x-runtime-lib 0.8.208 → 0.8.209
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +30 -48
- package/dist/sandbox/sandbox/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1370,12 +1370,12 @@ function useElementMethod(e, p, m) {
|
|
|
1370
1370
|
g?.eventBus.off(_, m);
|
|
1371
1371
|
});
|
|
1372
1372
|
}
|
|
1373
|
-
var getPropertySandbox =
|
|
1374
|
-
let _ =
|
|
1373
|
+
var getPropertySandbox = (e, p, m, g) => {
|
|
1374
|
+
let _ = e.getProperty(makePropertyId("elementProperty", p, toDotString(m)));
|
|
1375
1375
|
return g && typeof _ == "string" ? JSON.parse(_) : _;
|
|
1376
1376
|
}, setPropertySandbox = async (e, p, m, g, _) => {
|
|
1377
1377
|
_ && typeof g == "object" && (g = JSON.stringify(g, null, 2)), await e.setProperty(makePropertyId("elementProperty", p, toDotString(m)), g);
|
|
1378
|
-
}, getPropertyEditor =
|
|
1378
|
+
}, getPropertyEditor = (e, p, m) => {
|
|
1379
1379
|
let g = getField(e, p);
|
|
1380
1380
|
return m && typeof g == "string" ? JSON.parse(g) : g;
|
|
1381
1381
|
}, setPropertyEditor = async (e, p, m, g) => {
|
|
@@ -1383,8 +1383,8 @@ var getPropertySandbox = async (e, p, m, g) => {
|
|
|
1383
1383
|
};
|
|
1384
1384
|
function useElementProperty(e, p, m) {
|
|
1385
1385
|
let g = injectSandbox(), _ = ref();
|
|
1386
|
-
return watchEffect(
|
|
1387
|
-
g ? _.value =
|
|
1386
|
+
return watchEffect(() => {
|
|
1387
|
+
g ? _.value = getPropertySandbox(g, e.value.basic.id, p, m) : _.value = getPropertyEditor(e.value, p, m);
|
|
1388
1388
|
}), watch(_, async () => {
|
|
1389
1389
|
g ? await setPropertySandbox(g, e.value.basic.id, p, _.value, m) : await setPropertyEditor(e.value, p, _.value, m);
|
|
1390
1390
|
}), { property: _ };
|
|
@@ -3989,28 +3989,10 @@ var v1_default$40 = /* @__PURE__ */ __plugin_vue_export_helper_default(_sfc_main
|
|
|
3989
3989
|
refContext: {}
|
|
3990
3990
|
},
|
|
3991
3991
|
setup(e) {
|
|
3992
|
-
let p = e, { node: m } = useElementBase(p), g = injectType(), _ = injectData(), v = injectSandbox(), { property: y } = useElementProperty(m, ["settings", "valid"]), { property: b } = useElementProperty(m, ["settings", "fastFail"]), {
|
|
3993
|
-
"settings",
|
|
3994
|
-
"backgroundColor",
|
|
3995
|
-
"mode"
|
|
3996
|
-
]), { property: S } = useElementProperty(m, [
|
|
3997
|
-
"settings",
|
|
3998
|
-
"backgroundColor",
|
|
3999
|
-
"theme"
|
|
4000
|
-
]), { property: C } = useElementProperty(m, [
|
|
4001
|
-
"settings",
|
|
4002
|
-
"backgroundColor",
|
|
4003
|
-
"custom",
|
|
4004
|
-
"light"
|
|
4005
|
-
]), { property: w } = useElementProperty(m, [
|
|
4006
|
-
"settings",
|
|
4007
|
-
"backgroundColor",
|
|
4008
|
-
"custom",
|
|
4009
|
-
"dark"
|
|
4010
|
-
]), { color: T } = useColorV1(x, S, C, w), { applySize: E } = useSizeV1(p, m), { applyMargin: D } = useMarginV1(m), { applyPadding: O } = usePaddingV1(m), { applyBorder: k } = useBorderV1(m), A = computed(() => {
|
|
3992
|
+
let p = e, { node: m } = useElementBase(p), g = injectType(), _ = injectData(), v = injectSandbox(), { property: y } = useElementProperty(m, ["settings", "valid"]), { property: b } = useElementProperty(m, ["settings", "fastFail"]), { applySize: x } = useSizeV1(p, m), { applyMargin: S } = useMarginV1(m), { applyPadding: C } = usePaddingV1(m), { applyBorder: w } = useBorderV1(m), T = computed(() => {
|
|
4011
3993
|
let e = {}, p = _.value?.type;
|
|
4012
|
-
return g === "page" ? p === "ui" ? (
|
|
4013
|
-
}),
|
|
3994
|
+
return g === "page" ? p === "ui" ? (x(e), S(e), C(e), w(e)) : console.assert(!1) : g === "comp" && p === "ui" ? (x(e), S(e), C(e), w(e)) : console.assert(!1), e;
|
|
3995
|
+
}), E = async () => {
|
|
4014
3996
|
!v || !v.vm || await v.triggerEvent(makeEventId("elementEvent", p.nodeId, "submit"), []);
|
|
4015
3997
|
};
|
|
4016
3998
|
return (e, p) => {
|
|
@@ -4019,8 +4001,8 @@ var v1_default$40 = /* @__PURE__ */ __plugin_vue_export_helper_default(_sfc_main
|
|
|
4019
4001
|
modelValue: unref(y),
|
|
4020
4002
|
"onUpdate:modelValue": p[0] ||= (e) => isRef(y) ? y.value = e : null,
|
|
4021
4003
|
"fast-fail": unref(b),
|
|
4022
|
-
style: normalizeStyle(
|
|
4023
|
-
onSubmit: withModifiers(
|
|
4004
|
+
style: normalizeStyle(T.value),
|
|
4005
|
+
onSubmit: withModifiers(E, ["prevent"])
|
|
4024
4006
|
}, {
|
|
4025
4007
|
default: withCtx(() => [renderSlot(e.$slots, "default")]),
|
|
4026
4008
|
_: 3
|
|
@@ -10481,8 +10463,8 @@ function bindView(e) {
|
|
|
10481
10463
|
let v = p.getString(m), y = p.dump(g), b = p.getString(_), { promise: x, resolve: S, reject: C } = e.promiseManager.create();
|
|
10482
10464
|
return e.triggerEvent(v, y, b).then((e) => S(e), (e) => C(e)), x.settled.then(p.runtime.executePendingJobs), x.handle;
|
|
10483
10465
|
}).consume((e) => p.setProp(p.global, "__triggerEventV1__", e)), p.newFunction("__getPropertyV1__", (m, g) => {
|
|
10484
|
-
let _ = p.getString(m), v = p.getString(g)
|
|
10485
|
-
return e.getProperty(_, v)
|
|
10466
|
+
let _ = p.getString(m), v = p.getString(g);
|
|
10467
|
+
return newAny(p, e.getProperty(_, v));
|
|
10486
10468
|
}).consume((e) => p.setProp(p.global, "__getPropertyV1__", e)), p.newFunction("__setPropertyV1__", (m, g, _) => {
|
|
10487
10469
|
let v = p.getString(m), y = p.dump(g), b = p.getString(_), { promise: x, resolve: S, reject: C } = e.promiseManager.create();
|
|
10488
10470
|
return e.setProperty(v, y, b).then((e) => S(e), (e) => C(e)), x.settled.then(p.runtime.executePendingJobs), x.handle;
|
|
@@ -10688,44 +10670,44 @@ var PromiseManager = class {
|
|
|
10688
10670
|
let _ = g.meta.slots?.find((e) => e.id === p);
|
|
10689
10671
|
return !_ || !_.properties ? !1 : !!_.properties.find((e) => e.id === m);
|
|
10690
10672
|
}
|
|
10691
|
-
|
|
10673
|
+
getProperty(e, p) {
|
|
10692
10674
|
let { kind: m, nodeId: g, propertyKey: _ } = unwrapPropertyId(e), v = this.getNode(g);
|
|
10693
10675
|
if (!v) throw errors.nodeNotFound;
|
|
10694
|
-
if (m === "elementProperty") return
|
|
10695
|
-
if (m === "refProperty") return
|
|
10696
|
-
if (m === "multipleRefProperty") return
|
|
10697
|
-
if (m === "customSlotProperty") return
|
|
10698
|
-
if (m === "multipleCustomSlotProperty") return
|
|
10699
|
-
if (m === "customProperty") return
|
|
10700
|
-
if (m === "elementAdaptSlotProperty") return
|
|
10701
|
-
if (m === "customAdaptSlotProperty") return
|
|
10676
|
+
if (m === "elementProperty") return this.getElementProperty(e, v, _);
|
|
10677
|
+
if (m === "refProperty") return this.getRefProperty(e, g, _);
|
|
10678
|
+
if (m === "multipleRefProperty") return this.getMultipleRefProperty(e, g, _, p);
|
|
10679
|
+
if (m === "customSlotProperty") return this.getCustomSlotProperty(e, g, _);
|
|
10680
|
+
if (m === "multipleCustomSlotProperty") return this.getMultipleCustomSlotProperty(e, g, _, p);
|
|
10681
|
+
if (m === "customProperty") return this.getCustomProperty(e, _);
|
|
10682
|
+
if (m === "elementAdaptSlotProperty") return this.getElementAdaptSlotProperty(e, _);
|
|
10683
|
+
if (m === "customAdaptSlotProperty") return this.getCustomAdaptSlotProperty(e, _);
|
|
10702
10684
|
console.assert(!1);
|
|
10703
10685
|
}
|
|
10704
|
-
|
|
10705
|
-
if (!this.isValidOfElementProperty(p.basic.key, m)) throw console.warn(`Sandbox/getElementProperty invalid element property id=${e}`), errors.invalidElementProperty;
|
|
10686
|
+
getElementProperty(e, p, m) {
|
|
10687
|
+
if (!this.isValidOfElementProperty(p.basic.key, m)) throw console.trace("xxxx"), console.warn(`Sandbox/getElementProperty invalid element property id=${e}`), errors.invalidElementProperty;
|
|
10706
10688
|
return getField(p, m);
|
|
10707
10689
|
}
|
|
10708
|
-
|
|
10690
|
+
getRefProperty(e, p, m) {
|
|
10709
10691
|
let g = this.children[p];
|
|
10710
10692
|
if (!g) throw errors.sandboxNotFound;
|
|
10711
10693
|
if (!g.isValidOfCustomProperty(m)) throw console.warn(`Sandbox/getRefProperty invalid custom property id=${e}`), errors.invalidCustomProperty;
|
|
10712
10694
|
return g.customProperties[m];
|
|
10713
10695
|
}
|
|
10714
|
-
|
|
10696
|
+
getMultipleRefProperty(e, p, m, g) {
|
|
10715
10697
|
if (!g) throw errors.instanceNotAvailable;
|
|
10716
10698
|
let _ = this.children[`${p}/${g}`];
|
|
10717
10699
|
if (!_) throw errors.sandboxNotFound;
|
|
10718
10700
|
if (!_.isValidOfCustomProperty(m)) throw console.warn(`Sandbox/getMultipleRefProperty invalid custom property id=${e}`), errors.invalidCustomProperty;
|
|
10719
10701
|
return _.customProperties[m];
|
|
10720
10702
|
}
|
|
10721
|
-
|
|
10703
|
+
getCustomSlotProperty(e, p, m) {
|
|
10722
10704
|
let { compId: g, slotId: _, propertyId: v } = unwrapPropertyKeyOfCustomSlot(m);
|
|
10723
10705
|
if (!this.isValidOfCustomSlotProperty(g, _, v)) throw console.warn(`Sandbox/getCustomSlotProperty invalid custom slot property id=${e}`), errors.invalidCustomSlotProperty;
|
|
10724
10706
|
let y = this.children[p];
|
|
10725
10707
|
if (!y) throw errors.sandboxNotFound;
|
|
10726
10708
|
return y.customSlotProperties[v];
|
|
10727
10709
|
}
|
|
10728
|
-
|
|
10710
|
+
getMultipleCustomSlotProperty(e, p, m, g) {
|
|
10729
10711
|
if (!g) throw errors.instanceNotAvailable;
|
|
10730
10712
|
let { compId: _, slotId: v, propertyId: y } = unwrapPropertyKeyOfCustomSlot(m);
|
|
10731
10713
|
if (!this.isValidOfCustomSlotProperty(_, v, y)) throw console.warn(`Sandbox/getMultipleCustomSlotProperty invalid custom slot property id=${e}`), errors.invalidCustomSlotProperty;
|
|
@@ -10733,11 +10715,11 @@ var PromiseManager = class {
|
|
|
10733
10715
|
if (!b) throw errors.sandboxNotFound;
|
|
10734
10716
|
return b.customSlotProperties[y];
|
|
10735
10717
|
}
|
|
10736
|
-
|
|
10718
|
+
getCustomProperty(e, p) {
|
|
10737
10719
|
if (!this.isValidOfCustomProperty(p)) throw console.warn(`Sandbox/getCustomProperty invalid custom property id=${e}`), errors.invalidCustomProperty;
|
|
10738
10720
|
return this.customProperties[p];
|
|
10739
10721
|
}
|
|
10740
|
-
|
|
10722
|
+
getElementAdaptSlotProperty(e, p) {
|
|
10741
10723
|
if (!this.parent) throw errors.notInSlot;
|
|
10742
10724
|
let { elementKey: m, slotKey: g, propertyKey: _ } = unwrapPropertyKeyOfElementSlot(p);
|
|
10743
10725
|
if (!this.isEqualOfElementSlot(m, g)) throw errors.slotIncompatible;
|
|
@@ -10745,7 +10727,7 @@ var PromiseManager = class {
|
|
|
10745
10727
|
let v = { value: void 0 };
|
|
10746
10728
|
return this.eventBus.emit(`property/${_}/get`, { result: v }), v.value;
|
|
10747
10729
|
}
|
|
10748
|
-
|
|
10730
|
+
getCustomAdaptSlotProperty(e, p) {
|
|
10749
10731
|
if (!this.parent) throw errors.notInSlot;
|
|
10750
10732
|
let { compId: m, slotId: g, propertyId: _ } = unwrapPropertyKeyOfCustomSlot(p);
|
|
10751
10733
|
if (!this.isEqualOfCustomSlot(m, g)) throw errors.slotIncompatible;
|
|
@@ -51,7 +51,7 @@ export declare class Sandbox {
|
|
|
51
51
|
isValidOfElementSlotProperty(elementKey: string, slotKey: string, propertyKey: string): boolean;
|
|
52
52
|
isValidOfCustomProperty(propertyId: string): boolean;
|
|
53
53
|
isValidOfCustomSlotProperty(compId: string, slotId: string, propertyId: string): boolean;
|
|
54
|
-
getProperty(id: string, instance?: string):
|
|
54
|
+
getProperty(id: string, instance?: string): any;
|
|
55
55
|
private getElementProperty;
|
|
56
56
|
private getRefProperty;
|
|
57
57
|
private getMultipleRefProperty;
|