x-block-lib 0.11.4 → 0.11.6
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.
|
@@ -222,7 +222,10 @@ var en_default = {
|
|
|
222
222
|
COMPUTE_V1_COMPUTE_ENV_IS_TITLE: "environment is %1",
|
|
223
223
|
COMPUTE_V1_COMPUTE_ENV_IS_TOOLTIP: "COMPUTE_V1_COMPUTE_ENV_IS_TOOLTIP",
|
|
224
224
|
COMPUTE_V1_COMPUTE_ENV_IS_HELPURL: "COMPUTE_V1_COMPUTE_ENV_IS_HELPURL",
|
|
225
|
-
|
|
225
|
+
COMPUTE_V1_ON_FLOW_STATE_EVENT_TITLE: "state event",
|
|
226
|
+
COMPUTE_V1_ON_FLOW_STATE_EVENT_TOOLTIP: "COMPUTE_V1_ON_FLOW_STATE_EVENT_TOOLTIP",
|
|
227
|
+
COMPUTE_V1_ON_FLOW_STATE_EVENT_HELPURL: "COMPUTE_V1_ON_FLOW_STATE_EVENT_HELPURL",
|
|
228
|
+
COMPUTE_V1_SET_FUNC_OUTPUT_TITLE: "set output",
|
|
226
229
|
COMPUTE_V1_SET_FUNC_OUTPUT_TOOLTIP: "COMPUTE_V1_SET_FUNC_OUTPUT_TOOLTIP",
|
|
227
230
|
COMPUTE_V1_SET_FUNC_OUTPUT_HELPURL: "COMPUTE_V1_SET_FUNC_OUTPUT_HELPURL",
|
|
228
231
|
DATA_AS: "as",
|
package/dist/index.js
CHANGED
|
@@ -9,8 +9,8 @@ import { useDisplay } from "vuetify";
|
|
|
9
9
|
|
|
10
10
|
//#region src/core/locale/index.ts
|
|
11
11
|
async function setLocale(locale) {
|
|
12
|
-
if (locale === "en") setLocale$1((await import("./en.
|
|
13
|
-
else if (locale === "zhHans") setLocale$1((await import("./zhHans.
|
|
12
|
+
if (locale === "en") setLocale$1((await import("./en.farnksb7.js")).default);
|
|
13
|
+
else if (locale === "zhHans") setLocale$1((await import("./zhHans.cyz6m68z.js")).default);
|
|
14
14
|
else throw new Error(`invalid locale=${locale}`);
|
|
15
15
|
}
|
|
16
16
|
function localeMsg(key) {
|
|
@@ -3747,7 +3747,6 @@ const CALL_APP_METHOD_V1 = {
|
|
|
3747
3747
|
};
|
|
3748
3748
|
Blocks.call_app_method_v1 = CALL_APP_METHOD_V1;
|
|
3749
3749
|
javascriptGenerator.forBlock["call_app_method_v1"] = function(blockBase) {
|
|
3750
|
-
const it = javascriptGenerator.INDENT;
|
|
3751
3750
|
const block = blockBase;
|
|
3752
3751
|
let instance = "''";
|
|
3753
3752
|
switch (block.method.kind) {
|
|
@@ -3781,7 +3780,7 @@ javascriptGenerator.forBlock["call_app_method_v1"] = function(blockBase) {
|
|
|
3781
3780
|
}
|
|
3782
3781
|
inputs += `}`;
|
|
3783
3782
|
let outputs = "";
|
|
3784
|
-
if (block.method.outputs) for (const { key } of block.method.outputs) outputs +=
|
|
3783
|
+
if (block.method.outputs) for (const { key } of block.method.outputs) outputs += ` const __output$${key}__ = __outputs__[${javascriptGenerator.quote_(key)}];\n`;
|
|
3785
3784
|
if (block.method.kind === "customMethod") {
|
|
3786
3785
|
const { kind, nodeId, methodKey } = unwrapMethodId(block.method.id);
|
|
3787
3786
|
const funcName = getImplementMethodName(kind, nodeId, methodKey);
|
|
@@ -3990,15 +3989,14 @@ const IMPLEMENT_APP_METHOD_V1 = {
|
|
|
3990
3989
|
};
|
|
3991
3990
|
Blocks.implement_app_method_v1 = IMPLEMENT_APP_METHOD_V1;
|
|
3992
3991
|
javascriptGenerator.forBlock["implement_app_method_v1"] = function(blockBase) {
|
|
3993
|
-
const it = javascriptGenerator.INDENT;
|
|
3994
3992
|
const block = blockBase;
|
|
3995
3993
|
const { kind, nodeId, methodKey } = unwrapMethodId(block.method.id);
|
|
3996
3994
|
let inputs = "";
|
|
3997
|
-
if (block.method.inputs) for (const { key } of block.method.inputs) inputs +=
|
|
3995
|
+
if (block.method.inputs) for (const { key } of block.method.inputs) inputs += ` const __input$${key}__ = __inputs__[${javascriptGenerator.quote_(key)}];\n`;
|
|
3998
3996
|
const handle = javascriptGenerator.statementToCode(block, "HANDLE");
|
|
3999
3997
|
return `async function ${getImplementMethodName(kind, nodeId, methodKey)}(__instance__, __inputs__) {
|
|
4000
|
-
${inputs}
|
|
4001
|
-
${handle}
|
|
3998
|
+
${inputs} const __outputs__ = {};
|
|
3999
|
+
${handle} return __outputs__;
|
|
4002
4000
|
}
|
|
4003
4001
|
`;
|
|
4004
4002
|
};
|
|
@@ -5180,9 +5178,23 @@ function ${javascriptGenerator.FUNCTION_NAME_PLACEHOLDER_}(r, g, b) {
|
|
|
5180
5178
|
`)}(${red}, ${green}, ${blue})`, Order.FUNCTION_CALL];
|
|
5181
5179
|
};
|
|
5182
5180
|
|
|
5181
|
+
//#endregion
|
|
5182
|
+
//#region src/core/blocks/compute/flow/invokeFlowTrigger/v1/index.ts
|
|
5183
|
+
const INVOKE_FLOW_TRIGGER_V1 = { init: function() {} };
|
|
5184
|
+
Blocks.invoke_flow_trigger_v1 = INVOKE_FLOW_TRIGGER_V1;
|
|
5185
|
+
javascriptGenerator.forBlock["invoke_flow_trigger_v1"] = function() {
|
|
5186
|
+
return ``;
|
|
5187
|
+
};
|
|
5188
|
+
|
|
5183
5189
|
//#endregion
|
|
5184
5190
|
//#region src/core/blocks/compute/flow/onFlowStateEvent/v1/index.ts
|
|
5185
|
-
const ON_FLOW_STATE_EVENT_V1 = { init: function() {
|
|
5191
|
+
const ON_FLOW_STATE_EVENT_V1 = { init: function() {
|
|
5192
|
+
this.appendDummyInput().appendField("%{BKY_COMPUTE_V1_ON_FLOW_STATE_EVENT_TITLE}");
|
|
5193
|
+
this.appendStatementInput("HANDLE").appendField("%{BKY_APP_DO}");
|
|
5194
|
+
this.setStyle("event_blocks");
|
|
5195
|
+
this.setTooltip("%{BKY_COMPUTE_V1_ON_FLOW_STATE_EVENT_TOOLTIP}");
|
|
5196
|
+
this.setHelpUrl("%{BKY_COMPUTE_V1_ON_FLOW_STATE_EVENT_HELPURL}");
|
|
5197
|
+
} };
|
|
5186
5198
|
Blocks.on_flow_state_event_v1 = ON_FLOW_STATE_EVENT_V1;
|
|
5187
5199
|
javascriptGenerator.forBlock["on_flow_state_event_v1"] = function() {
|
|
5188
5200
|
return `__onFlowStateEventV1__();\n`;
|
|
@@ -5191,12 +5203,14 @@ javascriptGenerator.forBlock["on_flow_state_event_v1"] = function() {
|
|
|
5191
5203
|
//#endregion
|
|
5192
5204
|
//#region src/core/utils/compute/func.ts
|
|
5193
5205
|
function getAllFuncInfos(spaceId) {
|
|
5194
|
-
const
|
|
5206
|
+
const { spaces } = globalState.compute;
|
|
5207
|
+
const space = spaces.find((entry) => entry.id === spaceId);
|
|
5195
5208
|
if (!space) return [];
|
|
5196
5209
|
return space.funcs;
|
|
5197
5210
|
}
|
|
5198
5211
|
function getFuncInfo(spaceId, funcId) {
|
|
5199
|
-
const
|
|
5212
|
+
const { spaces } = globalState.compute;
|
|
5213
|
+
const space = spaces.find((entry) => entry.id === spaceId);
|
|
5200
5214
|
if (!space) return;
|
|
5201
5215
|
return space.funcs.find((entry) => entry.id === funcId);
|
|
5202
5216
|
}
|
|
@@ -5208,7 +5222,8 @@ function genFuncOpts(spaceId) {
|
|
|
5208
5222
|
return ensureOpts(options);
|
|
5209
5223
|
}
|
|
5210
5224
|
function getActiveFunc() {
|
|
5211
|
-
|
|
5225
|
+
const { activeFunc } = globalState.compute;
|
|
5226
|
+
return activeFunc;
|
|
5212
5227
|
}
|
|
5213
5228
|
function getActiveFuncOutputInfo(id) {
|
|
5214
5229
|
const { activeFunc } = globalState.compute;
|
|
@@ -5445,26 +5460,25 @@ const CALL_FUNC_V1 = {
|
|
|
5445
5460
|
};
|
|
5446
5461
|
Blocks.call_func_v1 = CALL_FUNC_V1;
|
|
5447
5462
|
javascriptGenerator.forBlock["call_func_v1"] = function(base) {
|
|
5448
|
-
const it = javascriptGenerator.INDENT;
|
|
5449
5463
|
const block = base;
|
|
5450
5464
|
const spaceId = javascriptGenerator.quote_(block.space.id);
|
|
5451
5465
|
const funcId = javascriptGenerator.quote_(block.func.id);
|
|
5452
5466
|
let inputs = "";
|
|
5453
|
-
inputs +=
|
|
5467
|
+
inputs += ` var __inputs__ = {\n`;
|
|
5454
5468
|
block.func.inputs.forEach(({ id }, index) => {
|
|
5455
5469
|
const value = javascriptGenerator.valueToCode(block, "INPUT" + index, Order.ATOMIC);
|
|
5456
|
-
inputs +=
|
|
5470
|
+
inputs += ` ${javascriptGenerator.quote_(id)}: ${value},\n`;
|
|
5457
5471
|
});
|
|
5458
|
-
inputs +=
|
|
5472
|
+
inputs += ` };`;
|
|
5459
5473
|
const name = javascriptGenerator.quote_(block.space.name + "/" + block.func.name);
|
|
5460
5474
|
let outputs = "";
|
|
5461
5475
|
block.func.outputs.forEach(({ id }) => {
|
|
5462
|
-
outputs +=
|
|
5476
|
+
outputs += ` var __output${id}__ = __result__[${javascriptGenerator.quote_(id)}];\n`;
|
|
5463
5477
|
});
|
|
5464
5478
|
const callback = javascriptGenerator.statementToCode(block, "CALLBACK");
|
|
5465
5479
|
return `{
|
|
5466
5480
|
${inputs}
|
|
5467
|
-
|
|
5481
|
+
var __result__ = __callFuncV1__(${spaceId},${funcId},__inputs__,__getEnvV1__(),${name});
|
|
5468
5482
|
${outputs}${callback}}
|
|
5469
5483
|
`;
|
|
5470
5484
|
};
|
|
@@ -5670,28 +5684,27 @@ const CALL_FUNC_INTERNAL_V1 = {
|
|
|
5670
5684
|
};
|
|
5671
5685
|
Blocks.call_func_internal_v1 = CALL_FUNC_INTERNAL_V1;
|
|
5672
5686
|
javascriptGenerator.forBlock["call_func_internal_v1"] = function(base) {
|
|
5673
|
-
const it = javascriptGenerator.INDENT;
|
|
5674
5687
|
const block = base;
|
|
5675
5688
|
const spaceId = javascriptGenerator.quote_(block.space.id);
|
|
5676
5689
|
const funcId = javascriptGenerator.quote_(block.func.id);
|
|
5677
|
-
let inputs =
|
|
5690
|
+
let inputs = ` var __inputs__ = {\n`;
|
|
5678
5691
|
block.func.inputs.forEach(({ id }, index) => {
|
|
5679
5692
|
const value = javascriptGenerator.valueToCode(block, "INPUT" + index, Order.ATOMIC);
|
|
5680
|
-
inputs +=
|
|
5693
|
+
inputs += ` ${javascriptGenerator.quote_(id)}: ${value},\n`;
|
|
5681
5694
|
});
|
|
5682
|
-
inputs +=
|
|
5695
|
+
inputs += ` };`;
|
|
5683
5696
|
const name = block.space.name + "/" + block.func.name;
|
|
5684
5697
|
let outputs = "";
|
|
5685
5698
|
block.func.outputs.forEach(({ id }) => {
|
|
5686
|
-
outputs +=
|
|
5699
|
+
outputs += ` var __output$${id}__ = __result__.outputs[${javascriptGenerator.quote_(id)}];\n`;
|
|
5687
5700
|
});
|
|
5688
5701
|
const callback = javascriptGenerator.statementToCode(block, "CALLBACK");
|
|
5689
5702
|
return `{
|
|
5690
5703
|
${inputs}
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5704
|
+
var __result__ = __callFuncInternalV1__(${spaceId}, ${funcId}, __inputs__);
|
|
5705
|
+
if (!__result__.success) {
|
|
5706
|
+
throw 'call func<${name}> failed, reason: ' + __result__.message;
|
|
5707
|
+
}
|
|
5695
5708
|
${outputs}${callback}}
|
|
5696
5709
|
`;
|
|
5697
5710
|
};
|
|
@@ -6074,12 +6087,13 @@ const ADD_DATA_V1 = {
|
|
|
6074
6087
|
this.setHelpUrl("%{BKY_DATA_V1_ADD_DATA_HELPURL}");
|
|
6075
6088
|
},
|
|
6076
6089
|
saveExtraState: function() {
|
|
6077
|
-
return {};
|
|
6090
|
+
return { create: !this.isInFlyout };
|
|
6078
6091
|
},
|
|
6079
|
-
loadExtraState: function() {
|
|
6092
|
+
loadExtraState: function(state) {
|
|
6080
6093
|
this.updateShape_();
|
|
6094
|
+
if (!state.create) this.ensureBlocks_();
|
|
6081
6095
|
setTimeout(() => {
|
|
6082
|
-
this.
|
|
6096
|
+
this.ensureBlocks2_();
|
|
6083
6097
|
}, 0);
|
|
6084
6098
|
},
|
|
6085
6099
|
updateShape_: function() {
|
|
@@ -6104,6 +6118,10 @@ const ADD_DATA_V1 = {
|
|
|
6104
6118
|
ensureBlocks_: function() {
|
|
6105
6119
|
if (this.isInsertionMarker()) return;
|
|
6106
6120
|
ensureTableBlock$3(this);
|
|
6121
|
+
ensureHandleBlock$3(this);
|
|
6122
|
+
},
|
|
6123
|
+
ensureBlocks2_: function() {
|
|
6124
|
+
if (this.isInsertionMarker()) return;
|
|
6107
6125
|
ensureParameterBlockV1s(this, [
|
|
6108
6126
|
[
|
|
6109
6127
|
"SUCCESS",
|
|
@@ -6124,22 +6142,21 @@ const ADD_DATA_V1 = {
|
|
|
6124
6142
|
true
|
|
6125
6143
|
]
|
|
6126
6144
|
]);
|
|
6127
|
-
ensureHandleBlock$3(this);
|
|
6128
6145
|
}
|
|
6129
6146
|
};
|
|
6130
6147
|
Blocks.add_data_v1 = ADD_DATA_V1;
|
|
6131
6148
|
javascriptGenerator.forBlock["add_data_v1"] = function(block) {
|
|
6132
|
-
const it = javascriptGenerator.INDENT;
|
|
6133
6149
|
return `{
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6150
|
+
var __tx__ = typeof __tx__ !== 'undefined' ? __tx__ : null;
|
|
6151
|
+
const __table__ = ${javascriptGenerator.valueToCode(block, "TABLE", Order.ATOMIC) || "null"};
|
|
6152
|
+
const {
|
|
6153
|
+
success: __success__,
|
|
6154
|
+
message: __message__,
|
|
6155
|
+
data: __data__
|
|
6156
|
+
} = __addDataV1__(__tx__, __table__);
|
|
6157
|
+
if (__tx__ && !__success__) {
|
|
6158
|
+
throw __message__;
|
|
6159
|
+
}
|
|
6143
6160
|
${javascriptGenerator.statementToCode(block, "HANDLE")}}
|
|
6144
6161
|
`;
|
|
6145
6162
|
};
|
|
@@ -6546,12 +6563,13 @@ const DATA_DELETE_V1 = {
|
|
|
6546
6563
|
this.setHelpUrl("%{BKY_DATA_V1_DELETE_DATA_HELPURL}");
|
|
6547
6564
|
},
|
|
6548
6565
|
saveExtraState: function() {
|
|
6549
|
-
return {};
|
|
6566
|
+
return { create: !this.isInFlyout };
|
|
6550
6567
|
},
|
|
6551
|
-
loadExtraState: function() {
|
|
6568
|
+
loadExtraState: function(state) {
|
|
6552
6569
|
this.updateShape_();
|
|
6570
|
+
if (!state.create) this.ensureBlocks_();
|
|
6553
6571
|
setTimeout(() => {
|
|
6554
|
-
this.
|
|
6572
|
+
this.ensureBlocks2_();
|
|
6555
6573
|
}, 0);
|
|
6556
6574
|
},
|
|
6557
6575
|
updateShape_: function() {
|
|
@@ -6577,6 +6595,10 @@ const DATA_DELETE_V1 = {
|
|
|
6577
6595
|
if (this.isInsertionMarker()) return;
|
|
6578
6596
|
ensureTableBlock$2(this);
|
|
6579
6597
|
ensureConditionBlock$2(this);
|
|
6598
|
+
ensureHandleBlock$2(this);
|
|
6599
|
+
},
|
|
6600
|
+
ensureBlocks2_: function() {
|
|
6601
|
+
if (this.isInsertionMarker()) return;
|
|
6580
6602
|
ensureParameterBlockV1s(this, [[
|
|
6581
6603
|
"SUCCESS",
|
|
6582
6604
|
"__success__",
|
|
@@ -6588,22 +6610,21 @@ const DATA_DELETE_V1 = {
|
|
|
6588
6610
|
"x-runtime-lib.message",
|
|
6589
6611
|
true
|
|
6590
6612
|
]]);
|
|
6591
|
-
ensureHandleBlock$2(this);
|
|
6592
6613
|
}
|
|
6593
6614
|
};
|
|
6594
6615
|
Blocks.delete_data_v1 = DATA_DELETE_V1;
|
|
6595
6616
|
javascriptGenerator.forBlock["delete_data_v1"] = function(block) {
|
|
6596
|
-
const it = javascriptGenerator.INDENT;
|
|
6597
6617
|
return `{
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6618
|
+
var __tx__ = typeof __tx__ !== 'undefined' ? __tx__ : null;
|
|
6619
|
+
const __table__ = ${javascriptGenerator.valueToCode(block, "TABLE", Order.ATOMIC) || "null"};
|
|
6620
|
+
const __condition__ = ${javascriptGenerator.valueToCode(block, "CONDITION", Order.ATOMIC) || "null"};
|
|
6621
|
+
const {
|
|
6622
|
+
success: __success__,
|
|
6623
|
+
message: __message__
|
|
6624
|
+
} = __deleteDataV1__(__tx__, __table__, __condition__);
|
|
6625
|
+
if (__tx__ && !__success__) {
|
|
6626
|
+
throw __message__;
|
|
6627
|
+
}
|
|
6607
6628
|
${javascriptGenerator.statementToCode(block, "HANDLE")}}
|
|
6608
6629
|
`;
|
|
6609
6630
|
};
|
|
@@ -6737,12 +6758,16 @@ const QUERY_DATA_V1 = {
|
|
|
6737
6758
|
this.setHelpUrl("%{BKY_DATA_V1_QUERY_DATA_HELPURL}");
|
|
6738
6759
|
},
|
|
6739
6760
|
saveExtraState: function() {
|
|
6740
|
-
return {};
|
|
6761
|
+
return { create: !this.isInFlyout };
|
|
6741
6762
|
},
|
|
6742
|
-
loadExtraState: function() {
|
|
6763
|
+
loadExtraState: function(state) {
|
|
6743
6764
|
this.updateShape_();
|
|
6744
6765
|
setTimeout(() => {
|
|
6745
|
-
this.
|
|
6766
|
+
this.updateShadow_();
|
|
6767
|
+
}, 0);
|
|
6768
|
+
if (!state.create) this.ensureBlocks_();
|
|
6769
|
+
setTimeout(() => {
|
|
6770
|
+
this.ensureBlocks2_();
|
|
6746
6771
|
}, 0);
|
|
6747
6772
|
},
|
|
6748
6773
|
updateShape_: function() {
|
|
@@ -6776,11 +6801,19 @@ const QUERY_DATA_V1 = {
|
|
|
6776
6801
|
this.moveInputBefore("TABLE", "CONDITION");
|
|
6777
6802
|
}
|
|
6778
6803
|
},
|
|
6804
|
+
updateShadow_: function() {
|
|
6805
|
+
if (this.isInsertionMarker()) return;
|
|
6806
|
+
this.getInput("EXTRA").setShadowDom(shadowOfListCreateV1());
|
|
6807
|
+
},
|
|
6779
6808
|
ensureBlocks_: function() {
|
|
6780
6809
|
if (this.isInsertionMarker()) return;
|
|
6781
6810
|
ensureTableBlock$1(this);
|
|
6782
6811
|
ensureConditionBlock$1(this);
|
|
6783
6812
|
ensureExtraBlock(this);
|
|
6813
|
+
ensureHandleBlock$1(this);
|
|
6814
|
+
},
|
|
6815
|
+
ensureBlocks2_: function() {
|
|
6816
|
+
if (this.isInsertionMarker()) return;
|
|
6784
6817
|
ensureParameterBlockV1s(this, [
|
|
6785
6818
|
[
|
|
6786
6819
|
"SUCCESS",
|
|
@@ -6807,25 +6840,24 @@ const QUERY_DATA_V1 = {
|
|
|
6807
6840
|
true
|
|
6808
6841
|
]
|
|
6809
6842
|
]);
|
|
6810
|
-
ensureHandleBlock$1(this);
|
|
6811
6843
|
}
|
|
6812
6844
|
};
|
|
6813
6845
|
Blocks.query_data_v1 = QUERY_DATA_V1;
|
|
6814
6846
|
javascriptGenerator.forBlock["query_data_v1"] = function(block) {
|
|
6815
|
-
const it = javascriptGenerator.INDENT;
|
|
6816
6847
|
return `{
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6848
|
+
var __tx__ = typeof __tx__ !== 'undefined' ? __tx__ : null;
|
|
6849
|
+
const __table__ = ${javascriptGenerator.valueToCode(block, "TABLE", Order.ATOMIC) || "null"};
|
|
6850
|
+
const __condition__ = ${javascriptGenerator.valueToCode(block, "CONDITION", Order.ATOMIC) || "null"};
|
|
6851
|
+
const __extra__ = ${javascriptGenerator.valueToCode(block, "EXTRA", Order.ATOMIC) || "null"};
|
|
6852
|
+
const {
|
|
6853
|
+
success: __success__,
|
|
6854
|
+
message: __message__,
|
|
6855
|
+
mainData: __mainData__,
|
|
6856
|
+
extraData: __extraData__
|
|
6857
|
+
} = __queryDataV1__(__tx__, __table__, __condition__, __extra__);
|
|
6858
|
+
if (__tx__ && !__success__) {
|
|
6859
|
+
throw __message__;
|
|
6860
|
+
}
|
|
6829
6861
|
${javascriptGenerator.statementToCode(block, "HANDLE")}}
|
|
6830
6862
|
`;
|
|
6831
6863
|
};
|
|
@@ -7319,49 +7351,48 @@ const TRANSACTION_V1 = {
|
|
|
7319
7351
|
};
|
|
7320
7352
|
Blocks.transaction_v1 = TRANSACTION_V1;
|
|
7321
7353
|
javascriptGenerator.forBlock["transaction_v1"] = function(blockBase) {
|
|
7322
|
-
const it = javascriptGenerator.INDENT;
|
|
7323
7354
|
const block = blockBase;
|
|
7324
7355
|
const depth = getBlockDepth(block);
|
|
7325
7356
|
const handle = javascriptGenerator.statementToCode(block, "HANDLE");
|
|
7326
7357
|
const finally_ = javascriptGenerator.statementToCode(block, "FINALLY");
|
|
7327
7358
|
return `{
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
${javascriptGenerator.prefixLines(handle,
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
${javascriptGenerator.prefixLines(finally_,
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7359
|
+
var __error${depth}__ = '';
|
|
7360
|
+
var __txExist${depth}__ = typeof(__tx__) !== 'undefined';
|
|
7361
|
+
var __tx__ = __txExist${depth}__ ? __tx__ : __txBeginV1__();
|
|
7362
|
+
var __spName${depth}__ = 'savePoint${depth}';
|
|
7363
|
+
try {
|
|
7364
|
+
if (!__tx__) {
|
|
7365
|
+
throw 'begin transaction failed';
|
|
7366
|
+
}
|
|
7367
|
+
if (__txExist${depth}__) {
|
|
7368
|
+
if (__txSavePointV1__(__tx__, __spName${depth}__)) {
|
|
7369
|
+
throw 'save point of transaction failed';
|
|
7370
|
+
}
|
|
7371
|
+
}
|
|
7372
|
+
${javascriptGenerator.prefixLines(handle, javascriptGenerator.INDENT)} } catch (__e__) {
|
|
7373
|
+
__error${depth}__ = __e__ ? __e__ : 'transaction interrupted';
|
|
7374
|
+
} finally {
|
|
7375
|
+
if (__txExist${depth}__) {
|
|
7376
|
+
if (__error${depth}__) {
|
|
7377
|
+
__txRollbackToV1__(__tx__, __spName${depth}__);
|
|
7378
|
+
}
|
|
7379
|
+
} else {
|
|
7380
|
+
if(__tx__) {
|
|
7381
|
+
if (__error${depth}__) {
|
|
7382
|
+
__txRollbackV1__(__tx__);
|
|
7383
|
+
} else {
|
|
7384
|
+
if (__txCommitV1__(__tx__)) {
|
|
7385
|
+
__error${depth}__ = 'commit transaction failed';
|
|
7386
|
+
}
|
|
7387
|
+
}
|
|
7388
|
+
}
|
|
7389
|
+
}
|
|
7390
|
+
var __success__ = !__error${depth}__;
|
|
7391
|
+
var __message__ = __error${depth}__ ? __error${depth}__ : 'success';
|
|
7392
|
+
${javascriptGenerator.prefixLines(finally_, javascriptGenerator.INDENT)} if (__txExist${depth}__ && __error${depth}__) {
|
|
7393
|
+
throw __error${depth}__;
|
|
7394
|
+
}
|
|
7395
|
+
}
|
|
7365
7396
|
}
|
|
7366
7397
|
`;
|
|
7367
7398
|
};
|
|
@@ -7756,12 +7787,13 @@ const UPDATE_DATA_V1 = {
|
|
|
7756
7787
|
this.setHelpUrl("%{BKY_DATA_V1_UPDATE_DATA_HELPURL}");
|
|
7757
7788
|
},
|
|
7758
7789
|
saveExtraState: function() {
|
|
7759
|
-
return {};
|
|
7790
|
+
return { create: !this.isInFlyout };
|
|
7760
7791
|
},
|
|
7761
|
-
loadExtraState: function() {
|
|
7792
|
+
loadExtraState: function(state) {
|
|
7762
7793
|
this.updateShape_();
|
|
7794
|
+
if (!state.create) this.ensureBlocks_();
|
|
7763
7795
|
setTimeout(() => {
|
|
7764
|
-
this.
|
|
7796
|
+
this.ensureBlocks2_();
|
|
7765
7797
|
}, 0);
|
|
7766
7798
|
},
|
|
7767
7799
|
updateShape_: function() {
|
|
@@ -7787,10 +7819,14 @@ const UPDATE_DATA_V1 = {
|
|
|
7787
7819
|
this.moveInputBefore("TABLE", "CONDITION");
|
|
7788
7820
|
}
|
|
7789
7821
|
},
|
|
7790
|
-
|
|
7822
|
+
ensureBlocks_: function() {
|
|
7791
7823
|
if (this.isInsertionMarker()) return;
|
|
7792
7824
|
ensureTableBlock(this);
|
|
7793
7825
|
ensureConditionBlock(this);
|
|
7826
|
+
ensureHandleBlock(this);
|
|
7827
|
+
},
|
|
7828
|
+
ensureBlocks2_: function() {
|
|
7829
|
+
if (this.isInsertionMarker()) return;
|
|
7794
7830
|
ensureParameterBlockV1s(this, [
|
|
7795
7831
|
[
|
|
7796
7832
|
"SUCCESS",
|
|
@@ -7811,23 +7847,22 @@ const UPDATE_DATA_V1 = {
|
|
|
7811
7847
|
true
|
|
7812
7848
|
]
|
|
7813
7849
|
]);
|
|
7814
|
-
ensureHandleBlock(this);
|
|
7815
7850
|
}
|
|
7816
7851
|
};
|
|
7817
7852
|
Blocks.update_data_v1 = UPDATE_DATA_V1;
|
|
7818
7853
|
javascriptGenerator.forBlock["update_data_v1"] = function(block) {
|
|
7819
|
-
const it = javascriptGenerator.INDENT;
|
|
7820
7854
|
return `{
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7855
|
+
var __tx__ = typeof __tx__ !== 'undefined' ? __tx__ : null;
|
|
7856
|
+
const __table__ = ${javascriptGenerator.valueToCode(block, "TABLE", Order.ATOMIC) || "null"};
|
|
7857
|
+
const __condition__ = ${javascriptGenerator.valueToCode(block, "CONDITION", Order.ATOMIC) || "null"};
|
|
7858
|
+
const {
|
|
7859
|
+
success: __success__,
|
|
7860
|
+
message: __message__,
|
|
7861
|
+
data: __data__
|
|
7862
|
+
} = __updateDataV1__(__tx__, __table__, __condition__);
|
|
7863
|
+
if (__tx__ && !__success__) {
|
|
7864
|
+
throw __message__;
|
|
7865
|
+
}
|
|
7831
7866
|
${javascriptGenerator.statementToCode(block, "HANDLE")}}
|
|
7832
7867
|
`;
|
|
7833
7868
|
};
|
|
@@ -8144,13 +8179,7 @@ const LIST_CREATE_V1 = {
|
|
|
8144
8179
|
else if (!this.itemCount_ && !this.getInput("EMPTY")) this.appendDummyInput("EMPTY").appendField("%{BKY_LIST_V1_CREATE_TITLE}");
|
|
8145
8180
|
for (let i = 0; i < this.itemCount_; i++) {
|
|
8146
8181
|
if (this.getInput("ADD" + i)) continue;
|
|
8147
|
-
this.appendValueInput("ADD" + i)
|
|
8148
|
-
"String",
|
|
8149
|
-
"Number",
|
|
8150
|
-
"Boolean",
|
|
8151
|
-
"Array",
|
|
8152
|
-
"Object"
|
|
8153
|
-
]);
|
|
8182
|
+
this.appendValueInput("ADD" + i);
|
|
8154
8183
|
if (i === 0) this.getInput("ADD" + i).setAlign(inputs.Align.RIGHT).appendField("%{BKY_LIST_V1_CREATE_TITLE}");
|
|
8155
8184
|
}
|
|
8156
8185
|
for (let i = this.itemCount_; this.getInput("ADD" + i); i++) this.removeInput("ADD" + i);
|
|
@@ -8911,7 +8940,6 @@ defineBlocksWithJsonArray([{
|
|
|
8911
8940
|
extensions: ["contextMenu_newGetVariableBlock_v1", "for_tooltip_v1"]
|
|
8912
8941
|
}]);
|
|
8913
8942
|
javascriptGenerator.forBlock["for_v1"] = function(block) {
|
|
8914
|
-
const it = javascriptGenerator.INDENT;
|
|
8915
8943
|
const variable = javascriptGenerator.getVariableName(block.getFieldValue("VAR"));
|
|
8916
8944
|
const from = javascriptGenerator.valueToCode(block, "FROM", Order.ASSIGNMENT) || "0";
|
|
8917
8945
|
const to = javascriptGenerator.valueToCode(block, "TO", Order.ASSIGNMENT) || "0";
|
|
@@ -8937,7 +8965,7 @@ javascriptGenerator.forBlock["for_v1"] = function(block) {
|
|
|
8937
8965
|
code += `var ${byVar} = `;
|
|
8938
8966
|
if (utils.string.isNumber(by)) code += `${Math.abs(Number(by))};\n`;
|
|
8939
8967
|
else code += `Math.abs(${by});\n`;
|
|
8940
|
-
code += `if (${fromVar} > ${toVar}) {\n${
|
|
8968
|
+
code += `if (${fromVar} > ${toVar}) {\n ${byVar} = -${byVar};\n}\n`;
|
|
8941
8969
|
code += `for (${variable} = ${fromVar}; ${byVar} >= 0 ? ${variable} <= ${toVar} : ${variable} >= ${toVar}; ${variable} += ${byVar}) {\n${handle}}\n`;
|
|
8942
8970
|
return code;
|
|
8943
8971
|
}
|
|
@@ -8970,7 +8998,6 @@ defineBlocksWithJsonArray([{
|
|
|
8970
8998
|
extensions: ["contextMenu_newGetVariableBlock_v1", "for_each_tooltip_v1"]
|
|
8971
8999
|
}]);
|
|
8972
9000
|
javascriptGenerator.forBlock["for_each_v1"] = function(block) {
|
|
8973
|
-
const it = javascriptGenerator.INDENT;
|
|
8974
9001
|
const variable = javascriptGenerator.getVariableName(block.getFieldValue("VAR"));
|
|
8975
9002
|
const list = javascriptGenerator.valueToCode(block, "LIST", Order.ASSIGNMENT) || "[]";
|
|
8976
9003
|
const handle = javascriptGenerator.addLoopTrap(javascriptGenerator.statementToCode(block, "DO"), block);
|
|
@@ -8982,7 +9009,7 @@ javascriptGenerator.forBlock["for_each_v1"] = function(block) {
|
|
|
8982
9009
|
}
|
|
8983
9010
|
const indexVar = javascriptGenerator.nameDB_.getDistinctName(`${variable}_index`, Names.NameType.VARIABLE);
|
|
8984
9011
|
code += `for (var ${indexVar} in ${listVar}) {
|
|
8985
|
-
${
|
|
9012
|
+
${variable} = ${listVar}[${indexVar}];
|
|
8986
9013
|
${handle}}\n`;
|
|
8987
9014
|
return code;
|
|
8988
9015
|
};
|
|
@@ -11892,10 +11919,8 @@ var item_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
11892
11919
|
const style = {
|
|
11893
11920
|
position: "relative",
|
|
11894
11921
|
background: mouseOver.value ? highlightColor.value : backgroundColor2.value,
|
|
11895
|
-
boxSizing: "border-box",
|
|
11896
11922
|
width: "100%",
|
|
11897
11923
|
height: "48px",
|
|
11898
|
-
marginTop: "1px",
|
|
11899
11924
|
userSelect: "none"
|
|
11900
11925
|
};
|
|
11901
11926
|
if (__props.select) {
|
|
@@ -12603,8 +12628,9 @@ function callFlowAvail() {
|
|
|
12603
12628
|
return getAllSpaceInfos$2("flow").length > 0;
|
|
12604
12629
|
}
|
|
12605
12630
|
function callback$2() {
|
|
12631
|
+
const { activeObject } = globalState.compute;
|
|
12606
12632
|
const root = [];
|
|
12607
|
-
if (
|
|
12633
|
+
if (activeObject.type === "flow") root.push(createBlock$1("on_flow_state_event_v1"));
|
|
12608
12634
|
if (callFlowAvail()) console.assert(true);
|
|
12609
12635
|
return root;
|
|
12610
12636
|
}
|
|
@@ -13243,18 +13269,18 @@ const compToolboxV1 = {
|
|
|
13243
13269
|
const flowToolboxV1 = {
|
|
13244
13270
|
kind: "categoryToolbox",
|
|
13245
13271
|
contents: [
|
|
13246
|
-
{
|
|
13247
|
-
kind: "category",
|
|
13248
|
-
name: "%{BKY_CATEGORY_FUNC}",
|
|
13249
|
-
categorystyle: "func_category",
|
|
13250
|
-
custom: computeFuncCategoryV1.name
|
|
13251
|
-
},
|
|
13252
13272
|
{
|
|
13253
13273
|
kind: "category",
|
|
13254
13274
|
name: "%{BKY_CATEGORY_FLOW}",
|
|
13255
13275
|
categorystyle: "flow_category",
|
|
13256
13276
|
custom: computeFlowCategoryV1.name
|
|
13257
13277
|
},
|
|
13278
|
+
{
|
|
13279
|
+
kind: "category",
|
|
13280
|
+
name: "%{BKY_CATEGORY_FUNC}",
|
|
13281
|
+
categorystyle: "func_category",
|
|
13282
|
+
custom: computeFuncCategoryV1.name
|
|
13283
|
+
},
|
|
13258
13284
|
{
|
|
13259
13285
|
kind: "category",
|
|
13260
13286
|
name: "%{BKY_CATEGORY_DATA}",
|
|
@@ -13980,7 +14006,7 @@ const install = (app) => {
|
|
|
13980
14006
|
//#region src/i18n/index.ts
|
|
13981
14007
|
async function loadLocaleMessageBlock(locale) {
|
|
13982
14008
|
if (locale === "en") return (await import("./i18n-en.d45d4c13.js").then((n) => n.t)).default;
|
|
13983
|
-
else if (locale === "zhHans") return (await import("./i18n-zhHans.
|
|
14009
|
+
else if (locale === "zhHans") return (await import("./i18n-zhHans.fjtgsqkm.js").then((n) => n.t)).default;
|
|
13984
14010
|
else throw new Error(`invalid locale=${locale}`);
|
|
13985
14011
|
}
|
|
13986
14012
|
|
|
@@ -50,7 +50,7 @@ var zhHans_default = {
|
|
|
50
50
|
CATEGORY_MISC: "杂项",
|
|
51
51
|
CATEGORY_OBJECT: "对象",
|
|
52
52
|
CATEGORY_PAGE: "页面",
|
|
53
|
-
CATEGORY_PROCEDURE: "
|
|
53
|
+
CATEGORY_PROCEDURE: "过程",
|
|
54
54
|
CATEGORY_RESOURCE: "资源",
|
|
55
55
|
CATEGORY_TEXT: "文本",
|
|
56
56
|
CATEGORY_TIME: "时间",
|
|
@@ -71,7 +71,7 @@ var zhHans_default = {
|
|
|
71
71
|
LABEL_METHOD: "方法",
|
|
72
72
|
LABEL_OBJECT: "对象",
|
|
73
73
|
LABEL_OPERATION: "操作",
|
|
74
|
-
LABEL_PROCEDURE: "
|
|
74
|
+
LABEL_PROCEDURE: "过程",
|
|
75
75
|
LABEL_PROPERTY: "属性",
|
|
76
76
|
LABEL_QUERY_EXTRA: "查询附加",
|
|
77
77
|
LABEL_SET: "设置",
|
|
@@ -222,7 +222,10 @@ var zhHans_default = {
|
|
|
222
222
|
COMPUTE_V1_COMPUTE_ENV_IS_TITLE: "环境是%1",
|
|
223
223
|
COMPUTE_V1_COMPUTE_ENV_IS_TOOLTIP: "COMPUTE_V1_COMPUTE_ENV_IS_TOOLTIP",
|
|
224
224
|
COMPUTE_V1_COMPUTE_ENV_IS_HELPURL: "COMPUTE_V1_COMPUTE_ENV_IS_HELPURL",
|
|
225
|
-
|
|
225
|
+
COMPUTE_V1_ON_FLOW_STATE_EVENT_TITLE: "状态事件",
|
|
226
|
+
COMPUTE_V1_ON_FLOW_STATE_EVENT_TOOLTIP: "COMPUTE_V1_ON_FLOW_STATE_EVENT_TOOLTIP",
|
|
227
|
+
COMPUTE_V1_ON_FLOW_STATE_EVENT_HELPURL: "COMPUTE_V1_ON_FLOW_STATE_EVENT_HELPURL",
|
|
228
|
+
COMPUTE_V1_SET_FUNC_OUTPUT_TITLE: "设置输出",
|
|
226
229
|
COMPUTE_V1_SET_FUNC_OUTPUT_TOOLTIP: "COMPUTE_V1_SET_FUNC_OUTPUT_TOOLTIP",
|
|
227
230
|
COMPUTE_V1_SET_FUNC_OUTPUT_HELPURL: "COMPUTE_V1_SET_FUNC_OUTPUT_HELPURL",
|
|
228
231
|
DATA_AS: "作为",
|
|
@@ -444,7 +447,7 @@ var zhHans_default = {
|
|
|
444
447
|
OBJECT_V1_TO_JSON_TITLE: "将对象%1转为JSON",
|
|
445
448
|
OBJECT_V1_TO_JSON_TOOLTIP: "OBJECT_V1_TO_JSON_TOOLTIP",
|
|
446
449
|
OBJECT_V1_TO_JSON_HELPURL: "OBJECT_V1_TO_JSON_HELPURL",
|
|
447
|
-
PROCEDURE_DEFAULT_NAME: "
|
|
450
|
+
PROCEDURE_DEFAULT_NAME: "过程",
|
|
448
451
|
PROCEDURE_RETURN: "返回",
|
|
449
452
|
PROCEDURE_WITH_RETURN: "带返回值",
|
|
450
453
|
PROCEDURE_V1_DEF_CONTAINER_TITLE: "带返回值",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-block-lib",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.6",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -36,26 +36,23 @@
|
|
|
36
36
|
"lodash-es": "^4.18.1",
|
|
37
37
|
"oxfmt": "^0.55.0",
|
|
38
38
|
"oxlint": "^1.70.0",
|
|
39
|
+
"picomatch": "^4.0.5",
|
|
39
40
|
"sass": "^1.101.0",
|
|
40
41
|
"tsdown": "^0.22.3",
|
|
41
42
|
"typescript": "^6.0.3",
|
|
42
43
|
"vite": "^8.0.16",
|
|
43
44
|
"vue-draggable-plus": "^0.6.1",
|
|
44
45
|
"x-config-lib": "^0.1.5",
|
|
45
|
-
"x-config-oxfmt": "^0.1.
|
|
46
|
-
"x-config-oxlint": "^0.1.
|
|
46
|
+
"x-config-oxfmt": "^0.1.5",
|
|
47
|
+
"x-config-oxlint": "^0.1.6"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"vue": "^3.5.38",
|
|
50
51
|
"vue-i18n": "^11.4.6",
|
|
51
52
|
"vuetify": "^4.1.2",
|
|
52
53
|
"x-error-lib": "^0.6.3",
|
|
53
|
-
"x-essential-lib": "^0.10.
|
|
54
|
+
"x-essential-lib": "^0.10.36",
|
|
54
55
|
"x-runtime-lib": "^0.10.2",
|
|
55
|
-
"x-state-lib": "^0.4.
|
|
56
|
-
},
|
|
57
|
-
"lint-staged": {
|
|
58
|
-
"*.{js,jsx,ts,tsx,vue}": "oxlint",
|
|
59
|
-
"*": "oxfmt --no-error-on-unmatched-pattern"
|
|
56
|
+
"x-state-lib": "^0.4.3"
|
|
60
57
|
}
|
|
61
58
|
}
|