From 8f61101ec79498dab848cc42354a96f82664f535 Mon Sep 17 00:00:00 2001 From: Oleg Brezhnev Date: Thu, 20 Apr 2023 14:18:36 +0300 Subject: [PATCH 01/13] update --- package.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/package.json b/package.json index f740771..24cb4b6 100644 --- a/package.json +++ b/package.json @@ -29,14 +29,6 @@ "@angular-devkit/build-angular": "~12.0.0", "@angular/cli": "~12.0.0", "@angular/compiler-cli": "~12.0.0", - "@types/jasmine": "~3.6.0", - "@types/node": "^12.11.1", - "jasmine-core": "~3.7.0", - "karma": "~6.3.0", - "karma-chrome-launcher": "~3.1.0", - "karma-coverage": "~2.0.3", - "karma-jasmine": "~4.0.0", - "karma-jasmine-html-reporter": "^1.5.0", "ng-packagr": "^12.0.0", "typescript": "~4.2.3" } From 03f5a10ad74024a26c4b3402f9091464c22edc8c Mon Sep 17 00:00:00 2001 From: Oleg Brezhnev Date: Thu, 20 Apr 2023 14:24:42 +0300 Subject: [PATCH 02/13] update --- package.json | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 24cb4b6..d9a102f 100644 --- a/package.json +++ b/package.json @@ -13,23 +13,22 @@ }, "private": true, "dependencies": { - "@angular/animations": "~12.0.0", - "@angular/common": "~12.0.0", - "@angular/compiler": "~12.0.0", - "@angular/core": "~12.0.0", - "@angular/forms": "~12.0.0", - "@angular/platform-browser": "~12.0.0", - "@angular/platform-browser-dynamic": "~12.0.0", - "@angular/router": "~12.0.0", + "@angular/animations": "~13.4.0", + "@angular/common": "~13.4.0", + "@angular/compiler": "~13.4.0", + "@angular/core": "~13.4.0", + "@angular/forms": "~13.4.0", + "@angular/platform-browser": "~13.4.0", + "@angular/platform-browser-dynamic": "~13.4.0", + "@angular/router": "~13.4.0", "rxjs": "~6.6.0", "tslib": "^2.1.0", "zone.js": "~0.11.4" }, "devDependencies": { - "@angular-devkit/build-angular": "~12.0.0", - "@angular/cli": "~12.0.0", - "@angular/compiler-cli": "~12.0.0", - "ng-packagr": "^12.0.0", - "typescript": "~4.2.3" + "@angular/cli": "~13.3.11", + "@angular/compiler-cli": "~13.4.0", + "ng-packagr": "^13.3.1", + "typescript": "~4.6.4" } -} +} \ No newline at end of file From 536fc88d9acc4786a0672d49fd7c25cf952b1d2c Mon Sep 17 00:00:00 2001 From: Oleg Brezhnev Date: Thu, 20 Apr 2023 14:49:31 +0300 Subject: [PATCH 03/13] upgrade angular version --- angular.json | 3 ++- package.json | 25 +++++++++++++------------ projects/ng-modal-lib/tsconfig.lib.json | 2 +- tsconfig.json | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/angular.json b/angular.json index 59a8645..2e38ec0 100644 --- a/angular.json +++ b/angular.json @@ -96,7 +96,8 @@ "styles": [ "src/styles.css" ], - "scripts": [] + "scripts": [], + "preserveSymLinks": true } } } diff --git a/package.json b/package.json index d9a102f..1ab4c40 100644 --- a/package.json +++ b/package.json @@ -13,22 +13,23 @@ }, "private": true, "dependencies": { - "@angular/animations": "~13.4.0", - "@angular/common": "~13.4.0", - "@angular/compiler": "~13.4.0", - "@angular/core": "~13.4.0", - "@angular/forms": "~13.4.0", - "@angular/platform-browser": "~13.4.0", - "@angular/platform-browser-dynamic": "~13.4.0", - "@angular/router": "~13.4.0", + "@angular/animations": "^14.3.0", + "@angular/common": "^14.3.0", + "@angular/compiler": "^14.3.0", + "@angular/core": "^14.3.0", + "@angular/forms": "^14.3.0", + "@angular/platform-browser": "^14.3.0", + "@angular/platform-browser-dynamic": "^14.3.0", + "@angular/router": "^14.3.0", "rxjs": "~6.6.0", "tslib": "^2.1.0", "zone.js": "~0.11.4" }, "devDependencies": { - "@angular/cli": "~13.3.11", - "@angular/compiler-cli": "~13.4.0", - "ng-packagr": "^13.3.1", + "@angular-devkit/build-angular": "^14.2.11", + "@angular/cli": "^14.2.11", + "@angular/compiler-cli": "^14.3.0", + "ng-packagr": "^14.2.2", "typescript": "~4.6.4" } -} \ No newline at end of file +} diff --git a/projects/ng-modal-lib/tsconfig.lib.json b/projects/ng-modal-lib/tsconfig.lib.json index 1407202..5b574d3 100644 --- a/projects/ng-modal-lib/tsconfig.lib.json +++ b/projects/ng-modal-lib/tsconfig.lib.json @@ -3,7 +3,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/lib", - "target": "es2015", + "target": "es2020", "declaration": true, "declarationMap": true, "inlineSources": true, diff --git a/tsconfig.json b/tsconfig.json index 337e537..d195556 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,7 +20,7 @@ "experimentalDecorators": true, "moduleResolution": "node", "importHelpers": true, - "target": "es2017", + "target": "es2020", "module": "es2020", "lib": [ "es2018", From da8335e47f38ec7fdf46dd94280c1276012869a3 Mon Sep 17 00:00:00 2001 From: Oleg Brezhnev Date: Thu, 20 Apr 2023 14:56:24 +0300 Subject: [PATCH 04/13] gitignored some files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index adccbd7..ebf9aef 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,5 @@ testem.log .DS_Store Thumbs.db package-lock.json +.angular +.vscode \ No newline at end of file From ccacf0aebd40ffe3ab3e1e253c2b4759da7ae7b1 Mon Sep 17 00:00:00 2001 From: Oleg Brezhnev Date: Thu, 20 Apr 2023 16:34:42 +0300 Subject: [PATCH 05/13] update angular version --- angular.json | 3 +-- projects/ng-modal-lib/package.json | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/angular.json b/angular.json index 2e38ec0..59a8645 100644 --- a/angular.json +++ b/angular.json @@ -96,8 +96,7 @@ "styles": [ "src/styles.css" ], - "scripts": [], - "preserveSymLinks": true + "scripts": [] } } } diff --git a/projects/ng-modal-lib/package.json b/projects/ng-modal-lib/package.json index ca7a9db..30cdc18 100644 --- a/projects/ng-modal-lib/package.json +++ b/projects/ng-modal-lib/package.json @@ -2,10 +2,10 @@ "name": "ng-modal-lib", "version": "0.0.9", "peerDependencies": { - "@angular/common": "^12.0.0", - "@angular/core": "^12.0.0" + "@angular/common": "^14.1.0", + "@angular/core": "^14.1.0" }, "dependencies": { - "tslib": "^2.1.0" + "tslib": "^2.3.0" } } From 7817957b7fba054cefad9c9d7e9447c10b93f217 Mon Sep 17 00:00:00 2001 From: Oleg Brezhnev Date: Wed, 2 Aug 2023 10:32:26 +0300 Subject: [PATCH 06/13] ng modal fixes --- package.json | 32 +++---- projects/ng-modal-lib/package.json | 2 +- .../src/lib/modal/modal.component.css | 3 + .../src/lib/modal/modal.component.html | 85 ++++++++++--------- .../src/lib/modal/modal.component.ts | 12 ++- src/app/modal-demo.component.ts | 49 ++++++----- 6 files changed, 102 insertions(+), 81 deletions(-) diff --git a/package.json b/package.json index 1ab4c40..aa0dd05 100644 --- a/package.json +++ b/package.json @@ -13,23 +13,23 @@ }, "private": true, "dependencies": { - "@angular/animations": "^14.3.0", - "@angular/common": "^14.3.0", - "@angular/compiler": "^14.3.0", - "@angular/core": "^14.3.0", - "@angular/forms": "^14.3.0", - "@angular/platform-browser": "^14.3.0", - "@angular/platform-browser-dynamic": "^14.3.0", - "@angular/router": "^14.3.0", - "rxjs": "~6.6.0", - "tslib": "^2.1.0", - "zone.js": "~0.11.4" + "@angular/animations": ">=14.3.0", + "@angular/common": ">=14.3.0", + "@angular/compiler": ">=14.3.0", + "@angular/core": ">=14.3.0", + "@angular/forms": ">=14.3.0", + "@angular/platform-browser": ">=14.3.0", + "@angular/platform-browser-dynamic": ">=14.3.0", + "@angular/router": ">=14.3.0", + "rxjs": ">=6.6.0", + "tslib": ">=2.1.0", + "zone.js": ">=0.11.4" }, "devDependencies": { - "@angular-devkit/build-angular": "^14.2.11", - "@angular/cli": "^14.2.11", - "@angular/compiler-cli": "^14.3.0", - "ng-packagr": "^14.2.2", - "typescript": "~4.6.4" + "@angular-devkit/build-angular": ">=14.2.11", + "@angular/cli": ">=14.2.11", + "@angular/compiler-cli": ">=14.3.0", + "ng-packagr": ">=14.2.2", + "typescript": ">=4.6.4" } } diff --git a/projects/ng-modal-lib/package.json b/projects/ng-modal-lib/package.json index 30cdc18..74d6564 100644 --- a/projects/ng-modal-lib/package.json +++ b/projects/ng-modal-lib/package.json @@ -1,6 +1,6 @@ { "name": "ng-modal-lib", - "version": "0.0.9", + "version": "0.0.15", "peerDependencies": { "@angular/common": "^14.1.0", "@angular/core": "^14.1.0" diff --git a/projects/ng-modal-lib/src/lib/modal/modal.component.css b/projects/ng-modal-lib/src/lib/modal/modal.component.css index 7e93780..cc4add4 100644 --- a/projects/ng-modal-lib/src/lib/modal/modal.component.css +++ b/projects/ng-modal-lib/src/lib/modal/modal.component.css @@ -21,6 +21,8 @@ .ui-modal { display: none; position: fixed; + + flex-flow: column nowrap; left: 0; top: 0; outline: none; @@ -45,6 +47,7 @@ } .ui-modal-body { + flex-grow: 1; position: relative; padding: .625rem 1rem; max-height: calc(100vh - 12.5rem); diff --git a/projects/ng-modal-lib/src/lib/modal/modal.component.html b/projects/ng-modal-lib/src/lib/modal/modal.component.html index a0bada8..6345bcf 100644 --- a/projects/ng-modal-lib/src/lib/modal/modal.component.html +++ b/projects/ng-modal-lib/src/lib/modal/modal.component.html @@ -1,44 +1,45 @@
+ \ No newline at end of file diff --git a/projects/ng-modal-lib/src/lib/modal/modal.component.ts b/projects/ng-modal-lib/src/lib/modal/modal.component.ts index 8a1d158..a14a594 100644 --- a/projects/ng-modal-lib/src/lib/modal/modal.component.ts +++ b/projects/ng-modal-lib/src/lib/modal/modal.component.ts @@ -16,7 +16,7 @@ export class ModalComponent implements AfterViewChecked { @Input() maximizable: boolean; @Input() backdrop = true; @Input() inViewport: boolean; - + @Input() dontDestroyOnClose = true; @Output() closeModal: EventEmitter = new EventEmitter(); @ViewChild('modalRoot', {static: false}) modalRoot: ElementRef; @@ -25,6 +25,7 @@ export class ModalComponent implements AfterViewChecked { @ViewChild('modalFooter', {static: false}) modalFooter: ElementRef; @ViewChild('closeIcon', {static: false}) closeIcon: ElementRef; + clearable = false; visible: boolean; executePostDisplayActions: boolean; maximized: boolean; @@ -80,7 +81,7 @@ export class ModalComponent implements AfterViewChecked { if (elementWidth === 0 && elementHeight === 0) { this.modalRoot.nativeElement.style.visibility = 'hidden'; - this.modalRoot.nativeElement.style.display = 'block'; + this.modalRoot.nativeElement.style.display = 'flex'; elementWidth = this.modalRoot.nativeElement.offsetWidth; elementHeight = this.modalRoot.nativeElement.offsetHeight; this.modalRoot.nativeElement.style.display = 'none'; @@ -136,6 +137,13 @@ export class ModalComponent implements AfterViewChecked { event.preventDefault(); } + resizeToContentHeight() { + const height = this.modalBody.nativeElement.scrollHeight + + this.modalFooter.nativeElement.offsetHeight + + this.modalHeader.nativeElement.offsetHeight; + this.modalRoot.nativeElement.style.height = height + 'px'; + this.calcBodyHeight(); + } maximize(): void { this.preMaximizePageX = parseFloat(this.modalRoot.nativeElement.style.top); this.preMaximizePageY = parseFloat(this.modalRoot.nativeElement.style.left); diff --git a/src/app/modal-demo.component.ts b/src/app/modal-demo.component.ts index f38e312..a9f95d0 100644 --- a/src/app/modal-demo.component.ts +++ b/src/app/modal-demo.component.ts @@ -1,29 +1,38 @@ -import { Component } from '@angular/core'; +import { Component, ViewChild, ViewChildren } from '@angular/core'; +import { ModalComponent } from 'ng-modal-lib'; @Component({ selector: 'app-modal-demo', template: ` - - - Demo modal - -

MODAL DIALOG

-

Lorem Ipsum is simply dummy text of the printing and typesetting industry. - Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s.

-
- -   - - - -
+ + + Demo modal + +
+

MODAL DIALOG

+

Lorem Ipsum is simply dummy text of the printing and typesetting industry. + Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s.

+
+ +
+ +   + + + +
`, }) export class ModalDemoComponent { + @ViewChild('modalRoot') modalRoot: ModalComponent; + onCloseModal(): void { + } - onCloseModal(): void {} - + resize() { + this.modalRoot.clearable = !this.modalRoot.clearable; + } } From df07c0b385b48b8a3fa46f02d2bcb245d861974b Mon Sep 17 00:00:00 2001 From: Oleg Brezhnev Date: Wed, 2 Aug 2023 10:52:09 +0300 Subject: [PATCH 07/13] update to angular@15 --- .browserslistrc | 17 -------------- package.json | 30 ++++++++++++------------- projects/ng-modal-lib/src/test.ts | 11 --------- projects/ng-modal-lib/tsconfig.lib.json | 1 - src/test.ts | 11 --------- tsconfig.json | 5 +++-- 6 files changed, 18 insertions(+), 57 deletions(-) delete mode 100644 .browserslistrc diff --git a/.browserslistrc b/.browserslistrc deleted file mode 100644 index 427441d..0000000 --- a/.browserslistrc +++ /dev/null @@ -1,17 +0,0 @@ -# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. -# For additional information regarding the format and rule options, please see: -# https://github.com/browserslist/browserslist#queries - -# For the full list of supported browsers by the Angular framework, please see: -# https://angular.io/guide/browser-support - -# You can see what browsers were selected by your queries by running: -# npx browserslist - -last 1 Chrome version -last 1 Firefox version -last 2 Edge major versions -last 2 Safari major versions -last 2 iOS major versions -Firefox ESR -not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. diff --git a/package.json b/package.json index aa0dd05..7883a8b 100644 --- a/package.json +++ b/package.json @@ -13,23 +13,23 @@ }, "private": true, "dependencies": { - "@angular/animations": ">=14.3.0", - "@angular/common": ">=14.3.0", - "@angular/compiler": ">=14.3.0", - "@angular/core": ">=14.3.0", - "@angular/forms": ">=14.3.0", - "@angular/platform-browser": ">=14.3.0", - "@angular/platform-browser-dynamic": ">=14.3.0", - "@angular/router": ">=14.3.0", + "@angular/animations": "15.2.9", + "@angular/common": "15.2.9", + "@angular/compiler": "15.2.9", + "@angular/core": "15.2.9", + "@angular/forms": "15.2.9", + "@angular/platform-browser": "15.2.9", + "@angular/platform-browser-dynamic": "15.2.9", + "@angular/router": "15.2.9", "rxjs": ">=6.6.0", "tslib": ">=2.1.0", - "zone.js": ">=0.11.4" + "zone.js": ">=0.13.0" }, "devDependencies": { - "@angular-devkit/build-angular": ">=14.2.11", - "@angular/cli": ">=14.2.11", - "@angular/compiler-cli": ">=14.3.0", - "ng-packagr": ">=14.2.2", - "typescript": ">=4.6.4" + "@angular-devkit/build-angular": "15.2.9", + "@angular/cli": "15.2.9", + "@angular/compiler-cli": "15.2.9", + "ng-packagr": "15.2.2", + "typescript": "4.9.5" } -} +} \ No newline at end of file diff --git a/projects/ng-modal-lib/src/test.ts b/projects/ng-modal-lib/src/test.ts index 52e5516..e63a876 100644 --- a/projects/ng-modal-lib/src/test.ts +++ b/projects/ng-modal-lib/src/test.ts @@ -8,19 +8,8 @@ import { platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; -declare const require: { - context(path: string, deep?: boolean, filter?: RegExp): { - keys(): string[]; - (id: string): T; - }; -}; - // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, platformBrowserDynamicTesting() ); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/projects/ng-modal-lib/tsconfig.lib.json b/projects/ng-modal-lib/tsconfig.lib.json index 5b574d3..24ad5e0 100644 --- a/projects/ng-modal-lib/tsconfig.lib.json +++ b/projects/ng-modal-lib/tsconfig.lib.json @@ -3,7 +3,6 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/lib", - "target": "es2020", "declaration": true, "declarationMap": true, "inlineSources": true, diff --git a/src/test.ts b/src/test.ts index 2042356..7632e27 100644 --- a/src/test.ts +++ b/src/test.ts @@ -7,19 +7,8 @@ import { platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; -declare const require: { - context(path: string, deep?: boolean, filter?: RegExp): { - keys(): string[]; - (id: string): T; - }; -}; - // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, platformBrowserDynamicTesting() ); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/tsconfig.json b/tsconfig.json index d195556..061fd07 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,12 +20,13 @@ "experimentalDecorators": true, "moduleResolution": "node", "importHelpers": true, - "target": "es2020", + "target": "ES2022", "module": "es2020", "lib": [ "es2018", "dom" - ] + ], + "useDefineForClassFields": false }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, From 57f5285f16bd060a46e5c00dbde0f257839ae48e Mon Sep 17 00:00:00 2001 From: Oleg Brezhnev Date: Wed, 2 Aug 2023 10:59:10 +0300 Subject: [PATCH 08/13] update to angular@16 --- angular.json | 3 +-- package.json | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/angular.json b/angular.json index 59a8645..23ce29c 100644 --- a/angular.json +++ b/angular.json @@ -132,6 +132,5 @@ } } } - }, - "defaultProject": "ng-modal" + } } diff --git a/package.json b/package.json index 7883a8b..906c20b 100644 --- a/package.json +++ b/package.json @@ -13,23 +13,23 @@ }, "private": true, "dependencies": { - "@angular/animations": "15.2.9", - "@angular/common": "15.2.9", - "@angular/compiler": "15.2.9", - "@angular/core": "15.2.9", - "@angular/forms": "15.2.9", - "@angular/platform-browser": "15.2.9", - "@angular/platform-browser-dynamic": "15.2.9", - "@angular/router": "15.2.9", + "@angular/animations": "16.1.7", + "@angular/common": "16.1.7", + "@angular/compiler": "16.1.7", + "@angular/core": "16.1.7", + "@angular/forms": "16.1.7", + "@angular/platform-browser": "16.1.7", + "@angular/platform-browser-dynamic": "16.1.7", + "@angular/router": "16.1.7", "rxjs": ">=6.6.0", "tslib": ">=2.1.0", "zone.js": ">=0.13.0" }, "devDependencies": { - "@angular-devkit/build-angular": "15.2.9", - "@angular/cli": "15.2.9", - "@angular/compiler-cli": "15.2.9", - "ng-packagr": "15.2.2", + "@angular-devkit/build-angular": "16.1.6", + "@angular/cli": "16.1.6", + "@angular/compiler-cli": "16.1.7", + "ng-packagr": "16.1.0", "typescript": "4.9.5" } } \ No newline at end of file From 280509de09a6bc029fd16eac7e17cd08ad060572 Mon Sep 17 00:00:00 2001 From: Oleg Brezhnev Date: Thu, 31 Aug 2023 22:32:29 +0300 Subject: [PATCH 09/13] recalculate fix --- projects/ng-modal-lib/package.json | 10 +++++----- .../src/lib/modal/modal.component.html | 2 +- .../src/lib/modal/modal.component.ts | 16 ++++++++++------ .../src/lib/resizable/resizable.directive.ts | 5 ++++- src/app/modal-demo.component.ts | 7 ++++++- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/projects/ng-modal-lib/package.json b/projects/ng-modal-lib/package.json index 74d6564..3f241a8 100644 --- a/projects/ng-modal-lib/package.json +++ b/projects/ng-modal-lib/package.json @@ -1,11 +1,11 @@ { - "name": "ng-modal-lib", - "version": "0.0.15", + "name": "ng-modal-full-resizable", + "version": "0.0.19", "peerDependencies": { - "@angular/common": "^14.1.0", - "@angular/core": "^14.1.0" + "@angular/common": ">=15.1.0", + "@angular/core": ">=15.1.0" }, "dependencies": { - "tslib": "^2.3.0" + "tslib": ">=2.3.0" } } diff --git a/projects/ng-modal-lib/src/lib/modal/modal.component.html b/projects/ng-modal-lib/src/lib/modal/modal.component.html index 6345bcf..75830be 100644 --- a/projects/ng-modal-lib/src/lib/modal/modal.component.html +++ b/projects/ng-modal-lib/src/lib/modal/modal.component.html @@ -1,7 +1,7 @@