@commercetools-frontend/experimental-components 5.3.1 → 5.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1684,7 +1684,7 @@ function formatMoneyRangeValue(value, intl) {
|
|
|
1684
1684
|
return '';
|
|
1685
1685
|
}
|
|
1686
1686
|
function formatMoneyValue(amount, currency, intl) {
|
|
1687
|
-
return formatMoney$
|
|
1687
|
+
return formatMoney$2(_objectSpread$1l({
|
|
1688
1688
|
centAmount: amount,
|
|
1689
1689
|
fractionDigits: getFractionDigit(currency)
|
|
1690
1690
|
}, currency ? {
|
|
@@ -1699,7 +1699,7 @@ function getFractionedAmount(moneyValue) {
|
|
|
1699
1699
|
const amount = moneyValue.type === PRECISION_TYPES.highPrecision ? moneyValue.preciseAmount : moneyValue.centAmount;
|
|
1700
1700
|
return amount / 10 ** fractionDigits;
|
|
1701
1701
|
}
|
|
1702
|
-
function formatMoney$
|
|
1702
|
+
function formatMoney$2(moneyValue, intl, options) {
|
|
1703
1703
|
var _moneyValue$fractione;
|
|
1704
1704
|
return intl.formatNumber((_moneyValue$fractione = moneyValue.fractionedAmount) !== null && _moneyValue$fractione !== void 0 ? _moneyValue$fractione : getFractionedAmount(moneyValue), _objectSpread$1l({
|
|
1705
1705
|
style: 'currency',
|
|
@@ -1750,10 +1750,10 @@ const formatLtext = _ref3 => {
|
|
|
1750
1750
|
locale: language
|
|
1751
1751
|
});
|
|
1752
1752
|
};
|
|
1753
|
-
const formatMoney = _ref4 => {
|
|
1753
|
+
const formatMoney$1 = _ref4 => {
|
|
1754
1754
|
let value = _ref4.value,
|
|
1755
1755
|
intl = _ref4.intl;
|
|
1756
|
-
return formatMoney$
|
|
1756
|
+
return formatMoney$2(value, intl);
|
|
1757
1757
|
};
|
|
1758
1758
|
const formatReference = _ref5 => {
|
|
1759
1759
|
let value = _ref5.value;
|
|
@@ -1843,7 +1843,7 @@ const doNotFormat = _ref13 => {
|
|
|
1843
1843
|
let value = _ref13.value;
|
|
1844
1844
|
return value;
|
|
1845
1845
|
};
|
|
1846
|
-
const getFormatter = type => isNil__default["default"](type) ? formatNilType : type.name === 'nested' ? formatNested : type.name === 'set' ? formatSet : type.name === 'enum' ? formatEnum : type.name === 'lenum' ? formatLenum : type.name === 'ltext' ? formatLtext : type.name === 'money' ? formatMoney : type.name === 'reference' ? formatReference : type.name === 'date' ? formatDate : type.name === 'time' ? doNotFormat : type.name === 'datetime' ? formatDateTime : type.name === 'boolean' ? formatBoolean : type.name === 'text' ? doNotFormat : type.name === 'number' ? doNotFormat : formatUnknown;
|
|
1846
|
+
const getFormatter = type => isNil__default["default"](type) ? formatNilType : type.name === 'nested' ? formatNested : type.name === 'set' ? formatSet : type.name === 'enum' ? formatEnum : type.name === 'lenum' ? formatLenum : type.name === 'ltext' ? formatLtext : type.name === 'money' ? formatMoney$1 : type.name === 'reference' ? formatReference : type.name === 'date' ? formatDate : type.name === 'time' ? doNotFormat : type.name === 'datetime' ? formatDateTime : type.name === 'boolean' ? formatBoolean : type.name === 'text' ? doNotFormat : type.name === 'number' ? doNotFormat : formatUnknown;
|
|
1847
1847
|
function formatAttribute(_ref14) {
|
|
1848
1848
|
let type = _ref14.type,
|
|
1849
1849
|
value = _ref14.value,
|
|
@@ -4333,12 +4333,38 @@ const createAttributeTypeValue = attribute => {
|
|
|
4333
4333
|
return attribute.type;
|
|
4334
4334
|
}
|
|
4335
4335
|
};
|
|
4336
|
+
|
|
4337
|
+
/*
|
|
4338
|
+
* Fixed price supports high precision. Action format is nested with the
|
|
4339
|
+
* the type of the money. Absolute discount only works with cent precision,
|
|
4340
|
+
* hence the action structure is flat.
|
|
4341
|
+
*/
|
|
4342
|
+
const formatMoney = valueType => money => {
|
|
4343
|
+
if (valueType === 'fixed') {
|
|
4344
|
+
return {
|
|
4345
|
+
[money.type]: _objectSpread$10({
|
|
4346
|
+
centAmount: money.centAmount,
|
|
4347
|
+
currencyCode: money.currencyCode
|
|
4348
|
+
}, money.type === PRECISION_TYPES.highPrecision && {
|
|
4349
|
+
preciseAmount: money.preciseAmount,
|
|
4350
|
+
fractionDigits: money.fractionDigits
|
|
4351
|
+
})
|
|
4352
|
+
};
|
|
4353
|
+
} else if (valueType === 'absolute') {
|
|
4354
|
+
return {
|
|
4355
|
+
centAmount: money.centAmount,
|
|
4356
|
+
currencyCode: money.currencyCode
|
|
4357
|
+
};
|
|
4358
|
+
} else {
|
|
4359
|
+
throw new Error('Unexpected value type for money.');
|
|
4360
|
+
}
|
|
4361
|
+
};
|
|
4362
|
+
|
|
4336
4363
|
/**
|
|
4337
4364
|
* converts the `changeValue` action to GraphQL actions variable
|
|
4338
4365
|
* @param {Object} actionPayload
|
|
4339
4366
|
*/
|
|
4340
4367
|
const convertChangeValueAction = actionPayload => {
|
|
4341
|
-
var _context2;
|
|
4342
4368
|
const valueType = actionPayload.value.type;
|
|
4343
4369
|
const possibleTypeKeys = {
|
|
4344
4370
|
relative: ['permyriad'],
|
|
@@ -4347,7 +4373,11 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4347
4373
|
giftLineItem: ['product', 'variantId', 'distributionChannel', 'supplyChannel', 'ResourceIdentifierInput']
|
|
4348
4374
|
};
|
|
4349
4375
|
const filteredValue = pick__default["default"](actionPayload.value, possibleTypeKeys[valueType]);
|
|
4350
|
-
if (filteredValue.money)
|
|
4376
|
+
if (filteredValue.money) {
|
|
4377
|
+
var _context2;
|
|
4378
|
+
const moneyFormatter = formatMoney(valueType);
|
|
4379
|
+
filteredValue.money = _mapInstanceProperty__default["default"](_context2 = filteredValue.money).call(_context2, moneyFormatter);
|
|
4380
|
+
}
|
|
4351
4381
|
return {
|
|
4352
4382
|
changeValue: {
|
|
4353
4383
|
value: {
|
|
@@ -4356,6 +4386,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4356
4386
|
}
|
|
4357
4387
|
};
|
|
4358
4388
|
};
|
|
4389
|
+
|
|
4359
4390
|
/**
|
|
4360
4391
|
* This function changes any payload after the actions have been computed.
|
|
4361
4392
|
* Currently we only need to change the `setCustomField` action payload
|
|
@@ -7209,6 +7240,13 @@ function CustomInputSet(props) {
|
|
|
7209
7240
|
children: jsxRuntime.jsx(formik.Field, {
|
|
7210
7241
|
name: props.name,
|
|
7211
7242
|
validate: values => {
|
|
7243
|
+
// This validate function overrides the one found in CustomFieldInternal ,
|
|
7244
|
+
// so we need to check if the field is required here.
|
|
7245
|
+
if (props.fieldDefinition.required && isNil__default["default"](dropEmptyEntries(values))) {
|
|
7246
|
+
return {
|
|
7247
|
+
missing: true
|
|
7248
|
+
};
|
|
7249
|
+
}
|
|
7212
7250
|
const errors = getDuplicateErrors(values);
|
|
7213
7251
|
return errors.length > 0 ? errors : undefined;
|
|
7214
7252
|
},
|
|
@@ -7592,10 +7630,12 @@ const CustomFieldsInternal = props => {
|
|
|
7592
7630
|
return jsxRuntime.jsx(formik.FastField, {
|
|
7593
7631
|
name: fieldName,
|
|
7594
7632
|
validate: validate,
|
|
7595
|
-
children: () => {
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7633
|
+
children: () => jsxRuntime.jsx(uiKit.Spacings.Stack, {
|
|
7634
|
+
scale: "xs",
|
|
7635
|
+
children: jsxRuntime.jsxs("div", {
|
|
7636
|
+
"aria-invalid": _Object$keys__default["default"](fieldErrors !== null && fieldErrors !== void 0 ? fieldErrors : {}).length > 0,
|
|
7637
|
+
"aria-errormessage": "".concat(fieldName, "-error"),
|
|
7638
|
+
id: "".concat(fieldName, "-error"),
|
|
7599
7639
|
children: [jsxRuntime.jsx(CustomFieldsLabel, {
|
|
7600
7640
|
name: fieldName,
|
|
7601
7641
|
fieldDefinition: fieldDefinition
|
|
@@ -7610,26 +7650,22 @@ const CustomFieldsInternal = props => {
|
|
|
7610
7650
|
isReadOnly: props.isReadOnly,
|
|
7611
7651
|
onBlur: handleBlur,
|
|
7612
7652
|
setFieldValue: props.setFieldValue
|
|
7613
|
-
}) : jsxRuntime.jsx(
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
setFieldValue: props.setFieldValue,
|
|
7624
|
-
hasError: hasError
|
|
7625
|
-
})
|
|
7626
|
-
}, _concatInstanceProperty__default["default"](_context3 = "".concat(fieldName, "-")).call(_context3, index)), jsxRuntime.jsx(CustomFieldErrors, {
|
|
7653
|
+
}) : jsxRuntime.jsx(CustomFieldInput, {
|
|
7654
|
+
name: fieldName,
|
|
7655
|
+
value: value,
|
|
7656
|
+
fieldDefinition: fieldDefinition,
|
|
7657
|
+
isDisabled: props.isDisabled,
|
|
7658
|
+
isReadOnly: props.isReadOnly,
|
|
7659
|
+
onBlur: handleBlur,
|
|
7660
|
+
setFieldValue: props.setFieldValue,
|
|
7661
|
+
hasError: hasError
|
|
7662
|
+
}), jsxRuntime.jsx(CustomFieldErrors, {
|
|
7627
7663
|
isTouched: isTouched,
|
|
7628
7664
|
errors: fieldErrors
|
|
7629
7665
|
})]
|
|
7630
7666
|
})]
|
|
7631
|
-
})
|
|
7632
|
-
}
|
|
7667
|
+
})
|
|
7668
|
+
})
|
|
7633
7669
|
}, _concatInstanceProperty__default["default"](_context2 = "".concat(fieldName, "-")).call(_context2, index));
|
|
7634
7670
|
})
|
|
7635
7671
|
});
|
|
@@ -8974,7 +9010,7 @@ function formatDiscount(discount, currencyCode, intl) {
|
|
|
8974
9010
|
if (discount.type === 'relative') return "".concat(discount.permyriad / 100, "%");
|
|
8975
9011
|
if (!discount.money) return null;
|
|
8976
9012
|
const moneyForCurrencyCode = _findInstanceProperty__default["default"](_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
8977
|
-
return moneyForCurrencyCode ? formatMoney$
|
|
9013
|
+
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
8978
9014
|
}
|
|
8979
9015
|
|
|
8980
9016
|
function formatPercentage(percentage) {
|
|
@@ -11303,6 +11339,10 @@ const ScrollToFieldError = () => {
|
|
|
11303
11339
|
const formik$1 = formik.useFormikContext();
|
|
11304
11340
|
const isValid = formik$1.isValid,
|
|
11305
11341
|
submitCount = formik$1.submitCount;
|
|
11342
|
+
const _useApplicationContex = applicationShellConnectors.useApplicationContext(applicationContext => ({
|
|
11343
|
+
dataLocale: applicationContext.dataLocale
|
|
11344
|
+
})),
|
|
11345
|
+
dataLocale = _useApplicationContex.dataLocale;
|
|
11306
11346
|
React.useEffect(() => {
|
|
11307
11347
|
// Do not run the effect if the form hasn't been submitted yet.
|
|
11308
11348
|
if (submitCount === 0) return;
|
|
@@ -11310,17 +11350,23 @@ const ScrollToFieldError = () => {
|
|
|
11310
11350
|
if (isValid) return;
|
|
11311
11351
|
const firstErrorElement = document.querySelector('[aria-invalid="true"]');
|
|
11312
11352
|
if (firstErrorElement) {
|
|
11313
|
-
var _ref, _document$querySelect, _elementToScrollTo$sc;
|
|
11353
|
+
var _ref, _ref2, _document$querySelect, _elementToScrollTo$sc;
|
|
11314
11354
|
// Get a reference to the label.
|
|
11315
|
-
const
|
|
11355
|
+
const firstElementId = firstErrorElement.getAttribute('id');
|
|
11356
|
+
const localizedInputIndex = _indexOfInstanceProperty__default["default"](firstElementId).call(firstElementId, ".".concat(dataLocale));
|
|
11357
|
+
|
|
11358
|
+
// check if locale is appended then remove it from id
|
|
11359
|
+
const id = localizedInputIndex > -1 ? firstElementId.replace(".".concat(dataLocale), '') : firstElementId;
|
|
11316
11360
|
|
|
11317
11361
|
// Scroll to the label (if found), otherwise to the input element itself.
|
|
11318
|
-
|
|
11362
|
+
|
|
11363
|
+
const elementToScrollTo = // div is used only for custom fields
|
|
11364
|
+
(_ref = (_ref2 = (_document$querySelect = document.querySelector("div[aria-errormessage=\"".concat(firstElementId, "\"]"))) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("label[for=\"".concat(id, "\"]"))) !== null && _ref2 !== void 0 ? _ref2 : document.querySelector("label#".concat(id))) !== null && _ref !== void 0 ? _ref : firstErrorElement;
|
|
11319
11365
|
(_elementToScrollTo$sc = elementToScrollTo.scrollIntoView) === null || _elementToScrollTo$sc === void 0 || _elementToScrollTo$sc.call(elementToScrollTo, {
|
|
11320
11366
|
behavior: 'smooth'
|
|
11321
11367
|
});
|
|
11322
11368
|
}
|
|
11323
|
-
}, [isValid, submitCount]);
|
|
11369
|
+
}, [dataLocale, isValid, submitCount]);
|
|
11324
11370
|
return null;
|
|
11325
11371
|
};
|
|
11326
11372
|
|
|
@@ -12622,7 +12668,7 @@ const computedProperties = {
|
|
|
12622
12668
|
intl = _ref4.intl;
|
|
12623
12669
|
const allVariants = _concatInstanceProperty__default["default"](_context2 = product.variants).call(_context2, product.masterVariant);
|
|
12624
12670
|
const variantPrices = flatMap__default["default"](allVariants, variant => variant.prices);
|
|
12625
|
-
return _mapInstanceProperty__default["default"](_context3 = getMinimumPricesByCurrencyCode(variantPrices)).call(_context3, price => formatMoney$
|
|
12671
|
+
return _mapInstanceProperty__default["default"](_context3 = getMinimumPricesByCurrencyCode(variantPrices)).call(_context3, price => formatMoney$2(price, intl)).join(', ') || constants.NO_VALUE_FALLBACK;
|
|
12626
12672
|
},
|
|
12627
12673
|
sku(_ref5) {
|
|
12628
12674
|
var _context4, _context5;
|
|
@@ -12927,13 +12973,18 @@ var messages = reactIntl.defineMessages({
|
|
|
12927
12973
|
id: 'CustomTypesSubform.typesPlaceholder',
|
|
12928
12974
|
description: 'The placeholder for the types',
|
|
12929
12975
|
defaultMessage: 'Select...'
|
|
12976
|
+
},
|
|
12977
|
+
noInputValues: {
|
|
12978
|
+
id: 'CustomTypesSubform.noInputValues',
|
|
12979
|
+
description: 'The label when there are no input values defined for the custom fields.',
|
|
12980
|
+
defaultMessage: 'There are no input values defined for the custom fields.'
|
|
12930
12981
|
}
|
|
12931
12982
|
});
|
|
12932
12983
|
|
|
12933
12984
|
const FIELD_NAME = 'custom';
|
|
12934
12985
|
|
|
12935
12986
|
function ownKeys$2(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12936
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
12987
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$2(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
12937
12988
|
const typeDefinitionsExist = typeDefinitions => {
|
|
12938
12989
|
return typeDefinitions.length > 0;
|
|
12939
12990
|
};
|
|
@@ -12944,9 +12995,18 @@ const typeDefinitionSelected = formValues => {
|
|
|
12944
12995
|
const typeDefinitionContainsFieldDefinitions = formValues => {
|
|
12945
12996
|
return formValues[FIELD_NAME].type.obj.key && formValues[FIELD_NAME].type.obj.fieldDefinitions.length > 0;
|
|
12946
12997
|
};
|
|
12947
|
-
const
|
|
12948
|
-
|
|
12949
|
-
|
|
12998
|
+
const fieldDefinitionsWithValues = formValues => {
|
|
12999
|
+
var _context;
|
|
13000
|
+
const fieldValues = formValues[FIELD_NAME].fields;
|
|
13001
|
+
return _filterInstanceProperty__default["default"](_context = formValues[FIELD_NAME].type.obj.fieldDefinitions).call(_context, _ref => {
|
|
13002
|
+
let name = _ref.name;
|
|
13003
|
+
return fieldValues[name] !== undefined;
|
|
13004
|
+
});
|
|
13005
|
+
};
|
|
13006
|
+
const CustomFieldsInputWrapper = _ref2 => {
|
|
13007
|
+
let typeDefinitions = _ref2.typeDefinitions,
|
|
13008
|
+
isReadOnly = _ref2.isReadOnly,
|
|
13009
|
+
hideEmptyFields = _ref2.hideEmptyFields;
|
|
12950
13010
|
const _useFormikContext = formik.useFormikContext(),
|
|
12951
13011
|
formValues = _valuesInstanceProperty__default["default"](_useFormikContext);
|
|
12952
13012
|
if (!typeDefinitionsExist(typeDefinitions)) {
|
|
@@ -12958,12 +13018,15 @@ const CustomFieldsInputWrapper = _ref => {
|
|
|
12958
13018
|
if (!typeDefinitionContainsFieldDefinitions(formValues)) {
|
|
12959
13019
|
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2({}, messages.noCustomFields));
|
|
12960
13020
|
}
|
|
13021
|
+
if (fieldDefinitionsWithValues(formValues).length === 0 && isReadOnly && hideEmptyFields) {
|
|
13022
|
+
return jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$2({}, messages.noInputValues));
|
|
13023
|
+
}
|
|
12961
13024
|
return jsxRuntime.jsx(uiKit.Constraints.Horizontal, {
|
|
12962
13025
|
max: "scale",
|
|
12963
13026
|
children: jsxRuntime.jsx(CustomFields, {
|
|
12964
13027
|
isReadOnly: isReadOnly,
|
|
12965
13028
|
name: "".concat(FIELD_NAME, ".fields"),
|
|
12966
|
-
fieldDefinitions: formValues[FIELD_NAME].type.obj.fieldDefinitions
|
|
13029
|
+
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues) : formValues[FIELD_NAME].type.obj.fieldDefinitions
|
|
12967
13030
|
})
|
|
12968
13031
|
});
|
|
12969
13032
|
};
|
|
@@ -12997,10 +13060,11 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
12997
13060
|
};
|
|
12998
13061
|
};
|
|
12999
13062
|
const CustomTypeSubform = _ref => {
|
|
13000
|
-
var _formValues$
|
|
13063
|
+
var _formValues$FIELD_NAM3, _formValues$FIELD_NAM4;
|
|
13001
13064
|
let typeDefinitions = _ref.typeDefinitions,
|
|
13002
13065
|
isReadOnly = _ref.isReadOnly,
|
|
13003
|
-
isCondensed = _ref.isCondensed
|
|
13066
|
+
isCondensed = _ref.isCondensed,
|
|
13067
|
+
hideEmptyFields = _ref.hideEmptyFields;
|
|
13004
13068
|
const _useFormikContext = formik.useFormikContext(),
|
|
13005
13069
|
formValues = _valuesInstanceProperty__default["default"](_useFormikContext),
|
|
13006
13070
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
@@ -13027,19 +13091,26 @@ const CustomTypeSubform = _ref => {
|
|
|
13027
13091
|
});
|
|
13028
13092
|
}
|
|
13029
13093
|
}, [typeDefinitions, setFieldValue, validateForm]);
|
|
13094
|
+
const typeDefinitionSelected = formValues => {
|
|
13095
|
+
var _formValues$FIELD_NAM, _formValues$FIELD_NAM2;
|
|
13096
|
+
return ((_formValues$FIELD_NAM = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM === void 0 ? void 0 : _formValues$FIELD_NAM.type) && ((_formValues$FIELD_NAM2 = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM2 === void 0 || (_formValues$FIELD_NAM2 = _formValues$FIELD_NAM2.type) === null || _formValues$FIELD_NAM2 === void 0 ? void 0 : _formValues$FIELD_NAM2.obj);
|
|
13097
|
+
};
|
|
13098
|
+
|
|
13099
|
+
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
13100
|
+
if (isReadOnly && hideEmptyFields && !typeDefinitionSelected(formValues)) return null;
|
|
13030
13101
|
return jsxRuntime.jsx(uiKit.CollapsiblePanel, {
|
|
13031
13102
|
header: jsxRuntime.jsx(uiKit.CollapsiblePanel.Header, {
|
|
13032
13103
|
isCondensed: isCondensed,
|
|
13033
13104
|
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread$1({}, messages.title))
|
|
13034
13105
|
}),
|
|
13035
13106
|
headerControls: typeDefinitions.length > 0 && jsxRuntime.jsx("div", {
|
|
13036
|
-
css: /*#__PURE__*/react$1.css("min-width:", uiKit.designTokens.constraint11, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:CustomTypeSubform;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
13107
|
+
css: /*#__PURE__*/react$1.css("min-width:", uiKit.designTokens.constraint11, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:CustomTypeSubform;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1c3RvbS10eXBlLXN1YmZvcm0uanN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQStHb0IiLCJmaWxlIjoiY3VzdG9tLXR5cGUtc3ViZm9ybS5qc3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyB1c2VDYWxsYmFjayB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCBQcm9wVHlwZXMgZnJvbSAncHJvcC10eXBlcyc7XG5pbXBvcnQgeyB1c2VGb3JtaWtDb250ZXh0IH0gZnJvbSAnZm9ybWlrJztcbmltcG9ydCB7IEZvcm1hdHRlZE1lc3NhZ2UsIHVzZUludGwgfSBmcm9tICdyZWFjdC1pbnRsJztcbmltcG9ydCB7IHVzZUFwcGxpY2F0aW9uQ29udGV4dCB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2FwcGxpY2F0aW9uLXNoZWxsLWNvbm5lY3RvcnMnO1xuaW1wb3J0IHsgZm9ybWF0TG9jYWxpemVkU3RyaW5nIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtZnJvbnRlbmQvbDEwbic7XG5pbXBvcnQge1xuICBDb2xsYXBzaWJsZVBhbmVsLFxuICBTZWxlY3RJbnB1dCxcbiAgZGVzaWduVG9rZW5zLFxufSBmcm9tICdAY29tbWVyY2V0b29scy1mc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JvcFR5cGVzLmFycmF5LmlzUmVxdWlyZWQsXG4gIGlzUmVhZE9ubHk6IFByb3BUeXBlcy5ib29sLFxuICBpc0NvbmRlbnNlZDogUHJvcFR5cGVzLmJvb2wsXG4gIGhpZGVFbXB0eUZpZWxkczogUHJvcFR5cGVzLmJvb2wsXG59O1xuXG5leHBvcnQgZGVmYXVsdCBDdXN0b21UeXBlU3ViZm9ybTtcbiJdfQ== */"),
|
|
13037
13108
|
children: jsxRuntime.jsx(uiKit.SelectInput, {
|
|
13038
13109
|
isClearable: true,
|
|
13039
13110
|
"data-testid": "custom-type-select",
|
|
13040
13111
|
name: "".concat(FIELD_NAME, ".type.obj.key"),
|
|
13041
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, (_formValues$
|
|
13042
|
-
value: (_formValues$
|
|
13112
|
+
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, (_formValues$FIELD_NAM3 = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM3 === void 0 || (_formValues$FIELD_NAM3 = _formValues$FIELD_NAM3.type) === null || _formValues$FIELD_NAM3 === void 0 ? void 0 : _formValues$FIELD_NAM3.id),
|
|
13113
|
+
value: (_formValues$FIELD_NAM4 = formValues[FIELD_NAME]) === null || _formValues$FIELD_NAM4 === void 0 || (_formValues$FIELD_NAM4 = _formValues$FIELD_NAM4.type) === null || _formValues$FIELD_NAM4 === void 0 || (_formValues$FIELD_NAM4 = _formValues$FIELD_NAM4.obj) === null || _formValues$FIELD_NAM4 === void 0 ? void 0 : _formValues$FIELD_NAM4.key,
|
|
13043
13114
|
onChange: handleTypeDefinitionSelect,
|
|
13044
13115
|
placeholder: formatMessage(messages.typesPlaceholder),
|
|
13045
13116
|
isReadOnly: isReadOnly
|
|
@@ -13048,7 +13119,8 @@ const CustomTypeSubform = _ref => {
|
|
|
13048
13119
|
headerControlsAlignment: "right",
|
|
13049
13120
|
children: jsxRuntime.jsx(CustomFieldsInputWrapper, {
|
|
13050
13121
|
typeDefinitions: typeDefinitions,
|
|
13051
|
-
isReadOnly: isReadOnly
|
|
13122
|
+
isReadOnly: isReadOnly,
|
|
13123
|
+
hideEmptyFields: hideEmptyFields
|
|
13052
13124
|
})
|
|
13053
13125
|
});
|
|
13054
13126
|
};
|
|
@@ -13144,7 +13216,8 @@ const createGraphQlDocFromFormState = formState => {
|
|
|
13144
13216
|
const CustomFieldsFormField = _ref => {
|
|
13145
13217
|
let resources = _ref.resources,
|
|
13146
13218
|
isReadOnly = _ref.isReadOnly,
|
|
13147
|
-
isCondensed = _ref.isCondensed
|
|
13219
|
+
isCondensed = _ref.isCondensed,
|
|
13220
|
+
hideEmptyFields = _ref.hideEmptyFields;
|
|
13148
13221
|
const projectKey = applicationShellConnectors.useApplicationContext(applicationContext => applicationContext.project.key);
|
|
13149
13222
|
return jsxRuntime.jsx(CustomFieldTypeDefinitionsConnector$1, {
|
|
13150
13223
|
resources: resources,
|
|
@@ -13161,7 +13234,8 @@ const CustomFieldsFormField = _ref => {
|
|
|
13161
13234
|
return jsxRuntime.jsx(CustomTypeSubform, {
|
|
13162
13235
|
typeDefinitions: typeDefinitions,
|
|
13163
13236
|
isReadOnly: isReadOnly,
|
|
13164
|
-
isCondensed: isCondensed
|
|
13237
|
+
isCondensed: isCondensed,
|
|
13238
|
+
hideEmptyFields: hideEmptyFields
|
|
13165
13239
|
});
|
|
13166
13240
|
}
|
|
13167
13241
|
});
|
|
@@ -13248,7 +13322,7 @@ exports.formatCustomerName = formatCustomerName;
|
|
|
13248
13322
|
exports.formatDateRangeValue = formatDateRangeValue;
|
|
13249
13323
|
exports.formatDateTime = formatDateTime$1;
|
|
13250
13324
|
exports.formatDiscount = formatDiscount;
|
|
13251
|
-
exports.formatMoney = formatMoney$
|
|
13325
|
+
exports.formatMoney = formatMoney$2;
|
|
13252
13326
|
exports.formatMoneyRangeValue = formatMoneyRangeValue;
|
|
13253
13327
|
exports.formatMoneyValue = formatMoneyValue;
|
|
13254
13328
|
exports.formatPercentage = formatPercentage;
|