Merge pull request #1522 from jerryyasir/spfxwebpart-worldclock

This commit is contained in:
Hugo Bernier 2020-10-02 02:23:14 -04:00 committed by GitHub
commit 07aa31e225
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 108539 additions and 0 deletions

View File

@ -0,0 +1,75 @@
# World Clocks Web Part
## Summary
- This sample is extension of the single World time clock sample that was provided in SP Starter Kit.
- This web part use SharePoint List to Show multiple Clocks.
- Each clock item can have Name, Timezone and status (Active, Yes/No).
- The web part properties will allow you to enter Web Part Title and select a List.
- The web part properties will allow you to show or hide time.
- You can show or hide clocks by setting the status to active or inactive.
- The web part does not update automatically. [Someone need to make the React Tick :)]
![Web Part](./assets/WebPart.png)
### Web Part in Action
![Web Part in Action](./assets/ClocksInAction.gif)
### Usage
**1) Create or use a list for World Clocks. The List should have the following Columns:**
- Title, GMTValues, ListOrder, IsActive.
![Create list for use with the World Clocks](./assets/WorldClockList.png)
- [World Clocks list Template for use with the Web Part](./assets/WorldClock.stp)
- [World Clocks Site Script use with the Web Part](./assets/WorldClock.json)
**2) Add the World Clocks web part to your page & Enter Title, Select List. You can also enable the other required settings.**
## Used SharePoint Framework Version
![SPFx 1.11.0](https://img.shields.io/badge/version-1.11.0-green.svg)
## Applies to
- [SharePoint Framework](https://docs.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview)
- [Office 365 tenant](https://docs.microsoft.com/sharepoint/dev/spfx/set-up-your-development-environment)
## Prerequisites
- A package is available for direct download.
Please create the list as described above
## Solution
| Solution | Author(s) |
| --------------------- | ---------------------------------------- |
| World Clocks Web Part | [Jerry Yasir](https://github.com/jyasir) |
## Version history
| Version | Date | Comments |
| ------- | ------------------ | ------------- |
| 1.0 | September 26, 2020 | First Version |
## Disclaimer
**THIS CODE IS PROVIDED _AS IS_ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
---
## Minimal Path to Awesome
- Clone or download this repository
- Run in command line:
- `npm install` to install the npm dependencies
- `gulp serve` to display in Developer Workbench (recommend using your tenant workbench so you can test with real lists within your site)
- To package and deploy:
- Use `gulp bundle --ship` & `gulp package-solution --ship`
- Add the `.sppkg` to your SharePoint App Catalog
<img src="https://telemetry.sharepointpnp.com/sp-dev-fx-webparts/samples/react-world-clocks" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

View File

@ -0,0 +1,20 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"world-clock-web-part-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/worldClockWebPart/WorldClockWebPartWebPart.js",
"manifest": "./src/webparts/worldClockWebPart/WorldClockWebPartWebPart.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"WorldClockWebPartWebPartStrings": "lib/webparts/worldClockWebPart/loc/{locale}.js",
"ControlStrings": "node_modules/@pnp/spfx-controls-react/lib/loc/{locale}.js",
"PropertyControlStrings": "node_modules/@pnp/spfx-property-controls/lib/loc/{locale}.js"
}
}

View File

@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
"deployCdnPath": "temp/deploy"
}

View File

@ -0,0 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"workingDir": "./temp/deploy/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "world-clock",
"accessKey": "<!-- ACCESS KEY -->"
}

View File

@ -0,0 +1,21 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "world-clocks-client-side-solution",
"id": "a6191c45-b01b-4158-8ca0-f86497d79df5",
"version": "1.0.0.1",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"developer": {
"name": "Jerry Yasr",
"websiteUrl": "https://jerryyasir.com",
"privacyUrl": "https://jerryyasir.com",
"termsOfUseUrl": "https://jerryyasir.com",
"mpnId": ""
}
},
"paths": {
"zippedPackage": "solution/world-clocks.sppkg"
}
}

View File

@ -0,0 +1,10 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://localhost:5432/workbench",
"api": {
"port": 5432,
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
}
}

View File

@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
}

View File

