Merge pull request #5113 from nemortu/update-spfx-version-react-content-query-online

This commit is contained in:
Hugo Bernier 2024-04-17 21:53:36 -04:00 committed by GitHub
commit 64a9948a68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
47 changed files with 32587 additions and 37393 deletions

View File

@ -1,39 +1,38 @@
// For more information on how to run this SPFx project in a VS Code Remote Container, please visit https://aka.ms/spfx-devcontainer
{ {
"name": "SPFx 1.11.0", "name": "SPFx 1.18.2",
"image": "docker.io/m365pnp/spfx:1.11.0", "image": "docker.io/m365pnp/spfx:1.18.2",
// Set *default* container specific settings.json values on container create. "customizations": {
"settings": {}, "vscode": {
// Add the IDs of extensions you want installed when the container is created. "extensions": [
"extensions": [ "editorconfig.editorconfig",
"editorconfig.editorconfig", "dbaeumer.vscode-eslint"
"dbaeumer.vscode-eslint" ]
], }
// Use 'forwardPorts' to make a list of ports inside the container available locally. },
"forwardPorts": [ "forwardPorts": [
4321, 4321,
35729, 35729,
5432 5432
], ],
"portsAttributes": { "portsAttributes": {
"4321": { "4321": {
"protocol": "https", "protocol": "https",
"label": "Manifest", "label": "Manifest",
"onAutoForward": "silent", "onAutoForward": "silent",
"requireLocalPort": true "requireLocalPort": true
}, },
"5432": { "5432": {
"protocol": "https", "protocol": "https",
"label": "Workbench", "label": "Workbench",
"onAutoForward": "silent" "onAutoForward": "silent"
}, },
"35729": { "35729": {
"protocol": "https", "protocol": "https",
"label": "LiveReload", "label": "LiveReload",
"onAutoForward": "silent", "onAutoForward": "silent",
"requireLocalPort": true "requireLocalPort": true
} }
}, },
"postCreateCommand": "bash .devcontainer/spfx-startup.sh", "postCreateCommand": "bash .devcontainer/spfx-startup.sh",
"remoteUser": "node" "remoteUser": "node"
} }

View File

@ -7,9 +7,11 @@ echo
echo -e "\e[1;94mGenerating dev certificate\e[0m" echo -e "\e[1;94mGenerating dev certificate\e[0m"
gulp trust-dev-cert gulp trust-dev-cert
# Convert the generated PEM certificate to a CER certificate
openssl x509 -inform PEM -in ~/.rushstack/rushstack-serve.pem -outform DER -out ./spfx-dev-cert.cer
cp ~/.gcb-serve-data/gcb-serve.cer ./spfx-dev-cert.cer # Copy the PEM ecrtificate for non-Windows hosts
cp ~/.gcb-serve-data/gcb-serve.cer ./spfx-dev-cert.pem cp ~/.rushstack/rushstack-serve.pem ./spfx-dev-cert.pem
## add *.cer to .gitignore to prevent certificates from being saved in repo ## add *.cer to .gitignore to prevent certificates from being saved in repo
if ! grep -Fxq '*.cer' ./.gitignore if ! grep -Fxq '*.cer' ./.gitignore

View File

@ -0,0 +1,352 @@
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
extends: ['@microsoft/eslint-config-spfx/lib/profiles/react'],
parserOptions: { tsconfigRootDir: __dirname },
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
'parserOptions': {
'project': './tsconfig.json',
'ecmaVersion': 2018,
'sourceType': 'module'
},
rules: {
// Prevent usage of the JavaScript null value, while allowing code to access existing APIs that may require null. https://www.npmjs.com/package/@rushstack/eslint-plugin
'@rushstack/no-new-null': 1,
// Require Jest module mocking APIs to be called before any other statements in their code block. https://www.npmjs.com/package/@rushstack/eslint-plugin
'@rushstack/hoist-jest-mock': 1,
// Require regular expressions to be constructed from string constants rather than dynamically building strings at runtime. https://www.npmjs.com/package/@rushstack/eslint-plugin-security
'@rushstack/security/no-unsafe-regexp': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/adjacent-overload-signatures': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
//
// CONFIGURATION: By default, these are banned: String, Boolean, Number, Object, Symbol
'@typescript-eslint/ban-types': [
1,
{
'extendDefaults': false,
'types': {
'String': {
'message': 'Use \'string\' instead',
'fixWith': 'string'
},
'Boolean': {
'message': 'Use \'boolean\' instead',
'fixWith': 'boolean'
},
'Number': {
'message': 'Use \'number\' instead',
'fixWith': 'number'
},
'Object': {
'message': 'Use \'object\' instead, or else define a proper TypeScript type:'
},
'Symbol': {
'message': 'Use \'symbol\' instead',
'fixWith': 'symbol'
},
'Function': {
'message': 'The \'Function\' type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with \'new\'.\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
}
}
}
],
// RATIONALE: Code is more readable when the type of every variable is immediately obvious.
// Even if the compiler may be able to infer a type, this inference will be unavailable
// to a person who is reviewing a GitHub diff. This rule makes writing code harder,
// but writing code is a much less important activity than reading it.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/explicit-function-return-type': [
0,
{
'allowExpressions': true,
'allowTypedFunctionExpressions': true,
'allowHigherOrderFunctions': false
}
],
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: although this is a recommended rule, it is up to dev to select coding style.
// Set to 1 (warning) or 2 (error) to enable.
'@typescript-eslint/explicit-member-accessibility': 0,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-array-constructor': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
//
// RATIONALE: The "any" keyword disables static type checking, the main benefit of using TypeScript.
// This rule should be suppressed only in very special cases such as JSON.stringify()
// where the type really can be anything. Even if the type is flexible, another type
// may be more appropriate such as "unknown", "{}", or "Record<k,V>".
'@typescript-eslint/no-explicit-any': 0,
// RATIONALE: The #1 rule of promises is that every promise chain must be terminated by a catch()
// handler. Thus wherever a Promise arises, the code must either append a catch handler,
// or else return the object to a caller (who assumes this responsibility). Unterminated
// promise chains are a serious issue. Besides causing errors to be silently ignored,
// they can also cause a NodeJS process to terminate unexpectedly.
'@typescript-eslint/no-floating-promises': 0,
// RATIONALE: Catches a common coding mistake.
'@typescript-eslint/no-for-in-array': 2,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-misused-new': 2,
// RATIONALE: The "namespace" keyword is not recommended for organizing code because JavaScript lacks
// a "using" statement to traverse namespaces. Nested namespaces prevent certain bundler
// optimizations. If you are declaring loose functions/variables, it's better to make them
// static members of a class, since classes support property getters and their private
// members are accessible by unit tests. Also, the exercise of choosing a meaningful
// class name tends to produce more discoverable APIs: for example, search+replacing
// the function "reverse()" is likely to return many false matches, whereas if we always
// write "Text.reverse()" is more unique. For large scale organization, it's recommended
// to decompose your code into separate NPM packages, which ensures that component
// dependencies are tracked more conscientiously.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-namespace': [
1,
{
'allowDeclarations': false,
'allowDefinitionFiles': false
}
],
// RATIONALE: Parameter properties provide a shorthand such as "constructor(public title: string)"
// that avoids the effort of declaring "title" as a field. This TypeScript feature makes
// code easier to write, but arguably sacrifices readability: In the notes for
// "@typescript-eslint/member-ordering" we pointed out that fields are central to
// a class's design, so we wouldn't want to bury them in a constructor signature
// just to save some typing.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Set to 1 (warning) or 2 (error) to enable the rule
'@typescript-eslint/parameter-properties': 0,
// RATIONALE: When left in shipping code, unused variables often indicate a mistake. Dead code
// may impact performance.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-unused-vars': [
0,
{
'vars': 'all',
// Unused function arguments often indicate a mistake in JavaScript code. However in TypeScript code,
// the compiler catches most of those mistakes, and unused arguments are fairly common for type signatures
// that are overriding a base class method or implementing an interface.
'args': 'none'
}
],
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-use-before-define': [
2,
{
'functions': false,
'classes': true,
'variables': true,
'enums': true,
'typedefs': true
}
],
// Disallows require statements except in import statements.
// In other words, the use of forms such as var foo = require("foo") are banned. Instead use ES6 style imports or import foo = require("foo") imports.
'@typescript-eslint/no-var-requires': 'error',
// RATIONALE: The "module" keyword is deprecated except when describing legacy libraries.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/prefer-namespace-keyword': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: it's up to developer to decide if he wants to add type annotations
// Set to 1 (warning) or 2 (error) to enable the rule
'@typescript-eslint/no-inferrable-types': 0,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: declaration of empty interfaces may be helpful for generic types scenarios
'@typescript-eslint/no-empty-interface': 0,
// RATIONALE: This rule warns if setters are defined without getters, which is probably a mistake.
'accessor-pairs': 1,
// RATIONALE: In TypeScript, if you write x["y"] instead of x.y, it disables type checking.
'dot-notation': [
1,
{
'allowPattern': '^_'
}
],
// RATIONALE: Catches code that is likely to be incorrect
'eqeqeq': 0,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'for-direction': 1,
// RATIONALE: Catches a common coding mistake.
'guard-for-in': 2,
// RATIONALE: If you have more than 2,000 lines in a single source file, it's probably time
// to split up your code.
'max-lines': ['warn', { max: 2000 }],
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-async-promise-executor': 2,
// RATIONALE: Deprecated language feature.
'no-caller': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-compare-neg-zero': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-cond-assign': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-constant-condition': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-control-regex': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-debugger': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-delete-var': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-duplicate-case': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty-character-class': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty-pattern': 1,
// RATIONALE: Eval is a security concern and a performance concern.
'no-eval': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-ex-assign': 2,
// RATIONALE: System types are global and should not be tampered with in a scalable code base.
// If two different libraries (or two versions of the same library) both try to modify
// a type, only one of them can win. Polyfills are acceptable because they implement
// a standardized interoperable contract, but polyfills are generally coded in plain
// JavaScript.
'no-extend-native': 1,
// Disallow unnecessary labels
'no-extra-label': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-fallthrough': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-func-assign': 1,
// RATIONALE: Catches a common coding mistake.
'no-implied-eval': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-invalid-regexp': 2,
// RATIONALE: Catches a common coding mistake.
'no-label-var': 2,
// RATIONALE: Eliminates redundant code.
'no-lone-blocks': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-misleading-character-class': 2,
// RATIONALE: Catches a common coding mistake.
'no-multi-str': 2,
// RATIONALE: It's generally a bad practice to call "new Thing()" without assigning the result to
// a variable. Either it's part of an awkward expression like "(new Thing()).doSomething()",
// or else implies that the constructor is doing nontrivial computations, which is often
// a poor class design.
'no-new': 1,
// RATIONALE: Obsolete language feature that is deprecated.
'no-new-func': 2,
// RATIONALE: Obsolete language feature that is deprecated.
'no-new-object': 2,
// RATIONALE: Obsolete notation.
'no-new-wrappers': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-octal': 2,
// RATIONALE: Catches code that is likely to be incorrect
'no-octal-escape': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-regex-spaces': 2,
// RATIONALE: Catches a common coding mistake.
'no-return-assign': 2,
// RATIONALE: Security risk.
'no-script-url': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-self-assign': 2,
// RATIONALE: Catches a common coding mistake.
'no-self-compare': 2,
// RATIONALE: This avoids statements such as "while (a = next(), a && a.length);" that use
// commas to create compound expressions. In general code is more readable if each
// step is split onto a separate line. This also makes it easier to set breakpoints
// in the debugger.
'no-sequences': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-shadow-restricted-names': 2,
// RATIONALE: Obsolete language feature that is deprecated.
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-sparse-arrays': 2,
// RATIONALE: Although in theory JavaScript allows any possible data type to be thrown as an exception,
// such flexibility adds pointless complexity, by requiring every catch block to test
// the type of the object that it receives. Whereas if catch blocks can always assume
// that their object implements the "Error" contract, then the code is simpler, and
// we generally get useful additional information like a call stack.
'no-throw-literal': 2,
// RATIONALE: Catches a common coding mistake.
'no-unmodified-loop-condition': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-unsafe-finally': 2,
// RATIONALE: Catches a common coding mistake.
'no-unused-expressions': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-unused-labels': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-useless-catch': 1,
// RATIONALE: Avoids a potential performance problem.
'no-useless-concat': 1,
// RATIONALE: The "var" keyword is deprecated because of its confusing "hoisting" behavior.
// Always use "let" or "const" instead.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'no-var': 0,
// RATIONALE: Generally not needed in modern code.
'no-void': 1,
// RATIONALE: Obsolete language feature that is deprecated.
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-with': 2,
// RATIONALE: Makes logic easier to understand, since constants always have a known value
// @typescript-eslint\eslint-plugin\dist\configs\eslint-recommended.js
'prefer-const': 0,
// RATIONALE: Catches a common coding mistake where "resolve" and "reject" are confused.
'promise/param-names': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'require-atomic-updates': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'require-yield': 1,
// "Use strict" is redundant when using the TypeScript compiler.
'strict': [
2,
'never'
],
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'use-isnan': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
// Set to 1 (warning) or 2 (error) to enable.
// Rationale to disable: !!{}
'no-extra-boolean-cast': 0,
// ====================================================================
// @microsoft/eslint-plugin-spfx
// ====================================================================
'@microsoft/spfx/import-requires-chunk-name': 1,
'@microsoft/spfx/no-require-ensure': 2,
'@microsoft/spfx/pair-react-dom-render-unmount': 1
}
},
{
// For unit tests, we can be a little bit less strict. The settings below revise the
// defaults specified in the extended configurations, as well as above.
files: [
// Test files
'*.test.ts',
'*.test.tsx',
'*.spec.ts',
'*.spec.tsx',
// Facebook convention
'**/__mocks__/*.ts',
'**/__mocks__/*.tsx',
'**/__tests__/*.ts',
'**/__tests__/*.tsx',
// Microsoft convention
'**/test/*.ts',
'**/test/*.tsx'
],
rules: {}
}
]
};

