@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.cjs
CHANGED
|
@@ -81,6 +81,7 @@ __export(src_exports, {
|
|
|
81
81
|
WidgetPackage: () => WidgetPackage,
|
|
82
82
|
WidgetParams: () => WidgetParams,
|
|
83
83
|
WidgetUrlUtils: () => WidgetUrlUtils,
|
|
84
|
+
getTextByLanguageCode: () => getTextByLanguageCode,
|
|
84
85
|
normalizeUrl: () => normalizeUrl,
|
|
85
86
|
parseQuery: () => parseQuery,
|
|
86
87
|
stringifyQuery: () => stringifyQuery
|
|
@@ -147,6 +148,7 @@ var Page = class {
|
|
|
147
148
|
description;
|
|
148
149
|
keywords;
|
|
149
150
|
security;
|
|
151
|
+
permissions;
|
|
150
152
|
/**
|
|
151
153
|
* 组件默认语言
|
|
152
154
|
*/
|
|
@@ -189,6 +191,7 @@ var Page = class {
|
|
|
189
191
|
this.path = options.path;
|
|
190
192
|
this.meta = options.meta ?? {};
|
|
191
193
|
this.security = options.security ?? false;
|
|
194
|
+
this.permissions = options.permissions ?? [];
|
|
192
195
|
}
|
|
193
196
|
/**
|
|
194
197
|
* 获取组件标题
|
|
@@ -237,10 +240,15 @@ var Widget = class extends Page {
|
|
|
237
240
|
* 配置页面路径,没有则不能修改
|
|
238
241
|
*/
|
|
239
242
|
configPagePath;
|
|
243
|
+
/**
|
|
244
|
+
* @deprecated
|
|
245
|
+
*/
|
|
246
|
+
routes;
|
|
240
247
|
constructor(options) {
|
|
241
248
|
super(options);
|
|
242
249
|
this.configPagePath = options.configPagePath;
|
|
243
250
|
this.supportDeployMode = options.supportDeployMode ?? 1 /* NORMAL */ | 16 /* OVERLAP */;
|
|
251
|
+
this.routes = options.routes ?? [];
|
|
244
252
|
}
|
|
245
253
|
static parseJSON(json) {
|
|
246
254
|
const object = JSON.parse(json);
|
|
@@ -1289,6 +1297,9 @@ var WidgetApiImpl = class extends BaseApi {
|
|
|
1289
1297
|
async openConfigPage(widgetId) {
|
|
1290
1298
|
return this.invokeMethod("openConfigPage", widgetId);
|
|
1291
1299
|
}
|
|
1300
|
+
async openConfigPageByName(widgetName) {
|
|
1301
|
+
return this.invokeMethod("openConfigPageByName", widgetName);
|
|
1302
|
+
}
|
|
1292
1303
|
async getWidgetPackages() {
|
|
1293
1304
|
return await this.invokeMethod("getWidgetPackages");
|
|
1294
1305
|
}
|
|
@@ -1389,16 +1400,19 @@ var WidgetDataApiImpl = class {
|
|
|
1389
1400
|
/**
|
|
1390
1401
|
* 保存组件数据
|
|
1391
1402
|
* @param data
|
|
1403
|
+
* @param options
|
|
1392
1404
|
*/
|
|
1393
|
-
async save(data) {
|
|
1405
|
+
async save(data, options = { sendBroadcast: true }) {
|
|
1394
1406
|
let store = this.getStore(data.name);
|
|
1395
1407
|
let json = JSON.stringify(data);
|
|
1396
1408
|
const result = await store.setItem(this.getKey(data.name, data.id), json);
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1409
|
+
if (options.sendBroadcast) {
|
|
1410
|
+
const broadcastEvent = new BroadcastEvent({
|
|
1411
|
+
event: "event::cn.widgetjs.core.widget.data-changed" /* DATA_CHANGED */,
|
|
1412
|
+
payload: { name: data.name, json }
|
|
1413
|
+
});
|
|
1414
|
+
await BroadcastApi.send(broadcastEvent);
|
|
1415
|
+
}
|
|
1402
1416
|
return result;
|
|
1403
1417
|
}
|
|
1404
1418
|
/**
|
|
@@ -1611,9 +1625,6 @@ var BrowserWindowApiImpl = class extends BaseApi {
|
|
|
1611
1625
|
if (options.alwaysOnTop) {
|
|
1612
1626
|
await this.setAlwaysOnTop(true);
|
|
1613
1627
|
}
|
|
1614
|
-
if (options.center) {
|
|
1615
|
-
await this.center();
|
|
1616
|
-
}
|
|
1617
1628
|
await this.setResizable(!!options.resizable);
|
|
1618
1629
|
await this.setMovable(!!options.movable);
|
|
1619
1630
|
if (options.width && options.height) {
|
|
@@ -1625,6 +1636,9 @@ var BrowserWindowApiImpl = class extends BaseApi {
|
|
|
1625
1636
|
if (options.maxWidth && options.maxHeight) {
|
|
1626
1637
|
await this.setMaximumSize(options.maxWidth, options.maxHeight);
|
|
1627
1638
|
}
|
|
1639
|
+
if (options.center) {
|
|
1640
|
+
await this.center();
|
|
1641
|
+
}
|
|
1628
1642
|
}
|
|
1629
1643
|
};
|
|
1630
1644
|
var BrowserWindowApi = new BrowserWindowApiImpl();
|
|
@@ -1991,7 +2005,7 @@ var LogApiImpl = class extends BaseApi {
|
|
|
1991
2005
|
}
|
|
1992
2006
|
json(data) {
|
|
1993
2007
|
const json = JSON.stringify(data, null, 2);
|
|
1994
|
-
this.
|
|
2008
|
+
this.log(json);
|
|
1995
2009
|
}
|
|
1996
2010
|
};
|
|
1997
2011
|
var LogApi = new LogApiImpl();
|
|
@@ -2060,6 +2074,7 @@ var FileApi = new FileApiImpl();
|
|
|
2060
2074
|
WidgetPackage,
|
|
2061
2075
|
WidgetParams,
|
|
2062
2076
|
WidgetUrlUtils,
|
|
2077
|
+
getTextByLanguageCode,
|
|
2063
2078
|
normalizeUrl,
|
|
2064
2079
|
parseQuery,
|
|
2065
2080
|
stringifyQuery
|