Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular v15 #2212

Merged
merged 24 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bc0a1f2
angular-material: migrating to v15
JBBianchi Nov 13, 2023
980f413
angular-material: fiddling with broken tests
JBBianchi Nov 13, 2023
746ba18
Merge branch 'master' into angular-v15
JBBianchi Nov 13, 2023
1a7cdda
angular-material: (???) fixed karma test shim
JBBianchi Nov 13, 2023
f30badf
Merge branch 'master' into angular-v15
JBBianchi Nov 14, 2023
da248ab
fix(angular-material): running tests without build output
JBBianchi Nov 16, 2023
9895a1a
fix(angular-test): fixed range tests
JBBianchi Nov 17, 2023
80530aa
fix(angular-material): fixed test coverage output
JBBianchi Nov 17, 2023
9f8fde3
fix(angular): ran lint:fix
JBBianchi Nov 18, 2023
c900325
fix(angular): fixed linting rules
JBBianchi Nov 21, 2023
f3039fa
fix(angular-material): fixed example build
JBBianchi Nov 21, 2023
c1dd4b3
fix(angular-material): linted example
JBBianchi Nov 22, 2023
26e42f2
fix(angular-material): fixed build example script
JBBianchi Nov 24, 2023
a4d2fcb
Merge branch 'master' of https://github.com/JBBianchi/jsonforms into …
JBBianchi Nov 25, 2023
25bf75c
Merge branch 'angular-v15' of https://github.com/JBBianchi/jsonforms …
JBBianchi Nov 25, 2023
516778f
fix(root): fixed pnpm-lock
JBBianchi Nov 25, 2023
dfc71bd
fix(angular-material): fixed test coverage
JBBianchi Nov 30, 2023
ec5e937
fix(angular-material): fixed nav item delete button display in list w…
JBBianchi Nov 30, 2023
e393bfb
fix(angular-material): PR review fixes
JBBianchi Dec 1, 2023
d291c01
fix(angular-material): removed teardown.destroyAfterEach false
JBBianchi Dec 1, 2023
07f26fa
Regenerate pnpm-lock.yaml and fix vue test
lucas-koehler Dec 8, 2023
45334f6
Enable debug output for coverage report action
lucas-koehler Dec 11, 2023
1f7dcf3
ci: prepend package paths on coverage report merge
lucas-koehler Dec 11, 2023
6b87dec
Revert "Enable debug output for coverage report action"
lucas-koehler Dec 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ stats.html
!.vscode/settings.json

.coveralls.yml
packages/examples-react/build
packages/examples-react/build

