@unimaze/billing 0.18.0 → 0.19.2
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/lib/common/components/base-information/ReferenceIdentifiers.js +7 -1
- package/lib/common/components/customer/CostCenter.d.ts +4 -1
- package/lib/common/components/customer/CostCenter.js +119 -77
- package/lib/common/components/customer/index.js +2 -1
- package/lib/style/index.css +50 -50
- package/lib/utils/RequirementsUtility.d.ts +2 -1
- package/lib/utils/RequirementsUtility.js +13 -5
- package/package.json +1 -1
|
@@ -30,6 +30,7 @@ var ReferenceIdentifierUtility_1 = require("../../../utils/ReferenceIdentifierUt
|
|
|
30
30
|
var axios_1 = __importDefault(require("axios"));
|
|
31
31
|
var ApiUtility_1 = require("../../../utils/ApiUtility");
|
|
32
32
|
var lodash_1 = require("lodash");
|
|
33
|
+
var form_item_1 = require("../form-item");
|
|
33
34
|
exports.translationMessages = react_intl_1.defineMessages({
|
|
34
35
|
referenceIdentifiers_labels_addButton: {
|
|
35
36
|
id: "referenceIdentifiers_labels_addButton",
|
|
@@ -138,7 +139,12 @@ var ReferenceIdentifiers = function (props) {
|
|
|
138
139
|
var getReferenceIdentifierValueFormItemInput = function (value, receiverRequirements, rapiBaseUrl, legalIdentifier, field, referenceIdentifierValidateStatus, setReferenceIdentifierValidateStatus) {
|
|
139
140
|
var fieldProps = __assign({}, field, { name: [field.name, "value"],
|
|
140
141
|
// fieldKey: [field.fieldKey, "value"],
|
|
141
|
-
rules: [
|
|
142
|
+
rules: [
|
|
143
|
+
{
|
|
144
|
+
required: !!(value && value.key),
|
|
145
|
+
message: props.intl.formatMessage(form_item_1.translationMessages.formItem_required_errorMessage)
|
|
146
|
+
}
|
|
147
|
+
] });
|
|
142
148
|
if (value && value.key) {
|
|
143
149
|
var options = ReferenceIdentifierUtility_1.getReferenceIdentifierOptions(receiverRequirements);
|
|
144
150
|
var fieldDefinition_1 = options.find(function (el) { return el.key.endsWith(value.key); });
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { InjectedIntlProps } from "react-intl";
|
|
3
3
|
import { NewReceiverRequirements } from "../../types/NewReceiverRequirements";
|
|
4
|
+
import { FormInstance } from "antd/es/form";
|
|
4
5
|
interface Props extends InjectedIntlProps {
|
|
5
6
|
receiverRequirements: NewReceiverRequirements;
|
|
6
7
|
updateReceiverRequirementsProp: (receiverRequirements: NewReceiverRequirements) => void;
|
|
7
8
|
rapiBaseUrl: string;
|
|
9
|
+
formInstance: FormInstance;
|
|
10
|
+
legalIdentifier: string;
|
|
8
11
|
}
|
|
9
|
-
declare const _default: React.ComponentClass<Pick<Props, "receiverRequirements" | "updateReceiverRequirementsProp" | "rapiBaseUrl">, any> & {
|
|
12
|
+
declare const _default: React.ComponentClass<Pick<Props, "formInstance" | "receiverRequirements" | "updateReceiverRequirementsProp" | "rapiBaseUrl" | "legalIdentifier">, any> & {
|
|
10
13
|
WrappedComponent: React.ComponentType<Props & InjectedIntlProps>;
|
|
11
14
|
};
|
|
12
15
|
export default _default;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
14
3
|
if (mod && mod.__esModule) return mod;
|
|
15
4
|
var result = {};
|
|
@@ -23,82 +12,135 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
13
|
var react_1 = __importStar(require("react"));
|
|
25
14
|
var ReceiverRequirements_1 = require("../../types/ReceiverRequirements");
|
|
26
|
-
var antd_1 = require("antd");
|
|
27
15
|
var form_item_1 = __importDefault(require("../form-item"));
|
|
28
16
|
var react_intl_1 = require("react-intl");
|
|
29
|
-
var
|
|
17
|
+
var RequirementsUtility_1 = require("../../../utils/RequirementsUtility");
|
|
30
18
|
// import {FormInstance} from "antd/es/form";
|
|
31
19
|
var translationMessages = {
|
|
32
20
|
baseInformation_costCenter: {
|
|
33
21
|
id: "baseInformation_costCenter",
|
|
34
22
|
defaultMessage: "Cost center",
|
|
35
23
|
},
|
|
24
|
+
baseInformation_costCenter_placeholder_input: {
|
|
25
|
+
id: "baseInformation_costCenter_placeholder_input",
|
|
26
|
+
defaultMessage: "Input you cost center",
|
|
27
|
+
},
|
|
28
|
+
baseInformation_costCenter_placeholder_search: {
|
|
29
|
+
id: "baseInformation_costCenter_placeholder_search",
|
|
30
|
+
defaultMessage: "Search cost centers",
|
|
31
|
+
},
|
|
36
32
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
33
|
+
//
|
|
34
|
+
// const handleReferenceIdentifierValueSearch = (
|
|
35
|
+
// searchValue: string,
|
|
36
|
+
// costCenterFieldDefinition: FieldDefinition,
|
|
37
|
+
// receiverRequirements: NewReceiverRequirements,
|
|
38
|
+
// rapiBaseUrl: string,
|
|
39
|
+
// setLoadingCostCenterValues: (loadingCostCenterValues: boolean) => void,
|
|
40
|
+
// updateReceiverRequirementsProp: (receiverRequirements: NewReceiverRequirements) => void
|
|
41
|
+
// ) => {
|
|
42
|
+
// if (costCenterFieldDefinition && costCenterFieldDefinition.properties && costCenterFieldDefinition.properties.href) {
|
|
43
|
+
// const searchUrl = rapiBaseUrl + costCenterFieldDefinition.properties.href.replace("%7BtextFilter%7D", searchValue).replace("%7Boffset%7D", "0").replace("%7Blimit%7D", "15");
|
|
44
|
+
// setLoadingCostCenterValues(true)
|
|
45
|
+
// axios.get(searchUrl)
|
|
46
|
+
// .then(response => {
|
|
47
|
+
// setLoadingCostCenterValues(false)
|
|
48
|
+
// const updatedFieldDefinitions: FieldDefinition[] = [...receiverRequirements.fieldDefinitions];
|
|
49
|
+
// const index = updatedFieldDefinitions.findIndex(x => x.key === costCenterFieldDefinition.key)
|
|
50
|
+
//
|
|
51
|
+
// const updatedReferenceIdentifier: FieldDefinition = {
|
|
52
|
+
// ...updatedFieldDefinitions[index],
|
|
53
|
+
// properties: {
|
|
54
|
+
// label: updatedFieldDefinitions[index].properties.label,
|
|
55
|
+
// href: updatedFieldDefinitions[index].properties.href,
|
|
56
|
+
// cardinality: updatedFieldDefinitions[index].properties.cardinality,
|
|
57
|
+
// values: response.data.value
|
|
58
|
+
// }
|
|
59
|
+
// };
|
|
60
|
+
// updatedFieldDefinitions.splice(index, 1, updatedReferenceIdentifier)
|
|
61
|
+
//
|
|
62
|
+
// const newReceiverRequirements: NewReceiverRequirements = {
|
|
63
|
+
// ...receiverRequirements,
|
|
64
|
+
// fieldDefinitions: updatedFieldDefinitions
|
|
65
|
+
// }
|
|
66
|
+
//
|
|
67
|
+
// updateReceiverRequirementsProp(newReceiverRequirements);
|
|
68
|
+
// }
|
|
69
|
+
// )
|
|
70
|
+
// .catch(error => {
|
|
71
|
+
// setLoadingCostCenterValues(false)
|
|
72
|
+
// // tslint:disable-next-line:no-console
|
|
73
|
+
// console.log(error);
|
|
74
|
+
// })
|
|
75
|
+
//
|
|
76
|
+
// }
|
|
77
|
+
// }
|
|
78
|
+
//
|
|
79
|
+
// const getCostCenterInput = (
|
|
80
|
+
// fieldDefinition: FieldDefinition,
|
|
81
|
+
// receiverRequirements: NewReceiverRequirements,
|
|
82
|
+
// rapiBaseUrl: string,
|
|
83
|
+
// setLoadingCostCenterValues: (loadingCostCenterValues: boolean) => void,
|
|
84
|
+
// loadingCostCenterValues: boolean,
|
|
85
|
+
// updateReceiverRequirementsProp: (receiverRequirements: NewReceiverRequirements) => void,
|
|
86
|
+
// constCenterPlaceholderInput: string,
|
|
87
|
+
// constCenterPlaceholderSearch: string,
|
|
88
|
+
// ): React.ReactElement => {
|
|
89
|
+
// let handling = null;
|
|
90
|
+
// if (fieldDefinition.properties.handling) {
|
|
91
|
+
// handling = JSON.parse(fieldDefinition.properties.handling)
|
|
92
|
+
// }
|
|
93
|
+
//
|
|
94
|
+
// if (fieldDefinition) {
|
|
95
|
+
// if (fieldDefinition.properties.values) {
|
|
96
|
+
// const selectProps: SelectProps<any> = fieldDefinition.properties.hasOwnProperty("href")
|
|
97
|
+
// ? {
|
|
98
|
+
// showSearch: true,
|
|
99
|
+
// filterOption: false,
|
|
100
|
+
// onSearch: (searchValue: string) => {
|
|
101
|
+
// handleReferenceIdentifierValueSearch(searchValue, fieldDefinition, receiverRequirements, rapiBaseUrl, setLoadingCostCenterValues, updateReceiverRequirementsProp);
|
|
102
|
+
// },
|
|
103
|
+
// onChange: (searchValue: string) => {
|
|
104
|
+
// if (!searchValue) {
|
|
105
|
+
// handleReferenceIdentifierValueSearch("", fieldDefinition, receiverRequirements, rapiBaseUrl, setLoadingCostCenterValues, updateReceiverRequirementsProp);
|
|
106
|
+
// }
|
|
107
|
+
// },
|
|
108
|
+
// loading: loadingCostCenterValues,
|
|
109
|
+
// }
|
|
110
|
+
// : {}
|
|
111
|
+
//
|
|
112
|
+
// return <Select
|
|
113
|
+
// dropdownMatchSelectWidth={false}
|
|
114
|
+
// allowClear
|
|
115
|
+
// {...selectProps}
|
|
116
|
+
// placeholder={getFieldPlaceholderOverride(receiverRequirements,AvailableFields["customer.locationIdentifier"], constCenterPlaceholderSearch)}
|
|
117
|
+
// >
|
|
118
|
+
// {fieldDefinition.properties.values.map(op => {
|
|
119
|
+
// return <Select.Option
|
|
120
|
+
// key={op.key}
|
|
121
|
+
// value={op.key}
|
|
122
|
+
// >
|
|
123
|
+
// {op.name}
|
|
124
|
+
// </Select.Option>;
|
|
125
|
+
// }
|
|
126
|
+
// )}
|
|
127
|
+
// </Select>;
|
|
128
|
+
// } else {
|
|
129
|
+
// return <Input
|
|
130
|
+
// placeholder={getFieldPlaceholderOverride(receiverRequirements,AvailableFields["customer.locationIdentifier"], constCenterPlaceholderInput)}/>
|
|
131
|
+
// }
|
|
132
|
+
// } else {
|
|
133
|
+
// return <Input
|
|
134
|
+
// placeholder={getFieldPlaceholderOverride(receiverRequirements,AvailableFields["customer.locationIdentifier"], constCenterPlaceholderInput)}/>
|
|
135
|
+
// }
|
|
136
|
+
// }
|
|
97
137
|
var CostCenter = function (props) {
|
|
98
|
-
var
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
|
|
138
|
+
var _a = react_1.useState(""), costCenterHandlingValidationStatus = _a[0], setCostCenterHandlingValidationStatus = _a[1];
|
|
139
|
+
var _b = react_1.useState({}), costCenterFieldProps = _b[0], setCostCenterFieldProps = _b[1];
|
|
140
|
+
var _c = react_1.useState(false), loadingCostCenterValues = _c[0], setLoadingCostCenterValues = _c[1];
|
|
141
|
+
var costCenterFieldDefinition = RequirementsUtility_1.getFieldRequirements(props.receiverRequirements, ReceiverRequirements_1.AvailableFields["customer.locationIdentifier"]);
|
|
142
|
+
if (costCenterFieldDefinition) {
|
|
143
|
+
return (react_1.default.createElement(form_item_1.default, { receiverRequirements: props.receiverRequirements, receiverRequirementsKey: ReceiverRequirements_1.AvailableFields["customer.locationIdentifier"], defaultLabel: props.intl.formatMessage(translationMessages.baseInformation_costCenter), defaultIsRequired: false, fieldName: ["invoice", "customer", "locationIdentifier"], validateStatus: costCenterHandlingValidationStatus }, RequirementsUtility_1.getInput(costCenterFieldDefinition, ["invoice", "customer", "locationIdentifier"], "handleCostCenterValidation", props.legalIdentifier, props.formInstance, props.rapiBaseUrl, props.receiverRequirements, props.updateReceiverRequirementsProp, setCostCenterFieldProps, costCenterFieldProps, setLoadingCostCenterValues, loadingCostCenterValues, setCostCenterHandlingValidationStatus, true)));
|
|
102
144
|
}
|
|
103
145
|
else {
|
|
104
146
|
return null;
|
|
@@ -92,7 +92,8 @@ var Customer = function (props) {
|
|
|
92
92
|
", ",
|
|
93
93
|
chosenCustomer.address.countryCode)
|
|
94
94
|
: null),
|
|
95
|
-
|
|
95
|
+
chosenCustomer && chosenCustomer.identifier &&
|
|
96
|
+
react_1.default.createElement(CostCenter_1.default, { receiverRequirements: props.receiverRequirements, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp, rapiBaseUrl: props.rapiBaseUrl, legalIdentifier: chosenCustomer.identifier, formInstance: props.formInstance })));
|
|
96
97
|
};
|
|
97
98
|
var CustomerIntl = react_intl_1.injectIntl(Customer);
|
|
98
99
|
exports.default = CustomerIntl;
|
package/lib/style/index.css
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
.component_header {
|
|
2
|
-
height: 3.3em;
|
|
3
|
-
background-color: #fff;
|
|
4
|
-
border-bottom: solid 1px #d9d9d9;
|
|
5
|
-
border-radius: 4px 4px 0 0;
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
justify-content: space-between;
|
|
9
|
-
padding: 1em 2em;
|
|
10
|
-
}
|
|
11
|
-
.component_header_title {
|
|
12
|
-
font-size: 1.1em;
|
|
13
|
-
}
|
|
14
|
-
.component_header_title > span > i {
|
|
15
|
-
font-size: 20px;
|
|
16
|
-
}
|
|
17
|
-
.header_icon {
|
|
18
|
-
font-size: 1.5em;
|
|
19
|
-
margin-right: 0.75em;
|
|
20
|
-
color: #1890ff;
|
|
21
|
-
}
|
|
22
|
-
.header_right {
|
|
23
|
-
display: flex;
|
|
24
|
-
justify-content: flex-end;
|
|
25
|
-
}
|
|
26
|
-
@media screen and (max-width: 768px) {
|
|
27
|
-
.header_right {
|
|
28
|
-
justify-content: flex-start;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
.header_right > button {
|
|
32
|
-
margin-bottom: unset !important;
|
|
33
|
-
}
|
|
34
|
-
.component_body {
|
|
35
|
-
border-radius: 0 0 4px 4px;
|
|
36
|
-
}
|
|
37
|
-
.component_wrapper {
|
|
38
|
-
align-self: stretch;
|
|
39
|
-
height: 100%;
|
|
40
|
-
background-color: #fff;
|
|
41
|
-
border: solid 1px #d9d9d9;
|
|
42
|
-
border-radius: 4px;
|
|
43
|
-
}
|
|
44
|
-
.component_wrapper_padding {
|
|
45
|
-
padding: 1em;
|
|
46
|
-
}
|
|
47
|
-
.umz_noValidationMessage .ant-form-item-explain {
|
|
48
|
-
height: 20px !important;
|
|
49
|
-
visibility: hidden !important;
|
|
50
|
-
}
|
|
1
|
+
.component_header {
|
|
2
|
+
height: 3.3em;
|
|
3
|
+
background-color: #fff;
|
|
4
|
+
border-bottom: solid 1px #d9d9d9;
|
|
5
|
+
border-radius: 4px 4px 0 0;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
padding: 1em 2em;
|
|
10
|
+
}
|
|
11
|
+
.component_header_title {
|
|
12
|
+
font-size: 1.1em;
|
|
13
|
+
}
|
|
14
|
+
.component_header_title > span > i {
|
|
15
|
+
font-size: 20px;
|
|
16
|
+
}
|
|
17
|
+
.header_icon {
|
|
18
|
+
font-size: 1.5em;
|
|
19
|
+
margin-right: 0.75em;
|
|
20
|
+
color: #1890ff;
|
|
21
|
+
}
|
|
22
|
+
.header_right {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: flex-end;
|
|
25
|
+
}
|
|
26
|
+
@media screen and (max-width: 768px) {
|
|
27
|
+
.header_right {
|
|
28
|
+
justify-content: flex-start;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
.header_right > button {
|
|
32
|
+
margin-bottom: unset !important;
|
|
33
|
+
}
|
|
34
|
+
.component_body {
|
|
35
|
+
border-radius: 0 0 4px 4px;
|
|
36
|
+
}
|
|
37
|
+
.component_wrapper {
|
|
38
|
+
align-self: stretch;
|
|
39
|
+
height: 100%;
|
|
40
|
+
background-color: #fff;
|
|
41
|
+
border: solid 1px #d9d9d9;
|
|
42
|
+
border-radius: 4px;
|
|
43
|
+
}
|
|
44
|
+
.component_wrapper_padding {
|
|
45
|
+
padding: 1em;
|
|
46
|
+
}
|
|
47
|
+
.umz_noValidationMessage .ant-form-item-explain {
|
|
48
|
+
height: 20px !important;
|
|
49
|
+
visibility: hidden !important;
|
|
50
|
+
}
|
|
51
51
|
/*# sourceMappingURL=index.css.map */
|
|
@@ -7,9 +7,10 @@ import { FormInstance } from "antd/es/form";
|
|
|
7
7
|
export declare const getFieldRequirements: (receiverRequirements: NewReceiverRequirements, key: AvailableFields) => FieldDefinition | undefined;
|
|
8
8
|
export declare const getFieldLabelOverride: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultLabel: React.ReactNode) => React.ReactNode;
|
|
9
9
|
export declare const getFieldLabelTooltipOverride: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultLabelTooltip: React.ReactNode) => React.ReactNode;
|
|
10
|
+
export declare const getFieldPlaceholderOverride: (fieldRequirement: FieldDefinition, defaultPlaceholder?: string | undefined) => string;
|
|
10
11
|
export declare const getFieldIsRequired: (receiverRequirements: NewReceiverRequirements, key: AvailableFields, defaultIsRequired: boolean) => boolean;
|
|
11
12
|
export interface FormItemPropsWithoutChildren extends Omit<FormItemProps, "children"> {
|
|
12
13
|
}
|
|
13
14
|
export declare const handleValueValidation: ((isoNumber: string, fieldName: string, value: string, rapiBaseUrl: string, namePath: string | number | (string | number)[], setValidationStatus: (validationStatus: "" | "error" | "success" | "validating" | "warning") => void, formInstance: FormInstance<any>, callName: string) => void) & import("lodash").Cancelable;
|
|
14
15
|
export declare const debouncedHandleSearchValues: ((searchValue: string, fieldDefinition: FieldDefinition, setLoadingValues: (loadingValues: boolean) => void, loadingValues: boolean, receiverRequirements: NewReceiverRequirements, updateReceiverRequirementsProp: (newReceiverRequirements: NewReceiverRequirements) => void, callName: string, rapiBaseUrl: string, overwrittenFieldDefinitionKey?: string | undefined) => void) & import("lodash").Cancelable;
|
|
15
|
-
export declare const getInput: (fieldDefinition: FieldDefinition, namePath: string | number | (string | number)[], validationCallName: string, legalIdentifier: string, formInstance: FormInstance<any>, rapiBaseUrl: string, receiverRequirements: NewReceiverRequirements, updateReceiverRequirementsProp: (receiverRequirements: NewReceiverRequirements) => void, setAccountingCostFieldProps: (accountingCostFiledProps: FormItemPropsWithoutChildren) => void, accountingCostFieldProps: FormItemPropsWithoutChildren, setLoadingAccountingCostValues: (loadingAccountingCostValues: boolean) => void, loadingAccountingCostValues: boolean, setHandlingValidationStatus: (handlingValidationStatus: "" | "error" | "success" | "validating" | "warning") => void) => React.ReactNode;
|
|
16
|
+
export declare const getInput: (fieldDefinition: FieldDefinition, namePath: string | number | (string | number)[], validationCallName: string, legalIdentifier: string, formInstance: FormInstance<any>, rapiBaseUrl: string, receiverRequirements: NewReceiverRequirements, updateReceiverRequirementsProp: (receiverRequirements: NewReceiverRequirements) => void, setAccountingCostFieldProps: (accountingCostFiledProps: FormItemPropsWithoutChildren) => void, accountingCostFieldProps: FormItemPropsWithoutChildren, setLoadingAccountingCostValues: (loadingAccountingCostValues: boolean) => void, loadingAccountingCostValues: boolean, setHandlingValidationStatus: (handlingValidationStatus: "" | "error" | "success" | "validating" | "warning") => void, allowClearSelect?: boolean | undefined) => React.ReactNode;
|
|
@@ -63,6 +63,13 @@ exports.getFieldLabelTooltipOverride = function (receiverRequirements, key, defa
|
|
|
63
63
|
return defaultLabelTooltip;
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
+
exports.getFieldPlaceholderOverride = function (fieldRequirement, defaultPlaceholder) {
|
|
67
|
+
if (fieldRequirement.properties.handling) {
|
|
68
|
+
var handling = JSON.parse(fieldRequirement.properties.handling);
|
|
69
|
+
return handling.placeholder ? handling.placeholder : defaultPlaceholder;
|
|
70
|
+
}
|
|
71
|
+
return defaultPlaceholder ? defaultPlaceholder : "";
|
|
72
|
+
};
|
|
66
73
|
exports.getFieldIsRequired = function (receiverRequirements, key, defaultIsRequired) {
|
|
67
74
|
var fieldRequirement = exports.getFieldRequirements(receiverRequirements, key);
|
|
68
75
|
var fieldCardinality = fieldRequirement && fieldRequirement.properties.hasOwnProperty("cardinality") && fieldRequirement.properties.cardinality;
|
|
@@ -91,7 +98,7 @@ exports.handleValueValidation = lodash_1.debounce(function (isoNumber, fieldName
|
|
|
91
98
|
.then(function (response) {
|
|
92
99
|
response.data ? setValidationStatus("success") : setValidationStatus("error");
|
|
93
100
|
})
|
|
94
|
-
.catch(function (
|
|
101
|
+
.catch(function () {
|
|
95
102
|
setValidationStatus("error");
|
|
96
103
|
});
|
|
97
104
|
}
|
|
@@ -121,15 +128,16 @@ var handleValueSearch = function (searchValue, fieldDefinition, setLoadingValues
|
|
|
121
128
|
}
|
|
122
129
|
};
|
|
123
130
|
exports.debouncedHandleSearchValues = lodash_1.debounce(handleValueSearch, 500);
|
|
124
|
-
exports.getInput = function (fieldDefinition, namePath, validationCallName, legalIdentifier, formInstance, rapiBaseUrl, receiverRequirements, updateReceiverRequirementsProp, setAccountingCostFieldProps, accountingCostFieldProps, setLoadingAccountingCostValues, loadingAccountingCostValues, setHandlingValidationStatus) {
|
|
131
|
+
exports.getInput = function (fieldDefinition, namePath, validationCallName, legalIdentifier, formInstance, rapiBaseUrl, receiverRequirements, updateReceiverRequirementsProp, setAccountingCostFieldProps, accountingCostFieldProps, setLoadingAccountingCostValues, loadingAccountingCostValues, setHandlingValidationStatus, allowClearSelect) {
|
|
125
132
|
var handling = null;
|
|
126
133
|
if (fieldDefinition.properties.handling) {
|
|
127
134
|
handling = JSON.parse(fieldDefinition.properties.handling);
|
|
128
135
|
}
|
|
136
|
+
var placeholder = exports.getFieldPlaceholderOverride(fieldDefinition);
|
|
129
137
|
if (handling && handling.shouldBeValidated) {
|
|
130
138
|
return (react_1.default.createElement(antd_1.Input, { onBlur: function (event) {
|
|
131
139
|
exports.handleValueValidation(legalIdentifier, fieldDefinition.name, event.currentTarget.value, rapiBaseUrl, namePath, setHandlingValidationStatus, formInstance, validationCallName);
|
|
132
|
-
} }));
|
|
140
|
+
}, placeholder: placeholder }));
|
|
133
141
|
}
|
|
134
142
|
else if (fieldDefinition.properties.values) {
|
|
135
143
|
var selectProps = fieldDefinition.properties.hasOwnProperty("href")
|
|
@@ -142,11 +150,11 @@ exports.getInput = function (fieldDefinition, namePath, validationCallName, lega
|
|
|
142
150
|
loading: loadingAccountingCostValues,
|
|
143
151
|
}
|
|
144
152
|
: {};
|
|
145
|
-
return (react_1.default.createElement(antd_1.Select, __assign({ dropdownMatchSelectWidth: false }, selectProps), fieldDefinition.properties.values.map(function (op) {
|
|
153
|
+
return (react_1.default.createElement(antd_1.Select, __assign({ dropdownMatchSelectWidth: false, allowClear: allowClearSelect }, selectProps, { placeholder: placeholder }), fieldDefinition.properties.values.map(function (op) {
|
|
146
154
|
return react_1.default.createElement(antd_1.Select.Option, { key: op.key, value: op.key }, op.name);
|
|
147
155
|
})));
|
|
148
156
|
}
|
|
149
157
|
else {
|
|
150
|
-
return (react_1.default.createElement(antd_1.Input,
|
|
158
|
+
return (react_1.default.createElement(antd_1.Input, { allowClear: allowClearSelect, placeholder: placeholder }));
|
|
151
159
|
}
|
|
152
160
|
};
|