@commercetools-frontend/experimental-components 5.3.1 → 5.4.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.
|
@@ -1601,7 +1601,7 @@ function formatMoneyRangeValue(value, intl) {
|
|
|
1601
1601
|
return '';
|
|
1602
1602
|
}
|
|
1603
1603
|
function formatMoneyValue(amount, currency, intl) {
|
|
1604
|
-
return formatMoney$
|
|
1604
|
+
return formatMoney$2(_objectSpread$1l({
|
|
1605
1605
|
centAmount: amount,
|
|
1606
1606
|
fractionDigits: getFractionDigit(currency)
|
|
1607
1607
|
}, currency ? {
|
|
@@ -1616,7 +1616,7 @@ function getFractionedAmount(moneyValue) {
|
|
|
1616
1616
|
const amount = moneyValue.type === PRECISION_TYPES.highPrecision ? moneyValue.preciseAmount : moneyValue.centAmount;
|
|
1617
1617
|
return amount / 10 ** fractionDigits;
|
|
1618
1618
|
}
|
|
1619
|
-
function formatMoney$
|
|
1619
|
+
function formatMoney$2(moneyValue, intl, options) {
|
|
1620
1620
|
var _moneyValue$fractione;
|
|
1621
1621
|
return intl.formatNumber((_moneyValue$fractione = moneyValue.fractionedAmount) !== null && _moneyValue$fractione !== void 0 ? _moneyValue$fractione : getFractionedAmount(moneyValue), _objectSpread$1l({
|
|
1622
1622
|
style: 'currency',
|
|
@@ -1667,10 +1667,10 @@ const formatLtext = _ref3 => {
|
|
|
1667
1667
|
locale: language
|
|
1668
1668
|
});
|
|
1669
1669
|
};
|
|
1670
|
-
const formatMoney = _ref4 => {
|
|
1670
|
+
const formatMoney$1 = _ref4 => {
|
|
1671
1671
|
let value = _ref4.value,
|
|
1672
1672
|
intl = _ref4.intl;
|
|
1673
|
-
return formatMoney$
|
|
1673
|
+
return formatMoney$2(value, intl);
|
|
1674
1674
|
};
|
|
1675
1675
|
const formatReference = _ref5 => {
|
|
1676
1676
|
let value = _ref5.value;
|
|
@@ -1760,7 +1760,7 @@ const doNotFormat = _ref13 => {
|
|
|
1760
1760
|
let value = _ref13.value;
|
|
1761
1761
|
return value;
|
|
1762
1762
|
};
|
|
1763
|
-
const getFormatter = type => isNil$1(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;
|
|
1763
|
+
const getFormatter = type => isNil$1(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;
|
|
1764
1764
|
function formatAttribute(_ref14) {
|
|
1765
1765
|
let type = _ref14.type,
|
|
1766
1766
|
value = _ref14.value,
|
|
@@ -4250,12 +4250,38 @@ const createAttributeTypeValue = attribute => {
|
|
|
4250
4250
|
return attribute.type;
|
|
4251
4251
|
}
|
|
4252
4252
|
};
|
|
4253
|
+
|
|
4254
|
+
/*
|
|
4255
|
+
* Fixed price supports high precision. Action format is nested with the
|
|
4256
|
+
* the type of the money. Absolute discount only works with cent precision,
|
|
4257
|
+
* hence the action structure is flat.
|
|
4258
|
+
*/
|
|
4259
|
+
const formatMoney = valueType => money => {
|
|
4260
|
+
if (valueType === 'fixed') {
|
|
4261
|
+
return {
|
|
4262
|
+
[money.type]: _objectSpread$10({
|
|
4263
|
+
centAmount: money.centAmount,
|
|
4264
|
+
currencyCode: money.currencyCode
|
|
4265
|
+
}, money.type === PRECISION_TYPES.highPrecision && {
|
|
4266
|
+
preciseAmount: money.preciseAmount,
|
|
4267
|
+
fractionDigits: money.fractionDigits
|
|
4268
|
+
})
|
|
4269
|
+
};
|
|
4270
|
+
} else if (valueType === 'absolute') {
|
|
4271
|
+
return {
|
|
4272
|
+
centAmount: money.centAmount,
|
|
4273
|
+
currencyCode: money.currencyCode
|
|
4274
|
+
};
|
|
4275
|
+
} else {
|
|
4276
|
+
throw new Error('Unexpected value type for money.');
|
|
4277
|
+
}
|
|
4278
|
+
};
|
|
4279
|
+
|
|
4253
4280
|
/**
|
|
4254
4281
|
* converts the `changeValue` action to GraphQL actions variable
|
|
4255
4282
|
* @param {Object} actionPayload
|
|
4256
4283
|
*/
|
|
4257
4284
|
const convertChangeValueAction = actionPayload => {
|
|
4258
|
-
var _context2;
|
|
4259
4285
|
const valueType = actionPayload.value.type;
|
|
4260
4286
|
const possibleTypeKeys = {
|
|
4261
4287
|
relative: ['permyriad'],
|
|
@@ -4264,7 +4290,11 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4264
4290
|
giftLineItem: ['product', 'variantId', 'distributionChannel', 'supplyChannel', 'ResourceIdentifierInput']
|
|
4265
4291
|
};
|
|
4266
4292
|
const filteredValue = pick(actionPayload.value, possibleTypeKeys[valueType]);
|
|
4267
|
-
if (filteredValue.money)
|
|
4293
|
+
if (filteredValue.money) {
|
|
4294
|
+
var _context2;
|
|
4295
|
+
const moneyFormatter = formatMoney(valueType);
|
|
4296
|
+
filteredValue.money = _mapInstanceProperty(_context2 = filteredValue.money).call(_context2, moneyFormatter);
|
|
4297
|
+
}
|
|
4268
4298
|
return {
|
|
4269
4299
|
changeValue: {
|
|
4270
4300
|
value: {
|
|
@@ -4273,6 +4303,7 @@ const convertChangeValueAction = actionPayload => {
|
|
|
4273
4303
|
}
|
|
4274
4304
|
};
|
|
4275
4305
|
};
|
|
4306
|
+
|
|
4276
4307
|
/**
|
|
4277
4308
|
* This function changes any payload after the actions have been computed.
|
|
4278
4309
|
* Currently we only need to change the `setCustomField` action payload
|
|
@@ -7126,6 +7157,13 @@ function CustomInputSet(props) {
|
|
|
7126
7157
|
children: jsx(Field, {
|
|
7127
7158
|
name: props.name,
|
|
7128
7159
|
validate: values => {
|
|
7160
|
+
// This validate function overrides the one found in CustomFieldInternal ,
|
|
7161
|
+
// so we need to check if the field is required here.
|
|
7162
|
+
if (props.fieldDefinition.required && isNil$1(dropEmptyEntries(values))) {
|
|
7163
|
+
return {
|
|
7164
|
+
missing: true
|
|
7165
|
+
};
|
|
7166
|
+
}
|
|
7129
7167
|
const errors = getDuplicateErrors(values);
|
|
7130
7168
|
return errors.length > 0 ? errors : undefined;
|
|
7131
7169
|
},
|
|
@@ -8891,7 +8929,7 @@ function formatDiscount(discount, currencyCode, intl) {
|
|
|
8891
8929
|
if (discount.type === 'relative') return "".concat(discount.permyriad / 100, "%");
|
|
8892
8930
|
if (!discount.money) return null;
|
|
8893
8931
|
const moneyForCurrencyCode = _findInstanceProperty(_context = discount.money).call(_context, discountMoney => discountMoney.currencyCode === currencyCode);
|
|
8894
|
-
return moneyForCurrencyCode ? formatMoney$
|
|
8932
|
+
return moneyForCurrencyCode ? formatMoney$2(moneyForCurrencyCode, intl) : null;
|
|
8895
8933
|
}
|
|
8896
8934
|
|
|
8897
8935
|
function formatPercentage(percentage) {
|
|
@@ -12539,7 +12577,7 @@ const computedProperties = {
|
|
|
12539
12577
|
intl = _ref4.intl;
|
|
12540
12578
|
const allVariants = _concatInstanceProperty(_context2 = product.variants).call(_context2, product.masterVariant);
|
|
12541
12579
|
const variantPrices = flatMap(allVariants, variant => variant.prices);
|
|
12542
|
-
return _mapInstanceProperty(_context3 = getMinimumPricesByCurrencyCode(variantPrices)).call(_context3, price => formatMoney$
|
|
12580
|
+
return _mapInstanceProperty(_context3 = getMinimumPricesByCurrencyCode(variantPrices)).call(_context3, price => formatMoney$2(price, intl)).join(', ') || NO_VALUE_FALLBACK;
|
|
12543
12581
|
},
|
|
12544
12582
|
sku(_ref5) {
|
|
12545
12583
|
var _context4, _context5;
|
|
@@ -12844,13 +12882,18 @@ var messages = defineMessages({
|
|
|
12844
12882
|
id: 'CustomTypesSubform.typesPlaceholder',
|
|
12845
12883
|
description: 'The placeholder for the types',
|
|
12846
12884
|
defaultMessage: 'Select...'
|
|
12885
|
+
},
|
|
12886
|
+
noInputValues: {
|
|
12887
|
+
id: 'CustomTypesSubform.noInputValues',
|
|
12888
|
+
description: 'The label when there are no input values defined for the custom fields.',
|
|
12889
|
+
defaultMessage: 'There are no input values defined for the custom fields.'
|
|
12847
12890
|
}
|
|
12848
12891
|
});
|
|
12849
12892
|
|
|
12850
12893
|
const FIELD_NAME = 'custom';
|
|
12851
12894
|
|
|
12852
12895
|
function ownKeys$2(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12853
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
12896
|
+
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(_context2 = ownKeys$2(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context3 = ownKeys$2(Object(t))).call(_context3, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12854
12897
|
const typeDefinitionsExist = typeDefinitions => {
|
|
12855
12898
|
return typeDefinitions.length > 0;
|
|
12856
12899
|
};
|
|
@@ -12861,9 +12904,18 @@ const typeDefinitionSelected = formValues => {
|
|
|
12861
12904
|
const typeDefinitionContainsFieldDefinitions = formValues => {
|
|
12862
12905
|
return formValues[FIELD_NAME].type.obj.key && formValues[FIELD_NAME].type.obj.fieldDefinitions.length > 0;
|
|
12863
12906
|
};
|
|
12864
|
-
const
|
|
12865
|
-
|
|
12866
|
-
|
|
12907
|
+
const fieldDefinitionsWithValues = formValues => {
|
|
12908
|
+
var _context;
|
|
12909
|
+
const fieldValues = formValues[FIELD_NAME].fields;
|
|
12910
|
+
return _filterInstanceProperty(_context = formValues[FIELD_NAME].type.obj.fieldDefinitions).call(_context, _ref => {
|
|
12911
|
+
let name = _ref.name;
|
|
12912
|
+
return fieldValues[name] !== undefined;
|
|
12913
|
+
});
|
|
12914
|
+
};
|
|
12915
|
+
const CustomFieldsInputWrapper = _ref2 => {
|
|
12916
|
+
let typeDefinitions = _ref2.typeDefinitions,
|
|
12917
|
+
isReadOnly = _ref2.isReadOnly,
|
|
12918
|
+
hideEmptyFields = _ref2.hideEmptyFields;
|
|
12867
12919
|
const _useFormikContext = useFormikContext(),
|
|
12868
12920
|
formValues = _valuesInstanceProperty(_useFormikContext);
|
|
12869
12921
|
if (!typeDefinitionsExist(typeDefinitions)) {
|
|
@@ -12875,12 +12927,15 @@ const CustomFieldsInputWrapper = _ref => {
|
|
|
12875
12927
|
if (!typeDefinitionContainsFieldDefinitions(formValues)) {
|
|
12876
12928
|
return jsx(FormattedMessage, _objectSpread$2({}, messages.noCustomFields));
|
|
12877
12929
|
}
|
|
12930
|
+
if (fieldDefinitionsWithValues(formValues).length === 0 && isReadOnly && hideEmptyFields) {
|
|
12931
|
+
return jsx(FormattedMessage, _objectSpread$2({}, messages.noInputValues));
|
|
12932
|
+
}
|
|
12878
12933
|
return jsx(Constraints.Horizontal, {
|
|
12879
12934
|
max: "scale",
|
|
12880
12935
|
children: jsx(CustomFields, {
|
|
12881
12936
|
isReadOnly: isReadOnly,
|
|
12882
12937
|
name: "".concat(FIELD_NAME, ".fields"),
|
|
12883
|
-
fieldDefinitions: formValues[FIELD_NAME].type.obj.fieldDefinitions
|
|
12938
|
+
fieldDefinitions: isReadOnly && hideEmptyFields ? fieldDefinitionsWithValues(formValues) : formValues[FIELD_NAME].type.obj.fieldDefinitions
|
|
12884
12939
|
})
|
|
12885
12940
|
});
|
|
12886
12941
|
};
|
|
@@ -12914,10 +12969,11 @@ const createFormStateFromTypeDefinition = selectedTypeDefinition => {
|
|
|
12914
12969
|
};
|
|
12915
12970
|
};
|
|
12916
12971
|
const CustomTypeSubform = _ref => {
|
|
12917
|
-
var _formValues$
|
|
12972
|
+
var _formValues$FIELD_NAM3, _formValues$FIELD_NAM4;
|
|
12918
12973
|
let typeDefinitions = _ref.typeDefinitions,
|
|
12919
12974
|
isReadOnly = _ref.isReadOnly,
|
|
12920
|
-
isCondensed = _ref.isCondensed
|
|
12975
|
+
isCondensed = _ref.isCondensed,
|
|
12976
|
+
hideEmptyFields = _ref.hideEmptyFields;
|
|
12921
12977
|
const _useFormikContext = useFormikContext(),
|
|
12922
12978
|
formValues = _valuesInstanceProperty(_useFormikContext),
|
|
12923
12979
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
@@ -12944,19 +13000,26 @@ const CustomTypeSubform = _ref => {
|
|
|
12944
13000
|
});
|
|
12945
13001
|
}
|
|
12946
13002
|
}, [typeDefinitions, setFieldValue, validateForm]);
|
|
13003
|
+
const typeDefinitionSelected = formValues => {
|
|
13004
|
+
var _formValues$FIELD_NAM, _formValues$FIELD_NAM2;
|
|
13005
|
+
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);
|
|
13006
|
+
};
|
|
13007
|
+
|
|
13008
|
+
// if the user has read-only permissions, empty fields are hidden, and no type definition is selected, hide the component
|
|
13009
|
+
if (isReadOnly && hideEmptyFields && !typeDefinitionSelected(formValues)) return null;
|
|
12947
13010
|
return jsx(CollapsiblePanel, {
|
|
12948
13011
|
header: jsx(CollapsiblePanel.Header, {
|
|
12949
13012
|
isCondensed: isCondensed,
|
|
12950
13013
|
children: jsx(FormattedMessage, _objectSpread$1({}, messages.title))
|
|
12951
13014
|
}),
|
|
12952
13015
|
headerControls: typeDefinitions.length > 0 && jsx("div", {
|
|
12953
|
-
css: /*#__PURE__*/css("min-width:", designTokens.constraint11, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:CustomTypeSubform;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
13016
|
+
css: /*#__PURE__*/css("min-width:", designTokens.constraint11, ";" + (process.env.NODE_ENV === "production" ? "" : ";label:CustomTypeSubform;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1c3RvbS10eXBlLXN1YmZvcm0uanN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQStHb0IiLCJmaWxlIjoiY3VzdG9tLXR5cGUtc3ViZm9ybS5qc3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyB1c2VDYWxsYmFjayB9IGZyb20gJ3JlYWN0JztcbmltcG9ydCBQcm9wVHlwZXMgZnJvbSAncHJvcC10eXBlcyc7XG5pbXBvcnQgeyB1c2VGb3JtaWtDb250ZXh0IH0gZnJvbSAnZm9ybWlrJztcbmltcG9ydCB7IEZvcm1hdHRlZE1lc3NhZ2UsIHVzZUludGwgfSBmcm9tICdyZWFjdC1pbnRsJztcbmltcG9ydCB7IHVzZUFwcGxpY2F0aW9uQ29udGV4dCB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLWZyb250ZW5kL2FwcGxpY2F0aW9uLXNoZWxsLWNvbm5lY3RvcnMnO1xuaW1wb3J0IHsgZm9ybWF0TG9jYWxpemV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xlY3RJbnB1dFxuICAgICAgICAgICAgICBpc0NsZWFyYWJsZVxuICAgICAgICAgICAgICBkYXRhLXRlc3RpZD1cImN1c3RvbS10eXBlLXNlbGVjdFwiXG4gICAgICAgICAgICAgIG5hbWU9e2Ake0ZJRUxEX05BTUV9LnR5cGUub2JqLmtleWB9XG4gICAgICAgICAgICAgIG9wdGlvbnM9e21hcFR5cGVEZWZpbml0aW9uc1RvT3B0aW9ucyhcbiAgICAgICAgICAgICAgICB0eXBlRGVmaW5pdGlvbnMsXG4gICAgICAgICAgICAgICAgbGFuZ3VhZ2UsXG4gICAgICAgICAgICAgICAgbGFuZ3VhZ2VzLFxuICAgICAgICAgICAgICAgIGZvcm1WYWx1ZXNbRklFTERfTkFNRV0/LnR5cGU/LmlkXG4gICAgICAgICAgICAgICl9XG4gICAgICAgICAgICAgIHZhbHVlPXtmb3JtVmFsdWVzW0ZJRUxEX05BTUVdPy50eXBlPy5vYmo/LmtleX1cbiAgICAgICAgICAgICAgb25DaGFuZ2U9e2hhbmRsZVR5cGVEZWZpbml0aW9uU2VsZWN0fVxuICAgICAgICAgICAgICBwbGFjZWhvbGRlcj17Zm9ybWF0TWVzc2FnZShtZXNzYWdlcy50eXBlc1BsYWNlaG9sZGVyKX1cbiAgICAgICAgICAgICAgaXNSZWFkT25seT17aXNSZWFkT25seX1cbiAgICAgICAgICAgIC8+XG4gICAgICAgICAgPC9kaXY+XG4gICAgICAgIClcbiAgICAgIH1cbiAgICAgIGhlYWRlckNvbnRyb2xzQWxpZ25tZW50PVwicmlnaHRcIlxuICAgID5cbiAgICAgIDxDdXN0b21GaWVsZHNJbnB1dFdyYXBwZXJcbiAgICAgICAgdHlwZURlZmluaXRpb25zPXt0eXBlRGVmaW5pdGlvbnN9XG4gICAgICAgIGlzUmVhZE9ubHk9e2lzUmVhZE9ubHl9XG4gICAgICAgIGhpZGVFbXB0eUZpZWxkcz17aGlkZUVtcHR5RmllbGRzfVxuICAgICAgLz5cbiAgICA8L0NvbGxhcHNpYmxlUGFuZWw+XG4gICk7XG59O1xuXG5DdXN0b21UeXBlU3ViZm9ybS5kaXNwbGF5TmFtZSA9ICdDdXN0b21UeXBlU3ViZm9ybSc7XG5DdXN0b21UeXBlU3ViZm9ybS5wcm9wVHlwZXMgPSB7XG4gIHR5cGVEZWZpbml0aW9uczogUHJvcFR5cGVzLmFycmF5LmlzUmVxdWlyZWQsXG4gIGlzUmVhZE9ubHk6IFByb3BUeXBlcy5ib29sLFxuICBpc0NvbmRlbnNlZDogUHJvcFR5cGVzLmJvb2wsXG4gIGhpZGVFbXB0eUZpZWxkczogUHJvcFR5cGVzLmJvb2wsXG59O1xuXG5leHBvcnQgZGVmYXVsdCBDdXN0b21UeXBlU3ViZm9ybTtcbiJdfQ== */"),
|
|
12954
13017
|
children: jsx(SelectInput, {
|
|
12955
13018
|
isClearable: true,
|
|
12956
13019
|
"data-testid": "custom-type-select",
|
|
12957
13020
|
name: "".concat(FIELD_NAME, ".type.obj.key"),
|
|
12958
|
-
options: mapTypeDefinitionsToOptions(typeDefinitions, language, languages, (_formValues$
|
|
12959
|
-
value: (_formValues$
|
|
13021
|
+
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),
|
|
13022
|
+
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,
|
|
12960
13023
|
onChange: handleTypeDefinitionSelect,
|
|
12961
13024
|
placeholder: formatMessage(messages.typesPlaceholder),
|
|
12962
13025
|
isReadOnly: isReadOnly
|
|
@@ -12965,7 +13028,8 @@ const CustomTypeSubform = _ref => {
|
|
|
12965
13028
|
headerControlsAlignment: "right",
|
|
12966
13029
|
children: jsx(CustomFieldsInputWrapper, {
|
|
12967
13030
|
typeDefinitions: typeDefinitions,
|
|
12968
|
-
isReadOnly: isReadOnly
|
|
13031
|
+
isReadOnly: isReadOnly,
|
|
13032
|
+
hideEmptyFields: hideEmptyFields
|
|
12969
13033
|
})
|
|
12970
13034
|
});
|
|
12971
13035
|
};
|
|
@@ -13061,7 +13125,8 @@ const createGraphQlDocFromFormState = formState => {
|
|
|
13061
13125
|
const CustomFieldsFormField = _ref => {
|
|
13062
13126
|
let resources = _ref.resources,
|
|
13063
13127
|
isReadOnly = _ref.isReadOnly,
|
|
13064
|
-
isCondensed = _ref.isCondensed
|
|
13128
|
+
isCondensed = _ref.isCondensed,
|
|
13129
|
+
hideEmptyFields = _ref.hideEmptyFields;
|
|
13065
13130
|
const projectKey = useApplicationContext(applicationContext => applicationContext.project.key);
|
|
13066
13131
|
return jsx(CustomFieldTypeDefinitionsConnector$1, {
|
|
13067
13132
|
resources: resources,
|
|
@@ -13078,7 +13143,8 @@ const CustomFieldsFormField = _ref => {
|
|
|
13078
13143
|
return jsx(CustomTypeSubform, {
|
|
13079
13144
|
typeDefinitions: typeDefinitions,
|
|
13080
13145
|
isReadOnly: isReadOnly,
|
|
13081
|
-
isCondensed: isCondensed
|
|
13146
|
+
isCondensed: isCondensed,
|
|
13147
|
+
hideEmptyFields: hideEmptyFields
|
|
13082
13148
|
});
|
|
13083
13149
|
}
|
|
13084
13150
|
});
|
|
@@ -13088,4 +13154,4 @@ CustomFieldsFormField.createGraphQlDocFromFormState = createGraphQlDocFromFormSt
|
|
|
13088
13154
|
|
|
13089
13155
|
var CategorySearchPickerOptionFragment = { kind: "Document", definitions: [{ kind: "FragmentDefinition", name: { kind: "Name", value: "CategorySearchPickerOptionFragment" }, typeCondition: { kind: "NamedType", name: { kind: "Name", value: "CategorySearch" } }, directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "id" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "externalId" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "slugAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }, { kind: "Field", name: { kind: "Name", value: "parent" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }, { kind: "Field", name: { kind: "Name", value: "ancestors" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "nameAllLocales" }, arguments: [], directives: [], selectionSet: { kind: "SelectionSet", selections: [{ kind: "Field", name: { kind: "Name", value: "locale" }, arguments: [], directives: [] }, { kind: "Field", name: { kind: "Name", value: "value" }, arguments: [], directives: [] }] } }] } }] } }], loc: { start: 0, end: 685, source: { body: "query SearchCategoryReference($locale: Locale!, $text: String!) {\n categories: categoryAutocomplete(locale: $locale, text: $text) {\n results {\n ...CategorySearchPickerOptionFragment\n }\n }\n}\n\nquery FetchCategoriesByIds($where: String!) {\n categories(where: $where) {\n results {\n id\n nameAllLocales {\n locale\n value\n }\n }\n }\n}\n\nfragment CategorySearchPickerOptionFragment on CategorySearch {\n id\n externalId\n nameAllLocales {\n locale\n value\n }\n slugAllLocales {\n locale\n value\n }\n parent {\n nameAllLocales {\n locale\n value\n }\n }\n ancestors {\n nameAllLocales {\n locale\n value\n }\n }\n}\n", name: "GraphQL request", locationOffset: { line: 1, column: 1 } } } };
|
|
13090
13156
|
|
|
13091
|
-
export { booleanField as BooleanField, Button, CartDiscountReferenceSearch, CategoryReferenceSearch, CategorySearchPickerOptionFragment, CenteredLoadingSpinner, ChannelPickerInput, CountriesPicker, customFieldDefinitionsConnector as CustomFieldDefinitionsConnector, CustomFieldTypeDefinitionsConnector$1 as CustomFieldTypeDefinitionsConnector, CustomFields, CustomFieldsErrorTextNotification, CustomFieldsFormField, CustomerGroupPickerInput, DefaultPageSizes, Divider, EMAIL_REGEX, FileInput, FormattedDateTime$1 as FormattedDateTime, LabelRange, MissingValueField, MultiValueSearchInput, numericFormatInput as NumericFormatInput, PRECISION_TYPES, pimIndexerProvider as PimIndexerProvider, ProductAttributeInput, ProductAttributes, ProductPickerInput, ProductSelectionsPicker as ProductSelectionPicker, RequestCache, RequiredIndicator, ScrollToFieldError, searchInput as SearchInput, SelectableFieldSearchInput, StoreSelectField, StoreSelectInput, ThrottledField, VALIDATOR_INTEGER, VALIDATOR_NUMERIC, VALIDATOR_REQUIRED, WithPimIndexer, allowedProperties, and, attributesMapToNameValuePairs, base64ToString, messages$8 as booleanMessages, buildSearchQuery, businessRoleConstants, messages$r as businessRoleMessages, businessRoleKeys as businessRoles, capitalizeFirst, clone, coerceToInteger, computedProperties, convertApolloNetworkStatusToLoadingState, convertApolloQueryDataToConnectorData, convertProductSelectionFromGraphQl, convertRatioToPercentage, createGraphQlUpdateActions, createNextSortDefinition, createReducer, createResourceReducer, handlers$2 as customFieldDefinitionsMockHanders, customFields as customFieldsTransformer, dateTransformer$1 as dateTransformer, exact, exists, extractErrorFromGraphQlResponse, filterCustomTypeUpdateActionValues, filterDataAttributes, filterEmptyValues, formatCustomField, formatCustomerAddress, formatCustomerName, formatDateRangeValue, formatDateTime$1 as formatDateTime, formatDiscount, formatMoney$
|
|
13157
|
+
export { booleanField as BooleanField, Button, CartDiscountReferenceSearch, CategoryReferenceSearch, CategorySearchPickerOptionFragment, CenteredLoadingSpinner, ChannelPickerInput, CountriesPicker, customFieldDefinitionsConnector as CustomFieldDefinitionsConnector, CustomFieldTypeDefinitionsConnector$1 as CustomFieldTypeDefinitionsConnector, CustomFields, CustomFieldsErrorTextNotification, CustomFieldsFormField, CustomerGroupPickerInput, DefaultPageSizes, Divider, EMAIL_REGEX, FileInput, FormattedDateTime$1 as FormattedDateTime, LabelRange, MissingValueField, MultiValueSearchInput, numericFormatInput as NumericFormatInput, PRECISION_TYPES, pimIndexerProvider as PimIndexerProvider, ProductAttributeInput, ProductAttributes, ProductPickerInput, ProductSelectionsPicker as ProductSelectionPicker, RequestCache, RequiredIndicator, ScrollToFieldError, searchInput as SearchInput, SelectableFieldSearchInput, StoreSelectField, StoreSelectInput, ThrottledField, VALIDATOR_INTEGER, VALIDATOR_NUMERIC, VALIDATOR_REQUIRED, WithPimIndexer, allowedProperties, and, attributesMapToNameValuePairs, base64ToString, messages$8 as booleanMessages, buildSearchQuery, businessRoleConstants, messages$r as businessRoleMessages, businessRoleKeys as businessRoles, capitalizeFirst, clone, coerceToInteger, computedProperties, convertApolloNetworkStatusToLoadingState, convertApolloQueryDataToConnectorData, convertProductSelectionFromGraphQl, convertRatioToPercentage, createGraphQlUpdateActions, createNextSortDefinition, createReducer, createResourceReducer, handlers$2 as customFieldDefinitionsMockHanders, customFields as customFieldsTransformer, dateTransformer$1 as dateTransformer, exact, exists, extractErrorFromGraphQlResponse, filterCustomTypeUpdateActionValues, filterDataAttributes, filterEmptyValues, formatCustomField, formatCustomerAddress, formatCustomerName, formatDateRangeValue, formatDateTime$1 as formatDateTime, formatDiscount, formatMoney$2 as formatMoney, formatMoneyRangeValue, formatMoneyValue, formatPercentage, formatAttribute as formatProductAttribute, getAncestors, getAttributeValueByType, getAttributeValueType, getBulkNotification, getCategoryLevel, getCountsFromBulkSummary, getDiscountValue, getDisplayName, getFractionedAmount, getIndexesOfInvalidValues, getMinimumPricesByCurrencyCode, getNetUnitPrice, getPathName, getPrefixSearchBounds, getPriceChannelName, getReferenceTypeId, getSelectedPrice, getTimeZoneId, getTimeZoneLabel, getTypeNameOfType, graphqlCategoryLevelTransformer, dateTransformer as graphqlDateTransformer, missingLocaleTransformer as graphqlMissingLocaleTransformer, missingTransformer as graphqlMissingTransformer, numberTransformer as graphqlNumberTransformer, graphqlQueryBuilder, referenceTransformer as graphqlReferenceTransformer, textTransformer as graphqlTextTransformer, hasInvalidInputError, hasSemanticError, injectCustomerGroupsPlatformLimits, injectCustomersPlatformLimits, injectDataTablePaginationState, injectModalState$1 as injectModalState, injectNotifications, injectPimIndexer, injectShippingMethodsPlatformLimits, injectStorage, injectTaxCategoriesPlatformLimits, injectModalState as injectToggleState, injectZonesPlatformLimits, isEmptyFilter as isEmpty, isEmptyValue, isUUID, isValidISODate, isValidISODateTime, isValidISOTime, keepDisplayName, mapStoresToOptions, mapTimeZonesToOptions, minusify, messages$7 as missingValueMessages, nameValuePairsToMap, normalizeProductSettings, not, omitDeep, omitSetsOfSets, or, commonPickerMessages as pickerMessages, handlers as platformLimitsMockHandlers, handlers$3 as productSelectionsFetcherMockHandler, handlers$4 as productSelectionsTotalFetcherMockHandler, range, reorderArrayItems, resolveStatusType, safelyAddFallback, sanitize, searchCategories, messages$F as searchInputMessages, setDisplayName, setToArray, shallowEqual, shouldUpdateAttributeInput, slugify, sortDataByIdsArray, sortRequiresLanguage, splitVariantAttributesByConstraint, handlers$5 as storesListConnectorMockHandlers, stringToBase64, swapArrayItems, transformAllToProperNounCase, transformCustomFieldsRawToCustomFields, transformLocalizedFieldsForCategory, truncate, unique, uniqueObjects, useCachedCategoryOptions, useCustomerGroupsPlatformLimits, useCustomersPlatformLimits, useDebouncedPromiseCallback, useFormatLocalizedFieldToString, useLocalizedKeyFallback, usePendingRequests, usePersistedTableConfiguration, usePimIndexer, usePrevious, useProductSelectionsFetcher, useProductSelectionsTotalFetcher, useRoleNotificationEffect, useShippingMethodsLimits as useShippingMethodsPlatformLimits, useStorage, useStoreKeysInDataFences, useStoresListFetcher, useTaxCategoriesLimits as useTaxCategoriesPlatformLimits, useTotalNumberOfStoresFetcher, handlers$1 as useTotalNumberOfStoresFetcherHandlers, validateFilter$2 as validateCustomField, validations as validateCustomFields, validateFilter$1 as validateDate, validateMultiOptionEnum, validateFilter as validateNumber, validateSingleOptionEnum, validateText, validatedInput, messages$K as validationMessages, withPendingRequests, withProps, withRedirectTo, withoutEmptyErrorsByField, wrapDisplayName };
|