Browse Source

feature:优化布局

es6
guy 2 years ago
parent
commit
129819b22e
  1. 49
      src/widget/timeinterval/dateinterval.js
  2. 49
      src/widget/timeinterval/timeinterval.js
  3. 53
      src/widget/timeinterval/timeperiods.js
  4. 36
      src/widget/yearinterval/yearinterval.js
  5. 50
      src/widget/yearmonthinterval/yearmonthinterval.js
  6. 37
      src/widget/yearquarterinterval/yearquarterinterval.js
  7. 1
      template/index.html

49
src/widget/timeinterval/dateinterval.js

@ -26,43 +26,26 @@ BI.DateInterval = BI.inherit(BI.Single, {
o.value = o.value || {};
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
this.label = BI.createWidget({
return {
type: "bi.horizontal_fill",
columnSize: ["fill", "", "fill"],
items: [{
el: self.left
}, {
el: {
type: "bi.label",
height: o.height,
width: this.constants.width,
text: "-"
});
BI.createWidget({
element: self,
type: "bi.center",
height: o.height,
items: [{
type: "bi.absolute",
items: [{
el: self.left,
left: this.constants.offset,
right: this.constants.width / 2,
top: 0,
bottom: 0
}]
hgap: 5,
text: "-",
ref: function (_ref) {
self.label = _ref;
}
}
}, {
type: "bi.absolute",
items: [{
el: self.right,
left: this.constants.width / 2,
right: this.constants.offset,
top: 0,
bottom: 0
el: self.right
}]
}]
});
BI.createWidget({
type: "bi.horizontal_auto",
element: this,
items: [
self.label
]
});
};
},
_createCombo: function (v, watermark) {

49
src/widget/timeinterval/timeinterval.js

@ -26,43 +26,26 @@ BI.TimeInterval = BI.inherit(BI.Single, {
o.value = o.value || {};
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
this.label = BI.createWidget({
return {
type: "bi.horizontal_fill",
columnSize: ["fill", "", "fill"],
items: [{
el: self.left
}, {
el: {
type: "bi.label",
height: o.height,
width: this.constants.width,
text: "-"
});
BI.createWidget({
element: self,
type: "bi.center",
height: o.height,
items: [{
type: "bi.absolute",
items: [{
el: self.left,
left: this.constants.offset,
right: this.constants.width / 2,
top: 0,
bottom: 0
}]
hgap: 5,
text: "-",
ref: function (_ref) {
self.label = _ref;
}
}
}, {
type: "bi.absolute",
items: [{
el: self.right,
left: this.constants.width / 2,
right: this.constants.offset,
top: 0,
bottom: 0
el: self.right
}]
}]
});
BI.createWidget({
type: "bi.horizontal_auto",
element: this,
items: [
self.label
]
});
};
},
_createCombo: function (v, watermark) {

53
src/widget/timeinterval/timeperiods.js

@ -19,63 +19,32 @@
render: function () {
var self = this, o = this.options;
return {
type: "bi.absolute",
height: o.height,
type: "bi.horizontal_fill",
columnSize: ["fill", "", "fill"],
items: [{
el: BI.extend({
ref: function (_ref) {
self.left = _ref;
}
}, this._createCombo(o.value.start, o.watermark?.start))
}, {
el: {
type: "bi.horizontal_auto",
items: [{
type: "bi.label",
height: o.height,
width: this.constants.width,
hgap: 5,
text: "-",
ref: function (_ref) {
self.label = _ref;
}
}]
},
top: 0,
left: 0,
right: 0,
bottom: 0
}, {
el: {
type: "bi.center",
height: o.height,
hgap: this.constants.hgap,
items: [{
type: "bi.absolute",
items: [{
el: BI.extend({
ref: function (_ref) {
self.left = _ref;
}
}, this._createCombo(o.value.start, o.watermark?.start)),
left: this.constants.offset,
right: 0,
top: 0,
bottom: 0,
}]
}, {
type: "bi.absolute",
items: [{
el: BI.extend({
ref: function (_ref) {
self.right = _ref;
}
}, this._createCombo(o.value.end, o.watermark?.end)),
left: 0,
right: this.constants.offset,
top: 0,
bottom: 0,
}]
}]
},
top: 0,
left: 0,
right: 0,
bottom: 0
}, this._createCombo(o.value.end, o.watermark?.end))
}]
};
},

36
src/widget/yearinterval/yearinterval.js

@ -26,41 +26,25 @@ BI.YearInterval = BI.inherit(BI.Single, {
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
return [{
type: "bi.center",
hgap: 15,
height: o.height,
items: [{
type: "bi.absolute",
return {
type: "bi.horizontal_fill",
columnSize: ["fill", "", "fill"],
items: [{
el: self.left,
left: this.constants.offset,
right: 0,
top: 0,
bottom: 0
}]
el: self.left
}, {
type: "bi.absolute",
items: [{
el: self.right,
left: 0,
right: this.constants.offset,
top: 0,
bottom: 0
}]
}]
}, {
type: "bi.horizontal_auto",
items: [{
el: {
type: "bi.label",
height: o.height,
width: this.constants.width,
hgap: 5,
text: "-",
ref: function (_ref) {
self.label = _ref;
}
}
}, {
el: self.right
}]
}]
};
},
_createCombo: function (v, watermark) {

50
src/widget/yearmonthinterval/yearmonthinterval.js

@ -21,44 +21,26 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
o.value = o.value || {};
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
this.label = BI.createWidget({
return {
type: "bi.horizontal_fill",
columnSize: ["fill", "", "fill"],
items: [{
el: self.left
}, {
el: {
type: "bi.label",
height: o.height,
width: this.constants.width,
text: "-"
});
BI.createWidget({
element: self,
type: "bi.center",
hgap: 15,
height: o.height,
items: [{
type: "bi.absolute",
items: [{
el: self.left,
left: this.constants.offset,
right: 0,
top: 0,
bottom: 0
}]
hgap: 5,
text: "-",
ref: function (_ref) {
self.label = _ref;
}
}
}, {
type: "bi.absolute",
items: [{
el: self.right,
left: 0,
right: this.constants.offset,
top: 0,
bottom: 0
el: self.right
}]
}]
});
BI.createWidget({
type: "bi.horizontal_auto",
element: this,
items: [
self.label
]
});
};
},
_createCombo: function (v, watermark) {

37
src/widget/yearquarterinterval/yearquarterinterval.js

@ -26,41 +26,26 @@ BI.YearQuarterInterval = BI.inherit(BI.Single, {
this.left = this._createCombo(o.value.start, o.watermark?.start);
this.right = this._createCombo(o.value.end, o.watermark?.end);
return [{
type: "bi.center",
hgap: 15,
height: o.height,
items: [{
type: "bi.absolute",
items: [{
el: self.left,
left: this.constants.offset,
right: 0,
top: 0,
bottom: 0
}]
}, {
type: "bi.absolute",
return {
type: "bi.horizontal_fill",
columnSize: ["fill", "", "fill"],
items: [{
el: self.right,
left: 0,
right: this.constants.offset,
top: 0,
bottom: 0
}]
}]
el: self.left
}, {
type: "bi.horizontal_auto",
items: [{
el: {
type: "bi.label",
height: o.height,
width: this.constants.width,
hgap: 5,
text: "-",
ref: function (_ref) {
self.label = _ref;
}
}
}, {
el: self.right
}]
}]
};
},
_createCombo: function (v, watermark) {

1
template/index.html

@ -1,4 +1,3 @@
<!DOCTYPE html>
<html lang="en">
<head>

Loading…
Cancel
Save