@singularsystems/neo-react 1.2.2 → 1.2.4

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.
@@ -131,8 +131,8 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
131
131
  };
132
132
  AutoCompleteDropDown.prototype.render = function () {
133
133
  var _this = this;
134
- var _a, _b, _c, _d, _e, _f, _g, _h;
135
- 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"]);
134
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
135
+ var _k = this.props, bind = _k.bind, bindDisplay = _k.bindDisplay, bindItems = _k.bindItems, bindIds = _k.bindIds, itemSource = _k.itemSource, items = _k.items, displayMember = _k.displayMember, valueMember = _k.valueMember, descriptionMember = _k.descriptionMember, option = _k.option, noRecordsPrompt = _k.noRecordsPrompt, typeToSearchPrompt = _k.typeToSearchPrompt, delayMs = _k.delayMs, minCharacters = _k.minCharacters, onItemSelected = _k.onItemSelected, fieldInfoLimit = _k.fieldInfoLimit, filterPredicate = _k.filterPredicate, inputFilter = _k.inputFilter, otherProps = __rest(_k, ["bind", "bindDisplay", "bindItems", "bindIds", "itemSource", "items", "displayMember", "valueMember", "descriptionMember", "option", "noRecordsPrompt", "typeToSearchPrompt", "delayMs", "minCharacters", "onItemSelected", "fieldInfoLimit", "filterPredicate", "inputFilter"]);
136
136
  this.setBindProperty();
137
137
  var splitProps = BindPropsHelper.splitCommonEditorProps(otherProps);
138
138
  var nativeProps = splitProps.rest;
@@ -215,9 +215,7 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
215
215
  nativeProps.isDisabled = true;
216
216
  }
217
217
  nativeProps.className = Utils.joinWithSpaces("react-select-bs", nativeProps.className);
218
- if (this.context.uniqueId) {
219
- nativeProps.inputId = this.context.uniqueId;
220
- }
218
+ nativeProps.inputId = (_g = this.context.uniqueId) !== null && _g !== void 0 ? _g : BindPropsHelper.getUniqueId(this.bindProperty, this);
221
219
  var userOnBlur = nativeProps.onBlur;
222
220
  nativeProps.onBlur = function (e) {
223
221
  _this.bindProperty.validator.hasBlurred = true;
@@ -231,10 +229,10 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
231
229
  };
232
230
  }
