Skip to content

Commit

Permalink
Updated Styling. Control is adhering to form state and attribute sett…
Browse files Browse the repository at this point in the history
…ing, in order to be disabled
  • Loading branch information
NielsMinnee committed Apr 8, 2024
1 parent 53a87b9 commit 09bab91
Show file tree
Hide file tree
Showing 7 changed files with 6,793 additions and 5,181 deletions.
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended"
],
"globals": {
"ComponentFramework": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"@microsoft/power-apps",
"@typescript-eslint"
],
"rules": {
"no-unused-vars": "off"
}
}
2 changes: 1 addition & 1 deletion NNDropdown/ControlManifest.Input.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<manifest>
<control namespace="Controls" constructor="NNDropdown" version="0.0.94" display-name-key="NNDropdown" description-key="NN Relation converted into a Multiselect Dropdown" control-type="standard">
<control namespace="Controls" constructor="NNDropdown" version="0.0.100" display-name-key="NNDropdown" description-key="NN Relation converted into a Multiselect Dropdown" control-type="standard">
<!--external-service-usage node declares whether this 3rd party PCF control is using external service or not, if yes, this control will be considered as premium and please also add the external domain it is using.
If it is not using any external service, please set the enabled="false" and DO NOT add any domain below. The "enabled" will be true by default.
Example1:
Expand Down
6 changes: 4 additions & 2 deletions NNDropdown/fluentUIDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import * as operations from './operations';
import { EntityReference, Setting, DropDownData } from "./interface";
import { IInputs } from './generated/ManifestTypes';
import { useState } from 'react';
import { inputProperties } from '@fluentui/react';

const dropdownStyles: Partial<IDropdownStyles> = { dropdown: { } }; //width: 300
const dropdownStyles: Partial<IDropdownStyles> = { title: { border: 'none', backgroundColor: '#F5F5F5' }};

export const NNDropdownControl: React.FC<{ context: ComponentFramework.Context<IInputs>, setting: Setting, dropdowndata: DropDownData }> = ({ context, setting, dropdowndata }) => {

Expand Down Expand Up @@ -46,7 +47,8 @@ export const NNDropdownControl: React.FC<{ context: ComponentFramework.Context<I
multiSelect
defaultSelectedKeys={dropdowndata.selectedOptions} //selectedOptions
options={dropdowndata.allOptions} //allOptions
styles={dropdownStyles}
styles={dropdownStyles}
disabled={context.mode.isControlDisabled}
/>
);
};
2 changes: 1 addition & 1 deletion NNDropdown/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ReactDOM = require("react-dom");
import * as ReactDOM from 'react-dom'
import { IInputs, IOutputs } from "./generated/ManifestTypes";
import * as operations from './operations';

Expand Down
9 changes: 5 additions & 4 deletions NNDropdown/operations.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { IInputs } from "./generated/ManifestTypes";
import * as webAPIHelper from "./webAPIHelper";
import { EntityReference, Setting, DropDownOption, DropDownData, Globals } from "./interface";
import ReactDOM = require("react-dom");
import React = require("react");
import * as ReactDOM from 'react-dom';
import * as React from 'react'
import * as dropdown from './fluentUIDropdown';

export async function _sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}

export function _writeLog(message: string, data?: any) {
if (true) { //Needs to be set back to a shared value. Had issue when the control was on the form multiple times. Settings/Globals were mixed.
const condition = true;
if (condition) { //Needs to be set back to a shared value. Had issue when the control was on the form multiple times. Settings/Globals were mixed.
console.log(message, data);
}
}
Expand Down Expand Up @@ -167,8 +168,8 @@ export async function _execute(context: ComponentFramework.Context<IInputs>, con
ReactDOM.render(React.createElement(dropdown.NNDropdownControl, { context: context, setting: _setting, dropdowndata: dropDownData }), container);
}
else {
//@ts-ignore
const msg = <div>This record hasn't been created yet. To enable this control, create the record.</div>;
ReactDOM.render(msg, container);
}

}
Loading

0 comments on commit 09bab91

Please sign in to comment.