@widget-js/core 0.7.9 → 0.9.28
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.cjs +25 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1383 -1356
- package/dist/index.js +24 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -65,6 +65,7 @@ var Page = class {
|
|
|
65
65
|
description;
|
|
66
66
|
keywords;
|
|
67
67
|
security;
|
|
68
|
+
permissions;
|
|
68
69
|
/**
|
|
69
70
|
* 组件默认语言
|
|
70
71
|
*/
|
|
@@ -107,6 +108,7 @@ var Page = class {
|
|
|
107
108
|
this.path = options.path;
|
|
108
109
|
this.meta = options.meta ?? {};
|
|
109
110
|
this.security = options.security ?? false;
|
|
111
|
+
this.permissions = options.permissions ?? [];
|
|
110
112
|
}
|
|
111
113
|
/**
|
|
112
114
|
* 获取组件标题
|
|
@@ -155,10 +157,15 @@ var Widget = class extends Page {
|
|
|
155
157
|
* 配置页面路径,没有则不能修改
|
|
156
158
|
*/
|
|
157
159
|
configPagePath;
|
|
160
|
+
/**
|
|
161
|
+
* @deprecated
|
|
162
|
+
*/
|
|
163
|
+
routes;
|
|
158
164
|
constructor(options) {
|
|
159
165
|
super(options);
|
|
160
166
|
this.configPagePath = options.configPagePath;
|
|
161
167
|
this.supportDeployMode = options.supportDeployMode ?? 1 /* NORMAL */ | 16 /* OVERLAP */;
|
|
168
|
+
this.routes = options.routes ?? [];
|
|
162
169
|
}
|
|
163
170
|
static parseJSON(json) {
|
|
164
171
|
const object = JSON.parse(json);
|
|
@@ -1207,6 +1214,9 @@ var WidgetApiImpl = class extends BaseApi {
|
|
|
1207
1214
|
async openConfigPage(widgetId) {
|
|
1208
1215
|
return this.invokeMethod("openConfigPage", widgetId);
|
|
1209
1216
|
}
|
|
1217
|
+
async openConfigPageByName(widgetName) {
|
|
1218
|
+
return this.invokeMethod("openConfigPageByName", widgetName);
|
|
1219
|
+
}
|
|
1210
1220
|
async getWidgetPackages() {
|
|
1211
1221
|
return await this.invokeMethod("getWidgetPackages");
|
|
1212
1222
|
}
|
|
@@ -1307,16 +1317,19 @@ var WidgetDataApiImpl = class {
|
|
|
1307
1317
|
/**
|
|
1308
1318
|
* 保存组件数据
|
|
1309
1319
|
* @param data
|
|
1320
|
+
* @param options
|
|
1310
1321
|
*/
|
|
1311
|
-
async save(data) {
|
|
1322
|
+
async save(data, options = { sendBroadcast: true }) {
|
|
1312
1323
|
let store = this.getStore(data.name);
|
|
1313
1324
|
let json = JSON.stringify(data);
|
|
1314
1325
|
const result = await store.setItem(this.getKey(data.name, data.id), json);
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1326
|
+
if (options.sendBroadcast) {
|
|
1327
|
+
const broadcastEvent = new BroadcastEvent({
|
|
1328
|
+
event: "event::cn.widgetjs.core.widget.data-changed" /* DATA_CHANGED */,
|
|
1329
|
+
payload: { name: data.name, json }
|
|
1330
|
+
});
|
|
1331
|
+
await BroadcastApi.send(broadcastEvent);
|
|
1332
|
+
}
|
|
1320
1333
|
return result;
|
|
1321
1334
|
}
|
|
1322
1335
|
/**
|
|
@@ -1529,9 +1542,6 @@ var BrowserWindowApiImpl = class extends BaseApi {
|
|
|
1529
1542
|
if (options.alwaysOnTop) {
|
|
1530
1543
|
await this.setAlwaysOnTop(true);
|
|
1531
1544
|
}
|
|
1532
|
-
if (options.center) {
|
|
1533
|
-
await this.center();
|
|
1534
|
-
}
|
|
1535
1545
|
await this.setResizable(!!options.resizable);
|
|
1536
1546
|
await this.setMovable(!!options.movable);
|
|
1537
1547
|
if (options.width && options.height) {
|
|
@@ -1543,6 +1553,9 @@ var BrowserWindowApiImpl = class extends BaseApi {
|
|
|
1543
1553
|
if (options.maxWidth && options.maxHeight) {
|
|
1544
1554
|
await this.setMaximumSize(options.maxWidth, options.maxHeight);
|
|
1545
1555
|
}
|
|
1556
|
+
if (options.center) {
|
|
1557
|
+
await this.center();
|
|
1558
|
+
}
|
|
1546
1559
|
}
|
|
1547
1560
|
};
|
|
1548
1561
|
var BrowserWindowApi = new BrowserWindowApiImpl();
|
|
@@ -1909,7 +1922,7 @@ var LogApiImpl = class extends BaseApi {
|
|
|
1909
1922
|
}
|
|
1910
1923
|
json(data) {
|
|
1911
1924
|
const json = JSON.stringify(data, null, 2);
|
|
1912
|
-
this.
|
|
1925
|
+
this.log(json);
|
|
1913
1926
|
}
|
|
1914
1927
|
};
|
|
1915
1928
|
var LogApi = new LogApiImpl();
|
|
@@ -1977,6 +1990,7 @@ export {
|
|
|
1977
1990
|
WidgetPackage,
|
|
1978
1991
|
WidgetParams,
|
|
1979
1992
|
WidgetUrlUtils,
|
|
1993
|
+
getTextByLanguageCode,
|
|
1980
1994
|
normalizeUrl,
|
|
1981
1995
|
parseQuery,
|
|
1982
1996
|
stringifyQuery
|