x-runtime-lib 0.8.197 → 0.8.198
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/composables/element/core/elementSlotMethod.d.ts +2 -1
- package/dist/composables/element/core/elementSlotProperty.d.ts +3 -1
- package/dist/composables/runtime/sandbox.d.ts +5 -1
- package/dist/element/ui/dataTable/v1/spawn.d.ts +2 -0
- package/dist/index.js +119 -84
- package/dist/sandbox/sandbox/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Sandbox } from '@/sandbox';
|
|
1
2
|
interface Params {
|
|
2
3
|
instance?: string;
|
|
3
4
|
inputs: {
|
|
@@ -7,5 +8,5 @@ interface Params {
|
|
|
7
8
|
[key: string]: any;
|
|
8
9
|
};
|
|
9
10
|
}
|
|
10
|
-
export declare function useElementSlotMethod(
|
|
11
|
+
export declare function useElementSlotMethod(sandbox: Sandbox | undefined, methodKey: string, hook: (params: Params) => void): void;
|
|
11
12
|
export {};
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
|
-
|
|
2
|
+
import { Sandbox } from '@/sandbox';
|
|
3
|
+
import { Node } from '@/types';
|
|
4
|
+
export declare function useElementSlotProperty(sandbox: Sandbox | undefined, node: Ref<Node>, propertyKey: string, target: Ref<any>): void;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { InitValues, Sandbox } from '@/sandbox';
|
|
3
3
|
import { Data, Meta, SandboxKind } from '@/types';
|
|
4
|
-
export declare function useSandbox(kind: SandboxKind, nodeId: string, slotId: string, instance: string, parent: Sandbox | undefined, meta: Ref<Meta | undefined>, data: Ref<Data | undefined>, initValues?: InitValues):
|
|
4
|
+
export declare function useSandbox(kind: SandboxKind, nodeId: string, slotId: string, instance: string, parent: Sandbox | undefined, meta: Ref<Meta | undefined>, data: Ref<Data | undefined>, initValues?: InitValues): {
|
|
5
|
+
sandbox: undefined;
|
|
6
|
+
} | {
|
|
7
|
+
sandbox: Sandbox;
|
|
8
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1482,24 +1482,26 @@ function useElementProperty(e, p, m) {
|
|
|
1482
1482
|
}), { property: _ };
|
|
1483
1483
|
}
|
|
1484
1484
|
function useElementSlotMethod(e, p, m) {
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
g?.eventBus.on(_, m);
|
|
1485
|
+
e && (onBeforeMount(() => {
|
|
1486
|
+
e.eventBus.on(`method/${p}`, m);
|
|
1488
1487
|
}), onUnmounted(() => {
|
|
1489
|
-
|
|
1490
|
-
});
|
|
1491
|
-
}
|
|
1492
|
-
function useElementSlotProperty(e, p, m) {
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1488
|
+
e.eventBus.off(`method/${p}`, m);
|
|
1489
|
+
}));
|
|
1490
|
+
}
|
|
1491
|
+
function useElementSlotProperty(e, p, m, g) {
|
|
1492
|
+
if (!e) return;
|
|
1493
|
+
let _ = (e) => {
|
|
1494
|
+
e.result.value = g.value;
|
|
1495
|
+
}, v = (e) => {
|
|
1496
|
+
g.value = e;
|
|
1497
1497
|
};
|
|
1498
1498
|
onBeforeMount(() => {
|
|
1499
|
-
|
|
1499
|
+
e.eventBus.on(`property/${m}/get`, _), e.eventBus.on(`property/${m}/set`, v);
|
|
1500
1500
|
}), onUnmounted(() => {
|
|
1501
|
-
|
|
1502
|
-
})
|
|
1501
|
+
e.eventBus.off(`property/${m}/get`, _), e.eventBus.off(`property/${m}/set`, v);
|
|
1502
|
+
}), watch(g, (g, _) => {
|
|
1503
|
+
e.hooks.onPropertyChange(makePropertyId("elementAdaptSlotProperty", "globality", makePropertyKeyOfElementSlot(p.value.basic.key, e.slotId, m)), g, _, e.instance), e.parent && e.parent.hooks.onPropertyChange(makePropertyId("elementSlotProperty", e.nodeId, makePropertyKeyOfElementSlot(p.value.basic.key, e.slotId, m)), g, _, e.instance);
|
|
1504
|
+
}, { immediate: !0 });
|
|
1503
1505
|
}
|
|
1504
1506
|
function useElementSlotRender(e, p, m) {
|
|
1505
1507
|
function g(p) {
|
|
@@ -3779,7 +3781,7 @@ var v1_default$40 = /* @__PURE__ */ __plugin_vue_export_helper_default(_sfc_main
|
|
|
3779
3781
|
_: 3
|
|
3780
3782
|
}));
|
|
3781
3783
|
}
|
|
3782
|
-
}),
|
|
3784
|
+
}), columnSlot_default = /* @__PURE__ */ defineComponent({
|
|
3783
3785
|
__name: "columnSlot",
|
|
3784
3786
|
props: /* @__PURE__ */ mergeModels({
|
|
3785
3787
|
refContext: {},
|
|
@@ -3793,9 +3795,11 @@ var v1_default$40 = /* @__PURE__ */ __plugin_vue_export_helper_default(_sfc_main
|
|
|
3793
3795
|
let p = useModel(e, "value"), m = e, g = injectId(), _ = injectNode(), v = ref();
|
|
3794
3796
|
provideMeta(v);
|
|
3795
3797
|
let y = ref();
|
|
3796
|
-
provideData(y), useDepend(computed(() => m.refContext.compId), v, y)
|
|
3797
|
-
let {
|
|
3798
|
-
|
|
3798
|
+
provideData(y), useDepend(computed(() => m.refContext.compId), v, y);
|
|
3799
|
+
let { sandbox: b } = useSandbox("multipleElementSlot", _.value.basic.id, "column", m.instance, injectSandbox(), v, y);
|
|
3800
|
+
useElementSlotProperty(b, _, "value", p);
|
|
3801
|
+
let { render: x } = useElementSlotRender(m.refContext, g, y);
|
|
3802
|
+
return (e, p) => (openBlock(), createBlock(unref(x)));
|
|
3799
3803
|
}
|
|
3800
3804
|
}), v1_default$31 = /* @__PURE__ */ defineComponent({
|
|
3801
3805
|
__name: "index",
|
|
@@ -3807,26 +3811,32 @@ var v1_default$40 = /* @__PURE__ */ __plugin_vue_export_helper_default(_sfc_main
|
|
|
3807
3811
|
setup(e) {
|
|
3808
3812
|
let p = e, { node: m } = useElementBase(p);
|
|
3809
3813
|
provideNode(m);
|
|
3810
|
-
let { property:
|
|
3814
|
+
let g = injectMode(), { property: _ } = useElementProperty(m, ["settings", "density"]), { property: v } = useElementProperty(m, ["settings", "fixedFooter"]), { property: y } = useElementProperty(m, ["settings", "fixedHeader"]), { property: b } = useElementProperty(m, ["settings", "headers"]), { property: x } = useElementProperty(m, ["size", "height"]), { property: S } = useElementProperty(m, ["settings", "hover"]), { property: C } = useElementProperty(m, ["settings", "data"], !0), { property: w } = useElementProperty(m, ["settings", "loading"]), { property: T } = useElementProperty(m, ["settings", "multiSort"]), { theme: E } = useTheme(), { property: D } = useElementProperty(m, ["size", "width"]), O = ref([]);
|
|
3815
|
+
if (isExecutableMode(g)) {
|
|
3816
|
+
let { property: e } = useElementProperty(m, ["slots", "columns"]);
|
|
3817
|
+
watchEffect(() => {
|
|
3818
|
+
O.value = e.value;
|
|
3819
|
+
});
|
|
3820
|
+
}
|
|
3811
3821
|
return (e, m) => {
|
|
3812
|
-
let
|
|
3822
|
+
let g = resolveComponent("v-data-table");
|
|
3813
3823
|
return openBlock(), createBlock(unref(wrap_default), {
|
|
3814
3824
|
block: "",
|
|
3815
3825
|
mask: ""
|
|
3816
3826
|
}, {
|
|
3817
|
-
default: withCtx(() => [createVNode(
|
|
3818
|
-
density: unref(
|
|
3819
|
-
"fixed-footer": unref(
|
|
3820
|
-
"fixed-header": unref(
|
|
3821
|
-
headers: unref(
|
|
3822
|
-
height: unref(
|
|
3823
|
-
hover: unref(
|
|
3824
|
-
items: unref(
|
|
3825
|
-
loading: unref(
|
|
3826
|
-
"multi-sort": unref(
|
|
3827
|
-
theme: unref(
|
|
3828
|
-
width: unref(
|
|
3829
|
-
}, createSlots({ _: 2 }, [renderList(
|
|
3827
|
+
default: withCtx(() => [createVNode(g, {
|
|
3828
|
+
density: unref(_),
|
|
3829
|
+
"fixed-footer": unref(v),
|
|
3830
|
+
"fixed-header": unref(y),
|
|
3831
|
+
headers: unref(b),
|
|
3832
|
+
height: unref(x),
|
|
3833
|
+
hover: unref(S),
|
|
3834
|
+
items: unref(C),
|
|
3835
|
+
loading: unref(w),
|
|
3836
|
+
"multi-sort": unref(T),
|
|
3837
|
+
theme: unref(E),
|
|
3838
|
+
width: unref(D)
|
|
3839
|
+
}, createSlots({ _: 2 }, [renderList(O.value, ({ key: e, comp: m }) => ({
|
|
3830
3840
|
name: `item.${e}`,
|
|
3831
3841
|
fn: withCtx(({ value: g }) => [createVNode(columnSlot_default, {
|
|
3832
3842
|
instance: e,
|
|
@@ -4983,7 +4993,7 @@ var v1_default$11 = /* @__PURE__ */ __plugin_vue_export_helper_default(_sfc_main
|
|
|
4983
4993
|
});
|
|
4984
4994
|
};
|
|
4985
4995
|
}
|
|
4986
|
-
}),
|
|
4996
|
+
}), appendInnerSlot_default = /* @__PURE__ */ defineComponent({
|
|
4987
4997
|
__name: "appendInnerSlot",
|
|
4988
4998
|
props: /* @__PURE__ */ mergeModels({
|
|
4989
4999
|
refContext: {},
|
|
@@ -5006,15 +5016,17 @@ var v1_default$11 = /* @__PURE__ */ __plugin_vue_export_helper_default(_sfc_main
|
|
|
5006
5016
|
let p = useModel(e, "isActive"), m = useModel(e, "isFocused"), g = e, _ = injectId(), v = injectNode(), y = ref();
|
|
5007
5017
|
provideMeta(y);
|
|
5008
5018
|
let b = ref();
|
|
5009
|
-
provideData(b), useDepend(computed(() => g.refContext.compId), y, b)
|
|
5019
|
+
provideData(b), useDepend(computed(() => g.refContext.compId), y, b);
|
|
5020
|
+
let { sandbox: x } = useSandbox("elementSlot", v.value.basic.id, "appendInner", "", injectSandbox(), y, b);
|
|
5021
|
+
useElementSlotProperty(x, v, "isActive", p), useElementSlotProperty(x, v, "isFocused", m), useElementSlotMethod(x, "focus", () => {
|
|
5010
5022
|
g.focus();
|
|
5011
|
-
}), useElementSlotMethod(
|
|
5023
|
+
}), useElementSlotMethod(x, "blur", () => {
|
|
5012
5024
|
g.blur();
|
|
5013
5025
|
});
|
|
5014
|
-
let { render:
|
|
5015
|
-
return (e, p) => (openBlock(), createBlock(unref(
|
|
5026
|
+
let { render: S } = useElementSlotRender(g.refContext, _, b);
|
|
5027
|
+
return (e, p) => (openBlock(), createBlock(unref(S)));
|
|
5016
5028
|
}
|
|
5017
|
-
}),
|
|
5029
|
+
}), appendSlot_default = /* @__PURE__ */ defineComponent({
|
|
5018
5030
|
__name: "appendSlot",
|
|
5019
5031
|
props: {
|
|
5020
5032
|
refContext: {},
|
|
@@ -5026,17 +5038,19 @@ var v1_default$11 = /* @__PURE__ */ __plugin_vue_export_helper_default(_sfc_main
|
|
|
5026
5038
|
let p = e, m = injectId(), g = injectNode(), _ = ref();
|
|
5027
5039
|
provideMeta(_);
|
|
5028
5040
|
let v = ref();
|
|
5029
|
-
provideData(v), useDepend(computed(() => p.refContext.compId), _, v)
|
|
5041
|
+
provideData(v), useDepend(computed(() => p.refContext.compId), _, v);
|
|
5042
|
+
let { sandbox: y } = useSandbox("elementSlot", g.value.basic.id, "append", "", injectSandbox(), _, v);
|
|
5043
|
+
useElementSlotMethod(y, "reset", () => {
|
|
5030
5044
|
p.reset();
|
|
5031
|
-
}), useElementSlotMethod(
|
|
5045
|
+
}), useElementSlotMethod(y, "resetValidation", () => {
|
|
5032
5046
|
p.resetValidation();
|
|
5033
|
-
}), useElementSlotMethod(
|
|
5047
|
+
}), useElementSlotMethod(y, "validate", () => {
|
|
5034
5048
|
p.validate();
|
|
5035
5049
|
});
|
|
5036
|
-
let { render:
|
|
5037
|
-
return (e, p) => (openBlock(), createBlock(unref(
|
|
5050
|
+
let { render: b } = useElementSlotRender(p.refContext, m, v);
|
|
5051
|
+
return (e, p) => (openBlock(), createBlock(unref(b)));
|
|
5038
5052
|
}
|
|
5039
|
-
}),
|
|
5053
|
+
}), prependInnerSlot_default = /* @__PURE__ */ defineComponent({
|
|
5040
5054
|
__name: "prependInnerSlot",
|
|
5041
5055
|
props: /* @__PURE__ */ mergeModels({
|
|
5042
5056
|
refContext: {},
|
|
@@ -5059,15 +5073,17 @@ var v1_default$11 = /* @__PURE__ */ __plugin_vue_export_helper_default(_sfc_main
|
|
|
5059
5073
|
let p = useModel(e, "isActive"), m = useModel(e, "isFocused"), g = e, _ = injectId(), v = injectNode(), y = ref();
|
|
5060
5074
|
provideMeta(y);
|
|
5061
5075
|
let b = ref();
|
|
5062
|
-
provideData(b), useDepend(computed(() => g.refContext.compId), y, b)
|
|
5076
|
+
provideData(b), useDepend(computed(() => g.refContext.compId), y, b);
|
|
5077
|
+
let { sandbox: x } = useSandbox("elementSlot", v.value.basic.id, "prependInner", "", injectSandbox(), y, b);
|
|
5078
|
+
useElementSlotProperty(x, v, "isActive", p), useElementSlotProperty(x, v, "isFocused", m), useElementSlotMethod(x, "focus", () => {
|
|
5063
5079
|
g.focus();
|
|
5064
|
-
}), useElementSlotMethod(
|
|
5080
|
+
}), useElementSlotMethod(x, "blur", () => {
|
|
5065
5081
|
g.blur();
|
|
5066
5082
|
});
|
|
5067
|
-
let { render:
|
|
5068
|
-
return (e, p) => (openBlock(), createBlock(unref(
|
|
5083
|
+
let { render: S } = useElementSlotRender(g.refContext, _, b);
|
|
5084
|
+
return (e, p) => (openBlock(), createBlock(unref(S)));
|
|
5069
5085
|
}
|
|
5070
|
-
}),
|
|
5086
|
+
}), prependSlot_default = /* @__PURE__ */ defineComponent({
|
|
5071
5087
|
__name: "prependSlot",
|
|
5072
5088
|
props: {
|
|
5073
5089
|
refContext: {},
|
|
@@ -5079,15 +5095,17 @@ var v1_default$11 = /* @__PURE__ */ __plugin_vue_export_helper_default(_sfc_main
|
|
|
5079
5095
|
let p = e, m = injectId(), g = injectNode(), _ = ref();
|
|
5080
5096
|
provideMeta(_);
|
|
5081
5097
|
let v = ref();
|
|
5082
|
-
provideData(v), useDepend(computed(() => p.refContext.compId), _, v)
|
|
5098
|
+
provideData(v), useDepend(computed(() => p.refContext.compId), _, v);
|
|
5099
|
+
let { sandbox: y } = useSandbox("elementSlot", g.value.basic.id, "prepend", "", injectSandbox(), _, v);
|
|
5100
|
+
useElementSlotMethod(y, "reset", () => {
|
|
5083
5101
|
p.reset();
|
|
5084
|
-
}), useElementSlotMethod(
|
|
5102
|
+
}), useElementSlotMethod(y, "resetValidation", () => {
|
|
5085
5103
|
p.resetValidation();
|
|
5086
|
-
}), useElementSlotMethod(
|
|
5104
|
+
}), useElementSlotMethod(y, "validate", () => {
|
|
5087
5105
|
p.validate();
|
|
5088
5106
|
});
|
|
5089
|
-
let { render:
|
|
5090
|
-
return (e, p) => (openBlock(), createBlock(unref(
|
|
5107
|
+
let { render: b } = useElementSlotRender(p.refContext, m, v);
|
|
5108
|
+
return (e, p) => (openBlock(), createBlock(unref(b)));
|
|
5091
5109
|
}
|
|
5092
5110
|
}), v1_default$4 = /* @__PURE__ */ defineComponent({
|
|
5093
5111
|
__name: "index",
|
|
@@ -5983,7 +6001,7 @@ const orbitControlsV1 = {
|
|
|
5983
6001
|
leaf: !0
|
|
5984
6002
|
};
|
|
5985
6003
|
regElement(orbitControlsV1);
|
|
5986
|
-
function spawn$
|
|
6004
|
+
function spawn$17(e, p) {
|
|
5987
6005
|
let m = getElementMust("3d_mesh_v1"), g = getProperties(m, e, p), _ = initNode();
|
|
5988
6006
|
initProperties(_, g), _.basic.id = genId(16), _.basic.key = m.key, _.transform = {
|
|
5989
6007
|
position: {
|
|
@@ -6090,10 +6108,10 @@ const boxGeometryV1 = {
|
|
|
6090
6108
|
methods: [],
|
|
6091
6109
|
slots: [],
|
|
6092
6110
|
leaf: !0,
|
|
6093
|
-
spawn: spawn$
|
|
6111
|
+
spawn: spawn$17
|
|
6094
6112
|
};
|
|
6095
6113
|
regElement(boxGeometryV1);
|
|
6096
|
-
function spawn$
|
|
6114
|
+
function spawn$16(e, p) {
|
|
6097
6115
|
let m = getElementMust("3d_mesh_v1"), g = getProperties(m, e, p), _ = initNode();
|
|
6098
6116
|
initProperties(_, g), _.basic.id = genId(16), _.basic.key = m.key, _.transform = {
|
|
6099
6117
|
position: {
|
|
@@ -6209,7 +6227,7 @@ const sphereGeometryV1 = {
|
|
|
6209
6227
|
methods: [],
|
|
6210
6228
|
slots: [],
|
|
6211
6229
|
leaf: !0,
|
|
6212
|
-
spawn: spawn$
|
|
6230
|
+
spawn: spawn$16
|
|
6213
6231
|
};
|
|
6214
6232
|
regElement(sphereGeometryV1);
|
|
6215
6233
|
var color$4 = cloneDeep_default(colorV1);
|
|
@@ -6439,7 +6457,7 @@ const meshV1 = {
|
|
|
6439
6457
|
slots: []
|
|
6440
6458
|
};
|
|
6441
6459
|
regElement(meshV1);
|
|
6442
|
-
function spawn$
|
|
6460
|
+
function spawn$15(e, p) {
|
|
6443
6461
|
let m = getElementMust("ui_bar_chart_v1"), g = getProperties(m, e, p), _ = initNode();
|
|
6444
6462
|
return initProperties(_, g), _.basic.id = genId(16), _.basic.key = m.key, _.size.height = "300px", _.xAxis.data = [
|
|
6445
6463
|
"Mon",
|
|
@@ -6509,10 +6527,10 @@ const barChartV1 = {
|
|
|
6509
6527
|
]
|
|
6510
6528
|
},
|
|
6511
6529
|
leaf: !0,
|
|
6512
|
-
spawn: spawn$
|
|
6530
|
+
spawn: spawn$15
|
|
6513
6531
|
};
|
|
6514
6532
|
regElement(barChartV1);
|
|
6515
|
-
function spawn$
|
|
6533
|
+
function spawn$14(e, p) {
|
|
6516
6534
|
let m = getElementMust("ui_line_chart_v1"), g = getProperties(m, e, p), _ = initNode();
|
|
6517
6535
|
return initProperties(_, g), _.basic.id = genId(16), _.basic.key = m.key, _.size.height = "300px", _.xAxis.data = [
|
|
6518
6536
|
"Mon",
|
|
@@ -6582,7 +6600,7 @@ const lineChartV1 = {
|
|
|
6582
6600
|
]
|
|
6583
6601
|
},
|
|
6584
6602
|
leaf: !0,
|
|
6585
|
-
spawn: spawn$
|
|
6603
|
+
spawn: spawn$14
|
|
6586
6604
|
};
|
|
6587
6605
|
regElement(lineChartV1);
|
|
6588
6606
|
var settings$37 = {
|
|
@@ -6904,7 +6922,7 @@ const badgeV1 = {
|
|
|
6904
6922
|
}
|
|
6905
6923
|
};
|
|
6906
6924
|
regElement(badgeV1);
|
|
6907
|
-
function spawn$
|
|
6925
|
+
function spawn$13(e, p) {
|
|
6908
6926
|
let m = getElementMust("ui_btn_v1"), g = getProperties(m, e, p), _ = initNode();
|
|
6909
6927
|
return initProperties(_, g), _.basic.id = genId(16), _.basic.key = m.key, _.settings.text = "button", {
|
|
6910
6928
|
nodeLite: toNodeLite(_),
|
|
@@ -7017,7 +7035,7 @@ const btnV1 = {
|
|
|
7017
7035
|
name: "x-runtime-lib.click"
|
|
7018
7036
|
}],
|
|
7019
7037
|
leaf: !0,
|
|
7020
|
-
spawn: spawn$
|
|
7038
|
+
spawn: spawn$13
|
|
7021
7039
|
};
|
|
7022
7040
|
regElement(btnV1);
|
|
7023
7041
|
const btnGroupV1 = {
|
|
@@ -7102,7 +7120,7 @@ const btnToggleV1 = {
|
|
|
7102
7120
|
}
|
|
7103
7121
|
};
|
|
7104
7122
|
regElement(btnToggleV1);
|
|
7105
|
-
function spawn$
|
|
7123
|
+
function spawn$12(e, p) {
|
|
7106
7124
|
let m = getElementMust("ui_card_v1"), g = getProperties(m, e, p), _ = initNode();
|
|
7107
7125
|
return initProperties(_, g), _.basic.id = genId(16), _.basic.key = m.key, _.children = [], _.settings.title = "title", _.settings.subtitle = "subtitle", _.settings.text = "text", {
|
|
7108
7126
|
nodeLite: toNodeLite(_),
|
|
@@ -7181,7 +7199,7 @@ const cardV1 = {
|
|
|
7181
7199
|
settings$29
|
|
7182
7200
|
]
|
|
7183
7201
|
},
|
|
7184
|
-
spawn: spawn$
|
|
7202
|
+
spawn: spawn$12
|
|
7185
7203
|
};
|
|
7186
7204
|
regElement(cardV1);
|
|
7187
7205
|
var settings$28 = {
|
|
@@ -7297,7 +7315,7 @@ const chipV1 = {
|
|
|
7297
7315
|
leaf: !0
|
|
7298
7316
|
};
|
|
7299
7317
|
regElement(chipV1);
|
|
7300
|
-
function spawn$
|
|
7318
|
+
function spawn$11(e, p) {
|
|
7301
7319
|
let m = getElementMust("ui_chip_group_v1"), g = getProperties(m, e, p), _ = initNode();
|
|
7302
7320
|
initProperties(_, g), _.basic.id = genId(16), _.basic.key = m.key;
|
|
7303
7321
|
let v = spawnChip(e, p, "chip1", "chip 1"), y = spawnChip(e, p, "chip2", "chip 2"), b = spawnChip(e, p, "chip3", "chip 3"), x = spawnChip(e, p, "chip4", "chip 4"), S = spawnChip(e, p, "chip5", "chip 5"), C = spawnChip(e, p, "chip6", "chip 6");
|
|
@@ -7391,7 +7409,7 @@ const chipGroupV1 = {
|
|
|
7391
7409
|
pageUi: [basicV1, settings$26],
|
|
7392
7410
|
compUi: [basicV1, settings$26]
|
|
7393
7411
|
},
|
|
7394
|
-
spawn: spawn$
|
|
7412
|
+
spawn: spawn$11
|
|
7395
7413
|
};
|
|
7396
7414
|
regElement(chipGroupV1);
|
|
7397
7415
|
const colorPickerV1 = {
|
|
@@ -7493,6 +7511,19 @@ const containerV1 = {
|
|
|
7493
7511
|
}]
|
|
7494
7512
|
};
|
|
7495
7513
|
regElement(containerV1);
|
|
7514
|
+
function spawn$10(e, p) {
|
|
7515
|
+
let m = getElementMust("ui_data_table_v1"), g = getProperties(m, e, p), _ = initNode();
|
|
7516
|
+
return initProperties(_, g), _.basic.id = genId(16), _.basic.key = m.key, _.settings.headers = [{
|
|
7517
|
+
value: "name",
|
|
7518
|
+
title: "Name"
|
|
7519
|
+
}, {
|
|
7520
|
+
value: "price",
|
|
7521
|
+
title: "Price"
|
|
7522
|
+
}], _.settings.data = "[\n { \"name\": \"Apple\", \"price\": 5.5 },\n { \"name\": \"Orange\", \"price\": 3.0 },\n { \"name\": \"Berry\", \"price\": 13.5 }\n]", {
|
|
7523
|
+
nodeLite: toNodeLite(_),
|
|
7524
|
+
nodes: { [_.basic.id]: _ }
|
|
7525
|
+
};
|
|
7526
|
+
}
|
|
7496
7527
|
var size$1 = {
|
|
7497
7528
|
key: "size",
|
|
7498
7529
|
name: "x-runtime-lib.size",
|
|
@@ -7667,7 +7698,8 @@ const dataTableV1 = {
|
|
|
7667
7698
|
readonly: !0
|
|
7668
7699
|
}]
|
|
7669
7700
|
}],
|
|
7670
|
-
leaf: !0
|
|
7701
|
+
leaf: !0,
|
|
7702
|
+
spawn: spawn$10
|
|
7671
7703
|
};
|
|
7672
7704
|
regElement(dataTableV1);
|
|
7673
7705
|
const datePickerV1 = {
|
|
@@ -10626,6 +10658,9 @@ var PromiseManager = class {
|
|
|
10626
10658
|
prepare(e, p, m) {
|
|
10627
10659
|
this.meta.value = e.value, this.data.value = p.value, this.resetProperties(m), this.resetStates();
|
|
10628
10660
|
}
|
|
10661
|
+
getNode(e) {
|
|
10662
|
+
return this.data.value?.view.nodes[e];
|
|
10663
|
+
}
|
|
10629
10664
|
async createVm(e, p) {
|
|
10630
10665
|
this.vm = e.newContext(), this.promiseManager = new PromiseManager(this.vm), bind(this), this.vm.evalCode("\nlet __events__ = {}\n\nfunction __onEventV1__(id, callback) {\n if (typeof(id) !== 'string' || !id) {\n return\n }\n if (typeof(callback) !== 'function') {\n return\n }\n if (!__events__[id]) {\n __events__[id] = []\n }\n const callbacks = __events__[id]\n for (let i = 0; i < callbacks.length; i++) {\n if (callbacks[i] === callback) {\n return\n }\n }\n callbacks.push(callback)\n}\n\nasync function __triggerEventInner__(id, ...params) {\n if (typeof(id) !== 'string' || !id) {\n return\n }\n if (!__events__[id]) {\n return\n }\n const callbacks = __events__[id]\n if (!callbacks) {\n return\n }\n for (let i = 0; i < callbacks.length; i++) {\n await callbacks[i](...params)\n }\n}\n\nlet __timers__ = {}\nlet __currTimerId__ = 0\n\nfunction __createTimerV1__(interval, loop, count, immediate, callback) {\n if (!loop && count <= 0) {\n return\n }\n const timer = {}\n timer.id = __currTimerId__++\n timer.interval = interval\n timer.loop = loop\n timer.count = count\n timer.immediate = immediate\n timer.callback = callback\n __timers__[timer.id] = timer\n if (timer.immediate) {\n __timeoutCallbackV1__(timer.id)\n } else {\n __timeoutV1__(timer.id, timer.interval)\n }\n}\n\nasync function __timeoutCallback__(timerId) {\n const timer = __timers__[timerId]\n if (timer) {\n timer.callback()\n // 修改计数\n if (!timer.loop) {\n timer.count = timer.count - 1\n }\n // 触发超时\n if (timer.loop || timer.count > 0) {\n await __timeoutV1__(timer.id, timer.interval)\n }\n // 回收\n if (!timer.loop && timer.count <= 0) {\n delete __timers__[timer.id]\n }\n }\n}\n\nfunction __destroy__() {\n __events__ = {}\n __timers__ = {}\n}\n"), this.setGlobalVariable("__env__", this.env), this.vm.evalCode(p), await nextTick(), this.hooks.onReady();
|
|
10631
10666
|
}
|
|
@@ -10738,7 +10773,7 @@ var PromiseManager = class {
|
|
|
10738
10773
|
return !m || !m.properties ? !1 : !!m.properties.find((e) => e.id === p);
|
|
10739
10774
|
}
|
|
10740
10775
|
async getProperty(e, p) {
|
|
10741
|
-
let { kind: m, nodeId: g, propertyKey: _ } = unwrapPropertyId(e), v = this.
|
|
10776
|
+
let { kind: m, nodeId: g, propertyKey: _ } = unwrapPropertyId(e), v = this.getNode(g);
|
|
10742
10777
|
if (!v) throw Error("node not found");
|
|
10743
10778
|
if (m === "elementProperty") return await this.getElementProperty(e, v, _);
|
|
10744
10779
|
if (m === "elementSlotProperty") return await this.getElementSlotProperty(e, g, _);
|
|
@@ -10761,7 +10796,7 @@ var PromiseManager = class {
|
|
|
10761
10796
|
if (!y) throw Error("sandbox not found");
|
|
10762
10797
|
if (!y.isValidOfElementSlotProperty(g, _, v)) throw console.warn(`Sandbox/getElementSlotProperty invalid element slot property id=${e}`), Error("invalid element slot property");
|
|
10763
10798
|
let b = { value: void 0 };
|
|
10764
|
-
return y.eventBus.emit(`property/${
|
|
10799
|
+
return y.eventBus.emit(`property/${v}/get`, { result: b }), b.value;
|
|
10765
10800
|
}
|
|
10766
10801
|
async getMultipleElementSlotProperty(e, p, m, g) {
|
|
10767
10802
|
if (!g) throw Error("instance not available");
|
|
@@ -10769,7 +10804,7 @@ var PromiseManager = class {
|
|
|
10769
10804
|
if (!b) throw Error("sandbox not found");
|
|
10770
10805
|
if (!b.isValidOfElementSlotProperty(_, v, y)) throw console.warn(`Sandbox/getMultipleElementSlotProperty invalid element slot property id=${e}`), Error("invalid element slot property");
|
|
10771
10806
|
let x = { value: void 0 };
|
|
10772
|
-
return b.eventBus.emit(`property/${
|
|
10807
|
+
return b.eventBus.emit(`property/${y}/get`, { result: x }), x.value;
|
|
10773
10808
|
}
|
|
10774
10809
|
async getRefProperty(e, p, m) {
|
|
10775
10810
|
let g = this.children[p];
|
|
@@ -10815,7 +10850,7 @@ var PromiseManager = class {
|
|
|
10815
10850
|
return this.customSlotProperties[g];
|
|
10816
10851
|
}
|
|
10817
10852
|
async setProperty(e, p, m) {
|
|
10818
|
-
let { kind: g, nodeId: v, propertyKey: y } = unwrapPropertyId(e), b = this.
|
|
10853
|
+
let { kind: g, nodeId: v, propertyKey: y } = unwrapPropertyId(e), b = this.getNode(v);
|
|
10819
10854
|
if (!b) throw Error("node not found");
|
|
10820
10855
|
if (p = cloneDeep_default(p), g === "elementProperty") await this.setElementProperty(e, p, y, b);
|
|
10821
10856
|
else if (g === "elementSlotProperty") await this.setElementSlotProperty(e, p, v, y);
|
|
@@ -10840,9 +10875,9 @@ var PromiseManager = class {
|
|
|
10840
10875
|
if (!x) throw Error("sandbox not found");
|
|
10841
10876
|
if (!x.isValidOfElementSlotProperty(v, y, b)) throw console.warn(`Sandbox/setElementSlotProperty invalid element slot property id=${e}`), Error("invalid element slot property");
|
|
10842
10877
|
let S = { value: void 0 };
|
|
10843
|
-
x.eventBus.emit(`property/${
|
|
10878
|
+
x.eventBus.emit(`property/${b}/get`, { result: S });
|
|
10844
10879
|
let C = S.value;
|
|
10845
|
-
isEqual_default(p, C) ||
|
|
10880
|
+
isEqual_default(p, C) || x.eventBus.emit(`property/${b}/set`, p);
|
|
10846
10881
|
}
|
|
10847
10882
|
async setMultipleElementSlotProperty(e, p, m, _, v) {
|
|
10848
10883
|
if (!v) throw Error("instance not available");
|
|
@@ -10850,9 +10885,9 @@ var PromiseManager = class {
|
|
|
10850
10885
|
if (!S) throw Error("sandbox not found");
|
|
10851
10886
|
if (!S.isValidOfElementSlotProperty(y, b, x)) throw console.warn(`Sandbox/setMultipleElementSlotProperty invalid element slot property id=${e}`), Error("invalid element slot property");
|
|
10852
10887
|
let C = { value: void 0 };
|
|
10853
|
-
S.eventBus.emit(`property/${
|
|
10888
|
+
S.eventBus.emit(`property/${x}/get`, { result: C });
|
|
10854
10889
|
let w = C.value;
|
|
10855
|
-
isEqual_default(p, w) ||
|
|
10890
|
+
isEqual_default(p, w) || S.eventBus.emit(`property/${x}/set`, p);
|
|
10856
10891
|
}
|
|
10857
10892
|
async setRefProperty(e, p, m, _) {
|
|
10858
10893
|
let v = this.children[m];
|
|
@@ -10925,7 +10960,7 @@ var PromiseManager = class {
|
|
|
10925
10960
|
}
|
|
10926
10961
|
async callMethod(e, p, m) {
|
|
10927
10962
|
this.debugTrace(makeFuncInfo("callMethod", e, p, m));
|
|
10928
|
-
let { kind: g, nodeId: _, methodKey: v } = unwrapMethodId(e), y = this.
|
|
10963
|
+
let { kind: g, nodeId: _, methodKey: v } = unwrapMethodId(e), y = this.getNode(_);
|
|
10929
10964
|
if (!y) throw Error("node not found");
|
|
10930
10965
|
if (g === "elementMethod") await this.callElementMethod(e, m, y.basic.key, v);
|
|
10931
10966
|
else if (g === "elementSlotMethod") await this.callElementSlotMethod(e, m, _, v);
|
|
@@ -10950,7 +10985,7 @@ var PromiseManager = class {
|
|
|
10950
10985
|
if (!b) throw Error("sandbox not found");
|
|
10951
10986
|
if (!b.isValidOfElementSlotMethod(_, v, y)) throw console.warn(`Sandbox/callElementSlotMethod invalid element slot method id=${e}`), Error("invalid element slot method");
|
|
10952
10987
|
let x = {};
|
|
10953
|
-
return b.eventBus.emit(`method/${
|
|
10988
|
+
return b.eventBus.emit(`method/${y}`, {
|
|
10954
10989
|
inputs: p,
|
|
10955
10990
|
outputs: x
|
|
10956
10991
|
}), x;
|
|
@@ -10961,7 +10996,7 @@ var PromiseManager = class {
|
|
|
10961
10996
|
if (!x) throw Error("sandbox not found");
|
|
10962
10997
|
if (!x.isValidOfElementSlotMethod(v, y, b)) throw console.warn(`Sandbox/callMultipleElementSlotMethod invalid element slot method id=${e}`), Error("invalid element slot method");
|
|
10963
10998
|
let S = {};
|
|
10964
|
-
return x.eventBus.emit(`method/${
|
|
10999
|
+
return x.eventBus.emit(`method/${b}`, {
|
|
10965
11000
|
inputs: m,
|
|
10966
11001
|
outputs: S
|
|
10967
11002
|
}), S;
|
|
@@ -11015,7 +11050,7 @@ var PromiseManager = class {
|
|
|
11015
11050
|
};
|
|
11016
11051
|
function useSandbox(e, p, m, _, v, y, b, x) {
|
|
11017
11052
|
let S = injectOrg(), C = injectEnv(), w = injectMode(), T = injectType(), E = injectDevice(), D = injectDark();
|
|
11018
|
-
if (!isExecutableMode(w)) return;
|
|
11053
|
+
if (!isExecutableMode(w)) return { sandbox: void 0 };
|
|
11019
11054
|
let O = injectRuntime(), k = new Sandbox(e, p, m, _, v, S, C, w, T, {
|
|
11020
11055
|
onReady: j,
|
|
11021
11056
|
onDestroy: M,
|
|
@@ -11056,13 +11091,13 @@ function useSandbox(e, p, m, _, v, y, b, x) {
|
|
|
11056
11091
|
async function P(e, p, m) {
|
|
11057
11092
|
k.vm && (await k.triggerEvent(makeEventId("stateChangeEvent", "globality", e), "", p, m), b.value?.code.reactivity && triggerReactivity(k, b.value.code.reactivity, makeTriggerId("stateTrigger", e), p, m));
|
|
11058
11093
|
}
|
|
11059
|
-
watch(E, async (e, p) => {
|
|
11094
|
+
return watch(E, async (e, p) => {
|
|
11060
11095
|
if (!k.vm) return;
|
|
11061
11096
|
let m = calcBreakpoint(e.width), g = calcBreakpoint(p?.width ?? e.width);
|
|
11062
11097
|
await k.callFunctionAsync("__triggerEventV1__", makeEventId("elementEvent", "globality", "screenSizeChange"), "", m, g);
|
|
11063
11098
|
}), watch(D, async (e) => {
|
|
11064
11099
|
k.vm && await k.callFunctionAsync("__triggerEventV1__", makeEventId("elementEvent", "globality", "darkModeChange"), "", e);
|
|
11065
|
-
});
|
|
11100
|
+
}), { sandbox: k };
|
|
11066
11101
|
}
|
|
11067
11102
|
function useTheme() {
|
|
11068
11103
|
let e = injectDark();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QuickJSContext, QuickJSRuntime } from 'quickjs-emscripten';
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
|
-
import { Data, Env, Meta, Mode, SandboxKind } from '@/types';
|
|
3
|
+
import { Data, Env, Meta, Mode, Node, SandboxKind } from '@/types';
|
|
4
4
|
import { InitValues, Inputs } from '../common';
|
|
5
5
|
import { Hooks } from './hooks';
|
|
6
6
|
import { PromiseManager } from './promiseManager';
|
|
@@ -29,6 +29,7 @@ export declare class Sandbox {
|
|
|
29
29
|
private meta;
|
|
30
30
|
private data;
|
|
31
31
|
prepare(meta: Ref<Meta | undefined>, data: Ref<Data | undefined>, initValues?: InitValues): void;
|
|
32
|
+
getNode(nodeId: string): Node | undefined;
|
|
32
33
|
createVm(runtime: QuickJSRuntime, code: string): Promise<void>;
|
|
33
34
|
destroyVm(): void;
|
|
34
35
|
setGlobalVariable(key: string, value: any): void;
|