@ -0,0 +1,81 @@
{
"id": "6baae7a7-af13-40d3-9567-f3bca9986248",
"alias": "WorldClockWebPartWebPart",
"componentType": "WebPart",
"version": "0.0.1",
"manifestVersion": 2,
"requiresCustomScript": false,
"supportedHosts": [
"SharePointWebPart"
],
"preconfiguredEntries": [
{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70",
"group": {
"default": "Other"
},
"title": {
"default": "World Clocks"
},
"description": {
"default": "World Clocks Web Part"
},
"officeFabricIconFontName": "Clock",
"properties": {
"description": "World Clocks WebPart"
}
}
],
"loaderConfig": {
"entryModuleId": "world-clock-web-part-web-part",
"internalModuleBaseUrls": [
"https://localhost:4321/"
],
"scriptResources": {
"world-clock-web-part-web-part": {
"type": "path",
"path": "dist/world-clock-web-part-web-part.js"
},
"WorldClockWebPartWebPartStrings": {
"defaultPath": "lib/webparts/worldClockWebPart/loc/en-us.js",
"type": "localizedPath"
},
"ControlStrings": {
"defaultPath": "node_modules/@pnp/spfx-controls-react/lib/loc/en-us.js",
"type": "localizedPath"
},
"@microsoft/sp-property-pane": {
"type": "component",
"version": "1.11.0",
"id": "f9e737b7-f0df-4597-ba8c-3060f82380db"
},
"@microsoft/sp-core-library": {
"type": "component",
"version": "1.11.0",
"id": "7263c7d0-1d6a-45ec-8d85-d4d1d234171b"
},
"@microsoft/sp-webpart-base": {
"type": "component",
"version": "1.11.0",
"id": "974a7777-0990-4136-8fa6-95d80114c2e0"
},
"react": {
"type": "component",
"version": "16.8.5",
"id": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"failoverPath": "../../../../users/hugoa/onedrive/github/sp-dev-fx-webparts/samples/react-world-clocks/node_modules/react/dist/react.js"
},
"react-dom": {
"type": "component",
"version": "16.8.5",
"id": "aa0a46ec-1505-43cd-a44a-93f3a5aa460a",
"failoverPath": "../../../../users/hugoa/onedrive/github/sp-dev-fx-webparts/samples/react-world-clocks/node_modules/react-dom/dist/react-dom.js"
},
"@microsoft/sp-http": {
"type": "component",
"version": "1.11.0",
"id": "c07208f0-ea3b-4c1a-9965-ac1b825211a6"
}
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

29
samples/react-world-clocks/gulpfile.js vendored Normal file
View File

@ -0,0 +1,29 @@
'use strict';
// check if gulp dist was called
if (process.argv.indexOf('dist') !== -1) {
// add ship options to command call
process.argv.push('--ship');
}
const path = require('path');
const gulp = require('gulp');
const build = require('@microsoft/sp-build-web');
const gulpSequence = require('gulp-sequence');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
// Create clean distrubution package
gulp.task('dist', gulpSequence('clean', 'bundle', 'package-solution'));
// Create clean development package
gulp.task('dev', gulpSequence('clean', 'bundle', 'package-solution'));
/**
* Custom Framework Specific gulp tasks
*/
build.initialize(gulp);

View File

@ -0,0 +1 @@
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,2 @@
// A file is required to be in the root of the /src directory by the TypeScript compiler
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wFAAwF"}

View File

@ -0,0 +1,19 @@
import { Version } from "@microsoft/sp-core-library";
import { BaseClientSideWebPart } from "@microsoft/sp-webpart-base";
import { IPropertyPaneConfiguration } from "@microsoft/sp-property-pane";
export interface IWorldClockWebPartWebPartProps {
selectedList: string;
description: string;
ShowTime: boolean;
showActiveOnly: boolean;
showTitle: boolean;
}
export default class WorldClockWebPartWebPart extends BaseClientSideWebPart<IWorldClockWebPartWebPartProps> {
render(): void;
onInit(): Promise<void>;
protected onDispose(): void;
protected readonly dataVersion: Version;
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration;
private _getLocations;
}
//# sourceMappingURL=WorldClockWebPartWebPart.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"WorldClockWebPartWebPart.d.ts","sourceRoot":"","sources":["../../../src/webparts/worldClockWebPart/WorldClockWebPartWebPart.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EACL,0BAA0B,EAK3B,MAAM,6BAA6B,CAAC;AASrC,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;CACpB;AASD,MAAM,CAAC,OAAO,OAAO,wBAAyB,SAAQ,qBAAqB,CACzE,8BAA8B,CAC/B;IACQ,MAAM,IAAI,IAAI;IAuBd,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ9B,SAAS,CAAC,SAAS,IAAI,IAAI;uBAQb,WAAW,EAAI,OAAO;IAIpC,SAAS,CAAC,4BAA4B,IAAI,0BAA0B;IAwDpE,OAAO,CAAC,aAAa;CAgCtB"}

View File

@ -0,0 +1,158 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import * as React from "react";
import * as ReactDom from "react-dom";
import { Version } from "@microsoft/sp-core-library";
import { BaseClientSideWebPart } from "@microsoft/sp-webpart-base";
import { PropertyPaneTextField, PropertyPaneToggle, } from "@microsoft/sp-property-pane";
import * as strings from "WorldClockWebPartWebPartStrings";
import WorldClockWebPart from "./components/WorldClockWebPart";
import { sp } from "@pnp/sp/presets/all";
import { PropertyFieldListPicker, PropertyFieldListPickerOrderBy, } from "@pnp/spfx-property-controls/lib/PropertyFieldListPicker";
var WorldClockWebPartWebPart = /** @class */ (function (_super) {
__extends(WorldClockWebPartWebPart, _super);
function WorldClockWebPartWebPart() {
return _super !== null && _super.apply(this, arguments) || this;
}
WorldClockWebPartWebPart.prototype.render = function () {
var _this = this;
var element = React.createElement(WorldClockWebPart, {
selectedList: this.properties.selectedList,
description: this.properties.description,
loadLocations: this._getLocations.bind(this),
ShowTime: this.properties.ShowTime,
showActiveOnly: this.properties.showActiveOnly,
showTitle: this.properties.showTitle,
updateProperty: function (value) {
_this.properties.description = value;
},
displayMode: this.displayMode,
onConfigure: function () {
_this.context.propertyPane.open();
},
});
ReactDom.render(element, this.domElement);
};
WorldClockWebPartWebPart.prototype.onInit = function () {
var _this = this;
return _super.prototype.onInit.call(this).then(function (_) {
sp.setup({
spfxContext: _this.context,
});
});
};
WorldClockWebPartWebPart.prototype.onDispose = function () {
ReactDom.unmountComponentAtNode(this.domElement);
};
Object.defineProperty(WorldClockWebPartWebPart.prototype, "dataVersion", {
// protected get disableReactivePropertyChanges(): boolean {
// return true;
// }
get: function () {
return Version.parse("1.0");
},
enumerable: true,
configurable: true
});
WorldClockWebPartWebPart.prototype.getPropertyPaneConfiguration = function () {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription,
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneTextField("description", {
label: strings.DescriptionFieldLabel,
}),
PropertyFieldListPicker("selectedList", {
label: "Select a list",
selectedList: this.properties.selectedList,
includeHidden: false,
orderBy: PropertyFieldListPickerOrderBy.Title,
disabled: false,
webAbsoluteUrl: this.context.pageContext.web.absoluteUrl,
onPropertyChange: this.onPropertyPaneFieldChanged.bind(this),
properties: this.properties,
context: this.context,
onGetErrorMessage: null,
deferredValidationTime: 0,
key: "listPickerFieldId",
}),
],
},
{
groupName: strings.BasicViewGroupName,
groupFields: [
PropertyPaneToggle("ShowTime", {
label: strings.IsShowTimeFieldLabel,
checked: this.properties.ShowTime,
key: "ShowTime",
}),
PropertyPaneToggle("showActiveOnly", {
label: strings.ShowActiveOnlyFieldLabel,
checked: this.properties.showActiveOnly,
key: "togshowActiveOnly",
}),
,
PropertyPaneToggle("showTitle", {
label: strings.showTitleFieldLabel,
checked: this.properties.showTitle,
key: "togshowTitle",
}),
],
},
],
},
],
};
};
WorldClockWebPartWebPart.prototype._getLocations = function () {
//console.log(this.properties);
//"World Clocks"
// debugger;
//console.log('__');
//console.log(this.context.pageContext.web.absoluteUrl);
//console.log(this.properties);
//let webLocation = new this.sp.web pnp.c(this.context.pageContext.web.absoluteUrl);
var filter = "";
console.log(this.properties.showActiveOnly);
if (this.properties.showActiveOnly) {
filter = "IsActive eq 1";
}
else {
filter = "";
}
return sp.web.lists
.getById(this.properties.selectedList)
.items.filter(filter)
.select("Title", "GMTValues")
.orderBy("ListOrder")
.get()
.then(function (Locations) {
return Locations;
})
.catch(function (error) {
console.log("error loading all location....");
console.log(error);
return [];
});
};
return WorldClockWebPartWebPart;
}(BaseClientSideWebPart));
export default WorldClockWebPartWebPart;
//# sourceMappingURL=WorldClockWebPartWebPart.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"WorldClockWebPartWebPart.js","sourceRoot":"","sources":["../../../src/webparts/worldClockWebPart/WorldClockWebPartWebPart.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAEL,qBAAqB,EACrB,kBAAkB,GAGnB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAC;AAC3D,OAAO,iBAAiB,MAAM,gCAAgC,CAAC;AAa/D,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAEzC,OAAO,EACL,uBAAuB,EACvB,8BAA8B,GAC/B,MAAM,yDAAyD,CAAC;AAGjE;IAAsD,4CAErD;IAFD;;IAsIA,CAAC;IAnIQ,yCAAM,GAAb;QAAA,iBAqBC;QApBC,IAAM,OAAO,GAAgD,KAAK,CAAC,aAAa,CAC9E,iBAAiB,EACjB;YACE,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,YAAY;YAC1C,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW;YACxC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;YAC5C,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ;YAClC,cAAc,EAAE,IAAI,CAAC,UAAU,CAAC,cAAc;YAC9C,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS;YACpC,cAAc,EAAE,UAAC,KAAa;gBAC5B,KAAI,CAAC,UAAU,CAAC,WAAW,GAAG,KAAK,CAAC;YACtC,CAAC;YACD,WAAW,EAAE,IAAI,CAAC,W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AC,KAAK;aAChB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;aACrC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;aACpB,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC;aAC5B,OAAO,CAAC,WAAW,CAAC;aACpB,GAAG,EAAE;aACL,IAAI,CAAC,UAAC,SAAS;YACd,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC;aACD,KAAK,CAAC,UAAC,KAAK;YACX,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;YAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACnB,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACP,CAAC;IACH,+BAAC;AAAD,CAAC,AAtID,CAAsD,qBAAqB,GAsI1E"}

