x-block-lib 0.4.40 → 0.4.42

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.
@@ -33,6 +33,8 @@ declare const _default: {
33
33
  CROSS_TAB_COPY: string;
34
34
  CROSS_TAB_PASTE: string;
35
35
  NO_OPTION: string;
36
+ BUTTON_NO_COMPUTE: string;
37
+ BUTTON_NO_TABLE: string;
36
38
  CATEGORY_CALC: string;
37
39
  CATEGORY_COLOR: string;
38
40
  CATEGORY_DATA: string;
@@ -47,8 +49,6 @@ declare const _default: {
47
49
  CATEGORY_TEXT: string;
48
50
  CATEGORY_TIME: string;
49
51
  CATEGORY_VARIABLE: string;
50
- DESC_NO_COMPUTE_GUIDE: string;
51
- DESC_NO_TABLE_GUIDE: string;
52
52
  LABEL_BOOLEAN: string;
53
53
  LABEL_CONDITION: string;
54
54
  LABEL_CREATE_VARIABLE: string;
@@ -33,6 +33,8 @@ declare const _default: {
33
33
  CROSS_TAB_COPY: string;
34
34
  CROSS_TAB_PASTE: string;
35
35
  NO_OPTION: string;
36
+ BUTTON_NO_COMPUTE: string;
37
+ BUTTON_NO_TABLE: string;
36
38
  CATEGORY_CALC: string;
37
39
  CATEGORY_COLOR: string;
38
40
  CATEGORY_DATA: string;
@@ -47,8 +49,6 @@ declare const _default: {
47
49
  CATEGORY_TEXT: string;
48
50
  CATEGORY_TIMER: string;
49
51
  CATEGORY_VARIABLE: string;
50
- DESC_NO_COMPUTE_GUIDE: string;
51
- DESC_NO_MODEL_GUIDE: string;
52
52
  LABEL_BOOLEAN: string;
53
53
  LABEL_CONDITION: string;
54
54
  LABEL_CREATE_VARIABLE: string;
@@ -9,13 +9,6 @@ export declare function getAppInfo(id: string): {
9
9
  id: string;
10
10
  name: string;
11
11
  sort: number;
12
- pages: {
13
- [pageid: string]: {
14
- id: string;
15
- name: string;
16
- sort: number;
17
- };
18
- };
19
12
  };
20
13
  export declare function genAppOpts(): Blockly.MenuOption[];
21
14
  interface PageInfo {
@@ -24,10 +17,11 @@ interface PageInfo {
24
17
  sort: number;
25
18
  }
26
19
  export declare function getAllPageInfos(appid: string): PageInfo[];
27
- export declare function getPageInfo(appid: string, id: string): {
20
+ export declare function getPageInfo(id: string): {
28
21
  id: string;
22
+ appid: string;
29
23
  name: string;
30
24
  sort: number;
31
- } | undefined;
25
+ };
32
26
  export declare function genPageOpts(appid: string): Blockly.MenuOption[];
33
27
  export {};
@@ -15,38 +15,9 @@ interface FuncInfo {
15
15
  sort: number;
16
16
  }
17
17
  export declare function getAllFuncInfos(spaceid: string): FuncInfo[];
18
- export declare function getFuncInfo(spaceid: string, id: string): {
19
- id: string;
20
- name: string;
21
- sort: number;
22
- dev: string;
23
- prod: string;
24
- inputs: {
25
- id: string;
26
- name: string;
27
- type: string;
28
- }[];
29
- outputs: {
30
- id: string;
31
- name: string;
32
- type: string;
33
- }[];
34
- } | undefined;
18
+ export declare function getFuncInfo(id: string): import("../../../state").Func;
35
19
  export declare function genFuncOpts(spaceid: string): Blockly.MenuOption[];
36
- export declare function getActiveFunc(): {
37
- id: string;
38
- name: string;
39
- inputs: {
40
- id: string;
41
- name: string;
42
- type: string;
43
- }[];
44
- outputs: {
45
- id: string;
46
- name: string;
47
- type: string;
48
- }[];
49
- };
20
+ export declare function getActiveFunc(): import("../../../state").ActiveFunc;
50
21
  export declare function getActiveFuncOutputInfo(id: string): {
51
22
  id: string;
52
23
  name: string;
@@ -5,36 +5,6 @@ interface SpaceInfo {
5
5
  sort: number;
6
6
  }
7
7
  export declare function getAllSpaceInfos(): SpaceInfo[];
8
- export declare function getSpaceInfo(id: string): {
9
- id: string;
10
- name: string;
11
- sort: number;
12
- funcs: {
13
- [funcid: string]: {
14
- id: string;
15
- name: string;
16
- sort: number;
17
- dev: string;
18
- prod: string;
19
- inputs: {
20
- id: string;
21
- name: string;
22
- type: string;
23
- }[];
24
- outputs: {
25
- id: string;
26
- name: string;
27
- type: string;
28
- }[];
29
- };
30
- };
31
- flows: {
32
- [flowid: string]: {
33
- id: string;
34
- name: string;
35
- sort: number;
36
- };
37
- };
38
- };
8
+ export declare function getSpaceInfo(id: string): import("../../../state").ComputeSpace;
39
9
  export declare function genSpaceOpts(): Blockly.MenuOption[];
40
10
  export {};
@@ -0,0 +1,10 @@
1
+ import * as Blockly from 'blockly/core';
2
+ interface SpaceInfo {
3
+ id: string;
4
+ name: string;
5
+ sort: number;
6
+ }
7
+ export declare function getAllSpaceInfos(): SpaceInfo[];
8
+ export declare function getSpaceInfo(id: string): import("../../../state").DataSpace;
9
+ export declare function genSpaceOpts(): Blockly.MenuOption[];
10
+ export {};
@@ -0,0 +1,21 @@
1
+ import * as Blockly from 'blockly/core';
2
+ interface TableInfo {
3
+ id: string;
4
+ name: string;
5
+ columns: {
6
+ id: string;
7
+ name: string;
8
+ type: string;
9
+ extend: string;
10
+ }[];
11
+ indexes: {
12
+ id: string;
13
+ columns: string[];
14
+ unique: boolean;
15
+ }[];
16
+ sort: number;
17
+ }
18
+ export declare function getAllTableInfos(spaceid: string): TableInfo[];
19
+ export declare function getTableInfo(id: string): import("../../../state").Table;
20
+ export declare function genTableOpts(spaceid: string): Blockly.MenuOption[];
21
+ export {};
package/dist/index.js CHANGED
@@ -1074,55 +1074,80 @@ function ur(e, t, n, o, i) {
1074
1074
  function _n(e, t) {
1075
1075
  return ur(e, t);
1076
1076
  }
1077
- const np = {
1078
- apps: {},
1079
- type: "page",
1080
- activePage: {
1081
- type: "common",
1082
- version: "",
1083
- nodes: {}
1084
- },
1085
- activeComp: {
1086
- type: "common",
1087
- version: "",
1088
- args: [],
1089
- nodes: {}
1090
- }
1091
- }, op = {
1092
- spaces: {},
1093
- type: "func",
1094
- activeFunc: {
1095
- id: "",
1096
- name: "",
1097
- inputs: [],
1098
- outputs: []
1099
- },
1100
- activeFlow: {
1101
- id: "",
1102
- name: ""
1103
- }
1104
- }, ip = {
1105
- spaces: {}
1106
- }, sp = {
1107
- spaces: {}
1108
- }, rp = {
1109
- props: {}
1110
- }, Le = function() {
1077
+ function np() {
1078
+ return {
1079
+ apps: {},
1080
+ pages: {},
1081
+ type: "page",
1082
+ activePage: {
1083
+ type: "common",
1084
+ version: "",
1085
+ nodes: {}
1086
+ },
1087
+ activeComp: {
1088
+ type: "common",
1089
+ version: "",
1090
+ args: [],
1091
+ nodes: {}
1092
+ }
1093
+ };
1094
+ }
1095
+ function op() {
1096
+ return {
1097
+ spaces: {},
1098
+ funcs: {},
1099
+ flows: {},
1100
+ type: "func",
1101
+ activeFunc: {
1102
+ id: "",
1103
+ name: "",
1104
+ inputs: [],
1105
+ outputs: []
1106
+ },
1107
+ activeFlow: {
1108
+ id: "",
1109
+ name: ""
1110
+ }
1111
+ };
1112
+ }
1113
+ function ip() {
1114
+ return {
1115
+ spaces: {},
1116
+ tables: {}
1117
+ };
1118
+ }
1119
+ function sp() {
1120
+ return {
1121
+ spaces: {}
1122
+ };
1123
+ }
1124
+ function rp() {
1125
+ return {
1126
+ props: {}
1127
+ };
1128
+ }
1129
+ const Le = function() {
1111
1130
  return window.blocklyState || (window.blocklyState = {
1112
- runtime: rp,
1113
- app: np,
1114
- compute: op,
1115
- data: ip,
1116
- resource: sp
1131
+ runtime: rp(),
1132
+ app: np(),
1133
+ compute: op(),
1134
+ data: ip(),
1135
+ resource: sp()
1117
1136
  }), window.blocklyState;
1118
1137
  }();
1119
1138
  function di() {
1120
- const { spaces: e } = Le.compute, t = [];
1121
- for (const n in e) {
1122
- const o = e[n];
1123
- t.push(o);
1139
+ const { spaces: e, funcs: t } = Le.compute, n = [];
1140
+ for (const o in e) {
1141
+ const i = e[o];
1142
+ let s = !1;
1143
+ for (const r in t)
1144
+ if (t[r].spaceid === o) {
1145
+ s = !0;
1146
+ break;
1147
+ }
1148
+ s && n.push(i);
1124
1149
  }
1125
- return t.sort((n, o) => n.sort - o.sort), t;
1150
+ return n.sort((o, i) => o.sort - i.sort), n;
1126
1151
  }
1127
1152
  function _r(e) {
1128
1153
  return Le.compute.spaces[e];
@@ -1134,19 +1159,15 @@ function pr() {
1134
1159
  }), ht(e);
1135
1160
  }
1136
1161
  function fi(e) {
1137
- const t = [], n = Le.compute.spaces[e];
1138
- if (!n)
1139
- return t;
1140
- for (const o in n.funcs) {
1141
- const i = n.funcs[o];
1142
- t.push(i);
1162
+ const { funcs: t } = Le.compute, n = [];
1163
+ for (const o in t) {
1164
+ const i = t[o];
1165
+ i.spaceid === e && n.push(i);
1143
1166
  }
1144
- return t.sort((o, i) => o.sort - i.sort), t;
1167
+ return n.sort((o, i) => o.sort - i.sort), n;
1145
1168
  }
1146
- function dr(e, t) {
1147
- const n = Le.compute.spaces[e];
1148
- if (n)
1149
- return n.funcs[t];
1169
+ function dr(e) {
1170
+ return Le.compute.funcs[e];
1150
1171
  }
1151
1172
  function fr(e) {
1152
1173
  const t = [];
@@ -1277,7 +1298,7 @@ const lp = {
1277
1298
  return;
1278
1299
  }
1279
1300
  e.name !== this.space.name && (this.space.name = e.name);
1280
- const t = dr(this.space.id, this.func.id);
1301
+ const t = dr(this.func.id);
1281
1302
  if (!t) {
1282
1303
  this.setWarningText(D.WARN_FUNC_NOT_AVAILABLE);
1283
1304
  return;
@@ -1421,7 +1442,7 @@ const cp = {
1421
1442
  return;
1422
1443
  }
1423
1444
  e.name !== this.space.name && (this.space.name = e.name);
1424
- const t = dr(this.space.id, this.func.id);
1445
+ const t = dr(this.func.id);
1425
1446
  if (!t) {
1426
1447
  this.setWarningText(D.WARN_FUNC_NOT_AVAILABLE);
1427
1448
  return;
@@ -1698,12 +1719,18 @@ c.forBlock.add_data_v1 = function(e) {
1698
1719
  `;
1699
1720
  };
1700
1721
  function jt() {
1701
- const e = [], { spaces: t } = Le.data;
1702
- for (const n in t) {
1703
- const o = t[n];
1704
- Object.keys(o.tables).length <= 0 || e.push(o);
1722
+ const e = [], { spaces: t, tables: n } = Le.data;
1723
+ for (const o in t) {
1724
+ const i = t[o];
1725
+ let s = !1;
1726
+ for (const r in n)
1727
+ if (n[r].spaceid === o) {
1728
+ s = !0;
1729
+ break;
1730
+ }
1731
+ s && e.push(i);
1705
1732
  }
1706
- return e.sort((n, o) => n.sort - o.sort), e;
1733
+ return e.sort((o, i) => o.sort - i.sort), e;
1707
1734
  }
1708
1735
  function ft(e) {
1709
1736
  return Le.data.spaces[e];
@@ -1715,19 +1742,15 @@ function lo() {
1715
1742
  }), ht(e);
1716
1743
  }
1717
1744
  function et(e) {
1718
- const t = [], n = Le.data.spaces[e];
1719
- if (!n)
1720
- return t;
1721
- for (const o in n.tables) {
1722
- const i = n.tables[o];
1723
- t.push(i);
1745
+ const { tables: t } = Le.data, n = [];
1746
+ for (const o in t) {
1747
+ const i = t[o];
1748
+ i.spaceid === e && n.push(i);
1724
1749
  }
1725
- return t.sort((o, i) => o.sort - i.sort), t;
1750
+ return n.sort((o, i) => o.sort - i.sort), n;
1726
1751
  }
1727
- function me(e, t) {
1728
- const n = Le.data.spaces[e];
1729
- if (n)
1730
- return n.tables[t];
1752
+ function me(e) {
1753
+ return Le.data.tables[e];
1731
1754
  }
1732
1755
  function co(e) {
1733
1756
  const t = [];
@@ -1809,7 +1832,7 @@ const dp = {
1809
1832
  return co(this.space.id);
1810
1833
  },
1811
1834
  genColumnOpts_: function() {
1812
- const e = [], t = me(this.space.id, this.table.id);
1835
+ const e = [], t = me(this.table.id);
1813
1836
  return t == null || t.columns.forEach((n) => {
1814
1837
  e.push([n.name, n.name]);
1815
1838
  }), ht(e);
@@ -1831,14 +1854,14 @@ const dp = {
1831
1854
  return;
1832
1855
  }
1833
1856
  let n = !1;
1834
- if (t.id !== this.space.id && (n = !0), this.space.id = t.id, this.space.name = t.name, this.getField("TABLE").getOptions(!1), n || !me(this.space.id, this.table.id)) {
1857
+ if (t.id !== this.space.id && (n = !0), this.space.id = t.id, this.space.name = t.name, this.getField("TABLE").getOptions(!1), n || !me(this.table.id)) {
1835
1858
  const s = (i = et(this.space.id)) == null ? void 0 : i[0];
1836
1859
  this.setFieldValue((s == null ? void 0 : s.name) ?? "", "COLUMN");
1837
1860
  }
1838
1861
  },
1839
1862
  onTableChange_: function(e) {
1840
1863
  var i;
1841
- const t = me(this.space.id, e);
1864
+ const t = me(e);
1842
1865
  if (!t) {
1843
1866
  console.assert(!1);
1844
1867
  return;
@@ -1847,7 +1870,7 @@ const dp = {
1847
1870
  t.id !== this.table.id && (n = !0), this.table.id = t.id, this.table.name = t.name, this.getField("COLUMN").getOptions(!1), n && this.setFieldValue(((i = t.columns) == null ? void 0 : i[0]) ?? "", "COLUMN");
1848
1871
  },
1849
1872
  onColumnChange_: function(e) {
1850
- const t = me(this.space.id, this.table.id);
1873
+ const t = me(this.table.id);
1851
1874
  if (!t) {
1852
1875
  console.assert(!1);
1853
1876
  return;
@@ -1866,7 +1889,7 @@ const dp = {
1866
1889
  return;
1867
1890
  }
1868
1891
  e.name !== this.space.name && (this.space.name = e.name);
1869
- const t = me(this.space.id, this.table.id);
1892
+ const t = me(this.table.id);
1870
1893
  if (!t) {
1871
1894
  this.setWarningText(D.WARN_TABLE_NOT_AVAILABLE);
1872
1895
  return;
@@ -2159,7 +2182,7 @@ const vp = {
2159
2182
  return co(this.space.id);
2160
2183
  },
2161
2184
  genColumnOpts_: function() {
2162
- const e = [], t = me(this.space.id, this.table.id);
2185
+ const e = [], t = me(this.table.id);
2163
2186
  return t == null || t.columns.forEach((n) => {
2164
2187
  e.push([n.name, n.name]);
2165
2188
  }), ht(e);
@@ -2192,13 +2215,13 @@ const vp = {
2192
2215
  return;
2193
2216
  }
2194
2217
  let n = !1;
2195
- if (t.id !== this.space.id && (n = !0), this.space.id = t.id, this.space.name = t.name, this.getField("TABLE").getOptions(!1), n || !me(this.space.id, this.table.id)) {
2218
+ if (t.id !== this.space.id && (n = !0), this.space.id = t.id, this.space.name = t.name, this.getField("TABLE").getOptions(!1), n || !me(this.table.id)) {
2196
2219
  const s = (i = et(this.space.id)) == null ? void 0 : i[0];
2197
2220
  s ? this.setFieldValue(s.id, "TABLE") : this.setFieldValue("", "TABLE");
2198
2221
  }
2199
2222
  },
2200
2223
  onTableChange_: function(e) {
2201
- const t = me(this.space.id, e);
2224
+ const t = me(e);
2202
2225
  if (!t) {
2203
2226
  console.assert(!1);
2204
2227
  return;
@@ -2273,7 +2296,7 @@ const vp = {
2273
2296
  return;
2274
2297
  }
2275
2298
  e.name !== this.space.name && (this.space.name = e.name);
2276
- const t = me(this.space.id, this.table.id);
2299
+ const t = me(this.table.id);
2277
2300
  if (!t) {
2278
2301
  this.setWarningText(D.WARN_TABLE_NOT_AVAILABLE);
2279
2302
  return;
@@ -2367,13 +2390,13 @@ const Ap = {
2367
2390
  return;
2368
2391
  }
2369
2392
  let n = !1;
2370
- if (t.id !== this.space.id && (n = !0), this.space.id = t.id, this.space.name = t.name, this.getField("TABLE").getOptions(!1), n || !me(this.space.id, this.table.id)) {
2393
+ if (t.id !== this.space.id && (n = !0), this.space.id = t.id, this.space.name = t.name, this.getField("TABLE").getOptions(!1), n || !me(this.table.id)) {
2371
2394
  const s = (i = et(this.space.id)) == null ? void 0 : i[0];
2372
2395
  s ? this.setFieldValue(s.id, "TABLE") : this.setFieldValue("", "TABLE");
2373
2396
  }
2374
2397
  },
2375
2398
  onTableChange_: function(e) {
2376
- const t = me(this.space.id, e);
2399
+ const t = me(e);
2377
2400
  if (!t) {
2378
2401
  console.assert(!1);
2379
2402
  return;
@@ -2387,7 +2410,7 @@ const Ap = {
2387
2410
  return;
2388
2411
  }
2389
2412
  e.name !== this.space.name && (this.space.name = e.name);
2390
- const t = me(this.space.id, this.table.id);
2413
+ const t = me(this.table.id);
2391
2414
  if (!t) {
2392
2415
  this.setWarningText(D.WARN_TABLE_NOT_AVAILABLE);
2393
2416
  return;
@@ -2466,7 +2489,7 @@ const Ip = {
2466
2489
  return co(this.space.id);
2467
2490
  },
2468
2491
  genColumnOpts_: function() {
2469
- const e = [], t = me(this.space.id, this.table.id);
2492
+ const e = [], t = me(this.table.id);
2470
2493
  return t == null || t.columns.forEach((n) => {
2471
2494
  e.push([n.name, n.name]);
2472
2495
  }), ht(e);
@@ -2490,13 +2513,13 @@ const Ip = {
2490
2513
  return;
2491
2514
  }
2492
2515
  let n = !1;
2493
- if (t.id !== this.space.id && (n = !0), this.space.id = t.id, this.space.name = t.name, this.getField("TABLE").getOptions(!1), n || !me(this.space.id, this.table.id)) {
2516
+ if (t.id !== this.space.id && (n = !0), this.space.id = t.id, this.space.name = t.name, this.getField("TABLE").getOptions(!1), n || !me(this.table.id)) {
2494
2517
  const s = (i = et(this.space.id)) == null ? void 0 : i[0];
2495
2518
  this.setFieldValue((s == null ? void 0 : s.id) ?? "", "TABLE");
2496
2519
  }
2497
2520
  },
2498
2521
  onTableChange_: function(e) {
2499
- const t = me(this.space.id, e);
2522
+ const t = me(e);
2500
2523
  if (!t) {
2501
2524
  console.assert(!1);
2502
2525
  return;
@@ -2572,7 +2595,7 @@ const Ip = {
2572
2595
  },
2573
2596
  updateCheck_: function() {
2574
2597
  var t;
2575
- const e = me(this.space.id, this.table.id);
2598
+ const e = me(this.table.id);
2576
2599
  for (let n = 0; n < this.itemCount_; n++) {
2577
2600
  let o = null;
2578
2601
  const i = this.getFieldValue("COLUMN" + n), s = e == null ? void 0 : e.columns.find((r) => r.name === i);
@@ -2600,7 +2623,7 @@ const Ip = {
2600
2623
  return;
2601
2624
  }
2602
2625
  e.name !== this.space.name && (this.space.name = e.name);
2603
- const t = me(this.space.id, this.table.id);
2626
+ const t = me(this.table.id);
2604
2627
  if (!t) {
2605
2628
  this.setWarningText(D.WARN_TABLE_NOT_AVAILABLE);
2606
2629
  return;
@@ -5579,7 +5602,7 @@ function nd() {
5579
5602
  }
5580
5603
  } else {
5581
5604
  const t = document.createElement("button");
5582
- t.setAttribute("text", D.DESC_NO_TABLE_GUIDE), t.setAttribute("callbackKey", "NO_TABLE"), e.push(t);
5605
+ t.setAttribute("text", D.BUTTON_NO_TABLE), t.setAttribute("callbackKey", "NO_TABLE"), e.push(t);
5583
5606
  }
5584
5607
  return e;
5585
5608
  }
@@ -5765,7 +5788,7 @@ const Tr = (e, t, n) => {
5765
5788
  });
5766
5789
  };
5767
5790
  async function rs(e) {
5768
- const t = await Tr(/* @__PURE__ */ Object.assign({ "./msg/en.ts": () => import("./msg-en-dlwi84yy.js"), "./msg/zhHans.ts": () => import("./msg-zhHans-60zrp0tu.js") }), `./msg/${e}.ts`, 3);
5791
+ const t = await Tr(/* @__PURE__ */ Object.assign({ "./msg/en.ts": () => import("./msg-en-b6f90zue.js"), "./msg/zhHans.ts": () => import("./msg-zhHans-db5w8qqg.js") }), `./msg/${e}.ts`, 3);
5769
5792
  Ca(t.default);
5770
5793
  }
5771
5794
  function mr(e) {
@@ -34,6 +34,9 @@ const _ = {
34
34
  CROSS_TAB_COPY: "Copy",
35
35
  CROSS_TAB_PASTE: "Paste",
36
36
  NO_OPTION: "No Option",
37
+ // button
38
+ BUTTON_NO_COMPUTE: "Please go to the layer of 'Compute' to create interface",
39
+ BUTTON_NO_TABLE: "Please go to the layer of 'Data' to create table",
37
40
  // category
38
41
  CATEGORY_CALC: "calc",
39
42
  CATEGORY_COLOR: "color",
@@ -49,9 +52,6 @@ const _ = {
49
52
  CATEGORY_TEXT: "text",
50
53
  CATEGORY_TIME: "time",
51
54
  CATEGORY_VARIABLE: "var",
52
- // desc
53
- DESC_NO_COMPUTE_GUIDE: "Please go to the layer of 'Compute' to create interface",
54
- DESC_NO_TABLE_GUIDE: "Please go to the layer of 'Data' to create table",
55
55
  // label
56
56
  LABEL_BOOLEAN: "Boolean",
57
57
  LABEL_CONDITION: "Condition",
@@ -34,6 +34,9 @@ const _ = {
34
34
  CROSS_TAB_COPY: "拷贝",
35
35
  CROSS_TAB_PASTE: "黏贴",
36
36
  NO_OPTION: "没有选项",
37
+ // button
38
+ BUTTON_NO_COMPUTE: "请到「计算」层创建接口",
39
+ BUTTON_NO_TABLE: "请到「数据」层创建表",
37
40
  // category
38
41
  CATEGORY_CALC: "计算",
39
42
  CATEGORY_COLOR: "颜色",
@@ -49,9 +52,6 @@ const _ = {
49
52
  CATEGORY_TEXT: "文本",
50
53
  CATEGORY_TIMER: "时间",
51
54
  CATEGORY_VARIABLE: "变量",
52
- // desc
53
- DESC_NO_COMPUTE_GUIDE: "请到「计算」层创建接口",
54
- DESC_NO_MODEL_GUIDE: "请到「数据」层创建表",
55
55
  // label
56
56
  LABEL_BOOLEAN: "布尔",
57
57
  LABEL_CONDITION: "条件",
@@ -4,13 +4,14 @@ export type App = {
4
4
  id: string;
5
5
  name: string;
6
6
  sort: number;
7
- pages: {
8
- [pageid: string]: {
9
- id: string;
10
- name: string;
11
- sort: number;
12
- };
13
- };
7
+ };
8
+ };
9
+ pages: {
10
+ [pageid: string]: {
11
+ id: string;
12
+ appid: string;
13
+ name: string;
14
+ sort: number;
14
15
  };
15
16
  };
16
17
  type: 'page' | 'comp';
@@ -44,4 +45,4 @@ export type App = {
44
45
  };
45
46
  };
46
47
  };
47
- export declare const initApp: App;
48
+ export declare function initApp(): App;
@@ -1,55 +1,62 @@
1
- export type Compute = {
2
- spaces: {
3
- [spaceid: string]: {
4
- id: string;
5
- name: string;
6
- sort: number;
7
- funcs: {
8
- [funcid: string]: {
9
- id: string;
10
- name: string;
11
- sort: number;
12
- dev: string;
13
- prod: string;
14
- inputs: {
15
- id: string;
16
- name: string;
17
- type: string;
18
- }[];
19
- outputs: {
20
- id: string;
21
- name: string;
22
- type: string;
23
- }[];
24
- };
25
- };
26
- flows: {
27
- [flowid: string]: {
28
- id: string;
29
- name: string;
30
- sort: number;
31
- };
32
- };
33
- };
34
- };
35
- type: 'func' | 'flow';
36
- activeFunc: {
1
+ export type ComputeSpace = {
2
+ id: string;
3
+ name: string;
4
+ sort: number;
5
+ };
6
+ export type Func = {
7
+ id: string;
8
+ spaceid: string;
9
+ name: string;
10
+ sort: number;
11
+ dev: string;
12
+ prod: string;
13
+ inputs: {
37
14
  id: string;
38
15
  name: string;
39
- inputs: {
40
- id: string;
41
- name: string;
42
- type: string;
43
- }[];
44
- outputs: {
45
- id: string;
46
- name: string;
47
- type: string;
48
- }[];
49
- };
50
- activeFlow: {
16
+ type: string;
17
+ }[];
18
+ outputs: {
19
+ id: string;
20
+ name: string;
21
+ type: string;
22
+ }[];
23
+ };
24
+ export type Flow = {
25
+ id: string;
26
+ spaceid: string;
27
+ name: string;
28
+ sort: number;
29
+ };
30
+ export type ActiveFunc = {
31
+ id: string;
32
+ name: string;
33
+ inputs: {
51
34
  id: string;
52
35
  name: string;
36
+ type: string;
37
+ }[];
38
+ outputs: {
39
+ id: string;
40
+ name: string;
41
+ type: string;
42
+ }[];
43
+ };
44
+ export type ActiveFlow = {
45
+ id: string;
46
+ name: string;
47
+ };
48
+ export type Compute = {
49
+ spaces: {
50
+ [spaceid: string]: ComputeSpace;
51
+ };
52
+ funcs: {
53
+ [funcid: string]: Func;
53
54
  };
55
+ flows: {
56
+ [flowid: string]: Flow;
57
+ };
58
+ type: 'func' | 'flow';
59
+ activeFunc: ActiveFunc;
60
+ activeFlow: ActiveFlow;
54
61
  };
55
- export declare const initCompute: Compute;
62
+ export declare function initCompute(): Compute;
@@ -1,30 +1,31 @@
1
+ export type DataSpace = {
2
+ id: string;
3
+ name: string;
4
+ sort: number;
5
+ };
6
+ export type Table = {
7
+ id: string;
8
+ spaceid: string;
9
+ name: string;
10
+ sort: number;
11
+ columns: {
12
+ id: string;
13
+ name: string;
14
+ type: string;
15
+ extend: string;
16
+ }[];
17
+ indexes: {
18
+ id: string;
19
+ columns: string[];
20
+ unique: boolean;
21
+ }[];
22
+ };
1
23
  export type Data = {
2
24
  spaces: {
3
- [spaceid: string]: {
4
- id: string;
5
- name: string;
6
- sort: number;
7
- tables: {
8
- [tableid: string]: {
9
- id: string;
10
- name: string;
11
- sort: number;
12
- columns: {
13
- id: string;
14
- name: string;
15
- type: string;
16
- extend: string;
17
- }[];
18
- indexes: {
19
- id: string;
20
- columns: string[];
21
- unique: boolean;
22
- }[];
23
- };
24
- };
25
- };
25
+ [spaceid: string]: DataSpace;
26
+ };
27
+ tables: {
28
+ [tableid: string]: Table;
26
29
  };
27
30
  };
28
- export declare const initData: {
29
- spaces: {};
30
- };
31
+ export declare function initData(): Data;
@@ -18,6 +18,4 @@ export type Resource = {
18
18
  };
19
19
  };
20
20
  };
21
- export declare const initResource: {
22
- spaces: {};
23
- };
21
+ export declare function initResource(): Resource;
@@ -9,6 +9,4 @@ export type Runtime = {
9
9
  };
10
10
  };
11
11
  };
12
- export declare const initRuntime: {
13
- props: {};
14
- };
12
+ export declare function initRuntime(): Runtime;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-block-lib",
3
3
  "private": false,
4
- "version": "0.4.40",
4
+ "version": "0.4.42",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -1,66 +0,0 @@
1
- import * as Blockly from 'blockly/core';
2
- interface SpaceInfo {
3
- id: string;
4
- name: string;
5
- sort: number;
6
- }
7
- export declare function getAllSpaceInfos(): SpaceInfo[];
8
- export declare function getSpaceInfo(id: string): {
9
- id: string;
10
- name: string;
11
- sort: number;
12
- tables: {
13
- [tableid: string]: {
14
- id: string;
15
- name: string;
16
- sort: number;
17
- columns: {
18
- id: string;
19
- name: string;
20
- type: string;
21
- extend: string;
22
- }[];
23
- indexes: {
24
- id: string;
25
- columns: string[];
26
- unique: boolean;
27
- }[];
28
- };
29
- };
30
- };
31
- export declare function genSpaceOpts(): Blockly.MenuOption[];
32
- interface TableInfo {
33
- id: string;
34
- name: string;
35
- columns: {
36
- id: string;
37
- name: string;
38
- type: string;
39
- extend: string;
40
- }[];
41
- indexes: {
42
- id: string;
43
- columns: string[];
44
- unique: boolean;
45
- }[];
46
- sort: number;
47
- }
48
- export declare function getAllTableInfos(spaceid: string): TableInfo[];
49
- export declare function getTableInfo(spaceid: string, id: string): {
50
- id: string;
51
- name: string;
52
- sort: number;
53
- columns: {
54
- id: string;
55
- name: string;
56
- type: string;
57
- extend: string;
58
- }[];
59
- indexes: {
60
- id: string;
61
- columns: string[];
62
- unique: boolean;
63
- }[];
64
- } | undefined;
65
- export declare function genTableOpts(spaceid: string): Blockly.MenuOption[];
66
- export {};