iOS:add ListItem actions api
This commit is contained in:
@@ -2,9 +2,12 @@
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
function obj2Model(obj) {
|
||||
if (obj instanceof Array) {
|
||||
return obj.map(e => obj2Model(e));
|
||||
function obj2Model(obj, convertor) {
|
||||
if (obj instanceof Function) {
|
||||
return convertor(obj);
|
||||
}
|
||||
else if (obj instanceof Array) {
|
||||
return obj.map(e => obj2Model(e, convertor));
|
||||
}
|
||||
else if (obj instanceof Object) {
|
||||
if (Reflect.has(obj, 'toModel') && Reflect.get(obj, 'toModel') instanceof Function) {
|
||||
@@ -14,7 +17,7 @@ function obj2Model(obj) {
|
||||
else {
|
||||
for (let key in obj) {
|
||||
const val = Reflect.get(obj, key);
|
||||
Reflect.set(obj, key, obj2Model(val));
|
||||
Reflect.set(obj, key, obj2Model(val, convertor));
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
@@ -228,7 +231,7 @@ class View {
|
||||
newV = this.callback2Id(newV);
|
||||
}
|
||||
else {
|
||||
newV = obj2Model(newV);
|
||||
newV = obj2Model(newV, (v) => this.callback2Id(v));
|
||||
}
|
||||
this.__dirty_props__[propKey] = newV;
|
||||
}
|
||||
@@ -1548,6 +1551,10 @@ __decorate$8([
|
||||
Property,
|
||||
__metadata$8("design:type", String)
|
||||
], ListItem.prototype, "identifier", void 0);
|
||||
__decorate$8([
|
||||
Property,
|
||||
__metadata$8("design:type", Array)
|
||||
], ListItem.prototype, "actions", void 0);
|
||||
class List extends Superview {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
Reference in New Issue
Block a user