View File

@ -0,0 +1,29 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "6baae7a7-af13-40d3-9567-f3bca9986248",
"alias": "WorldClockWebPartWebPart",
"componentType": "WebPart",
"version": "*",
"manifestVersion": 2,
"requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart"],
"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
"group": {
"default": "Other"
},
"title": {
"default": "World Clocks"
},
"description": {
"default": "World Clocks Web Part"
},
"officeFabricIconFontName": "Clock",
"properties": {
"description": "World Clocks WebPart"
}
}]
}

View File

@ -0,0 +1,20 @@
import { DisplayMode } from "@microsoft/sp-core-library";
export interface IWorldClockWebPartProps {
selectedList: string;
description: string;
loadLocations: () => Promise<ILocation[]>;
ShowTime: boolean;
showActiveOnly: boolean;
showTitle: boolean;
displayMode: DisplayMode;
updateProperty: (value: string) => void;
onConfigure: () => void;
}
export interface ILocation {
Title?: string;
GMTValues?: number;
}
export interface IWorldClockWebPartState {
clocks?: any[];
}
//# sourceMappingURL=IWorldClockWebPartProps.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"IWorldClockWebPartProps.d.ts","sourceRoot":"","sources":["../../../../src/webparts/worldClockWebPart/components/IWorldClockWebPartProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IAC1C,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;CAChB"}

View File

@ -0,0 +1 @@
//# sourceMappingURL=IWorldClockWebPartProps.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"IWorldClockWebPartProps.js","sourceRoot":"","sources":["../../../../src/webparts/worldClockWebPart/components/IWorldClockWebPartProps.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,10 @@
import * as React from "react";
import { IWorldClockWebPartProps, IWorldClockWebPartState } from "./IWorldClockWebPartProps";
export default class WorldClockWebPart extends React.Component<IWorldClockWebPartProps, IWorldClockWebPartState> {
private clocks;
private TitleText;
constructor(props: IWorldClockWebPartProps, state: IWorldClockWebPartState);
componentDidMount(): void;
render(): React.ReactElement<IWorldClockWebPartProps>;
}
//# sourceMappingURL=WorldClockWebPart.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"WorldClockWebPart.d.ts","sourceRoot":"","sources":["../../../../src/webparts/worldClockWebPart/components/WorldClockWebPart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,uBAAuB,EAEvB,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AAYnC,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,KAAK,CAAC,SAAS,CAC5D,uBAAuB,EACvB,uBAAuB,CACxB;IACC,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,SAAS,CAAc;gBACnB,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,uBAAuB;IAInE,iBAAiB;IAyHjB,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,uBAAuB,CAAC;CA6B7D"}

View File

