@meta2d/core 1.0.92 → 1.0.94-alpha.1
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/package.json +1 -1
- package/src/core.d.ts +1 -1
- package/src/core.js +23 -12
- package/src/core.js.map +1 -1
- package/src/theme.js +1 -1
- package/src/theme.js.map +1 -1
- package/src/utils/url.js +4 -4
- package/src/utils/url.js.map +1 -1
package/package.json
CHANGED
package/src/core.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ export declare class Meta2d {
|
|
|
73
73
|
setDatabyOptions(options?: Options): void;
|
|
74
74
|
private init;
|
|
75
75
|
initEventFns(): void;
|
|
76
|
-
getSendData(data: any[]): any;
|
|
76
|
+
getSendData(data: any[], cpen?: Pen): any;
|
|
77
77
|
convertType(value: string, type: string): string | number | boolean;
|
|
78
78
|
getEventData(list: any, pen: Pen): any;
|
|
79
79
|
message(options: MessageOptions): void;
|
package/src/core.js
CHANGED
|
@@ -460,7 +460,7 @@ export class Meta2d {
|
|
|
460
460
|
};
|
|
461
461
|
this.events[EventAction.SendData] = (pen, e) => {
|
|
462
462
|
if (e.data?.length) {
|
|
463
|
-
const value = this.getSendData(e.data);
|
|
463
|
+
const value = this.getSendData(e.data, pen);
|
|
464
464
|
if (pen.formId && pen.formData) {
|
|
465
465
|
//表单数据
|
|
466
466
|
Object.assign(value, pen.formData);
|
|
@@ -550,7 +550,7 @@ export class Meta2d {
|
|
|
550
550
|
});
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
|
-
getSendData(data) {
|
|
553
|
+
getSendData(data, cpen) {
|
|
554
554
|
const value = {};
|
|
555
555
|
data.forEach((item) => {
|
|
556
556
|
if (item.prop) {
|
|
@@ -564,7 +564,7 @@ export class Meta2d {
|
|
|
564
564
|
let keys = _value.match(/\$\{([^}]+)\}/g)?.map(m => m.slice(2, -1));
|
|
565
565
|
if (keys) {
|
|
566
566
|
keys.forEach((key) => {
|
|
567
|
-
_value = _value.replace(`\${${key}}`, this.getDynamicParam(key));
|
|
567
|
+
_value = _value.replace(`\${${key}}`, getter(cpen, key) || this.getDynamicParam(key));
|
|
568
568
|
});
|
|
569
569
|
}
|
|
570
570
|
value[item.prop] = _value;
|
|
@@ -731,11 +731,22 @@ export class Meta2d {
|
|
|
731
731
|
let params = undefined;
|
|
732
732
|
let url = network.url;
|
|
733
733
|
if (network.method === 'GET') {
|
|
734
|
-
|
|
735
|
-
'?'
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
734
|
+
if (Object.keys(value).length !== 0) {
|
|
735
|
+
if (url.includes('?')) {
|
|
736
|
+
params =
|
|
737
|
+
'&' +
|
|
738
|
+
Object.keys(value)
|
|
739
|
+
.map((key) => key + '=' + value[key])
|
|
740
|
+
.join('&');
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
params =
|
|
744
|
+
'?' +
|
|
745
|
+
Object.keys(value)
|
|
746
|
+
.map((key) => key + '=' + value[key])
|
|
747
|
+
.join('&');
|
|
748
|
+
}
|
|
749
|
+
}
|
|
739
750
|
}
|
|
740
751
|
// if (network.method === 'POST') {
|
|
741
752
|
if (url.indexOf('${') > -1) {
|
|
@@ -2634,7 +2645,7 @@ export class Meta2d {
|
|
|
2634
2645
|
const res = await fetch('/api/iot/app/mqtt', {
|
|
2635
2646
|
method: 'GET',
|
|
2636
2647
|
headers: {
|
|
2637
|
-
Authorization:
|
|
2648
|
+
Authorization: getToken(),
|
|
2638
2649
|
},
|
|
2639
2650
|
});
|
|
2640
2651
|
if (res.ok) {
|
|
@@ -2651,7 +2662,7 @@ export class Meta2d {
|
|
|
2651
2662
|
const res = await fetch('/api/iot/subscribe/properties', {
|
|
2652
2663
|
method: 'POST',
|
|
2653
2664
|
headers: {
|
|
2654
|
-
Authorization:
|
|
2665
|
+
Authorization: getToken(),
|
|
2655
2666
|
},
|
|
2656
2667
|
body: JSON.stringify({ devices: devices, type }),
|
|
2657
2668
|
});
|
|
@@ -2664,7 +2675,7 @@ export class Meta2d {
|
|
|
2664
2675
|
const ret = await fetch(`/api/iot/unsubscribe/properties`, {
|
|
2665
2676
|
method: 'POST',
|
|
2666
2677
|
headers: {
|
|
2667
|
-
Authorization:
|
|
2678
|
+
Authorization: getToken(),
|
|
2668
2679
|
},
|
|
2669
2680
|
body: JSON.stringify({ token }),
|
|
2670
2681
|
});
|
|
@@ -2689,7 +2700,7 @@ export class Meta2d {
|
|
|
2689
2700
|
const res = await fetch(`/api/iot/data/sql/${method}`, {
|
|
2690
2701
|
method: 'POST',
|
|
2691
2702
|
headers: {
|
|
2692
|
-
Authorization:
|
|
2703
|
+
Authorization: getToken(),
|
|
2693
2704
|
},
|
|
2694
2705
|
body: JSON.stringify({ dbId: sql.dbId || sql.dbid, sql: _sql, }),
|
|
2695
2706
|
});
|