wini-web-components 2.1.3 → 2.1.5

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.
@@ -12,6 +12,7 @@ interface SelectMultipleProps {
12
12
  helperTextColor?: string;
13
13
  style?: CSSProperties;
14
14
  handleSearch?: (e: string) => Promise<Array<OptionsItem>>;
15
+ handleLoadmore?: (onLoadMore: boolean, ev: React.UIEvent<HTMLDivElement, UIEvent>) => void;
15
16
  showClearValueButton?: boolean;
16
17
  popupClassName?: string;
17
18
  }
@@ -306,7 +306,12 @@ var SelectMultiple = /** @class */ (function (_super) {
306
306
  _this.props.onChange(newValue);
307
307
  }, className: 'button-text-3', style: { color: _list.length ? 'var(--infor-main-color)' : 'var(--neutral-text-title-color)' } }, _list.length && isSelectedAll ? 'Bỏ chọn tất cả' : 'Chọn tất cả');
308
308
  })()),
309
- react_1.default.createElement("div", { className: "col ".concat(input_multi_select_module_css_1.default['select-body']) },
309
+ react_1.default.createElement("div", { className: "col ".concat(input_multi_select_module_css_1.default['select-body']), onScroll: this.props.handleLoadmore ? function (ev) {
310
+ if (_this.props.handleLoadmore) {
311
+ var scrollElement = ev.target;
312
+ _this.props.handleLoadmore(Math.round(scrollElement.offsetHeight + scrollElement.scrollTop) >= (scrollElement.scrollHeight - 1), ev);
313
+ }
314
+ } : undefined },
310
315
  ((_g = this.state.search) !== null && _g !== void 0 ? _g : this.state.options).filter(function (e) { return !e.parentId; }).map(function (item) { return _this.renderOptions(item); }),
311
316
  (((_h = this.state.search) === null || _h === void 0 ? void 0 : _h.length) === 0 || ((_j = this.props.options) === null || _j === void 0 ? void 0 : _j.length) === 0) && (react_1.default.createElement("div", { className: input_multi_select_module_css_1.default['no-results-found'] }, "No result found")))), document.body));
312
317
  };
@@ -18,6 +18,7 @@ interface Select1Props {
18
18
  helperTextColor?: string;
19
19
  style?: CSSProperties;
20
20
  handleSearch?: (e: string) => Promise<Array<OptionsItem>>;
21
+ handleLoadmore?: (onLoadMore: boolean, ev: React.UIEvent<HTMLDivElement, UIEvent>) => void;
21
22
  readOnly?: boolean;
22
23
  popupClassName?: string;
23
24
  prefix?: ReactNode;
@@ -105,7 +105,6 @@ var Select1 = /** @class */ (function (_super) {
105
105
  _this.inputRef = (0, react_1.createRef)();
106
106
  _this.onKeyDown = function (ev) {
107
107
  var _a, _b, _c, _d, _e, _f, _g;
108
- console.log(ev.key);
109
108
  if ((((_a = _this.state.options) === null || _a === void 0 ? void 0 : _a.length) || ((_b = _this.state.search) === null || _b === void 0 ? void 0 : _b.length)) && _this.state.isOpen) {
110
109
  switch (ev.key.toLowerCase()) {
111
110
  case "enter":
@@ -303,7 +302,12 @@ var Select1 = /** @class */ (function (_super) {
303
302
  left: this.state.offset.x + 'px',
304
303
  width: this.state.offset.width,
305
304
  }, onMouseOver: function (ev) { return _this.setState(__assign(__assign({}, _this.state), { onSelect: ev.target })); }, onMouseOut: function () { return _this.setState(__assign(__assign({}, _this.state), { onSelect: null })); } },
306
- react_1.default.createElement("div", { className: "col ".concat(select1_module_css_1.default['select-body']) },
305
+ react_1.default.createElement("div", { className: "col ".concat(select1_module_css_1.default['select-body']), onScroll: this.props.handleLoadmore ? function (ev) {
306
+ if (_this.props.handleLoadmore) {
307
+ var scrollElement = ev.target;
308
+ _this.props.handleLoadmore(Math.round(scrollElement.offsetHeight + scrollElement.scrollTop) >= (scrollElement.scrollHeight - 1), ev);
309
+ }
310
+ } : undefined },
307
311
  ((_g = this.state.search) !== null && _g !== void 0 ? _g : this.state.options).filter(function (e) { return !e.parentId; }).map(function (item) { return _this.renderOptions(item); }),
308
312
  (((_h = this.state.search) === null || _h === void 0 ? void 0 : _h.length) === 0 || ((_j = this.props.options) === null || _j === void 0 ? void 0 : _j.length) === 0) && (react_1.default.createElement("div", { className: select1_module_css_1.default['no-results-found'] }, "No result found")))), document.body));
309
313
  };