@ -0,0 +1,137 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import * as React from "react";
import styles from "./WorldClockWebPart.module.scss";
import AnalogClock from "react-analog-clock";
import Clock from "react-live-clock";
import moment from "moment";
import { Placeholder } from "@pnp/spfx-controls-react/lib/Placeholder";
import { WebPartTitle } from "@pnp/spfx-controls-react/lib/WebPartTitle";
var WorldClockWebPart = /** @class */ (function (_super) {
__extends(WorldClockWebPart, _super);
function WorldClockWebPart(props, state) {
var _this = _super.call(this, props) || this;
_this.clocks = [];
_this.TitleText = "";
_this.state = { clocks: [] };
return _this;
}
WorldClockWebPart.prototype.componentDidMount = function () {
var _this = this;
var dayTheme = {
background: "#ededed",
border: "#222222",
center: "#222222",
seconds: "transparent",
minutes: "#000",
hour: "#000",
tick: "#000",
smallTickWidth: 1,
largeTickWidth: 1,
secondHandWidth: 1,
minuteHandWidth: 1,
hourHandWidth: 1,
};
var eveningTheme = {
background: "#A9A9A9",
border: "#868181",
center: "#DCDCDC",
seconds: "transparent",
minutes: "#000000",
hour: "#000000",
tick: "#000000",
smallTickWidth: 1,
largeTickWidth: 1,
secondHandWidth: 1,
minuteHandWidth: 1,
hourHandWidth: 1,
};
var nightTheme = {
background: "#2e2e2e",
border: "#868181",
center: "#acabab",
seconds: "transparent",
minutes: "#acabab",
hour: "#acabab",
tick: "#acabab",
smallTickWidth: 1,
largeTickWidth: 1,
secondHandWidth: 1,
minuteHandWidth: 1,
hourHandWidth: 1,
};
var WIDTH = 100;
this.props.loadLocations().then(function (options) {
console.log(options);
for (var i = 0; i < options.length; i++) {
var myDate = new Date().setHours(new Date().getHours() +
new Date().getTimezoneOffset() / 60 +
Number(options[i].GMTValues));
var TimeofDay = moment(myDate).format("hh:mm A");
var selectedTheme = null;
var time = new Date(myDate).getHours();
{
var timeOfDayMessage = "";
if (time > 4 && time < 18) {
timeOfDayMessage = "is having a great day Today.";
selectedTheme = dayTheme;
}
else if (time >= 18 && time < 21) {
timeOfDayMessage = "is having a great evening right Now.";
selectedTheme = eveningTheme;
}
else {
timeOfDayMessage = "is all Good Night right now!";
selectedTheme = nightTheme;
}
_this.clocks.push(React.createElement("span", { className: styles.Clock, title: "Current Time in " +
options[i].Title +
" (GMT" +
options[i].GMTValues +
") is " +
TimeofDay +
" and it " +
timeOfDayMessage },
React.createElement(AnalogClock
//theme={time > 6 && time < 18 ? dayTheme : nightTheme}
, {
//theme={time > 6 && time < 18 ? dayTheme : nightTheme}
theme: selectedTheme, gmtOffset: options[i].GMTValues, showSmallTicks: false, width: WIDTH, interval: 1 }),
_this.props.ShowTime ? (React.createElement("p", { className: styles.ClockTitle, title: "Current Time in " +
options[i].Title +
" (GMT" +
options[i].GMTValues +
") is " +
TimeofDay },
React.createElement(Clock, { date: myDate, format: "hh:mm:ss", interval: 1000, ticking: true }))) : (React.createElement("div", null)),
React.createElement("p", { className: styles.ClockTitle }, options[i].Title)));
}
}
_this.setState({ clocks: _this.clocks });
});
};
WorldClockWebPart.prototype.render = function () {
var WIDTH = 250;
var showTitle = this.props.showTitle;
var listSelected = typeof this.props.selectedList !== "undefined" &&
this.props.selectedList.length > 0;
return (React.createElement("div", { className: styles.worldClockWebPart },
!listSelected && (React.createElement(Placeholder, { iconName: "Clock", iconText: "Configure your web part", description: "Select the already imported Clocks list and choose other settings.", buttonLabel: "Choose a List", onConfigure: this.props.onConfigure })),
showTitle && (React.createElement(WebPartTitle, { title: this.props.description, displayMode: this.props.displayMode, updateProperty: this.props.updateProperty })),
React.createElement("div", { className: styles.container }, this.clocks)));
};
return WorldClockWebPart;
}(React.Component));
export default WorldClockWebPart;
//# sourceMappingURL=WorldClockWebPart.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"WorldClockWebPart.js","sourceRoot":"","sources":["../../../../src/webparts/worldClockWebPart/components/WorldClockWebPart.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,MAAM,MAAM,iCAAiC,CAAC;AAOrD,OAAO,WAAuB,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,MAAM,kBAAkB,CAAC;AACrC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAIzE;IAA+C,qCAG9C;IAGC,2BAAY,KAA8B,EAAE,KAA8B;QAA1E,YACE,kBAAM,KAAK,CAAC,SAEb;QALO,YAAM,GAAG,EAAE,CAAC;QACZ,eAAS,GAAW,EAAE,CAAC;QAG7B,KAAI,CAAC,KAAK,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;;IAC9B,CAAC;IACM,6CAAiB,GAAxB;QAAA,iBAwHC;QAvHC,IAAM,QAAQ,GAAG;YACf,UAAU,EAAE,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EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EAC7B,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,EACnC,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,GACzC,CACH;YACD,6BAAK,SAAS,EAAE,MAAM,CAAC,SAAS,IAAG,IAAI,CAAC,MAAM,CAAO,CACjD,CACP,CAAC;IACJ,CAAC;IACH,wBAAC;AAAD,CAAC,AAhKD,CAA+C,KAAK,CAAC,SAAS,GAgK7D"}

View File

