@singularsystems/neo-react 1.0.15 → 1.0.16

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.
@@ -50,8 +50,8 @@ var Button = /** @class */ (function (_super) {
50
50
  };
51
51
  Button.prototype.afterRender = function () {
52
52
  if (this.btnGroupDom.current && this.menuDom.current) {
53
- this.menuDom.current.style.position = "fixed"; // override bootstrap style.
54
- this.positionHelper = new Components.FixedPositionHelper(this.btnGroupDom.current, this.menuDom.current, this.props.menuAlignment === "right");
53
+ this.positionHelper = new Components.FixedPositionHelper(this.btnGroupDom.current, this.menuDom.current);
54
+ this.positionHelper.positionPopup(this.props.menuAlignment === "right");
55
55
  }
56
56
  };
57
57
  Button.prototype.componentWillUnmount = function () {
@@ -25,6 +25,12 @@ interface IAutoCompleteCommonProps<T> extends ICommonEditorProps, Props<IOption,
25
25
  * Function used to filter items out of the datasource.
26
26
  * **Note:** this will only apply to the `items` prop. */
27
27
  filterPredicate?: (item: T) => boolean;
28
+ /**
29
+ * Function used to filter items based on what the user has typed.
30
+ * Applies after `filterPredicate`, and is ignored if `itemSource` is specified.
31
+ * Use if you are displaying multiple columns and need to match on any of the columns.
32
+ */
33
+ inputFilter?: (input: string, item: T) => boolean;
28
34
  /**
29
35
  * Property of an item to use as the description.
30
36
  *
@@ -128,7 +128,7 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
128
128
  AutoCompleteDropDown.prototype.render = function () {
129
129
  var _this = this;
130
130
  var _a, _b, _c, _d, _e, _f, _g, _h;
131
- var _j = this.props, bind = _j.bind, bindDisplay = _j.bindDisplay, bindItems = _j.bindItems, bindIds = _j.bindIds, itemSource = _j.itemSource, items = _j.items, displayMember = _j.displayMember, valueMember = _j.valueMember, descriptionMember = _j.descriptionMember, option = _j.option, noRecordsPrompt = _j.noRecordsPrompt, typeToSearchPrompt = _j.typeToSearchPrompt, delayMs = _j.delayMs, minCharacters = _j.minCharacters, onItemSelected = _j.onItemSelected, fieldInfoLimit = _j.fieldInfoLimit, otherProps = __rest(_j, ["bind", "bindDisplay", "bindItems", "bindIds", "itemSource", "items", "displayMember", "valueMember", "descriptionMember", "option", "noRecordsPrompt", "typeToSearchPrompt", "delayMs", "minCharacters", "onItemSelected", "fieldInfoLimit"]);
131
+ var _j = this.props, bind = _j.bind, bindDisplay = _j.bindDisplay, bindItems = _j.bindItems, bindIds = _j.bindIds, itemSource = _j.itemSource, items = _j.items, displayMember = _j.displayMember, valueMember = _j.valueMember, descriptionMember = _j.descriptionMember, option = _j.option, noRecordsPrompt = _j.noRecordsPrompt, typeToSearchPrompt = _j.typeToSearchPrompt, delayMs = _j.delayMs, minCharacters = _j.minCharacters, onItemSelected = _j.onItemSelected, fieldInfoLimit = _j.fieldInfoLimit, filterPredicate = _j.filterPredicate, inputFilter = _j.inputFilter, otherProps = __rest(_j, ["bind", "bindDisplay", "bindItems", "bindIds", "itemSource", "items", "displayMember", "valueMember", "descriptionMember", "option", "noRecordsPrompt", "typeToSearchPrompt", "delayMs", "minCharacters", "onItemSelected", "fieldInfoLimit", "filterPredicate", "inputFilter"]);
132
132
  this.setBindProperty();
133
133
  var splitProps = BindPropsHelper.splitCommonEditorProps(otherProps);
134
134
  var nativeProps = splitProps.rest;
@@ -148,13 +148,13 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
148
148
  if (this.props.items) {
149
149
  var items_1 = this.getItems(this.props.items);
150
150
  defaultItems = this.mapTArrayToOptions(items_1);
151
- if (this.props.filterPredicate !== undefined) {
151
+ if (filterPredicate !== undefined) {
152
152
  if (bindValue) {
153
153
  // Dont filter out the current selected item even if excluded by the filter.
154
- defaultItems = defaultItems.filter(function (option) { return bindValue.value === option.value || _this.props.filterPredicate(option.item); });
154
+ defaultItems = defaultItems.filter(function (option) { return bindValue.value === option.value || filterPredicate(option.item); });
155
155
  }
156
156
  else {
157
- defaultItems = defaultItems.filter(function (option) { return _this.props.filterPredicate(option.item); });
157
+ defaultItems = defaultItems.filter(function (option) { return filterPredicate(option.item); });
158
158
  }
159
159
  }
160
160
  if (descriptionMember === undefined && items_1.length > 0) {
@@ -221,6 +221,11 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
221
221
  userOnBlur(e);
222
222
  }
223
223
  };
224
+ if (this.props.inputFilter && !this.props.itemSource) {
225
+ nativeProps.filterOption = function (option, input) {
226
+ return !input || _this.props.inputFilter(input, option.data.item);
227
+ };
228
+ }
224
229
  if (this.props.itemSource !== undefined) {
225
230
  return Tooltip.fromDataAttributes(InputHelpers.surroundWithInputGroup(React.createElement(this.asyncSelectImplementation, __assign({}, nativeProps, { placeholder: (_g = this.props.placeholder) !== null && _g !== void 0 ? _g : "", classNamePrefix: "react-select-bs", defaultOptions: defaultItems, loadOptions: this.onKeyPress, isMulti: bindItems !== undefined, noOptionsMessage: function (c) { var _a, _b; return c.inputValue && c.inputValue.length >= (minCharacters !== null && minCharacters !== void 0 ? minCharacters : 1) ? ((_a = _this.props.noRecordsPrompt) !== null && _a !== void 0 ? _a : "No records found") : ((_b = _this.props.typeToSearchPrompt) !== null && _b !== void 0 ? _b : "Type to search..."); }, value: value, onChange: this.onItemSelected, components: components })), splitProps.editor, { disabled: nativeProps.isDisabled }), nativeProps);
226
231
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-react",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "React application logic and components for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "typescript": "5.4.2"
32
32
  },
33
33
  "dependencies": {
34
- "@singularsystems/neo-core": "1.0.12",
34
+ "@singularsystems/neo-core": "1.0.13",
35
35
  "@types/rc-slider": "^8.6.5",
36
36
  "@types/react-color": "^3.0.1",
37
37
  "axios": "1.6.7",
@@ -49,7 +49,7 @@
49
49
  "tslib": "2.5.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@singularsystems/neo-core": ">=1.0.12",
52
+ "@singularsystems/neo-core": ">=1.0.13",
53
53
  "axios": ">=1.6.2",
54
54
  "inversify": ">=5.0.1",
55
55
  "mobx": ">=6.9.0",