mirror of
https://github.com/keeweb/keeweb.git
synced 2024-06-26 07:39:04 +02:00
picker
This commit is contained in:
parent
7f20e6cc46
commit
56fbc14893
|
@ -14,9 +14,10 @@ const FieldViewAutocomplete = FieldViewText.extend({
|
||||||
startEdit() {
|
startEdit() {
|
||||||
FieldViewText.prototype.startEdit.call(this);
|
FieldViewText.prototype.startEdit.call(this);
|
||||||
const fieldRect = this.input[0].getBoundingClientRect();
|
const fieldRect = this.input[0].getBoundingClientRect();
|
||||||
|
const shadowSpread = parseInt(this.input.css('--focus-shadow-spread'));
|
||||||
this.autocomplete = $('<div class="details__field-autocomplete"></div>').appendTo('body');
|
this.autocomplete = $('<div class="details__field-autocomplete"></div>').appendTo('body');
|
||||||
this.autocomplete.css({
|
this.autocomplete.css({
|
||||||
top: fieldRect.bottom,
|
top: fieldRect.bottom + shadowSpread,
|
||||||
left: fieldRect.left,
|
left: fieldRect.left,
|
||||||
width: fieldRect.width - 2
|
width: fieldRect.width - 2
|
||||||
});
|
});
|
||||||
|
|
|
@ -33,9 +33,22 @@ const FieldViewDate = FieldViewText.extend({
|
||||||
weekdaysShort: Locale.weekdaysShort
|
weekdaysShort: Locale.weekdaysShort
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.picker.adjustPosition = this.adjustPickerPosition.bind(this);
|
||||||
_.defer(this.picker.show.bind(this.picker));
|
_.defer(this.picker.show.bind(this.picker));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
adjustPickerPosition(...args) {
|
||||||
|
window.Pikaday = Pikaday;
|
||||||
|
Pikaday.prototype.adjustPosition.apply(this.picker, args);
|
||||||
|
const shadowSpread = parseInt(this.input.css('--focus-shadow-spread'));
|
||||||
|
if (shadowSpread) {
|
||||||
|
const isOnTop = this.picker.el.classList.contains('top-aligned');
|
||||||
|
const offset = isOnTop ? -shadowSpread : shadowSpread;
|
||||||
|
const newTop = parseInt(this.picker.el.style.top) + offset;
|
||||||
|
this.picker.el.style.top = `${newTop}px`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
fieldValueBlur(e) {
|
fieldValueBlur(e) {
|
||||||
if (!this.picker) {
|
if (!this.picker) {
|
||||||
FieldViewText.prototype.fieldValueBlur.call(this, e);
|
FieldViewText.prototype.fieldValueBlur.call(this, e);
|
||||||
|
|
|
@ -38,11 +38,12 @@ const FieldViewTags = FieldViewText.extend({
|
||||||
startEdit() {
|
startEdit() {
|
||||||
FieldViewText.prototype.startEdit.call(this);
|
FieldViewText.prototype.startEdit.call(this);
|
||||||
const fieldRect = this.input[0].getBoundingClientRect();
|
const fieldRect = this.input[0].getBoundingClientRect();
|
||||||
|
const shadowSpread = parseInt(this.input.css('--focus-shadow-spread'));
|
||||||
this.tagsAutocomplete = $('<div class="details__field-autocomplete"></div>').appendTo(
|
this.tagsAutocomplete = $('<div class="details__field-autocomplete"></div>').appendTo(
|
||||||
'body'
|
'body'
|
||||||
);
|
);
|
||||||
this.tagsAutocomplete.css({
|
this.tagsAutocomplete.css({
|
||||||
top: fieldRect.bottom,
|
top: fieldRect.bottom + shadowSpread,
|
||||||
left: fieldRect.left,
|
left: fieldRect.left,
|
||||||
width: fieldRect.width - 2
|
width: fieldRect.width - 2
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user