@ -0,0 +1,2 @@
.worldClockWebPart_4593dcaa .container_4593dcaa{margin:0 auto;padding:10px;display:table}.worldClockWebPart_4593dcaa .Clock_4593dcaa{float:left;margin-left:10px;margin-right:10px}.worldClockWebPart_4593dcaa .Clock_4593dcaa>div{-webkit-box-sizing:unset;box-sizing:unset}.worldClockWebPart_4593dcaa .ClockTitle_4593dcaa{text-align:center;margin:5px;font-size:13px;font-weight:700;font-family:"Segoe UI Web (West European)",Segoe UI,-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif}.worldClockWebPart_4593dcaa .row_4593dcaa{margin:0 -8px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#fff;background-color:#005a9e;padding:20px}.worldClockWebPart_4593dcaa .row_4593dcaa::after,.worldClockWebPart_4593dcaa .row_4593dcaa::before{display:table;content:'';line-height:0}.worldClockWebPart_4593dcaa .row_4593dcaa::after{clear:both}.worldClockWebPart_4593dcaa .column_4593dcaa{position:relative;min-height:1px;padding-left:8px;padding-right:8px;-webkit-box-sizing:border-box;box-sizing:border-box}[dir=ltr] .worldClockWebPart_4593dcaa .column_4593dcaa{float:left}[dir=rtl] .worldClockWebPart_4593dcaa .column_4593dcaa{float:right}.worldClockWebPart_4593dcaa .column_4593dcaa .ms-Grid_4593dcaa{padding:0}@media (min-width:640px){.worldClockWebPart_4593dcaa .column_4593dcaa{width:83.33333333333334%}}@media (min-width:1024px){.worldClockWebPart_4593dcaa .column_4593dcaa{width:66.66666666666666%}}@media (min-width:1024px){[dir=ltr] .worldClockWebPart_4593dcaa .column_4593dcaa{left:16.66667%}[dir=rtl] .worldClockWebPart_4593dcaa .column_4593dcaa{right:16.66667%}}@media (min-width:640px){[dir=ltr] .worldClockWebPart_4593dcaa .column_4593dcaa{left:8.33333%}[dir=rtl] .worldClockWebPart_4593dcaa .column_4593dcaa{right:8.33333%}}.worldClockWebPart_4593dcaa .title_4593dcaa{font-size:21px;font-weight:100;color:#fff}.worldClockWebPart_4593dcaa .subTitle_4593dcaa{font-size:17px;font-weight:300;color:#fff}.worldClockWebPart_4593dcaa .description_4593dcaa{font-size:17px;font-weight:300;color:#fff}.worldClockWebPart_4593dcaa .button_4593dcaa{text-decoration:none;height:32px;min-width:80px;background-color:#0078d4;border-color:#0078d4;color:#fff;outline:transparent;position:relative;font-family:"Segoe UI WestEuropean","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased;font-size:14px;font-weight:400;border-width:0;text-align:center;cursor:pointer;display:inline-block;padding:0 16px}.worldClockWebPart_4593dcaa .button_4593dcaa .label_4593dcaa{font-weight:600;font-size:14px;height:32px;line-height:32px;margin:0 4px;vertical-align:top;display:inline-block}
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyY1xcd2VicGFydHNcXHdvcmxkQ2xvY2tXZWJQYXJ0XFxjb21wb25lbnRzXFxXb3JsZENsb2NrV2ViUGFydC5tb2R1bGUuc2NzcyIsIiRzdGRpbiIsIm5vZGVfbW9kdWxlc1xcb2ZmaWNlLXVpLWZhYnJpYy1yZWFjdFxcZGlzdFxcc2Fzc1xcbWl4aW5zXFxfR2VuZXJhbC5NaXhpbnMuc2NzcyIsIm5vZGVfbW9kdWxlc1xcb2ZmaWNlLXVpLWZhYnJpYy1yZWFjdFxcZGlzdFxcc2Fzc1xcdmFyaWFibGVzXFxfQ29sb3IuVmFyaWFibGVzLnNjc3MiLCJub2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XQUNBLFdBQUEsV0FoREYsdURBa0RFLE1BQUEsS0FsREYsdURBb0RFLE1BQUEsTUtnWFEsK0RMOVdSLFFBQUEsRUFDRSx5QktxbkJ1Qiw2Q0xubkJ6QixNQUFBLG9CQUNFLDBCSzZ3QnVCLDZDTDN3QnpCLE1BQUEsb0JBQ0UsMEJBN0RKLHVEQStESSxLQUFBLFVLK2dCc0IsdURMN2dCeEIsTUFBQSxXQUNFLHlCQWxFSix1REFvRUksS0FBQSxTQUNzQix1RENDcEIsTUFBTyxVSzlDaUIsNENDeVE1QixVQUFBLEtQdk5BLFlBQWUsSUNDZixNQUFPLEtLbERxQiwrQ0N3UTVCLFVBQUEsS1BsTkEsWUFBZSxJQ0NmLE1BQU8sS0t2RHFCLGtEQ3dRNUIsVUFBQSxLUDdNQSxZQUFlLElDQ2YsTUFBTyxLRHBCTyw2Q0FHRCxnQkFBQSxLQUNYLE9BQUEsS0FDQSxVQUFBLEtBQ0EsaUJHOUNvQyxRSGlEcEMsYUFBUyxRQUNULE1BQUEsS0FDQSxRQUFhLFlBRWIsU0FBQSxTQUVBLFlBQUEsdUJDZ0JrQyxDS3RFUixVTHNFb0IsQ0t0RXBCLGFMc0VtQyxDRGY5QyxrQkNnQkEsQ0RoQkEsTUNnQlEsQ0RoQlIsZ0JDZ0IwQixDRGhCMUIsV0FDSCx1QkFBQSxZQUNaLFVBQUEsS0FDQSxZQUFBLElBQ0EsYUFBQSxFQXJGSixXQUFBLE9Bd0dFLE9BQUEsUUFDQSxRQUFBLGFBZkksUUFBQSxFQUFBLEtBQ2EsNkRBQ2IsWUFBYSxJQUNiLFVBQUEsS0FDQSxPQUFBLEtBaUJGLFlBQUEsS0FDQSxPQUFBLEVBQUEsSUNBQSxlQUFnQixJQUNoQixRQUFTIn0= */

View File

@ -0,0 +1,16 @@
declare const styles: {
worldClockWebPart: string;
container: string;
Clock: string;
ClockTitle: string;
row: string;
column: string;
'ms-Grid': string;
title: string;
subTitle: string;
description: string;
button: string;
label: string;
};
export default styles;
//# sourceMappingURL=WorldClockWebPart.module.scss.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"WorldClockWebPart.module.scss.d.ts","sourceRoot":"","sources":["../../../../src/webparts/worldClockWebPart/components/WorldClockWebPart.module.scss.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,MAAM;;;;;;;;;;;;;CAaX,CAAC;AAEF,eAAe,MAAM,CAAC"}

View File

@ -0,0 +1,19 @@
/* tslint:disable */
require("./WorldClockWebPart.module.css");
var styles = {
worldClockWebPart: 'worldClockWebPart_4593dcaa',
container: 'container_4593dcaa',
Clock: 'Clock_4593dcaa',
ClockTitle: 'ClockTitle_4593dcaa',
row: 'row_4593dcaa',
column: 'column_4593dcaa',
'ms-Grid': 'ms-Grid_4593dcaa',
title: 'title_4593dcaa',
subTitle: 'subTitle_4593dcaa',
description: 'description_4593dcaa',
button: 'button_4593dcaa',
label: 'label_4593dcaa'
};
export default styles;
/* tslint:enable */
//# sourceMappingURL=WorldClockWebPart.module.scss.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"WorldClockWebPart.module.scss.js","sourceRoot":"","sources":["../../../../src/webparts/worldClockWebPart/components/WorldClockWebPart.module.scss.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,CAAC,gCAAgC,CAAC,CAAC;AAC1C,IAAM,MAAM,GAAG;IACb,iBAAiB,EAAE,4BAA4B;IAC/C,SAAS,EAAE,oBAAoB;IAC/B,KAAK,EAAE,gBAAgB;IACvB,UAAU,EAAE,qBAAqB;IACjC,GAAG,EAAE,cAAc;IACnB,MAAM,EAAE,iBAAiB;IACzB,SAAS,EAAE,kBAAkB;IAC7B,KAAK,EAAE,gBAAgB;IACvB,QAAQ,EAAE,mBAAmB;IAC7B,WAAW,EAAE,sBAAsB;IACnC,MAAM,EAAE,iBAAiB;IACzB,KAAK,EAAE,gBAAgB;CACxB,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,mBAAmB"}

View File

@ -0,0 +1,12 @@
define([], function () {
return {
PropertyPaneDescription: "Basic Web Part Properties",
BasicGroupName: "Base Properties",
BasicViewGroupName: "View Properties",
DescriptionFieldLabel: "Clocks Title",
showTitleFieldLabel: "Show Title",
ListNameFieldLabel: "Select Clocks List",
IsShowTimeFieldLabel: "Show Time",
ShowActiveOnlyFieldLabel: "Show Active Clocks"
};
});

17872
samples/react-world-clocks/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
{
"name": "world-clock",
"version": "0.0.1",
"private": true,
"main": "lib/index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test",
"preversion": "node ./tools/pre-version.js",
"postversion": "gulp dist"
},
"dependencies": {
"@microsoft/sp-core-library": "1.11.0",
"@microsoft/sp-lodash-subset": "1.11.0",
"@microsoft/sp-office-ui-fabric-core": "1.11.0",
"@microsoft/sp-property-pane": "1.11.0",
"@microsoft/sp-webpart-base": "1.11.0",
"@pnp/pnpjs": "^2.0.6",
"@pnp/spfx-controls-react": "1.19.0",
"@pnp/spfx-property-controls": "1.19.0",
"moment-timezone": "^0.5.31",
"office-ui-fabric-react": "6.214.0",
"react": "16.8.5",
"react-analog-clock": "^2.1.0",
"react-dom": "16.8.5",
"react-moment": "^0.9.7"
},
"devDependencies": {
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
"@microsoft/sp-build-web": "1.11.0",
"@microsoft/sp-module-interfaces": "1.11.0",
"@microsoft/sp-tslint-rules": "1.11.0",
"@microsoft/sp-webpart-workbench": "1.11.0",
"@types/chai": "3.4.34",
"@types/es6-promise": "0.0.33",
"@types/mocha": "2.2.38",
"@types/react": "16.8.8",
"@types/react-dom": "16.8.3",
"@types/webpack-env": "1.13.1",
"ajv": "~5.2.2",
"analog-clock-react": "^1.2.0",
"gulp": "~3.9.1",
"gulp-sequence": "1.0.0",
"react-live-clock": "5.0.1"
}
}

