@michalrakus/x-react-web-lib 1.26.0 → 1.27.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.
@@ -26,6 +26,7 @@ export interface XAutoCompleteBaseProps {
26
26
  searchBrowse?: JSX.Element;
27
27
  valueForm?: JSX.Element;
28
28
  idField?: string;
29
+ addRowEnabled: boolean;
29
30
  onAddRow?: (inputValue: string) => void;
30
31
  insertButtonTooltip?: string;
31
32
  updateButtonTooltip?: string;
@@ -33,6 +34,7 @@ export interface XAutoCompleteBaseProps {
33
34
  minLength?: number;
34
35
  buttonsLayout: "splitButton" | "buttons";
35
36
  width?: string;
37
+ maxWidth?: string;
36
38
  scrollHeight?: string;
37
39
  inputClassName?: string;
38
40
  readOnly?: boolean;
@@ -45,6 +47,7 @@ export declare class XAutoCompleteBase extends Component<XAutoCompleteBaseProps>
45
47
  static defaultProps: {
46
48
  lazyLoadMaxRows: number;
47
49
  splitQueryValue: boolean;
50
+ addRowEnabled: boolean;
48
51
  minLength: number;
49
52
  buttonsLayout: string;
50
53
  scrollHeight: string;
@@ -674,16 +674,17 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
674
674
  var readOnly = (_a = this.props.readOnly) !== null && _a !== void 0 ? _a : false;
675
675
  var buttons;
676
676
  if (!readOnly) {
677
- if (this.props.searchBrowse || this.props.valueForm || this.props.onAddRow) {
677
+ var createInsertItem = (this.props.addRowEnabled && (this.props.valueForm !== undefined || this.props.onAddRow !== undefined));
678
+ if (createInsertItem || this.props.valueForm || this.props.searchBrowse) {
678
679
  // mame searchBrowse alebo CRUD operacie, potrebujeme viac buttonov alebo SplitButton
679
680
  var buttonItems = [];
680
- if (this.props.valueForm || this.props.onAddRow) {
681
+ if (createInsertItem) {
681
682
  this.createInsertItem(buttonItems);
682
683
  }
683
684
  if (this.props.valueForm) {
684
685
  this.createUpdateItem(buttonItems);
685
686
  }
686
- if (this.props.searchBrowse && !readOnly) {
687
+ if (this.props.searchBrowse) {
687
688
  this.createSearchItem(buttonItems);
688
689
  }
689
690
  this.createDropdownItem(buttonItems);
@@ -726,7 +727,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
726
727
  // Dialog pre konkretny form:
727
728
  // <DobrovolnikForm id={this.formDialogObjectId} object={this.formDialogInitValuesForInsert} onSaveOrCancel={this.formDialogOnSaveOrCancel}/>
728
729
  // formgroup-inline lepi SplitButton na autocomplete a zarovna jeho vysku
729
- return (react_1.default.createElement("div", { className: "x-auto-complete-base", style: { width: this.props.width } },
730
+ return (react_1.default.createElement("div", { className: "x-auto-complete-base", style: { width: this.props.width, maxWidth: this.props.maxWidth } },
730
731
  react_1.default.createElement(autocomplete_1.AutoComplete, __assign({ value: inputValue, suggestions: this.state.filteredSuggestions, completeMethod: this.completeMethod, itemTemplate: this.itemTemplate, onChange: this.onChange, onSelect: this.onSelect, onBlur: this.onBlur, minLength: this.props.minLength, scrollHeight: this.props.scrollHeight, ref: this.autoCompleteRef, readOnly: readOnly, disabled: readOnly }, XUtils_1.XUtils.createTooltipOrErrorProps(error), { inputClassName: this.props.inputClassName, showEmptyMessage: true })),
731
732
  buttons,
732
733
  this.props.valueForm != undefined ?
@@ -742,6 +743,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
742
743
  XAutoCompleteBase.defaultProps = {
743
744
  lazyLoadMaxRows: 10,
744
745
  splitQueryValue: true,
746
+ addRowEnabled: true,
745
747
  minLength: 1,
746
748
  buttonsLayout: "buttons",
747
749
  scrollHeight: '15rem' // primereact has 200px
@@ -5,6 +5,7 @@ export declare const XFormHeader: {
5
5
  form?: XFormBase;
6
6
  label: string;
7
7
  appendNewRow: boolean;
8
+ style?: React.CSSProperties;
8
9
  }): React.JSX.Element;
9
10
  defaultProps: {
10
11
  appendNewRow: boolean;
@@ -8,7 +8,7 @@ var react_1 = __importDefault(require("react"));
8
8
  var XLocale_1 = require("./XLocale");
9
9
  var XFormHeader = function (props) {
10
10
  var _a;
11
- return (react_1.default.createElement("div", { className: "x-form-header" }, props.label + (props.appendNewRow && ((_a = props.form) === null || _a === void 0 ? void 0 : _a.isAddRow()) ? " - " + (0, XLocale_1.xLocaleOption)('newRow') : "")));
11
+ return (react_1.default.createElement("div", { className: "x-form-header", style: props.style }, props.label + (props.appendNewRow && ((_a = props.form) === null || _a === void 0 ? void 0 : _a.isAddRow()) ? " - " + (0, XLocale_1.xLocaleOption)('newRow') : "")));
12
12
  };
13
13
  exports.XFormHeader = XFormHeader;
14
14
  exports.XFormHeader.defaultProps = {
@@ -15,9 +15,9 @@ export declare enum OperationType {
15
15
  Remove = 3
16
16
  }
17
17
  export declare enum XViewStatus {
18
- ReadWrite = 0,
19
- ReadOnly = 1,
20
- Hidden = 2
18
+ ReadWrite = "readWrite",
19
+ ReadOnly = "readOnly",
20
+ Hidden = "hidden"
21
21
  }
22
22
  export type XViewStatusOrBoolean = XViewStatus | boolean;
23
23
  export interface IPostgresInterval {
@@ -99,9 +99,9 @@ var OperationType;
99
99
  })(OperationType = exports.OperationType || (exports.OperationType = {}));
100
100
  var XViewStatus;
101
101
  (function (XViewStatus) {
102
- XViewStatus[XViewStatus["ReadWrite"] = 0] = "ReadWrite";
103
- XViewStatus[XViewStatus["ReadOnly"] = 1] = "ReadOnly";
104
- XViewStatus[XViewStatus["Hidden"] = 2] = "Hidden";
102
+ XViewStatus["ReadWrite"] = "readWrite";
103
+ XViewStatus["ReadOnly"] = "readOnly";
104
+ XViewStatus["Hidden"] = "hidden";
105
105
  })(XViewStatus = exports.XViewStatus || (exports.XViewStatus = {}));
106
106
  var XUtils = /** @class */ (function () {
107
107
  function XUtils() {
@@ -652,8 +652,12 @@ var XUtils = /** @class */ (function () {
652
652
  XUtils.showErrorMessage = function (message, e) {
653
653
  var msg = message + XUtilsCommon_1.XUtilsCommon.newLine;
654
654
  if (e instanceof XResponseError_1.XResponseError) {
655
- // better error message for optimistic locking
656
- if (e.xResponseErrorBody.exceptionName === 'OptimisticLockVersionMismatchError') {
655
+ if (e.xResponseErrorBody.exceptionName === 'XAppError') {
656
+ // app error from backend, we show only the error message
657
+ msg += e.xResponseErrorBody.message;
658
+ }
659
+ else if (e.xResponseErrorBody.exceptionName === 'OptimisticLockVersionMismatchError') {
660
+ // better error message for optimistic locking
657
661
  msg += "The optimistic lock failed, someone else has changed the row during the editation. Sorry, you have to cancel the editation and start the editation again.";
658
662
  }
659
663
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michalrakus/x-react-web-lib",
3
- "version": "1.26.0",
3
+ "version": "1.27.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "clean": "rimraf lib",
@@ -40,7 +40,7 @@
40
40
  "peerDependencies": {
41
41
  "primeflex": "^3.3.1",
42
42
  "primeicons": "^7.0.0",
43
- "primereact": "~10.6.5",
43
+ "primereact": "~10.4.0",
44
44
  "quill": "^1.3.7",
45
45
  "react": "^18.2.0",
46
46
  "react-dom": "^18.2.0",