**/.angular/cache
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jsonforms-monorepo",
"engines": {
"node": "^16.13",
"node": "^16.14",
"pnpm": ">=7.13.4"
},
"scripts": {
Expand Down
16 changes: 16 additions & 0 deletions packages/angular-material/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,21 @@ module.exports = {
caughtErrorsIgnorePattern: '^_',
},
],
// workaround for
// https://github.com/import-js/eslint-plugin-import/issues/1810:
"import/no-unresolved": [
"error",
{
ignore: [
"@angular/cdk/.*",
"@angular/core/.*",
"@angular/material/.*",
"@angular/platform-browser/.*",
"@angular/platform-browser-dynamic/.*",
"core-js/es7/.*",
"zone.js/.*",
]
}
],
},
};
10 changes: 4 additions & 6 deletions packages/angular-material/example/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const itemTester: UISchemaTester = (_schema, schemaPath, _path) => {
<div>
<button (click)="changeLocale('de-DE')">Change locale to de-DE</button>
<button (click)="changeLocale('en-US')">Change locale to en-US</button>
Current locale: {{ currentLocale }}
Current locale: {{ i18n.locale }}
<button (click)="toggleReadonly()">
{{ readonly ? 'Unset' : 'Set' }} Readonly
</button>
Expand All @@ -85,19 +85,17 @@ const itemTester: UISchemaTester = (_schema, schemaPath, _path) => {
[uischema]="selectedExample.uischema"
[renderers]="renderers"
[i18n]="i18n"
[uischemas]="uischemas"
[readonly]="readonly"
[config]="config"
></jsonforms>
`,
})
export class AppComponent {
readonly renderers = angularMaterialRenderers;
readonly examples = getExamples();
selectedExample: ExampleDescription;
selectedExample: ExampleDescription | undefined;
i18n: JsonFormsI18nState;
private dateAdapter;
private readonly = false;
readonly = false;
data: any;
uischemas: { tester: UISchemaTester; uischema: UISchemaElement }[] = [
{ tester: itemTester, uischema: uiSchema },
Expand All @@ -114,7 +112,7 @@ export class AppComponent {
this.selectedExample = this.examples.find(
(e) => e.name === ev.target.value
);
this.i18n = this.selectedExample.i18n ?? defaultI18n;
this.i18n = this.selectedExample?.i18n ?? defaultI18n;
}

changeLocale(locale: string) {
Expand Down
55 changes: 55 additions & 0 deletions packages/angular-material/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
//dir: require('path').join(__dirname, '../../coverage/angular-material'),
JBBianchi marked this conversation as resolved.
Show resolved Hide resolved
subdir: '.',
reporters: [
{ type: 'lcov' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml', 'dots'],

browsers: [ config.singleRun ? 'ChromeHeadlessNoSandbox' : 'Chrome' ],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox'],
},
},
restartOnFileChange: true,
logLevel: config.LOG_INFO,

webpackMiddleware: {
stats: 'detailed',
},

webpackServer: {
noInfo: true,
},
});
};
102 changes: 53 additions & 49 deletions packages/angular-material/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@
"typings": "./lib/esm/index.d.ts",
"scripts": {
"build": "ngc && ngc -p tsconfig.cjs.json",
"build:examples-app": "rollup -c rollup.example.config.js",
"dev": "webpack --config webpack/webpack.dev.js && webpack-dev-server --config webpack/webpack.dev.js --env=dev --inline",
JBBianchi marked this conversation as resolved.
Show resolved Hide resolved
"build:examples-app": "ngc -p tsconfig.example.json && rollup -c rollup.example.config.js",
"dev": "pnpm run build:examples-app && npx http-server ./example/dist/ -c-1 -o",
"clean": "rimraf lib coverage dist .nyc_output 2> /dev/null",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"report": "nyc report --reporter=html",
"doc": "typedoc --name 'JSON Forms Angular Material Renderers' --out docs src",
"test": "karma start ./test-config/karma.conf.js --single-run",
"test-ci": "karma start ./test-config/karma.conf.js --single-run",
"test-cov": "karma start ./test-config/karma.conf.js --coverage --single-run",
"test-dbg": "node ./test-runner",
"test": "node ./test-runner --single-run",
"test-ci": "node ./test-runner --single-run",
"test-cov": "node ./test-runner --coverage --single-run",
"e2e": "npm run e2e-update && npm run e2e-test",
"e2e-test": "protractor ./test-config/protractor.conf.js",
"e2e-update": "webdriver-manager update --standalone false --gecko false"
Expand All @@ -60,93 +61,96 @@
]
},
"peerDependencies": {
"@angular/animations": "^12.0.0 || ^13.0.0 || ^14.0.0",
"@angular/cdk": "^12.0.0 || ^13.0.0 || ^14.0.0",
"@angular/common": "^12.0.0 || ^13.0.0 || ^14.0.0",
"@angular/core": "^12.0.0 || ^13.0.0 || ^14.0.0",
"@angular/flex-layout": "^12.0.0-beta || ^13.0.0-beta || ^14.0.0-beta",
"@angular/forms": "^12.0.0 || ^13.0.0 || ^14.0.0",
"@angular/material": "^12.0.0 || ^13.0.0 || ^14.0.0",
"@angular/platform-browser": "^12.0.0 || ^13.0.0 || ^14.0.0",
"@angular/router": "^12.0.0 || ^13.0.0 || ^14.0.0",
"@angular/animations": "^15.0.0",
"@angular/cdk": "^15.0.0",
"@angular/common": "^15.0.0",
"@angular/core": "^15.0.0",
"@angular/flex-layout": "^15.0.0-beta",
"@angular/forms": "^15.0.0",
"@angular/material": "^15.0.0",
"@angular/platform-browser": "^15.0.0",
"@angular/router": "^15.0.0",
"@jsonforms/angular": "3.2.0-alpha.3",
"@jsonforms/angular-test": "^3.2.0-alpha.3",
"@jsonforms/core": "3.2.0-alpha.3",
"core-js": "^2.5.3",
"rxjs": "^6.5.3 || ^7.4.0"
"rxjs": "^6.6.0 || ^7.4.0"
},
"dependencies": {
"hammerjs": "2.0.8",
"lodash": "^4.17.21"
},
"devDependencies": {
"@angular-eslint/eslint-plugin": "^12.0.0",
"@angular-eslint/eslint-plugin-template": "^12.0.0",
"@angular-eslint/schematics": "^12.0.0",
"@angular-eslint/template-parser": "^12.0.0",
"@angular/animations": "^12.0.0",
"@angular/cdk": "^12.0.0",
"@angular/common": "^12.0.0",
"@angular/compiler": "^12.0.0",
"@angular/compiler-cli": "^12.0.0",
"@angular/core": "^12.0.0",
"@angular/flex-layout": "^12.0.0-beta",
"@angular/forms": "^12.0.0",
"@angular/material": "^12.0.0",
"@angular/platform-browser": "^12.0.0",
"@angular/platform-browser-dynamic": "^12.0.0",
"@angular/router": "^12.0.0",
"@angular-devkit/build-angular": "~15.2.10",
"@angular-eslint/eslint-plugin": "^15.0.0",
"@angular-eslint/eslint-plugin-template": "^15.0.0",
"@angular-eslint/schematics": "^15.0.0",
"@angular-eslint/template-parser": "^15.0.0",
"@angular/animations": "^15.0.0",
"@angular/cdk": "^15.0.0",
"@angular/common": "^15.0.0",
"@angular/compiler": "^15.0.0",
"@angular/compiler-cli": "^15.0.0",
"@angular/core": "^15.0.0",
"@angular/flex-layout": "^15.0.0-beta",
"@angular/forms": "^15.0.0",
"@angular/material": "^15.0.0",
"@angular/platform-browser": "^15.0.0",
"@angular/platform-browser-dynamic": "^15.0.0",
"@angular/router": "^15.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5",
"@babel/plugin-proposal-optional-chaining": "^7.16.5",
"@jsonforms/angular": "workspace:*",
"@jsonforms/angular-test": "workspace:*",
"@jsonforms/core": "workspace:*",
"@jsonforms/examples": "workspace:*",
"@ngtools/webpack": "^15.0.0",
"@rollup/plugin-commonjs": "^23.0.3",
"@rollup/plugin-json": "^5.0.2",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.1",
"@types/node": "^16.18.34",
"@types/jasmine": "~3.8.0",
"@types/lodash": "4.14.149",
"@types/node": "^18.10.0",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"angular2-template-loader": "^0.6.2",
"babel-loader": "^8.0.6",
"copy-webpack-plugin": "^5.0.5",
"core-js": "^2.5.3",
"copy-webpack-plugin": "^11.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"html-loader": "^0.5.5",
"istanbul-instrumenter-loader": "^3.0.1",
"http-server": "^14.1.1",
"jasmine": "^3.99.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^3.1.4",
"karma": "^6.4.1",
"karma-chrome-launcher": "^3.2.0",
"karma-coverage-istanbul-reporter": "^2.1.1",
"karma-coverage": "~2.0.3",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"karma-sourcemap-loader": "^0.3.8",
"karma-webpack": "^4.0.2",
"karma-webpack": "^5.0.0",
"ng-packagr": "^15.0.0",
"null-loader": "^0.1.1",
"nyc": "^15.1.0",
"prettier": "^2.8.4",
"protractor": "^5.4.1",
"request": "^2.88.0",
"protractor": "^7.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.78.0",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-import-css": "^3.3.1",
"rollup-plugin-typescript2": "^0.34.1",
"rollup-plugin-visualizer": "^5.4.1",
"rxjs": "^6.5.3",
"rxjs": "^6.6.0",
"ts-loader": "^6.2.1",
"tslib": "^2.5.0",
"typedoc": "~0.21.9",
"typescript": "4.2.3",
"webpack": "^4.41.2",
"webpack-cli": "^3.2.1",
"webpack-dev-server": "^3.9.0",
"tslib": "^2.3.0",
JBBianchi marked this conversation as resolved.
Show resolved Hide resolved
"typedoc": "~0.25.3",
"typescript": "~4.9.5",
"webpack": "^5.78.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.13.2",
lucas-koehler marked this conversation as resolved.
Show resolved Hide resolved
"yargs": "^17.7.2",
"zone.js": "^0.11.4"
}
}
2 changes: 1 addition & 1 deletion packages/angular-material/rollup.example.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import typescript from 'rollup-plugin-typescript2';
* @type {import('rollup').RollupOptions}
*/
const config = {
input: 'example/main.ts',
input: 'example/dist/example/main.js',
output: {
file: 'example/dist/bundle.js',
format: 'iife',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export class AutocompleteControlRenderer
@Input() options: string[];
filteredOptions: Observable<string[]>;
shouldFilter: boolean;
focused = false;

constructor(jsonformsService: JsonFormsAngularService) {
super(jsonformsService);
Expand Down
2 changes: 2 additions & 0 deletions packages/angular-material/src/controls/date.renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DateControlRenderer extends JsonFormsControl {
focused = false;

constructor(jsonformsService: JsonFormsAngularService) {
super(jsonformsService);
}
Expand Down
1 change: 1 addition & 0 deletions packages/angular-material/src/controls/number.renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export class NumberControlRenderer extends JsonFormsControl {
locale: string;
numberFormat: Intl.NumberFormat;
decimalSeparator: string;
focused = false;

constructor(jsonformsService: JsonFormsAngularService) {
super(jsonformsService);
Expand Down
23 changes: 18 additions & 5 deletions packages/angular-material/src/controls/range.renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,29 @@ import { isRangeControl, RankedTester, rankWith } from '@jsonforms/core';
<label class="mat-caption" style="color:rgba(0,0,0,.54)">{{
label
}}</label>
<!-- TODO: The 'tickInterval' property no longer exists -->
lucas-koehler marked this conversation as resolved.
Show resolved Hide resolved
<mat-slider
[value]="data || scopedSchema.default"
(change)="onChange($event)"
[disabled]="!isEnabled()"
[max]="max"
[min]="min"
[step]="multipleOf"
[thumbLabel]="true"
tickInterval="auto"
[discrete]="true"
[id]="id"
></mat-slider>
#ngSlider
>
<input
matSliderThumb
[value]="data || scopedSchema.default"
(change)="
onChange({
source: ngSliderThumb,
parent: ngSlider,
value: ngSliderThumb.value
})
"
#ngSliderThumb="matSliderThumb"
/>
</mat-slider>
<mat-hint class="mat-caption" *ngIf="shouldShowUnfocusedDescription()">{{
description
}}</mat-hint>
Expand All @@ -60,6 +72,7 @@ export class RangeControlRenderer extends JsonFormsControl {
min: number;
max: number;
multipleOf: number;
focused = false;

constructor(
jsonformsService: JsonFormsAngularService,
Expand Down
1 change: 1 addition & 0 deletions packages/angular-material/src/controls/text.renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import { isStringControl, RankedTester, rankWith } from '@jsonforms/core';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TextControlRenderer extends JsonFormsControl {
focused = false;
constructor(jsonformsService: JsonFormsAngularService) {
super(jsonformsService);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import { isMultiLineControl, RankedTester, rankWith } from '@jsonforms/core';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TextAreaRenderer extends JsonFormsControl {
focused = false;
constructor(jsonformsService: JsonFormsAngularService) {
super(jsonformsService);
}
Expand Down
Loading