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

49
src/widget/timeinterval/timeinterval.js

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

53
src/widget/timeinterval/timeperiods.js

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

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

50
src/widget/yearmonthinterval/yearmonthinterval.js

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

1
template/index.html

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

Loading…
Cancel
Save