tryton-sao 6.0.72 → 6.0.73

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.
package/CHANGELOG CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ Version 6.0.73 - 2026-02-18
3
+ ---------------------------
4
+ * Bug fixes (see mercurial logs for details)
5
+
6
+
2
7
  Version 6.0.72 - 2026-02-01
3
8
  ---------------------------
4
9
  * Bug fixes (see mercurial logs for details)
@@ -3039,16 +3039,59 @@ var Sao = {};
3039
3039
  };
3040
3040
 
3041
3041
  Sao.common.scrollIntoViewIfNeeded = function(element) {
3042
- element = element[0];
3043
- if (element) {
3044
- var rect = element.getBoundingClientRect();
3045
- if (rect.bottom > window.innerHeight) {
3046
- element.scrollIntoView(false);
3042
+ function isScrollable(el) {
3043
+ let style = getComputedStyle(el);
3044
+ return /(auto|scroll|overlay)/.test(
3045
+ style.overflow + style.overflowY + style.overflowX
3046
+ );
3047
+ }
3048
+
3049
+ function getScrollableAncestors(el) {
3050
+ let ancestors = [];
3051
+ let parent = el.parentElement;
3052
+ while (parent && parent !== document.body) {
3053
+ if (isScrollable(parent)) {
3054
+ ancestors.push(parent);
3055
+ }
3056
+ parent = parent.parentElement;
3047
3057
  }
3048
- if (rect.top < 0) {
3049
- element.scrollIntoView();
3058
+ ancestors.push(window);
3059
+ return ancestors;
3060
+ }
3061
+
3062
+ function scrollIntoViewWithin(el, container) {
3063
+ let rect = el.getBoundingClientRect();
3064
+
3065
+ if (container === window) {
3066
+ if (rect.top < 0 || rect.bottom > window.innerHeight) {
3067
+ el.scrollIntoView({
3068
+ block: 'center',
3069
+ });
3070
+ }
3071
+ } else {
3072
+ let container_rect = container.getBoundingClientRect();
3073
+ let top_ = rect.top - container_rect.top;
3074
+ let bottom = top_ + rect.height;
3075
+
3076
+ let target_top = container.scrollTop;
3077
+
3078
+ if (top_ < 0) {
3079
+ target_top += top_ - container.clientHeight / 2;
3080
+ } else if (bottom > container.clientHeight) {
3081
+ target_top += bottom - container.clientHeight / 2
3082
+ }
3083
+ container.scrollTo({
3084
+ top: Math.max(0, target_top),
3085
+ });
3050
3086
  }
3051
3087
  }
3088
+
3089
+ element.each(function() {
3090
+ let ancestors = getScrollableAncestors(this);
3091
+ for (let ancestor of ancestors) {
3092
+ scrollIntoViewWithin(this, ancestor);
3093
+ }
3094
+ });
3052
3095
  };
3053
3096
 
3054
3097
  // Handle click and Return press event
@@ -9678,11 +9721,6 @@ var Sao = {};
9678
9721
  }
9679
9722
  return result;
9680
9723
  },
9681
- get_removed_ids: function(record) {
9682
- return record._values[this.name].record_removed.map(function(r) {
9683
- return r.id;
9684
- });
9685
- },
9686
9724
  get_domain: function(record) {
9687
9725
  var domains = this.get_domains(record);
9688
9726
  var attr_domain = domains[1];
@@ -17513,8 +17551,6 @@ function eval_pyson(value){
17513
17551
  var context = this.field.get_search_context(this.record);
17514
17552
  domain = [domain,
17515
17553
  this.record.expr_eval(this.attributes.add_remove)];
17516
- var removed_ids = this.field.get_removed_ids(this.record);
17517
- domain = ['OR', domain, ['id', 'in', removed_ids]];
17518
17554
  var text = this.wid_text.val();
17519
17555
 
17520
17556
  var sequence = this._sequence();
@@ -17767,8 +17803,6 @@ function eval_pyson(value){
17767
17803
  var domain = this.field.get_domain(this.record);
17768
17804
  domain = [domain,
17769
17805
  this.record.expr_eval(this.attributes.add_remove)];
17770
- var removed_ids = this.field.get_removed_ids(this.record);
17771
- domain = ['OR', domain, ['id', 'in', removed_ids]];
17772
17806
  return Sao.common.update_completion(
17773
17807
  this.wid_text, this.record, this.field, model, domain);
17774
17808
  },