@tft/crispr-forms 13.0.19 → 13.0.20

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.
@@ -1352,6 +1352,26 @@ function allowedFileExtValidator(allowedFileExtensions, onlyAllowFiles = true) {
1352
1352
  }
1353
1353
  return { allowedExtension: { allowedFileExtensions, actualExtension } };
1354
1354
  };
1355
+ }
1356
+ function allowedFileType(matchExp) {
1357
+ return (formControl) => {
1358
+ const value = formControl.value;
1359
+ if (!(value instanceof File))
1360
+ return null;
1361
+ const type = value.type;
1362
+ const matches = type.match(matchExp);
1363
+ if (!type || !matches?.length) {
1364
+ return {
1365
+ allowedFileType: {
1366
+ actualType: type,
1367
+ allowedTypeExp: matchExp
1368
+ }
1369
+ };
1370
+ }
1371
+ else {
1372
+ return null;
1373
+ }
1374
+ };
1355
1375
  }
1356
1376
 
1357
1377
  // TODO: Should we import UI library?
@@ -1533,6 +1553,7 @@ var index$2 = /*#__PURE__*/Object.freeze({
1533
1553
  ImageUploadFieldModule: ImageUploadFieldModule,
1534
1554
  maxFileSizeValidator: maxFileSizeValidator,
1535
1555
  allowedFileExtValidator: allowedFileExtValidator,
1556
+ allowedFileType: allowedFileType,
1536
1557
  FileDropzoneDirective: FileDropzoneDirective,
1537
1558
  FileUploadFieldComponent: FileUploadFieldComponent,
1538
1559
  FileUploadFieldModule: FileUploadFieldModule,
@@ -1958,5 +1979,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.1", ngImpor
1958
1979
  * Generated bundle index. Do not edit.
1959
1980
  */
1960
1981
 
1961
- export { AbstractAutocompleteComponent, AutocompleteChiplistFieldComponent, AutocompleteFieldComponent, ButtonComponent, CheckboxFieldComponent, ControlType, CrisprFieldComponent, CrisprFormComponent, CrisprFormsModule, DEFAULT_EMPTY_OPTIONS_MESSAGE, DatepickerFieldComponent, DividerComponent, FieldContainerComponent, FieldContainerModule, FileDropzoneDirective, FileUploadFieldComponent, FileUploadFieldModule, HeadingComponent, HeadingModule, ImageUploadFieldComponent, ImageUploadFieldModule, InputFieldComponent, MaterialModule, OptionComponent, RadioFieldComponent, SelectFieldComponent, SliderFieldComponent, TextareaFieldComponent, UnitConversionFieldComponent, allowedFileExtValidator, buildFormGroupFromConfig, callOptionsIfFunction, checkControlForValues, checkControlsForValues, computeValueFromFields, createControlForType, crisprControlMixin, filterOptionsByLabel, isControlConfig, maxFileSizeValidator, observablifyOptions };
1982
+ export { AbstractAutocompleteComponent, AutocompleteChiplistFieldComponent, AutocompleteFieldComponent, ButtonComponent, CheckboxFieldComponent, ControlType, CrisprFieldComponent, CrisprFormComponent, CrisprFormsModule, DEFAULT_EMPTY_OPTIONS_MESSAGE, DatepickerFieldComponent, DividerComponent, FieldContainerComponent, FieldContainerModule, FileDropzoneDirective, FileUploadFieldComponent, FileUploadFieldModule, HeadingComponent, HeadingModule, ImageUploadFieldComponent, ImageUploadFieldModule, InputFieldComponent, MaterialModule, OptionComponent, RadioFieldComponent, SelectFieldComponent, SliderFieldComponent, TextareaFieldComponent, UnitConversionFieldComponent, allowedFileExtValidator, allowedFileType, buildFormGroupFromConfig, callOptionsIfFunction, checkControlForValues, checkControlsForValues, computeValueFromFields, createControlForType, crisprControlMixin, filterOptionsByLabel, isControlConfig, maxFileSizeValidator, observablifyOptions };
1962
1983
  //# sourceMappingURL=tft-crispr-forms.mjs.map