wini-web-components 1.4.0 → 1.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.
@@ -42,6 +42,7 @@ export declare class Select1 extends React.Component<Select1Props, Select1State>
42
42
  private renderOptions;
43
43
  private onKeyDown;
44
44
  componentDidUpdate(prevProps: Select1Props, prevState: Select1State): void;
45
+ componentDidMount(): void;
45
46
  render(): React.JSX.Element;
46
47
  }
47
48
  export {};
@@ -233,21 +233,19 @@ var Select1 = /** @class */ (function (_super) {
233
233
  };
234
234
  Select1.prototype.componentDidUpdate = function (prevProps, prevState) {
235
235
  var _this = this;
236
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
236
+ var _a, _b, _c, _d, _e, _f, _g, _h;
237
237
  if (prevProps.options !== this.props.options) {
238
238
  this.setState(__assign(__assign({}, this.state), { options: this.props.options }));
239
239
  if (this.inputRef.current)
240
240
  this.inputRef.current.value = "".concat((_b = (_a = this.props.options.find(function (e) { return e.id === _this.state.value; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "");
241
241
  }
242
- if (prevProps.value !== this.props.value && this.inputRef.current) {
242
+ if (prevProps.value !== this.props.value)
243
243
  this.setState(__assign(__assign({}, this.state), { value: this.props.value }));
244
- this.inputRef.current.value = "".concat((_d = (_c = this.state.options.find(function (e) { return e.id === _this.state.value; })) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : "");
245
- }
246
244
  if (prevState.value !== this.state.value && this.inputRef.current)
247
- this.inputRef.current.value = "".concat((_f = (_e = this.state.options.find(function (e) { return e.id === _this.state.value; })) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : "");
245
+ this.inputRef.current.value = "".concat((_d = (_c = this.state.options.find(function (e) { return e.id === _this.state.value; })) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : "");
248
246
  //
249
247
  if (this.state.isOpen && prevState.isOpen !== this.state.isOpen) {
250
- var thisPopupRect = (_g = document.body.querySelector('.select1-popup')) === null || _g === void 0 ? void 0 : _g.getBoundingClientRect();
248
+ var thisPopupRect = (_e = document.body.querySelector('.select1-popup')) === null || _e === void 0 ? void 0 : _e.getBoundingClientRect();
251
249
  if (thisPopupRect) {
252
250
  var style = void 0;
253
251
  if (thisPopupRect.right > document.body.offsetWidth) {
@@ -257,20 +255,26 @@ var Select1 = /** @class */ (function (_super) {
257
255
  };
258
256
  }
259
257
  var _bottom = thisPopupRect.bottom - 8;
260
- var thisContainerRect = (_h = this.containerRef.current) === null || _h === void 0 ? void 0 : _h.getBoundingClientRect();
258
+ var thisContainerRect = (_f = this.containerRef.current) === null || _f === void 0 ? void 0 : _f.getBoundingClientRect();
261
259
  if (thisContainerRect) {
262
260
  if (_bottom > document.body.offsetHeight) {
263
261
  style = __assign(__assign({}, (style !== null && style !== void 0 ? style : {})), { top: "".concat(thisContainerRect.y - 2 - thisPopupRect.height, "px") });
264
262
  }
265
263
  }
266
264
  if (style) {
267
- (_j = style.left) !== null && _j !== void 0 ? _j : (style.left = style.right ? undefined : "".concat(this.state.offset.x, "px"));
268
- (_k = style.width) !== null && _k !== void 0 ? _k : (style.width = "".concat(this.state.offset.width, "px"));
265
+ (_g = style.left) !== null && _g !== void 0 ? _g : (style.left = style.right ? undefined : "".concat(this.state.offset.x, "px"));
266
+ (_h = style.width) !== null && _h !== void 0 ? _h : (style.width = "".concat(this.state.offset.width, "px"));
269
267
  this.setState(__assign(__assign({}, this.state), { style: style }));
270
268
  }
271
269
  }
272
270
  }
273
271
  };
272
+ Select1.prototype.componentDidMount = function () {
273
+ var _this = this;
274
+ var _a, _b;
275
+ if (this.inputRef.current)
276
+ this.inputRef.current.value = "".concat((_b = (_a = this.state.options.find(function (e) { return e.id === _this.state.value; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : "");
277
+ };
274
278
  Select1.prototype.render = function () {
275
279
  var _this = this;
276
280
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;