@tft/crispr-forms 13.0.21 → 14.0.0
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 +77 -76
- package/esm2020/public-api.mjs +5 -0
- package/esm2020/src/index.mjs +2 -0
- package/esm2020/src/lib/crispr-forms.module.mjs +57 -0
- package/esm2020/src/lib/field-component-map.const.mjs +27 -0
- package/esm2020/src/lib/field.directive.mjs +69 -0
- package/esm2020/src/lib/form/form.component.mjs +63 -0
- package/esm2020/src/lib/form-group-list/form-group-list.component.mjs +93 -0
- package/esm2020/src/lib/form-group-list/index.mjs +2 -0
- package/esm2020/src/lib/pipes/crispr-pipes.module.mjs +24 -0
- package/esm2020/src/lib/pipes/initial-control-value.pipe.mjs +21 -0
- package/esm2020/src/lib/public_api.mjs +3 -0
- package/esm2020/src/lib/sub-group/index.mjs +3 -0
- package/esm2020/src/lib/sub-group/sub-group.component.mjs +21 -0
- package/esm2020/src/lib/sub-group/sub-group.module.mjs +42 -0
- package/esm2020/tft-crispr-forms.mjs +2 -2
- package/esm2020/ui/autocomplete-chiplist-field/autocomplete-chiplist-field.component.mjs +130 -0
- package/esm2020/ui/autocomplete-chiplist-field/public-api.mjs +2 -0
- package/esm2020/ui/autocomplete-chiplist-field/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs +5 -0
- package/esm2020/ui/autocomplete-field/autocomplete-field.component.mjs +93 -0
- package/esm2020/ui/autocomplete-field/public-api.mjs +2 -0
- package/esm2020/ui/autocomplete-field/tft-crispr-forms-ui-autocomplete-field.mjs +5 -0
- package/esm2020/ui/button/button.component.mjs +49 -0
- package/esm2020/ui/button/public-api.mjs +2 -0
- package/esm2020/ui/button/tft-crispr-forms-ui-button.mjs +5 -0
- package/esm2020/ui/checkbox-field/checkbox-field.component.mjs +42 -0
- package/esm2020/ui/checkbox-field/public-api.mjs +2 -0
- package/esm2020/ui/checkbox-field/tft-crispr-forms-ui-checkbox-field.mjs +5 -0
- package/esm2020/ui/datepicker-field/datepicker-field.component.mjs +63 -0
- package/esm2020/ui/datepicker-field/public-api.mjs +2 -0
- package/esm2020/ui/datepicker-field/tft-crispr-forms-ui-datepicker-field.mjs +5 -0
- package/esm2020/ui/divider/divider.component.mjs +28 -0
- package/esm2020/ui/divider/public-api.mjs +2 -0
- package/esm2020/ui/divider/tft-crispr-forms-ui-divider.mjs +5 -0
- package/esm2020/ui/field-container/field-container.component.mjs +58 -0
- package/esm2020/ui/field-container/public-api.mjs +2 -0
- package/esm2020/ui/field-container/tft-crispr-forms-ui-field-container.mjs +5 -0
- package/esm2020/ui/file-dropzone/file-dropzone.directive.mjs +40 -0
- package/esm2020/ui/file-dropzone/public-api.mjs +2 -0
- package/esm2020/ui/file-dropzone/tft-crispr-forms-ui-file-dropzone.mjs +5 -0
- package/esm2020/ui/file-upload-field/file-upload-field.component.mjs +108 -0
- package/esm2020/ui/file-upload-field/public-api.mjs +2 -0
- package/esm2020/ui/file-upload-field/tft-crispr-forms-ui-file-upload-field.mjs +5 -0
- package/esm2020/ui/heading/heading.component.mjs +31 -0
- package/esm2020/ui/heading/public-api.mjs +2 -0
- package/esm2020/ui/heading/tft-crispr-forms-ui-heading.mjs +5 -0
- package/esm2020/ui/image-upload-field/image-upload-field.component.mjs +179 -0
- package/esm2020/ui/image-upload-field/public-api.mjs +2 -0
- package/esm2020/ui/image-upload-field/tft-crispr-forms-ui-image-upload-field.mjs +5 -0
- package/esm2020/ui/info/info.component.mjs +23 -0
- package/esm2020/ui/info/public-api.mjs +2 -0
- package/esm2020/ui/info/tft-crispr-forms-ui-info.mjs +5 -0
- package/esm2020/ui/input-field/input-field.component.mjs +41 -0
- package/esm2020/ui/input-field/public-api.mjs +2 -0
- package/esm2020/ui/input-field/tft-crispr-forms-ui-input-field.mjs +5 -0
- package/esm2020/ui/option/option.component.mjs +19 -0
- package/esm2020/ui/option/public-api.mjs +2 -0
- package/esm2020/ui/option/tft-crispr-forms-ui-option.mjs +5 -0
- package/esm2020/ui/public-api.mjs +7 -0
- package/esm2020/ui/radio-field/public-api.mjs +2 -0
- package/esm2020/ui/radio-field/radio-field.component.mjs +39 -0
- package/esm2020/ui/radio-field/tft-crispr-forms-ui-radio-field.mjs +5 -0
- package/esm2020/ui/select-field/public-api.mjs +2 -0
- package/esm2020/ui/select-field/select-field.component.mjs +73 -0
- package/esm2020/ui/select-field/tft-crispr-forms-ui-select-field.mjs +5 -0
- package/esm2020/ui/selected-file/public-api.mjs +2 -0
- package/esm2020/ui/selected-file/selected-file.component.mjs +26 -0
- package/esm2020/ui/selected-file/tft-crispr-forms-ui-selected-file.mjs +5 -0
- package/esm2020/ui/slider-field/public-api.mjs +2 -0
- package/esm2020/ui/slider-field/slider-field.component.mjs +44 -0
- package/esm2020/ui/slider-field/tft-crispr-forms-ui-slider-field.mjs +5 -0
- package/esm2020/ui/textarea-field/public-api.mjs +2 -0
- package/esm2020/ui/textarea-field/textarea-field.component.mjs +42 -0
- package/esm2020/ui/textarea-field/tft-crispr-forms-ui-textarea-field.mjs +5 -0
- package/esm2020/ui/tft-crispr-forms-ui.mjs +5 -0
- package/esm2020/ui/unit-conversion-field/public-api.mjs +2 -0
- package/esm2020/ui/unit-conversion-field/tft-crispr-forms-ui-unit-conversion-field.mjs +5 -0
- package/esm2020/ui/unit-conversion-field/unit-conversion-field.component.mjs +84 -0
- package/esm2020/utils/abstracts/autocomplete-field.abstract.mjs +30 -0
- package/esm2020/utils/abstracts/crispr-control.mixin.mjs +27 -0
- package/esm2020/utils/abstracts/crispr-field.abstract.mjs +20 -0
- package/esm2020/utils/abstracts/index.mjs +4 -0
- package/esm2020/utils/functions/buildFormGroupFromConfig.mjs +28 -0
- package/esm2020/utils/functions/callOptionsIfFunction.mjs +4 -0
- package/esm2020/utils/functions/createControlForType.mjs +19 -0
- package/esm2020/utils/functions/filterOptionsByLabel.mjs +11 -0
- package/esm2020/utils/functions/image-compression.helpers.mjs +50 -0
- package/esm2020/utils/functions/index.mjs +8 -0
- package/esm2020/utils/functions/isControlConfig.mjs +7 -0
- package/esm2020/utils/functions/observablifyOptions.mjs +29 -0
- package/esm2020/utils/models/autocomplete-chiplist-field.config.mjs +2 -0
- package/esm2020/utils/models/autocomplete-field.config.mjs +2 -0
- package/esm2020/utils/models/button.config.mjs +2 -0
- package/esm2020/utils/models/checkbox-field.config.mjs +2 -0
- package/esm2020/utils/models/crispr-field.config.mjs +23 -0
- package/esm2020/utils/models/datepicker-field.config.mjs +2 -0
- package/esm2020/utils/models/divider.config.mjs +2 -0
- package/esm2020/utils/models/file-upload-field.config.mjs +2 -0
- package/esm2020/utils/models/form-group-list.config.mjs +2 -0
- package/esm2020/utils/models/heading.config.mjs +3 -0
- package/esm2020/utils/models/image-upload-field.config.mjs +2 -0
- package/esm2020/utils/models/index.mjs +18 -0
- package/esm2020/utils/models/input-field.config.mjs +2 -0
- package/esm2020/utils/models/radio-field.config.mjs +2 -0
- package/esm2020/utils/models/select-field.config.mjs +2 -0
- package/esm2020/utils/models/slider-field.config.mjs +2 -0
- package/esm2020/utils/models/textarea-field.config.mjs +2 -0
- package/esm2020/utils/models/unit-conversion-field.config.mjs +2 -0
- package/esm2020/utils/operators/form.operators.mjs +24 -0
- package/esm2020/utils/operators/index.mjs +2 -0
- package/esm2020/utils/public-api.mjs +5 -0
- package/esm2020/utils/tft-crispr-forms-utils.mjs +5 -0
- package/fesm2015/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs +138 -0
- package/fesm2015/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-autocomplete-field.mjs +101 -0
- package/fesm2015/tft-crispr-forms-ui-autocomplete-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-button.mjs +55 -0
- package/fesm2015/tft-crispr-forms-ui-button.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-checkbox-field.mjs +49 -0
- package/fesm2015/tft-crispr-forms-ui-checkbox-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-datepicker-field.mjs +71 -0
- package/fesm2015/tft-crispr-forms-ui-datepicker-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-divider.mjs +34 -0
- package/fesm2015/tft-crispr-forms-ui-divider.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-field-container.mjs +64 -0
- package/fesm2015/tft-crispr-forms-ui-field-container.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-file-dropzone.mjs +47 -0
- package/fesm2015/tft-crispr-forms-ui-file-dropzone.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-file-upload-field.mjs +117 -0
- package/fesm2015/tft-crispr-forms-ui-file-upload-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-heading.mjs +37 -0
- package/fesm2015/tft-crispr-forms-ui-heading.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-image-upload-field.mjs +182 -0
- package/fesm2015/tft-crispr-forms-ui-image-upload-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-info.mjs +30 -0
- package/fesm2015/tft-crispr-forms-ui-info.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-input-field.mjs +48 -0
- package/fesm2015/tft-crispr-forms-ui-input-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-option.mjs +26 -0
- package/fesm2015/tft-crispr-forms-ui-option.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-radio-field.mjs +46 -0
- package/fesm2015/tft-crispr-forms-ui-radio-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-select-field.mjs +81 -0
- package/fesm2015/tft-crispr-forms-ui-select-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-selected-file.mjs +33 -0
- package/fesm2015/tft-crispr-forms-ui-selected-file.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-slider-field.mjs +51 -0
- package/fesm2015/tft-crispr-forms-ui-slider-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-textarea-field.mjs +49 -0
- package/fesm2015/tft-crispr-forms-ui-textarea-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui-unit-conversion-field.mjs +93 -0
- package/fesm2015/tft-crispr-forms-ui-unit-conversion-field.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-ui.mjs +12 -0
- package/fesm2015/tft-crispr-forms-ui.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms-utils.mjs +270 -0
- package/fesm2015/tft-crispr-forms-utils.mjs.map +1 -0
- package/fesm2015/tft-crispr-forms.mjs +117 -1730
- package/fesm2015/tft-crispr-forms.mjs.map +1 -1
- package/fesm2020/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs +137 -0
- package/fesm2020/tft-crispr-forms-ui-autocomplete-chiplist-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-autocomplete-field.mjs +100 -0
- package/fesm2020/tft-crispr-forms-ui-autocomplete-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-button.mjs +55 -0
- package/fesm2020/tft-crispr-forms-ui-button.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-checkbox-field.mjs +49 -0
- package/fesm2020/tft-crispr-forms-ui-checkbox-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-datepicker-field.mjs +70 -0
- package/fesm2020/tft-crispr-forms-ui-datepicker-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-divider.mjs +34 -0
- package/fesm2020/tft-crispr-forms-ui-divider.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-field-container.mjs +65 -0
- package/fesm2020/tft-crispr-forms-ui-field-container.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-file-dropzone.mjs +47 -0
- package/fesm2020/tft-crispr-forms-ui-file-dropzone.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-file-upload-field.mjs +115 -0
- package/fesm2020/tft-crispr-forms-ui-file-upload-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-heading.mjs +37 -0
- package/fesm2020/tft-crispr-forms-ui-heading.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-image-upload-field.mjs +185 -0
- package/fesm2020/tft-crispr-forms-ui-image-upload-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-info.mjs +30 -0
- package/fesm2020/tft-crispr-forms-ui-info.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-input-field.mjs +48 -0
- package/fesm2020/tft-crispr-forms-ui-input-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-option.mjs +26 -0
- package/fesm2020/tft-crispr-forms-ui-option.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-radio-field.mjs +46 -0
- package/fesm2020/tft-crispr-forms-ui-radio-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-select-field.mjs +80 -0
- package/fesm2020/tft-crispr-forms-ui-select-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-selected-file.mjs +33 -0
- package/fesm2020/tft-crispr-forms-ui-selected-file.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-slider-field.mjs +51 -0
- package/fesm2020/tft-crispr-forms-ui-slider-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-textarea-field.mjs +49 -0
- package/fesm2020/tft-crispr-forms-ui-textarea-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui-unit-conversion-field.mjs +91 -0
- package/fesm2020/tft-crispr-forms-ui-unit-conversion-field.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-ui.mjs +12 -0
- package/fesm2020/tft-crispr-forms-ui.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms-utils.mjs +269 -0
- package/fesm2020/tft-crispr-forms-utils.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms.mjs +117 -1723
- package/fesm2020/tft-crispr-forms.mjs.map +1 -1
- package/index.d.ts +5 -1
- package/package.json +188 -15
- package/public-api.d.ts +3 -0
- package/src/index.d.ts +1 -0
- package/src/lib/crispr-forms.module.d.ts +15 -0
- package/src/lib/field-component-map.const.d.ts +42 -0
- package/{lib → src/lib}/field.directive.d.ts +4 -10
- package/{lib → src/lib}/form/form.component.d.ts +3 -3
- package/{lib → src/lib}/form-group-list/form-group-list.component.d.ts +12 -14
- package/{lib → src/lib}/form-group-list/index.d.ts +0 -1
- package/{lib → src/lib}/pipes/crispr-pipes.module.d.ts +0 -0
- package/{lib → src/lib}/pipes/initial-control-value.pipe.d.ts +2 -2
- package/src/lib/public_api.d.ts +2 -0
- package/{lib → src/lib}/sub-group/index.d.ts +0 -0
- package/src/lib/sub-group/sub-group.component.d.ts +22 -0
- package/{lib → src/lib}/sub-group/sub-group.module.d.ts +2 -2
- package/tft-crispr-forms-14.0.0.tgz +0 -0
- package/ui/README.md +3 -0
- package/{lib/material → ui}/autocomplete-chiplist-field/autocomplete-chiplist-field.component.d.ts +2 -3
- package/ui/autocomplete-chiplist-field/index.d.ts +5 -0
- package/ui/autocomplete-chiplist-field/public-api.d.ts +1 -0
- package/{lib/material → ui}/autocomplete-field/autocomplete-field.component.d.ts +2 -3
- package/ui/autocomplete-field/index.d.ts +5 -0
- package/ui/autocomplete-field/public-api.d.ts +1 -0
- package/{lib/material → ui}/button/button.component.d.ts +2 -3
- package/ui/button/index.d.ts +5 -0
- package/ui/button/public-api.d.ts +1 -0
- package/ui/checkbox-field/checkbox-field.component.d.ts +21 -0
- package/ui/checkbox-field/index.d.ts +5 -0
- package/ui/checkbox-field/public-api.d.ts +1 -0
- package/{lib/material → ui}/datepicker-field/datepicker-field.component.d.ts +14 -17
- package/ui/datepicker-field/index.d.ts +5 -0
- package/ui/datepicker-field/public-api.d.ts +1 -0
- package/{lib/material → ui}/divider/divider.component.d.ts +2 -3
- package/ui/divider/index.d.ts +5 -0
- package/ui/divider/public-api.d.ts +1 -0
- package/{lib → ui}/field-container/field-container.component.d.ts +3 -10
- package/ui/field-container/index.d.ts +5 -0
- package/{lib/field-container/index.d.ts → ui/field-container/public-api.d.ts} +0 -0
- package/{lib/material/file-upload → ui/file-dropzone}/file-dropzone.directive.d.ts +1 -1
- package/ui/file-dropzone/index.d.ts +5 -0
- package/{lib/material/file-upload/index.d.ts → ui/file-dropzone/public-api.d.ts} +0 -1
- package/ui/file-upload-field/file-upload-field.component.d.ts +37 -0
- package/ui/file-upload-field/index.d.ts +5 -0
- package/ui/file-upload-field/public-api.d.ts +1 -0
- package/ui/heading/heading.component.d.ts +8 -0
- package/ui/heading/index.d.ts +5 -0
- package/ui/heading/public-api.d.ts +1 -0
- package/ui/image-upload-field/image-upload-field.component.d.ts +48 -0
- package/ui/image-upload-field/index.d.ts +5 -0
- package/{lib/material/image-upload-field/index.d.ts → ui/image-upload-field/public-api.d.ts} +0 -0
- package/ui/index.d.ts +5 -0
- package/ui/info/index.d.ts +5 -0
- package/ui/info/info.component.d.ts +7 -0
- package/ui/info/public-api.d.ts +1 -0
- package/ui/input-field/index.d.ts +5 -0
- package/ui/input-field/input-field.component.d.ts +22 -0
- package/ui/input-field/public-api.d.ts +1 -0
- package/ui/option/index.d.ts +5 -0
- package/{lib/material → ui}/option/option.component.d.ts +2 -2
- package/{lib/material/option/index.d.ts → ui/option/public-api.d.ts} +0 -0
- package/ui/public-api.d.ts +5 -0
- package/ui/radio-field/index.d.ts +5 -0
- package/ui/radio-field/public-api.d.ts +1 -0
- package/ui/radio-field/radio-field.component.d.ts +23 -0
- package/ui/select-field/index.d.ts +5 -0
- package/ui/select-field/public-api.d.ts +1 -0
- package/{lib/material → ui}/select-field/select-field.component.d.ts +12 -14
- package/ui/selected-file/index.d.ts +5 -0
- package/ui/selected-file/public-api.d.ts +1 -0
- package/ui/selected-file/selected-file.component.d.ts +10 -0
- package/ui/slider-field/index.d.ts +5 -0
- package/ui/slider-field/public-api.d.ts +1 -0
- package/ui/slider-field/slider-field.component.d.ts +25 -0
- package/ui/textarea-field/index.d.ts +5 -0
- package/ui/textarea-field/public-api.d.ts +1 -0
- package/ui/textarea-field/textarea-field.component.d.ts +21 -0
- package/ui/unit-conversion-field/index.d.ts +5 -0
- package/ui/unit-conversion-field/public-api.d.ts +1 -0
- package/{lib/material → ui}/unit-conversion-field/unit-conversion-field.component.d.ts +14 -17
- package/utils/README.md +3 -0
- package/{lib → utils}/abstracts/autocomplete-field.abstract.d.ts +4 -4
- package/{lib → utils}/abstracts/crispr-control.mixin.d.ts +0 -0
- package/{lib → utils}/abstracts/crispr-field.abstract.d.ts +1 -1
- package/{lib → utils}/abstracts/index.d.ts +0 -0
- package/utils/functions/buildFormGroupFromConfig.d.ts +9 -0
- package/utils/functions/callOptionsIfFunction.d.ts +3 -0
- package/utils/functions/createControlForType.d.ts +9 -0
- package/utils/functions/filterOptionsByLabel.d.ts +7 -0
- package/utils/functions/image-compression.helpers.d.ts +5 -0
- package/utils/functions/index.d.ts +7 -0
- package/utils/functions/isControlConfig.d.ts +5 -0
- package/utils/functions/observablifyOptions.d.ts +12 -0
- package/utils/index.d.ts +5 -0
- package/{lib → utils}/models/autocomplete-chiplist-field.config.d.ts +2 -1
- package/{lib → utils}/models/autocomplete-field.config.d.ts +1 -2
- package/{lib → utils}/models/button.config.d.ts +0 -0
- package/{lib → utils}/models/checkbox-field.config.d.ts +1 -2
- package/{lib → utils}/models/crispr-field.config.d.ts +5 -7
- package/{lib → utils}/models/datepicker-field.config.d.ts +4 -6
- package/{lib → utils}/models/divider.config.d.ts +1 -1
- package/{lib → utils}/models/file-upload-field.config.d.ts +9 -4
- package/{lib → utils}/models/form-group-list.config.d.ts +1 -2
- package/{lib → utils}/models/heading.config.d.ts +1 -2
- package/{lib → utils}/models/image-upload-field.config.d.ts +2 -1
- package/{lib → utils}/models/index.d.ts +0 -0
- package/{lib → utils}/models/input-field.config.d.ts +1 -2
- package/{lib → utils}/models/radio-field.config.d.ts +0 -0
- package/{lib → utils}/models/select-field.config.d.ts +2 -2
- package/{lib → utils}/models/slider-field.config.d.ts +1 -2
- package/{lib → utils}/models/textarea-field.config.d.ts +1 -2
- package/{lib → utils}/models/unit-conversion-field.config.d.ts +1 -2
- package/{lib → utils/operators}/form.operators.d.ts +0 -0
- package/utils/operators/index.d.ts +1 -0
- package/utils/public-api.d.ts +4 -0
- package/esm2020/index.mjs +0 -2
- package/esm2020/lib/abstracts/autocomplete-field.abstract.mjs +0 -30
- package/esm2020/lib/abstracts/crispr-control.mixin.mjs +0 -27
- package/esm2020/lib/abstracts/crispr-field.abstract.mjs +0 -17
- package/esm2020/lib/abstracts/index.mjs +0 -4
- package/esm2020/lib/crispr-forms.module.mjs +0 -66
- package/esm2020/lib/field-component-map.const.mjs +0 -28
- package/esm2020/lib/field-container/field-container.component.mjs +0 -85
- package/esm2020/lib/field-container/index.mjs +0 -2
- package/esm2020/lib/field.directive.mjs +0 -90
- package/esm2020/lib/form/form.component.mjs +0 -53
- package/esm2020/lib/form-group-list/form-group-list.component.mjs +0 -77
- package/esm2020/lib/form-group-list/form-group-list.module.mjs +0 -54
- package/esm2020/lib/form-group-list/index.mjs +0 -3
- package/esm2020/lib/form.helpers.mjs +0 -190
- package/esm2020/lib/form.operators.mjs +0 -24
- package/esm2020/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.mjs +0 -111
- package/esm2020/lib/material/autocomplete-field/autocomplete-field.component.mjs +0 -78
- package/esm2020/lib/material/button/button.component.mjs +0 -35
- package/esm2020/lib/material/checkbox-field/checkbox-field.component.mjs +0 -31
- package/esm2020/lib/material/datepicker-field/datepicker-field.component.mjs +0 -45
- package/esm2020/lib/material/divider/divider.component.mjs +0 -22
- package/esm2020/lib/material/file-upload/file-dropzone.directive.mjs +0 -39
- package/esm2020/lib/material/file-upload/file-upload.component.mjs +0 -145
- package/esm2020/lib/material/file-upload/index.mjs +0 -3
- package/esm2020/lib/material/heading/heading.component.mjs +0 -54
- package/esm2020/lib/material/image-upload-field/image-compression.helpers.mjs +0 -4
- package/esm2020/lib/material/image-upload-field/image-upload-field.component.mjs +0 -265
- package/esm2020/lib/material/image-upload-field/index.mjs +0 -2
- package/esm2020/lib/material/index.mjs +0 -18
- package/esm2020/lib/material/info/info.component.mjs +0 -46
- package/esm2020/lib/material/input-field/input-field.component.mjs +0 -27
- package/esm2020/lib/material/material.module.mjs +0 -200
- package/esm2020/lib/material/option/index.mjs +0 -2
- package/esm2020/lib/material/option/option.component.mjs +0 -14
- package/esm2020/lib/material/radio-field/radio-field.component.mjs +0 -29
- package/esm2020/lib/material/select-field/select-field.component.mjs +0 -58
- package/esm2020/lib/material/selected-file/selected-file.component.mjs +0 -47
- package/esm2020/lib/material/slider-field/slider-field.component.mjs +0 -30
- package/esm2020/lib/material/textarea-field/textarea-field.component.mjs +0 -28
- package/esm2020/lib/material/unit-conversion-field/unit-conversion-field.component.mjs +0 -69
- package/esm2020/lib/models/autocomplete-chiplist-field.config.mjs +0 -2
- package/esm2020/lib/models/autocomplete-field.config.mjs +0 -2
- package/esm2020/lib/models/button.config.mjs +0 -2
- package/esm2020/lib/models/checkbox-field.config.mjs +0 -2
- package/esm2020/lib/models/crispr-field.config.mjs +0 -23
- package/esm2020/lib/models/datepicker-field.config.mjs +0 -2
- package/esm2020/lib/models/divider.config.mjs +0 -2
- package/esm2020/lib/models/file-upload-field.config.mjs +0 -2
- package/esm2020/lib/models/form-group-list.config.mjs +0 -2
- package/esm2020/lib/models/heading.config.mjs +0 -3
- package/esm2020/lib/models/image-upload-field.config.mjs +0 -2
- package/esm2020/lib/models/index.mjs +0 -18
- package/esm2020/lib/models/input-field.config.mjs +0 -2
- package/esm2020/lib/models/radio-field.config.mjs +0 -2
- package/esm2020/lib/models/select-field.config.mjs +0 -2
- package/esm2020/lib/models/slider-field.config.mjs +0 -2
- package/esm2020/lib/models/textarea-field.config.mjs +0 -2
- package/esm2020/lib/models/unit-conversion-field.config.mjs +0 -2
- package/esm2020/lib/pipes/crispr-pipes.module.mjs +0 -26
- package/esm2020/lib/pipes/initial-control-value.pipe.mjs +0 -20
- package/esm2020/lib/public_api.mjs +0 -10
- package/esm2020/lib/sub-group/index.mjs +0 -3
- package/esm2020/lib/sub-group/sub-group.component.mjs +0 -20
- package/esm2020/lib/sub-group/sub-group.module.mjs +0 -45
- package/lib/crispr-forms.module.d.ts +0 -16
- package/lib/field-component-map.const.d.ts +0 -28
- package/lib/form-group-list/form-group-list.module.d.ts +0 -15
- package/lib/form.helpers.d.ts +0 -88
- package/lib/material/checkbox-field/checkbox-field.component.d.ts +0 -23
- package/lib/material/file-upload/file-upload.component.d.ts +0 -54
- package/lib/material/heading/heading.component.d.ts +0 -17
- package/lib/material/image-upload-field/image-compression.helpers.d.ts +0 -1
- package/lib/material/image-upload-field/image-upload-field.component.d.ts +0 -68
- package/lib/material/index.d.ts +0 -17
- package/lib/material/info/info.component.d.ts +0 -15
- package/lib/material/input-field/input-field.component.d.ts +0 -24
- package/lib/material/material.module.d.ts +0 -44
- package/lib/material/radio-field/radio-field.component.d.ts +0 -26
- package/lib/material/selected-file/selected-file.component.d.ts +0 -17
- package/lib/material/slider-field/slider-field.component.d.ts +0 -27
- package/lib/material/textarea-field/textarea-field.component.d.ts +0 -24
- package/lib/public_api.d.ts +0 -9
- package/lib/sub-group/sub-group.component.d.ts +0 -24
- package/tft-crispr-forms-13.0.21.tgz +0 -0
- package/tft-crispr-forms.d.ts +0 -5
|
@@ -1,1591 +1,40 @@
|
|
|
1
|
-
import { of, combineLatest, from, isObservable, BehaviorSubject, Subject } from 'rxjs';
|
|
2
|
-
import * as i4$1 from '@angular/forms';
|
|
3
|
-
import { FormGroup, FormArray, FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
-
import { map, startWith, debounceTime, distinctUntilChanged, switchMap, shareReplay, tap } from 'rxjs/operators';
|
|
5
1
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { Directive,
|
|
7
|
-
import * as
|
|
2
|
+
import { Directive, Input, Pipe, NgModule, EventEmitter, Component, Output, ViewChild, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
8
4
|
import { CommonModule } from '@angular/common';
|
|
9
|
-
import * as i2
|
|
10
|
-
import {
|
|
11
|
-
import * as
|
|
12
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
13
|
-
import * as i3 from '@angular/material/tooltip';
|
|
14
|
-
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
15
|
-
import * as i5 from '@tft/form-validation-handler';
|
|
5
|
+
import * as i2 from '@angular/forms';
|
|
6
|
+
import { FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
7
|
+
import * as i3$1 from '@tft/form-validation-handler';
|
|
16
8
|
import { FormValidationHandlerModule } from '@tft/form-validation-handler';
|
|
17
|
-
import * as i7 from '@angular/material/input';
|
|
18
|
-
import { MatInputModule } from '@angular/material/input';
|
|
19
|
-
import * as i3$1 from '@angular/material/select';
|
|
20
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
21
|
-
import * as i4$2 from '@angular/material/checkbox';
|
|
22
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
23
|
-
import * as i5$1 from '@angular/material/core';
|
|
24
|
-
import * as i4$3 from '@angular/material/autocomplete';
|
|
25
|
-
import { MatAutocompleteTrigger, MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
26
|
-
import { ENTER } from '@angular/cdk/keycodes';
|
|
27
|
-
import * as i3$2 from '@angular/material/chips';
|
|
28
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
29
|
-
import * as i3$3 from '@angular/material/slider';
|
|
30
|
-
import { MatSliderModule } from '@angular/material/slider';
|
|
31
|
-
import * as i1 from '@angular/material/button';
|
|
32
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
33
|
-
import * as i8 from '@angular/cdk/portal';
|
|
34
|
-
import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
|
|
35
|
-
import * as i3$4 from '@angular/material/datepicker';
|
|
36
|
-
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
37
|
-
import * as i1$1 from '@angular/material/divider';
|
|
38
|
-
import { MatDividerModule } from '@angular/material/divider';
|
|
39
|
-
import * as i2$2 from '@angular/material/radio';
|
|
40
|
-
import { MatRadioModule } from '@angular/material/radio';
|
|
41
9
|
import { __awaiter } from 'tslib';
|
|
42
|
-
import
|
|
43
|
-
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import {
|
|
48
|
-
import
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
// export type ControlType = keyof typeof FIELD_COMPONENTS;
|
|
53
|
-
var ControlType;
|
|
54
|
-
(function (ControlType) {
|
|
55
|
-
ControlType["AUTOCOMPLETE"] = "autocomplete";
|
|
56
|
-
ControlType["AUTOCOMPLETE_CHIPLIST"] = "autocompleteChiplist";
|
|
57
|
-
ControlType["BUTTON"] = "button";
|
|
58
|
-
ControlType["CHECKBOX"] = "checkbox";
|
|
59
|
-
ControlType["CUSTOM"] = "custom";
|
|
60
|
-
ControlType["DATEPICKER"] = "datepicker";
|
|
61
|
-
ControlType["DIVIDER"] = "divider";
|
|
62
|
-
ControlType["FILE_UPLOAD"] = "fileUpload";
|
|
63
|
-
ControlType["HEADING"] = "heading";
|
|
64
|
-
ControlType["INPUT"] = "input";
|
|
65
|
-
ControlType["IMAGE_UPLOAD"] = "imageUpload";
|
|
66
|
-
ControlType["GROUP_LIST"] = "groupList";
|
|
67
|
-
ControlType["RADIO"] = "radio";
|
|
68
|
-
ControlType["SELECT"] = "select";
|
|
69
|
-
ControlType["SLIDER"] = "slider";
|
|
70
|
-
ControlType["SUB_GROUP"] = "subGroup";
|
|
71
|
-
ControlType["TEXTAREA"] = "textarea";
|
|
72
|
-
ControlType["UNIT_CONVERSION"] = "unitConversion";
|
|
73
|
-
})(ControlType || (ControlType = {}));
|
|
74
|
-
|
|
75
|
-
;
|
|
76
|
-
|
|
77
|
-
function valueIn(values) {
|
|
78
|
-
return map((value) => {
|
|
79
|
-
if (value) {
|
|
80
|
-
return values.some(v => {
|
|
81
|
-
if (isRegex(v)) {
|
|
82
|
-
const trimmedStringForRegex = v.substr(1, v.length - 2);
|
|
83
|
-
const regex = new RegExp(trimmedStringForRegex);
|
|
84
|
-
return regex.test(value);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
return v === value;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
function isRegex(string) {
|
|
97
|
-
return string.startsWith('/') && string.endsWith('/');
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Watches a single control for a list of values, returns true when field value matches any value in list
|
|
102
|
-
* unless an evaluate method is found on config, in which case that method is run on the returned boolean value
|
|
103
|
-
* @param group the direct parent of the field we want to watch
|
|
104
|
-
* @param config
|
|
105
|
-
*/
|
|
106
|
-
function checkControlForValues(group, config) {
|
|
107
|
-
// check that all the pieces we need are available
|
|
108
|
-
if (config && config.controlName && Array.isArray(config.values)) {
|
|
109
|
-
return getValueChanges(group, config.controlName).pipe(
|
|
110
|
-
// return a boolean, true if value is in the values being watch for, otherwise false
|
|
111
|
-
valueIn(config.values), map((isValueInValues) => {
|
|
112
|
-
// since we can only check if the value is in the list of watched values, the evaluate function gives us
|
|
113
|
-
// a chance to make other decisions based on if the boolean returned, e.g. return true if value not in watched values
|
|
114
|
-
if (config.evaluate && config.evaluate instanceof Function) {
|
|
115
|
-
return config.evaluate(isValueInValues);
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
return isValueInValues;
|
|
119
|
-
}
|
|
120
|
-
}));
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
//
|
|
124
|
-
return of(true);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Watches a list of fields for individual lists of values returning true when any field contains one
|
|
129
|
-
* of the values being watched for, or optionally running a function on the array of resolved booleans
|
|
130
|
-
* from the listed fields and returning a boolean
|
|
131
|
-
* @param group the form group that has the fields to watch as direct descendants
|
|
132
|
-
* @param config the configuration to use when calling the function
|
|
133
|
-
*/
|
|
134
|
-
function checkControlsForValues(group, config) {
|
|
135
|
-
// if no config is passed we just want to show the field, so we return an observable of true
|
|
136
|
-
if (!config || !config.watchConfigs) {
|
|
137
|
-
return of(true);
|
|
138
|
-
}
|
|
139
|
-
// we run checkControlForValues on every control in the list of WatchConfigs creating
|
|
140
|
-
// an array of Observable watching fields for values
|
|
141
|
-
const fieldTriggers = config.watchConfigs.map(watchConfig => {
|
|
142
|
-
// resolves a boolean, true when field value matches a watched value, otherwise false
|
|
143
|
-
return checkControlForValues(group, watchConfig);
|
|
144
|
-
});
|
|
145
|
-
return combineLatest(fieldTriggers).pipe(startWith([true]), map((booleans) => {
|
|
146
|
-
// if the user passed an evaluate function use it
|
|
147
|
-
if (config.evaluate && config.evaluate instanceof Function) {
|
|
148
|
-
return config.evaluate(booleans);
|
|
149
|
-
}
|
|
150
|
-
else { // otherwise we return true if any of the watched fields resolve to true
|
|
151
|
-
return booleans.some(bool => bool);
|
|
152
|
-
}
|
|
153
|
-
}));
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Watches values on an array of fields, computing their values as they change
|
|
157
|
-
* @param group the group to get the fields from, for now it can only be the parent of the computed field
|
|
158
|
-
* @param computeFieldsConfig the configuration that drives the computation, holds the names to watch and the
|
|
159
|
-
* computation function that get called against the array of values
|
|
160
|
-
*/
|
|
161
|
-
function computeValueFromFields(group, computeFieldsConfig) {
|
|
162
|
-
// TODO: better checking
|
|
163
|
-
const { controlNamesToWatch } = computeFieldsConfig;
|
|
164
|
-
//creates an observable listener for each control in the controlNamesToWatch array
|
|
165
|
-
return combineLatest(controlNamesToWatch.map(controlNameToWatch => getValueChanges(group, controlNameToWatch))).pipe(
|
|
166
|
-
// each time a watched field values changes a new array of the latest field values is pipe through to the
|
|
167
|
-
// compute callback. Which runs the users logic on the values to compute this fields value
|
|
168
|
-
map(valuesArray => computeFieldsConfig.computeCallback(valuesArray)));
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* A simple wrapper for doing error checking around getting the valueChanges observable from a control on a form group
|
|
172
|
-
* @param group the form group we want to pull the observable from
|
|
173
|
-
* @param controlName the name of the control who's value we want to subscribe to
|
|
174
|
-
*/
|
|
175
|
-
function getValueChanges(group, controlName) {
|
|
176
|
-
const control = group.get(controlName);
|
|
177
|
-
if (!control) {
|
|
178
|
-
throw new Error(`No control with controlName ${controlName}`);
|
|
179
|
-
}
|
|
180
|
-
return control.valueChanges;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* TODO: move to utils library after library is built
|
|
184
|
-
* Allows developer to pass an array of operators into the pipe of an Observable.
|
|
185
|
-
* Useful for creating function with a variable amount of operators to be run
|
|
186
|
-
* @param observable the observable to pass the operators to
|
|
187
|
-
* @param operators array of operators to pipe
|
|
188
|
-
*/
|
|
189
|
-
function pipeOperatorsIntoObservable(observable, operators) {
|
|
190
|
-
try {
|
|
191
|
-
return operators.reduce((obs, op) => {
|
|
192
|
-
return obs.pipe(op);
|
|
193
|
-
}, observable);
|
|
194
|
-
}
|
|
195
|
-
catch (_a) {
|
|
196
|
-
console.error('Unable to pipe operators into observable');
|
|
197
|
-
return of(null);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
function callOptionsIfFunction(options, parentGroup, searchString) {
|
|
201
|
-
return options instanceof Function ? options(parentGroup, searchString) : options;
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* The user can give us select options as an array, a function that resolves to a promise,
|
|
205
|
-
* or an observable. This functions consumes any of those and returns an observable that
|
|
206
|
-
* resolves an array of options
|
|
207
|
-
*
|
|
208
|
-
* @param options the options passed in from the config
|
|
209
|
-
* @param emptyMessageOption the message to display when the array is empty
|
|
210
|
-
*/
|
|
211
|
-
function observablifyOptions(options, parentGroup, searchString) {
|
|
212
|
-
const calledOptions = callOptionsIfFunction(options, parentGroup, searchString);
|
|
213
|
-
// if options are a promise
|
|
214
|
-
const observableOptions = calledOptions instanceof Promise
|
|
215
|
-
// convert to observable
|
|
216
|
-
? from(calledOptions)
|
|
217
|
-
// if array that isn't empty
|
|
218
|
-
: Array.isArray(calledOptions) && calledOptions.length
|
|
219
|
-
// convert to observable
|
|
220
|
-
? of(calledOptions)
|
|
221
|
-
// if observable
|
|
222
|
-
: isObservable(calledOptions)
|
|
223
|
-
// return it
|
|
224
|
-
? calledOptions
|
|
225
|
-
// else an empty array
|
|
226
|
-
: of([]);
|
|
227
|
-
return observableOptions;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Determines if the field config is for a form control (not a divider, heading or other non-control field)
|
|
231
|
-
* */
|
|
232
|
-
function isControlConfig(fieldConfig) {
|
|
233
|
-
return 'controlName' in fieldConfig;
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* builds out form group based on config
|
|
237
|
-
* @param config a configuration for a form group
|
|
238
|
-
* @param value an object of initial values to pass in
|
|
239
|
-
* @param group the form group to modify and build out
|
|
240
|
-
*/
|
|
241
|
-
function buildFormGroupFromConfig(config, value = null, group = new FormGroup({})) {
|
|
242
|
-
config.fields.forEach((controlConfig) => {
|
|
243
|
-
var _a;
|
|
244
|
-
if (isControlConfig(controlConfig)) {
|
|
245
|
-
// then add a control to the group using the controlName from configuration
|
|
246
|
-
const { controlName } = controlConfig;
|
|
247
|
-
if (group.get(controlName)) {
|
|
248
|
-
group.removeControl(controlName);
|
|
249
|
-
}
|
|
250
|
-
// if there's a value object and it has a non-null/undefined value for this field use it.
|
|
251
|
-
// Otherwise, default to null
|
|
252
|
-
const controlValue = (_a = (value && value[controlName])) !== null && _a !== void 0 ? _a : null;
|
|
253
|
-
const control = createControlForType(controlConfig, controlValue);
|
|
254
|
-
group.addControl(controlName, control);
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
group.setValidators(config.validators);
|
|
258
|
-
return group;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Analyze the config and build a form control to spec. Notice we don't use FormBuilder here
|
|
262
|
-
* as we want to keep this function pure.
|
|
263
|
-
* @param controlConfig the configuration object for the control to build
|
|
264
|
-
* @param value an initial value to use if passed in
|
|
265
|
-
*/
|
|
266
|
-
function createControlForType(controlConfig, value = null) {
|
|
267
|
-
// build form control out based on the control type
|
|
268
|
-
const control = controlConfig.controlType === ControlType.SUB_GROUP
|
|
269
|
-
? buildFormGroupFromConfig(controlConfig, value)
|
|
270
|
-
: controlConfig.controlType === ControlType.GROUP_LIST
|
|
271
|
-
? new FormArray([], controlConfig.validators)
|
|
272
|
-
: new FormControl(value || null, controlConfig.validators);
|
|
273
|
-
return control;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* A basic filter function that filters the search string against the label of the options object
|
|
277
|
-
* @param options the array of options to filter
|
|
278
|
-
* @param searchString the string from the input
|
|
279
|
-
*/
|
|
280
|
-
function filterOptionsByLabel(options, searchString) {
|
|
281
|
-
return options.filter(option => {
|
|
282
|
-
return option.label && option.label.toLowerCase().includes(searchString.toLowerCase());
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
function crisprControlMixin(BaseClass) {
|
|
287
|
-
return class extends BaseClass {
|
|
288
|
-
set value(value) {
|
|
289
|
-
this.setControlValue(value);
|
|
290
|
-
this._value = value;
|
|
291
|
-
}
|
|
292
|
-
get value() {
|
|
293
|
-
return this._value;
|
|
294
|
-
}
|
|
295
|
-
ngOnInit() {
|
|
296
|
-
super.ngOnInit();
|
|
297
|
-
this.control = this.group.get(this.config.controlName);
|
|
298
|
-
this.setControlValue(this.value);
|
|
299
|
-
// setTimeouts are ugly but this seems to be the only way to get the computed field to compute initial values
|
|
300
|
-
setTimeout(() => {
|
|
301
|
-
this.control.updateValueAndValidity();
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
setControlValue(value) {
|
|
305
|
-
if (value && this.control && this.config.controlType !== ControlType.SUB_GROUP) {
|
|
306
|
-
this.control.setValue(value);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
313
|
-
class CrisprFieldComponent {
|
|
314
|
-
ngOnInit() {
|
|
315
|
-
this.applyDefaultConfig();
|
|
316
|
-
}
|
|
317
|
-
applyDefaultConfig() {
|
|
318
|
-
this.config = this.defaultConfig ? Object.assign(Object.assign({}, this.defaultConfig), this.config) : this.config;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
CrisprFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
322
|
-
CrisprFieldComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.1", type: CrisprFieldComponent, ngImport: i0 });
|
|
323
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprFieldComponent, decorators: [{
|
|
324
|
-
type: Directive
|
|
325
|
-
}] });
|
|
326
|
-
|
|
327
|
-
const AbstractAutocompleteFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
328
|
-
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
329
|
-
class AbstractAutocompleteComponent extends AbstractAutocompleteFieldMixin {
|
|
330
|
-
constructor() {
|
|
331
|
-
super(...arguments);
|
|
332
|
-
// we need a separate control for the UI because of the way the material autocomplete chiplist works
|
|
333
|
-
this.autocompleteInputControl = new FormControl('');
|
|
334
|
-
}
|
|
335
|
-
ngOnInit() {
|
|
336
|
-
super.ngOnInit();
|
|
337
|
-
this.group.addControl(this.config.controlName, new FormControl());
|
|
338
|
-
// filter options by the search string using either the default filter function or one passed in through config
|
|
339
|
-
this.options$ = this.autocompleteInputControl.valueChanges.pipe(
|
|
340
|
-
// this is needed to have the options panel to open on focus
|
|
341
|
-
startWith(''), debounceTime(this.config.typeDebounceTime), map((searchText) => typeof searchText === 'string' ? searchText === null || searchText === void 0 ? void 0 : searchText.trim() : ''), distinctUntilChanged(), switchMap((searchText) => observablifyOptions(this.config.options, this.group, searchText)), shareReplay(1));
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
AbstractAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: AbstractAutocompleteComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
345
|
-
AbstractAutocompleteComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.1", type: AbstractAutocompleteComponent, usesInheritance: true, ngImport: i0 });
|
|
346
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: AbstractAutocompleteComponent, decorators: [{
|
|
347
|
-
type: Directive
|
|
348
|
-
}] });
|
|
349
|
-
|
|
350
|
-
class InfoComponent {
|
|
351
|
-
}
|
|
352
|
-
InfoComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: InfoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
353
|
-
InfoComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: InfoComponent, selector: "crispr-info", inputs: { info: "info" }, ngImport: i0, template: "<mat-icon\n *ngIf=\"info\"\n [matTooltip]=\"info.content\"\n [matTooltipPosition]=\"info.tooltipPosition || 'below'\"\n matSuffix>\n info\n</mat-icon>\n", styles: ["mat-icon{font-size:1.2em;width:1em;height:1em;opacity:.8}\n"], components: [{ type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
354
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: InfoComponent, decorators: [{
|
|
355
|
-
type: Component,
|
|
356
|
-
args: [{ selector: 'crispr-info', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-icon\n *ngIf=\"info\"\n [matTooltip]=\"info.content\"\n [matTooltipPosition]=\"info.tooltipPosition || 'below'\"\n matSuffix>\n info\n</mat-icon>\n", styles: ["mat-icon{font-size:1.2em;width:1em;height:1em;opacity:.8}\n"] }]
|
|
357
|
-
}], propDecorators: { info: [{
|
|
358
|
-
type: Input
|
|
359
|
-
}] } });
|
|
360
|
-
class InfoModule {
|
|
361
|
-
}
|
|
362
|
-
InfoModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: InfoModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
363
|
-
InfoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: InfoModule, declarations: [InfoComponent], imports: [CommonModule,
|
|
364
|
-
MatIconModule,
|
|
365
|
-
MatTooltipModule], exports: [InfoComponent] });
|
|
366
|
-
InfoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: InfoModule, imports: [[
|
|
367
|
-
CommonModule,
|
|
368
|
-
MatIconModule,
|
|
369
|
-
MatTooltipModule
|
|
370
|
-
]] });
|
|
371
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: InfoModule, decorators: [{
|
|
372
|
-
type: NgModule,
|
|
373
|
-
args: [{
|
|
374
|
-
imports: [
|
|
375
|
-
CommonModule,
|
|
376
|
-
MatIconModule,
|
|
377
|
-
MatTooltipModule
|
|
378
|
-
],
|
|
379
|
-
exports: [
|
|
380
|
-
InfoComponent
|
|
381
|
-
],
|
|
382
|
-
declarations: [
|
|
383
|
-
InfoComponent
|
|
384
|
-
]
|
|
385
|
-
}]
|
|
386
|
-
}] });
|
|
387
|
-
|
|
388
|
-
const defaultConfig$8 = {
|
|
389
|
-
typographyClass: 'mat-h3'
|
|
390
|
-
};
|
|
391
|
-
class HeadingComponent extends CrisprFieldComponent {
|
|
392
|
-
constructor() {
|
|
393
|
-
super(...arguments);
|
|
394
|
-
this.defaultConfig = defaultConfig$8;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
HeadingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: HeadingComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
398
|
-
HeadingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: HeadingComponent, selector: "crispr-heading", inputs: { config: "config" }, usesInheritance: true, ngImport: i0, 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", styles: [":host{display:block}\n"], components: [{ type: InfoComponent, selector: "crispr-info", inputs: ["info"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2$1.MatSuffix, selector: "[matSuffix]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
399
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: HeadingComponent, decorators: [{
|
|
400
|
-
type: Component,
|
|
401
|
-
args: [{ selector: 'crispr-heading', changeDetection: ChangeDetectionStrategy.OnPush, 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", styles: [":host{display:block}\n"] }]
|
|
402
|
-
}], propDecorators: { config: [{
|
|
403
|
-
type: Input
|
|
404
|
-
}] } });
|
|
405
|
-
class HeadingModule {
|
|
406
|
-
}
|
|
407
|
-
HeadingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: HeadingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
408
|
-
HeadingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: HeadingModule, declarations: [HeadingComponent], imports: [CommonModule,
|
|
409
|
-
MatFormFieldModule,
|
|
410
|
-
InfoModule], exports: [HeadingComponent] });
|
|
411
|
-
HeadingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: HeadingModule, imports: [[
|
|
412
|
-
CommonModule,
|
|
413
|
-
MatFormFieldModule,
|
|
414
|
-
InfoModule
|
|
415
|
-
]] });
|
|
416
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: HeadingModule, decorators: [{
|
|
417
|
-
type: NgModule,
|
|
418
|
-
args: [{
|
|
419
|
-
imports: [
|
|
420
|
-
CommonModule,
|
|
421
|
-
MatFormFieldModule,
|
|
422
|
-
InfoModule
|
|
423
|
-
],
|
|
424
|
-
exports: [
|
|
425
|
-
HeadingComponent
|
|
426
|
-
],
|
|
427
|
-
declarations: [
|
|
428
|
-
HeadingComponent
|
|
429
|
-
]
|
|
430
|
-
}]
|
|
431
|
-
}] });
|
|
432
|
-
|
|
433
|
-
class FieldContainerComponent {
|
|
434
|
-
constructor() {
|
|
435
|
-
// boolean whether field-container is inline
|
|
436
|
-
this.inlineField = false;
|
|
437
|
-
this.subs = [];
|
|
438
|
-
}
|
|
439
|
-
ngOnInit() {
|
|
440
|
-
this.disabled$ = this.connectDisabledCallback(this.group, this.config);
|
|
441
|
-
// we tried moving this into afterViewChecked and afterContentChecked lifecycle hooks without any luck
|
|
442
|
-
if (this.config.computeValue) {
|
|
443
|
-
this.subs.push(this.config.computeValue(this.group).pipe(distinctUntilChanged(), tap(computedValue => this.group.get(this.config.controlName).setValue(computedValue))).subscribe());
|
|
444
|
-
}
|
|
445
|
-
else if (this.config.computeFieldConfig) {
|
|
446
|
-
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`);
|
|
447
|
-
this.subs.push(computeValueFromFields(this.group, this.config.computeFieldConfig).pipe(distinctUntilChanged(), tap(computedValue => this.group.get(this.config.controlName).setValue(computedValue))).subscribe());
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
ngOnDestroy() {
|
|
451
|
-
this.subs.forEach(sub => sub.unsubscribe);
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Connects user defined disabledCallback function to the the view, so that the control is enabled/disabled
|
|
455
|
-
* appropriately. It also keeps the form will hide disabled fields in the UI unless `hideDisabled` is set to
|
|
456
|
-
* false in the controls config
|
|
457
|
-
* @param group used to get valueChanges from control
|
|
458
|
-
* @param config configuration object used to
|
|
459
|
-
*/
|
|
460
|
-
connectDisabledCallback(group, config = null) {
|
|
461
|
-
const control = group.get(config.controlName);
|
|
462
|
-
// If the disabled$ function exists on the field config then call it with the disabledCallbackConfig
|
|
463
|
-
// as a parameter otherwise return an observable of true.
|
|
464
|
-
return (config === null || config === void 0 ? void 0 : config.disabledCallback) && config.disabledCallback instanceof Function
|
|
465
|
-
? config.disabledCallback(group, config.disabledCallbackConfig || null).pipe(
|
|
466
|
-
// This enables/disables when callback conditions are met
|
|
467
|
-
tap((shouldDisable) => shouldDisable ? control.disable() : control.enable()))
|
|
468
|
-
: of(false);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
FieldContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FieldContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
472
|
-
FieldContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: FieldContainerComponent, selector: "crispr-field-container", inputs: { config: "config", group: "group", inlineField: "inlineField" }, ngImport: i0, 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", styles: ["::ng-deep mat-form-field.mat-form-field{display:block;padding:.25em 0}.inline-field{display:inline-block}\n"], components: [{ type: HeadingComponent, selector: "crispr-heading", inputs: ["config"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "async": i2.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
473
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FieldContainerComponent, decorators: [{
|
|
474
|
-
type: Component,
|
|
475
|
-
args: [{ selector: 'crispr-field-container', changeDetection: ChangeDetectionStrategy.OnPush, 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", styles: ["::ng-deep mat-form-field.mat-form-field{display:block;padding:.25em 0}.inline-field{display:inline-block}\n"] }]
|
|
476
|
-
}], propDecorators: { config: [{
|
|
477
|
-
type: Input
|
|
478
|
-
}], group: [{
|
|
479
|
-
type: Input
|
|
480
|
-
}], inlineField: [{
|
|
481
|
-
type: Input
|
|
482
|
-
}] } });
|
|
483
|
-
class FieldContainerModule {
|
|
484
|
-
}
|
|
485
|
-
FieldContainerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FieldContainerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
486
|
-
FieldContainerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FieldContainerModule, declarations: [FieldContainerComponent], imports: [CommonModule,
|
|
487
|
-
HeadingModule], exports: [FieldContainerComponent] });
|
|
488
|
-
FieldContainerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FieldContainerModule, imports: [[
|
|
489
|
-
CommonModule,
|
|
490
|
-
HeadingModule,
|
|
491
|
-
]] });
|
|
492
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FieldContainerModule, decorators: [{
|
|
493
|
-
type: NgModule,
|
|
494
|
-
args: [{
|
|
495
|
-
imports: [
|
|
496
|
-
CommonModule,
|
|
497
|
-
HeadingModule,
|
|
498
|
-
],
|
|
499
|
-
exports: [
|
|
500
|
-
FieldContainerComponent
|
|
501
|
-
],
|
|
502
|
-
declarations: [
|
|
503
|
-
FieldContainerComponent
|
|
504
|
-
]
|
|
505
|
-
}]
|
|
506
|
-
}] });
|
|
507
|
-
|
|
508
|
-
const InputFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
509
|
-
class InputFieldComponent extends InputFieldMixin {
|
|
510
|
-
constructor() {
|
|
511
|
-
super();
|
|
512
|
-
this.defaultConfig = { inputType: 'text' };
|
|
513
|
-
}
|
|
514
|
-
ngOnInit() {
|
|
515
|
-
super.ngOnInit();
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
InputFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: InputFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
519
|
-
InputFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: InputFieldComponent, selector: "crispr-input-field", usesInheritance: true, ngImport: i0, 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>\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-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n\n</crispr-field-container>\n", styles: [""], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: InfoComponent, selector: "crispr-info", inputs: ["info"] }], directives: [{ type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { type: i2$1.MatLabel, selector: "mat-label" }, { type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { type: i4$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i4$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.MatSuffix, selector: "[matSuffix]" }, { type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
520
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: InputFieldComponent, decorators: [{
|
|
521
|
-
type: Component,
|
|
522
|
-
args: [{ selector: 'crispr-input-field', changeDetection: ChangeDetectionStrategy.OnPush, 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>\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-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n\n</crispr-field-container>\n", styles: [""] }]
|
|
523
|
-
}], ctorParameters: function () { return []; } });
|
|
524
|
-
|
|
525
|
-
class OptionComponent {
|
|
526
|
-
}
|
|
527
|
-
OptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: OptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
528
|
-
OptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: OptionComponent, selector: "crispr-option", inputs: { option: "option" }, ngImport: i0, 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", styles: [""], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
529
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: OptionComponent, decorators: [{
|
|
530
|
-
type: Component,
|
|
531
|
-
args: [{ selector: 'crispr-option', changeDetection: ChangeDetectionStrategy.OnPush, 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", styles: [""] }]
|
|
532
|
-
}], propDecorators: { option: [{
|
|
533
|
-
type: Input
|
|
534
|
-
}] } });
|
|
535
|
-
|
|
536
|
-
const SelectFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
537
|
-
class SelectFieldComponent extends SelectFieldMixin {
|
|
538
|
-
constructor() {
|
|
539
|
-
super(...arguments);
|
|
540
|
-
this.defaultConfig = {
|
|
541
|
-
enableToggleAll: false,
|
|
542
|
-
color: 'primary'
|
|
543
|
-
};
|
|
544
|
-
this.allSelected = false;
|
|
545
|
-
}
|
|
546
|
-
ngOnInit() {
|
|
547
|
-
super.ngOnInit();
|
|
548
|
-
// options$ can be passed as an array, promise that resolves array, or observable that resolves array
|
|
549
|
-
// this functions accounts for all possibilities and converts to observable that resolves array
|
|
550
|
-
this.options$ = observablifyOptions(this.config.options, this.group);
|
|
551
|
-
}
|
|
552
|
-
ngAfterViewInit() {
|
|
553
|
-
var _a, _b;
|
|
554
|
-
if (this.config.multiple
|
|
555
|
-
&& this.config.enableToggleAll
|
|
556
|
-
&& ((_a = this.selectField.options) === null || _a === void 0 ? void 0 : _a.length) === ((_b = this.value) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
557
|
-
this.allSelected = true;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
toggleAll(isSelected) {
|
|
561
|
-
if (isSelected) {
|
|
562
|
-
this.selectField.options.forEach(option => option.deselect());
|
|
563
|
-
}
|
|
564
|
-
else {
|
|
565
|
-
this.selectField.options.forEach(option => option.select());
|
|
566
|
-
}
|
|
567
|
-
this.allSelected = !this.allSelected;
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
SelectFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SelectFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
571
|
-
SelectFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: SelectFieldComponent, selector: "crispr-select-field", viewQueries: [{ propertyName: "selectField", first: true, predicate: ["selectField"], descendants: true }], usesInheritance: true, ngImport: i0, 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\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: ["mat-checkbox{display:block;padding:16px}\n"], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i4$2.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i5$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: OptionComponent, selector: "crispr-option", inputs: ["option"] }, { type: InfoComponent, selector: "crispr-info", inputs: ["info"] }], directives: [{ type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.MatLabel, selector: "mat-label" }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.MatSuffix, selector: "[matSuffix]" }, { type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }], pipes: { "async": i2.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
572
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SelectFieldComponent, decorators: [{
|
|
573
|
-
type: Component,
|
|
574
|
-
args: [{ selector: 'crispr-select-field', changeDetection: ChangeDetectionStrategy.OnPush, 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\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: ["mat-checkbox{display:block;padding:16px}\n"] }]
|
|
575
|
-
}], propDecorators: { selectField: [{
|
|
576
|
-
type: ViewChild,
|
|
577
|
-
args: ['selectField']
|
|
578
|
-
}] } });
|
|
579
|
-
|
|
580
|
-
const defaultConfig$7 = {
|
|
581
|
-
autoActiveFirstOption: true,
|
|
582
|
-
typeDebounceTime: 500,
|
|
583
|
-
emptyOptionsMessage: DEFAULT_EMPTY_OPTIONS_MESSAGE
|
|
584
|
-
};
|
|
585
|
-
class AutocompleteFieldComponent extends AbstractAutocompleteComponent {
|
|
586
|
-
constructor() {
|
|
587
|
-
super(...arguments);
|
|
588
|
-
this.defaultConfig = defaultConfig$7;
|
|
589
|
-
}
|
|
590
|
-
ngOnInit() {
|
|
591
|
-
super.ngOnInit();
|
|
592
|
-
this.clearFieldSubscription = this.autocompleteInputControl.valueChanges.subscribe((text) => {
|
|
593
|
-
if (typeof text === 'string' && (text === null || text === void 0 ? void 0 : text.trim()) === '') {
|
|
594
|
-
this.control.setValue(null);
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
ngOnDestroy() {
|
|
599
|
-
this.clearFieldSubscription.unsubscribe();
|
|
600
|
-
}
|
|
601
|
-
setControlValue(value) {
|
|
602
|
-
if (this.control && value) {
|
|
603
|
-
// sets the initial value on the control if one is passed
|
|
604
|
-
this.control.setValue(value.value || '');
|
|
605
|
-
this.autocompleteInputControl.setValue(value.label || '');
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* The material autocomplete defaults to displaying the options value instead of its label.
|
|
610
|
-
* We only have the value from the selected option to work with, so we have to pass the options
|
|
611
|
-
* through a function called in the template and return the function that the material displayWith
|
|
612
|
-
* input is expecting.
|
|
613
|
-
* @param options the array of options to search for option with corresponding value
|
|
614
|
-
*/
|
|
615
|
-
displayLabel(options) {
|
|
616
|
-
if (this.config.displayWith) {
|
|
617
|
-
return this.config.displayWith(options);
|
|
618
|
-
}
|
|
619
|
-
return (value) => {
|
|
620
|
-
var _a;
|
|
621
|
-
const label = !!options && Array.isArray(options)
|
|
622
|
-
? (_a = options.find((option) => JSON.stringify(option.value) === JSON.stringify(value))) === null || _a === void 0 ? void 0 : _a.label : value;
|
|
623
|
-
return label;
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
handleSelect(event) {
|
|
627
|
-
this.control.setValue(event.option.value);
|
|
628
|
-
this.autoInputRef.nativeElement.blur();
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
AutocompleteFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: AutocompleteFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
632
|
-
AutocompleteFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: AutocompleteFieldComponent, selector: "crispr-autocomplete-field", viewQueries: [{ propertyName: "autoInput", first: true, predicate: ["autoInput"], descendants: true, read: MatAutocompleteTrigger }, { propertyName: "autoInputRef", first: true, predicate: ["autoInput"], descendants: true }], usesInheritance: true, ngImport: i0, 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 [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n\n <input class=\"hidden-error-directive-anchor\" [formControlName]=\"config.controlName\" type=\"text\"/>\n\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\"\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\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n", styles: [".hidden-error-directive-anchor{display:none}\n"], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { type: i4$3.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i5$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: OptionComponent, selector: "crispr-option", inputs: ["option"] }], directives: [{ type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.MatLabel, selector: "mat-label" }, { type: i4$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4$3.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i4$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i2$1.MatSuffix, selector: "[matSuffix]" }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }], pipes: { "async": i2.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
633
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: AutocompleteFieldComponent, decorators: [{
|
|
634
|
-
type: Component,
|
|
635
|
-
args: [{ selector: 'crispr-autocomplete-field', changeDetection: ChangeDetectionStrategy.OnPush, 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 [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n\n <input class=\"hidden-error-directive-anchor\" [formControlName]=\"config.controlName\" type=\"text\"/>\n\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\"\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\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n", styles: [".hidden-error-directive-anchor{display:none}\n"] }]
|
|
636
|
-
}], propDecorators: { autoInput: [{
|
|
637
|
-
type: ViewChild,
|
|
638
|
-
args: ['autoInput', { read: MatAutocompleteTrigger }]
|
|
639
|
-
}], autoInputRef: [{
|
|
640
|
-
type: ViewChild,
|
|
641
|
-
args: ['autoInput']
|
|
642
|
-
}] } });
|
|
643
|
-
|
|
644
|
-
const defaultConfig$6 = {
|
|
645
|
-
chipsSelectable: true,
|
|
646
|
-
areChipsRemovable: true,
|
|
647
|
-
tabToSelect: true,
|
|
648
|
-
autoActiveFirstOption: true,
|
|
649
|
-
imageUrlParam: 'image',
|
|
650
|
-
typeDebounceTime: 500,
|
|
651
|
-
allowDuplicates: false,
|
|
652
|
-
duplicateCompareFunction: (chip, option) => chip.value === option.value,
|
|
653
|
-
separatorKeyCodes: [ENTER],
|
|
654
|
-
emptyOptionsMessage: DEFAULT_EMPTY_OPTIONS_MESSAGE,
|
|
655
|
-
};
|
|
656
|
-
class AutocompleteChiplistFieldComponent extends AbstractAutocompleteComponent {
|
|
657
|
-
constructor() {
|
|
658
|
-
super(...arguments);
|
|
659
|
-
this.defaultConfig = defaultConfig$6;
|
|
660
|
-
this.chips$ = new BehaviorSubject([]);
|
|
661
|
-
this.controlValue$ = this.chips$.pipe(tap(chips => {
|
|
662
|
-
this.control.setValue(chips.map(chip => chip.value));
|
|
663
|
-
}));
|
|
664
|
-
}
|
|
665
|
-
ngOnInit() {
|
|
666
|
-
super.ngOnInit();
|
|
667
|
-
this.remainingOptions$ = combineLatest([
|
|
668
|
-
this.chips$,
|
|
669
|
-
this.options$
|
|
670
|
-
]).pipe(map(([chips, options]) => {
|
|
671
|
-
return this.config.allowDuplicates
|
|
672
|
-
? options
|
|
673
|
-
: options === null || options === void 0 ? void 0 : options.filter(option => {
|
|
674
|
-
return !chips.some(chip => this.config.duplicateCompareFunction(chip, option));
|
|
675
|
-
});
|
|
676
|
-
}));
|
|
677
|
-
}
|
|
678
|
-
setControlValue(value) {
|
|
679
|
-
if (value) {
|
|
680
|
-
this.chips$.next(value);
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
// handles mat selecting
|
|
684
|
-
handleSelect(event) {
|
|
685
|
-
const selectedOption = event.option.value;
|
|
686
|
-
this.chips$.next([...this.chips$.value, selectedOption]);
|
|
687
|
-
this.chipInputRef.nativeElement.value = '';
|
|
688
|
-
this.autocompleteInputControl.setValue('');
|
|
689
|
-
// setTimeout needed because the panel thinks it's still open at this point
|
|
690
|
-
setTimeout(() => this.chipInput.openPanel());
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* To follow ARIA standards we want to select the active option on blur.
|
|
694
|
-
* matChipInputAddOnBlur should do this but it causes buggy behaviour
|
|
695
|
-
* @param event blur event that triggers the handle blur
|
|
696
|
-
*/
|
|
697
|
-
handleTab(_event) {
|
|
698
|
-
if (this.chipInput.activeOption && (this.config.tabToSelect || this.config.addChipOnBlur)) {
|
|
699
|
-
const chip = this.chipInput.activeOption.value;
|
|
700
|
-
this.chips$.next([...this.chips$.value, chip]);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
/**
|
|
704
|
-
* Handles selection via key tokens passed through separatorKeyCodes propert
|
|
705
|
-
* NOTE: If TAB is used focus does not move on to next component
|
|
706
|
-
* @param event
|
|
707
|
-
*/
|
|
708
|
-
handleTokenEnd(event) {
|
|
709
|
-
var _a;
|
|
710
|
-
if (this.chipInput.activeOption) {
|
|
711
|
-
this.chipInput.activeOption.select();
|
|
712
|
-
}
|
|
713
|
-
(_a = event.chipInput) === null || _a === void 0 ? void 0 : _a.clear();
|
|
714
|
-
}
|
|
715
|
-
mapToLabel(option) {
|
|
716
|
-
return option ? option.label : '';
|
|
717
|
-
}
|
|
718
|
-
removeChip(removedChip) {
|
|
719
|
-
const remainingChips = this.chips$.value.filter(chip => chip !== removedChip);
|
|
720
|
-
this.chips$.next(remainingChips);
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
AutocompleteChiplistFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: AutocompleteChiplistFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
724
|
-
AutocompleteChiplistFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: AutocompleteChiplistFieldComponent, selector: "crispr-autocomplete-chiplist-field", viewQueries: [{ propertyName: "chipInput", first: true, predicate: ["autoInput"], descendants: true, read: MatAutocompleteTrigger }, { propertyName: "chipInputRef", first: true, predicate: ["autoInput"], descendants: true }], usesInheritance: true, ngImport: i0, 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\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 <input class=\"hidden-error-directive-anchor\" [formControlName]=\"config.controlName\" type=\"text\"/>\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 <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n", 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%;object-fit:cover}.hidden-error-directive-anchor{display:none}\n"], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3$2.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { type: i4$3.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i5$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: OptionComponent, selector: "crispr-option", inputs: ["option"] }], directives: [{ type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.MatLabel, selector: "mat-label" }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3$2.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i3$2.MatChipRemove, selector: "[matChipRemove]" }, { type: i4$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i3$2.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }, { type: i4$3.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i4$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i2$1.MatSuffix, selector: "[matSuffix]" }, { type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }], pipes: { "async": i2.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
725
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: AutocompleteChiplistFieldComponent, decorators: [{
|
|
726
|
-
type: Component,
|
|
727
|
-
args: [{ selector: 'crispr-autocomplete-chiplist-field', changeDetection: ChangeDetectionStrategy.OnPush, 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\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 <input class=\"hidden-error-directive-anchor\" [formControlName]=\"config.controlName\" type=\"text\"/>\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 <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n", 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%;object-fit:cover}.hidden-error-directive-anchor{display:none}\n"] }]
|
|
728
|
-
}], propDecorators: { chipInput: [{
|
|
729
|
-
type: ViewChild,
|
|
730
|
-
args: ['autoInput', { read: MatAutocompleteTrigger }]
|
|
731
|
-
}], chipInputRef: [{
|
|
732
|
-
type: ViewChild,
|
|
733
|
-
args: ['autoInput']
|
|
734
|
-
}] } });
|
|
735
|
-
|
|
736
|
-
const defaultConfig$5 = {
|
|
737
|
-
labelPosition: 'after',
|
|
738
|
-
inline: false
|
|
739
|
-
};
|
|
740
|
-
const CheckboxFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
741
|
-
class CheckboxFieldComponent extends CheckboxFieldMixin {
|
|
742
|
-
constructor() {
|
|
743
|
-
super(...arguments);
|
|
744
|
-
this.defaultConfig = defaultConfig$5;
|
|
745
|
-
}
|
|
746
|
-
ngOnInit() {
|
|
747
|
-
super.ngOnInit();
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
CheckboxFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CheckboxFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
751
|
-
CheckboxFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: CheckboxFieldComponent, selector: "crispr-checkbox-field", usesInheritance: true, ngImport: i0, 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", styles: ["mat-checkbox{height:42px}\n"], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: i4$2.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: InfoComponent, selector: "crispr-info", inputs: ["info"] }], directives: [{ type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.MatSuffix, selector: "[matSuffix]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
752
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CheckboxFieldComponent, decorators: [{
|
|
753
|
-
type: Component,
|
|
754
|
-
args: [{ selector: 'crispr-checkbox-field', changeDetection: ChangeDetectionStrategy.OnPush, 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", styles: ["mat-checkbox{height:42px}\n"] }]
|
|
755
|
-
}] });
|
|
756
|
-
|
|
757
|
-
const defaultConfig$4 = { rows: 5 };
|
|
758
|
-
const TextareaFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
759
|
-
class TextareaFieldComponent extends TextareaFieldMixin {
|
|
760
|
-
constructor() {
|
|
761
|
-
super(...arguments);
|
|
762
|
-
this.defaultConfig = defaultConfig$4;
|
|
763
|
-
}
|
|
764
|
-
ngOnInit() {
|
|
765
|
-
super.ngOnInit();
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
TextareaFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: TextareaFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
769
|
-
TextareaFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: TextareaFieldComponent, selector: "crispr-textarea-field", usesInheritance: true, ngImport: i0, 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\n <mat-hint *ngIf=\"config.hint && control.valid\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: [""], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: InfoComponent, selector: "crispr-info", inputs: ["info"] }], directives: [{ type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.MatLabel, selector: "mat-label" }, { type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { type: i2$1.MatSuffix, selector: "[matSuffix]" }, { type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
770
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: TextareaFieldComponent, decorators: [{
|
|
771
|
-
type: Component,
|
|
772
|
-
args: [{ selector: 'crispr-textarea-field', changeDetection: ChangeDetectionStrategy.OnPush, 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\n <mat-hint *ngIf=\"config.hint && control.valid\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: [""] }]
|
|
773
|
-
}] });
|
|
774
|
-
|
|
775
|
-
const defaultConfig$3 = { displayLimits: true };
|
|
776
|
-
const SliderFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
777
|
-
class SliderFieldComponent extends SliderFieldMixin {
|
|
778
|
-
constructor() {
|
|
779
|
-
super();
|
|
780
|
-
this.defaultConfig = defaultConfig$3;
|
|
781
|
-
}
|
|
782
|
-
get flexDirection() {
|
|
783
|
-
return this.config.vertical ? 'column' : 'row';
|
|
784
|
-
}
|
|
785
|
-
ngOnInit() {
|
|
786
|
-
super.ngOnInit();
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
SliderFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SliderFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
790
|
-
SliderFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: SliderFieldComponent, selector: "crispr-slider-field", usesInheritance: true, ngImport: i0, 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", styles: [".slider-container{display:flex;align-items:center}.slider-container .mat-slider-horizontal{width:100%}\n"], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { type: i3$3.MatSlider, selector: "mat-slider", inputs: ["disabled", "color", "tabIndex", "invert", "max", "min", "step", "thumbLabel", "tickInterval", "value", "displayWith", "valueText", "vertical"], outputs: ["change", "input", "valueChange"], exportAs: ["matSlider"] }], directives: [{ type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.ControlErrorsDirective, selector: "[formControl], [formControlName]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
791
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SliderFieldComponent, decorators: [{
|
|
792
|
-
type: Component,
|
|
793
|
-
args: [{ selector: 'crispr-slider-field', changeDetection: ChangeDetectionStrategy.OnPush, 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", styles: [".slider-container{display:flex;align-items:center}.slider-container .mat-slider-horizontal{width:100%}\n"] }]
|
|
794
|
-
}], ctorParameters: function () { return []; } });
|
|
795
|
-
|
|
796
|
-
class ButtonComponent extends CrisprFieldComponent {
|
|
797
|
-
constructor() {
|
|
798
|
-
super(...arguments);
|
|
799
|
-
this.defaultConfig = { buttonType: 'raised', type: 'submit' };
|
|
800
|
-
}
|
|
801
|
-
get matButtonClass() {
|
|
802
|
-
return this.config.buttonType ? `mat-${this.config.buttonType}-button` : '';
|
|
803
|
-
}
|
|
804
|
-
ngOnInit() {
|
|
805
|
-
super.ngOnInit();
|
|
806
|
-
this.formValid$ = this.group.statusChanges.pipe(map(status => status === 'VALID'), startWith(this.group.valid));
|
|
807
|
-
}
|
|
808
|
-
handleClick(group, event) {
|
|
809
|
-
if (this.config.callback) {
|
|
810
|
-
this.config.callback(group, event);
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
ButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: ButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
815
|
-
ButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: ButtonComponent, selector: "crispr-button", usesInheritance: true, ngImport: i0, 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", styles: [""], components: [{ type: i1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i2.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
816
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
817
|
-
type: Component,
|
|
818
|
-
args: [{ selector: 'crispr-button', changeDetection: ChangeDetectionStrategy.OnPush, 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", styles: [""] }]
|
|
819
|
-
}] });
|
|
820
|
-
|
|
821
|
-
const defaultConfig$2 = {
|
|
822
|
-
startView: 'month',
|
|
823
|
-
};
|
|
824
|
-
const DatepickerFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
825
|
-
class DatepickerFieldComponent extends DatepickerFieldMixin {
|
|
826
|
-
constructor() {
|
|
827
|
-
super(...arguments);
|
|
828
|
-
this.defaultConfig = defaultConfig$2;
|
|
829
|
-
}
|
|
830
|
-
ngOnInit() {
|
|
831
|
-
var _a, _b;
|
|
832
|
-
super.ngOnInit();
|
|
833
|
-
this.startAt$ = this.config.startAt instanceof Date
|
|
834
|
-
? of(this.config.startAt)
|
|
835
|
-
: this.config.startAt instanceof Function
|
|
836
|
-
? this.config.startAt(this.group)
|
|
837
|
-
: of(null);
|
|
838
|
-
this.dateClass = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.cellClassFunction) || null;
|
|
839
|
-
this.dateClass$ = this.config.dateClass ? (_b = this.config) === null || _b === void 0 ? void 0 : _b.dateClass(this.group) : of(() => '');
|
|
840
|
-
}
|
|
841
|
-
ngAfterContentInit() {
|
|
842
|
-
if (this.config.datepickerActions) {
|
|
843
|
-
this.calendarFooterPortal = new ComponentPortal(this.config.datepickerActions);
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
DatepickerFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: DatepickerFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
848
|
-
DatepickerFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: DatepickerFieldComponent, selector: "crispr-datepicker-field", usesInheritance: true, ngImport: i0, 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-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n\n", styles: [""], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3$4.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { type: i3$4.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { type: i3$4.MatDatepickerActions, selector: "mat-datepicker-actions, mat-date-range-picker-actions" }], directives: [{ type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.MatLabel, selector: "mat-label" }, { type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3$4.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { type: i2$1.MatSuffix, selector: "[matSuffix]" }, { type: i8.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }], pipes: { "async": i2.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
849
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: DatepickerFieldComponent, decorators: [{
|
|
850
|
-
type: Component,
|
|
851
|
-
args: [{ selector: 'crispr-datepicker-field', changeDetection: ChangeDetectionStrategy.OnPush, 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-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n</crispr-field-container>\n\n", styles: [""] }]
|
|
852
|
-
}] });
|
|
853
|
-
|
|
854
|
-
class DividerComponent extends CrisprFieldComponent {
|
|
855
|
-
constructor() {
|
|
856
|
-
super(...arguments);
|
|
857
|
-
// TODO: pull in type after configs are better organized
|
|
858
|
-
this.defaultConfig = {};
|
|
859
|
-
}
|
|
860
|
-
ngOnInit() {
|
|
861
|
-
super.ngOnInit();
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
DividerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: DividerComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
865
|
-
DividerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: DividerComponent, selector: "crispr-divider", usesInheritance: true, ngImport: i0, template: "<mat-divider [ngClass]=\"config.classes\"></mat-divider>", styles: [":host{display:block;padding:1em 0}::ng-deep .mat-divider.mat-divider-horizontal{position:relative}\n"], components: [{ type: i1$1.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], preserveWhitespaces: true });
|
|
866
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: DividerComponent, decorators: [{
|
|
867
|
-
type: Component,
|
|
868
|
-
args: [{ selector: 'crispr-divider', template: "<mat-divider [ngClass]=\"config.classes\"></mat-divider>", styles: [":host{display:block;padding:1em 0}::ng-deep .mat-divider.mat-divider-horizontal{position:relative}\n"] }]
|
|
869
|
-
}] });
|
|
870
|
-
|
|
871
|
-
const RadioFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
872
|
-
class RadioFieldComponent extends RadioFieldMixin {
|
|
873
|
-
constructor() {
|
|
874
|
-
super(...arguments);
|
|
875
|
-
this.defaultConfig = {};
|
|
876
|
-
}
|
|
877
|
-
ngOnInit() {
|
|
878
|
-
super.ngOnInit();
|
|
879
|
-
// options$ can be passed as an array, promise that resolves array, or observable that resolves array
|
|
880
|
-
// this functions accounts for all possibilities and converts to observable that resolves array
|
|
881
|
-
this.options$ = observablifyOptions(this.config.options, this.group);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
RadioFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: RadioFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
885
|
-
RadioFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: RadioFieldComponent, selector: "crispr-radio-field", usesInheritance: true, ngImport: i0, 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", styles: ["mat-radio-button{padding:12px}\n"], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: i2$2.MatRadioButton, selector: "mat-radio-button", inputs: ["disableRipple", "tabIndex"], exportAs: ["matRadioButton"] }], directives: [{ type: i2$2.MatRadioGroup, selector: "mat-radio-group", exportAs: ["matRadioGroup"] }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i2.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
886
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: RadioFieldComponent, decorators: [{
|
|
887
|
-
type: Component,
|
|
888
|
-
args: [{ selector: 'crispr-radio-field', changeDetection: ChangeDetectionStrategy.OnPush, 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", styles: ["mat-radio-button{padding:12px}\n"] }]
|
|
889
|
-
}] });
|
|
890
|
-
|
|
891
|
-
const defaultConfig$1 = {};
|
|
892
|
-
const UnitConversionFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
893
|
-
class UnitConversionFieldComponent extends UnitConversionFieldMixin {
|
|
894
|
-
constructor() {
|
|
895
|
-
super(...arguments);
|
|
896
|
-
this.defaultConfig = defaultConfig$1;
|
|
897
|
-
this.displayValueControl = new FormControl();
|
|
898
|
-
this.unitSelectControl = new FormControl();
|
|
899
|
-
}
|
|
900
|
-
ngOnInit() {
|
|
901
|
-
var _a, _b;
|
|
902
|
-
super.ngOnInit();
|
|
903
|
-
// TODO: Validators need work. validation is tricky because the input needs to be validated against but the validator will compare against the controls value
|
|
904
|
-
// this.displayValueControl.setValidators(this.config.validators);
|
|
905
|
-
const controlValuePipeline = [
|
|
906
|
-
this.displayValueControl.valueChanges.pipe(startWith(this.displayValueControl.value))
|
|
907
|
-
];
|
|
908
|
-
// setup all required pieces when showing a field for selecting units
|
|
909
|
-
if (this.config.showUnitSelect) {
|
|
910
|
-
this.unitOptions$ = observablifyOptions(this.config.selectableUnits, this.group);
|
|
911
|
-
controlValuePipeline.push(this.unitSelectControl.valueChanges.pipe(startWith(((_a = this.config) === null || _a === void 0 ? void 0 : _a.initialDisplayUnit) || null)));
|
|
912
|
-
this.unitSelectControl.setValue(((_b = this.config) === null || _b === void 0 ? void 0 : _b.initialDisplayUnit) || null);
|
|
913
|
-
}
|
|
914
|
-
this.transformationSubscription = combineLatest(controlValuePipeline).subscribe(([displayValue, unitValue]) => {
|
|
915
|
-
const computedValue = this.config.storedValueConversion(displayValue, unitValue);
|
|
916
|
-
this.control.setValue(computedValue);
|
|
917
|
-
});
|
|
918
|
-
}
|
|
919
|
-
ngOnDestroy() {
|
|
920
|
-
this.transformationSubscription.unsubscribe();
|
|
921
|
-
}
|
|
922
|
-
setInitialDisplayValue(storedValue, unit) {
|
|
923
|
-
const initialDisplayValue = this.config.initialDisplayValueConversion(storedValue || null, unit);
|
|
924
|
-
this.displayValueControl.setValue(initialDisplayValue);
|
|
925
|
-
}
|
|
926
|
-
/**
|
|
927
|
-
* We override the 'setControlValue' we inherited from crisprControlMixin and add our custom logic,
|
|
928
|
-
* This function gets called onInit because were object oriented. it's so great, so great that I'm
|
|
929
|
-
* typing a paragraph to explain what the hell is going on...
|
|
930
|
-
* @param value the initial value for the control passed down from the form components input
|
|
931
|
-
*/
|
|
932
|
-
setControlValue(value) {
|
|
933
|
-
var _a;
|
|
934
|
-
const initialUnitValue = this.config.showUnitSelect ? (_a = this.config) === null || _a === void 0 ? void 0 : _a.initialDisplayUnit : null;
|
|
935
|
-
this.setInitialDisplayValue(value, initialUnitValue);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
UnitConversionFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: UnitConversionFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
939
|
-
UnitConversionFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: UnitConversionFieldComponent, selector: "crispr-unit-conversion-field", usesInheritance: true, ngImport: i0, 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 <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 <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: [".unit-field{width:40%;margin-left:16px}:host ::ng-deep .field-container{display:flex}\n"], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: InfoComponent, selector: "crispr-info", inputs: ["info"] }, { type: i3$1.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { type: i5$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { type: OptionComponent, selector: "crispr-option", inputs: ["option"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.MatLabel, selector: "mat-label" }, { type: i4$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i4$1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { type: i4$1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i5.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { type: i2$1.MatSuffix, selector: "[matSuffix]" }, { type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }], pipes: { "async": i2.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
940
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: UnitConversionFieldComponent, decorators: [{
|
|
941
|
-
type: Component,
|
|
942
|
-
args: [{ selector: 'crispr-unit-conversion-field', changeDetection: ChangeDetectionStrategy.OnPush, 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 <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 <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: [".unit-field{width:40%;margin-left:16px}:host ::ng-deep .field-container{display:flex}\n"] }]
|
|
943
|
-
}] });
|
|
944
|
-
|
|
945
|
-
class FileDropzoneDirective {
|
|
946
|
-
constructor() {
|
|
947
|
-
this.fileDrop = new EventEmitter();
|
|
948
|
-
this.crisprFileDropzone = true;
|
|
949
|
-
}
|
|
950
|
-
onDrop($event) {
|
|
951
|
-
if (this.crisprFileDropzone) {
|
|
952
|
-
$event.preventDefault();
|
|
953
|
-
this.fileDrop.emit($event.dataTransfer.files);
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
// Prevents DOM from trying to open file in browser
|
|
957
|
-
onDragOver($event) {
|
|
958
|
-
if (this.crisprFileDropzone) {
|
|
959
|
-
$event.preventDefault();
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
FileDropzoneDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FileDropzoneDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
964
|
-
FileDropzoneDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.1", type: FileDropzoneDirective, selector: "[crisprFileDropzone]", inputs: { crisprFileDropzone: "crisprFileDropzone" }, outputs: { fileDrop: "fileDrop" }, host: { listeners: { "drop": "onDrop($event)", "dragover": "onDragOver($event)" } }, ngImport: i0 });
|
|
965
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FileDropzoneDirective, decorators: [{
|
|
966
|
-
type: Directive,
|
|
967
|
-
args: [{
|
|
968
|
-
selector: '[crisprFileDropzone]'
|
|
969
|
-
}]
|
|
970
|
-
}], propDecorators: { fileDrop: [{
|
|
971
|
-
type: Output
|
|
972
|
-
}], crisprFileDropzone: [{
|
|
973
|
-
type: Input
|
|
974
|
-
}], onDrop: [{
|
|
975
|
-
type: HostListener,
|
|
976
|
-
args: ['drop', ['$event']]
|
|
977
|
-
}], onDragOver: [{
|
|
978
|
-
type: HostListener,
|
|
979
|
-
args: ['dragover', ['$event']]
|
|
980
|
-
}] } });
|
|
981
|
-
|
|
982
|
-
class SelectedFileComponent {
|
|
983
|
-
}
|
|
984
|
-
SelectedFileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SelectedFileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
985
|
-
SelectedFileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: SelectedFileComponent, selector: "crispr-selected-file", inputs: { fileName: "fileName", progress: "progress", showProgress: "showProgress", color: "color" }, ngImport: i0, 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", styles: ["mat-progress-bar{margin-bottom:8px}\n"], components: [{ type: i1$2.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], preserveWhitespaces: true });
|
|
986
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SelectedFileComponent, decorators: [{
|
|
987
|
-
type: Component,
|
|
988
|
-
args: [{ selector: 'crispr-selected-file', 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", styles: ["mat-progress-bar{margin-bottom:8px}\n"] }]
|
|
989
|
-
}], propDecorators: { fileName: [{
|
|
990
|
-
type: Input
|
|
991
|
-
}], progress: [{
|
|
992
|
-
type: Input
|
|
993
|
-
}], showProgress: [{
|
|
994
|
-
type: Input
|
|
995
|
-
}], color: [{
|
|
996
|
-
type: Input
|
|
997
|
-
}] } });
|
|
998
|
-
class SelectedFileModule {
|
|
999
|
-
}
|
|
1000
|
-
SelectedFileModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SelectedFileModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1001
|
-
SelectedFileModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SelectedFileModule, declarations: [SelectedFileComponent], imports: [CommonModule,
|
|
1002
|
-
MatProgressBarModule], exports: [SelectedFileComponent] });
|
|
1003
|
-
SelectedFileModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SelectedFileModule, imports: [[
|
|
1004
|
-
CommonModule,
|
|
1005
|
-
MatProgressBarModule
|
|
1006
|
-
]] });
|
|
1007
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SelectedFileModule, decorators: [{
|
|
1008
|
-
type: NgModule,
|
|
1009
|
-
args: [{
|
|
1010
|
-
imports: [
|
|
1011
|
-
CommonModule,
|
|
1012
|
-
MatProgressBarModule
|
|
1013
|
-
],
|
|
1014
|
-
exports: [
|
|
1015
|
-
SelectedFileComponent
|
|
1016
|
-
],
|
|
1017
|
-
declarations: [
|
|
1018
|
-
SelectedFileComponent
|
|
1019
|
-
]
|
|
1020
|
-
}]
|
|
1021
|
-
}] });
|
|
1022
|
-
|
|
1023
|
-
const FileUploadFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
1024
|
-
class FileUploadFieldComponent extends FileUploadFieldMixin {
|
|
1025
|
-
// ngControl: NgControl = null;
|
|
1026
|
-
constructor(ngControl) {
|
|
1027
|
-
super();
|
|
1028
|
-
this.ngControl = ngControl;
|
|
1029
|
-
this.defaultConfig = {
|
|
1030
|
-
allowMultipleFiles: false,
|
|
1031
|
-
acceptedTypes: '*.*',
|
|
1032
|
-
dropZoneText: 'DROP FILE HERE',
|
|
1033
|
-
selectFilesButtonType: 'button',
|
|
1034
|
-
selectButtonText: 'SELECT',
|
|
1035
|
-
showClearFilesButton: true,
|
|
1036
|
-
clearFilesButtonText: 'CLEAR',
|
|
1037
|
-
uploadButtonText: 'UPLOAD',
|
|
1038
|
-
uploadButtonType: 'button',
|
|
1039
|
-
showUploadProgress: false,
|
|
1040
|
-
disableOnUpload: true
|
|
1041
|
-
};
|
|
1042
|
-
this.isUploaded = false;
|
|
1043
|
-
this.fileProgress = [];
|
|
1044
|
-
if (this.ngControl != null) {
|
|
1045
|
-
// Setting the value accessor directly (instead of using
|
|
1046
|
-
// the providers) to avoid running into a circular import.
|
|
1047
|
-
ngControl.valueAccessor = this;
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
ngOnInit() {
|
|
1051
|
-
super.ngOnInit();
|
|
1052
|
-
this.disabled$ = this.config.disabledCallback
|
|
1053
|
-
? this.config.disabledCallback(this.group, this.config)
|
|
1054
|
-
: of(false);
|
|
1055
|
-
}
|
|
1056
|
-
filesChanged(files) {
|
|
1057
|
-
if (files && files.length > 0) {
|
|
1058
|
-
this.selectedFiles = files;
|
|
1059
|
-
this.control.patchValue(files);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
uploadFiles() {
|
|
1063
|
-
if (this.selectedFiles && this.config.uploadFiles) {
|
|
1064
|
-
this.isUploaded = true;
|
|
1065
|
-
this.config.uploadFiles(this.group, this.selectedFiles, this);
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
resetFileInput() {
|
|
1069
|
-
this.fileInputRef.nativeElement.value = '';
|
|
1070
|
-
this.control.patchValue(null);
|
|
1071
|
-
this.isUploaded = false;
|
|
1072
|
-
}
|
|
1073
|
-
writeValue(value) {
|
|
1074
|
-
// clear file input
|
|
1075
|
-
// this.host.nativeElement.value = '';
|
|
1076
|
-
// this.file = null;
|
|
1077
|
-
}
|
|
1078
|
-
registerOnChange(fn) {
|
|
1079
|
-
this.onChange = fn;
|
|
1080
|
-
}
|
|
1081
|
-
registerOnTouched(fn) {
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
FileUploadFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FileUploadFieldComponent, deps: [{ token: i4$1.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1085
|
-
FileUploadFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: FileUploadFieldComponent, selector: "crispr-file-upload-field", viewQueries: [{ propertyName: "fileInputRef", first: true, predicate: ["fileInput"], descendants: true }], usesInheritance: true, ngImport: i0, 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 <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 <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\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", 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}\n"], components: [{ type: i0.forwardRef(function () { return FieldContainerComponent; }), selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: i0.forwardRef(function () { return i2$1.MatFormField; }), selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i0.forwardRef(function () { return i4.MatIcon; }), selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i0.forwardRef(function () { return i1.MatButton; }), selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i0.forwardRef(function () { return SelectedFileComponent; }), selector: "crispr-selected-file", inputs: ["fileName", "progress", "showProgress", "color"] }], directives: [{ type: i0.forwardRef(function () { return FileDropzoneDirective; }), selector: "[crisprFileDropzone]", inputs: ["crisprFileDropzone"], outputs: ["fileDrop"] }, { type: i0.forwardRef(function () { return i4$1.NgControlStatusGroup; }), selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i0.forwardRef(function () { return i4$1.FormGroupDirective; }), selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i0.forwardRef(function () { return i5.ControlErrorContainerDirective; }), selector: "[controlErrorContainer], [formGroup]" }, { type: i0.forwardRef(function () { return i7.MatInput; }), selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i0.forwardRef(function () { return i4$1.DefaultValueAccessor; }), selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i0.forwardRef(function () { return i4$1.NgControlStatus; }), selector: "[formControlName],[ngModel],[formControl]" }, { type: i0.forwardRef(function () { return i4$1.FormControlName; }), selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i0.forwardRef(function () { return i5.ControlErrorsDirective; }), selector: "[formControl], [formControlName]" }, { type: i0.forwardRef(function () { return i2$1.MatLabel; }), selector: "mat-label" }, { type: i0.forwardRef(function () { return i2.NgIf; }), selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i0.forwardRef(function () { return i2.NgForOf; }), selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i0.forwardRef(function () { return i2$1.MatHint; }), selector: "mat-hint", inputs: ["align", "id"] }], pipes: { "async": i0.forwardRef(function () { return i2.AsyncPipe; }) }, changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
1086
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FileUploadFieldComponent, decorators: [{
|
|
1087
|
-
type: Component,
|
|
1088
|
-
args: [{ selector: 'crispr-file-upload-field', changeDetection: ChangeDetectionStrategy.OnPush, 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 <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 <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\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", 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}\n"] }]
|
|
1089
|
-
}], ctorParameters: function () {
|
|
1090
|
-
return [{ type: i4$1.NgControl, decorators: [{
|
|
1091
|
-
type: Optional
|
|
1092
|
-
}, {
|
|
1093
|
-
type: Self
|
|
1094
|
-
}] }];
|
|
1095
|
-
}, propDecorators: { fileInputRef: [{
|
|
1096
|
-
type: ViewChild,
|
|
1097
|
-
args: ['fileInput']
|
|
1098
|
-
}] } });
|
|
1099
|
-
class FileUploadFieldModule {
|
|
1100
|
-
}
|
|
1101
|
-
FileUploadFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FileUploadFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1102
|
-
FileUploadFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FileUploadFieldModule, declarations: [FileUploadFieldComponent, FileDropzoneDirective], imports: [CommonModule,
|
|
1103
|
-
FieldContainerModule,
|
|
1104
|
-
ReactiveFormsModule,
|
|
1105
|
-
MatIconModule,
|
|
1106
|
-
MatButtonModule,
|
|
1107
|
-
MatFormFieldModule,
|
|
1108
|
-
MatInputModule,
|
|
1109
|
-
SelectedFileModule,
|
|
1110
|
-
FormValidationHandlerModule], exports: [FileUploadFieldComponent, FileDropzoneDirective] });
|
|
1111
|
-
FileUploadFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FileUploadFieldModule, imports: [[
|
|
1112
|
-
CommonModule,
|
|
1113
|
-
FieldContainerModule,
|
|
1114
|
-
ReactiveFormsModule,
|
|
1115
|
-
MatIconModule,
|
|
1116
|
-
MatButtonModule,
|
|
1117
|
-
MatFormFieldModule,
|
|
1118
|
-
MatInputModule,
|
|
1119
|
-
SelectedFileModule,
|
|
1120
|
-
FormValidationHandlerModule,
|
|
1121
|
-
]] });
|
|
1122
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FileUploadFieldModule, decorators: [{
|
|
1123
|
-
type: NgModule,
|
|
1124
|
-
args: [{
|
|
1125
|
-
imports: [
|
|
1126
|
-
CommonModule,
|
|
1127
|
-
FieldContainerModule,
|
|
1128
|
-
ReactiveFormsModule,
|
|
1129
|
-
MatIconModule,
|
|
1130
|
-
MatButtonModule,
|
|
1131
|
-
MatFormFieldModule,
|
|
1132
|
-
MatInputModule,
|
|
1133
|
-
SelectedFileModule,
|
|
1134
|
-
FormValidationHandlerModule,
|
|
1135
|
-
],
|
|
1136
|
-
exports: [
|
|
1137
|
-
FileUploadFieldComponent,
|
|
1138
|
-
FileDropzoneDirective
|
|
1139
|
-
],
|
|
1140
|
-
declarations: [
|
|
1141
|
-
FileUploadFieldComponent,
|
|
1142
|
-
FileDropzoneDirective
|
|
1143
|
-
]
|
|
1144
|
-
}]
|
|
1145
|
-
}] });
|
|
1146
|
-
|
|
1147
|
-
function convertBytesToMb(bytes) {
|
|
1148
|
-
return bytes / 1048576;
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
const ImageUploadFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
1152
|
-
class ImageUploadFieldComponent extends ImageUploadFieldMixin {
|
|
1153
|
-
constructor(ngControl, domSanitizer, cdr) {
|
|
1154
|
-
super();
|
|
1155
|
-
this.ngControl = ngControl;
|
|
1156
|
-
this.domSanitizer = domSanitizer;
|
|
1157
|
-
this.cdr = cdr;
|
|
1158
|
-
this.defaultConfig = {
|
|
1159
|
-
// allowMultipleFiles: false,
|
|
1160
|
-
acceptedTypes: 'image/*',
|
|
1161
|
-
dropZoneText: 'DROP FILE HERE',
|
|
1162
|
-
selectFilesButtonType: 'button',
|
|
1163
|
-
selectButtonText: 'SELECT',
|
|
1164
|
-
showClearFilesButton: true,
|
|
1165
|
-
clearFilesButtonText: 'CLEAR',
|
|
1166
|
-
resetFilesButtonText: 'RESET',
|
|
1167
|
-
imagePreviewHeight: '250px',
|
|
1168
|
-
compressImage: false,
|
|
1169
|
-
targetCompressedImageFileSizeMb: .4,
|
|
1170
|
-
minCompressionThresholdMb: .6,
|
|
1171
|
-
useWebWorker: true,
|
|
1172
|
-
};
|
|
1173
|
-
this.inputImageFileSubject = new Subject();
|
|
1174
|
-
this.inputImageFile$ = this.inputImageFileSubject.asObservable().pipe(shareReplay(1));
|
|
1175
|
-
this.compressedFile$ = this.inputImageFile$.pipe(switchMap((file) => __awaiter(this, void 0, void 0, function* () {
|
|
1176
|
-
if (!file || !(file instanceof File))
|
|
1177
|
-
return null;
|
|
1178
|
-
const { compressImage, targetCompressedImageFileSizeMb, minCompressionThresholdMb, maxWidthOrHeight, useWebWorker } = this.config;
|
|
1179
|
-
const fileSizeMb = convertBytesToMb(file.size);
|
|
1180
|
-
const shouldCompress = compressImage
|
|
1181
|
-
&& targetCompressedImageFileSizeMb < fileSizeMb
|
|
1182
|
-
&& minCompressionThresholdMb < fileSizeMb;
|
|
1183
|
-
if (shouldCompress) {
|
|
1184
|
-
const options = Object.assign(Object.assign({}, (maxWidthOrHeight ? { maxWidthOrHeight } : { maxSizeMB: targetCompressedImageFileSizeMb })), { useWebWorker, maxIterations: 30, onProgress: (progress) => {
|
|
1185
|
-
this.progress = progress;
|
|
1186
|
-
this.cdr.detectChanges();
|
|
1187
|
-
} });
|
|
1188
|
-
return yield imageCompression(file, options);
|
|
1189
|
-
}
|
|
1190
|
-
else
|
|
1191
|
-
return file;
|
|
1192
|
-
})), map((compressedFile) => {
|
|
1193
|
-
if (!compressedFile)
|
|
1194
|
-
return compressedFile;
|
|
1195
|
-
const { type, name, lastModified } = compressedFile;
|
|
1196
|
-
return new File([compressedFile], this.config.fileName || name, {
|
|
1197
|
-
type,
|
|
1198
|
-
lastModified
|
|
1199
|
-
});
|
|
1200
|
-
}), tap(file => {
|
|
1201
|
-
// only set the value if there is a file because resetToInitialValue sets the control value
|
|
1202
|
-
// to initial value and clears the compressed image, so setting it to null here would undo that
|
|
1203
|
-
if (file) {
|
|
1204
|
-
this.control.setValue(file);
|
|
1205
|
-
}
|
|
1206
|
-
if (file || this.value) {
|
|
1207
|
-
this.control.markAsTouched();
|
|
1208
|
-
setTimeout(() => {
|
|
1209
|
-
this.cdr.detectChanges();
|
|
1210
|
-
}, 100);
|
|
1211
|
-
}
|
|
1212
|
-
}), shareReplay(1));
|
|
1213
|
-
this.compressedImageUrlString$ = this.compressedFile$.pipe(switchMap((file) => __awaiter(this, void 0, void 0, function* () {
|
|
1214
|
-
if (!file)
|
|
1215
|
-
return null;
|
|
1216
|
-
const compressedStringImage = yield imageCompression.getDataUrlFromFile(file);
|
|
1217
|
-
return this.domSanitizer.bypassSecurityTrustResourceUrl(compressedStringImage);
|
|
1218
|
-
})), shareReplay(1));
|
|
1219
|
-
this.isUploaded = false;
|
|
1220
|
-
if (this.ngControl != null) {
|
|
1221
|
-
// Setting the value accessor directly (instead of using
|
|
1222
|
-
// the providers) to avoid running into a circular import.
|
|
1223
|
-
ngControl.valueAccessor = this;
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
ngOnInit() {
|
|
1227
|
-
super.ngOnInit();
|
|
1228
|
-
this.imageSrcUrl$ = combineLatest([
|
|
1229
|
-
this.compressedImageUrlString$.pipe(startWith(null)),
|
|
1230
|
-
this.control.valueChanges.pipe(startWith(this.value), map((controlValue) => {
|
|
1231
|
-
var _a, _b;
|
|
1232
|
-
if (!controlValue)
|
|
1233
|
-
return null;
|
|
1234
|
-
if (controlValue instanceof File)
|
|
1235
|
-
return null;
|
|
1236
|
-
return ((_b = (_a = this.config).mapInputValueToUrl) === null || _b === void 0 ? void 0 : _b.call(_a, controlValue)) || controlValue;
|
|
1237
|
-
}))
|
|
1238
|
-
]).pipe(map(([compressedImageUrlString, controlUrl]) => {
|
|
1239
|
-
return compressedImageUrlString || controlUrl || null;
|
|
1240
|
-
}));
|
|
1241
|
-
this.disabled$ = this.config.disabledCallback
|
|
1242
|
-
? this.config.disabledCallback(this.group, this.config)
|
|
1243
|
-
: of(false);
|
|
1244
|
-
}
|
|
1245
|
-
filesChanged(files) {
|
|
1246
|
-
if (files && files.length > 0) {
|
|
1247
|
-
const imageFile = files[0];
|
|
1248
|
-
// We clear the control here so that it is invalid while compressing
|
|
1249
|
-
// the input pipeline will take care of resetting it
|
|
1250
|
-
this.control.patchValue(null);
|
|
1251
|
-
// this.control.setErrors({compressing: {loadingMessage: 'Please wait while file compresses'}});
|
|
1252
|
-
this.control.markAsTouched();
|
|
1253
|
-
this.inputImageFileSubject.next(imageFile);
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
clearFileInput() {
|
|
1257
|
-
this.inputImageFileSubject.next(null);
|
|
1258
|
-
this.fileInputRef.nativeElement.value = '';
|
|
1259
|
-
this.control.patchValue(null);
|
|
1260
|
-
this.control.markAsTouched();
|
|
1261
|
-
this.isUploaded = false;
|
|
1262
|
-
}
|
|
1263
|
-
resetToInitialValue(initialValue) {
|
|
1264
|
-
this.inputImageFileSubject.next(null);
|
|
1265
|
-
this.control.patchValue(initialValue);
|
|
1266
|
-
this.isUploaded = false;
|
|
1267
|
-
}
|
|
1268
|
-
writeValue(value) { }
|
|
1269
|
-
registerOnChange(fn) {
|
|
1270
|
-
this.onChange = fn;
|
|
1271
|
-
}
|
|
1272
|
-
registerOnTouched(fn) { }
|
|
1273
|
-
}
|
|
1274
|
-
ImageUploadFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: ImageUploadFieldComponent, deps: [{ token: i4$1.NgControl, optional: true, self: true }, { token: i2$3.DomSanitizer }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1275
|
-
ImageUploadFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.1", type: ImageUploadFieldComponent, selector: "crispr-image-upload-field", viewQueries: [{ propertyName: "fileInputRef", first: true, predicate: ["fileInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label>{{config.label}}</mat-label>\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n <input\n #fileInput\n type=\"file\"\n [accept]=\"config.acceptedTypes\"\n (change)=\"filesChanged($event.target.files)\"/>\n <div class=\"ui-container\">\n\n <div class=\"image-preview\" [style.height]=\"config.imagePreviewHeight\">\n <crispr-selected-file\n *ngIf=\"(progress < 100) && inputImageFile$ | async as file; else dropzoneOrPreview\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"'Compressing: ' + file.name\"\n [showProgress]=\"true\"\n [progress]=\"progress\">\n </crispr-selected-file>\n\n <ng-template #dropzoneOrPreview>\n <!-- <img *ngIf=\"(initialUrlString$ | async) as initialUrlString;\" [src]=\"initialUrlString\" alt=\"\"> -->\n <img *ngIf=\"imageSrcUrl$ | async as srcUrl; else noImage\" [src]=\"srcUrl\" alt=\"\">\n <ng-template #noImage>\n <div class=\"drop-container\"\n [crisprFileDropzone]=\"!(disabled$ | async)\"\n (fileDrop)=\"filesChanged($event)\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n </div>\n </ng-template>\n\n </ng-template>\n </div>\n\n\n\n <!-- </ng-template> -->\n <div class=\"button-container\" *ngIf=\"true\">\n\n <button\n mat-button\n (click)=\"clearFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>delete</mat-icon>\n {{config.clearFilesButtonText}}\n </button>\n\n <button\n *ngIf=\"value\"\n mat-button\n (click)=\"resetToInitialValue(value)\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>replay</mat-icon>\n {{config.resetFilesButtonText}}\n </button>\n\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async)\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n <mat-icon>\n camera\n </mat-icon>\n SELECT\n </button>\n </div>\n </div>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: [":host ::ng-deep .mat-form-field .mat-form-field-infix{padding-top:0}:host ::ng-deep .mat-form-field .mat-button-wrapper{display:flex;flex-direction:column;align-items:center;padding-top:8px}:host .ui-container{display:flex;flex-direction:column}:host .ui-container .image-preview{display:flex;flex-direction:column;align-content:space-between;justify-content:center;align-items:center;margin:8px 0;flex-grow:1}:host .ui-container .image-preview crispr-selected-file{width:100%}:host .ui-container .image-preview .drop-container{display:flex;box-sizing:border-box;flex-direction:column;align-items:center;border:3px dashed gray;height:100%;width:100%;align-content:center;justify-content:center;border-radius:8px}:host .ui-container .image-preview .drop-container .drop-icon{height:32px;width:32px;font-size:36px}:host .ui-container .image-preview .drop-container .mat-h2{margin:0}:host .ui-container .image-preview img{height:inherit;max-width:100%}:host .ui-container .button-container{display:flex;flex-direction:var(--image-upload-button-container-direction);justify-content:flex-end}:host .ui-container .button-container button{margin-left:8px}:host input{position:absolute;max-height:0;visibility:hidden}\n"], components: [{ type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { type: i2$1.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: SelectedFileComponent, selector: "crispr-selected-file", inputs: ["fileName", "progress", "showProgress", "color"] }, { type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i5.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { type: i2$1.MatLabel, selector: "mat-label" }, { type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { type: i5.ControlErrorsDirective, selector: "[formControl], [formControlName]" }, { type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: FileDropzoneDirective, selector: "[crisprFileDropzone]", inputs: ["crisprFileDropzone"], outputs: ["fileDrop"] }, { type: i2$1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }], pipes: { "async": i2.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
1276
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: ImageUploadFieldComponent, decorators: [{
|
|
1277
|
-
type: Component,
|
|
1278
|
-
args: [{ selector: 'crispr-image-upload-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label>{{config.label}}</mat-label>\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n <input\n #fileInput\n type=\"file\"\n [accept]=\"config.acceptedTypes\"\n (change)=\"filesChanged($event.target.files)\"/>\n <div class=\"ui-container\">\n\n <div class=\"image-preview\" [style.height]=\"config.imagePreviewHeight\">\n <crispr-selected-file\n *ngIf=\"(progress < 100) && inputImageFile$ | async as file; else dropzoneOrPreview\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"'Compressing: ' + file.name\"\n [showProgress]=\"true\"\n [progress]=\"progress\">\n </crispr-selected-file>\n\n <ng-template #dropzoneOrPreview>\n <!-- <img *ngIf=\"(initialUrlString$ | async) as initialUrlString;\" [src]=\"initialUrlString\" alt=\"\"> -->\n <img *ngIf=\"imageSrcUrl$ | async as srcUrl; else noImage\" [src]=\"srcUrl\" alt=\"\">\n <ng-template #noImage>\n <div class=\"drop-container\"\n [crisprFileDropzone]=\"!(disabled$ | async)\"\n (fileDrop)=\"filesChanged($event)\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n </div>\n </ng-template>\n\n </ng-template>\n </div>\n\n\n\n <!-- </ng-template> -->\n <div class=\"button-container\" *ngIf=\"true\">\n\n <button\n mat-button\n (click)=\"clearFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>delete</mat-icon>\n {{config.clearFilesButtonText}}\n </button>\n\n <button\n *ngIf=\"value\"\n mat-button\n (click)=\"resetToInitialValue(value)\"\n type=\"button\"\n [disabled]=\"(disabled$ | async)\"\n aria-label=\"Remove Selected File(s)\">\n <mat-icon>replay</mat-icon>\n {{config.resetFilesButtonText}}\n </button>\n\n <button\n mat-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async)\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n <mat-icon>\n camera\n </mat-icon>\n SELECT\n </button>\n </div>\n </div>\n\n <mat-hint *ngIf=\"config.hint && (control.valid || !control.touched)\">{{config.hint}}</mat-hint>\n\n </mat-form-field>\n\n</crispr-field-container>\n", styles: [":host ::ng-deep .mat-form-field .mat-form-field-infix{padding-top:0}:host ::ng-deep .mat-form-field .mat-button-wrapper{display:flex;flex-direction:column;align-items:center;padding-top:8px}:host .ui-container{display:flex;flex-direction:column}:host .ui-container .image-preview{display:flex;flex-direction:column;align-content:space-between;justify-content:center;align-items:center;margin:8px 0;flex-grow:1}:host .ui-container .image-preview crispr-selected-file{width:100%}:host .ui-container .image-preview .drop-container{display:flex;box-sizing:border-box;flex-direction:column;align-items:center;border:3px dashed gray;height:100%;width:100%;align-content:center;justify-content:center;border-radius:8px}:host .ui-container .image-preview .drop-container .drop-icon{height:32px;width:32px;font-size:36px}:host .ui-container .image-preview .drop-container .mat-h2{margin:0}:host .ui-container .image-preview img{height:inherit;max-width:100%}:host .ui-container .button-container{display:flex;flex-direction:var(--image-upload-button-container-direction);justify-content:flex-end}:host .ui-container .button-container button{margin-left:8px}:host input{position:absolute;max-height:0;visibility:hidden}\n"] }]
|
|
1279
|
-
}], ctorParameters: function () {
|
|
1280
|
-
return [{ type: i4$1.NgControl, decorators: [{
|
|
1281
|
-
type: Optional
|
|
1282
|
-
}, {
|
|
1283
|
-
type: Self
|
|
1284
|
-
}] }, { type: i2$3.DomSanitizer }, { type: i0.ChangeDetectorRef }];
|
|
1285
|
-
}, propDecorators: { fileInputRef: [{
|
|
1286
|
-
type: ViewChild,
|
|
1287
|
-
args: ['fileInput']
|
|
1288
|
-
}] } });
|
|
1289
|
-
class ImageUploadFieldModule {
|
|
1290
|
-
}
|
|
1291
|
-
ImageUploadFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: ImageUploadFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1292
|
-
ImageUploadFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: ImageUploadFieldModule, declarations: [ImageUploadFieldComponent], imports: [CommonModule,
|
|
1293
|
-
FieldContainerModule,
|
|
1294
|
-
ReactiveFormsModule,
|
|
1295
|
-
MatIconModule,
|
|
1296
|
-
MatButtonModule,
|
|
1297
|
-
MatFormFieldModule,
|
|
1298
|
-
MatInputModule,
|
|
1299
|
-
SelectedFileModule,
|
|
1300
|
-
FileUploadFieldModule,
|
|
1301
|
-
FormValidationHandlerModule], exports: [ImageUploadFieldComponent] });
|
|
1302
|
-
ImageUploadFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: ImageUploadFieldModule, imports: [[
|
|
1303
|
-
CommonModule,
|
|
1304
|
-
FieldContainerModule,
|
|
1305
|
-
ReactiveFormsModule,
|
|
1306
|
-
MatIconModule,
|
|
1307
|
-
MatButtonModule,
|
|
1308
|
-
MatFormFieldModule,
|
|
1309
|
-
MatInputModule,
|
|
1310
|
-
SelectedFileModule,
|
|
1311
|
-
FileUploadFieldModule,
|
|
1312
|
-
FormValidationHandlerModule
|
|
1313
|
-
]] });
|
|
1314
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: ImageUploadFieldModule, decorators: [{
|
|
1315
|
-
type: NgModule,
|
|
1316
|
-
args: [{
|
|
1317
|
-
imports: [
|
|
1318
|
-
CommonModule,
|
|
1319
|
-
FieldContainerModule,
|
|
1320
|
-
ReactiveFormsModule,
|
|
1321
|
-
MatIconModule,
|
|
1322
|
-
MatButtonModule,
|
|
1323
|
-
MatFormFieldModule,
|
|
1324
|
-
MatInputModule,
|
|
1325
|
-
SelectedFileModule,
|
|
1326
|
-
FileUploadFieldModule,
|
|
1327
|
-
FormValidationHandlerModule
|
|
1328
|
-
],
|
|
1329
|
-
exports: [
|
|
1330
|
-
ImageUploadFieldComponent
|
|
1331
|
-
],
|
|
1332
|
-
declarations: [
|
|
1333
|
-
ImageUploadFieldComponent
|
|
1334
|
-
]
|
|
1335
|
-
}]
|
|
1336
|
-
}] });
|
|
1337
|
-
function maxFileSizeValidator(maxFileSize) {
|
|
1338
|
-
return (control) => {
|
|
1339
|
-
const controlValue = control.value;
|
|
1340
|
-
if (!(controlValue instanceof File)) {
|
|
1341
|
-
return null;
|
|
1342
|
-
}
|
|
1343
|
-
const actualFileSize = +convertBytesToMb(controlValue.size).toPrecision(3);
|
|
1344
|
-
if (maxFileSize > actualFileSize)
|
|
1345
|
-
return null;
|
|
1346
|
-
return { maxFileSize: { maxFileSize, actualFileSize } };
|
|
1347
|
-
};
|
|
1348
|
-
}
|
|
1349
|
-
function allowedFileExtValidator(allowedFileExtensions, onlyAllowFiles = true) {
|
|
1350
|
-
return (control) => {
|
|
1351
|
-
const controlValue = control.value;
|
|
1352
|
-
const isFile = controlValue instanceof File;
|
|
1353
|
-
if (!onlyAllowFiles && !isFile)
|
|
1354
|
-
return null;
|
|
1355
|
-
const actualExtension = isFile ? controlValue.name.split('.').pop().toLocaleLowerCase() : 'Not a file';
|
|
1356
|
-
const isAllowedExtension = allowedFileExtensions.includes(actualExtension);
|
|
1357
|
-
if (isAllowedExtension) {
|
|
1358
|
-
return null;
|
|
1359
|
-
}
|
|
1360
|
-
return { allowedExtension: { allowedFileExtensions, actualExtension } };
|
|
1361
|
-
};
|
|
1362
|
-
}
|
|
1363
|
-
function allowedFileType(matchExp) {
|
|
1364
|
-
return (formControl) => {
|
|
1365
|
-
const value = formControl.value;
|
|
1366
|
-
if (!(value instanceof File))
|
|
1367
|
-
return null;
|
|
1368
|
-
const type = value.type;
|
|
1369
|
-
const matches = type.match(matchExp);
|
|
1370
|
-
if (!type || !(matches === null || matches === void 0 ? void 0 : matches.length)) {
|
|
1371
|
-
return {
|
|
1372
|
-
allowedFileType: {
|
|
1373
|
-
actualType: type,
|
|
1374
|
-
allowedTypeExp: matchExp
|
|
1375
|
-
}
|
|
1376
|
-
};
|
|
1377
|
-
}
|
|
1378
|
-
else {
|
|
1379
|
-
return null;
|
|
1380
|
-
}
|
|
1381
|
-
};
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
// TODO: Should we import UI library?
|
|
1385
|
-
// Will the tree shaker shake the unused modules?
|
|
1386
|
-
const MAT_DESIGN_MODULES = [
|
|
1387
|
-
MatIconModule,
|
|
1388
|
-
MatAutocompleteModule,
|
|
1389
|
-
MatDatepickerModule,
|
|
1390
|
-
MatInputModule,
|
|
1391
|
-
MatRadioModule,
|
|
1392
|
-
MatSelectModule,
|
|
1393
|
-
MatCheckboxModule,
|
|
1394
|
-
MatChipsModule,
|
|
1395
|
-
MatSliderModule,
|
|
1396
|
-
MatSlideToggleModule,
|
|
1397
|
-
MatButtonModule,
|
|
1398
|
-
MatButtonToggleModule,
|
|
1399
|
-
MatChipsModule,
|
|
1400
|
-
MatTooltipModule,
|
|
1401
|
-
MatFormFieldModule,
|
|
1402
|
-
MatMomentDateModule,
|
|
1403
|
-
MatDividerModule,
|
|
1404
|
-
MatProgressBarModule,
|
|
1405
|
-
PortalModule
|
|
1406
|
-
];
|
|
1407
|
-
const CRISPR_FIELDS = [
|
|
1408
|
-
InputFieldComponent,
|
|
1409
|
-
SelectFieldComponent,
|
|
1410
|
-
RadioFieldComponent,
|
|
1411
|
-
AutocompleteFieldComponent,
|
|
1412
|
-
AutocompleteChiplistFieldComponent,
|
|
1413
|
-
CheckboxFieldComponent,
|
|
1414
|
-
TextareaFieldComponent,
|
|
1415
|
-
DatepickerFieldComponent,
|
|
1416
|
-
SliderFieldComponent,
|
|
1417
|
-
ButtonComponent,
|
|
1418
|
-
DividerComponent,
|
|
1419
|
-
UnitConversionFieldComponent,
|
|
1420
|
-
OptionComponent,
|
|
1421
|
-
];
|
|
1422
|
-
class MaterialModule {
|
|
1423
|
-
}
|
|
1424
|
-
MaterialModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: MaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1425
|
-
MaterialModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: MaterialModule, declarations: [InputFieldComponent,
|
|
1426
|
-
SelectFieldComponent,
|
|
1427
|
-
RadioFieldComponent,
|
|
1428
|
-
AutocompleteFieldComponent,
|
|
1429
|
-
AutocompleteChiplistFieldComponent,
|
|
1430
|
-
CheckboxFieldComponent,
|
|
1431
|
-
TextareaFieldComponent,
|
|
1432
|
-
DatepickerFieldComponent,
|
|
1433
|
-
SliderFieldComponent,
|
|
1434
|
-
ButtonComponent,
|
|
1435
|
-
DividerComponent,
|
|
1436
|
-
UnitConversionFieldComponent,
|
|
1437
|
-
OptionComponent], imports: [CommonModule,
|
|
1438
|
-
ReactiveFormsModule,
|
|
1439
|
-
FormValidationHandlerModule,
|
|
1440
|
-
InfoModule,
|
|
1441
|
-
FileUploadFieldModule,
|
|
1442
|
-
HeadingModule,
|
|
1443
|
-
FieldContainerModule, MatIconModule,
|
|
1444
|
-
MatAutocompleteModule,
|
|
1445
|
-
MatDatepickerModule,
|
|
1446
|
-
MatInputModule,
|
|
1447
|
-
MatRadioModule,
|
|
1448
|
-
MatSelectModule,
|
|
1449
|
-
MatCheckboxModule,
|
|
1450
|
-
MatChipsModule,
|
|
1451
|
-
MatSliderModule,
|
|
1452
|
-
MatSlideToggleModule,
|
|
1453
|
-
MatButtonModule,
|
|
1454
|
-
MatButtonToggleModule,
|
|
1455
|
-
MatChipsModule,
|
|
1456
|
-
MatTooltipModule,
|
|
1457
|
-
MatFormFieldModule,
|
|
1458
|
-
MatMomentDateModule,
|
|
1459
|
-
MatDividerModule,
|
|
1460
|
-
MatProgressBarModule,
|
|
1461
|
-
PortalModule], exports: [MatIconModule,
|
|
1462
|
-
MatAutocompleteModule,
|
|
1463
|
-
MatDatepickerModule,
|
|
1464
|
-
MatInputModule,
|
|
1465
|
-
MatRadioModule,
|
|
1466
|
-
MatSelectModule,
|
|
1467
|
-
MatCheckboxModule,
|
|
1468
|
-
MatChipsModule,
|
|
1469
|
-
MatSliderModule,
|
|
1470
|
-
MatSlideToggleModule,
|
|
1471
|
-
MatButtonModule,
|
|
1472
|
-
MatButtonToggleModule,
|
|
1473
|
-
MatChipsModule,
|
|
1474
|
-
MatTooltipModule,
|
|
1475
|
-
MatFormFieldModule,
|
|
1476
|
-
MatMomentDateModule,
|
|
1477
|
-
MatDividerModule,
|
|
1478
|
-
MatProgressBarModule,
|
|
1479
|
-
PortalModule, InputFieldComponent,
|
|
1480
|
-
SelectFieldComponent,
|
|
1481
|
-
RadioFieldComponent,
|
|
1482
|
-
AutocompleteFieldComponent,
|
|
1483
|
-
AutocompleteChiplistFieldComponent,
|
|
1484
|
-
CheckboxFieldComponent,
|
|
1485
|
-
TextareaFieldComponent,
|
|
1486
|
-
DatepickerFieldComponent,
|
|
1487
|
-
SliderFieldComponent,
|
|
1488
|
-
ButtonComponent,
|
|
1489
|
-
DividerComponent,
|
|
1490
|
-
UnitConversionFieldComponent,
|
|
1491
|
-
OptionComponent] });
|
|
1492
|
-
MaterialModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: MaterialModule, imports: [[
|
|
1493
|
-
CommonModule,
|
|
1494
|
-
ReactiveFormsModule,
|
|
1495
|
-
FormValidationHandlerModule,
|
|
1496
|
-
InfoModule,
|
|
1497
|
-
FileUploadFieldModule,
|
|
1498
|
-
HeadingModule,
|
|
1499
|
-
FieldContainerModule,
|
|
1500
|
-
...MAT_DESIGN_MODULES,
|
|
1501
|
-
], MatIconModule,
|
|
1502
|
-
MatAutocompleteModule,
|
|
1503
|
-
MatDatepickerModule,
|
|
1504
|
-
MatInputModule,
|
|
1505
|
-
MatRadioModule,
|
|
1506
|
-
MatSelectModule,
|
|
1507
|
-
MatCheckboxModule,
|
|
1508
|
-
MatChipsModule,
|
|
1509
|
-
MatSliderModule,
|
|
1510
|
-
MatSlideToggleModule,
|
|
1511
|
-
MatButtonModule,
|
|
1512
|
-
MatButtonToggleModule,
|
|
1513
|
-
MatChipsModule,
|
|
1514
|
-
MatTooltipModule,
|
|
1515
|
-
MatFormFieldModule,
|
|
1516
|
-
MatMomentDateModule,
|
|
1517
|
-
MatDividerModule,
|
|
1518
|
-
MatProgressBarModule,
|
|
1519
|
-
PortalModule] });
|
|
1520
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: MaterialModule, decorators: [{
|
|
1521
|
-
type: NgModule,
|
|
1522
|
-
args: [{
|
|
1523
|
-
imports: [
|
|
1524
|
-
CommonModule,
|
|
1525
|
-
ReactiveFormsModule,
|
|
1526
|
-
FormValidationHandlerModule,
|
|
1527
|
-
InfoModule,
|
|
1528
|
-
FileUploadFieldModule,
|
|
1529
|
-
HeadingModule,
|
|
1530
|
-
FieldContainerModule,
|
|
1531
|
-
...MAT_DESIGN_MODULES,
|
|
1532
|
-
],
|
|
1533
|
-
exports: [
|
|
1534
|
-
...MAT_DESIGN_MODULES,
|
|
1535
|
-
...CRISPR_FIELDS
|
|
1536
|
-
],
|
|
1537
|
-
declarations: [
|
|
1538
|
-
...CRISPR_FIELDS,
|
|
1539
|
-
]
|
|
1540
|
-
}]
|
|
1541
|
-
}] });
|
|
1542
|
-
|
|
1543
|
-
var index$2 = /*#__PURE__*/Object.freeze({
|
|
1544
|
-
__proto__: null,
|
|
1545
|
-
InputFieldComponent: InputFieldComponent,
|
|
1546
|
-
SelectFieldComponent: SelectFieldComponent,
|
|
1547
|
-
AutocompleteFieldComponent: AutocompleteFieldComponent,
|
|
1548
|
-
AutocompleteChiplistFieldComponent: AutocompleteChiplistFieldComponent,
|
|
1549
|
-
CheckboxFieldComponent: CheckboxFieldComponent,
|
|
1550
|
-
TextareaFieldComponent: TextareaFieldComponent,
|
|
1551
|
-
SliderFieldComponent: SliderFieldComponent,
|
|
1552
|
-
ButtonComponent: ButtonComponent,
|
|
1553
|
-
DatepickerFieldComponent: DatepickerFieldComponent,
|
|
1554
|
-
HeadingComponent: HeadingComponent,
|
|
1555
|
-
HeadingModule: HeadingModule,
|
|
1556
|
-
DividerComponent: DividerComponent,
|
|
1557
|
-
RadioFieldComponent: RadioFieldComponent,
|
|
1558
|
-
UnitConversionFieldComponent: UnitConversionFieldComponent,
|
|
1559
|
-
ImageUploadFieldComponent: ImageUploadFieldComponent,
|
|
1560
|
-
ImageUploadFieldModule: ImageUploadFieldModule,
|
|
1561
|
-
maxFileSizeValidator: maxFileSizeValidator,
|
|
1562
|
-
allowedFileExtValidator: allowedFileExtValidator,
|
|
1563
|
-
allowedFileType: allowedFileType,
|
|
1564
|
-
FileDropzoneDirective: FileDropzoneDirective,
|
|
1565
|
-
FileUploadFieldComponent: FileUploadFieldComponent,
|
|
1566
|
-
FileUploadFieldModule: FileUploadFieldModule,
|
|
1567
|
-
MaterialModule: MaterialModule,
|
|
1568
|
-
OptionComponent: OptionComponent
|
|
1569
|
-
});
|
|
10
|
+
import { isControlConfig, ControlType, buildFormGroupFromConfig, crisprControlMixin, CrisprFieldComponent, createControlForType } from '@tft/crispr-forms/utils';
|
|
11
|
+
export * from '@tft/crispr-forms/utils';
|
|
12
|
+
import * as i2$1 from '@angular/material/button';
|
|
13
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
14
|
+
import * as i3$2 from '@angular/material/icon';
|
|
15
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
16
|
+
import * as i3 from '@tft/crispr-forms/ui';
|
|
17
|
+
import { FieldContainerComponent } from '@tft/crispr-forms/ui';
|
|
18
|
+
export * from '@tft/crispr-forms/ui';
|
|
1570
19
|
|
|
1571
20
|
const FIELD_COMPONENTS = {
|
|
1572
21
|
groupList: Promise.resolve().then(function () { return index$1; }).then(({ FormGroupListComponent }) => FormGroupListComponent),
|
|
1573
22
|
subGroup: Promise.resolve().then(function () { return index; }).then(({ SubGroupComponent }) => SubGroupComponent),
|
|
1574
|
-
button:
|
|
1575
|
-
input:
|
|
1576
|
-
select:
|
|
1577
|
-
radio:
|
|
1578
|
-
autocomplete:
|
|
1579
|
-
autocompleteChiplist:
|
|
1580
|
-
textarea:
|
|
1581
|
-
checkbox:
|
|
1582
|
-
slider:
|
|
1583
|
-
datepicker:
|
|
1584
|
-
fileUpload:
|
|
1585
|
-
imageUpload:
|
|
1586
|
-
heading:
|
|
1587
|
-
divider:
|
|
1588
|
-
unitConversion:
|
|
23
|
+
button: import('@tft/crispr-forms/ui/button').then(({ ButtonComponent }) => ButtonComponent),
|
|
24
|
+
input: import('@tft/crispr-forms/ui/input-field').then(({ InputFieldComponent }) => InputFieldComponent),
|
|
25
|
+
select: import('@tft/crispr-forms/ui/select-field').then(({ SelectFieldComponent }) => SelectFieldComponent),
|
|
26
|
+
radio: import('@tft/crispr-forms/ui/radio-field').then(({ RadioFieldComponent }) => RadioFieldComponent),
|
|
27
|
+
autocomplete: import('@tft/crispr-forms/ui/autocomplete-field').then(({ AutocompleteFieldComponent }) => AutocompleteFieldComponent),
|
|
28
|
+
autocompleteChiplist: import('@tft/crispr-forms/ui/autocomplete-chiplist-field').then(({ AutocompleteChiplistFieldComponent }) => AutocompleteChiplistFieldComponent),
|
|
29
|
+
textarea: import('@tft/crispr-forms/ui/textarea-field').then(({ TextareaFieldComponent }) => TextareaFieldComponent),
|
|
30
|
+
checkbox: import('@tft/crispr-forms/ui/checkbox-field').then(({ CheckboxFieldComponent }) => CheckboxFieldComponent),
|
|
31
|
+
slider: import('@tft/crispr-forms/ui/slider-field').then(({ SliderFieldComponent }) => SliderFieldComponent),
|
|
32
|
+
datepicker: import('@tft/crispr-forms/ui/datepicker-field').then(({ DatepickerFieldComponent }) => DatepickerFieldComponent),
|
|
33
|
+
fileUpload: import('@tft/crispr-forms/ui/file-upload-field').then(({ FileUploadFieldComponent }) => FileUploadFieldComponent),
|
|
34
|
+
imageUpload: import('@tft/crispr-forms/ui/image-upload-field').then(({ ImageUploadFieldComponent }) => ImageUploadFieldComponent),
|
|
35
|
+
heading: import('@tft/crispr-forms/ui').then(({ HeadingComponent }) => HeadingComponent),
|
|
36
|
+
divider: import('@tft/crispr-forms/ui/divider').then(({ DividerComponent }) => DividerComponent),
|
|
37
|
+
unitConversion: import('@tft/crispr-forms/ui/unit-conversion-field').then(({ UnitConversionFieldComponent }) => UnitConversionFieldComponent)
|
|
1589
38
|
};
|
|
1590
39
|
function isControlComponent(component) {
|
|
1591
40
|
return component && isControlConfig(component.config) && 'value' in component; // || component.config.controlType === ControlType.BUTTON;
|
|
@@ -1645,12 +94,13 @@ class CrisprFieldDirective {
|
|
|
1645
94
|
}
|
|
1646
95
|
}
|
|
1647
96
|
}
|
|
1648
|
-
CrisprFieldDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1649
|
-
CrisprFieldDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1650
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
97
|
+
CrisprFieldDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFieldDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
98
|
+
CrisprFieldDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: CrisprFieldDirective, isStandalone: true, selector: "[crisprField]", inputs: { config: "config", group: "group", value: "value" }, ngImport: i0 });
|
|
99
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFieldDirective, decorators: [{
|
|
1651
100
|
type: Directive,
|
|
1652
101
|
args: [{
|
|
1653
|
-
selector: '[crisprField]'
|
|
102
|
+
selector: '[crisprField]',
|
|
103
|
+
standalone: true
|
|
1654
104
|
}]
|
|
1655
105
|
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { config: [{
|
|
1656
106
|
type: Input
|
|
@@ -1658,28 +108,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImpor
|
|
|
1658
108
|
type: Input
|
|
1659
109
|
}], value: [{
|
|
1660
110
|
type: Input
|
|
1661
|
-
}] } });
|
|
1662
|
-
class CrisprFieldModule {
|
|
1663
|
-
}
|
|
1664
|
-
CrisprFieldModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1665
|
-
CrisprFieldModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprFieldModule, declarations: [CrisprFieldDirective], imports: [CommonModule], exports: [CrisprFieldDirective] });
|
|
1666
|
-
CrisprFieldModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprFieldModule, imports: [[
|
|
1667
|
-
CommonModule,
|
|
1668
|
-
]] });
|
|
1669
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprFieldModule, decorators: [{
|
|
1670
|
-
type: NgModule,
|
|
1671
|
-
args: [{
|
|
1672
|
-
imports: [
|
|
1673
|
-
CommonModule,
|
|
1674
|
-
],
|
|
1675
|
-
exports: [
|
|
1676
|
-
CrisprFieldDirective
|
|
1677
|
-
],
|
|
1678
|
-
declarations: [
|
|
1679
|
-
CrisprFieldDirective
|
|
1680
|
-
]
|
|
1681
|
-
}]
|
|
1682
|
-
}] });
|
|
111
|
+
}] } });
|
|
1683
112
|
|
|
1684
113
|
class InitialControlValuePipe {
|
|
1685
114
|
// TODO: does changing any to unknown break anything?
|
|
@@ -1689,15 +118,35 @@ class InitialControlValuePipe {
|
|
|
1689
118
|
: null;
|
|
1690
119
|
}
|
|
1691
120
|
}
|
|
1692
|
-
InitialControlValuePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1693
|
-
InitialControlValuePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "
|
|
1694
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
121
|
+
InitialControlValuePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: InitialControlValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
122
|
+
InitialControlValuePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: InitialControlValuePipe, name: "initialControlValue" });
|
|
123
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: InitialControlValuePipe, decorators: [{
|
|
1695
124
|
type: Pipe,
|
|
1696
125
|
args: [{
|
|
1697
126
|
name: 'initialControlValue'
|
|
1698
127
|
}]
|
|
1699
128
|
}] });
|
|
1700
129
|
|
|
130
|
+
class CrisprPipesModule {
|
|
131
|
+
}
|
|
132
|
+
CrisprPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
133
|
+
CrisprPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: CrisprPipesModule, declarations: [InitialControlValuePipe], imports: [CommonModule], exports: [InitialControlValuePipe] });
|
|
134
|
+
CrisprPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprPipesModule, imports: [CommonModule] });
|
|
135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprPipesModule, decorators: [{
|
|
136
|
+
type: NgModule,
|
|
137
|
+
args: [{
|
|
138
|
+
imports: [
|
|
139
|
+
CommonModule
|
|
140
|
+
],
|
|
141
|
+
exports: [
|
|
142
|
+
InitialControlValuePipe
|
|
143
|
+
],
|
|
144
|
+
declarations: [
|
|
145
|
+
InitialControlValuePipe
|
|
146
|
+
]
|
|
147
|
+
}]
|
|
148
|
+
}] });
|
|
149
|
+
|
|
1701
150
|
class CrisprFormComponent {
|
|
1702
151
|
constructor() {
|
|
1703
152
|
this.form = new FormGroup({});
|
|
@@ -1719,11 +168,17 @@ class CrisprFormComponent {
|
|
|
1719
168
|
this.submitTrigger.nativeElement.click();
|
|
1720
169
|
}
|
|
1721
170
|
}
|
|
1722
|
-
CrisprFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1723
|
-
CrisprFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1724
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
171
|
+
CrisprFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
172
|
+
CrisprFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: CrisprFormComponent, isStandalone: true, selector: "crispr-form", inputs: { config: "config", form: "form", value: "value" }, outputs: { submitted: "submitted", valueChanges: "valueChanges", statusChanges: "statusChanges" }, viewQueries: [{ propertyName: "submitTrigger", first: true, predicate: ["submitTrigger"], descendants: true }], ngImport: i0, 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 #ngFormElement=\"ngForm\">\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 <!-- Hidden button, programmatically clicked when crispr form triggerSubmit function called.\n Uses a hidden button with type=\"submit\" because it will trigger both native form submit event\n (which the error handler has to listen for) and ngSubmit event -->\n <button #submitTrigger class=\"submit-trigger\" type=\"submit\">\n </button>\n</form>\n", styles: [".submit-trigger{display:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: CrisprFieldDirective, selector: "[crisprField]", inputs: ["config", "group", "value"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i3$1.ControlErrorsFormDirective, selector: "form", inputs: ["errorDictionary"] }, { kind: "directive", type: i3$1.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }, { kind: "ngmodule", type: CrisprPipesModule }, { kind: "pipe", type: InitialControlValuePipe, name: "initialControlValue" }], preserveWhitespaces: true });
|
|
173
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormComponent, decorators: [{
|
|
1725
174
|
type: Component,
|
|
1726
|
-
args: [{ selector: 'crispr-form',
|
|
175
|
+
args: [{ selector: 'crispr-form', standalone: true, imports: [
|
|
176
|
+
CommonModule,
|
|
177
|
+
CrisprFieldDirective,
|
|
178
|
+
ReactiveFormsModule,
|
|
179
|
+
FormValidationHandlerModule,
|
|
180
|
+
CrisprPipesModule
|
|
181
|
+
], 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 #ngFormElement=\"ngForm\">\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 <!-- Hidden button, programmatically clicked when crispr form triggerSubmit function called.\n Uses a hidden button with type=\"submit\" because it will trigger both native form submit event\n (which the error handler has to listen for) and ngSubmit event -->\n <button #submitTrigger class=\"submit-trigger\" type=\"submit\">\n </button>\n</form>\n", styles: [".submit-trigger{display:none}\n"] }]
|
|
1727
182
|
}], propDecorators: { config: [{
|
|
1728
183
|
type: Input
|
|
1729
184
|
}], form: [{
|
|
@@ -1799,82 +254,25 @@ class FormGroupListComponent extends FormGroupListMixin {
|
|
|
1799
254
|
this.control.removeAt(index);
|
|
1800
255
|
}
|
|
1801
256
|
}
|
|
1802
|
-
FormGroupListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1803
|
-
FormGroupListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1804
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
257
|
+
FormGroupListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FormGroupListComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
258
|
+
FormGroupListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: FormGroupListComponent, isStandalone: true, selector: "crispr-form-group-list", usesInheritance: true, ngImport: i0, template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- Don't add trackBy function, it confuses the state of the array -->\n <div *ngFor=\"let con of control?.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\"> {{ config.itemLabelBuilder ? config.itemLabelBuilder(i) : 'Item ' + (i + 1) }} </span>\n <button\n mat-icon-button\n type=\"button\"\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"clickDelete(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroup]=\"con\">\n <!-- TODO: if chiplists didn't need to have labels mixed in with their values we could use [value]=\"control.value\" below -->\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [value]=\"blockValue ? null : value && value[i] | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"con\">\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)=\"clickAdd()\">\n {{config.addItemLabel || config.addButtonLabel}}\n </button>\n </div>\n\n</crispr-field-container>\n", styles: [".item-header{display:flex;justify-content:space-between}.group-footer{display:flex;justify-content:flex-end}.group-footer button.add{margin-bottom:16px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3$2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: CrisprFieldDirective, selector: "[crisprField]", inputs: ["config", "group", "value"] }, { kind: "ngmodule", type: CrisprPipesModule }, { kind: "pipe", type: InitialControlValuePipe, name: "initialControlValue" }, { kind: "ngmodule", type: FormValidationHandlerModule }, { kind: "directive", type: i3$1.ControlErrorContainerDirective, selector: "[controlErrorContainer], [formGroup]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, preserveWhitespaces: true });
|
|
259
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: FormGroupListComponent, decorators: [{
|
|
1805
260
|
type: Component,
|
|
1806
|
-
args: [{ selector: 'crispr-form-group-list', changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1807
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
|
1808
|
-
|
|
1809
|
-
class CrisprPipesModule {
|
|
1810
|
-
}
|
|
1811
|
-
CrisprPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1812
|
-
CrisprPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprPipesModule, declarations: [InitialControlValuePipe], imports: [CommonModule], exports: [InitialControlValuePipe] });
|
|
1813
|
-
CrisprPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprPipesModule, imports: [[
|
|
1814
|
-
CommonModule
|
|
1815
|
-
]] });
|
|
1816
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprPipesModule, decorators: [{
|
|
1817
|
-
type: NgModule,
|
|
1818
|
-
args: [{
|
|
1819
|
-
imports: [
|
|
1820
|
-
CommonModule
|
|
1821
|
-
],
|
|
1822
|
-
exports: [
|
|
1823
|
-
InitialControlValuePipe
|
|
1824
|
-
],
|
|
1825
|
-
declarations: [
|
|
1826
|
-
InitialControlValuePipe
|
|
1827
|
-
]
|
|
1828
|
-
}]
|
|
1829
|
-
}] });
|
|
1830
|
-
|
|
1831
|
-
class FormGroupListModule {
|
|
1832
|
-
}
|
|
1833
|
-
FormGroupListModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FormGroupListModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1834
|
-
FormGroupListModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FormGroupListModule, declarations: [FormGroupListComponent], imports: [CommonModule,
|
|
1835
|
-
MatButtonModule,
|
|
1836
|
-
MatIconModule,
|
|
1837
|
-
FieldContainerModule,
|
|
1838
|
-
ReactiveFormsModule,
|
|
1839
|
-
CrisprFieldModule,
|
|
1840
|
-
CrisprPipesModule,
|
|
1841
|
-
FormValidationHandlerModule], exports: [FormGroupListComponent] });
|
|
1842
|
-
FormGroupListModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FormGroupListModule, imports: [[
|
|
1843
|
-
CommonModule,
|
|
1844
|
-
MatButtonModule,
|
|
1845
|
-
MatIconModule,
|
|
1846
|
-
FieldContainerModule,
|
|
1847
|
-
ReactiveFormsModule,
|
|
1848
|
-
CrisprFieldModule,
|
|
1849
|
-
CrisprPipesModule,
|
|
1850
|
-
FormValidationHandlerModule
|
|
1851
|
-
]] });
|
|
1852
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: FormGroupListModule, decorators: [{
|
|
1853
|
-
type: NgModule,
|
|
1854
|
-
args: [{
|
|
1855
|
-
imports: [
|
|
261
|
+
args: [{ selector: 'crispr-form-group-list', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
|
|
1856
262
|
CommonModule,
|
|
1857
263
|
MatButtonModule,
|
|
1858
264
|
MatIconModule,
|
|
1859
|
-
|
|
265
|
+
FieldContainerComponent,
|
|
1860
266
|
ReactiveFormsModule,
|
|
1861
|
-
|
|
267
|
+
CrisprFieldDirective,
|
|
1862
268
|
CrisprPipesModule,
|
|
1863
269
|
FormValidationHandlerModule
|
|
1864
|
-
],
|
|
1865
|
-
|
|
1866
|
-
FormGroupListComponent
|
|
1867
|
-
],
|
|
1868
|
-
declarations: [
|
|
1869
|
-
FormGroupListComponent
|
|
1870
|
-
]
|
|
1871
|
-
}]
|
|
1872
|
-
}] });
|
|
270
|
+
], template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- Don't add trackBy function, it confuses the state of the array -->\n <div *ngFor=\"let con of control?.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\"> {{ config.itemLabelBuilder ? config.itemLabelBuilder(i) : 'Item ' + (i + 1) }} </span>\n <button\n mat-icon-button\n type=\"button\"\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"clickDelete(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroup]=\"con\">\n <!-- TODO: if chiplists didn't need to have labels mixed in with their values we could use [value]=\"control.value\" below -->\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [value]=\"blockValue ? null : value && value[i] | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"con\">\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)=\"clickAdd()\">\n {{config.addItemLabel || config.addButtonLabel}}\n </button>\n </div>\n\n</crispr-field-container>\n", styles: [".item-header{display:flex;justify-content:space-between}.group-footer{display:flex;justify-content:flex-end}.group-footer button.add{margin-bottom:16px}\n"] }]
|
|
271
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
|
|
1873
272
|
|
|
1874
273
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1875
274
|
__proto__: null,
|
|
1876
|
-
FormGroupListComponent: FormGroupListComponent
|
|
1877
|
-
FormGroupListModule: FormGroupListModule
|
|
275
|
+
FormGroupListComponent: FormGroupListComponent
|
|
1878
276
|
});
|
|
1879
277
|
|
|
1880
278
|
const FormGroupMixin = crisprControlMixin(CrisprFieldComponent);
|
|
@@ -1883,37 +281,34 @@ class SubGroupComponent extends FormGroupMixin {
|
|
|
1883
281
|
super.ngOnInit();
|
|
1884
282
|
}
|
|
1885
283
|
}
|
|
1886
|
-
SubGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1887
|
-
SubGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1888
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
284
|
+
SubGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SubGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
285
|
+
SubGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: SubGroupComponent, selector: "crispr-sub-group", usesInheritance: true, ngImport: i0, 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", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: CrisprFieldDirective, selector: "[crisprField]", inputs: ["config", "group", "value"] }, { kind: "component", type: i3.FieldContainerComponent, selector: "crispr-field-container", inputs: ["config", "group", "inlineField"] }, { kind: "pipe", type: InitialControlValuePipe, name: "initialControlValue" }], preserveWhitespaces: true });
|
|
286
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SubGroupComponent, decorators: [{
|
|
1889
287
|
type: Component,
|
|
1890
|
-
args: [{ selector: 'crispr-sub-group', 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"
|
|
288
|
+
args: [{ selector: 'crispr-sub-group', 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" }]
|
|
1891
289
|
}] });
|
|
1892
290
|
|
|
1893
291
|
class SubGroupModule {
|
|
1894
292
|
}
|
|
1895
|
-
SubGroupModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1896
|
-
SubGroupModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
1897
|
-
|
|
1898
|
-
|
|
293
|
+
SubGroupModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SubGroupModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
294
|
+
SubGroupModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: SubGroupModule, declarations: [SubGroupComponent], imports: [CommonModule,
|
|
295
|
+
CrisprFieldDirective,
|
|
296
|
+
FieldContainerComponent,
|
|
1899
297
|
CrisprPipesModule,
|
|
1900
298
|
// TODO: Does this need to be here?
|
|
1901
299
|
FormValidationHandlerModule], exports: [SubGroupComponent] });
|
|
1902
|
-
SubGroupModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
FormValidationHandlerModule
|
|
1909
|
-
]] });
|
|
1910
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: SubGroupModule, decorators: [{
|
|
300
|
+
SubGroupModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SubGroupModule, imports: [CommonModule,
|
|
301
|
+
FieldContainerComponent,
|
|
302
|
+
CrisprPipesModule,
|
|
303
|
+
// TODO: Does this need to be here?
|
|
304
|
+
FormValidationHandlerModule] });
|
|
305
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: SubGroupModule, decorators: [{
|
|
1911
306
|
type: NgModule,
|
|
1912
307
|
args: [{
|
|
1913
308
|
imports: [
|
|
1914
309
|
CommonModule,
|
|
1915
|
-
|
|
1916
|
-
|
|
310
|
+
CrisprFieldDirective,
|
|
311
|
+
FieldContainerComponent,
|
|
1917
312
|
CrisprPipesModule,
|
|
1918
313
|
// TODO: Does this need to be here?
|
|
1919
314
|
FormValidationHandlerModule
|
|
@@ -1935,51 +330,43 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
1935
330
|
|
|
1936
331
|
class CrisprFormsModule {
|
|
1937
332
|
}
|
|
1938
|
-
CrisprFormsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1939
|
-
CrisprFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
333
|
+
CrisprFormsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
334
|
+
CrisprFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormsModule, imports: [CommonModule,
|
|
1940
335
|
ReactiveFormsModule,
|
|
1941
336
|
FormValidationHandlerModule,
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
337
|
+
FormGroupListComponent,
|
|
338
|
+
FieldContainerComponent,
|
|
339
|
+
CrisprFieldDirective,
|
|
1945
340
|
SubGroupModule,
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
MaterialModule,
|
|
1959
|
-
CrisprPipesModule,
|
|
1960
|
-
], FieldContainerModule,
|
|
1961
|
-
MaterialModule] });
|
|
1962
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImport: i0, type: CrisprFormsModule, decorators: [{
|
|
341
|
+
CrisprPipesModule,
|
|
342
|
+
CrisprFormComponent], exports: [CrisprFormComponent,
|
|
343
|
+
FieldContainerComponent] });
|
|
344
|
+
CrisprFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormsModule, imports: [CommonModule,
|
|
345
|
+
ReactiveFormsModule,
|
|
346
|
+
FormValidationHandlerModule,
|
|
347
|
+
FormGroupListComponent,
|
|
348
|
+
FieldContainerComponent,
|
|
349
|
+
SubGroupModule,
|
|
350
|
+
CrisprPipesModule,
|
|
351
|
+
CrisprFormComponent] });
|
|
352
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: CrisprFormsModule, decorators: [{
|
|
1963
353
|
type: NgModule,
|
|
1964
354
|
args: [{
|
|
1965
355
|
imports: [
|
|
1966
356
|
CommonModule,
|
|
1967
357
|
ReactiveFormsModule,
|
|
1968
358
|
FormValidationHandlerModule,
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
359
|
+
FormGroupListComponent,
|
|
360
|
+
FieldContainerComponent,
|
|
361
|
+
CrisprFieldDirective,
|
|
1972
362
|
SubGroupModule,
|
|
1973
|
-
MaterialModule,
|
|
1974
363
|
CrisprPipesModule,
|
|
1975
|
-
|
|
1976
|
-
declarations: [
|
|
1977
|
-
CrisprFormComponent,
|
|
364
|
+
CrisprFormComponent
|
|
1978
365
|
],
|
|
1979
366
|
exports: [
|
|
1980
367
|
CrisprFormComponent,
|
|
1981
|
-
|
|
1982
|
-
MaterialModule
|
|
368
|
+
FieldContainerComponent,
|
|
369
|
+
// MaterialModule
|
|
1983
370
|
]
|
|
1984
371
|
}]
|
|
1985
372
|
}] });
|
|
@@ -1988,5 +375,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImpor
|
|
|
1988
375
|
* Generated bundle index. Do not edit.
|
|
1989
376
|
*/
|
|
1990
377
|
|
|
1991
|
-
export {
|
|
378
|
+
export { CrisprFormComponent, CrisprFormsModule };
|
|
1992
379
|
//# sourceMappingURL=tft-crispr-forms.mjs.map
|