jitz-sharepoint-utilities 2.0.5 → 2.0.7

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.
@@ -149,6 +149,25 @@ export default class List<T extends IModel> implements IList<T> {
149
149
  }
150
150
  }
151
151
 
152
+ getItemsIndexedRecursive = async (filter: string): Promise<T[]> => {
153
+ var results = await this.getItemsIndexed(filter);
154
+ var moreData: any[] = await this.continueFetch();
155
+ results = [...results, ...moreData];
156
+ return results;
157
+ };
158
+
159
+ continueFetch = async () => {
160
+ var data: any[] = [];
161
+ try {
162
+ data = await this.loadMoreIndexed();
163
+ if (this.lowerId > 0) {
164
+ var moreData: any[] = await this.continueFetch();
165
+ data = [...data, ...moreData];
166
+ }
167
+ } catch {}
168
+ return data;
169
+ };
170
+
152
171
  getData = async (filter: string): Promise<T[]> => {
153
172
  var expandFields = (
154
173
  [...this.lookUpFields, ...this.userTypeFields] || []
@@ -31,6 +31,7 @@ export interface IList<T extends IModel> {
31
31
  top?: number
32
32
  ): Promise<T[]>;
33
33
  loadMoreIndexed(): Promise<T[]>;
34
+ getItemsIndexedRecursive(filterQuery?: string): Promise<T[]>;
34
35
  _nextPageLink?: string;
35
36
  top: number;
36
37
  indexLimit: number;
@@ -22,6 +22,8 @@ export default class List<T extends IModel> implements IList<T> {
22
22
  loadMore: () => Promise<T[]>;
23
23
  getItemsIndexed: (filterQuery?: string, orderby?: string, top?: number) => Promise<T[]>;
24
24
  loadMoreIndexed(): Promise<T[]>;
25
+ getItemsIndexedRecursive: (filter: string) => Promise<T[]>;
26
+ continueFetch: () => Promise<any[]>;
25
27
  getData: (filter: string) => Promise<T[]>;
26
28
  private getLowerId;
27
29
  getItemById: (id: number) => Promise<T>;
@@ -140,6 +140,47 @@ var List = /** @class */ (function () {
140
140
  }
141
141
  });
142
142
  }); };
143
+ this.getItemsIndexedRecursive = function (filter) { return __awaiter(_this, void 0, void 0, function () {
144
+ var results, moreData;
145
+ return __generator(this, function (_a) {
146
+ switch (_a.label) {
147
+ case 0: return [4 /*yield*/, this.getItemsIndexed(filter)];
148
+ case 1:
149
+ results = _a.sent();
150
+ return [4 /*yield*/, this.continueFetch()];
151
+ case 2:
152
+ moreData = _a.sent();
153
+ results = __spreadArray(__spreadArray([], results, true), moreData, true);
154
+ return [2 /*return*/, results];
155
+ }
156
+ });
157
+ }); };
158
+ this.continueFetch = function () { return __awaiter(_this, void 0, void 0, function () {
159
+ var data, moreData, _a;
160
+ return __generator(this, function (_b) {
161
+ switch (_b.label) {
162
+ case 0:
163
+ data = [];
164
+ _b.label = 1;
165
+ case 1:
166
+ _b.trys.push([1, 5, , 6]);
167
+ return [4 /*yield*/, this.loadMoreIndexed()];
168
+ case 2:
169
+ data = _b.sent();
170
+ if (!(this.lowerId > 0)) return [3 /*break*/, 4];
171
+ return [4 /*yield*/, this.continueFetch()];
172
+ case 3:
173
+ moreData = _b.sent();
174
+ data = __spreadArray(__spreadArray([], data, true), moreData, true);
175
+ _b.label = 4;
176
+ case 4: return [3 /*break*/, 6];
177
+ case 5:
178
+ _a = _b.sent();
179
+ return [3 /*break*/, 6];
180
+ case 6: return [2 /*return*/, data];
181
+ }
182
+ });
183
+ }); };
143
184
  this.getData = function (filter) { return __awaiter(_this, void 0, void 0, function () {
144
185
  var expandFields, selectFields, response;
145
186
  return __generator(this, function (_a) {
@@ -15,6 +15,7 @@ export interface IList<T extends IModel> {
15
15
  delete(id: number): Promise<boolean>;
16
16
  getItemsIndexed(filterQuery?: string, orderby?: string, top?: number): Promise<T[]>;
17
17
  loadMoreIndexed(): Promise<T[]>;
18
+ getItemsIndexedRecursive(filterQuery?: string): Promise<T[]>;
18
19
  _nextPageLink?: string;
19
20
  top: number;
20
21
  indexLimit: number;
@@ -1,5 +1,5 @@
1
1
  export default class UtilityService {
2
- static setCookie: (name: string, val: string, validMinutes?: number) => void;
2
+ static setCookie: (name: string, val: string, validMilliSeconds?: number) => void;
3
3
  static getCookie: (name: string) => string | undefined;
4
4
  static deleteCookie: (name: string) => void;
5
5
  static formatDate: (date: Date) => string;
@@ -25,4 +25,5 @@ export default class UtilityService {
25
25
  static LightenDarkenColor: (col: string, amt: number) => string;
26
26
  static getProfilePictureUrl: (siteUrl: string, email: string, apiType?: string, size?: string) => string;
27
27
  static getRandomColorCode: () => string;
28
+ static transparentize(value: string, opacity: number): string;
28
29
  }
@@ -1,18 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var sp_core_library_1 = require("@microsoft/sp-core-library");
4
+ var color_1 = require("@kurkle/color");
4
5
  var XLSX = require("xlsx");
5
6
  var UtilityService = /** @class */ (function () {
6
7
  function UtilityService() {
7
8
  }
9
+ UtilityService.transparentize = function (value, opacity) {
10
+ var alpha = opacity === undefined ? 0.5 : 1 - opacity;
11
+ return (0, color_1.default)(value).alpha(alpha).rgbString();
12
+ };
8
13
  var _a;
9
14
  _a = UtilityService;
10
- UtilityService.setCookie = function (name, val, validMinutes) {
11
- if (validMinutes === void 0) { validMinutes = 604800000; }
15
+ UtilityService.setCookie = function (name, val, validMilliSeconds) {
16
+ if (validMilliSeconds === void 0) { validMilliSeconds = 604800000; }
12
17
  var date = new Date();
13
18
  var value = val;
14
19
  // Set it expire in 7 days
15
- date.setTime(date.getTime() + validMinutes);
20
+ date.setTime(date.getTime() + validMilliSeconds);
16
21
  // Set it
17
22
  document.cookie =
18
23
  name + "=" + value + "; expires=" + date.toUTCString() + "; path=/";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jitz-sharepoint-utilities",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "Essential SharePoint utilities for SharePoint Add-in and SPFx development",
5
5
  "author": "Jithendra Mani",
6
6
  "license": "ISC",
@@ -11,6 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@fluentui/react": "^8.106.4",
14
+ "@kurkle/color": "^0.3.4",
14
15
  "@microsoft/sp-core-library": "^1.19.0",
15
16
  "@microsoft/sp-lodash-subset": "^1.19.0",
16
17
  "@microsoft/sp-office-ui-fabric-core": "^1.19.0",