233
231
  if (this.props.itemSource !== undefined) {
234
- 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);
232
+ return Tooltip.fromDataAttributes(InputHelpers.surroundWithInputGroup(React.createElement(this.asyncSelectImplementation, __assign({}, nativeProps, { placeholder: (_h = this.props.placeholder) !== null && _h !== void 0 ? _h : "", 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);
235
233
  }
236
234
  else {
237
- return Tooltip.fromDataAttributes(InputHelpers.surroundWithInputGroup(React.createElement(this.selectImplementation, __assign({}, nativeProps, { placeholder: (_h = this.props.placeholder) !== null && _h !== void 0 ? _h : "", classNamePrefix: "react-select-bs", options: defaultItems, isLoading: this.isLoading, isMulti: bindItems !== undefined, noOptionsMessage: function (c) { var _a; return (_a = _this.props.noRecordsPrompt) !== null && _a !== void 0 ? _a : "No records found"; }, value: value, onChange: this.onItemSelected, components: components })), splitProps.editor, { disabled: nativeProps.isDisabled }), nativeProps);
235
+ return Tooltip.fromDataAttributes(InputHelpers.surroundWithInputGroup(React.createElement(this.selectImplementation, __assign({}, nativeProps, { placeholder: (_j = this.props.placeholder) !== null && _j !== void 0 ? _j : "", classNamePrefix: "react-select-bs", options: defaultItems, isLoading: this.isLoading, isMulti: bindItems !== undefined, noOptionsMessage: function (c) { var _a; return (_a = _this.props.noRecordsPrompt) !== null && _a !== void 0 ? _a : "No records found"; }, value: value, onChange: this.onItemSelected, components: components })), splitProps.editor, { disabled: nativeProps.isDisabled }), nativeProps);
238
236
  }
239
237
  };
240
238
  AutoCompleteDropDown.prototype.getOption = function (content, additionalClass) {
@@ -21,7 +21,7 @@ var Link = /** @class */ (function (_super) {
21
21
  }
22
22
  if (!e.defaultPrevented) {
23
23
  e.preventDefault();
24
- if (this.props.to) {
24
+ if (this.props.to !== undefined) {
25
25
  Misc.Globals.appService.get(AppServices.NeoTypes.Routing.NavigationHelper).navigateInternal(this.props.to);
26
26
  }
27
27
  }
@@ -29,7 +29,7 @@ var Link = /** @class */ (function (_super) {
29
29
  Link.prototype.render = function () {
30
30
  var _a = this.props, to = _a.to, href = _a.href, isNav = _a.isNav, exact = _a.exact, rest = __rest(_a, ["to", "href", "isNav", "exact"]);
31
31
  href !== null && href !== void 0 ? href : (href = "/");
32
- if (to) {
32
+ if (to !== undefined) {
33
33
  if (to.startsWith("/") && !to.startsWith(this.basePath)) {
34
34
  to = this.basePath + to;
35
35
  }
@@ -145,6 +145,7 @@ export declare class BindPropsHelper {
145
145
  };
146
146
  static normaliseContainerProps<T, TContainerDom = React.HTMLProps<T>, TData = any>(component: IComponentBase, props: IEditorContainerProps<T, TData>, inGroup: boolean, isBootstrap?: boolean): IEditorContainerNormalisedProps<TContainerDom, TData>;
147
147
  static normaliseEditorProps<T, TDom = React.HTMLProps<T>>(component: IComponentBase, props: (IEditorAndSelectorProps<T, any> & TDom) | IEditorNormalisedProps<TDom, any>): IEditorNormalisedProps<TDom, any>;
148
+ static getUniqueId(bindProperty: Model.IPropertyInstance, component: IComponentBase): string;
148
149
  static getPlaceholderText(placeholder: string | boolean | undefined, property: PropertyInfo): string | undefined;
149
150
  static autoSetDomProperties<TDom extends React.HTMLProps<HTMLElement>>(props: IEditorNormalisedProps<TDom, any>, formContext: FormContextParams, componentBlurFn?: (e: React.FocusEvent<HTMLElement>) => void, componentFocusFn?: (e: React.FocusEvent<HTMLElement>) => void): TDom;
150
151
  static isReadOnly(editorProps: ICommonEditorProps, formContext: FormContextParams): boolean;
@@ -179,7 +179,7 @@ var BindPropsHelper = /** @class */ (function () {
179
179
  fileProps: fileProps,
180
180
  radioList: radioList,
181
181
  inGroup: inGroup,
182
- uniqueID: (bindOrDisplay === null || bindOrDisplay === void 0 ? void 0 : bindOrDisplay.uniqueID) + "!" + component.uniqueId,
182
+ uniqueID: this.getUniqueId(bindOrDisplay, component),
183
183
  containerDom: containerDom,
184
184
  isBootstrap: isBootstrap
185
185
  };
@@ -193,6 +193,9 @@ var BindPropsHelper = /** @class */ (function () {
193
193
  }
194
194
  return nProps;
195
195
  };
196
+ BindPropsHelper.getUniqueId = function (bindProperty, component) {
197
+ return (bindProperty === null || bindProperty === void 0 ? void 0 : bindProperty.uniqueID) + "!" + component.uniqueId;
198
+ };
196
199
  BindPropsHelper.getPlaceholderText = function (placeholder, property) {
197
200
  if (placeholder === true) {
198
201
  return property.readableName;
@@ -22,6 +22,10 @@ var NavigationHelper = /** @class */ (function () {
22
22
  case 0:
23
23
  basePath = this.routingState.basePath;
24
24
  prevUrl = this.prevUrls.length === 0 ? undefined : this.prevUrls[this.prevUrls.length - 1];
25
+ // Special case for when the root url has parameters. E.g. instead of /home/dashboard it will be //dashboard.
26
+ while (url.startsWith("//")) {
27
+ url = url.substring(1);
28
+ }
25
29
  path = url;
26
30
  if (basePath) {
27
31
  if (path.startsWith(basePath)) {
@@ -73,7 +77,7 @@ var NavigationHelper = /** @class */ (function () {
73
77
  };
74
78
  NavigationHelper.prototype.getPathForView = function (view, paramValues) {
75
79
  var basePath = this.routingState.appRouteProvider.getPathForComponent(view);
76
- if (basePath) {
80
+ if (basePath !== undefined) {
77
81
  if (paramValues) {
78
82
  return ViewParameterList.getPathForValues(basePath, view.params, paramValues);
79
83
  }
@@ -58,6 +58,10 @@ var RouteProvider = /** @class */ (function () {
58
58
  for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) {
59
59
  var match = matches_1[_i];
60
60
  var paramString = path.substring(match.path.length);
61
+ // Special case for root path which has its leading "/" removed by the navigation helper.
62
+ if (match.path === "/") {
63
+ paramString = "/" + paramString;
64
+ }
61
65
  var parts = paramString.split("/").slice(1);
62
66
  var partCount = parts.length;
63
67
  // Allow extra "/"
@@ -87,7 +91,7 @@ var RouteProvider = /** @class */ (function () {
87
91
  var _a, _b;
88
92
  for (var _i = 0, routes_1 = routes; _i < routes_1.length; _i++) {
89
93
  var route = routes_1[_i];
90
- var hasComponent = route.path && route.component;
94
+ var hasComponent = route.path !== undefined && route.component;
91
95
  if (hasComponent) {
92
96
  if (parent && !route.breadCrumbParent) {
93
97
  route.breadCrumbParent = parent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-react",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
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",