@dartech/arsenal-ui 1.3.83 → 1.3.85
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/index.js +161 -31
- package/package.json +1 -1
- package/src/interfaces/definition.d.ts +9 -1
- package/src/lib/Definition/CreateDefinition/CreateDefinition.d.ts +4 -1
- package/src/lib/Definition/DefinitionFiller/DefinitionFiller.d.ts +4 -1
- package/src/lib/Forms/ControlAutocomplete.d.ts +2 -1
- package/src/lib/Property/PropertyFiller/MultiplePropertyFiller.d.ts +4 -1
- package/src/lib/Property/PropertyFiller/MultiplePropertyWidget.d.ts +4 -1
- package/src/lib/Property/PropertyFiller/PropertyFiller.d.ts +4 -1
- package/src/lib/Property/PropertyWidget/PropertyWidget.d.ts +4 -1
- package/src/lib/Property/UpsertProperty/CreatePropertiesList.d.ts +4 -1
- package/src/lib/Property/UpsertProperty/CreatePropertyFormFields.d.ts +4 -1
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.d.ts +4 -1
- package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.d.ts +4 -1
- package/src/lib/Property/UpsertProperty/PropertyValueField/FileValueWidget.d.ts +6 -0
- package/src/lib/Property/UpsertProperty/PropertyValueField/PropertyValueField.d.ts +4 -1
- package/src/lib/Property/UpsertProperty/PropertyValueField/StringValueField.d.ts +2 -1
package/index.js
CHANGED
@@ -100,6 +100,8 @@ var PropertyType;
|
|
100
100
|
PropertyType["BOOLEAN"] = "BOOLEAN";
|
101
101
|
PropertyType["ENTITY_REFERENCE"] = "ENTITY_REFERENCE";
|
102
102
|
PropertyType["ENTITY"] = "ENTITY";
|
103
|
+
PropertyType["FILE"] = "FILE";
|
104
|
+
PropertyType["FILE_REFERENCE"] = "FILE_REFERENCE";
|
103
105
|
PropertyType["JSON"] = "JSON";
|
104
106
|
PropertyType["DATE"] = "DATE";
|
105
107
|
PropertyType["TIME"] = "TIME";
|
@@ -707,9 +709,10 @@ const ControlAutocomplete = _a => {
|
|
707
709
|
options = [],
|
708
710
|
multiple,
|
709
711
|
textFieldProps = {},
|
710
|
-
disableCloseOnSelect
|
712
|
+
disableCloseOnSelect,
|
713
|
+
useStringValue
|
711
714
|
} = _a,
|
712
|
-
autocompleteProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "hideErrorMessage", "onChange", "labelKey", "valueKey", "options", "multiple", "textFieldProps", "disableCloseOnSelect"]);
|
715
|
+
autocompleteProps = __rest(_a, ["control", "validate", "name", "label", "required", "defaultValue", "disabled", "hideErrorMessage", "onChange", "labelKey", "valueKey", "options", "multiple", "textFieldProps", "disableCloseOnSelect", "useStringValue"]);
|
713
716
|
const _b = useController({
|
714
717
|
name,
|
715
718
|
control,
|
@@ -722,14 +725,16 @@ const ControlAutocomplete = _a => {
|
|
722
725
|
_c = _b.field,
|
723
726
|
{
|
724
727
|
ref,
|
725
|
-
onChange
|
728
|
+
onChange,
|
729
|
+
value
|
726
730
|
} = _c,
|
727
|
-
fieldProps = __rest(_c, ["ref", "onChange"]),
|
731
|
+
fieldProps = __rest(_c, ["ref", "onChange", "value"]),
|
728
732
|
{
|
729
733
|
fieldState: {
|
730
734
|
error
|
731
735
|
}
|
732
736
|
} = _b;
|
737
|
+
const [localValue, setLocalValue] = useState();
|
733
738
|
const {
|
734
739
|
getOptionLabel,
|
735
740
|
isOptionEqualToValue,
|
@@ -739,9 +744,16 @@ const ControlAutocomplete = _a => {
|
|
739
744
|
labelKey
|
740
745
|
});
|
741
746
|
const handleChange = (_, value) => {
|
742
|
-
onChange(value);
|
747
|
+
onChange(useStringValue ? value[valueKey] : value);
|
748
|
+
setLocalValue(value);
|
743
749
|
};
|
750
|
+
useEffect(() => {
|
751
|
+
if (typeof value === 'string' && valueKey && useStringValue && !localValue && options.length && !!options[0] && typeof options[0] === 'object') {
|
752
|
+
setLocalValue(options.find(el => el[valueKey] === value));
|
753
|
+
}
|
754
|
+
}, [localValue, options, useStringValue, value, valueKey]);
|
744
755
|
return jsx(Autocomplete, Object.assign({}, fieldProps, {
|
756
|
+
value: useStringValue ? localValue !== null && localValue !== void 0 ? localValue : null : value,
|
745
757
|
fullWidth: true,
|
746
758
|
disablePortal: true,
|
747
759
|
size: "small",
|
@@ -3285,7 +3297,8 @@ const EntityAdditionalFields = ({
|
|
3285
3297
|
entityDefinition: _entityDefinition = false,
|
3286
3298
|
globalParameter: _globalParameter = false,
|
3287
3299
|
entityReferenceDefinitionSources,
|
3288
|
-
entityReferenceValueComponent
|
3300
|
+
entityReferenceValueComponent,
|
3301
|
+
fileReferenceValueComponent
|
3289
3302
|
}) => {
|
3290
3303
|
const {
|
3291
3304
|
control,
|
@@ -3430,7 +3443,8 @@ const EntityAdditionalFields = ({
|
|
3430
3443
|
entityDefinition: _entityDefinition,
|
3431
3444
|
globalParameter: _globalParameter,
|
3432
3445
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
3433
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
3446
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
3447
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
3434
3448
|
})
|
3435
3449
|
}))]
|
3436
3450
|
}))
|
@@ -3602,7 +3616,8 @@ const PropertyAdditionalFields = ({
|
|
3602
3616
|
entityDefinition: _entityDefinition = false,
|
3603
3617
|
globalParameter: _globalParameter = false,
|
3604
3618
|
entityReferenceDefinitionSources,
|
3605
|
-
entityReferenceValueComponent
|
3619
|
+
entityReferenceValueComponent,
|
3620
|
+
fileReferenceValueComponent
|
3606
3621
|
}) => {
|
3607
3622
|
switch (propertyType) {
|
3608
3623
|
case PropertyType.STRING:
|
@@ -3639,7 +3654,8 @@ const PropertyAdditionalFields = ({
|
|
3639
3654
|
globalParameter: _globalParameter,
|
3640
3655
|
entityDefinition: _entityDefinition,
|
3641
3656
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
3642
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
3657
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
3658
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
3643
3659
|
});
|
3644
3660
|
default:
|
3645
3661
|
return null;
|
@@ -3668,8 +3684,10 @@ const StringValueField = ({
|
|
3668
3684
|
name,
|
3669
3685
|
rules: {
|
3670
3686
|
required: required && (Array.isArray(restrictedValues) && restrictedValues.length ? 'Please, select a value' : 'Please, fill this field')
|
3687
|
+
// pattern: validate && urlValidator,
|
3671
3688
|
}
|
3672
3689
|
});
|
3690
|
+
|
3673
3691
|
const value = useWatch({
|
3674
3692
|
control,
|
3675
3693
|
name
|
@@ -3707,6 +3725,79 @@ const StringValueField = ({
|
|
3707
3725
|
};
|
3708
3726
|
var StringValueField$1 = StringValueField;
|
3709
3727
|
|
3728
|
+
const convertBase64 = file => {
|
3729
|
+
return new Promise((resolve, reject) => {
|
3730
|
+
const fileReader = new FileReader();
|
3731
|
+
fileReader.readAsDataURL(file);
|
3732
|
+
fileReader.onload = () => {
|
3733
|
+
resolve(fileReader.result);
|
3734
|
+
};
|
3735
|
+
fileReader.onerror = error => {
|
3736
|
+
reject(error);
|
3737
|
+
};
|
3738
|
+
});
|
3739
|
+
};
|
3740
|
+
const FileValueWidget = ({
|
3741
|
+
name
|
3742
|
+
}) => {
|
3743
|
+
const {
|
3744
|
+
control,
|
3745
|
+
setValue,
|
3746
|
+
register
|
3747
|
+
} = useFormContext();
|
3748
|
+
const [fileType, setFileType] = useState(null);
|
3749
|
+
const fileValue = useWatch({
|
3750
|
+
control,
|
3751
|
+
name
|
3752
|
+
});
|
3753
|
+
const handleFileRead = useCallback(event => __awaiter(void 0, void 0, void 0, function* () {
|
3754
|
+
const file = event.target.files[0];
|
3755
|
+
const reader = new FileReader();
|
3756
|
+
reader.readAsDataURL(file);
|
3757
|
+
const base64 = yield convertBase64(file);
|
3758
|
+
setValue(name, base64);
|
3759
|
+
}), [name, setValue]);
|
3760
|
+
useEffect(() => {
|
3761
|
+
if (fileValue) {
|
3762
|
+
const type = fileValue.substring(fileValue.indexOf(':') + 1, fileValue.indexOf(';base64'));
|
3763
|
+
if (type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
|
3764
|
+
setFileType('application/xls');
|
3765
|
+
} else if (type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') {
|
3766
|
+
setFileType('application/docx');
|
3767
|
+
} else {
|
3768
|
+
setFileType(type);
|
3769
|
+
}
|
3770
|
+
}
|
3771
|
+
}, [fileValue]);
|
3772
|
+
return jsxs(Fragment, {
|
3773
|
+
children: [fileType && jsx(Box, Object.assign({
|
3774
|
+
mb: 2
|
3775
|
+
}, {
|
3776
|
+
children: jsx(Typography, Object.assign({
|
3777
|
+
variant: "subtitle2"
|
3778
|
+
}, {
|
3779
|
+
children: `Uploaded file type: ${fileType}`
|
3780
|
+
}))
|
3781
|
+
})), jsxs(Button, Object.assign({
|
3782
|
+
component: "label",
|
3783
|
+
variant: "contained",
|
3784
|
+
size: "large",
|
3785
|
+
color: "primary"
|
3786
|
+
}, {
|
3787
|
+
children: [fileType ? 'Change file' : 'Upload file', jsx("input", Object.assign({
|
3788
|
+
type: "hidden"
|
3789
|
+
}, register(`${name}`, {
|
3790
|
+
required: true
|
3791
|
+
}))), jsx("input", {
|
3792
|
+
type: "file",
|
3793
|
+
hidden: true,
|
3794
|
+
onChange: handleFileRead
|
3795
|
+
})]
|
3796
|
+
}))]
|
3797
|
+
});
|
3798
|
+
};
|
3799
|
+
var FileValueWidget$1 = FileValueWidget;
|
3800
|
+
|
3710
3801
|
const PropertyWidget = ({
|
3711
3802
|
property,
|
3712
3803
|
name,
|
@@ -3714,7 +3805,8 @@ const PropertyWidget = ({
|
|
3714
3805
|
useExpression,
|
3715
3806
|
control,
|
3716
3807
|
entityReferenceDefinitionSources,
|
3717
|
-
entityReferenceValueComponent: EntityReferenceValueComponent
|
3808
|
+
entityReferenceValueComponent: EntityReferenceValueComponent,
|
3809
|
+
fileReferenceValueComponent: FileReferenceValueComponent
|
3718
3810
|
}) => {
|
3719
3811
|
const propertyType = useMemo(() => typeof property.propertyType === 'string' ? property.propertyType : property['propertyType']['value'], [property]);
|
3720
3812
|
switch (propertyType) {
|
@@ -3807,6 +3899,21 @@ const PropertyWidget = ({
|
|
3807
3899
|
label: label
|
3808
3900
|
});
|
3809
3901
|
}
|
3902
|
+
case PropertyType.FILE:
|
3903
|
+
return jsx(FileValueWidget$1, {
|
3904
|
+
name: name
|
3905
|
+
});
|
3906
|
+
case PropertyType.FILE_REFERENCE:
|
3907
|
+
if (FileReferenceValueComponent) {
|
3908
|
+
return jsx(FileReferenceValueComponent, {
|
3909
|
+
name: name
|
3910
|
+
});
|
3911
|
+
} else {
|
3912
|
+
return jsx(StringValueField$1, {
|
3913
|
+
name: name,
|
3914
|
+
label: label
|
3915
|
+
});
|
3916
|
+
}
|
3810
3917
|
case PropertyType.ANY:
|
3811
3918
|
return jsx(ControlAceEditor, {
|
3812
3919
|
control: control,
|
@@ -3820,7 +3927,8 @@ const PropertyWidget = ({
|
|
3820
3927
|
dataFieldName: name,
|
3821
3928
|
useExpression: useExpression,
|
3822
3929
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
3823
|
-
entityReferenceValueComponent: EntityReferenceValueComponent
|
3930
|
+
entityReferenceValueComponent: EntityReferenceValueComponent,
|
3931
|
+
fileReferenceValueComponent: FileReferenceValueComponent
|
3824
3932
|
});
|
3825
3933
|
default:
|
3826
3934
|
return jsx("div", {
|
@@ -3862,6 +3970,8 @@ const usePropertyFiller = ({
|
|
3862
3970
|
case PropertyType.DATE_TIME:
|
3863
3971
|
case PropertyType.ENTITY_REFERENCE:
|
3864
3972
|
case PropertyType.ANY:
|
3973
|
+
case PropertyType.FILE:
|
3974
|
+
case PropertyType.FILE_REFERENCE:
|
3865
3975
|
return '';
|
3866
3976
|
case PropertyType.JSON:
|
3867
3977
|
return {};
|
@@ -3929,7 +4039,8 @@ const PropertyFiller = ({
|
|
3929
4039
|
required,
|
3930
4040
|
title,
|
3931
4041
|
entityReferenceDefinitionSources,
|
3932
|
-
entityReferenceValueComponent
|
4042
|
+
entityReferenceValueComponent,
|
4043
|
+
fileReferenceValueComponent
|
3933
4044
|
}) => {
|
3934
4045
|
const {
|
3935
4046
|
control,
|
@@ -4103,12 +4214,14 @@ const PropertyFiller = ({
|
|
4103
4214
|
useExpression: useExpression,
|
4104
4215
|
label: valueLabel,
|
4105
4216
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
4106
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
4217
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
4218
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
4107
4219
|
}), fillOption === 'dem_builder' && jsx(CreateDefinition, {
|
4108
4220
|
title: "JSON",
|
4109
4221
|
definitionFieldName: name,
|
4110
4222
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
4111
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
4223
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
4224
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
4112
4225
|
}), error && jsx(FormHelperText, Object.assign({
|
4113
4226
|
error: true
|
4114
4227
|
}, {
|
@@ -4124,7 +4237,8 @@ const MultiplePropertyWidget = ({
|
|
4124
4237
|
required,
|
4125
4238
|
label,
|
4126
4239
|
entityReferenceDefinitionSources,
|
4127
|
-
entityReferenceValueComponent
|
4240
|
+
entityReferenceValueComponent,
|
4241
|
+
fileReferenceValueComponent
|
4128
4242
|
}) => {
|
4129
4243
|
const {
|
4130
4244
|
control,
|
@@ -4171,7 +4285,8 @@ const MultiplePropertyWidget = ({
|
|
4171
4285
|
name: `${name}.${index}`,
|
4172
4286
|
label: `${label || property.name} (${index + 1})`,
|
4173
4287
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
4174
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
4288
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
4289
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
4175
4290
|
}), jsx(Box, Object.assign({
|
4176
4291
|
mt: "8px",
|
4177
4292
|
ml: "4px"
|
@@ -4213,7 +4328,8 @@ const MultiplePropertyFiller = ({
|
|
4213
4328
|
label,
|
4214
4329
|
title,
|
4215
4330
|
entityReferenceDefinitionSources,
|
4216
|
-
entityReferenceValueComponent
|
4331
|
+
entityReferenceValueComponent,
|
4332
|
+
fileReferenceValueComponent
|
4217
4333
|
}) => {
|
4218
4334
|
var _a;
|
4219
4335
|
const [selectTouched, setSelectTouched] = useState(false);
|
@@ -4357,7 +4473,8 @@ const MultiplePropertyFiller = ({
|
|
4357
4473
|
required: required,
|
4358
4474
|
label: label,
|
4359
4475
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
4360
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
4476
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
4477
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
4361
4478
|
}), error && jsx(FormHelperText, Object.assign({
|
4362
4479
|
error: true
|
4363
4480
|
}, {
|
@@ -4372,7 +4489,8 @@ const PropertyValueField = ({
|
|
4372
4489
|
label: _label = '',
|
4373
4490
|
required,
|
4374
4491
|
entityReferenceDefinitionSources,
|
4375
|
-
entityReferenceValueComponent
|
4492
|
+
entityReferenceValueComponent,
|
4493
|
+
fileReferenceValueComponent
|
4376
4494
|
}) => {
|
4377
4495
|
const {
|
4378
4496
|
control
|
@@ -4425,14 +4543,16 @@ const PropertyValueField = ({
|
|
4425
4543
|
title: _label,
|
4426
4544
|
required: required,
|
4427
4545
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
4428
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
4546
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
4547
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
4429
4548
|
}) : jsx(PropertyFiller, {
|
4430
4549
|
name: name,
|
4431
4550
|
property: fillerProperty,
|
4432
4551
|
title: _label,
|
4433
4552
|
required: required,
|
4434
4553
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
4435
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
4554
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
4555
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
4436
4556
|
});
|
4437
4557
|
};
|
4438
4558
|
|
@@ -4831,7 +4951,8 @@ const CreatePropertyFormFields = ({
|
|
4831
4951
|
globalParameter: _globalParameter = false,
|
4832
4952
|
customPropertyFields: _customPropertyFields = [],
|
4833
4953
|
entityReferenceDefinitionSources,
|
4834
|
-
entityReferenceValueComponent
|
4954
|
+
entityReferenceValueComponent,
|
4955
|
+
fileReferenceValueComponent
|
4835
4956
|
}) => {
|
4836
4957
|
var _a;
|
4837
4958
|
const {
|
@@ -4959,14 +5080,16 @@ const CreatePropertyFormFields = ({
|
|
4959
5080
|
globalParameter: _globalParameter,
|
4960
5081
|
entityDefinition: _entityDefinition,
|
4961
5082
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
4962
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
5083
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
5084
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
4963
5085
|
}), jsx(PropertyValueField, {
|
4964
5086
|
propertyFieldName: propertyFieldName,
|
4965
5087
|
name: `${propertyFieldName}.${_globalParameter ? 'value' : 'defaultValue'}`,
|
4966
5088
|
label: valueLabel,
|
4967
5089
|
required: _globalParameter ? isRequired : false,
|
4968
5090
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
4969
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
5091
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
5092
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
4970
5093
|
})]
|
4971
5094
|
}), customFields.length ? jsx(Fragment, {
|
4972
5095
|
children: customFields.map((field, index) => jsx(Grid, {
|
@@ -5002,7 +5125,8 @@ const CreatePropertiesList = ({
|
|
5002
5125
|
entityPropFields,
|
5003
5126
|
parentRemove,
|
5004
5127
|
entityReferenceDefinitionSources,
|
5005
|
-
entityReferenceValueComponent
|
5128
|
+
entityReferenceValueComponent,
|
5129
|
+
fileReferenceValueComponent
|
5006
5130
|
}) => {
|
5007
5131
|
const fieldName = useMemo(() => parentFieldName ? `${parentFieldName}.properties` : `properties`, [parentFieldName]);
|
5008
5132
|
const {
|
@@ -5098,7 +5222,8 @@ const CreatePropertiesList = ({
|
|
5098
5222
|
globalParameter: _globalParameter,
|
5099
5223
|
customPropertyFields: _customPropertyFields,
|
5100
5224
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
5101
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
5225
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
5226
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
5102
5227
|
})
|
5103
5228
|
}), jsx(AccordionActions, {
|
5104
5229
|
children: jsx(Button, Object.assign({
|
@@ -5134,7 +5259,8 @@ const CreateDefinition = ({
|
|
5134
5259
|
hideNameField,
|
5135
5260
|
required: _required = false,
|
5136
5261
|
entityReferenceDefinitionSources,
|
5137
|
-
entityReferenceValueComponent
|
5262
|
+
entityReferenceValueComponent,
|
5263
|
+
fileReferenceValueComponent
|
5138
5264
|
}) => {
|
5139
5265
|
const {
|
5140
5266
|
control
|
@@ -5187,7 +5313,8 @@ const CreateDefinition = ({
|
|
5187
5313
|
required: _required,
|
5188
5314
|
parentFieldName: definitionFieldName,
|
5189
5315
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
5190
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
5316
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
5317
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
5191
5318
|
})]
|
5192
5319
|
}));
|
5193
5320
|
};
|
@@ -5465,7 +5592,8 @@ const DefinitionFiller = ({
|
|
5465
5592
|
useExpression: _useExpression = false,
|
5466
5593
|
title,
|
5467
5594
|
entityReferenceDefinitionSources,
|
5468
|
-
entityReferenceValueComponent
|
5595
|
+
entityReferenceValueComponent,
|
5596
|
+
fileReferenceValueComponent
|
5469
5597
|
}) => {
|
5470
5598
|
const stepperData = useMemo(() => {
|
5471
5599
|
if (properties) {
|
@@ -5490,6 +5618,7 @@ const DefinitionFiller = ({
|
|
5490
5618
|
label: property.name,
|
5491
5619
|
required: property.isRequired,
|
5492
5620
|
entityReferenceValueComponent: entityReferenceValueComponent,
|
5621
|
+
fileReferenceValueComponent: fileReferenceValueComponent,
|
5493
5622
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources
|
5494
5623
|
}) : jsx(PropertyFiller, {
|
5495
5624
|
property: property,
|
@@ -5498,13 +5627,14 @@ const DefinitionFiller = ({
|
|
5498
5627
|
label: property.name,
|
5499
5628
|
required: property.isRequired,
|
5500
5629
|
entityReferenceDefinitionSources: entityReferenceDefinitionSources,
|
5501
|
-
entityReferenceValueComponent: entityReferenceValueComponent
|
5630
|
+
entityReferenceValueComponent: entityReferenceValueComponent,
|
5631
|
+
fileReferenceValueComponent: fileReferenceValueComponent
|
5502
5632
|
})
|
5503
5633
|
};
|
5504
5634
|
});
|
5505
5635
|
}
|
5506
5636
|
return [];
|
5507
|
-
}, [properties, dataFieldName, _useExpression, entityReferenceValueComponent, entityReferenceDefinitionSources]);
|
5637
|
+
}, [properties, dataFieldName, _useExpression, entityReferenceValueComponent, entityReferenceDefinitionSources, fileReferenceValueComponent]);
|
5508
5638
|
return jsx(LocalizationProvider, Object.assign({
|
5509
5639
|
dateAdapter: AdapterDateFns
|
5510
5640
|
}, {
|
package/package.json
CHANGED
@@ -10,6 +10,8 @@ export declare enum PropertyType {
|
|
10
10
|
BOOLEAN = "BOOLEAN",
|
11
11
|
ENTITY_REFERENCE = "ENTITY_REFERENCE",
|
12
12
|
ENTITY = "ENTITY",
|
13
|
+
FILE = "FILE",
|
14
|
+
FILE_REFERENCE = "FILE_REFERENCE",
|
13
15
|
JSON = "JSON",
|
14
16
|
DATE = "DATE",
|
15
17
|
TIME = "TIME",
|
@@ -105,7 +107,13 @@ export interface TimeProperty extends Property {
|
|
105
107
|
export interface AnyProperty extends Property {
|
106
108
|
propertyType: PropertyType.ANY;
|
107
109
|
}
|
108
|
-
export
|
110
|
+
export interface FileProperty extends Property {
|
111
|
+
propertyType: PropertyType.FILE;
|
112
|
+
}
|
113
|
+
export interface FileReferenceProperty extends Property {
|
114
|
+
propertyType: PropertyType.FILE_REFERENCE;
|
115
|
+
}
|
116
|
+
export type PropertyUnion<T = Record<string, never>> = BigDecimalProperty | BigIntegerProperty | BooleanProperty | DateProperty | DateTimeProperty | DoubleProperty | EntityTypeProperty<T> | EntityReferenceProperty | FloatProperty | StringProperty | IntegerProperty | JsonProperty | LongProperty | TimeProperty | AnyProperty | EntityReferenceProperty | FileProperty | FileReferenceProperty;
|
109
117
|
export declare const DATE_DEFAULT_FORMAT = "yyyy-MM-dd";
|
110
118
|
export declare const TIME_DEFAULT_FORMAT = "HH:mm:ss";
|
111
119
|
export declare const DATE_TIME_DEFAULT_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
|
@@ -15,6 +15,9 @@ type Props = {
|
|
15
15
|
name: string;
|
16
16
|
property: EntityReferenceProperty;
|
17
17
|
}>;
|
18
|
+
fileReferenceValueComponent?: React.ElementType<{
|
19
|
+
name: string;
|
20
|
+
}>;
|
18
21
|
};
|
19
|
-
export declare const CreateDefinition: ({ definitionFieldName, title, hideCodeField, hideVersionField, hideNameField, required, entityReferenceDefinitionSources, entityReferenceValueComponent, }: Props) => JSX.Element;
|
22
|
+
export declare const CreateDefinition: ({ definitionFieldName, title, hideCodeField, hideVersionField, hideNameField, required, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: Props) => JSX.Element;
|
20
23
|
export default CreateDefinition;
|
@@ -13,6 +13,9 @@ type Props = {
|
|
13
13
|
name: string;
|
14
14
|
property: EntityReferenceProperty;
|
15
15
|
}>;
|
16
|
+
fileReferenceValueComponent?: React.ElementType<{
|
17
|
+
name: string;
|
18
|
+
}>;
|
16
19
|
};
|
17
|
-
export declare const DefinitionFiller: ({ properties, dataFieldName, useExpression, title, entityReferenceDefinitionSources, entityReferenceValueComponent, }: Props) => JSX.Element;
|
20
|
+
export declare const DefinitionFiller: ({ properties, dataFieldName, useExpression, title, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: Props) => JSX.Element;
|
18
21
|
export default DefinitionFiller;
|
@@ -60,10 +60,11 @@ export type ControlAutocompleteProps = Omit<AutocompleteProps<unknown, boolean,
|
|
60
60
|
*/
|
61
61
|
options: string[] | unknown[];
|
62
62
|
textFieldProps?: TextFieldProps;
|
63
|
+
useStringValue?: boolean;
|
63
64
|
};
|
64
65
|
/**
|
65
66
|
* Material UI `Autocomplete` controlled component. Used with react-hook-form
|
66
67
|
* @category Forms
|
67
68
|
*/
|
68
|
-
export declare const ControlAutocomplete: ({ control, validate, name, label, required, defaultValue, disabled, hideErrorMessage, onChange: customOnChange, labelKey, valueKey, options, multiple, textFieldProps, disableCloseOnSelect, ...autocompleteProps }: ControlAutocompleteProps) => JSX.Element;
|
69
|
+
export declare const ControlAutocomplete: ({ control, validate, name, label, required, defaultValue, disabled, hideErrorMessage, onChange: customOnChange, labelKey, valueKey, options, multiple, textFieldProps, disableCloseOnSelect, useStringValue, ...autocompleteProps }: ControlAutocompleteProps) => JSX.Element;
|
69
70
|
export default ControlAutocomplete;
|
@@ -15,6 +15,9 @@ type Props = {
|
|
15
15
|
name: string;
|
16
16
|
property: EntityReferenceProperty;
|
17
17
|
}>;
|
18
|
+
fileReferenceValueComponent?: React.ElementType<{
|
19
|
+
name: string;
|
20
|
+
}>;
|
18
21
|
};
|
19
|
-
export declare const MultiplePropertyFiller: ({ property, name, useExpression, required, label, title, entityReferenceDefinitionSources, entityReferenceValueComponent, }: Props) => JSX.Element;
|
22
|
+
export declare const MultiplePropertyFiller: ({ property, name, useExpression, required, label, title, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: Props) => JSX.Element;
|
20
23
|
export default MultiplePropertyFiller;
|
@@ -14,6 +14,9 @@ type Props = {
|
|
14
14
|
name: string;
|
15
15
|
property: EntityReferenceProperty;
|
16
16
|
}>;
|
17
|
+
fileReferenceValueComponent?: React.ElementType<{
|
18
|
+
name: string;
|
19
|
+
}>;
|
17
20
|
};
|
18
|
-
export declare const MultiplePropertyWidget: ({ name, property, useExpression, required, label, entityReferenceDefinitionSources, entityReferenceValueComponent, }: Props) => JSX.Element;
|
21
|
+
export declare const MultiplePropertyWidget: ({ name, property, useExpression, required, label, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: Props) => JSX.Element;
|
19
22
|
export default MultiplePropertyWidget;
|
@@ -15,6 +15,9 @@ export type PropertyFillerProps = {
|
|
15
15
|
name: string;
|
16
16
|
property: EntityReferenceProperty;
|
17
17
|
}>;
|
18
|
+
fileReferenceValueComponent?: React.ElementType<{
|
19
|
+
name: string;
|
20
|
+
}>;
|
18
21
|
};
|
19
|
-
export declare const PropertyFiller: ({ property, name, useExpression, label, required, title, entityReferenceDefinitionSources, entityReferenceValueComponent, }: PropertyFillerProps) => JSX.Element;
|
22
|
+
export declare const PropertyFiller: ({ property, name, useExpression, label, required, title, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: PropertyFillerProps) => JSX.Element;
|
20
23
|
export default PropertyFiller;
|
@@ -15,6 +15,9 @@ type Props = {
|
|
15
15
|
name: string;
|
16
16
|
property: EntityReferenceProperty;
|
17
17
|
}>;
|
18
|
+
fileReferenceValueComponent?: React.ElementType<{
|
19
|
+
name: string;
|
20
|
+
}>;
|
18
21
|
};
|
19
|
-
export declare const PropertyWidget: ({ property, name, label, useExpression, control, entityReferenceDefinitionSources, entityReferenceValueComponent: EntityReferenceValueComponent, }: Props) => JSX.Element;
|
22
|
+
export declare const PropertyWidget: ({ property, name, label, useExpression, control, entityReferenceDefinitionSources, entityReferenceValueComponent: EntityReferenceValueComponent, fileReferenceValueComponent: FileReferenceValueComponent, }: Props) => JSX.Element;
|
20
23
|
export default PropertyWidget;
|
@@ -20,6 +20,9 @@ type Props = {
|
|
20
20
|
name: string;
|
21
21
|
property: EntityReferenceProperty;
|
22
22
|
}>;
|
23
|
+
fileReferenceValueComponent?: React.ElementType<{
|
24
|
+
name: string;
|
25
|
+
}>;
|
23
26
|
};
|
24
|
-
export declare const CreatePropertiesList: ({ parentFieldName, hideAddButton, focusOnIndex, required, entityDefinition, globalParameter, customPropertyFields, entityPropFields, parentRemove, entityReferenceDefinitionSources, entityReferenceValueComponent, }: Props) => JSX.Element;
|
27
|
+
export declare const CreatePropertiesList: ({ parentFieldName, hideAddButton, focusOnIndex, required, entityDefinition, globalParameter, customPropertyFields, entityPropFields, parentRemove, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: Props) => JSX.Element;
|
25
28
|
export default CreatePropertiesList;
|
@@ -13,6 +13,9 @@ type Props = {
|
|
13
13
|
name: string;
|
14
14
|
property: EntityReferenceProperty;
|
15
15
|
}>;
|
16
|
+
fileReferenceValueComponent?: React.ElementType<{
|
17
|
+
name: string;
|
18
|
+
}>;
|
16
19
|
};
|
17
|
-
export declare const CreatePropertyFormFields: ({ propertyFieldName, entityDefinition, globalParameter, customPropertyFields, entityReferenceDefinitionSources, entityReferenceValueComponent, }: Props) => JSX.Element;
|
20
|
+
export declare const CreatePropertyFormFields: ({ propertyFieldName, entityDefinition, globalParameter, customPropertyFields, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: Props) => JSX.Element;
|
18
21
|
export default CreatePropertyFormFields;
|
package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/EntityAdditionalFields.d.ts
CHANGED
@@ -12,6 +12,9 @@ type Props = {
|
|
12
12
|
name: string;
|
13
13
|
property: EntityReferenceProperty;
|
14
14
|
}>;
|
15
|
+
fileReferenceValueComponent?: React.ElementType<{
|
16
|
+
name: string;
|
17
|
+
}>;
|
15
18
|
};
|
16
|
-
declare const EntityAdditionalFields: ({ parentPropertyFieldName, entityDefinition, globalParameter, entityReferenceDefinitionSources, entityReferenceValueComponent, }: Props) => JSX.Element;
|
19
|
+
declare const EntityAdditionalFields: ({ parentPropertyFieldName, entityDefinition, globalParameter, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: Props) => JSX.Element;
|
17
20
|
export default EntityAdditionalFields;
|
package/src/lib/Property/UpsertProperty/PropertyAdditionalFields/PropertyAdditionalFields.d.ts
CHANGED
@@ -13,6 +13,9 @@ type Props = {
|
|
13
13
|
name: string;
|
14
14
|
property: EntityReferenceProperty;
|
15
15
|
}>;
|
16
|
+
fileReferenceValueComponent?: React.ElementType<{
|
17
|
+
name: string;
|
18
|
+
}>;
|
16
19
|
};
|
17
|
-
export declare const PropertyAdditionalFields: ({ propertyType, propertyFieldName, entityDefinition, globalParameter, entityReferenceDefinitionSources, entityReferenceValueComponent, }: Props) => JSX.Element;
|
20
|
+
export declare const PropertyAdditionalFields: ({ propertyType, propertyFieldName, entityDefinition, globalParameter, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: Props) => JSX.Element;
|
18
21
|
export default PropertyAdditionalFields;
|
@@ -13,6 +13,9 @@ type Props = {
|
|
13
13
|
name: string;
|
14
14
|
property: EntityReferenceProperty;
|
15
15
|
}>;
|
16
|
+
fileReferenceValueComponent?: React.ElementType<{
|
17
|
+
name: string;
|
18
|
+
}>;
|
16
19
|
};
|
17
|
-
export declare const PropertyValueField: ({ propertyFieldName, name, label, required, entityReferenceDefinitionSources, entityReferenceValueComponent, }: Props) => JSX.Element;
|
20
|
+
export declare const PropertyValueField: ({ propertyFieldName, name, label, required, entityReferenceDefinitionSources, entityReferenceValueComponent, fileReferenceValueComponent, }: Props) => JSX.Element;
|
18
21
|
export default PropertyValueField;
|
@@ -4,6 +4,7 @@ type Props = {
|
|
4
4
|
label?: string;
|
5
5
|
required?: boolean;
|
6
6
|
restrictedValues?: string[];
|
7
|
+
urlValidate?: boolean;
|
7
8
|
};
|
8
|
-
declare const StringValueField: ({ name, label, required, restrictedValues }: Props) => JSX.Element;
|
9
|
+
declare const StringValueField: ({ name, label, required, restrictedValues, }: Props) => JSX.Element;
|
9
10
|
export default StringValueField;
|