View File

@ -29,3 +29,6 @@ obj
# Styles Generated Code # Styles Generated Code
*.scss.ts *.scss.ts
.heft
release

View File

@ -0,0 +1 @@
v18.19.0

View File

@ -1,13 +0,0 @@
{
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-scss"
],
"rules": {
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
"selector-pseudo-class-no-unknown": [ true, {
ignorePseudoClasses: ["global"],
}]
}
}

View File

@ -1,12 +1,17 @@
{ {
"@microsoft/generator-sharepoint": { "@microsoft/generator-sharepoint": {
"version": "1.11.0", "version": "1.18.2",
"libraryName": "react-content-query", "libraryName": "react-content-query",
"libraryId": "489c9f8f-8e66-4efb-8365-85279ba91433", "libraryId": "489c9f8f-8e66-4efb-8365-85279ba91433",
"environment": "spo", "environment": "spo",
"isDomainIsolated": false, "isDomainIsolated": false,
"packageManager": "npm", "packageManager": "npm",
"componentType": "webpart", "componentType": "webpart",
"isCreatingSolution": true "isCreatingSolution": true,
"sdkVersions": {
"@microsoft/teams-js": "2.12.0",
"@microsoft/microsoft-graph-client": "3.0.2"
},
"nodeVersion": "18.19.0"
} }
} }

View File

