Skip to content

Commit

Permalink
Add all the progress control
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Sanchez authored and Victor Sanchez committed Jan 30, 2021
0 parents commit 66fe47a
Show file tree
Hide file tree
Showing 18 changed files with 11,192 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules

# generated directory
**/generated

# output directory
/out

# msbuild output directories
/bin
/obj
/ProgressControlPCF
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Víctor Sánchez

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Progress Control

## Description

This control will allow you to display an integer or a decimal as a % control.

## Download

[DOWNLOAD LATEST RELEASE](https://github.com/victorsolaya/Multiselect_Records_PCF/releases/latest)

## How to configure

1. Add the control to the field that will contain the data split by your delimiter.
2. The parameters of the control are explained below

## Parameters

1. Field (required) -> It is the field that will contain the data

2. is100MaximumValue (required) -> Set if 100 is the maximum value for your field number.

3. CSS Path (optional) -> This will allow to you to add your own styles to the component, if it is not set, it will show the ones that have been added by default.
If you want to add your own styles, you need to pass to the parameter the path url of the css component as: /Webresources/vso/css/styles.css

### How to edit the number

If you want to edit the number, just edit it through the number that is displayed inside the control. It will always add a % just for display reasons.
You can edit the common javascript functionality of ...setValue()

### Assets

![Display](assets/show-percentage.png)

If you set the maximum value as FALSE
![Is Maximum Value False](assets/isMaximumValueFalse.gif)

If you set the maximum value as TRUE
![Is Maximum Value False](assets/isMaximumValueTrue.gif)

### Styles

You can edit the styles if you follow the content as the current .css.
45 changes: 45 additions & 0 deletions __tests__/calculations.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { doCalculations, sum } from '../progresscontrol/utilities/calculations';

test('360 degress with 100%', () => {
const percentage = 100;
const expectedDegrees = 360;
var expectedObject = {
calculationLeft: 180, calculationRight: 180
}
expect(sum(expectedObject.calculationLeft, expectedObject.calculationRight)).toBe(expectedDegrees);
expect(doCalculations(percentage)).toStrictEqual(expectedObject);
});

test('90 degress with 25%', () => {
const percentage = 25;
const expectedDegrees = 90;

var expectedObject = {
calculationLeft: 90, calculationRight: 0
}
expect(sum(expectedObject.calculationLeft, expectedObject.calculationRight)).toBe(expectedDegrees);
expect(doCalculations(percentage)).toStrictEqual(expectedObject);
});

test('180 degress with 50%', () => {
const percentage = 50;
const expectedDegrees = 180;

var expectedObject = {
calculationLeft: 180, calculationRight: 0
}
expect(sum(expectedObject.calculationLeft, expectedObject.calculationRight)).toBe(expectedDegrees);
expect(doCalculations(percentage)).toStrictEqual(expectedObject);
});

test('270 degress with 75%', () => {
const percentage = 75;
const expectedDegrees = 270;

var expectedObject = {
calculationLeft: 180, calculationRight: 90
}
expect(sum(expectedObject.calculationLeft, expectedObject.calculationRight)).toBe(expectedDegrees);
expect(doCalculations(percentage)).toStrictEqual(expectedObject);
});

Binary file added assets/isMaximumValueFalse.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/isMaximumValueTrue.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/show-percentage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[0127/200352.272:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3)
12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
"roots": [
"<rootDir>"
],
"testMatch": [
"**/__tests__/**/*.+(ts|tsx|js)",
"**/?(*.)+(spec|test).+(ts|tsx|js)"
],
"transform": {
"^.+\\.(ts|tsx)$": "ts-jest"
},
}
Loading

0 comments on commit 66fe47a

Please sign in to comment.