Browse Source

Merge branch 'master' of ssh://code.fineres.com:7999/~dailer/fineui

es6
dailer 3 years ago
parent
commit
92ec904e32
  1. 2
      package.json
  2. 4
      src/base/combination/group.virtual.js
  3. 2
      src/base/layer/layer.popover.js
  4. 11
      src/case/ztree/0.treeview.js
  5. 26
      src/component/form/form.field.js
  6. 4
      src/component/form/form.js
  7. 32
      src/core/wrapper/layout.js
  8. 2
      src/widget/singleslider/singleslider.js

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20220217230329", "version": "2.0.20220222143230",
"description": "fineui", "description": "fineui",
"main": "dist/fineui.min.js", "main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",

4
src/base/combination/group.virtual.js

@ -109,7 +109,9 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
if (!this.layouts) { if (!this.layouts) {
this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items))); this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items)));
} else { } else {
this.layouts.populate(items); this.layouts.populate(items, {
context: this
});
} }
} }
}); });

2
src/base/layer/layer.popover.js

@ -75,6 +75,8 @@ BI.Popover = BI.inherit(BI.Widget, {
title: o.header, title: o.header,
textAlign: "left" textAlign: "left"
}, },
top: 0,
bottom: 0,
left: BI.SIZE_CONSANTS.H_GAP_SIZE, left: BI.SIZE_CONSANTS.H_GAP_SIZE,
right: o.closable ? 0 : BI.SIZE_CONSANTS.H_GAP_SIZE right: o.closable ? 0 : BI.SIZE_CONSANTS.H_GAP_SIZE
}] }]

11
src/case/ztree/0.treeview.js

