diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f08cf73c..7401b3a55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added list 'Interessentregister' to portfolio level - Using list fields instead of content type for 'Dokumenter' to keep the OOTB document type dropdown #136 - Updated Standardmal.txt to include Parameters +- Fixed colors and columns not matching content for resource allocation #134 ## 1.1.3 - 2019-10-15 diff --git a/SharePointFramework/PortfolioWebParts/package.json b/SharePointFramework/PortfolioWebParts/package.json index 52639f168..aa537184f 100644 --- a/SharePointFramework/PortfolioWebParts/package.json +++ b/SharePointFramework/PortfolioWebParts/package.json @@ -51,7 +51,7 @@ "office-ui-fabric-react": "6.200.1", "projectwebparts": "link:..\\ProjectWebParts", "react": "16.7.0", - "react-calendar-timeline": "0.23.1", + "react-calendar-timeline": "^0.26.6", "react-dom": "16.7.0", "react-highcharts": "16.0.2", "react-image-fade-in": "1.0.2", @@ -72,6 +72,7 @@ "@types/chai": "3.4.34", "@types/mocha": "2.2.38", "@types/object-assign": "4.0.30", + "@types/react-calendar-timeline": "^0.26.0", "@types/string-format": "2.0.0", "@types/underscore": "1.9.2", "ajv": "~5.2.2", diff --git a/SharePointFramework/PortfolioWebParts/pnpm-lock.yaml b/SharePointFramework/PortfolioWebParts/pnpm-lock.yaml index 960522729..1f5013606 100644 --- a/SharePointFramework/PortfolioWebParts/pnpm-lock.yaml +++ b/SharePointFramework/PortfolioWebParts/pnpm-lock.yaml @@ -25,7 +25,7 @@ dependencies: object-get: 2.1.0 office-ui-fabric-react: 6.200.1_12ca6beb53d2d8ad03a024f5a9577535 react: 16.7.0 - react-calendar-timeline: 0.23.1_c3db651cfe12a78303c92d82cf81d4a8 + react-calendar-timeline: 0.26.6_c3db651cfe12a78303c92d82cf81d4a8 react-dom: 16.7.0_react@16.7.0 react-highcharts: 16.0.2_react-dom@16.7.0+react@16.7.0 react-image-fade-in: 1.0.2_react-dom@16.7.0+react@16.7.0 @@ -41,6 +41,7 @@ devDependencies: '@types/chai': 3.4.34 '@types/mocha': 2.2.38 '@types/object-assign': 4.0.30 + '@types/react-calendar-timeline': 0.26.0 '@types/string-format': 2.0.0 '@types/underscore': 1.9.2 ajv: 5.2.5 @@ -1339,6 +1340,13 @@ packages: dev: true resolution: integrity: sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA== + /@types/react-calendar-timeline/0.26.0: + dependencies: + '@types/react': 16.7.22 + moment: 2.24.0 + dev: true + resolution: + integrity: sha512-KMhmAcE/+dSHHXV3W2YH5xKHXn4FjCTsGHZbYSEa2QotOCPJC2rK4LKhWcpfl3MOoJDZ4MUPpzhV+1Dyzl6vjg== /@types/react-dom/16.8.0: dependencies: '@types/react': 16.7.22 @@ -1354,7 +1362,6 @@ packages: dependencies: '@types/prop-types': 15.7.3 csstype: 2.6.7 - dev: false resolution: integrity: sha512-j/3tVoY09kHcTfbia4l67ofQn9xvktUvlC/4QN0KuBHAXlbU/wuGKMb8WfEb/vIcWxsOxHv559uYprkFDFfP8Q== /@types/react/16.8.8: @@ -3382,6 +3389,10 @@ packages: node: '>=0.10.0' resolution: integrity: sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== + /classnames/2.2.6: + dev: false + resolution: + integrity: sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q== /clean-css/4.2.1: dependencies: source-map: 0.6.1 @@ -8213,6 +8224,10 @@ packages: node: '>=6' resolution: integrity: sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== + /memoize-one/5.1.1: + dev: false + resolution: + integrity: sha512-HKeeBpWvqiVJD57ZUAsJNm71eHTykffzcLZVYWiVfQeI1rJtuEaS7hQiEpWfVVk18donPwJEcFKIkCmPJNOhHA== /memory-fs/0.4.1: dependencies: errno: 0.1.7 @@ -10235,12 +10250,14 @@ packages: node: '>= 0.8' resolution: integrity: sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q== - /react-calendar-timeline/0.23.1_c3db651cfe12a78303c92d82cf81d4a8: + /react-calendar-timeline/0.26.6_c3db651cfe12a78303c92d82cf81d4a8: dependencies: + classnames: 2.2.6 create-react-context: 0.2.3_react@16.7.0 element-resize-detector: 1.1.15 interactjs: 1.6.2 lodash.isequal: 4.5.0 + memoize-one: 5.1.1 moment: 2.24.0 react: 16.7.0 react-dom: 16.7.0_react@16.7.0 @@ -10252,7 +10269,7 @@ packages: react: '>=16.3' react-dom: '>=16.3' resolution: - integrity: sha512-HHzaq7oH3mjyy5wYmNr6NmI23/O/+yLajpOqJpP/yBOJFlR5bkm4n2BvWJ71NNVomVtjoBP3M/DtPPt7zqsjOA== + integrity: sha512-cuO+UQrN0a9o7U65SBvTbR4Is1lzLMwJQtD3iGUJV7XMmY41DQdi0pveKHaW6STZ7nj6+pV+aFY4FkRCeTo0wA== /react-dom/16.7.0_react@16.7.0: dependencies: loose-envify: 1.4.0 @@ -13240,6 +13257,7 @@ specifiers: '@types/mocha': 2.2.38 '@types/object-assign': 4.0.30 '@types/react': 16.7.22 + '@types/react-calendar-timeline': ^0.26.0 '@types/react-dom': 16.8.0 '@types/string-format': 2.0.0 '@types/underscore': 1.9.2 @@ -13257,7 +13275,7 @@ specifiers: office-ui-fabric-react: 6.200.1 pzl-tslint-rules: 1.0.5 react: 16.7.0 - react-calendar-timeline: 0.23.1 + react-calendar-timeline: ^0.26.6 react-dom: 16.7.0 react-highcharts: 16.0.2 react-image-fade-in: 1.0.2 diff --git a/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/IResourceAllocationProps.ts b/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/IResourceAllocationProps.ts index 7e02b2114..c0bb244b8 100644 --- a/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/IResourceAllocationProps.ts +++ b/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/IResourceAllocationProps.ts @@ -1,4 +1,5 @@ import { IBaseComponentProps } from '../IBaseComponentProps'; +import * as moment from 'moment'; export interface IResourceAllocationProps extends IBaseComponentProps { /** @@ -15,4 +16,14 @@ export interface IResourceAllocationProps extends IBaseComponentProps { * Background color for absence items */ itemAbsenceBgColor?: string; + + /** + * Default time start + */ + defaultTimeStart?: [number, moment.unitOfTime.DurationConstructor]; + + /** + * Default time end + */ + defaultTimeEnd?: [number, moment.unitOfTime.DurationConstructor]; } \ No newline at end of file diff --git a/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/ResourceAllocation.module.scss b/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/ResourceAllocation.module.scss index b0db58a3a..3905a9137 100644 --- a/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/ResourceAllocation.module.scss +++ b/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/ResourceAllocation.module.scss @@ -1,6 +1,6 @@ -@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss'; +@import "~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss"; -.resourceAllocation { +.resourceAllocation { margin: 15px 0 0 0; .container { margin: 0px auto; @@ -26,7 +26,30 @@ margin: 0px auto; padding: 0 32px 0 32px; font-size: 12px !important; + + [class="react-calendar-timeline"] [class*="rct-header-root"] { + background: #f4f4f4 !important; + } + + [class="react-calendar-timeline"] [class*="rct-dateHeader-primary"] { + color: #444; + border: none; + } + + [class="react-calendar-timeline"] [class*="rct-calendar-header"] { + border: none; + } + + [class="react-calendar-timeline"] [class*="rct-dateHeader"] { + font-size: 10px; + border: none; + } + + [class="react-calendar-timeline"] [class*="rct-item"] [class*="rct-item-content"] { + text-overflow: ellipsis; + white-space: nowrap; + width: 100%; + } } } } - diff --git a/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/Timeline.overrides.css b/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/Timeline.overrides.css index f0467e33d..e69de29bb 100644 --- a/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/Timeline.overrides.css +++ b/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/Timeline.overrides.css @@ -1,8 +0,0 @@ -.react-calendar-timeline .rct-header .rct-label-group { - background: #f4f4f4!important; - color: #444; -} - -.react-calendar-timeline .rct-header-container.header-sticky > div { - width: 100% !important; -} \ No newline at end of file diff --git a/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/index.tsx b/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/index.tsx index fa0688f2c..fa2169cae 100644 --- a/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/index.tsx +++ b/SharePointFramework/PortfolioWebParts/src/components/ResourceAllocation/index.tsx @@ -10,7 +10,7 @@ import { MessageBar, MessageBarType } from 'office-ui-fabric-react/lib/MessageBa import { Spinner, SpinnerType } from 'office-ui-fabric-react/lib/Spinner'; import * as strings from 'PortfolioWebPartsStrings'; import * as React from 'react'; -import Timeline, { TimelineMarkers, TodayMarker } from 'react-calendar-timeline'; +import Timeline, { TimelineMarkers, TodayMarker, ReactCalendarItemRendererProps } from 'react-calendar-timeline'; import 'react-calendar-timeline/lib/Timeline.css'; import { tryParsePercentage } from 'shared/lib/helpers'; import { DataSourceService } from 'shared/lib/services'; @@ -26,6 +26,8 @@ export class ResourceAllocation extends React.Component = { itemBgColor: '51,153,51', itemAbsenceBgColor: '26,111,179', + defaultTimeStart: [-1, 'months'], + defaultTimeEnd: [1, 'years'], }; /** @@ -83,7 +85,7 @@ export class ResourceAllocation extends React.Component
-
+
@@ -93,12 +95,12 @@ export class ResourceAllocation extends React.Component this._itemRenderer(item, itemContext, getItemProps)} - defaultTimeStart={moment().subtract(1, 'months')} - defaultTimeEnd={moment().add(1, 'years')}> + sidebarWidth={250} + itemRenderer={this._itemRenderer.bind(this)} + defaultTimeStart={moment().add(...this.props.defaultTimeStart)} + defaultTimeEnd={moment().add(...this.props.defaultTimeEnd)}> - +
@@ -188,16 +190,14 @@ export class ResourceAllocation extends React.Component) => React.HTMLProps) { + private _itemRenderer(props: ReactCalendarItemRendererProps) { + let htmlProps = props.getItemProps(props.item.itemProps); + console.log('_itemRenderer', htmlProps); return ( -
-
- {item.title} +
+
+ {props.item.title}
); @@ -229,7 +229,7 @@ export class ResourceAllocation extends React.Component { const group = _.find(groups, grp => grp.title === res[groupBy]); - const allocation = tryParsePercentage(res.GtResourceLoadOWSNMBR, true, 0) as number; + const allocation = tryParsePercentage(res.GtResourceLoadOWSNMBR, false, 0) as number; const isAbsence = res.ContentTypeId.indexOf('0x010029F45E75BA9CE340A83EFFB2927E11F4') !== -1; const itemOpacity = allocation < 30 ? 0.3 : (allocation / 100); const itemColor = allocation < 40 ? '#000' : '#fff'; @@ -237,10 +237,10 @@ export class ResourceAllocation extends React.Componentsentrale ressursallokeringslisten. Disse oppføringene vil vises med blå og rød (fravær) farge i tabellen under. Prosjektallokeringer vises med grønn farge. Fargestyrken til allokeringen baserer seg på allokeringsprosenten.", + ResourceAllocationInfoText: "Ressursallokering eller fravær som gjelder på tvers av prosjekter legges inn i densentrale ressursallokeringslisten. Disse oppføringene vil vises med blå og rød (fravær) farge i tabellen under. Prosjektallokeringer vises med grønn farge. Fargestyrken til allokeringen baserer seg på allokeringsprosenten.", ResourceLabel: "Ressurs", ResponsibleLabel: 'Ansvarlig', RiskActionLabel: 'Tiltak',