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

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

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

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

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