View File

@ -0,0 +1 @@
### placeholder

View File

@ -0,0 +1 @@
// A file is required to be in the root of the /src directory by the TypeScript compiler

View File

@ -0,0 +1,29 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "6baae7a7-af13-40d3-9567-f3bca9986248",
"alias": "WorldClockWebPartWebPart",
"componentType": "WebPart",
"version": "*",
"manifestVersion": 2,
"requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart"],
"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
"group": {
"default": "Other"
},
"title": {
"default": "World Clocks"
},
"description": {
"default": "World Clocks Web Part"
},
"officeFabricIconFontName": "Clock",
"properties": {
"description": "World Clocks WebPart"
}
}]
}

View File

@ -0,0 +1,170 @@
import * as React from "react";
import * as ReactDom from "react-dom";
import { Version } from "@microsoft/sp-core-library";
import { BaseClientSideWebPart } from "@microsoft/sp-webpart-base";
import {
IPropertyPaneConfiguration,
PropertyPaneTextField,
PropertyPaneToggle,
PropertyPaneDropdown,
IPropertyPaneDropdownOption,
} from "@microsoft/sp-property-pane";
import * as strings from "WorldClockWebPartWebPartStrings";
import WorldClockWebPart from "./components/WorldClockWebPart";
import {
IWorldClockWebPartProps,
ILocation,
} from "./components/IWorldClockWebPartProps";
export interface IWorldClockWebPartWebPartProps {
selectedList: string;
description: string;
ShowTime: boolean;
showActiveOnly: boolean;
showTitle: boolean;
}
import { sp } from "@pnp/sp/presets/all";
import {
PropertyFieldListPicker,
PropertyFieldListPickerOrderBy,
} from "@pnp/spfx-property-controls/lib/PropertyFieldListPicker";
import { groupOne } from "office-ui-fabric-react";
export default class WorldClockWebPartWebPart extends BaseClientSideWebPart<
IWorldClockWebPartWebPartProps
> {
public render(): void {
const element: React.ReactElement<IWorldClockWebPartProps> = React.createElement(
WorldClockWebPart,
{
selectedList: this.properties.selectedList,
description: this.properties.description,
loadLocations: this._getLocations.bind(this),
ShowTime: this.properties.ShowTime,
showActiveOnly: this.properties.showActiveOnly,
showTitle: this.properties.showTitle,
updateProperty: (value: string) => {
this.properties.description = value;
},
displayMode: this.displayMode,
onConfigure: () => {
this.context.propertyPane.open();
},
}
);
ReactDom.render(element, this.domElement);
}
public onInit(): Promise<void> {
return super.onInit().then((_) => {
sp.setup({
spfxContext: this.context,
});
});
}
protected onDispose(): void {
ReactDom.unmountComponentAtNode(this.domElement);
}
// protected get disableReactivePropertyChanges(): boolean {
// return true;
// }
protected get dataVersion(): Version {
return Version.parse("1.0");
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription,
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneTextField("description", {
label: strings.DescriptionFieldLabel,
}),
PropertyFieldListPicker("selectedList", {
label: "Select a list",
selectedList: this.properties.selectedList,
includeHidden: false,
orderBy: PropertyFieldListPickerOrderBy.Title,
disabled: false,
webAbsoluteUrl: this.context.pageContext.web.absoluteUrl,
onPropertyChange: this.onPropertyPaneFieldChanged.bind(this),
properties: this.properties,
context: this.context,
onGetErrorMessage: null,
deferredValidationTime: 0,
key: "listPickerFieldId",
}),
],
},
{
groupName: strings.BasicViewGroupName,
groupFields: [
PropertyPaneToggle("ShowTime", {
label: strings.IsShowTimeFieldLabel,
checked: this.properties.ShowTime,
key: "ShowTime",
}),
PropertyPaneToggle("showActiveOnly", {
label: strings.ShowActiveOnlyFieldLabel,
checked: this.properties.showActiveOnly,
key: "togshowActiveOnly",
}),
,
PropertyPaneToggle("showTitle", {
label: strings.showTitleFieldLabel,
checked: this.properties.showTitle,
key: "togshowTitle",
}),
],
},
],
},
],
};
}
private _getLocations(): Promise<ILocation[]> {
//console.log(this.properties);
//"World Clocks"
// debugger;
//console.log('__');
//console.log(this.context.pageContext.web.absoluteUrl);
//console.log(this.properties);
//let webLocation = new this.sp.web pnp.c(this.context.pageContext.web.absoluteUrl);
let filter: string = "";
console.log(this.properties.showActiveOnly);
if (this.properties.showActiveOnly) {
filter = "IsActive eq 1";
} else {
filter = "";
}
return sp.web.lists
.getById(this.properties.selectedList)
.items.filter(filter)
.select("Title", "GMTValues")
.orderBy("ListOrder")
.get()
.then((Locations) => {
return Locations;
})
.catch((error) => {
console.log("error loading all location....");
console.log(error);
return [];
});
}
}

