init commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import * as React from 'react';
|
||||
import { Label } from '@fluentui/react-components';
|
||||
|
||||
export interface IHelloWorldProps {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export class HelloWorld extends React.Component<IHelloWorldProps> {
|
||||
public render(): React.ReactNode {
|
||||
return (
|
||||
<Label>
|
||||
Hello {this.props.name}!
|
||||
</Label>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2020": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:react/recommended",
|
||||
"plugin:promise/recommended"
|
||||
],
|
||||
"globals": {
|
||||
"ComponentFramework": true
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2020,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"@microsoft/power-apps",
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unused-vars": "off"
|
||||
},
|
||||
"settings": {
|
||||
"react": {
|
||||
"version": "detect"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "pcf-project",
|
||||
"version": "1.0.0",
|
||||
"description": "Project containing your PowerApps Component Framework (PCF) control.",
|
||||
"scripts": {
|
||||
"build": "pcf-scripts build",
|
||||
"clean": "pcf-scripts clean",
|
||||
"lint": "pcf-scripts lint",
|
||||
"lint:fix": "pcf-scripts lint fix",
|
||||
"rebuild": "pcf-scripts rebuild",
|
||||
"start": "pcf-scripts start",
|
||||
"start:watch": "pcf-scripts start watch",
|
||||
"refreshTypes": "pcf-scripts refreshTypes"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^16.14.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/eslint-plugin-power-apps": "^0.2.51",
|
||||
"@types/powerapps-component-framework": "^1.3.15",
|
||||
"@types/react": "^16.14.60",
|
||||
"@types/react-dom": "^16.9.24",
|
||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-promise": "^7.1.0",
|
||||
"eslint-plugin-react": "^7.37.1",
|
||||
"pcf-scripts": "^1",
|
||||
"pcf-start": "^1",
|
||||
"react": "^16.14.0",
|
||||
"typescript": "^4.9.5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<manifest>
|
||||
<control namespace="$namespaceplaceholder$" constructor="$controlnameplaceholder$" version="0.0.1" display-name-key="$controlnameplaceholder$" description-key="$controlnameplaceholder$ description" control-type="virtual" design-mapping-file="design-maps/map.Fluent.xml">
|
||||
<!--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 false by default.
|
||||
Example1:
|
||||
<external-service-usage enabled="true">
|
||||
<domain>www.Microsoft.com</domain>
|
||||
</external-service-usage>
|
||||
Example2:
|
||||
<external-service-usage enabled="false">
|
||||
</external-service-usage>
|
||||
-->
|
||||
<external-service-usage enabled="false">
|
||||
<!--UNCOMMENT TO ADD EXTERNAL DOMAINS
|
||||
<domain></domain>
|
||||
<domain></domain>
|
||||
-->
|
||||
</external-service-usage>
|
||||
<!-- dataset node represents a set of entity records on CDS; allow more than one datasets -->
|
||||
<data-set name="sampleDataSet" display-name-key="Dataset_Display_Key">
|
||||
<!-- 'property-set' node represents a unique, configurable property that each record in the dataset must provide. -->
|
||||
<!-- UNCOMMENT TO ADD PROPERTY-SET NODE
|
||||
<property-set name="samplePropertySet" display-name-key="Property_Display_Key" description-key="Property_Desc_Key" of-type="SingleLine.Text" usage="bound" required="true" />
|
||||
-->
|
||||
</data-set>
|
||||
<resources>
|
||||
<code path="index.ts" order="1"/>
|
||||
<platform-library name="React" version="$pcfReactVersion$" />
|
||||
<platform-library name="Fluent" version="$pcfFluentVersion$" />
|
||||
<!-- UNCOMMENT TO ADD MORE RESOURCES
|
||||
<css path="css/$controlnameplaceholder$.css" order="1" />
|
||||
<resx path="strings/$controlnameplaceholder$.1033.resx" version="1.0.0" />
|
||||
-->
|
||||
</resources>
|
||||
<!-- UNCOMMENT TO ENABLE THE SPECIFIED API
|
||||
<feature-usage>
|
||||
<uses-feature name="Device.captureAudio" required="true" />
|
||||
<uses-feature name="Device.captureImage" required="true" />
|
||||
<uses-feature name="Device.captureVideo" required="true" />
|
||||
<uses-feature name="Device.getBarcodeValue" required="true" />
|
||||
<uses-feature name="Device.getCurrentPosition" required="true" />
|
||||
<uses-feature name="Device.pickFile" required="true" />
|
||||
<uses-feature name="Utility" required="true" />
|
||||
<uses-feature name="WebAPI" required="true" />
|
||||
</feature-usage>
|
||||
-->
|
||||
</control>
|
||||
</manifest>
|
||||
@@ -0,0 +1,58 @@
|
||||
import { IInputs, IOutputs } from "./generated/ManifestTypes";
|
||||
import { HelloWorld, IHelloWorldProps } from "./HelloWorld";
|
||||
import * as React from "react";
|
||||
import DataSetInterfaces = ComponentFramework.PropertyHelper.DataSetApi;
|
||||
type DataSet = ComponentFramework.PropertyTypes.DataSet;
|
||||
|
||||
export class $controlnameplaceholder$ implements ComponentFramework.ReactControl<IInputs, IOutputs> {
|
||||
private theComponent: ComponentFramework.ReactControl<IInputs, IOutputs>;
|
||||
private notifyOutputChanged: () => void;
|
||||
|
||||
/**
|
||||
* Empty constructor.
|
||||
*/
|
||||
constructor() { }
|
||||
|
||||
/**
|
||||
* Used to initialize the control instance. Controls can kick off remote server calls and other initialization actions here.
|
||||
* Data-set values are not initialized here, use updateView.
|
||||
* @param context The entire property bag available to control via Context Object; It contains values as set up by the customizer mapped to property names defined in the manifest, as well as utility functions.
|
||||
* @param notifyOutputChanged A callback method to alert the framework that the control has new outputs ready to be retrieved asynchronously.
|
||||
* @param state A piece of data that persists in one session for a single user. Can be set at any point in a controls life cycle by calling 'setControlState' in the Mode interface.
|
||||
*/
|
||||
public init(
|
||||
context: ComponentFramework.Context<IInputs>,
|
||||
notifyOutputChanged: () => void,
|
||||
state: ComponentFramework.Dictionary
|
||||
): void {
|
||||
this.notifyOutputChanged = notifyOutputChanged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when any value in the property bag has changed. This includes field values, data-sets, global values such as container height and width, offline status, control metadata values such as label, visible, etc.
|
||||
* @param context The entire property bag available to control via Context Object; It contains values as set up by the customizer mapped to names defined in the manifest, as well as utility functions
|
||||
* @returns ReactElement root react element for the control
|
||||
*/
|
||||
public updateView(context: ComponentFramework.Context<IInputs>): React.ReactElement {
|
||||
const props: IHelloWorldProps = { name: 'Power Apps' };
|
||||
return React.createElement(
|
||||
HelloWorld, props
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* It is called by the framework prior to a control receiving new data.
|
||||
* @returns an object based on nomenclature defined in manifest, expecting object[s] for property marked as "bound" or "output"
|
||||
*/
|
||||
public getOutputs(): IOutputs {
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the control is to be removed from the DOM tree. Controls should use this call for cleanup.
|
||||
* i.e. cancelling any pending remote calls, removing listeners, etc.
|
||||
*/
|
||||
public destroy(): void {
|
||||
// Add code to cleanup control if necessary
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user