@ -357,15 +357,20 @@ BI.TreeView = BI.inherit(BI.Pane, {
if (BI.isNull(n.title)) { if (BI.isNull(n.title)) {
n.title = n.text; n.title = n.text;
} }
if (n.disabled) {
n.title = n.warningTitle || n.title;
}
var text = BI.createWidget(BI.extend({ var text = BI.createWidget(BI.extend({
type: "bi.text",
cls: "tree-node-text", cls: "tree-node-text",
css: { css: {
display: "inline" display: "inline"
}, },
whiteSpace: "nowrap", whiteSpace: "nowrap",
root: true root: true,
}, n)); keyword: o.paras.keyword
}, n, {
type: "bi.text"
}));
var fragment = BI.Widget._renderEngine.createElement("<div>"); var fragment = BI.Widget._renderEngine.createElement("<div>");
fragment.append(text.element[0]); fragment.append(text.element[0]);
n.text = fragment.html(); n.text = fragment.html();

26
src/component/form/form.field.js

@ -3,13 +3,16 @@
* @version 2.0 * @version 2.0
* Created by windy on 2022/1/11 * Created by windy on 2022/1/11
*/ */
BI.FormField = BI.inherit(BI.Widget, { BI.FormField = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-form-field", baseCls: "bi-form-field",
label: "", label: "",
el: {}, el: {},
validate: BI.emptyFn labelAlign: "right", // 文字默认右对齐
validate: function () {
return true;
} // 默认返回true
}, },
render: function () { render: function () {
@ -24,7 +27,7 @@ BI.FormField = BI.inherit(BI.Widget, {
o.el.ref && o.el.ref.call(this, _ref); o.el.ref && o.el.ref.call(this, _ref);
}, },
height: o.el.height || 28, height: o.el.height || 28,
listeners: [{ listeners: BI.concat(o.el.listeners, [{
eventName: "EVENT_CHANGE", eventName: "EVENT_CHANGE",
action: function () { action: function () {
self.fireEvent("EVENT_CHANGE"); self.fireEvent("EVENT_CHANGE");
@ -32,9 +35,9 @@ BI.FormField = BI.inherit(BI.Widget, {
}, { }, {
eventName: "EVENT_CONFIRM", eventName: "EVENT_CONFIRM",
action: function () { action: function () {
self.fireEvent("EVENT_CHANGE"); self.fireEvent("EVENT_CONFIRM");
} }
}] }])
}), }),
left: 0, left: 0,
bottom: 0, bottom: 0,
@ -60,11 +63,14 @@ BI.FormField = BI.inherit(BI.Widget, {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
columnSize: ["auto", "fill"], columnSize: ["auto", "fill"],
verticalAlign: BI.VerticalAlign.Stretch, verticalAlign: BI.VerticalAlign.Stretch,
hgap: 5,
items: BI.isKey(o.label) ? [{ items: BI.isKey(o.label) ? [{
type: "bi.label", el: {
text: o.label + ":", type: "bi.label",
width: o.labelWidth textAlign: o.labelAlign,
text: o.label,
width: o.labelWidth,
rgap: 20 // 表单文字与右侧输入间距均为20px
}
}, field] : [field] }, field] : [field]
}; };
}, },
@ -77,7 +83,7 @@ BI.FormField = BI.inherit(BI.Widget, {
var isValid = this.validateWithNoTip(); var isValid = this.validateWithNoTip();
!isValid && this.error.setText(this.options.tip(this.field.getValue(), this.field)); !isValid && this.error.setText(this.options.tip(this.field.getValue(), this.field));
this.error.setVisible(!isValid); this.error.setVisible(!isValid);
this.element[isValid ? "removeClass" : "addClass"]("error"); this.field.element[isValid ? "removeClass" : "addClass"]("bi-error");
return isValid; return isValid;
}, },

4
src/component/form/form.js

@ -3,10 +3,11 @@
* @version 2.0 * @version 2.0
* Created by windy on 2022/1/11 * Created by windy on 2022/1/11
*/ */
BI.Form = BI.inherit(BI.Widget, { BI.Form = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-form", baseCls: "bi-form",
labelAlign: "right",
layout: { layout: {
type: "bi.vertical", type: "bi.vertical",
vgap: 20 vgap: 20
@ -40,6 +41,7 @@ BI.Form = BI.inherit(BI.Widget, {
return { return {
type: "bi.form_field", type: "bi.form_field",
height: item.el.height || 28, height: item.el.height || 28,
labelAlign: o.labelAlign,
labelWidth: o.labelWidth, labelWidth: o.labelWidth,
el: item.el, el: item.el,
label: item.label, label: item.label,

32
src/core/wrapper/layout.js

@ -492,7 +492,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
}, },
updateChildren: function (oldCh, newCh) { updateChildren: function (oldCh, newCh, context) {
var self = this; var self = this;
var oldStartIdx = 0, newStartIdx = 0; var oldStartIdx = 0, newStartIdx = 0;
var oldEndIdx = oldCh.length - 1; var oldEndIdx = oldCh.length - 1;
@ -546,7 +546,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} else { } else {
var sameOldVnode = findOldVnode(oldCh, newStartVnode, oldStartIdx, oldEndIdx); var sameOldVnode = findOldVnode(oldCh, newStartVnode, oldStartIdx, oldEndIdx);
if (BI.isNull(sameOldVnode[0])) { // 不存在就把新的放到左边 if (BI.isNull(sameOldVnode[0])) { // 不存在就把新的放到左边
var node = addNode(newStartVnode, newStartIdx); var node = addNode(newStartVnode, newStartIdx, context);
insertBefore(node, oldStartVnode); insertBefore(node, oldStartVnode);
} else { // 如果新节点在旧节点区间中存在就复用一下 } else { // 如果新节点在旧节点区间中存在就复用一下
var sameOldIndex = sameOldVnode[1]; var sameOldIndex = sameOldVnode[1];
@ -561,7 +561,7 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
if (oldStartIdx > oldEndIdx) { if (oldStartIdx > oldEndIdx) {
before = BI.isNull(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1]; before = BI.isNull(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1];
addVnodes(before, newCh, newStartIdx, newEndIdx); addVnodes(before, newCh, newStartIdx, newEndIdx, context);
} else if (newStartIdx > newEndIdx) { } else if (newStartIdx > newEndIdx) {
removeVnodes(oldCh, oldStartIdx, oldEndIdx); removeVnodes(oldCh, oldStartIdx, oldEndIdx);
} }
@ -586,15 +586,15 @@ BI.Layout = BI.inherit(BI.Widget, {
} }
} }
function addNode (vnode, index) { function addNode (vnode, index, context) {
var opt = self._getOptions(vnode); var opt = self._getOptions(vnode);
var key = opt.key == null ? index : opt.key; var key = opt.key == null ? index : opt.key;
return children[key] = self._newElement(index, vnode); return children[key] = self._newElement(index, vnode, context);
} }
function addVnodes (before, vnodes, startIdx, endIdx) { function addVnodes (before, vnodes, startIdx, endIdx, context) {
for (; startIdx <= endIdx; ++startIdx) { for (; startIdx <= endIdx; ++startIdx) {
var node = addNode(vnodes[startIdx], startIdx); var node = addNode(vnodes[startIdx], startIdx, context);
insertBefore(node, before, false, startIdx); insertBefore(node, before, false, startIdx);
} }
} }
@ -662,16 +662,18 @@ BI.Layout = BI.inherit(BI.Widget, {
update: function (opt) { update: function (opt) {
var o = this.options; var o = this.options;
var items = opt.items || []; var items = opt.items || [];
var context = opt.context;
var oldItems = o.items; var oldItems = o.items;
this.options.items = items; this.options.items = items;
return this.updateChildren(oldItems, items); return this.updateChildren(oldItems, items, context);
}, },
stroke: function (items) { stroke: function (items, options) {
options = options || {};
var self = this; var self = this;
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (item) { if (item) {
self._addElement(i, item); self._addElement(i, item, options.context);
} }
}); });
}, },
@ -702,14 +704,18 @@ BI.Layout = BI.inherit(BI.Widget, {
this.options.items = []; this.options.items = [];
}, },
populate: function (items) { populate: function (items, options) {
items = items || []; items = items || [];
options = options || {};
if (this._isMounted) { if (this._isMounted) {
this.update({items: items}); this.update({
items: items,
context: options.context
});
return; return;
} }
this.options.items = items; this.options.items = items;
this.stroke(items); this.stroke(items, options);
}, },
resize: function () { resize: function () {

2
src/widget/singleslider/singleslider.js

@ -127,7 +127,7 @@ BI.SingleSlider = BI.inherit(BI.Single, {
width: "100%" width: "100%"
}, { }, {
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical",
items: [{ items: [{
type: "bi.horizontal_auto", type: "bi.horizontal_auto",
items: [this.label] items: [this.label]

Loading…
Cancel
Save