View File

@ -0,0 +1,21 @@
import { DisplayMode } from "@microsoft/sp-core-library";
export interface IWorldClockWebPartProps {
selectedList: string;
description: string;
loadLocations: () => Promise<ILocation[]>;
ShowTime: boolean;
showActiveOnly: boolean;
showTitle: boolean;
displayMode: DisplayMode;
updateProperty: (value: string) => void;
onConfigure: () => void;
}
export interface ILocation {
Title?: string;
GMTValues?: number;
}
export interface IWorldClockWebPartState {
clocks?: any[];
}

View File

@ -0,0 +1,100 @@
@import '~office-ui-fabric-react/dist/sass/References.scss';
.worldClockWebPart {
.container {
margin: 0px auto;
/*background-color: #d8d8da;*/
padding: 10px;
display: table;
}
.Clock {
float: left;
margin-left: 10px;
margin-right: 10px;
}
.Clock>div {
-webkit-box-sizing: unset;
/* Safari/Chrome, other WebKit */
-moz-box-sizing: unset;
/* Firefox, other Gecko */
box-sizing: unset;
/* Opera/IE 8+ */
}
.ClockTitle {
text-align: center;
margin: 5px;
font-size: 13px;
font-weight: bold;
font-family: "Segoe UI Web (West European)", Segoe UI, -apple-system,
BlinkMacSystemFont, Roboto, Helvetica Neue, sans-serif;
}
.row {
@include ms-Grid-row;
@include ms-fontColor-white;
background-color: $ms-color-themeDark;
padding: 20px;
}
.column {
@include ms-Grid-col;
@include ms-lg10;
@include ms-xl8;
@include ms-xlPush2;
@include ms-lgPush1;
}
.title {
@include ms-font-xl;
@include ms-fontColor-white;
}
.subTitle {
@include ms-font-l;
@include ms-fontColor-white;
}
.description {
@include ms-font-l;
@include ms-fontColor-white;
}
.button {
// Our button
text-decoration: none;
height: 32px;
// Primary Button
min-width: 80px;
background-color: $ms-color-themePrimary;
border-color: $ms-color-themePrimary;
color: $ms-color-white;
// Basic Button
outline: transparent;
position: relative;
font-family: "Segoe UI WestEuropean", "Segoe UI", -apple-system,
BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
-webkit-font-smoothing: antialiased;
font-size: $ms-font-size-m;
font-weight: $ms-font-weight-regular;
border-width: 0;
text-align: center;
cursor: pointer;
display: inline-block;
padding: 0 16px;
.label {
font-weight: $ms-font-weight-semibold;
font-size: $ms-font-size-m;
height: 32px;
line-height: 32px;
margin: 0 4px;
vertical-align: top;
display: inline-block;
}
}
}

View File

