update doric-web to 0.2.3-rc1

This commit is contained in:
pengfei.zhou 2020-01-06 14:18:02 +08:00 committed by osborn
parent b1ed4f7bed
commit a0f923ecde
3 changed files with 87 additions and 23 deletions

View File

@ -2111,28 +2111,43 @@ class VLayout extends LinearLayout {
} }
class HLayout extends LinearLayout { class HLayout extends LinearLayout {
} }
function stack(views) { function stack(views, config) {
const ret = new Stack; const ret = new Stack;
ret.layoutConfig = layoutConfig().fit(); ret.layoutConfig = layoutConfig().fit();
for (let v of views) { for (let v of views) {
ret.addChild(v); ret.addChild(v);
} }
if (config) {
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
}
return ret; return ret;
} }
function hlayout(views) { function hlayout(views, config) {
const ret = new HLayout; const ret = new HLayout;
ret.layoutConfig = layoutConfig().fit(); ret.layoutConfig = layoutConfig().fit();
for (let v of views) { for (let v of views) {
ret.addChild(v); ret.addChild(v);
} }
if (config) {
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
}
return ret; return ret;
} }
function vlayout(views) { function vlayout(views, config) {
const ret = new VLayout; const ret = new VLayout;
ret.layoutConfig = layoutConfig().fit(); ret.layoutConfig = layoutConfig().fit();
for (let v of views) { for (let v of views) {
ret.addChild(v); ret.addChild(v);
} }
if (config) {
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
}
return ret; return ret;
} }
@ -2811,10 +2826,22 @@ function list(config) {
} }
return ret; return ret;
} }
function listItem(item) { function listItem(item, config) {
return (new ListItem).also((it) => { return (new ListItem).also((it) => {
it.layoutConfig = layoutConfig().most().configHeight(exports.LayoutSpec.FIT); it.layoutConfig = layoutConfig().fit();
it.addChild(item); if (item instanceof View) {
it.addChild(item);
}
else {
item.forEach(e => {
it.addChild(e);
});
}
if (config) {
for (let key in config) {
Reflect.set(it, key, Reflect.get(config, key, config), it);
}
}
}); });
} }
@ -2891,12 +2918,6 @@ __decorate$6([
Property, Property,
__metadata$6("design:type", Function) __metadata$6("design:type", Function)
], Slider.prototype, "onPageSlided", void 0); ], Slider.prototype, "onPageSlided", void 0);
function slideItem(item) {
return (new SlideItem).also((it) => {
it.layoutConfig = layoutConfig().fit();
it.addChild(item);
});
}
function slider(config) { function slider(config) {
const ret = new Slider; const ret = new Slider;
for (let key in config) { for (let key in config) {
@ -2904,6 +2925,24 @@ function slider(config) {
} }
return ret; return ret;
} }
function slideItem(item, config) {
return (new SlideItem).also((it) => {
it.layoutConfig = layoutConfig().fit();
if (item instanceof View) {
it.addChild(item);
}
else {
item.forEach(e => {
it.addChild(e);
});
}
if (config) {
for (let key in config) {
Reflect.set(it, key, Reflect.get(config, key, config), it);
}
}
});
}
/* /*
* Copyright [2019] [Doric.Pub] * Copyright [2019] [Doric.Pub]
@ -2920,9 +2959,14 @@ function slider(config) {
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
function scroller(content) { function scroller(content, config) {
return (new Scroller).also(v => { return (new Scroller).also(v => {
v.layoutConfig = layoutConfig().fit(); v.layoutConfig = layoutConfig().fit();
if (config) {
for (let key in config) {
Reflect.set(v, key, Reflect.get(config, key, config), v);
}
}
v.content = content; v.content = content;
}); });
} }
@ -3097,10 +3141,22 @@ function flowlayout(config) {
} }
return ret; return ret;
} }
function flowItem(item) { function flowItem(item, config) {
return (new FlowLayoutItem).also((it) => { return (new FlowLayoutItem).also((it) => {
it.layoutConfig = layoutConfig().fit(); it.layoutConfig = layoutConfig().fit();
it.addChild(item); if (item instanceof View) {
it.addChild(item);
}
else {
item.forEach(e => {
it.addChild(e);
});
}
if (config) {
for (let key in config) {
Reflect.set(it, key, Reflect.get(config, key, config), it);
}
}
}); });
} }
@ -3215,14 +3271,21 @@ __decorate$b([
Property, Property,
__metadata$b("design:type", Function) __metadata$b("design:type", Function)
], Draggable.prototype, "onDrag", void 0); ], Draggable.prototype, "onDrag", void 0);
function draggable(config, views) { function draggable(views, config) {
const ret = new Draggable; const ret = new Draggable;
ret.layoutConfig = layoutConfig().fit(); ret.layoutConfig = layoutConfig().fit();
for (let key in config) { if (views instanceof View) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret); ret.addChild(views);
} }
for (let v of views) { else {
ret.addChild(v); views.forEach(e => {
ret.addChild(e);
});
}
if (config) {
for (let key in config) {
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
}
} }
return ret; return ret;
} }

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,12 @@
{ {
"name": "doric-web", "name": "doric-web",
"version": "0.2.2", "version": "0.2.3-rc1",
"description": "Doric library for Web", "description": "Doric library for Web",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc -p .&& rollup -c" "build": "tsc -p .&& rollup -c",
"prepublish": "npm run build"
}, },
"repository": { "repository": {
"type": "git", "type": "git",