@michalrakus/x-react-web-lib 1.32.12 → 1.34.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.
|
@@ -91,7 +91,7 @@ var XUserForm = /** @class */ (function (_super) {
|
|
|
91
91
|
};
|
|
92
92
|
XUserForm.prototype.preInitForm = function (object, operationType) {
|
|
93
93
|
// aktualny user si nemoze zmenit username, enabled a admin status
|
|
94
|
-
var username =
|
|
94
|
+
var username = object.username;
|
|
95
95
|
if (operationType === XUtils_1.OperationType.Update && (username === XUtils_1.XUtils.getUsername() || (XUtils_1.XUtils.demo() && (username === 'xman')))) {
|
|
96
96
|
this.setState({ usernameEnabledReadOnly: true });
|
|
97
97
|
}
|
|
@@ -53,6 +53,7 @@ export declare class XAutoCompleteBase extends Component<XAutoCompleteBaseProps>
|
|
|
53
53
|
scrollHeight: string;
|
|
54
54
|
};
|
|
55
55
|
autoCompleteRef: any;
|
|
56
|
+
autoCompleteInputRef: any;
|
|
56
57
|
state: {
|
|
57
58
|
inputChanged: boolean;
|
|
58
59
|
inputValueState: string | undefined;
|
|
@@ -83,6 +84,7 @@ export declare class XAutoCompleteBase extends Component<XAutoCompleteBaseProps>
|
|
|
83
84
|
onBlur(e: React.FocusEvent<HTMLInputElement>): void;
|
|
84
85
|
createErrorMessage(): string;
|
|
85
86
|
setFocusToInput(): void;
|
|
87
|
+
removeFocusFromInput(): void;
|
|
86
88
|
setObjectValue(object: any, objectChange: OperationType): void;
|
|
87
89
|
formDialogOnSaveOrCancel(object: any | null, objectChange: OperationType): void;
|
|
88
90
|
formDialogOnHide(): void;
|
|
@@ -135,6 +135,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
135
135
|
function XAutoCompleteBase(props) {
|
|
136
136
|
var _this = _super.call(this, props) || this;
|
|
137
137
|
_this.autoCompleteRef = react_1.default.createRef();
|
|
138
|
+
_this.autoCompleteInputRef = react_1.default.createRef();
|
|
138
139
|
_this.state = {
|
|
139
140
|
inputChanged: false,
|
|
140
141
|
inputValueState: undefined,
|
|
@@ -368,11 +369,19 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
368
369
|
}
|
|
369
370
|
};
|
|
370
371
|
XAutoCompleteBase.prototype.onSelect = function (e) {
|
|
372
|
+
var _this = this;
|
|
371
373
|
// nevolame this.setObjectValue ak uz bol zavolany z onBlur
|
|
372
374
|
if (!this.wasOnChangeCalled) {
|
|
373
375
|
// nedovolime vybrat specialny zaznam ...
|
|
374
376
|
if (!XAutoCompleteBase.isMoreSuggestions(e.value)) {
|
|
375
377
|
this.setObjectValue(e.value, XUtils_1.OperationType.None);
|
|
378
|
+
// ak sme na mobile, nechceme aby sa otvorila klavesnica mobilu, preto zavolame removeFocus
|
|
379
|
+
// pouzivame setTimeout, priame volanie nefungovalo
|
|
380
|
+
if (XUtils_1.XUtils.isMobile()) {
|
|
381
|
+
setTimeout(function () {
|
|
382
|
+
_this.removeFocusFromInput();
|
|
383
|
+
}, 0); // Delaying blur to allow PrimeReact to finish its focus logic
|
|
384
|
+
}
|
|
376
385
|
}
|
|
377
386
|
}
|
|
378
387
|
};
|
|
@@ -454,7 +463,11 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
454
463
|
}
|
|
455
464
|
*/
|
|
456
465
|
XAutoCompleteBase.prototype.setFocusToInput = function () {
|
|
457
|
-
this.autoCompleteRef.current.focus();
|
|
466
|
+
//this.autoCompleteRef.current.focus(); bolo toto kedysi
|
|
467
|
+
this.autoCompleteInputRef.current.focus();
|
|
468
|
+
};
|
|
469
|
+
XAutoCompleteBase.prototype.removeFocusFromInput = function () {
|
|
470
|
+
this.autoCompleteInputRef.current.blur();
|
|
458
471
|
};
|
|
459
472
|
XAutoCompleteBase.prototype.setObjectValue = function (object, objectChange) {
|
|
460
473
|
this.setState({ inputChanged: false, notValid: false });
|
|
@@ -727,7 +740,7 @@ var XAutoCompleteBase = /** @class */ (function (_super) {
|
|
|
727
740
|
// Dialog pre konkretny form:
|
|
728
741
|
// <DobrovolnikForm id={this.formDialogObjectId} object={this.formDialogInitValuesForInsert} onSaveOrCancel={this.formDialogOnSaveOrCancel}/>
|
|
729
742
|
// formgroup-inline lepi SplitButton na autocomplete a zarovna jeho vysku
|
|
730
|
-
return (react_1.default.createElement.apply(react_1.default, __spreadArray(__spreadArray(["div", { className: "x-auto-complete-base", style: { width: this.props.width, maxWidth: this.props.maxWidth } }, 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 }))], __read(buttons), false), [this.props.valueForm != undefined ?
|
|
743
|
+
return (react_1.default.createElement.apply(react_1.default, __spreadArray(__spreadArray(["div", { className: "x-auto-complete-base", style: { width: this.props.width, maxWidth: this.props.maxWidth } }, 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, inputRef: this.autoCompleteInputRef, readOnly: readOnly, disabled: readOnly }, XUtils_1.XUtils.createTooltipOrErrorProps(error), { inputClassName: this.props.inputClassName, showEmptyMessage: true }))], __read(buttons), false), [this.props.valueForm != undefined ?
|
|
731
744
|
react_1.default.createElement(dialog_1.Dialog, { key: "dialog-form", className: "x-dialog-without-header", visible: this.state.formDialogOpened, onHide: this.formDialogOnHide }, react_1.default.cloneElement(this.props.valueForm, {
|
|
732
745
|
id: this.formDialogObjectId, initValues: this.formDialogInitValuesForInsert, onSaveOrCancel: this.formDialogOnSaveOrCancel
|
|
733
746
|
} /*, this.props.valueForm.children*/))
|
|
@@ -25,6 +25,6 @@ var XToOneAssocButton = function (props) {
|
|
|
25
25
|
};
|
|
26
26
|
return (react_1.default.createElement("div", { className: "field grid" },
|
|
27
27
|
react_1.default.createElement("label", { htmlFor: props.assocField, className: "col-fixed", style: { width: XUtils_1.XUtils.FIELD_LABEL_WIDTH } }, label),
|
|
28
|
-
react_1.default.createElement(button_1.Button, { label: label, onClick: onClickButton, disabled: assocObject === null })));
|
|
28
|
+
react_1.default.createElement(button_1.Button, { label: props.buttonLabel !== undefined ? props.buttonLabel : label, onClick: onClickButton, disabled: assocObject === null })));
|
|
29
29
|
};
|
|
30
30
|
exports.XToOneAssocButton = XToOneAssocButton;
|