@ichicraft/widgets-widget-base 1.13.1 → 1.14.0
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/README.md +6 -0
- package/lib/BaseWidget.d.ts +1 -1
- package/lib/BaseWidget.js +1 -4
- package/lib/index.js +2 -23
- package/lib/types/index.d.ts +7 -2
- package/lib/types/index.js +8 -11
- package/lib/utils/ConfigurationHelper.js +1 -5
- package/lib/utils/UserHelper.js +5 -9
- package/lib/utils/index.js +2 -18
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -9,6 +9,12 @@ All notable changes to this project will be documented here.
|
|
|
9
9
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
10
10
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
11
11
|
|
|
12
|
+
## 1.14.0 - 2025-05-21
|
|
13
|
+
- Version bumped `@microsoft/sp-http` dependency to latest SPFx version `1.21.1`
|
|
14
|
+
|
|
15
|
+
## 1.13.2 - 2025-04-11
|
|
16
|
+
- Minor update in documentation of `WebApiPermissionRequest` interface
|
|
17
|
+
|
|
12
18
|
## 1.13.1 - 2025-03-11
|
|
13
19
|
- Added new interface `ICSite`, used to represent a SharePoint site object in code
|
|
14
20
|
|
package/lib/BaseWidget.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExportData, ValidationResult, WidgetContext } from './types';
|
|
2
2
|
export default abstract class BaseWidget {
|
|
3
3
|
protected readonly context: WidgetContext;
|
|
4
4
|
constructor(context: WidgetContext);
|
package/lib/BaseWidget.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.BaseWidget = void 0;
|
|
21
|
-
var BaseWidget_1 = require("./BaseWidget");
|
|
22
|
-
Object.defineProperty(exports, "BaseWidget", { enumerable: true, get: function () { return __importDefault(BaseWidget_1).default; } });
|
|
23
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
export { default as BaseWidget } from './BaseWidget';
|
|
2
|
+
export * from './types';
|
package/lib/types/index.d.ts
CHANGED
|
@@ -457,11 +457,16 @@ export interface WidgetResource {
|
|
|
457
457
|
}
|
|
458
458
|
export interface WebApiPermissionRequest {
|
|
459
459
|
/**
|
|
460
|
-
* Specifies the name of the
|
|
460
|
+
* Specifies the name of the API to which access has to be granted.
|
|
461
|
+
* This can be something like "Microsoft Graph" or "Power BI Service" and is the same
|
|
462
|
+
* as what's used in the package-solution file in an SPPKG package.
|
|
461
463
|
*/
|
|
462
464
|
resource: string;
|
|
463
465
|
/**
|
|
464
|
-
* Specifies the name of
|
|
466
|
+
* Specifies the name of one scope claim that the resource application
|
|
467
|
+
* should expect in the OAuth 2.0 access token.
|
|
468
|
+
* This can be something like "User.Read.All" (for Graph) or "Report.Read.All" (for Power BI) and is the same
|
|
469
|
+
* as what's used in the package-solution file in an SPPKG package.
|
|
465
470
|
*/
|
|
466
471
|
scope: string;
|
|
467
472
|
}
|
package/lib/types/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CommandBarItemType = exports.CustomCommandBarItemSeverity = exports.ICPersonaType = exports.DebugComponentType = void 0;
|
|
4
|
-
var DebugComponentType;
|
|
1
|
+
export var DebugComponentType;
|
|
5
2
|
(function (DebugComponentType) {
|
|
6
3
|
/**
|
|
7
4
|
* This is the default component type and just opens the default widget board.
|
|
@@ -12,29 +9,29 @@ var DebugComponentType;
|
|
|
12
9
|
* dialog of the widget you're working on
|
|
13
10
|
*/
|
|
14
11
|
DebugComponentType["AdminConfig"] = "AdminConfig";
|
|
15
|
-
})(DebugComponentType || (
|
|
16
|
-
var ICPersonaType;
|
|
12
|
+
})(DebugComponentType || (DebugComponentType = {}));
|
|
13
|
+
export var ICPersonaType;
|
|
17
14
|
(function (ICPersonaType) {
|
|
18
15
|
ICPersonaType[ICPersonaType["User"] = 0] = "User";
|
|
19
16
|
ICPersonaType[ICPersonaType["SPGroup"] = 1] = "SPGroup";
|
|
20
17
|
ICPersonaType[ICPersonaType["Other"] = 2] = "Other";
|
|
21
18
|
ICPersonaType[ICPersonaType["Custom"] = 3] = "Custom";
|
|
22
|
-
})(ICPersonaType || (
|
|
19
|
+
})(ICPersonaType || (ICPersonaType = {}));
|
|
23
20
|
/**
|
|
24
21
|
* Tells the severity of the command bar item, resulting in
|
|
25
22
|
* distinguishable presentation of the item
|
|
26
23
|
*/
|
|
27
|
-
var CustomCommandBarItemSeverity;
|
|
24
|
+
export var CustomCommandBarItemSeverity;
|
|
28
25
|
(function (CustomCommandBarItemSeverity) {
|
|
29
26
|
/** Normal severity, displays just like all the other command bar items */
|
|
30
27
|
CustomCommandBarItemSeverity[CustomCommandBarItemSeverity["Normal"] = 0] = "Normal";
|
|
31
28
|
/** Warning severity, displays the item with a more noticable warning color */
|
|
32
29
|
CustomCommandBarItemSeverity[CustomCommandBarItemSeverity["Warning"] = 1] = "Warning";
|
|
33
|
-
})(CustomCommandBarItemSeverity || (
|
|
30
|
+
})(CustomCommandBarItemSeverity || (CustomCommandBarItemSeverity = {}));
|
|
34
31
|
/**
|
|
35
32
|
* Tells how to render the command bar item, e.g. as an icon button or as a link.
|
|
36
33
|
*/
|
|
37
|
-
var CommandBarItemType;
|
|
34
|
+
export var CommandBarItemType;
|
|
38
35
|
(function (CommandBarItemType) {
|
|
39
36
|
/** Renders the item as an Icon */
|
|
40
37
|
CommandBarItemType["Icon"] = "icon";
|
|
@@ -44,4 +41,4 @@ var CommandBarItemType;
|
|
|
44
41
|
CommandBarItemType["SearchBar"] = "search-bar";
|
|
45
42
|
/** Renders the item in the overflow menu */
|
|
46
43
|
CommandBarItemType["Overflow"] = "overflow";
|
|
47
|
-
})(CommandBarItemType || (
|
|
44
|
+
})(CommandBarItemType || (CommandBarItemType = {}));
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConfigurationHelper = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @class
|
|
6
3
|
* Helper class for Configuration related things.
|
|
7
4
|
*/
|
|
8
|
-
class ConfigurationHelper {
|
|
5
|
+
export class ConfigurationHelper {
|
|
9
6
|
/**
|
|
10
7
|
*
|
|
11
8
|
* @param config The serialized configuration to parse into an object
|
|
@@ -19,4 +16,3 @@ class ConfigurationHelper {
|
|
|
19
16
|
return JSON.stringify(config);
|
|
20
17
|
}
|
|
21
18
|
}
|
|
22
|
-
exports.ConfigurationHelper = ConfigurationHelper;
|
package/lib/utils/UserHelper.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,28 +7,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
exports.UserHelper = void 0;
|
|
13
|
-
const types_1 = require("../types");
|
|
10
|
+
import { ICPersonaType } from '../types';
|
|
14
11
|
/**
|
|
15
12
|
* @class
|
|
16
13
|
* Helper class for User related methods.
|
|
17
14
|
*/
|
|
18
|
-
class UserHelper {
|
|
15
|
+
export class UserHelper {
|
|
19
16
|
static isCurrentUserInScope(personas, context) {
|
|
20
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
18
|
let userIsPartOfThis = false;
|
|
22
19
|
for (let i = 0; i < personas.length; i++) {
|
|
23
20
|
const personaItem = personas[i];
|
|
24
21
|
switch (personaItem.type) {
|
|
25
|
-
case
|
|
22
|
+
case ICPersonaType.SPGroup: {
|
|
26
23
|
const userIsMemberOfSPGroup = yield context.isCurrentUserMemberOfSPGroup(Number.parseInt(personaItem.id));
|
|
27
24
|
if (userIsMemberOfSPGroup) {
|
|
28
25
|
userIsPartOfThis = true;
|
|
29
26
|
}
|
|
30
27
|
break;
|
|
31
28
|
}
|
|
32
|
-
case
|
|
29
|
+
case ICPersonaType.User: {
|
|
33
30
|
// handle a username exact match and partial match in case picker is in format 'i:0#.f|membership|USERNAME'
|
|
34
31
|
if (personaItem.id.toLowerCase() === context.userName.toLowerCase() ||
|
|
35
32
|
personaItem.id.toLowerCase() ===
|
|
@@ -42,7 +39,7 @@ class UserHelper {
|
|
|
42
39
|
}
|
|
43
40
|
break;
|
|
44
41
|
}
|
|
45
|
-
case
|
|
42
|
+
case ICPersonaType.Other:
|
|
46
43
|
case null: {
|
|
47
44
|
let personaItemId = personaItem.id;
|
|
48
45
|
// Check if this is the infamous "Everyone except external users" group,
|
|
@@ -94,4 +91,3 @@ class UserHelper {
|
|
|
94
91
|
return personas;
|
|
95
92
|
}
|
|
96
93
|
}
|
|
97
|
-
exports.UserHelper = UserHelper;
|
package/lib/utils/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ConfigurationHelper"), exports);
|
|
18
|
-
__exportStar(require("./UserHelper"), exports);
|
|
1
|
+
export * from './ConfigurationHelper';
|
|
2
|
+
export * from './UserHelper';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichicraft/widgets-widget-base",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "Part of the Widget Development Kit for building widgets for Ichicraft Boards",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -22,10 +22,17 @@
|
|
|
22
22
|
"requirejs": "2.3.7"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@microsoft/sp-http": "1.
|
|
25
|
+
"@microsoft/sp-http": "1.21.1",
|
|
26
26
|
"@pnp/sp": "4.0.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"
|
|
29
|
+
"@ianvs/prettier-plugin-sort-imports": "4.4.1",
|
|
30
|
+
"eslint": "8.57.0",
|
|
31
|
+
"eslint-config-prettier": "9.1.0",
|
|
32
|
+
"eslint-plugin-prettier": "5.2.1",
|
|
33
|
+
"eslint-plugin-react": "7.35.2",
|
|
34
|
+
"eslint-plugin-react-hooks": "4.6.2",
|
|
35
|
+
"prettier": "3.3.3",
|
|
36
|
+
"typescript": "~5.3.3"
|
|
30
37
|
}
|
|
31
38
|
}
|