Browse Source

feature:优化布局

es6
guy 2 years ago
parent
commit
129819b22e
  1. 51
      src/widget/timeinterval/dateinterval.js
  2. 51
      src/widget/timeinterval/timeinterval.js
  3. 73
      src/widget/timeinterval/timeperiods.js
  4. 46
      src/widget/yearinterval/yearinterval.js
  5. 52
      src/widget/yearmonthinterval/yearmonthinterval.js
  6. 47
      src/widget/yearquarterinterval/yearquarterinterval.js
  7. 1
      template/index.html

51
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({
type: "bi.label",
height: o.height,
width: this.constants.width,
text: "-"
});
BI.createWidget({
element: self,
type: "bi.center",
height: o.height,
return {
type: "bi.horizontal_fill",
columnSize: ["fill", "", "fill"],
items: [{
type: "bi.absolute",
items: [{
el: self.left,
left: this.constants.offset,
right: this.constants.width / 2,
top: 0,
bottom: 0
}]
el: self.left
}, {
type: "bi.absolute",
items: [{
el: self.right,
left: this.constants.width / 2,
right: this.constants.offset,
top: 0,
bottom: 0
}]
el: {
type: "bi.label",
height: o.height,
hgap: 5,
text: "-",
ref: function (_ref) {
self.label = _ref;
}
}
}, {
el: self.right
}]
});
BI.createWidget({
type: "bi.horizontal_auto",
element: this,
items: [
self.label
]
});
};
},
_createCombo: function (v, watermark) {

51
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({
type: "bi.label",
height: o.height,
width: this.constants.width,
text: "-"
});
BI.createWidget({
element: self,
type: "bi.center",
height: o.height,
return {
type: "bi.horizontal_fill",
columnSize: ["fill", "", "fill"],
items: [{
type: "bi.absolute",
items: [{
el: self.left,
left: this.constants.offset,
right: this.constants.width / 2,
top: 0,
bottom: 0
}]
el: self.left
}, {
type: "bi.absolute",
items: [{
el: self.right,
left: this.constants.width / 2,
right: this.constants.offset,
top: 0,
bottom: 0
}]
el: {
type: "bi.label",
height: o.height,
hgap: 5,
text: "-",
ref: function (_ref) {
self.label = _ref;
}
}
}, {
el: self.right
}]
});
BI.createWidget({
type: "bi.horizontal_auto",
element: this,
items: [
self.label
]
});
};
},
_createCombo: function (v, watermark) {

73
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: {
type: "bi.horizontal_auto",
items: [{
type: "bi.label",
height: o.height,
width: this.constants.width,
text: "-",
ref: function (_ref) {
self.label = _ref;
}
}]
},
top: 0,
left: 0,
right: 0,
bottom: 0
el: BI.extend({
ref: function (_ref) {
self.left = _ref;
}
}, this._createCombo(o.value.start, o.watermark?.start))
}, {
el: {
type: "bi.center",
type: "bi.label",
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
hgap: 5,
text: "-",
ref: function (_ref) {
self.label = _ref;
}
}
}, {
el: BI.extend({
ref: function (_ref) {
self.right = _ref;
}
}, this._createCombo(o.value.end, o.watermark?.end))
}]
};
},

46
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,
return {
type: "bi.horizontal_fill",
columnSize: ["fill", "", "fill"],
items: [{
type: "bi.absolute",
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: [{
type: "bi.label",
height: o.height,
width: this.constants.width,
text: "-",
ref: function (_ref) {
self.label = _ref;
el: {
type: "bi.label",
height: o.height,
hgap: 5,
text: "-",
ref: function (_ref) {
self.label = _ref;
}
}
}, {
el: self.right
}]
}]
};
},
_createCombo: function (v, watermark) {

52
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({
type: "bi.label",
height: o.height,
width: this.constants.width,
text: "-"
});
BI.createWidget({
element: self,
type: "bi.center",
hgap: 15,
height: o.height,
return {
type: "bi.horizontal_fill",
columnSize: ["fill", "", "fill"],
items: [{
type: "bi.absolute",
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
}]
el: {
type: "bi.label",
height: o.height,
hgap: 5,
text: "-",
ref: function (_ref) {
self.label = _ref;
}
}
}, {
el: self.right
}]
});
BI.createWidget({
type: "bi.horizontal_auto",
element: this,
items: [
self.label
]
});
};
},
_createCombo: function (v, watermark) {

47
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,
return {
type: "bi.horizontal_fill",
columnSize: ["fill", "", "fill"],
items: [{
type: "bi.absolute",
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: [{
type: "bi.label",
height: o.height,
width: this.constants.width,
text: "-",
ref: function (_ref) {
self.label = _ref;
el: {
type: "bi.label",
height: o.height,
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