@ -0,0 +1,179 @@
import * as React from "react";
import styles from "./WorldClockWebPart.module.scss";
import {
IWorldClockWebPartProps,
ILocation,
IWorldClockWebPartState,
} from "./IWorldClockWebPartProps";
import { escape } from "@microsoft/sp-lodash-subset";
import AnalogClock, { Themes } from "react-analog-clock";
import Clock from "react-live-clock";
import moment from "moment";
import { SPComponentLoader } from "@microsoft/sp-loader";
import { Placeholder } from "@pnp/spfx-controls-react/lib/Placeholder";
import { WebPartTitle } from "@pnp/spfx-controls-react/lib/WebPartTitle";
import { memoizeFunction } from "office-ui-fabric-react";
export default class WorldClockWebPart extends React.Component<
IWorldClockWebPartProps,
IWorldClockWebPartState
> {
private clocks = [];
private TitleText: string = "";
constructor(props: IWorldClockWebPartProps, state: IWorldClockWebPartState) {
super(props);
this.state = { clocks: [] };
}
public componentDidMount() {
const dayTheme = {
background: "#ededed",
border: "#222222",
center: "#222222",
seconds: "transparent",
minutes: "#000",
hour: "#000",
tick: "#000",
smallTickWidth: 1,
largeTickWidth: 1,
secondHandWidth: 1,
minuteHandWidth: 1,
hourHandWidth: 1,
};
const eveningTheme = {
background: "#A9A9A9",
border: "#868181",
center: "#DCDCDC",
seconds: "transparent",
minutes: "#000000",
hour: "#000000",
tick: "#000000",
smallTickWidth: 1,
largeTickWidth: 1,
secondHandWidth: 1,
minuteHandWidth: 1,
hourHandWidth: 1,
};
const nightTheme = {
background: "#2e2e2e",
border: "#868181",
center: "#acabab",
seconds: "transparent",
minutes: "#acabab",
hour: "#acabab",
tick: "#acabab",
smallTickWidth: 1,
largeTickWidth: 1,
secondHandWidth: 1,
minuteHandWidth: 1,
hourHandWidth: 1,
};
const WIDTH = 100;
this.props.loadLocations().then((options) => {
console.log(options);
for (let i = 0; i < options.length; i++) {
let myDate: any = new Date().setHours(
new Date().getHours() +
new Date().getTimezoneOffset() / 60 +
Number(options[i].GMTValues)
);
let TimeofDay = moment(myDate).format("hh:mm A");
let selectedTheme = null;
var time = new Date(myDate).getHours();
{
let timeOfDayMessage: string = "";
if (time > 4 && time < 18) {
timeOfDayMessage = "is having a great day Today.";
selectedTheme = dayTheme;
} else if (time >= 18 && time < 21) {
timeOfDayMessage = "is having a great evening right Now.";
selectedTheme = eveningTheme;
} else {
timeOfDayMessage = "is all Good Night right now!";
selectedTheme = nightTheme;
}
this.clocks.push(
<span
className={styles.Clock}
title={
"Current Time in " +
options[i].Title +
" (GMT" +
options[i].GMTValues +
") is " +
TimeofDay +
" and it " +
timeOfDayMessage
}
>
<AnalogClock
//theme={time > 6 && time < 18 ? dayTheme : nightTheme}
theme={selectedTheme}
gmtOffset={options[i].GMTValues}
showSmallTicks={false}
width={WIDTH}
interval={1}
/>
{this.props.ShowTime ? (
<p
className={styles.ClockTitle}
title={
"Current Time in " +
options[i].Title +
" (GMT" +
options[i].GMTValues +
") is " +
TimeofDay
}
>
<Clock
date={myDate}
format={"hh:mm:ss"}
interval={1000}
ticking={true}
/>
</p>
) : (
<div />
)}
<p className={styles.ClockTitle}>{options[i].Title}</p>
</span>
);
}
}
this.setState({ clocks: this.clocks });
});
}
public render(): React.ReactElement<IWorldClockWebPartProps> {
const WIDTH = 250;
const showTitle: boolean = this.props.showTitle;
const listSelected: boolean =
typeof this.props.selectedList !== "undefined" &&
this.props.selectedList.length > 0;
return (
<div className={styles.worldClockWebPart}>
{!listSelected && (
<Placeholder
iconName="Clock"
iconText="Configure your web part"
description="Select the already imported Clocks list and choose other settings."
buttonLabel="Choose a List"
onConfigure={this.props.onConfigure}
/>
)}
{showTitle && (
<WebPartTitle
title={this.props.description}
displayMode={this.props.displayMode}
updateProperty={this.props.updateProperty}
/>
)}
<div className={styles.container}>{this.clocks}</div>
</div>
);
}
}

View File

@ -0,0 +1,12 @@
define([], function () {
return {
PropertyPaneDescription: "Basic Web Part Properties",
BasicGroupName: "Base Properties",
BasicViewGroupName: "View Properties",
DescriptionFieldLabel: "Clocks Title",
showTitleFieldLabel: "Show Title",
ListNameFieldLabel: "Select Clocks List",
IsShowTimeFieldLabel: "Show Time",
ShowActiveOnlyFieldLabel: "Show Active Clocks"
};
});

View File

@ -0,0 +1,15 @@
declare interface IWorldClockWebPartWebPartStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
BasicViewGroupName: string;
DescriptionFieldLabel: string;
ListNameFieldLabel: String;
IsShowTimeFieldLabel: string;
ShowActiveOnlyFieldLabel: string;
showTitleFieldLabel: string;
}
declare module "WorldClockWebPartWebPartStrings" {
const strings: IWorldClockWebPartWebPartStrings;
export = strings;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

View File

@ -0,0 +1,64 @@
/**
* This script updates the package-solution version analogue to the
* the package.json file.
*/
if (process.env.npm_package_version === undefined) {
throw 'Package version cannot be evaluated';
}
// define path to package-solution file
const solution = './config/package-solution.json',
teams = './teams/manifest.json';
// require filesystem instance
const fs = require('fs');
// get next automated package version from process variable
const nextPkgVersion = process.env.npm_package_version;
// make sure next build version match
const nextVersion = nextPkgVersion.indexOf('-') === -1 ?
nextPkgVersion : nextPkgVersion.split('-')[0];
// Update version in SPFx package-solution if exists
if (fs.existsSync(solution)) {
// read package-solution file
const solutionFileContent = fs.readFileSync(solution, 'UTF-8');
// parse file as json
const solutionContents = JSON.parse(solutionFileContent);
// set property of version to next version
solutionContents.solution.version = nextVersion + '.0';
// save file
fs.writeFileSync(
solution,
// convert file back to proper json
JSON.stringify(solutionContents, null, 2),
'UTF-8');
}
// Update version in teams manifest if exists
if (fs.existsSync(teams)) {
// read package-solution file
const teamsManifestContent = fs.readFileSync(teams, 'UTF-8');
// parse file as json
const teamsContent = JSON.parse(teamsManifestContent);
// set property of version to next version
teamsContent.version = nextVersion;
// save file
fs.writeFileSync(
teams,
// convert file back to proper json
JSON.stringify(teamsContent, null, 2),
'UTF-8');
}

View File

@ -0,0 +1,40 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.3/includes/tsconfig-web.json",
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"outDir": "lib",
"inlineSources": false,
"strictNullChecks": false,
"noUnusedLocals": false,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"es6-promise",
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection"
],
"esModuleInterop": true
},
"include": [
"src/**/*.ts",
"src/**/*.tsx"
],
"exclude": [
"node_modules",
"lib"
]
}

View File

@ -0,0 +1,30 @@
{
"extends": "@microsoft/sp-tslint-rules/base-tslint.json",
"rules": {
"class-name": false,
"export-name": false,
"forin": false,
"label-position": false,
"member-access": true,
"no-arg": false,
"no-console": false,
"no-construct": false,
"no-duplicate-variable": true,
"no-eval": false,
"no-function-expression": true,
"no-internal-module": true,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-unnecessary-semicolons": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-with-statement": true,
"semicolon": true,
"trailing-comma": false,
"typedef": false,
"typedef-whitespace": false,
"use-named-parameter": true,
"variable-name": false,
"whitespace": false
}
}

File diff suppressed because it is too large Load Diff