sample react-content-query-online cannot be built, updated to SPFX 1.18.2 and did a few fixes to be abled to build a working sample

This commit is contained in:
Florin DUCA 2024-03-31 14:05:39 +02:00
parent 166e37a008
commit 882ec700ae
39 changed files with 32494 additions and 37333 deletions

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
*.scss.ts
.heft
release

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": {
"version": "1.11.0",
"version": "1.18.2",
"libraryName": "react-content-query",
"libraryId": "489c9f8f-8e66-4efb-8365-85279ba91433",
"environment": "spo",
"isDomainIsolated": false,
"packageManager": "npm",
"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

@ -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",
"workingDir": "./temp/deploy/",
"workingDir": "./release/assets/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "react-content-query",
"accessKey": "<!-- ACCESS KEY -->"
}
"accessKey": "<!-- ACCESS KEY -->",
}

View File

@ -50,7 +50,29 @@
"privacyUrl": "",
"termsOfUseUrl": "",
"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": {
"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,
"https": true,
"initialPage": "https://localhost:5432/workbench",
"api": {
"port": 5432,
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
}
"initialPage": "https://{tenantDomain}/_layouts/workbench.aspx"
}

View File

@ -27,9 +27,9 @@ build.configureWebpack.mergeConfig({
generatedConfiguration.resolve.alias = { handlebars: 'handlebars/dist/handlebars.min.js' };
generatedConfiguration.module.rules.push(
/*generatedConfiguration.module.rules.push(
{ test: /\.js$/, loader: 'unlazy-loader' }
);
);*/
generatedConfiguration.node = {
fs: 'empty'
@ -39,28 +39,14 @@ build.configureWebpack.mergeConfig({
}
});
/**
* StyleLinter configuration
* Reference and custom gulp task
*/
const stylelint = require('gulp-stylelint');
/* Stylelinter sub task */
let styleLintSubTask = build.subTask('stylelint', (gulp) => {
var getTasks = build.rig.getTasks;
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.');
return gulp
.src('src/**/*.scss')
.pipe(stylelint({
failAfterError: false,
reporters: [{
formatter: 'string',
console: true
}]
}));
});
/* end sub task */
result.set('serve', result.get('serve-deprecated'));
return result;
};
build.initialize(gulp);

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,7 +1,7 @@
import * as moment from 'moment';
import { Text } from '@microsoft/sp-core-library';
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 { IQueryFilter } from '../../controls/PropertyPaneQueryFilterPanel/components/QueryFilter/IQueryFilter';
import { QueryFilterOperator } from '../../controls/PropertyPaneQueryFilterPanel/components/QueryFilter/QueryFilterOperator';

View File

@ -1,5 +1,5 @@
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 { isEmpty } from '@microsoft/sp-lodash-subset';
import { IWebPartContext } from '@microsoft/sp-webpart-base';
@ -447,7 +447,7 @@ export class ContentQueryService implements IContentQueryService {
return new Promise<boolean>((resolve, reject) => {
this.spHttpClient.get(filePath, SPHttpClient.configurations.v1).then((response: SPHttpClientResponse) => {
if (response.ok) {
resolve();
resolve(true);
}
else {
reject(response.statusText);

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 { IChecklistItem } from '../../controls/PropertyPaneAsyncChecklist/components/AsyncChecklist/IChecklistItem';
import { IContentQueryTemplateContext } from '../../webparts/contentQuery/components/IContentQueryTemplateContext';
@ -23,4 +23,4 @@ export interface IContentQueryService {
clearCachedOrderByOptions: () => void;
clearCachedFilterFields: () => void;
clearCachedViewFields: () => void;
}
}

View File

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

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import { clone } from '@microsoft/sp-lodash-subset';
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 { IAsyncChecklistState } from './IAsyncChecklistState';
import { IChecklistItem } from './IChecklistItem';
@ -10,7 +10,7 @@ import styles from './AsyncChecklist.module.scss';
export class AsyncChecklist extends React.Component<IAsyncChecklistProps, IAsyncChecklistState> {
/*************************************************************************************
* Stores the checked items
* Stores the checked items
*************************************************************************************/
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
* @param checkboxId
* @param checkboxId
*************************************************************************************/
private isCheckboxChecked(checkboxId: string) {
return (this.checkedItems.filter((checkedItem) => { return checkedItem.toLowerCase().trim() == checkboxId.toLowerCase().trim(); }).length > 0);
@ -140,12 +140,12 @@ export class AsyncChecklist extends React.Component<IAsyncChecklistProps, IAsync
return (
<div className={ styles.checklist }>
<Label>{ this.props.strings.label }</Label>
{ loading }
{ !this.state.loading &&
{ !this.state.loading &&
<div className={ styles.checklistItems }>
<div className={ styles.checklistPadding }>{ checklistItems }</div>
</div>

View File

@ -1,4 +1,4 @@
import { IDropdownOption } from 'office-ui-fabric-react';
import { IDropdownOption } from '@fluentui/react';
export interface IPropertyPaneAsyncDropdownProps {
label: string;
@ -8,4 +8,4 @@ export interface IPropertyPaneAsyncDropdownProps {
onPropertyChange: (propertyPath: string, newValue: any) => void;
selectedKey?: string | number;
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 { IPropertyPaneField, PropertyPaneFieldType } from "@microsoft/sp-property-pane";
import { IDropdownOption } from 'office-ui-fabric-react';
import { IDropdownOption } from '@fluentui/react';
import { IPropertyPaneAsyncDropdownProps } from './IPropertyPaneAsyncDropdownProps';
import { IPropertyPaneAsyncDropdownInternalProps } from './IPropertyPaneAsyncDropdownInternalProps';
import { AsyncDropdown } from './components/AsyncDropdown/AsyncDropdown';
@ -20,8 +20,8 @@ export class PropertyPaneAsyncDropdown implements IPropertyPaneField<IPropertyPa
/*****************************************************************************************
* Property pane's contructor
* @param targetProperty
* @param properties
* @param targetProperty
* @param properties
*****************************************************************************************/
constructor(targetProperty: string, properties: IPropertyPaneAsyncDropdownProps) {
this.targetProperty = targetProperty;
@ -80,4 +80,4 @@ export class PropertyPaneAsyncDropdown implements IPropertyPaneField<IPropertyPa
private onChanged(option: IDropdownOption, index?: number): void {
this.properties.onPropertyChange(this.targetProperty, option.key);
}
}
}

View File

@ -1,6 +1,6 @@
import * as React from 'react';
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 { IAsyncDropdownState } from './IAsyncDropdownState';
import { cloneDeep } from '@microsoft/sp-lodash-subset';
@ -10,8 +10,8 @@ export class AsyncDropdown extends React.Component<IAsyncDropdownProps, IAsyncDr
/*************************************************************************************
* Component's constructor
* @param props
* @param state
* @param props
* @param state
*************************************************************************************/
constructor(props: IAsyncDropdownProps, state: IAsyncDropdownState) {
super(props);
@ -102,7 +102,7 @@ export class AsyncDropdown extends React.Component<IAsyncDropdownProps, IAsyncDr
* Renders the the AsyncDropdown component
*************************************************************************************/
public render() {
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 />;

View File

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

View File

@ -1,8 +1,8 @@
import { IDropdownOption } from 'office-ui-fabric-react';
import { IDropdownOption } from '@fluentui/react';
export interface IAsyncDropdownState {
processed: boolean;
options: IDropdownOption[];
selectedKey: string | number;
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 { IQueryFilterField } from './components/QueryFilter/IQueryFilterField';
import { IQueryFilterPanelStrings } from './components/QueryFilterPanel/IQueryFilterPanelStrings';
@ -12,4 +12,4 @@ export interface IPropertyPaneQueryFilterPanelProps {
trimEmptyFiltersOnChange?: boolean;
disabled?: boolean;
strings: IQueryFilterPanelStrings;
}
}

View File

@ -1,7 +1,7 @@
import { IQueryFilterField } from './IQueryFilterField';
import { QueryFilterOperator } from './QueryFilterOperator';
import { QueryFilterJoin } from './QueryFilterJoin';
import { IPersonaProps, ITag } from 'office-ui-fabric-react';
import { IPersonaProps, ITag } from '@fluentui/react';
export interface IQueryFilter {
index: number;
@ -12,4 +12,4 @@ export interface IQueryFilter {
includeTime?: boolean;
me?: boolean;
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 { IQueryFilterField } from './IQueryFilterField';
import { IQueryFilterStrings } from './IQueryFilterStrings';
@ -12,4 +12,4 @@ export interface IQueryFilterProps {
onChanged?: (filter: IQueryFilter) => void;
disabled?: boolean;
strings: IQueryFilterStrings;
}
}

View File

@ -1,4 +1,4 @@
import { IDatePickerStrings } from 'office-ui-fabric-react';
import { IDatePickerStrings } from '@fluentui/react';
export interface IQueryFilterStrings {
fieldLabel: string;
@ -33,4 +33,4 @@ export interface IQueryFilterStrings {
datePickerDatePlaceholder: string;
datePickerExpressionPlaceholder: 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 {
background-color: transparent;

View File

@ -2,10 +2,10 @@ import * as React
import * as moment from 'moment';
import { cloneDeep, isEmpty } from '@microsoft/sp-lodash-subset';
import { Text } from '@microsoft/sp-core-library';
import { Dropdown, IDropdownOption, TextField, ChoiceGroup, IChoiceGroupOption } from 'office-ui-fabric-react';
import { NormalPeoplePicker, IPersonaProps, IBasePickerSuggestionsProps, Label } from 'office-ui-fabric-react';
import { TagPicker, ITag } from 'office-ui-fabric-react';
import { DatePicker, Checkbox } from 'office-ui-fabric-react';
import { Dropdown, IDropdownOption, TextField, ChoiceGroup, IChoiceGroupOption } from '@fluentui/react';
import { NormalPeoplePicker, IPersonaProps, IBasePickerSuggestionsProps, Label } from '@fluentui/react';
import { TagPicker, ITag } from '@fluentui/react';
import { DatePicker, Checkbox } from '@fluentui/react';
import { IQueryFilter } from './IQueryFilter';
import { QueryFilterOperator } from './QueryFilterOperator';
import { QueryFilterJoin } from './QueryFilterJoin';
@ -17,26 +17,26 @@ import styles
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;
/*************************************************************************************
* Component's constructor
* @param props
* @param state
* @param props
* @param state
*************************************************************************************/
constructor(props: IQueryFilterProps, state: IQueryFilterState) {
super(props);
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 }),
pickersKey: Math.random()
};
this.onAnyChange = this.onAnyChange.bind(this);
}
@ -44,7 +44,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
/*************************************************************************************
* 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; });
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);
@ -60,7 +60,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
/*************************************************************************************
* 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.setState({ filter: this.state.filter, pickersKey: this.state.pickersKey });
this.onAnyChange();
@ -70,7 +70,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
/*************************************************************************************
* 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) {
this.state.filter.value = newValue;
this.onAnyChange();
@ -118,7 +118,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
this.setState({ filter: this.state.filter, pickersKey: this.state.pickersKey });
this.onAnyChange();
}
/*************************************************************************************
* When the date expression text field value changes
@ -129,7 +129,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
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 errorMsg = isValid ? '' : this.props.strings.datePickerExpressionError;
if(isValid) {
// If the change is NOT triggered by the date picker change
if(!(isEmpty(newValue) && this.state.filter.value != null)) {
@ -240,11 +240,18 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
* Returns the options for the operator Dropdown component
*************************************************************************************/
private getJoinGroupOptions(): IChoiceGroupOption[] {
/*
let options:IChoiceGroupOption[] = [
{ 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) }
];
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 +345,21 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
<div className={styles.paddingContainer}>
<Dropdown label={this.props.strings.fieldLabel}
disabled={this.props.disabled}
onChanged={this.onFieldDropdownChange.bind(this)}
onChange={this.onFieldDropdownChange.bind(this)}
selectedKey={filterFieldKey}
options={this.getFieldDropdownOptions()} />
<Dropdown label={this.props.strings.operatorLabel}
disabled={this.props.disabled}
onChanged={this.onOperatorDropdownChange.bind(this)}
onChange={this.onOperatorDropdownChange.bind(this)}
selectedKey={QueryFilterOperator[this.state.filter.operator]}
options={this.getOperatorDropdownOptions()} />
{ showTextField &&
<TextField label={this.props.strings.valueLabel}
disabled={this.props.disabled}
onGetErrorMessage={ this.onValueTextFieldChange.bind(this) }
//onGetErrorMessage={ this.onValueTextFieldChange.bind(this) }
onChange={this.onValueTextFieldChange.bind(this)}
deferredValidationTime={500}
value={ this.state.filter.value != null ? this.state.filter.value as string : '' } />
}
@ -390,7 +398,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
{ showDatePicker &&
<div>
<DatePicker
<DatePicker
label={ this.props.strings.valueLabel }
placeholder={ this.props.strings.datePickerDatePlaceholder }
allowTextInput={ true }
@ -399,7 +407,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
parseDateFromString={ this.onDatePickerParse.bind(this) }
onSelectDate={ this.onDatePickerChange.bind(this) }
strings={ this.props.strings.datePickerStrings } />
<TextField
<TextField
placeholder={ this.props.strings.datePickerExpressionPlaceholder }
onGetErrorMessage={ this.onDateExpressionChange.bind(this) }
deferredValidationTime={ 500 }
@ -411,7 +419,7 @@ export class QueryFilter extends React.Component<IQueryFilterProps, IQueryFilter
</div>
}
<ChoiceGroup options={this.getJoinGroupOptions()}
<ChoiceGroup options={this.getJoinGroupOptions()}
onChange={this.onJoinChoiceChange.bind(this)}
disabled={this.props.disabled} />
</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 { IQueryFilterField } from '../QueryFilter/IQueryFilterField';
import { IQueryFilterPanelStrings } from './IQueryFilterPanelStrings';
@ -13,4 +13,4 @@ export interface IQueryFilterPanelProps {
trimEmptyFiltersOnChange?: boolean;
strings: IQueryFilterPanelStrings;
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 {
.queryFilterPanelItems {

View File

@ -2,7 +2,7 @@ import * as React from 'react';
import { cloneDeep } from '@microsoft/sp-lodash-subset';
import { Text } from '@microsoft/sp-core-library';
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 { IQueryFilter } from '../QueryFilter/IQueryFilter';
import { QueryFilterOperator } from '../QueryFilter/QueryFilterOperator';

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 {
z-index: 2000000 !important;

View File

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

View File

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

View File

@ -11,7 +11,7 @@ import { IPropertyPaneToggleProps, PropertyPaneToggle } from "@microsoft/sp-prop
import { IPropertyPaneLabelProps, PropertyPaneLabel } from "@microsoft/sp-property-pane";
import { IPropertyPaneButtonProps, PropertyPaneButton, PropertyPaneButtonType } from "@microsoft/sp-property-pane";
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 { IContentQueryProps } from './components/IContentQueryProps';
import { IQuerySettings } from './components/IQuerySettings';

View File

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

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import * as Handlebars from "handlebars";
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 { Text } from '@microsoft/sp-core-library';
import { IContentQueryProps } from './IContentQueryProps';
@ -10,7 +10,7 @@ import { IContentQueryTemplateContext } from './IContentQueryTemplat
import { SPComponentLoader } from '@microsoft/sp-loader';
import styles from './ContentQuery.module.scss';
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 { IReadonlyTheme } from '@microsoft/sp-component-base';
@ -80,7 +80,7 @@ export default class ContentQuery extends React.Component<IContentQueryProps, IC
});
}
else {
resolve();
resolve(null);
}
}
next();

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": {
"noImplicitAny": false,
"target": "es5",
"forceConsistentCasingInFileNames": true,
"module": "esnext",
@ -25,15 +26,12 @@
"lib": [
"es5",
"dom",
"es2015.collection"
"es2015.collection",
"es2015.promise"
]
},
"include": [
"src/**/*.ts",
"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
}
}