@widget-js/core 0.7.6 → 0.7.9
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 +39 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +49 -13
- package/dist/index.js +39 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -146,6 +146,7 @@ var Page = class {
|
|
|
146
146
|
*/
|
|
147
147
|
description;
|
|
148
148
|
keywords;
|
|
149
|
+
security;
|
|
149
150
|
/**
|
|
150
151
|
* 组件默认语言
|
|
151
152
|
*/
|
|
@@ -170,8 +171,8 @@ var Page = class {
|
|
|
170
171
|
constructor(options) {
|
|
171
172
|
this.name = options.name;
|
|
172
173
|
this.title = options.title;
|
|
173
|
-
this.description = options.description;
|
|
174
|
-
this.keywords = options.keywords;
|
|
174
|
+
this.description = options.description ?? {};
|
|
175
|
+
this.keywords = options.keywords ?? [];
|
|
175
176
|
this.lang = options.lang;
|
|
176
177
|
this.width = options.width;
|
|
177
178
|
this.height = options.height;
|
|
@@ -187,6 +188,7 @@ var Page = class {
|
|
|
187
188
|
this.previewImage = options.previewImage;
|
|
188
189
|
this.path = options.path;
|
|
189
190
|
this.meta = options.meta ?? {};
|
|
191
|
+
this.security = options.security ?? false;
|
|
190
192
|
}
|
|
191
193
|
/**
|
|
192
194
|
* 获取组件标题
|
|
@@ -200,6 +202,8 @@ var Page = class {
|
|
|
200
202
|
* @param lang 语言环境,不传则获取默认标题
|
|
201
203
|
*/
|
|
202
204
|
getDescription(lang) {
|
|
205
|
+
if (this.description == void 0)
|
|
206
|
+
return void 0;
|
|
203
207
|
return getTextByLanguageCode(this.description, lang);
|
|
204
208
|
}
|
|
205
209
|
static parseJSON(json) {
|
|
@@ -272,6 +276,9 @@ var Widget = class extends Page {
|
|
|
272
276
|
isSupportNormal() {
|
|
273
277
|
return (this.supportDeployMode & 1 /* NORMAL */) > 0;
|
|
274
278
|
}
|
|
279
|
+
isConfigurable() {
|
|
280
|
+
return this.configPagePath != null && this.configPagePath != "";
|
|
281
|
+
}
|
|
275
282
|
};
|
|
276
283
|
var WidgetKeyword = /* @__PURE__ */ ((WidgetKeyword2) => {
|
|
277
284
|
WidgetKeyword2["RECOMMEND"] = "recommend";
|
|
@@ -1279,6 +1286,9 @@ var WidgetApiImpl = class extends BaseApi {
|
|
|
1279
1286
|
}
|
|
1280
1287
|
return widgets;
|
|
1281
1288
|
}
|
|
1289
|
+
async openConfigPage(widgetId) {
|
|
1290
|
+
return this.invokeMethod("openConfigPage", widgetId);
|
|
1291
|
+
}
|
|
1282
1292
|
async getWidgetPackages() {
|
|
1283
1293
|
return await this.invokeMethod("getWidgetPackages");
|
|
1284
1294
|
}
|
|
@@ -1597,6 +1607,25 @@ var BrowserWindowApiImpl = class extends BaseApi {
|
|
|
1597
1607
|
setZoomFactor(factor) {
|
|
1598
1608
|
return this.invokeMethod("setZoomFactor", factor);
|
|
1599
1609
|
}
|
|
1610
|
+
async setup(options) {
|
|
1611
|
+
if (options.alwaysOnTop) {
|
|
1612
|
+
await this.setAlwaysOnTop(true);
|
|
1613
|
+
}
|
|
1614
|
+
if (options.center) {
|
|
1615
|
+
await this.center();
|
|
1616
|
+
}
|
|
1617
|
+
await this.setResizable(!!options.resizable);
|
|
1618
|
+
await this.setMovable(!!options.movable);
|
|
1619
|
+
if (options.width && options.height) {
|
|
1620
|
+
await this.setSize(options.width, options.height);
|
|
1621
|
+
}
|
|
1622
|
+
if (options.minWidth && options.minHeight) {
|
|
1623
|
+
await this.setMinimumSize(options.minWidth, options.minHeight);
|
|
1624
|
+
}
|
|
1625
|
+
if (options.maxWidth && options.maxHeight) {
|
|
1626
|
+
await this.setMaximumSize(options.maxWidth, options.maxHeight);
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1600
1629
|
};
|
|
1601
1630
|
var BrowserWindowApi = new BrowserWindowApiImpl();
|
|
1602
1631
|
|
|
@@ -1711,7 +1740,7 @@ var NotificationApiImpl = class extends BaseApi {
|
|
|
1711
1740
|
};
|
|
1712
1741
|
var NotificationApi = new NotificationApiImpl();
|
|
1713
1742
|
|
|
1714
|
-
// src/api/
|
|
1743
|
+
// src/api/DeployedWidgetApi.ts
|
|
1715
1744
|
var DeployedWidgetApiImpl = class extends BaseApi {
|
|
1716
1745
|
getChannel() {
|
|
1717
1746
|
return "channel::cn.widgetjs.core.hosted_widget" /* HOSTED_WIDGET */;
|
|
@@ -1752,8 +1781,8 @@ var DeployedWidgetApiImpl = class extends BaseApi {
|
|
|
1752
1781
|
async openDevTools(widgetId) {
|
|
1753
1782
|
return this.invokeMethod("openDevTools", widgetId);
|
|
1754
1783
|
}
|
|
1755
|
-
async
|
|
1756
|
-
return this.invokeMethod("
|
|
1784
|
+
async openConfigPage(widgetId, params) {
|
|
1785
|
+
return this.invokeMethod("openConfigPage", widgetId, params);
|
|
1757
1786
|
}
|
|
1758
1787
|
/**
|
|
1759
1788
|
* 注册激活、呼出、置顶组件快捷键
|
|
@@ -1839,6 +1868,7 @@ var ShortcutApi = new ShortcutApiImpl();
|
|
|
1839
1868
|
var AppApiEvent = /* @__PURE__ */ ((AppApiEvent2) => {
|
|
1840
1869
|
AppApiEvent2["CONFIG_CHANGED"] = "event::cn.widgetjs.core.app.config.changed";
|
|
1841
1870
|
AppApiEvent2["MOVING_GRID_WINDOW"] = "event::cn.widgetjs.core.app.moving.grid.window";
|
|
1871
|
+
AppApiEvent2["STOP_MOVING_GRID_WINDOW"] = "event::cn.widgetjs.core.app.moving.grid.window.stop";
|
|
1842
1872
|
return AppApiEvent2;
|
|
1843
1873
|
})(AppApiEvent || {});
|
|
1844
1874
|
var AppApiConstants = /* @__PURE__ */ ((AppApiConstants2) => {
|
|
@@ -1959,6 +1989,10 @@ var LogApiImpl = class extends BaseApi {
|
|
|
1959
1989
|
console.log(...data);
|
|
1960
1990
|
this.invokeMethod("log", ...data);
|
|
1961
1991
|
}
|
|
1992
|
+
json(data) {
|
|
1993
|
+
const json = JSON.stringify(data, null, 2);
|
|
1994
|
+
this.invokeMethod("info", json);
|
|
1995
|
+
}
|
|
1962
1996
|
};
|
|
1963
1997
|
var LogApi = new LogApiImpl();
|
|
1964
1998
|
|