@ -14,14 +14,17 @@ While the original web part was based on an **XSLT** templating engine, this *Re
| :warning: Important | | :warning: Important |
|:---------------------------| |:---------------------------|
| Every SPFx version is only compatible with specific version(s) of Node.js. In order to be able to build this sample, please ensure that the version of Node on your workstation matches one of the versions listed in this section. This sample will not work on a different version of Node.| | Every SPFx version is optimally compatible with specific versions of Node.js. In order to be able to build this sample, you need to ensure that the version of Node on your workstation matches one of the versions listed in this section. This sample will not work on a different version of Node.|
|Refer to <https://aka.ms/spfx-matrix> for more information on SPFx compatibility. | |Refer to <https://aka.ms/spfx-matrix> for more information on SPFx compatibility. |
![SPFx 1.11](https://img.shields.io/badge/SPFx-1.11.0-green.svg) This sample is optimally compatible with the following environment configuration:
![Node.js v10](https://img.shields.io/badge/Node.js-v10-green.svg) ![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg)
![SPFx 1.18.2](https://img.shields.io/badge/SPFx-1.18.2-green.svg)
![Node.js v16 | v18](https://img.shields.io/badge/Node.js-v16%20%7C%20v18-green.svg)
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg)
![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg "SharePoint Server 2019 requires SPFx 1.4.1 or lower") ![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg "SharePoint Server 2019 requires SPFx 1.4.1 or lower")
![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1") ![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1")
![Local Workbench Incompatible](https://img.shields.io/badge/Local%20Workbench-Incompatible-red.svg "The solution requires access to content") ![Local Workbench Unsupported](https://img.shields.io/badge/Local%20Workbench-Unsupported-red.svg "Local workbench is no longer available as of SPFx 1.13 and above")
![Hosted Workbench Compatible](https://img.shields.io/badge/Hosted%20Workbench-Compatible-green.svg) ![Hosted Workbench Compatible](https://img.shields.io/badge/Hosted%20Workbench-Compatible-green.svg)
![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg) ![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg)

View File

@ -9,7 +9,7 @@
"The React Content Query Web Part is a modern version of the good old Content by Query Web Part that was introduced in SharePoint 2007. Built for SharePoint Online, this modern version is built against the new SharePoint Framework (SPFx) and uses the latest Web Stack practices. While the original Web Part was based on a XSLT templating engine, this React Web Part is based on the well known Handlebars templating engine, which empowers users to create simple, yet powerfull HTML templates for rendering the queried content. This new version also lets the user query any site collections which resides on the same domain url, add unlimited filters, query DateTime fields to the nearest minute rather than being limited to a day, and much more." "The React Content Query Web Part is a modern version of the good old Content by Query Web Part that was introduced in SharePoint 2007. Built for SharePoint Online, this modern version is built against the new SharePoint Framework (SPFx) and uses the latest Web Stack practices. While the original Web Part was based on a XSLT templating engine, this React Web Part is based on the well known Handlebars templating engine, which empowers users to create simple, yet powerfull HTML templates for rendering the queried content. This new version also lets the user query any site collections which resides on the same domain url, add unlimited filters, query DateTime fields to the nearest minute rather than being limited to a day, and much more."
], ],
"creationDateTime": "2021-01-07", "creationDateTime": "2021-01-07",
"updateDateTime": "2023-05-04", "updateDateTime": "2024-03-31",
"products": [ "products": [
"SharePoint" "SharePoint"
], ],
@ -20,7 +20,7 @@
}, },
{ {
"key": "SPFX-VERSION", "key": "SPFX-VERSION",
"value": "1.11.0" "value": "1.18.2"
} }
], ],
"thumbnails": [ "thumbnails": [
@ -138,10 +138,15 @@
"name": "Abderahman Moujahid" "name": "Abderahman Moujahid"
}, },
{ {
"gitHubAccount": "ChrisLizon", "gitHubAccount": "ChrisLizon",
"name": "Chris Lizon", "name": "Chris Lizon",
"pictureUrl": "https://github.com/ChrisLizon.png" "pictureUrl": "https://github.com/ChrisLizon.png"
} },
{
"gitHubAccount": "nemortu",
"name": "nemortu",
"pictureUrl": "https://github.com/nemortu.png"
}
], ],
"references": [ "references": [
{ {

View File

@ -1,4 +0,0 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
"deployCdnPath": "temp/deploy"
}

View File

@ -1,7 +1,7 @@
{ {
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json", "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"workingDir": "./temp/deploy/", "workingDir": "./release/assets/",
"account": "<!-- STORAGE ACCOUNT NAME -->", "account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "react-content-query", "container": "react-content-query",
"accessKey": "<!-- ACCESS KEY -->" "accessKey": "<!-- ACCESS KEY -->",
} }

View File

@ -50,7 +50,29 @@
"privacyUrl": "", "privacyUrl": "",
"termsOfUseUrl": "", "termsOfUseUrl": "",
"websiteUrl": "" "websiteUrl": ""
} },
"metadata": {
"shortDescription": {
"default": "react-content-query-webpart description"
},
"longDescription": {
"default": "react-content-query-webpart description"
},
"screenshotPaths": [],
"videoUrl": "",
"categories": []
},
"features": [
{
"title": "react-content-query-webpart ContentQueryWebPart Feature",
"description": "The feature that activates ContentQueryWebPart from the react-content-query-webpart solution.",
"id": "ac515af1-4490-4c7b-8191-d49b41b26c5e",
"version": "1.1.0.0",
"componentIds": [
"ac515af1-4490-4c7b-8191-d49b41b26c5e"
]
}
]
}, },
"paths": { "paths": {
"zippedPackage": "solution/react-content-query-webpart.sppkg" "zippedPackage": "solution/react-content-query-webpart.sppkg"

View File

@ -0,0 +1,3 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json"
}

View File

@ -1,10 +1,6 @@
{ {
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json", "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json",
"port": 4321, "port": 4321,
"https": true, "https": true,
"initialPage": "https://localhost:5432/workbench", "initialPage": "https://{tenantDomain}/_layouts/workbench.aspx"
"api": {
"port": 5432,
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
}
} }

View File

@ -27,9 +27,9 @@ build.configureWebpack.mergeConfig({
generatedConfiguration.resolve.alias = { handlebars: 'handlebars/dist/handlebars.min.js' }; generatedConfiguration.resolve.alias = { handlebars: 'handlebars/dist/handlebars.min.js' };
generatedConfiguration.module.rules.push( /*generatedConfiguration.module.rules.push(
{ test: /\.js$/, loader: 'unlazy-loader' } { test: /\.js$/, loader: 'unlazy-loader' }
); );*/
generatedConfiguration.node = { generatedConfiguration.node = {
fs: 'empty' fs: 'empty'
@ -39,28 +39,14 @@ build.configureWebpack.mergeConfig({
} }
}); });
/**
* StyleLinter configuration
* Reference and custom gulp task
*/
const stylelint = require('gulp-stylelint');
/* Stylelinter sub task */ var getTasks = build.rig.getTasks;
let styleLintSubTask = build.subTask('stylelint', (gulp) => { build.rig.getTasks = function () {
var result = getTasks.call(build.rig);
console.log('[stylelint]: By default style lint errors will not break your build. If you want to change this behaviour, modify failAfterError parameter in gulpfile.js.'); result.set('serve', result.get('serve-deprecated'));
return gulp
.src('src/**/*.scss')
.pipe(stylelint({
failAfterError: false,
reporters: [{
formatter: 'string',
console: true
}]
}));
});
/* end sub task */
return result;
};
build.initialize(gulp); build.initialize(gulp);

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
{ {
"name": "react-content-query-webpart", "name": "react-content-query-webpart",
"version": "1.1.0", "version": "1.2.0",
"private": true, "private": true,
"main": "lib/index.js",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=16.13.0 <17.0.0 || >=18.17.1 <19.0.0"
}, },
"main": "lib/index.js",
"scripts": { "scripts": {
"build": "gulp bundle", "build": "gulp bundle",
"clean": "gulp clean", "clean": "gulp clean",
@ -14,11 +14,11 @@
"dependencies": { "dependencies": {
"@microsoft/mgt": "^2.0.1", "@microsoft/mgt": "^2.0.1",
"@microsoft/sp-build-web": "1.18.0", "@microsoft/sp-build-web": "1.18.0",
"@microsoft/sp-core-library": "1.11.0", "@microsoft/sp-core-library": "1.18.2",
"@microsoft/sp-lodash-subset": "1.11.0", "@microsoft/sp-lodash-subset": "1.18.2",
"@microsoft/sp-office-ui-fabric-core": "1.11.0", "@microsoft/sp-office-ui-fabric-core": "1.18.2",
"@microsoft/sp-property-pane": "1.11.0", "@microsoft/sp-property-pane": "1.18.2",
"@microsoft/sp-webpart-base": "1.11.0", "@microsoft/sp-webpart-base": "1.18.2",
"@pnp/spfx-controls-react": "2.3.0", "@pnp/spfx-controls-react": "2.3.0",
"@pnp/spfx-property-controls": "2.2.0", "@pnp/spfx-property-controls": "2.2.0",
"@types/handlebars": "4.0.32", "@types/handlebars": "4.0.32",
@ -50,41 +50,39 @@
"morgan": ">=1.9.1", "morgan": ">=1.9.1",
"natives": "^1.1.6", "natives": "^1.1.6",
"node.extend": ">=1.1.7", "node.extend": ">=1.1.7",
"office-ui-fabric-react": "6.214.0",
"open": ">=6.0.0", "open": ">=6.0.0",
"randomatic": ">=3.0.0", "randomatic": ">=3.0.0",
"react": "16.8.5", "react": "17.0.1",
"react-ace": "^5.1.0", "react-dom": "17.0.1",
"react-dom": "16.8.5", "react-ace": "^11.0.1",
"set-value": ">=3.0.3", "set-value": ">=3.0.3",
"sshpk": ">=1.13.2", "sshpk": ">=1.13.2",
"stringstream": ">=0.0.6", "stringstream": ">=0.0.6",
"tar": ">=2.2.2", "tar": ">=2.2.2",
"underscore.string": ">=3.3.5", "underscore.string": ">=3.3.5",
"ws": ">=1.1.5" "ws": ">=1.1.5",
"tslib": "2.3.1",
"@fluentui/react": "^8.106.4"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/rush-stack-compiler-2.9": "0.7.16", "@microsoft/rush-stack-compiler-4.7": "0.1.0",
"@microsoft/rush-stack-compiler-3.3": "0.3.5", "@rushstack/eslint-config": "2.5.1",
"@microsoft/sp-module-interfaces": "1.11.0", "@microsoft/eslint-plugin-spfx": "1.18.2",
"@microsoft/sp-tslint-rules": "1.11.0", "@microsoft/eslint-config-spfx": "1.18.2",
"@microsoft/sp-webpart-workbench": "1.12.1", "@microsoft/sp-build-web": "1.18.2",
"@microsoft/sp-module-interfaces": "1.18.2",
"@types/chai": "3.4.34", "@types/chai": "3.4.34",
"@types/es6-promise": "0.0.33", "@types/es6-promise": "0.0.33",
"@types/mocha": "2.2.38", "@types/mocha": "2.2.38",
"@types/react": "16.8.8", "@types/react": "17.0.45",
"@types/react-dom": "16.8.3", "@types/react-dom": "17.0.17",
"@types/webpack-env": "1.13.1", "@types/webpack-env": "1.13.1",
"ajv": "5.2.2", "ajv": "5.2.2",
"awesome-typescript-loader": "^3.2.1", "eslint": "8.7.0",
"gulp": "~3.9.1", "eslint-plugin-react-hooks": "4.3.0",
"gulp": "4.0.2",
"gulp-sequence": "1.0.0", "gulp-sequence": "1.0.0",
"gulp-stylelint": "^13.0.0",
"jest": "^23.6.0", "jest": "^23.6.0",
"stylelint": "14.16.1", "typescript": "4.7.4"
"stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.14.2",
"tslint-microsoft-contrib": "^5.0.0",
"unlazy-loader": "^0.1.2"
} }
} }

View File

@ -1,7 +1,7 @@
import * as moment from 'moment'; import * as moment from 'moment';
import { Text } from '@microsoft/sp-core-library'; import { Text } from '@microsoft/sp-core-library';
import { isEmpty } from '@microsoft/sp-lodash-subset'; import { isEmpty } from '@microsoft/sp-lodash-subset';
import { IPersonaProps, ITag } from 'office-ui-fabric-react'; import { IPersonaProps, ITag } from '@fluentui/react';
import { IQuerySettings } from '../../webparts/contentQuery/components/IQuerySettings'; import { IQuerySettings } from '../../webparts/contentQuery/components/IQuerySettings';
import { IQueryFilter } from '../../controls/PropertyPaneQueryFilterPanel/components/QueryFilter/IQueryFilter'; import { IQueryFilter } from '../../controls/PropertyPaneQueryFilterPanel/components/QueryFilter/IQueryFilter';
import { QueryFilterOperator } from '../../controls/PropertyPaneQueryFilterPanel/components/QueryFilter/QueryFilterOperator'; import { QueryFilterOperator } from '../../controls/PropertyPaneQueryFilterPanel/components/QueryFilter/QueryFilterOperator';
@ -291,7 +291,9 @@ export class CamlQueryHelper {
if (!url) { if (!url) {
url = window.location.href; url = window.location.href;
} }
// eslint-disable-next-line no-useless-escape
name = name.replace(/[\[\]]/g, "\\$&"); name = name.replace(/[\[\]]/g, "\\$&");
// eslint-disable-next-line @rushstack/security/no-unsafe-regexp
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url); results = regex.exec(url);
if (!results) return null; if (!results) return null;

View File

@ -1,5 +1,5 @@
import * as strings from 'contentQueryStrings'; import * as strings from 'contentQueryStrings';
import { IDropdownOption, IPersonaProps, ITag } from 'office-ui-fabric-react'; import { IDropdownOption, IPersonaProps, ITag } from '@fluentui/react';
import { SPHttpClient, SPHttpClientResponse } from '@microsoft/sp-http'; import { SPHttpClient, SPHttpClientResponse } from '@microsoft/sp-http';
import { isEmpty } from '@microsoft/sp-lodash-subset'; import { isEmpty } from '@microsoft/sp-lodash-subset';
import { IWebPartContext } from '@microsoft/sp-webpart-base'; import { IWebPartContext } from '@microsoft/sp-webpart-base';
@ -295,6 +295,7 @@ export class ContentQueryService implements IContentQueryService {
this.listService.getListFields(webUrl, listId, ['InternalName', 'Title', 'Sortable'], 'Title').then((data: any) => { this.listService.getListFields(webUrl, listId, ['InternalName', 'Title', 'Sortable'], 'Title').then((data: any) => {
const sortableFields: any[] = data.value.filter((field) => { return field.Sortable == true; }); const sortableFields: any[] = data.value.filter((field) => { return field.Sortable == true; });
let options: IDropdownOption[] = [{ key: "", text: strings.queryFilterPanelStrings.queryFilterStrings.fieldSelectLabel }]; let options: IDropdownOption[] = [{ key: "", text: strings.queryFilterPanelStrings.queryFilterStrings.fieldSelectLabel }];
// eslint-disable-next-line no-useless-escape
const orderByOptions: IDropdownOption[] = sortableFields.map((field) => { return { key: field.InternalName, text: Text.format("{0} \{\{{1}\}\}", field.Title, field.InternalName) }; }); const orderByOptions: IDropdownOption[] = sortableFields.map((field) => { return { key: field.InternalName, text: Text.format("{0} \{\{{1}\}\}", field.Title, field.InternalName) }; });
options = options.concat(orderByOptions); options = options.concat(orderByOptions);
this.orderByOptions = options; this.orderByOptions = options;
@ -371,7 +372,8 @@ export class ContentQueryService implements IContentQueryService {
let items: IChecklistItem[] = fields.map((field) => { let items: IChecklistItem[] = fields.map((field) => {
return { return {
id: field.InternalName, id: field.InternalName,
label: Text.format("{0} \{\{{1}\}\}", field.Title, field.InternalName) // eslint-disable-next-line no-useless-escape
label: Text.format("{0} \{\{{1}\}}", field.Title, field.InternalName)
}; };
}); });
this.viewFields = items; this.viewFields = items;
@ -447,7 +449,7 @@ export class ContentQueryService implements IContentQueryService {
return new Promise<boolean>((resolve, reject) => { return new Promise<boolean>((resolve, reject) => {
this.spHttpClient.get(filePath, SPHttpClient.configurations.v1).then((response: SPHttpClientResponse) => { this.spHttpClient.get(filePath, SPHttpClient.configurations.v1).then((response: SPHttpClientResponse) => {
if (response.ok) { if (response.ok) {
resolve(); resolve(true);
} }
else { else {
reject(response.statusText); reject(response.statusText);
@ -479,6 +481,7 @@ export class ContentQueryService implements IContentQueryService {
* @param itemSelectorEnabled: Defines whether to render the item selector element in the template * @param itemSelectorEnabled: Defines whether to render the item selector element in the template
*************************************************************************************************/ *************************************************************************************************/
public generateDefaultTemplate(viewFields: string[], itemSelectorEnabled: boolean): string { public generateDefaultTemplate(viewFields: string[], itemSelectorEnabled: boolean): string {
// eslint-disable-next-line no-useless-escape
let viewFieldsStr = viewFields.map((field) => { return Text.format(" <span class='ms-DetailsRow-cell'><strong>{0}: </strong>\{\{{0}.textValue\}\}</span>", field); }).join("\n"); let viewFieldsStr = viewFields.map((field) => { return Text.format(" <span class='ms-DetailsRow-cell'><strong>{0}: </strong>\{\{{0}.textValue\}\}</span>", field); }).join("\n");
let selectItemStr = "\n <span><button class='selectItem' data-itemId='{{ID.textValue}}'>Select</button></span>"; let selectItemStr = "\n <span><button class='selectItem' data-itemId='{{ID.textValue}}'>Select</button></span>";
let template = Text.format(`<style type="text/css"> let template = Text.format(`<style type="text/css">

View File

@ -1,4 +1,4 @@
import { IDropdownOption, IPersonaProps, ITag } from 'office-ui-fabric-react'; import { IDropdownOption, IPersonaProps, ITag } from '@fluentui/react';
import { IQueryFilterField } from '../../controls/PropertyPaneQueryFilterPanel/components/QueryFilter/IQueryFilterField'; import { IQueryFilterField } from '../../controls/PropertyPaneQueryFilterPanel/components/QueryFilter/IQueryFilterField';
import { IChecklistItem } from '../../controls/PropertyPaneAsyncChecklist/components/AsyncChecklist/IChecklistItem'; import { IChecklistItem } from '../../controls/PropertyPaneAsyncChecklist/components/AsyncChecklist/IChecklistItem';
import { IContentQueryTemplateContext } from '../../webparts/contentQuery/components/IContentQueryTemplateContext'; import { IContentQueryTemplateContext } from '../../webparts/contentQuery/components/IContentQueryTemplateContext';
@ -23,4 +23,4 @@ export interface IContentQueryService {
clearCachedOrderByOptions: () => void; clearCachedOrderByOptions: () => void;
clearCachedFilterFields: () => void; clearCachedFilterFields: () => void;
clearCachedViewFields: () => void; clearCachedViewFields: () => void;
} }

View File

@ -19,8 +19,8 @@ export class PropertyPaneAsyncChecklist implements IPropertyPaneField<IPropertyP
/***************************************************************************************** /*****************************************************************************************
* Property pane's contructor * Property pane's contructor
* @param targetProperty * @param targetProperty
* @param properties * @param properties
*****************************************************************************************/ *****************************************************************************************/
constructor(targetProperty: string, properties: IPropertyPaneAsyncChecklistProps) { constructor(targetProperty: string, properties: IPropertyPaneAsyncChecklistProps) {
this.targetProperty = targetProperty; this.targetProperty = targetProperty;
@ -65,6 +65,7 @@ export class PropertyPaneAsyncChecklist implements IPropertyPaneField<IPropertyP
stateKey: new Date().toString() stateKey: new Date().toString()
}); });
// eslint-disable-next-line @microsoft/spfx/pair-react-dom-render-unmount
ReactDom.render(asyncChecklist, elem); ReactDom.render(asyncChecklist, elem);
this.loadedItems = true; this.loadedItems = true;
} }
@ -76,4 +77,4 @@ export class PropertyPaneAsyncChecklist implements IPropertyPaneField<IPropertyP
private onChange(checkedKeys: string[]): void { private onChange(checkedKeys: string[]): void {
this.properties.onPropertyChange(this.targetProperty, checkedKeys); this.properties.onPropertyChange(this.targetProperty, checkedKeys);
} }
} }

View File

@ -1,4 +1,3 @@
@import "~office-ui-fabric-react/dist/sass/References.scss";
.checklist { .checklist {
.checklistItems { .checklistItems {

View File

@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import { clone } from '@microsoft/sp-lodash-subset'; import { clone } from '@microsoft/sp-lodash-subset';
import { Text } from '@microsoft/sp-core-library'; import { Text } from '@microsoft/sp-core-library';
import { Spinner, Label, Checkbox } from 'office-ui-fabric-react'; import { Spinner, Label, Checkbox } from '@fluentui/react';
import { IAsyncChecklistProps } from './IAsyncChecklistProps'; import { IAsyncChecklistProps } from './IAsyncChecklistProps';
import { IAsyncChecklistState } from './IAsyncChecklistState'; import { IAsyncChecklistState } from './IAsyncChecklistState';
import { IChecklistItem } from './IChecklistItem'; import { IChecklistItem } from './IChecklistItem';
@ -10,7 +10,7 @@ import styles from './AsyncChecklist.module.scss';
export class AsyncChecklist extends React.Component<IAsyncChecklistProps, IAsyncChecklistState> { export class AsyncChecklist extends React.Component<IAsyncChecklistProps, IAsyncChecklistState> {
/************************************************************************************* /*************************************************************************************
* Stores the checked items * Stores the checked items
*************************************************************************************/ *************************************************************************************/
private checkedItems: string[]; private checkedItems: string[];
@ -62,7 +62,7 @@ export class AsyncChecklist extends React.Component<IAsyncChecklistProps, IAsync
/************************************************************************************* /*************************************************************************************
* Returns whether the checkbox with the specified ID should be checked or not * Returns whether the checkbox with the specified ID should be checked or not
* @param checkboxId * @param checkboxId
*************************************************************************************/ *************************************************************************************/
private isCheckboxChecked(checkboxId: string) { private isCheckboxChecked(checkboxId: string) {
return (this.checkedItems.filter((checkedItem) => { return checkedItem.toLowerCase().trim() == checkboxId.toLowerCase().trim(); }).length > 0); return (this.checkedItems.filter((checkedItem) => { return checkedItem.toLowerCase().trim() == checkboxId.toLowerCase().trim(); }).length > 0);
@ -73,6 +73,7 @@ export class AsyncChecklist extends React.Component<IAsyncChecklistProps, IAsync
* Loads the checklist items asynchronously * Loads the checklist items asynchronously
*************************************************************************************/ *************************************************************************************/
private loadItems() { private loadItems() {
// eslint-disable-next-line @typescript-eslint/no-this-alias
let _this_ = this; let _this_ = this;
_this_.checkedItems = this.getDefaultCheckedItems(); _this_.checkedItems = this.getDefaultCheckedItems();
@ -140,12 +141,12 @@ export class AsyncChecklist extends React.Component<IAsyncChecklistProps, IAsync
return ( return (
<div className={ styles.checklist }> <div className={ styles.checklist }>
<Label>{ this.props.strings.label }</Label> <Label>{ this.props.strings.label }</Label>
{ loading } { loading }
{ !this.state.loading && { !this.state.loading &&
<div className={ styles.checklistItems }> <div className={ styles.checklistItems }>
<div className={ styles.checklistPadding }>{ checklistItems }</div> <div className={ styles.checklistPadding }>{ checklistItems }</div>
</div> </div>

View File

@ -1,4 +1,4 @@
import { IDropdownOption } from 'office-ui-fabric-react'; import { IDropdownOption } from '@fluentui/react';
export interface IPropertyPaneAsyncDropdownProps { export interface IPropertyPaneAsyncDropdownProps {
label: string; label: string;
@ -8,4 +8,4 @@ export interface IPropertyPaneAsyncDropdownProps {
onPropertyChange: (propertyPath: string, newValue: any) => void; onPropertyChange: (propertyPath: string, newValue: any) => void;
selectedKey?: string | number; selectedKey?: string | number;
disabled?: boolean; disabled?: boolean;
} }

View File

@ -3,7 +3,7 @@ import * as ReactDom from 'react-dom';
import { } from "@microsoft/sp-webpart-base"; import { } from "@microsoft/sp-webpart-base";
import { } from "@microsoft/sp-webpart-base"; import { } from "@microsoft/sp-webpart-base";
import { IPropertyPaneField, PropertyPaneFieldType } from "@microsoft/sp-property-pane"; import { IPropertyPaneField, PropertyPaneFieldType } from "@microsoft/sp-property-pane";
import { IDropdownOption } from 'office-ui-fabric-react'; import { IDropdownOption } from '@fluentui/react';
import { IPropertyPaneAsyncDropdownProps } from './IPropertyPaneAsyncDropdownProps'; import { IPropertyPaneAsyncDropdownProps } from './IPropertyPaneAsyncDropdownProps';
import { IPropertyPaneAsyncDropdownInternalProps } from './IPropertyPaneAsyncDropdownInternalProps'; import { IPropertyPaneAsyncDropdownInternalProps } from './IPropertyPaneAsyncDropdownInternalProps';
import { AsyncDropdown } from './components/AsyncDropdown/AsyncDropdown'; import { AsyncDropdown } from './components/AsyncDropdown/AsyncDropdown';
@ -20,8 +20,8 @@ export class PropertyPaneAsyncDropdown implements IPropertyPaneField<IPropertyPa
/***************************************************************************************** /*****************************************************************************************
* Property pane's contructor * Property pane's contructor
* @param targetProperty * @param targetProperty
* @param properties * @param properties
*****************************************************************************************/ *****************************************************************************************/
constructor(targetProperty: string, properties: IPropertyPaneAsyncDropdownProps) { constructor(targetProperty: string, properties: IPropertyPaneAsyncDropdownProps) {
this.targetProperty = targetProperty; this.targetProperty = targetProperty;
@ -70,6 +70,7 @@ export class PropertyPaneAsyncDropdown implements IPropertyPaneField<IPropertyPa
stateKey: new Date().toString() stateKey: new Date().toString()
}); });
// eslint-disable-next-line @microsoft/spfx/pair-react-dom-render-unmount
ReactDom.render(asyncDropDown, elem); ReactDom.render(asyncDropDown, elem);
} }
@ -80,4 +81,4 @@ export class PropertyPaneAsyncDropdown implements IPropertyPaneField<IPropertyPa
private onChanged(option: IDropdownOption, index?: number): void { private onChanged(option: IDropdownOption, index?: number): void {
this.properties.onPropertyChange(this.targetProperty, option.key); this.properties.onPropertyChange(this.targetProperty, option.key);
} }
} }

View File

@ -1,6 +1,6 @@
import * as React from 'react'; import * as React from 'react';
import { Text } from '@microsoft/sp-core-library'; import { Text } from '@microsoft/sp-core-library';
import { Dropdown, IDropdownOption, Spinner } from 'office-ui-fabric-react'; import { Dropdown, IDropdownOption, Spinner } from '@fluentui/react';
import { IAsyncDropdownProps } from './IAsyncDropdownProps'; import { IAsyncDropdownProps } from './IAsyncDropdownProps';
import { IAsyncDropdownState } from './IAsyncDropdownState'; import { IAsyncDropdownState } from './IAsyncDropdownState';
import { cloneDeep } from '@microsoft/sp-lodash-subset'; import { cloneDeep } from '@microsoft/sp-lodash-subset';
@ -10,8 +10,8 @@ export class AsyncDropdown extends React.Component<IAsyncDropdownProps, IAsyncDr
/************************************************************************************* /*************************************************************************************
* Component's constructor * Component's constructor
* @param props * @param props
* @param state * @param state
*************************************************************************************/ *************************************************************************************/
constructor(props: IAsyncDropdownProps, state: IAsyncDropdownState) { constructor(props: IAsyncDropdownProps, state: IAsyncDropdownState) {
super(props); super(props);
@ -102,7 +102,7 @@ export class AsyncDropdown extends React.Component<IAsyncDropdownProps, IAsyncDr
* Renders the the AsyncDropdown component * Renders the the AsyncDropdown component
*************************************************************************************/ *************************************************************************************/
public render() { public render() {
const loading = !this.state.processed ? <Spinner label={this.props.loadingLabel} /> : <div />; const loading = !this.state.processed ? <Spinner label={this.props.loadingLabel} /> : <div />;
const error = this.state.error != null ? <div className="ms-TextField-errorMessage ms-u-slideDownIn20">{ Text.format(this.props.errorLabelFormat, this.state.error) }</div> : <div />; const error = this.state.error != null ? <div className="ms-TextField-errorMessage ms-u-slideDownIn20">{ Text.format(this.props.errorLabelFormat, this.state.error) }</div> : <div />;

View File

@ -1,4 +1,4 @@
import { IDropdownOption } from 'office-ui-fabric-react'; import { IDropdownOption } from '@fluentui/react';
export interface IAsyncDropdownProps { export interface IAsyncDropdownProps {
label: string; label: string;
@ -9,4 +9,4 @@ export interface IAsyncDropdownProps {
selectedKey?: string | number; selectedKey?: string | number;
disabled?: boolean; disabled?: boolean;
stateKey?: string; stateKey?: string;
} }

View File

@ -1,8 +1,8 @@
import { IDropdownOption } from 'office-ui-fabric-react'; import { IDropdownOption } from '@fluentui/react';
export interface IAsyncDropdownState { export interface IAsyncDropdownState {
processed: boolean; processed: boolean;
options: IDropdownOption[]; options: IDropdownOption[];
selectedKey: string | number; selectedKey: string | number;
error: string; error: string;
} }

View File

@ -1,4 +1,4 @@
import { IPersonaProps, ITag } from 'office-ui-fabric-react'; import { IPersonaProps, ITag } from '@fluentui/react';
import { IQueryFilter } from './components/QueryFilter/IQueryFilter'; import { IQueryFilter } from './components/QueryFilter/IQueryFilter';
import { IQueryFilterField } from './components/QueryFilter/IQueryFilterField'; import { IQueryFilterField } from './components/QueryFilter/IQueryFilterField';
import { IQueryFilterPanelStrings } from './components/QueryFilterPanel/IQueryFilterPanelStrings'; import { IQueryFilterPanelStrings } from './components/QueryFilterPanel/IQueryFilterPanelStrings';
@ -12,4 +12,4 @@ export interface IPropertyPaneQueryFilterPanelProps {
trimEmptyFiltersOnChange?: boolean; trimEmptyFiltersOnChange?: boolean;
disabled?: boolean; disabled?: boolean;
strings: IQueryFilterPanelStrings; strings: IQueryFilterPanelStrings;
} }

View File

@ -70,6 +70,7 @@ export class PropertyPaneQueryFilterPanel implements IPropertyPaneField<IPropert
stateKey: new Date().toString() stateKey: new Date().toString()
}); });
// eslint-disable-next-line @microsoft/spfx/pair-react-dom-render-unmount
ReactDom.render(queryFilterpanel, elem); ReactDom.render(queryFilterpanel, elem);
} }

View File

@ -1,7 +1,7 @@
import { IQueryFilterField } from './IQueryFilterField'; import { IQueryFilterField } from './IQueryFilterField';
import { QueryFilterOperator } from './QueryFilterOperator'; import { QueryFilterOperator } from './QueryFilterOperator';
import { QueryFilterJoin } from './QueryFilterJoin'; import { QueryFilterJoin } from './QueryFilterJoin';
import { IPersonaProps, ITag } from 'office-ui-fabric-react'; import { IPersonaProps, ITag } from '@fluentui/react';
export interface IQueryFilter { export interface IQueryFilter {
index: number; index: number;
@ -12,4 +12,4 @@ export interface IQueryFilter {
includeTime?: boolean; includeTime?: boolean;
me?: boolean; me?: boolean;
join: QueryFilterJoin; join: QueryFilterJoin;
} }

View File

@ -1,4 +1,4 @@
import { IPersonaProps, ITag } from 'office-ui-fabric-react'; import { IPersonaProps, ITag } from '@fluentui/react';
import { IQueryFilter } from './IQueryFilter'; import { IQueryFilter } from './IQueryFilter';
import { IQueryFilterField } from './IQueryFilterField'; import { IQueryFilterField } from './IQueryFilterField';
import { IQueryFilterStrings } from './IQueryFilterStrings'; import { IQueryFilterStrings } from './IQueryFilterStrings';
@ -12,4 +12,4 @@ export interface IQueryFilterProps {
onChanged?: (filter: IQueryFilter) => void; onChanged?: (filter: IQueryFilter) => void;
disabled?: boolean; disabled?: boolean;
strings: IQueryFilterStrings; strings: IQueryFilterStrings;
} }

View File

@ -1,4 +1,4 @@
import { IDatePickerStrings } from 'office-ui-fabric-react'; import { IDatePickerStrings } from '@fluentui/react';
export interface IQueryFilterStrings { export interface IQueryFilterStrings {
fieldLabel: string; fieldLabel: string;
@ -33,4 +33,4 @@ export interface IQueryFilterStrings {
datePickerDatePlaceholder: string; datePickerDatePlaceholder: string;
datePickerExpressionPlaceholder: string; datePickerExpressionPlaceholder: string;
datePickerIncludeTime: string; datePickerIncludeTime: string;
} }

View File

@ -1,4 +1,4 @@
@import "~office-ui-fabric-react/dist/sass/References.scss"; @import '~@fluentui/react/dist/sass/References.scss';
.queryFilter { .queryFilter {
background-color: transparent; background-color: transparent;

View File

@ -1,11 +1,12 @@
/* eslint-disable react/no-direct-mutation-state */
import * as React from 'react'; import * as React from 'react';
import * as moment from 'moment'; import * as moment from 'moment';
import { cloneDeep, isEmpty } from '@microsoft/sp-lodash-subset'; import { cloneDeep, isEmpty } from '@microsoft/sp-lodash-subset';
import { Text } from '@microsoft/sp-core-library'; import { Text } from '@microsoft/sp-core-library';
import { Dropdown, IDropdownOption, TextField, ChoiceGroup, IChoiceGroupOption } from 'office-ui-fabric-react'; import { Dropdown, IDropdownOption, TextField, ChoiceGroup, IChoiceGroupOption } from '@fluentui/react';
import { NormalPeoplePicker, IPersonaProps, IBasePickerSuggestionsProps, Label } from 'office-ui-fabric-react'; import { NormalPeoplePicker, IPersonaProps, IBasePickerSuggestionsProps, Label } from '@fluentui/react';
import { TagPicker, ITag } from 'office-ui-fabric-react'; import { TagPicker, ITag } from '@fluentui/react';
import { DatePicker, Checkbox } from 'office-ui-fabric-react'; import { DatePicker, Checkbox } from '@fluentui/react';
import { IQueryFilter } from './IQueryFilter'; import { IQueryFilter } from './IQueryFilter';
import { QueryFilterOperator } from './QueryFilterOperator'; import { QueryFilterOperator } from './QueryFilterOperator';
import { QueryFilterJoin } from './QueryFilterJoin'; import { QueryFilterJoin } from './QueryFilterJoin';
@ -17,26 +18,26 @@ import styles
export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilterState> { export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilterState> {
/************************************************************************************* /*************************************************************************************
* Stores the IQueryFilter config of the current filter * Stores the IQueryFilter config of the current filter
*************************************************************************************/ *************************************************************************************/
private filter:IQueryFilter; private filter:IQueryFilter;
/************************************************************************************* /*************************************************************************************
* Component's constructor * Component's constructor
* @param props * @param props
* @param state * @param state
*************************************************************************************/ *************************************************************************************/
constructor(props: IQueryFilterProps, state: IQueryFilterState) { constructor(props: IQueryFilterProps, state: IQueryFilterState) {
super(props); super(props);
moment.locale(this.props.strings.datePickerLocale); moment.locale(this.props.strings.datePickerLocale);
this.state = { this.state = {
filter: (this.props.filter ? cloneDeep(this.props.filter) : { index: 0, field: null, operator: QueryFilterOperator.Eq, value: '', join: QueryFilterJoin.Or }), filter: (this.props.filter ? cloneDeep(this.props.filter) : { index: 0, field: null, operator: QueryFilterOperator.Eq, value: '', join: QueryFilterJoin.Or }),
pickersKey: Math.random() pickersKey: Math.random()
}; };
this.onAnyChange = this.onAnyChange.bind(this); this.onAnyChange = this.onAnyChange.bind(this);
} }
@ -44,7 +45,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
/************************************************************************************* /*************************************************************************************
* When the field Dropdown changes * When the field Dropdown changes
*************************************************************************************/ *************************************************************************************/
private onFieldDropdownChange(option: IDropdownOption, index?: number) { private onFieldDropdownChange(event: React.FormEvent<HTMLDivElement>, option?: IDropdownOption, index?: number) {
let field = this.props.fields.filter((f) => { return f.internalName == option.key; }); let field = this.props.fields.filter((f) => { return f.internalName == option.key; });
this.state.filter.field = field != null && field.length > 0 ? field[0] : null; this.state.filter.field = field != null && field.length > 0 ? field[0] : null;
this.state.filter.operator = (this.state.filter.field && (this.state.filter.field.type == QueryFilterFieldType.User || this.state.filter.field.type == QueryFilterFieldType.Taxonomy) ? QueryFilterOperator.ContainsAny : QueryFilterOperator.Eq); this.state.filter.operator = (this.state.filter.field && (this.state.filter.field.type == QueryFilterFieldType.User || this.state.filter.field.type == QueryFilterFieldType.Taxonomy) ? QueryFilterOperator.ContainsAny : QueryFilterOperator.Eq);
@ -60,7 +61,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
/************************************************************************************* /*************************************************************************************
* When the operator Dropdown changes * When the operator Dropdown changes
*************************************************************************************/ *************************************************************************************/
private onOperatorDropdownChange(option: IDropdownOption, index?: number) { private onOperatorDropdownChange(event: React.FormEvent<HTMLDivElement>, option?: IDropdownOption, index?: number) {
this.state.filter.operator = QueryFilterOperator[option.key]; this.state.filter.operator = QueryFilterOperator[option.key];
this.setState({ filter: this.state.filter, pickersKey: this.state.pickersKey }); this.setState({ filter: this.state.filter, pickersKey: this.state.pickersKey });
this.onAnyChange(); this.onAnyChange();
@ -70,7 +71,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
/************************************************************************************* /*************************************************************************************
* When the TextField value changes * When the TextField value changes
*************************************************************************************/ *************************************************************************************/
private onValueTextFieldChange(newValue: string): string { private onValueTextFieldChange(event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string): string {
if(this.state.filter.value != newValue) { if(this.state.filter.value != newValue) {
this.state.filter.value = newValue; this.state.filter.value = newValue;
this.onAnyChange(); this.onAnyChange();
@ -104,6 +105,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
* When the NormalPeoplePicker value changes * When the NormalPeoplePicker value changes
*************************************************************************************/ *************************************************************************************/
private onTaxonomyPickerResolve(items: ITag[]) { private onTaxonomyPickerResolve(items: ITag[]) {
// eslint-disable-next-line react/no-direct-mutation-state
this.state.filter.value = items; this.state.filter.value = items;
this.onAnyChange(); this.onAnyChange();
} }
@ -118,7 +120,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
this.setState({ filter: this.state.filter, pickersKey: this.state.pickersKey }); this.setState({ filter: this.state.filter, pickersKey: this.state.pickersKey });
this.onAnyChange(); this.onAnyChange();
} }
/************************************************************************************* /*************************************************************************************
* When the date expression text field value changes * When the date expression text field value changes
@ -126,14 +128,17 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
private onDateExpressionChange(newValue: string): string { private onDateExpressionChange(newValue: string): string {
// Validates the picker // Validates the picker
// eslint-disable-next-line no-useless-escape
let regex = new RegExp(/^\[Today\](\s{0,}[\+-]\s{0,}\[{0,1}\d{1,4}\]{0,1}){0,1}$/); let regex = new RegExp(/^\[Today\](\s{0,}[\+-]\s{0,}\[{0,1}\d{1,4}\]{0,1}){0,1}$/);
let isValid = regex.test(newValue) || isEmpty(newValue); let isValid = regex.test(newValue) || isEmpty(newValue);
let errorMsg = isValid ? '' : this.props.strings.datePickerExpressionError; let errorMsg = isValid ? '' : this.props.strings.datePickerExpressionError;
if(isValid) { if(isValid) {
// If the change is NOT triggered by the date picker change // If the change is NOT triggered by the date picker change
if(!(isEmpty(newValue) && this.state.filter.value != null)) { if(!(isEmpty(newValue) && this.state.filter.value != null)) {
// eslint-disable-next-line react/no-direct-mutation-state
this.state.filter.value = null; this.state.filter.value = null;
// eslint-disable-next-line react/no-direct-mutation-state
this.state.filter.expression = newValue; this.state.filter.expression = newValue;
this.setState({ filter: this.state.filter, pickersKey: this.state.pickersKey }); this.setState({ filter: this.state.filter, pickersKey: this.state.pickersKey });
this.onAnyChange(); this.onAnyChange();
@ -150,6 +155,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
* @param checked : Whether the checkbox is not checked or not * @param checked : Whether the checkbox is not checked or not
*************************************************************************************/ *************************************************************************************/
private onDateIncludeTimeChange(ev?: React.FormEvent<HTMLInputElement>, checked?: boolean) { private onDateIncludeTimeChange(ev?: React.FormEvent<HTMLInputElement>, checked?: boolean) {
// eslint-disable-next-line react/no-direct-mutation-state
this.state.filter.includeTime = checked; this.state.filter.includeTime = checked;
this.onAnyChange(); this.onAnyChange();
} }
@ -160,6 +166,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
*************************************************************************************/ *************************************************************************************/
private onJoinChoiceChange(ev?: React.FormEvent<HTMLInputElement>, option?: IChoiceGroupOption) { private onJoinChoiceChange(ev?: React.FormEvent<HTMLInputElement>, option?: IChoiceGroupOption) {
if(option) { if(option) {
// eslint-disable-next-line react/no-direct-mutation-state
this.state.filter.join = QueryFilterJoin[option.key]; this.state.filter.join = QueryFilterJoin[option.key];
this.onAnyChange(); this.onAnyChange();
} }
@ -185,6 +192,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
]; ];
for(let field of this.props.fields) { for(let field of this.props.fields) {
// eslint-disable-next-line no-useless-escape
let option:IDropdownOption = { key: field.internalName, text: Text.format("{0} \{\{{1}\}\}", field.displayName, field.internalName) }; let option:IDropdownOption = { key: field.internalName, text: Text.format("{0} \{\{{1}\}\}", field.displayName, field.internalName) };
options.push(option); options.push(option);
} }
@ -240,11 +248,18 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
* Returns the options for the operator Dropdown component * Returns the options for the operator Dropdown component
*************************************************************************************/ *************************************************************************************/
private getJoinGroupOptions(): IChoiceGroupOption[] { private getJoinGroupOptions(): IChoiceGroupOption[] {
/*
let options:IChoiceGroupOption[] = [ let options:IChoiceGroupOption[] = [
{ key: QueryFilterJoin[QueryFilterJoin.And], text: this.props.strings.andLabel, checked: (this.state.filter.join == QueryFilterJoin.And) }, { key: QueryFilterJoin[QueryFilterJoin.And], text: this.props.strings.andLabel, checked: (this.state.filter.join == QueryFilterJoin.And) },
{ key: QueryFilterJoin[QueryFilterJoin.Or], text: this.props.strings.orLabel, checked: (this.state.filter.join == QueryFilterJoin.Or) } { key: QueryFilterJoin[QueryFilterJoin.Or], text: this.props.strings.orLabel, checked: (this.state.filter.join == QueryFilterJoin.Or) }
]; ];
return options; return options;
*/
let options:IChoiceGroupOption[] = [
{ key: QueryFilterJoin[QueryFilterJoin.And], text: this.props.strings.andLabel},
{ key: QueryFilterJoin[QueryFilterJoin.Or], text: this.props.strings.orLabel}
];
return options;
} }
@ -338,20 +353,21 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
<div className={styles.paddingContainer}> <div className={styles.paddingContainer}>
<Dropdown label={this.props.strings.fieldLabel} <Dropdown label={this.props.strings.fieldLabel}
disabled={this.props.disabled} disabled={this.props.disabled}
onChanged={this.onFieldDropdownChange.bind(this)} onChange={this.onFieldDropdownChange.bind(this)}
selectedKey={filterFieldKey} selectedKey={filterFieldKey}
options={this.getFieldDropdownOptions()} /> options={this.getFieldDropdownOptions()} />
<Dropdown label={this.props.strings.operatorLabel} <Dropdown label={this.props.strings.operatorLabel}
disabled={this.props.disabled} disabled={this.props.disabled}
onChanged={this.onOperatorDropdownChange.bind(this)} onChange={this.onOperatorDropdownChange.bind(this)}
selectedKey={QueryFilterOperator[this.state.filter.operator]} selectedKey={QueryFilterOperator[this.state.filter.operator]}
options={this.getOperatorDropdownOptions()} /> options={this.getOperatorDropdownOptions()} />
{ showTextField && { showTextField &&
<TextField label={this.props.strings.valueLabel} <TextField label={this.props.strings.valueLabel}
disabled={this.props.disabled} disabled={this.props.disabled}
onGetErrorMessage={ this.onValueTextFieldChange.bind(this) } //onGetErrorMessage={ this.onValueTextFieldChange.bind(this) }
onChange={this.onValueTextFieldChange.bind(this)}
deferredValidationTime={500} deferredValidationTime={500}
value={ this.state.filter.value != null ? this.state.filter.value as string : '' } /> value={ this.state.filter.value != null ? this.state.filter.value as string : '' } />
} }
@ -390,7 +406,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
{ showDatePicker && { showDatePicker &&
<div> <div>
<DatePicker <DatePicker
label={ this.props.strings.valueLabel } label={ this.props.strings.valueLabel }
placeholder={ this.props.strings.datePickerDatePlaceholder } placeholder={ this.props.strings.datePickerDatePlaceholder }
allowTextInput={ true } allowTextInput={ true }
@ -399,7 +415,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
parseDateFromString={ this.onDatePickerParse.bind(this) } parseDateFromString={ this.onDatePickerParse.bind(this) }
onSelectDate={ this.onDatePickerChange.bind(this) } onSelectDate={ this.onDatePickerChange.bind(this) }
strings={ this.props.strings.datePickerStrings } /> strings={ this.props.strings.datePickerStrings } />
<TextField <TextField
placeholder={ this.props.strings.datePickerExpressionPlaceholder } placeholder={ this.props.strings.datePickerExpressionPlaceholder }
onGetErrorMessage={ this.onDateExpressionChange.bind(this) } onGetErrorMessage={ this.onDateExpressionChange.bind(this) }
deferredValidationTime={ 500 } deferredValidationTime={ 500 }
@ -411,7 +427,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
</div> </div>
} }
<ChoiceGroup options={this.getJoinGroupOptions()} <ChoiceGroup options={this.getJoinGroupOptions()}
onChange={this.onJoinChoiceChange.bind(this)} onChange={this.onJoinChoiceChange.bind(this)}
disabled={this.props.disabled} /> disabled={this.props.disabled} />
</div> </div>

View File

@ -1,4 +1,4 @@
import { IPersonaProps, ITag } from 'office-ui-fabric-react'; import { IPersonaProps, ITag } from '@fluentui/react';
import { IQueryFilter } from '../QueryFilter/IQueryFilter'; import { IQueryFilter } from '../QueryFilter/IQueryFilter';
import { IQueryFilterField } from '../QueryFilter/IQueryFilterField'; import { IQueryFilterField } from '../QueryFilter/IQueryFilterField';
import { IQueryFilterPanelStrings } from './IQueryFilterPanelStrings'; import { IQueryFilterPanelStrings } from './IQueryFilterPanelStrings';
@ -13,4 +13,4 @@ export interface IQueryFilterPanelProps {
trimEmptyFiltersOnChange?: boolean; trimEmptyFiltersOnChange?: boolean;
strings: IQueryFilterPanelStrings; strings: IQueryFilterPanelStrings;
stateKey?: string; stateKey?: string;
} }

View File

@ -1,4 +1,4 @@
@import "~office-ui-fabric-react/dist/sass/References.scss"; @import '~@fluentui/react/dist/sass/References.scss';
.queryFilterPanel { .queryFilterPanel {
.queryFilterPanelItems { .queryFilterPanelItems {

View File

@ -1,8 +1,9 @@
/* eslint-disable react/no-direct-mutation-state */
import * as React from 'react'; import * as React from 'react';
import { cloneDeep } from '@microsoft/sp-lodash-subset'; import { cloneDeep } from '@microsoft/sp-lodash-subset';
import { Text } from '@microsoft/sp-core-library'; import { Text } from '@microsoft/sp-core-library';
import { isEmpty } from '@microsoft/sp-lodash-subset'; import { isEmpty } from '@microsoft/sp-lodash-subset';
import { Spinner, CommandButton, ButtonType, Label } from 'office-ui-fabric-react'; import { Spinner, CommandButton, ButtonType, Label } from '@fluentui/react';
import { QueryFilter } from '../QueryFilter/QueryFilter'; import { QueryFilter } from '../QueryFilter/QueryFilter';
import { IQueryFilter } from '../QueryFilter/IQueryFilter'; import { IQueryFilter } from '../QueryFilter/IQueryFilter';
import { QueryFilterOperator } from '../QueryFilter/QueryFilterOperator'; import { QueryFilterOperator } from '../QueryFilter/QueryFilterOperator';

View File

@ -18,8 +18,8 @@ export class PropertyPaneTextDialog implements IPropertyPaneField<IPropertyPaneT
/***************************************************************************************** /*****************************************************************************************
* Property pane's contructor * Property pane's contructor
* @param targetProperty * @param targetProperty
* @param properties * @param properties
*****************************************************************************************/ *****************************************************************************************/
constructor(targetProperty: string, properties: IPropertyPaneTextDialogProps) { constructor(targetProperty: string, properties: IPropertyPaneTextDialogProps) {
this.targetProperty = targetProperty; this.targetProperty = targetProperty;
@ -62,6 +62,7 @@ export class PropertyPaneTextDialog implements IPropertyPaneField<IPropertyPaneT
stateKey: new Date().toString() stateKey: new Date().toString()
}); });
// eslint-disable-next-line @microsoft/spfx/pair-react-dom-render-unmount
ReactDom.render(textDialog, elem); ReactDom.render(textDialog, elem);
} }
@ -72,4 +73,4 @@ export class PropertyPaneTextDialog implements IPropertyPaneField<IPropertyPaneT
private onChanged(text: string): void { private onChanged(text: string): void {
this.properties.onPropertyChange(this.targetProperty, text); this.properties.onPropertyChange(this.targetProperty, text);
} }
} }

View File

@ -1,4 +1,4 @@
@import "~office-ui-fabric-react/dist/sass/References.scss"; @import '~@fluentui/react/dist/sass/References.scss';
.ace_editor.ace_autocomplete { .ace_editor.ace_autocomplete {
z-index: 2000000 !important; z-index: 2000000 !important;

View File

@ -1,3 +1,4 @@
@import '~@fluentui/react/dist/sass/References.scss';
.textDialog { .textDialog {
max-width: 100%; max-width: 100%;
} }

View File

@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import { Dialog, DialogType, DialogFooter } from 'office-ui-fabric-react'; import { Dialog, DialogType, DialogFooter } from '@fluentui/react';
import { Button, ButtonType, Label } from 'office-ui-fabric-react'; import { Button, ButtonType, Label } from '@fluentui/react';
import { TextField } from 'office-ui-fabric-react'; import { TextField } from '@fluentui/react';
import { ITextDialogProps } from './ITextDialogProps'; import { ITextDialogProps } from './ITextDialogProps';
import { ITextDialogState } from './ITextDialogState'; import { ITextDialogState } from './ITextDialogState';
import AceEditor from 'react-ace'; import AceEditor from 'react-ace';
@ -17,8 +17,8 @@ export class TextDialog extends React.Component<ITextDialogProps, ITextDialogSta
/************************************************************************************* /*************************************************************************************
* Component's constructor * Component's constructor
* @param props * @param props
* @param state * @param state
*************************************************************************************/ *************************************************************************************/
constructor(props: ITextDialogProps, state: ITextDialogState) { constructor(props: ITextDialogProps, state: ITextDialogState) {
super(props); super(props);
@ -79,7 +79,7 @@ export class TextDialog extends React.Component<ITextDialogProps, ITextDialogSta
return ( return (
<div> <div>
<Label>{ this.props.strings.dialogButtonLabel }</Label> <Label>{ this.props.strings.dialogButtonLabel }</Label>
<Button label={ this.props.strings.dialogButtonLabel } onClick={ this.showDialog.bind(this) }>{ this.props.strings.dialogButtonText }</Button> <Button label={ this.props.strings.dialogButtonLabel } onClick={ this.showDialog.bind(this) }>{ this.props.strings.dialogButtonText }</Button>
<Dialog type={ DialogType.normal } <Dialog type={ DialogType.normal }
@ -89,7 +89,7 @@ export class TextDialog extends React.Component<ITextDialogProps, ITextDialogSta
subText={ this.props.strings.dialogSubText } subText={ this.props.strings.dialogSubText }
isBlocking={ true } isBlocking={ true }
containerClassName={ 'ms-dialogMainOverride ' + styles.textDialog }> containerClassName={ 'ms-dialogMainOverride ' + styles.textDialog }>
<AceEditor <AceEditor
width="100%" width="100%"
mode="html" mode="html"

View File

@ -11,7 +11,7 @@ import { IPropertyPaneToggleProps, PropertyPaneToggle } from "@microsoft/sp-prop
import { IPropertyPaneLabelProps, PropertyPaneLabel } from "@microsoft/sp-property-pane"; import { IPropertyPaneLabelProps, PropertyPaneLabel } from "@microsoft/sp-property-pane";
import { IPropertyPaneButtonProps, PropertyPaneButton, PropertyPaneButtonType } from "@microsoft/sp-property-pane"; import { IPropertyPaneButtonProps, PropertyPaneButton, PropertyPaneButtonType } from "@microsoft/sp-property-pane";
import { update, get, isEmpty } from '@microsoft/sp-lodash-subset'; import { update, get, isEmpty } from '@microsoft/sp-lodash-subset';
import { IDropdownOption, IPersonaProps, ITag } from 'office-ui-fabric-react'; import { IDropdownOption, IPersonaProps, ITag } from '@fluentui/react';
import ContentQuery from './components/ContentQuery'; import ContentQuery from './components/ContentQuery';
import { IContentQueryProps } from './components/IContentQueryProps'; import { IContentQueryProps } from './components/IContentQueryProps';
import { IQuerySettings } from './components/IQuerySettings'; import { IQuerySettings } from './components/IQuerySettings';
@ -139,6 +139,7 @@ export default class ContentQueryWebPart
if (this.properties.enableMGT) if (this.properties.enableMGT)
{ {
// Add MGT dependencies // Add MGT dependencies
// eslint-disable-next-line @typescript-eslint/no-var-requires
const MGT:any = require('@microsoft/mgt'); const MGT:any = require('@microsoft/mgt');
// We only need to re-register the SharePoint provider if we didn't register it before // We only need to re-register the SharePoint provider if we didn't register it before
@ -168,6 +169,7 @@ export default class ContentQueryWebPart
themeVariant: this._themeVariant themeVariant: this._themeVariant
} }
); );
// eslint-disable-next-line @microsoft/spfx/pair-react-dom-render-unmount
ReactDom.render(element, this.domElement); ReactDom.render(element, this.domElement);
} }
@ -548,7 +550,7 @@ export default class ContentQueryWebPart
/*************************************************************************** /***************************************************************************
* Validates the templateUrl property * Validates the templateUrl property
***************************************************************************/ ***************************************************************************/
private onTemplateUrlChange(value: string): Promise<String> { private onTemplateUrlChange(value: string): Promise<string> {
Log.verbose(this.logSource, "WebPart property 'templateUrl' has changed, refreshing WebPart...", this.context.serviceScope); Log.verbose(this.logSource, "WebPart property 'templateUrl' has changed, refreshing WebPart...", this.context.serviceScope);
return new Promise<string>((resolve, reject) => { return new Promise<string>((resolve, reject) => {
@ -576,7 +578,7 @@ export default class ContentQueryWebPart
/*************************************************************************** /***************************************************************************
* Validates the itemLimit property * Validates the itemLimit property
***************************************************************************/ ***************************************************************************/
private onItemLimitChange(value: string): Promise<String> { private onItemLimitChange(value: string): Promise<string> {
Log.verbose(this.logSource, "WebPart property 'itemLimit' has changed, refreshing WebPart...", this.context.serviceScope); Log.verbose(this.logSource, "WebPart property 'itemLimit' has changed, refreshing WebPart...", this.context.serviceScope);
return new Promise<string>((resolve, reject) => { return new Promise<string>((resolve, reject) => {

View File

@ -1,7 +1,7 @@
@import "~office-ui-fabric-react/dist/sass/References.scss"; @import '~@fluentui/react/dist/sass/References.scss';
.cqwp { .cqwp {
.cqwpValidations { .cqwpValidations {
padding-top: 0; padding-top: 0;
padding-left: 20px; padding-left: 20px;

View File

@ -1,7 +1,7 @@
import * as React from 'react'; import * as React from 'react';
import * as Handlebars from "handlebars"; import * as Handlebars from "handlebars";
import * as strings from 'contentQueryStrings'; import * as strings from 'contentQueryStrings';
import { Spinner } from 'office-ui-fabric-react'; import { Spinner } from '@fluentui/react';
import { isEmpty } from '@microsoft/sp-lodash-subset'; import { isEmpty } from '@microsoft/sp-lodash-subset';
import { Text } from '@microsoft/sp-core-library'; import { Text } from '@microsoft/sp-core-library';
import { IContentQueryProps } from './IContentQueryProps'; import { IContentQueryProps } from './IContentQueryProps';
@ -10,7 +10,7 @@ import { IContentQueryTemplateContext } from './IContentQueryTemplat
import { SPComponentLoader } from '@microsoft/sp-loader'; import { SPComponentLoader } from '@microsoft/sp-loader';
import styles from './ContentQuery.module.scss'; import styles from './ContentQuery.module.scss';
import { Placeholder } from "@pnp/spfx-controls-react/lib/Placeholder"; import { Placeholder } from "@pnp/spfx-controls-react/lib/Placeholder";
import { Icon } from 'office-ui-fabric-react/lib/components/Icon'; import { Icon } from '@fluentui/react';
import { IMandatoryFieldsStatus } from './IMandatoryFieldsStatus'; import { IMandatoryFieldsStatus } from './IMandatoryFieldsStatus';
import { IReadonlyTheme } from '@microsoft/sp-component-base'; import { IReadonlyTheme } from '@microsoft/sp-component-base';
@ -41,6 +41,7 @@ export default class ContentQuery extends React.Component<IContentQueryProps, IC
super(props); super(props);
// Imports the handlebars-helpers // Imports the handlebars-helpers
// eslint-disable-next-line @typescript-eslint/no-var-requires
let helpers = require<any>('handlebars-helpers')({ let helpers = require<any>('handlebars-helpers')({
handlebars: Handlebars handlebars: Handlebars
}); });
@ -65,6 +66,7 @@ export default class ContentQuery extends React.Component<IContentQueryProps, IC
*************************************************************************************/ *************************************************************************************/
private loadExternalScriptsSequentially(scriptUrls: string[]): Promise<{}> { private loadExternalScriptsSequentially(scriptUrls: string[]): Promise<{}> {
var index = 0; var index = 0;
// eslint-disable-next-line @typescript-eslint/no-this-alias
var _this_ = this; var _this_ = this;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -80,7 +82,7 @@ export default class ContentQuery extends React.Component<IContentQueryProps, IC
}); });
} }
else { else {
resolve(); resolve(null);
} }
} }
next(); next();
@ -386,7 +388,7 @@ export default class ContentQuery extends React.Component<IContentQueryProps, IC
{/* Shows the query results once loaded */} {/* Shows the query results once loaded */}
{mandatoryFieldsConfigured && !this.state.loading && !this.state.error && {mandatoryFieldsConfigured && !this.state.loading && !this.state.error &&
<div dangerouslySetInnerHTML={this.createMarkup(this.state.processedTemplateResult)}></div> <div dangerouslySetInnerHTML={this.createMarkup(this.state.processedTemplateResult)} />
} }
</div> </div>

View File

@ -1,6 +1,7 @@
{ {
"extends": "./node_modules/@microsoft/rush-stack-compiler-2.9/includes/tsconfig-web.json", "extends": "./node_modules/@microsoft/rush-stack-compiler-4.7/includes/tsconfig-web.json",
"compilerOptions": { "compilerOptions": {
"noImplicitAny": false,
"target": "es5", "target": "es5",
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"module": "esnext", "module": "esnext",
@ -25,15 +26,12 @@
"lib": [ "lib": [
"es5", "es5",
"dom", "dom",
"es2015.collection" "es2015.collection",
"es2015.promise"
] ]
}, },
"include": [ "include": [
"src/**/*.ts", "src/**/*.ts",
"src/**/*.tsx" "src/**/*.tsx"
],
"exclude": [
"node_modules",
"lib"
] ]
} }

View File

@ -1,26 +0,0 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.3/includes/tsconfig-web.json",
"rules": {
"class-name": false,
"export-name": false,
"forin": false,
"label-position": false,
"member-access": true,
"no-arg": false,
"no-console": false,
"no-construct": false,
"no-duplicate-variable": true,
"no-eval": false,
"no-internal-module": true,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"semicolon": true,
"trailing-comma": false,
"typedef": false,
"typedef-whitespace": false,
"variable-name": false,
"whitespace": false
}
}