@salutejs/plasma-new-hope 0.335.1-canary.2209.17603494170.0 → 0.335.1-canary.2209.17629577358.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.
@@ -1 +1,16 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "Combobox", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return Combobox;
9
+ }
10
+ });
11
+ var _engines = require("../../../engines");
12
+ var _ = require("../../..");
13
+ var _Comboboxconfig = require("./Combobox.config");
14
+ var mergedConfig = (0, _engines.mergeConfig)(_.comboboxNewConfig, _Comboboxconfig.config);
15
+ var ComboboxComponent = (0, _engines.component)(mergedConfig);
16
+ var Combobox = ComboboxComponent;
@@ -76,10 +76,23 @@ export var mergeConfig = function(baseConfig, userConfig) {
76
76
  }
77
77
  return res;
78
78
  };
79
+ // INFO: Метод, который проводит слияние двух объектов
80
+ // INFO: если значение явно указанно как undefined/null/пустая строка, то будет взято значение указанное в default
81
+ function mergeWithoutNullable(defaults, componentProps) {
82
+ var props = Object.keys(defaults).reduce(function(acc, key) {
83
+ return _object_spread_props(_object_spread({}, acc), _define_property({}, key, [
84
+ null,
85
+ undefined,
86
+ ''
87
+ ].includes(componentProps[key]) ? defaults[key] : componentProps[key]));
88
+ }, {});
89
+ return _object_spread({}, componentProps, props);
90
+ }
79
91
  export function component(config) {
80
92
  var Comp = config.layout(_component(config));
81
93
  return /*#__PURE__*/ React.forwardRef(function(props, ref) {
82
- return /*#__PURE__*/ React.createElement(Comp, _object_spread_props(_object_spread({}, config === null || config === void 0 ? void 0 : config.defaults, props), {
94
+ var mergedProps = mergeWithoutNullable(config === null || config === void 0 ? void 0 : config.defaults, props);
95
+ return /*#__PURE__*/ React.createElement(Comp, _object_spread_props(_object_spread({}, mergedProps), {
83
96
  ref: ref
84
97
  }));
85
98
  });