(false);
15 |
16 | const styles = _useStyles();
17 | const myTheme = props.isDisabled ? {
18 | ...props.theme,
19 | colorCompoundBrandStroke: props.theme?.colorNeutralStroke1,
20 | colorCompoundBrandStrokeHover: props.theme?.colorNeutralStroke1Hover,
21 | colorCompoundBrandStrokePressed: props.theme?.colorNeutralStroke1Pressed,
22 | colorCompoundBrandStrokeSelected: props.theme?.colorNeutralStroke1Selected,
23 | backgroundColor: props.theme?.colorNeutralBackground3,
24 | }
25 | :
26 | props.theme;
27 |
28 | return (
29 |
30 |
31 |
32 | {props.isDisabled?
33 |
39 | :
40 | {
47 | setPlaceholder(selectString);
48 | setDropdownIconVisible(true);
49 | }}
50 | onMouseLeave={() => {
51 | setPlaceholder("---");
52 | setDropdownIconVisible(false);
53 | }}
54 | onBlur={() => {
55 | setPlaceholder("---");
56 | setDropdownIconVisible(false);
57 | }}
58 | onOptionSelect={(e, option) => {
59 | if (!option?.optionValue) {
60 | props.onChange(undefined);
61 | return;
62 | }
63 |
64 | props.onChange(props.availableOptions.find(o => o.text === option.optionValue)!);
65 | }}
66 | >
67 | {props.availableOptions.map(option => (
68 |
75 | ))}
76 |
77 | }
78 |
79 |
80 |
81 | );
82 | }
--------------------------------------------------------------------------------
/YearDropdown/YearDropdown/components/DropdownOld.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import { Dropdown, IDropdownOption, IDropdownStyleProps, IDropdownStyles } from '@fluentui/react/lib/Dropdown';
3 | import { IRecordSelectorProps } from "./IRecordSelectorProps";
4 |
5 | export const DropdownOld: React.FunctionComponent = props => {
6 | return (
7 | {
12 | props.onChange(option);
13 | }}
14 | styles={dropdownStyles}
15 | />);
16 | }
17 |
18 | const colorFocus = "#a9a9a9";
19 |
20 | export const dropdownStyles = (props: IDropdownStyleProps):Partial => ({
21 | title: [{
22 | color: "black",
23 | display: "block",
24 | fontWeight: props.isOpen===true ? "400" : "600",
25 | fontStretch: "normal",
26 | borderWidth: "1px",
27 | borderStyle: "solid",
28 | borderColor: props.isOpen===true ? "black" : "transparent",
29 | backgroundColor : "transparent",
30 | outline: "none",
31 | outlineColor: "transparent",
32 | outlineOffset: "0",
33 | boxSizing: "border-box",
34 | height: "33px",
35 | width: "100%",
36 | selectors: {
37 | ':hover': {
38 | borderColor: "black",
39 | borderWidth:"1px",
40 | fontWeight : props.disabled === true ? "600" : "400",
41 | backgroundColor : props.disabled === true ? "#E2E2E2" : "transparent",
42 | boxShadow: "none"
43 | }
44 | }
45 | }],
46 | dropdown: [{
47 | outline: "none",
48 | textAlign:"left",
49 | border: "1px solid transparent",
50 | outlineColor: "transparent",
51 | outlineOffset: "0",
52 | boxShadow: "none",
53 | selectors:{
54 | ":focus:after": {
55 | outline: "none",
56 | // border: "1px solid black",
57 | border: props.disabled===true ? "1px solid transparent" : `1px solid ${colorFocus}`,
58 | outlineColor: "transparent",
59 | boxShadow: "none"
60 | }
61 | }
62 | }],
63 | dropdownItem: [{
64 | display: "inline-flex",
65 | selectors: {
66 | ":hover": {
67 | color: "black"
68 | }
69 | }
70 | }],
71 | dropdownItemSelected: [{
72 | display: "inline-flex",
73 | selectors: {
74 | ":hover": {
75 | color: "black"
76 | }
77 | }
78 | }],
79 | caretDown :[{
80 | color: props.isOpen===true? colorFocus : "transparent"
81 | }],
82 | caretDownWrapper: [{
83 | borderLeft: props.isOpen===true ? `1px solid ${colorFocus}` : "none",
84 | paddingLeft: "7px"
85 | }]
86 | });
87 |
--------------------------------------------------------------------------------
/YearDropdown/YearDropdown/components/IRecordSelectorProps.ts:
--------------------------------------------------------------------------------
1 | import { IDropdownOption } from '@fluentui/react/lib/Dropdown';
2 | import { Theme } from "@fluentui/react-components";
3 |
4 | export interface IRecordSelectorProps {
5 | selectedValue: string | number;
6 | availableOptions: IDropdownOption[];
7 | isDisabled: boolean;
8 | onChange: (selectedOption?: IDropdownOption) => void;
9 | theme?: Theme
10 | }
--------------------------------------------------------------------------------
/YearDropdown/YearDropdown/components/RecordSelector.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 | import { Dropdown, IDropdownOption, IDropdownStyleProps, IDropdownStyles } from '@fluentui/react/lib/Dropdown';
3 | import { IRecordSelectorProps } from "./IRecordSelectorProps";
4 | import { DropdownOld } from './DropdownOld';
5 | import { DropdownNew } from './DropdownNew';
6 |
7 |
8 | export const RecordSelector: React.FunctionComponent = props => {
9 | if (!props.theme) {
10 | return (
11 | {
16 | props.onChange(option);
17 | }}
18 |
19 | />);
20 | }
21 |
22 | return (
23 | );
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/YearDropdown/YearDropdown/img/YearDropdown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MscrmTools/PCF-Controls/f9ad2f81c8dfd06fd27cb390a0e399e8a32999da/YearDropdown/YearDropdown/img/YearDropdown.png
--------------------------------------------------------------------------------
/YearDropdown/YearDropdown/strings/YearDropdown.1031.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | text/microsoft-resx
51 |
52 |
53 | 2.0
54 |
55 |
56 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
57 |
58 |
59 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
60 |
61 |
62 | Zielspalte
63 |
64 |
65 | Die an dieses Steuerelement gebundene Spalte
66 |
67 |
68 | Jahre zuvor
69 |
70 |
71 | Anzahl der Jahre, die im Dropdown-Menü vor dem aktuellen Jahr hinzugefügt werden
72 |
73 |
74 | Jahre danach
75 |
76 |
77 | Anzahl der Jahre, die im Dropdown-Menü nach dem aktuellen Jahr hinzugefügt werden
78 |
79 |
80 | Standardmonat
81 |
82 |
83 | Standardmonat zur Generierung des Datums, wenn die Zielspalte vom Typ Datum ist
84 |
85 |
86 | Standardtag
87 |
88 |
89 | Standardtag zur Generierung des Datums, wenn die Zielspalte vom Typ Datum ist
90 |
91 |
92 | Jahresauswahl-Dropdown
93 |
94 |
95 | Ein Steuerelement zur Auswahl eines Jahres und Speicherung in einer DateTime-, Ganzzahl- oder Zeichenkettenspalte
96 |
97 |
--------------------------------------------------------------------------------
/YearDropdown/YearDropdown/strings/YearDropdown.1033.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | text/microsoft-resx
51 |
52 |
53 | 2.0
54 |
55 |
56 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
57 |
58 |
59 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
60 |
61 |
62 | Target column
63 |
64 |
65 | The column bound to this control
66 |
67 |
68 | Years before
69 |
70 |
71 | The number of years to add in the dropdown prior of current year
72 |
73 |
74 | Years after
75 |
76 |
77 | The number of years to add in the dropdown after of current year
78 |
79 |
80 | Default month
81 |
82 |
83 | Default month to generate the date when the target column is of type Date
84 |
85 |
86 | Default day
87 |
88 |
89 | Default day to generate the date when the target column is of type Date
90 |
91 |
92 | Year selection dropdown
93 |
94 |
95 | A control to select a year and store it in DateTime, Whole number or string column
96 |
97 |
--------------------------------------------------------------------------------
/YearDropdown/YearDropdown/strings/YearDropdown.1036.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | text/microsoft-resx
51 |
52 |
53 | 2.0
54 |
55 |
56 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
57 |
58 |
59 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
60 |
61 |
62 | Colonne liée
63 |
64 |
65 | La colonne liée à ce controle
66 |
67 |
68 | Années avant
69 |
70 |
71 | Le nombre d'année, avant l'année en cours, à afficher dans la liste déroulante
72 |
73 |
74 | Années après
75 |
76 |
77 | Le nombre d'année, après l'année en cours, à afficher dans la liste déroulante
78 |
79 |
80 | Mois par défaut
81 |
82 |
83 | Mois par défaut utilisé lors du stockage de l'année vers une colonne de type Date
84 |
85 |
86 | Jour par défaut
87 |
88 |
89 | Jour par défaut utilisé lors du stockage de l'année vers une colonne de type Date
90 |
91 |
92 | Sélection d'année
93 |
94 |
95 | Un contrôle en liste déroulante pour sélectionner une année et la stocker sous forme de date, de nombre entier ou de texte
96 |
97 |
--------------------------------------------------------------------------------
/YearDropdown/eslint.config.mjs:
--------------------------------------------------------------------------------
1 | import eslintjs from "@eslint/js";
2 | import microsoftPowerApps from "@microsoft/eslint-plugin-power-apps";
3 | import pluginPromise from "eslint-plugin-promise";
4 | import reactPlugin from "eslint-plugin-react";
5 | import globals from "globals";
6 | import typescriptEslint from "typescript-eslint";
7 |
8 | /** @type {import('eslint').Linter.Config[]} */
9 | export default [
10 | {
11 | ignores: ["**/generated"],
12 | },
13 | eslintjs.configs.recommended,
14 | ...typescriptEslint.configs.recommendedTypeChecked,
15 | ...typescriptEslint.configs.stylisticTypeChecked,
16 | pluginPromise.configs["flat/recommended"],
17 | microsoftPowerApps.configs.paCheckerHosted,
18 | reactPlugin.configs.flat.recommended,
19 | {
20 | plugins: {
21 | "@microsoft/power-apps": microsoftPowerApps,
22 | },
23 |
24 | languageOptions: {
25 | globals: {
26 | ...globals.browser,
27 | ComponentFramework: true,
28 | },
29 | parserOptions: {
30 | ecmaVersion: 2020,
31 | sourceType: "module",
32 | projectService: true,
33 | tsconfigRootDir: import.meta.dirname,
34 | },
35 | },
36 |
37 | rules: {
38 | "@typescript-eslint/no-unused-vars": "off",
39 | },
40 | settings: {
41 | react: {
42 | version: "detect",
43 | },
44 | },
45 | },
46 | ];
47 |
--------------------------------------------------------------------------------
/YearDropdown/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "pcf-project",
3 | "version": "1.0.0",
4 | "description": "Project containing your PowerApps Component Framework (PCF) control.",
5 | "scripts": {
6 | "build": "pcf-scripts build",
7 | "clean": "pcf-scripts clean",
8 | "lint": "pcf-scripts lint",
9 | "lint:fix": "pcf-scripts lint fix",
10 | "rebuild": "pcf-scripts rebuild",
11 | "start": "pcf-scripts start",
12 | "start:watch": "pcf-scripts start watch",
13 | "refreshTypes": "pcf-scripts refreshTypes"
14 | },
15 | "dependencies": {
16 | "@fluentui/react": "^8.29.0",
17 | "@fluentui/react-components": "9.46.2",
18 | "@typescript-eslint/eslint-plugin": "^8.29.0",
19 | "react": "16.14.0",
20 | "react-dom": "16.14.0"
21 | },
22 | "devDependencies": {
23 | "@eslint/js": "^9.17.0",
24 | "@microsoft/eslint-plugin-power-apps": "^0.2.51",
25 | "@types/powerapps-component-framework": "^1.3.15",
26 | "@types/react": "^16.14.60",
27 | "@types/react-dom": "^16.9.24",
28 | "eslint-plugin-promise": "^7.1.0",
29 | "eslint-plugin-react": "^7.37.2",
30 | "globals": "^15.13.0",
31 | "pcf-scripts": "^1",
32 | "pcf-start": "^1",
33 | "react": "^16.14.0",
34 | "typescript": "^4.9.5",
35 | "typescript-eslint": "^8.18.1"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/YearDropdown/pcfconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "outDir": "./out/controls"
3 | }
--------------------------------------------------------------------------------
/YearDropdown/screenshots/YearDropdown.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MscrmTools/PCF-Controls/f9ad2f81c8dfd06fd27cb390a0e399e8a32999da/YearDropdown/screenshots/YearDropdown.gif
--------------------------------------------------------------------------------
/YearDropdown/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./node_modules/pcf-scripts/tsconfig_base.json",
3 | "compilerOptions": {
4 | "typeRoots": ["node_modules/@types"],
5 | "module": "es2015",
6 | "moduleResolution": "node"
7 | }
8 | }
--------------------------------------------------------------------------------
/package-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "lockfileVersion": 1
3 | }
4 |
--------------------------------------------------------------------------------