@alfresco/adf-core 8.2.0-18186380146 → 8.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -16
- package/api/lib/adf-http-client.service.d.ts +9 -9
- package/api/lib/alfresco-api/alfresco-api.utils.d.ts +1 -1
- package/app.config.schema.json +0 -3
- package/bundles/assets/adf-core/i18n/ar.json +0 -5
- package/bundles/assets/adf-core/i18n/cs.json +0 -5
- package/bundles/assets/adf-core/i18n/da.json +0 -5
- package/bundles/assets/adf-core/i18n/de.json +19 -9
- package/bundles/assets/adf-core/i18n/en.json +22 -12
- package/bundles/assets/adf-core/i18n/es.json +19 -9
- package/bundles/assets/adf-core/i18n/fi.json +0 -5
- package/bundles/assets/adf-core/i18n/fr.json +19 -9
- package/bundles/assets/adf-core/i18n/it.json +19 -9
- package/bundles/assets/adf-core/i18n/ja.json +0 -5
- package/bundles/assets/adf-core/i18n/nb.json +0 -5
- package/bundles/assets/adf-core/i18n/nl.json +0 -5
- package/bundles/assets/adf-core/i18n/pl.json +19 -9
- package/bundles/assets/adf-core/i18n/pt-BR.json +0 -5
- package/bundles/assets/adf-core/i18n/pt.json +19 -9
- package/bundles/assets/adf-core/i18n/ru.json +0 -5
- package/bundles/assets/adf-core/i18n/sv.json +0 -5
- package/bundles/assets/adf-core/i18n/zh-CN.json +0 -5
- package/custom-theme/material-theme.scss +13 -13
- package/custom-theme/theme/custom-palette-creator.scss +23 -25
- package/custom-theme/theme/custom-theme-palettes.scss +7 -7
- package/custom-theme/theme/theme-data.scss +13 -13
- package/custom-theme/theme/typography.scss +5 -5
- package/fesm2022/adf-core.mjs +1226 -1212
- package/fesm2022/adf-core.mjs.map +1 -1
- package/fesm2022/alfresco-adf-core-api.mjs +40 -27
- package/fesm2022/alfresco-adf-core-api.mjs.map +1 -1
- package/fesm2022/alfresco-adf-core-shell.mjs +5 -1
- package/fesm2022/alfresco-adf-core-shell.mjs.map +1 -1
- package/lib/auth/basic-auth/basic-alfresco-auth.service.d.ts +2 -24
- package/lib/auth/interfaces/authentication-service.interface.d.ts +7 -13
- package/lib/auth/models/oauth-config.model.d.ts +0 -1
- package/lib/auth/oidc/oidc-authentication.service.d.ts +0 -20
- package/lib/auth/services/authentication.service.d.ts +10 -28
- package/lib/auth/services/base-authentication.service.d.ts +6 -14
- package/lib/card-view/components/card-view/card-view.component.scss +2 -1
- package/lib/card-view/components/card-view-dateitem/card-view-dateitem.component.scss +59 -34
- package/lib/card-view/components/card-view-textitem/card-view-textitem.component.scss +8 -0
- package/lib/clipboard/clipboard.directive.d.ts +10 -11
- package/lib/clipboard/clipboard.module.d.ts +5 -4
- package/lib/core.module.d.ts +44 -46
- package/lib/datatable/components/columns-selector/columns-selector.component.d.ts +2 -1
- package/lib/datatable/components/columns-selector/columns-selector.component.scss +89 -76
- package/lib/datatable/components/datatable-cell/datatable-cell.component.d.ts +2 -0
- package/lib/form/components/form-base.component.d.ts +1 -1
- package/lib/form/components/form-field/form-field.component.d.ts +5 -0
- package/lib/form/components/form-renderer.component.d.ts +7 -5
- package/lib/form/components/form-renderer.component.scss +44 -0
- package/lib/form/components/widgets/amount/amount.widget.d.ts +43 -4
- package/lib/form/components/widgets/base-viewer/base-viewer.widget.d.ts +16 -0
- package/lib/form/components/widgets/button/button.widget.d.ts +12 -0
- package/lib/form/components/widgets/button/button.widget.scss +14 -0
- package/lib/form/components/widgets/core/container-column.model.d.ts +2 -0
- package/lib/form/components/widgets/core/container-row.model.d.ts +26 -0
- package/lib/form/components/widgets/core/form-field-types.d.ts +5 -0
- package/lib/form/components/widgets/core/form-field-validator.d.ts +4 -0
- package/lib/form/components/widgets/core/form-field.model.d.ts +26 -2
- package/lib/form/components/widgets/core/form.model.d.ts +2 -1
- package/lib/{datatable/components/mocks/datatable.mock.d.ts → form/components/widgets/core/handlers/form-field-rule.handler.d.ts} +5 -5
- package/lib/{login/components/login-dialog/login-dialog-component-data.interface.d.ts → form/components/widgets/core/repeatable-section.model.d.ts} +8 -5
- package/lib/form/components/widgets/index.d.ts +4 -1
- package/lib/form/components/widgets/reactive-widget.interface.d.ts +4 -0
- package/lib/form/components/widgets/repeat/repeat.widget.d.ts +9 -0
- package/lib/form/components/widgets/repeat/repeat.widget.scss +36 -0
- package/lib/form/form-base.module.d.ts +3 -2
- package/lib/info-drawer/info-drawer.component.scss +6 -0
- package/lib/login/login.module.d.ts +3 -5
- package/lib/login/public-api.d.ts +0 -2
- package/lib/mock/public-api.d.ts +0 -1
- package/lib/mock/translation.service.mock.d.ts +1 -0
- package/lib/notifications/components/notification-history.component.d.ts +9 -3
- package/lib/notifications/notification-history.module.d.ts +2 -4
- package/lib/notifications/public-api.d.ts +0 -1
- package/lib/snackbar-content/snackbar-content.component.scss +4 -1
- package/lib/styles/{material.theme.scss → _globals.scss} +1 -1
- package/lib/styles/_index.scss +4 -126
- package/lib/styles/_mat-selectors.scss +3 -0
- package/lib/testing/index.d.ts +0 -1
- package/lib/testing/noop-translate.module.d.ts +1 -0
- package/lib/testing/unit-testing-utils.d.ts +4 -0
- package/lib/translation/translation.service.d.ts +6 -0
- package/package.json +4 -5
- package/schematics/migrations/schematics/migrations/7_0_0/index.d.ts +1 -2
- package/schematics/migrations/schematics/migrations/7_0_0/index.js +46 -59
- package/schematics/migrations/schematics/migrations/7_0_0/index.js.map +1 -1
- package/schematics/migrations/schematics/migrations/collection.json +0 -5
- package/lib/clipboard/clipboard.theme.scss +0 -19
- package/lib/login/components/login-dialog/login-dialog.component.d.ts +0 -15
- package/lib/login/components/login-dialog/login-dialog.component.scss +0 -4
- package/lib/mock/data-column.mock.d.ts +0 -51
- package/lib/notifications/components/add-notification.stories.component.d.ts +0 -10
- package/lib/styles/_theming.scss +0 -3
- package/lib/styles/_typography.scss +0 -18
- package/lib/testing/core.story.module.d.ts +0 -9
|
@@ -15,7 +15,11 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { FormService } from '../../services/form.service';
|
|
18
|
+
import { FormFieldModel } from './core/form-field.model';
|
|
19
|
+
import { WidgetComponent } from './widget.component';
|
|
18
20
|
export interface ReactiveFormWidget {
|
|
19
21
|
updateReactiveFormControl(): void;
|
|
20
22
|
formService: FormService;
|
|
23
|
+
field: FormFieldModel;
|
|
21
24
|
}
|
|
25
|
+
export type MaybeReactiveFormWidget = WidgetComponent | ReactiveFormWidget;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContainerModel } from '../core/container.model';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class RepeatWidgetComponent {
|
|
4
|
+
element: ContainerModel;
|
|
5
|
+
isEditor: boolean;
|
|
6
|
+
addRow(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RepeatWidgetComponent, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RepeatWidgetComponent, "adf-repeat-widget", never, { "element": { "alias": "element"; "required": false; }; "isEditor": { "alias": "isEditor"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.adf-container-widget {
|
|
2
|
+
&-repeat__text {
|
|
3
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.87);
|
|
4
|
+
padding-bottom: 10px;
|
|
5
|
+
cursor: default;
|
|
6
|
+
user-select: none;
|
|
7
|
+
font-size: var(--adf-header-font-size);
|
|
8
|
+
font-weight: var(--adf-header-font-weight);
|
|
9
|
+
color: var(--adf-header-color);
|
|
10
|
+
line-height: normal;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&-row-action {
|
|
14
|
+
margin-left: 10px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&-row-limit {
|
|
18
|
+
color: rgba(0, 0, 0, 0.67);
|
|
19
|
+
font-size: 12px;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.adf-readonly {
|
|
24
|
+
.adf-container-widget {
|
|
25
|
+
&-repeat__text {
|
|
26
|
+
color: var(--mdc-text-button-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));
|
|
27
|
+
border-bottom: 1px solid var(--mdc-text-button-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));
|
|
28
|
+
cursor: default;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-row-limit {
|
|
32
|
+
color: var(--mdc-text-button-disabled-label-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -18,10 +18,11 @@ import * as i16 from "./components/widgets/error/error.component";
|
|
|
18
18
|
import * as i17 from "./components/widgets/date-time/date-time.widget";
|
|
19
19
|
import * as i18 from "./components/widgets/json/json.widget";
|
|
20
20
|
import * as i19 from "./components/widgets/base-viewer/base-viewer.widget";
|
|
21
|
-
import * as i20 from "./components/widgets/
|
|
21
|
+
import * as i20 from "./components/widgets/button/button.widget";
|
|
22
|
+
import * as i21 from "./components/widgets/text/text-mask.component";
|
|
22
23
|
/** @deprecated This module is deprecated and will be removed in a future release. Use standalone components instead. */
|
|
23
24
|
export declare class FormBaseModule {
|
|
24
25
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormBaseModule, never>;
|
|
25
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<FormBaseModule, never, [typeof i1.FormFieldComponent, typeof i2.FormRendererComponent, typeof i3.WidgetComponent, typeof i4.StartFormCustomButtonDirective, typeof i5.InplaceFormInputComponent, typeof i6.UnknownWidgetComponent, typeof i7.TextWidgetComponent, typeof i8.NumberWidgetComponent, typeof i9.DecimalWidgetComponent, typeof i10.CheckboxWidgetComponent, typeof i11.MultilineTextWidgetComponentComponent, typeof i12.HyperlinkWidgetComponent, typeof i13.DisplayTextWidgetComponent, typeof i14.DateWidgetComponent, typeof i15.AmountWidgetComponent, typeof i16.ErrorWidgetComponent, typeof i17.DateTimeWidgetComponent, typeof i18.JsonWidgetComponent, typeof i19.BaseViewerWidgetComponent, typeof i20.InputMaskDirective], [typeof i1.FormFieldComponent, typeof i2.FormRendererComponent, typeof i4.StartFormCustomButtonDirective, typeof i6.UnknownWidgetComponent, typeof i7.TextWidgetComponent, typeof i8.NumberWidgetComponent, typeof i9.DecimalWidgetComponent, typeof i10.CheckboxWidgetComponent, typeof i11.MultilineTextWidgetComponentComponent, typeof i12.HyperlinkWidgetComponent, typeof i13.DisplayTextWidgetComponent, typeof i14.DateWidgetComponent, typeof i15.AmountWidgetComponent, typeof i16.ErrorWidgetComponent, typeof i17.DateTimeWidgetComponent, typeof i18.JsonWidgetComponent, typeof i19.BaseViewerWidgetComponent, typeof i5.InplaceFormInputComponent, typeof i3.WidgetComponent]>;
|
|
26
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<FormBaseModule, never, [typeof i1.FormFieldComponent, typeof i2.FormRendererComponent, typeof i3.WidgetComponent, typeof i4.StartFormCustomButtonDirective, typeof i5.InplaceFormInputComponent, typeof i6.UnknownWidgetComponent, typeof i7.TextWidgetComponent, typeof i8.NumberWidgetComponent, typeof i9.DecimalWidgetComponent, typeof i10.CheckboxWidgetComponent, typeof i11.MultilineTextWidgetComponentComponent, typeof i12.HyperlinkWidgetComponent, typeof i13.DisplayTextWidgetComponent, typeof i14.DateWidgetComponent, typeof i15.AmountWidgetComponent, typeof i16.ErrorWidgetComponent, typeof i17.DateTimeWidgetComponent, typeof i18.JsonWidgetComponent, typeof i19.BaseViewerWidgetComponent, typeof i20.ButtonWidgetComponent, typeof i21.InputMaskDirective], [typeof i1.FormFieldComponent, typeof i2.FormRendererComponent, typeof i4.StartFormCustomButtonDirective, typeof i6.UnknownWidgetComponent, typeof i7.TextWidgetComponent, typeof i8.NumberWidgetComponent, typeof i9.DecimalWidgetComponent, typeof i10.CheckboxWidgetComponent, typeof i11.MultilineTextWidgetComponentComponent, typeof i12.HyperlinkWidgetComponent, typeof i13.DisplayTextWidgetComponent, typeof i14.DateWidgetComponent, typeof i15.AmountWidgetComponent, typeof i16.ErrorWidgetComponent, typeof i17.DateTimeWidgetComponent, typeof i18.JsonWidgetComponent, typeof i19.BaseViewerWidgetComponent, typeof i20.ButtonWidgetComponent, typeof i5.InplaceFormInputComponent, typeof i3.WidgetComponent]>;
|
|
26
27
|
static ɵinj: i0.ɵɵInjectorDeclaration<FormBaseModule>;
|
|
27
28
|
}
|
|
@@ -83,6 +83,12 @@
|
|
|
83
83
|
height: 32px;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
&:focus-visible {
|
|
87
|
+
outline: 2px solid var(--theme-blue-button-color);
|
|
88
|
+
border-radius: 4px;
|
|
89
|
+
outline-offset: -2px;
|
|
90
|
+
}
|
|
91
|
+
|
|
86
92
|
&--active {
|
|
87
93
|
color: var(--theme-primary-color);
|
|
88
94
|
background-color: var(--adf-theme-background-card-color);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LoginDialogPanelComponent } from './components/login-dialog-panel/login-dialog-panel.component';
|
|
2
|
-
import { LoginDialogComponent } from './components/login-dialog/login-dialog.component';
|
|
3
2
|
import { LoginComponent } from './components/login/login.component';
|
|
4
3
|
import { LoginFooterDirective } from './directives/login-footer.directive';
|
|
5
4
|
import { LoginHeaderDirective } from './directives/login-header.directive';
|
|
@@ -7,12 +6,11 @@ import * as i0 from "@angular/core";
|
|
|
7
6
|
import * as i1 from "./components/login/login.component";
|
|
8
7
|
import * as i2 from "./directives/login-footer.directive";
|
|
9
8
|
import * as i3 from "./directives/login-header.directive";
|
|
10
|
-
import * as i4 from "./components/login-dialog/login-dialog.component";
|
|
11
|
-
|
|
12
|
-
export declare const LOGIN_DIRECTIVES: readonly [typeof LoginComponent, typeof LoginFooterDirective, typeof LoginHeaderDirective, typeof LoginDialogComponent, typeof LoginDialogPanelComponent];
|
|
9
|
+
import * as i4 from "./components/login-dialog-panel/login-dialog-panel.component";
|
|
10
|
+
export declare const LOGIN_DIRECTIVES: readonly [typeof LoginComponent, typeof LoginFooterDirective, typeof LoginHeaderDirective, typeof LoginDialogPanelComponent];
|
|
13
11
|
/** @deprecated use `...LOGIN_DIRECTIVES` or import the standalone directives directly */
|
|
14
12
|
export declare class LoginModule {
|
|
15
13
|
static ɵfac: i0.ɵɵFactoryDeclaration<LoginModule, never>;
|
|
16
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<LoginModule, never, [typeof i1.LoginComponent, typeof i2.LoginFooterDirective, typeof i3.LoginHeaderDirective, typeof i4.
|
|
14
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<LoginModule, never, [typeof i1.LoginComponent, typeof i2.LoginFooterDirective, typeof i3.LoginHeaderDirective, typeof i4.LoginDialogPanelComponent], [typeof i1.LoginComponent, typeof i2.LoginFooterDirective, typeof i3.LoginHeaderDirective, typeof i4.LoginDialogPanelComponent]>;
|
|
17
15
|
static ɵinj: i0.ɵɵInjectorDeclaration<LoginModule>;
|
|
18
16
|
}
|
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
export * from './directives/login-header.directive';
|
|
18
18
|
export * from './directives/login-footer.directive';
|
|
19
19
|
export * from './components/login/login.component';
|
|
20
|
-
export * from './components/login-dialog/login-dialog.component';
|
|
21
|
-
export * from './components/login-dialog/login-dialog-component-data.interface';
|
|
22
20
|
export * from './components/login-dialog-panel/login-dialog-panel.component';
|
|
23
21
|
export * from './models/login-error.event';
|
|
24
22
|
export * from './models/login-submit.event';
|
package/lib/mock/public-api.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare class TranslationMock implements TranslationService {
|
|
|
16
16
|
use(): any;
|
|
17
17
|
loadTranslation(): void;
|
|
18
18
|
get(key: string | Array<string>): Observable<string | any>;
|
|
19
|
+
getLocale(): any;
|
|
19
20
|
instant(key: string | Array<string>): string | any;
|
|
20
21
|
static ɵfac: i0.ɵɵFactoryDeclaration<TranslationMock, never>;
|
|
21
22
|
static ɵprov: i0.ɵɵInjectableDeclaration<TranslationMock>;
|
|
@@ -22,9 +22,9 @@ import { StorageService } from '../../common/services/storage.service';
|
|
|
22
22
|
import { PaginationModel } from '../../models/pagination.model';
|
|
23
23
|
import * as i0 from "@angular/core";
|
|
24
24
|
export declare class NotificationHistoryComponent implements OnInit, AfterViewInit {
|
|
25
|
-
private notificationService;
|
|
26
|
-
storageService
|
|
27
|
-
cd
|
|
25
|
+
private readonly notificationService;
|
|
26
|
+
private readonly storageService;
|
|
27
|
+
private readonly cd;
|
|
28
28
|
static MAX_NOTIFICATION_STACK_LENGTH: number;
|
|
29
29
|
static NOTIFICATION_STORAGE: string;
|
|
30
30
|
trigger: MatMenuTrigger;
|
|
@@ -37,7 +37,11 @@ export declare class NotificationHistoryComponent implements OnInit, AfterViewIn
|
|
|
37
37
|
notifications: NotificationModel[];
|
|
38
38
|
paginatedNotifications: NotificationModel[];
|
|
39
39
|
pagination: PaginationModel;
|
|
40
|
+
private readonly markAsReadButton;
|
|
41
|
+
private readonly loadMoreButton;
|
|
42
|
+
private readonly menuItems;
|
|
40
43
|
private readonly destroyRef;
|
|
44
|
+
private focusKeyManager;
|
|
41
45
|
constructor(notificationService: NotificationService, storageService: StorageService, cd: ChangeDetectorRef);
|
|
42
46
|
ngOnInit(): void;
|
|
43
47
|
ngAfterViewInit(): void;
|
|
@@ -49,6 +53,8 @@ export declare class NotificationHistoryComponent implements OnInit, AfterViewIn
|
|
|
49
53
|
loadMore($event: MouseEvent): void;
|
|
50
54
|
hasMoreNotifications(): boolean;
|
|
51
55
|
onNotificationClick(notification: NotificationModel, $event: MouseEvent): void;
|
|
56
|
+
manageFocus(event: KeyboardEvent): void;
|
|
57
|
+
private initializeFocusManager;
|
|
52
58
|
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationHistoryComponent, never>;
|
|
53
59
|
static ɵcmp: i0.ɵɵComponentDeclaration<NotificationHistoryComponent, "adf-notification-history", never, { "menuPositionX": { "alias": "menuPositionX"; "required": false; }; "menuPositionY": { "alias": "menuPositionY"; "required": false; }; "maxNotifications": { "alias": "maxNotifications"; "required": false; }; }, {}, never, never, true, never>;
|
|
54
60
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { NotificationHistoryComponent } from './components/notification-history.component';
|
|
2
|
-
import { AddNotificationStorybookComponent } from './components/add-notification.stories.component';
|
|
3
2
|
import * as i0 from "@angular/core";
|
|
4
3
|
import * as i1 from "./components/notification-history.component";
|
|
5
|
-
|
|
6
|
-
export declare const NOTIFICATION_HISTORY_DIRECTIVES: readonly [typeof NotificationHistoryComponent, typeof AddNotificationStorybookComponent];
|
|
4
|
+
export declare const NOTIFICATION_HISTORY_DIRECTIVES: readonly [typeof NotificationHistoryComponent];
|
|
7
5
|
/** @deprecated use `...NOTIFICATION_HISTORY_DIRECTIVES` or import the individual directives */
|
|
8
6
|
export declare class NotificationHistoryModule {
|
|
9
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationHistoryModule, never>;
|
|
10
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<NotificationHistoryModule, never, [typeof i1.NotificationHistoryComponent
|
|
8
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NotificationHistoryModule, never, [typeof i1.NotificationHistoryComponent], [typeof i1.NotificationHistoryComponent]>;
|
|
11
9
|
static ɵinj: i0.ɵɵInjectorDeclaration<NotificationHistoryModule>;
|
|
12
10
|
}
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
export * from './components/notification-history.component';
|
|
18
|
-
export * from './components/add-notification.stories.component';
|
|
19
18
|
export * from './helpers/notification.factory';
|
|
20
19
|
export * from './models/notification.model';
|
|
21
20
|
export * from './services/notification.service';
|
package/lib/styles/_index.scss
CHANGED
|
@@ -1,126 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
@
|
|
3
|
-
@
|
|
4
|
-
|
|
5
|
-
/* stylelint-disable scss/no-global-function-names */
|
|
6
|
-
/* stylelint-disable scss/at-import-partial-extension */
|
|
7
|
-
@import './mixins';
|
|
8
|
-
@import './mat-selectors';
|
|
9
|
-
@import '../form/components/widgets/form.theme';
|
|
10
|
-
@import '../clipboard/clipboard.theme';
|
|
11
|
-
@import './material.theme';
|
|
12
|
-
|
|
13
|
-
@mixin alfresco-material-theme($theme) {
|
|
14
|
-
@include adf-core-theme($theme);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@mixin adf-core-theme($theme, $custom-css-variables: $adf-custom-theme-sizes) {
|
|
18
|
-
$foreground: map-get($theme, foreground);
|
|
19
|
-
$background: map-get($theme, background);
|
|
20
|
-
$warn: map-get($theme, warn);
|
|
21
|
-
$accent: map-get($theme, accent);
|
|
22
|
-
$primary: map-get($theme, primary);
|
|
23
|
-
$typography: map-get($theme, typography);
|
|
24
|
-
|
|
25
|
-
// map SCSS variables to expose as CSS variables
|
|
26
|
-
$defaults: (
|
|
27
|
-
// theme colors
|
|
28
|
-
--theme-primary-color: mat.m2-get-color-from-palette($primary),
|
|
29
|
-
--theme-primary-color-default-contrast: mat.m2-get-color-from-palette($primary, default-contrast),
|
|
30
|
-
--theme-header-text-color: mat.m2-get-color-from-palette($primary, default-contrast),
|
|
31
|
-
--adf-theme-primary-50: mat.m2-get-color-from-palette($primary, 50),
|
|
32
|
-
--adf-theme-primary-100: mat.m2-get-color-from-palette($primary, 100),
|
|
33
|
-
--adf-theme-primary-300: mat.m2-get-color-from-palette($primary, 300),
|
|
34
|
-
--adf-theme-primary-900: mat.m2-get-color-from-palette($primary, 900),
|
|
35
|
-
--theme-warn-color: mat.m2-get-color-from-palette($warn),
|
|
36
|
-
--theme-warn-color-a700: mat.m2-get-color-from-palette($warn, A700),
|
|
37
|
-
--theme-warn-color-default-contrast: mat.m2-get-color-from-palette($warn, default-contrast),
|
|
38
|
-
--theme-accent-color: mat.m2-get-color-from-palette($accent),
|
|
39
|
-
--theme-accent-color-a200: mat.m2-get-color-from-palette($accent, A200),
|
|
40
|
-
--theme-accent-color-default-contrast: mat.m2-get-color-from-palette($accent, default-contrast),
|
|
41
|
-
--theme-accent-500: mat.m2-get-color-from-palette($accent, 500),
|
|
42
|
-
--adf-theme-foreground-base-color: mat.m2-get-color-from-palette($foreground, base),
|
|
43
|
-
--adf-theme-foreground-base-color-065: mat.m2-get-color-from-palette($foreground, base, 0.65),
|
|
44
|
-
--adf-theme-foreground-base-color-045: mat.m2-get-color-from-palette($foreground, base, 0.45),
|
|
45
|
-
--adf-theme-foreground-disabled-text-color: mat.m2-get-color-from-palette($foreground, disabled-text),
|
|
46
|
-
--adf-theme-foreground-divider-color: mat.m2-get-color-from-palette($foreground, divider),
|
|
47
|
-
--adf-theme-foreground-icon-color: mat.m2-get-color-from-palette($foreground, icon),
|
|
48
|
-
--adf-theme-foreground-icon-color-054: mat.m2-get-color-from-palette($foreground, icon, 0.54),
|
|
49
|
-
--adf-theme-foreground-secondary-text-color: mat.m2-get-color-from-palette($foreground, secondary-text),
|
|
50
|
-
--adf-theme-foreground-text-color: mat.m2-get-color-from-palette($foreground, text),
|
|
51
|
-
--adf-theme-foreground-text-color-087: mat.m2-get-color-from-palette($foreground, text, 0.87),
|
|
52
|
-
--adf-theme-foreground-text-color-075: mat.m2-get-color-from-palette($foreground, text, 0.75),
|
|
53
|
-
--adf-theme-foreground-text-color-064: mat.m2-get-color-from-palette($foreground, text, 0.64),
|
|
54
|
-
--adf-theme-foreground-text-color-054: mat.m2-get-color-from-palette($foreground, text, 0.54),
|
|
55
|
-
--adf-theme-foreground-text-color-040: mat.m2-get-color-from-palette($foreground, text, 0.4),
|
|
56
|
-
--adf-theme-foreground-text-color-027: mat.m2-get-color-from-palette($foreground, text, 0.27),
|
|
57
|
-
--adf-theme-foreground-text-color-025: mat.m2-get-color-from-palette($foreground, text, 0.25),
|
|
58
|
-
--adf-theme-foreground-text-color-014: mat.m2-get-color-from-palette($foreground, text, 0.14),
|
|
59
|
-
--adf-theme-foreground-text-color-007: mat.m2-get-color-from-palette($foreground, text, 0.07),
|
|
60
|
-
--adf-theme-background-card-color: mat.m2-get-color-from-palette($background, card),
|
|
61
|
-
--adf-theme-background-card-color-087: mat.m2-get-color-from-palette($background, card, 0.87),
|
|
62
|
-
--theme-background-color: mat.m2-get-color-from-palette($background, background),
|
|
63
|
-
--adf-theme-background-dialog-color: mat.m2-get-color-from-palette($background, dialog),
|
|
64
|
-
--adf-theme-background-hover-color: mat.m2-get-color-from-palette($background, hover),
|
|
65
|
-
--adf-theme-background-selected-button-color: mat.m2-get-color-from-palette($background, selected-button),
|
|
66
|
-
--adf-theme-background-status-bar-color: mat.m2-get-color-from-palette($background, status-bar),
|
|
67
|
-
--adf-theme-background-unselected-chip-color: mat.m2-get-color-from-palette($background, unselected-chip),
|
|
68
|
-
// typography
|
|
69
|
-
--theme-font-family: mat.m2-font-family($typography),
|
|
70
|
-
--theme-font-weight: normal,
|
|
71
|
-
--theme-body-1-font-size: mat.m2-font-size($typography, body-2),
|
|
72
|
-
--theme-body-2-font-size: mat.m2-font-size($typography, subtitle-2),
|
|
73
|
-
--theme-body-1-line-height: mat.m2-line-height($typography, body-2),
|
|
74
|
-
--theme-display-1-font-size: mat.m2-font-size($typography, headline-4),
|
|
75
|
-
--theme-display-3-font-size: mat.m2-font-size($typography, headline-2),
|
|
76
|
-
--theme-display-4-font-size: mat.m2-font-size($typography, headline-1),
|
|
77
|
-
--theme-caption-font-size: mat.m2-font-size($typography, caption),
|
|
78
|
-
--theme-title-font-size: mat.m2-font-size($typography, headline-6),
|
|
79
|
-
--theme-subheading-1-font-size: mat.m2-font-size($typography, body-1),
|
|
80
|
-
--theme-subheading-2-font-size: mat.m2-font-size($typography, subtitle-1),
|
|
81
|
-
--theme-button-font-size: mat.m2-font-size($typography, button),
|
|
82
|
-
--theme-headline-font-size: mat.m2-font-size($typography, headline-5),
|
|
83
|
-
--theme-headline-line-height: mat.m2-line-height($typography, headline-5),
|
|
84
|
-
--theme-adf-icon-1-font-size: map-get($custom-css-variables, 'theme-adf-icon-1-font-size'),
|
|
85
|
-
--theme-adf-picture-1-font-size: map-get($custom-css-variables, 'theme-adf-picture-1-font-size'),
|
|
86
|
-
--theme-adf-task-footer-font-size: map-get($custom-css-variables, 'theme-adf-task-footer-font-size'),
|
|
87
|
-
--theme-adf-task-title-font-size: map-get($custom-css-variables, 'theme-adf-task-title-font-size'),
|
|
88
|
-
// specific colors
|
|
89
|
-
--adf-theme-mat-grey-color-a200: mat.m2-get-color-from-palette(mat.$m2-grey-palette, 'A200'),
|
|
90
|
-
--adf-theme-mat-grey-color-a400: mat.m2-get-color-from-palette(mat.$m2-grey-palette, 'A400'),
|
|
91
|
-
--adf-theme-mat-grey-color-50: mat.m2-get-color-from-palette(mat.$m2-grey-palette, 50),
|
|
92
|
-
// spacing
|
|
93
|
-
--adf-theme-spacing: map-get($custom-css-variables, 'theme-adf-spacing'),
|
|
94
|
-
// components
|
|
95
|
-
--adf-metadata-property-panel-border-color: rgba(0, 0, 0, 0.12),
|
|
96
|
-
--adf-metadata-buttons-background-color: rgba(33, 33, 33, 0.05),
|
|
97
|
-
--adf-metadata-action-button-clear-color: rgba(33, 35, 40, 0.698),
|
|
98
|
-
--adf-metadata-property-panel-text-color: rgba(33, 35, 40, 0.7),
|
|
99
|
-
--adf-metadata-property-panel-label-color: rgba(33, 33, 33, 0.24),
|
|
100
|
-
--adf-metadata-property-panel-title-color: rgb(33, 33, 33),
|
|
101
|
-
--adf-error-color: #ba1b1b,
|
|
102
|
-
--adf-secondary-button-background: #2121210d,
|
|
103
|
-
--adf-secondary-modal-text-color: #212121,
|
|
104
|
-
--adf-disabled-button-background: rgba(0, 0, 0, 0.12),
|
|
105
|
-
--adf-chip-border-color: #757575,
|
|
106
|
-
--adf-sidenav-active-text-color: rgba(0, 48, 100, 1)
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
// propagates SCSS variables into the CSS variables scope
|
|
110
|
-
:root {
|
|
111
|
-
@each $name, $value in $defaults {
|
|
112
|
-
#{$name}: #{$value};
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
@include datetimepicker-theme.mat-datetimepicker-theme($theme);
|
|
117
|
-
@include adf-material-theme;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
$adf-custom-theme-sizes: (
|
|
121
|
-
'theme-adf-icon-1-font-size': 17px,
|
|
122
|
-
'theme-adf-picture-1-font-size': 18px,
|
|
123
|
-
'theme-adf-task-footer-font-size': 18px,
|
|
124
|
-
'theme-adf-task-title-font-size': 18px,
|
|
125
|
-
'theme-adf-spacing': 16px
|
|
126
|
-
);
|
|
1
|
+
@forward './globals';
|
|
2
|
+
@forward './flex';
|
|
3
|
+
@forward './mixins';
|
|
4
|
+
@forward './mat-selectors';
|
|
@@ -17,6 +17,7 @@ $mat-checkbox: '.mat-mdc-checkbox';
|
|
|
17
17
|
$mat-checkbox-label: '.mdc-label';
|
|
18
18
|
$mat-button: '.mat-mdc-button';
|
|
19
19
|
$mat-button-label: '.mdc-button__label';
|
|
20
|
+
$mat-form-field-input-control: '.mat-mdc-form-field-input-control';
|
|
20
21
|
$mat-form-field: '.mat-mdc-form-field';
|
|
21
22
|
$mat-form-field-flex: '.mat-mdc-form-field-flex';
|
|
22
23
|
$mat-form-field-wrapper: '.mat-mdc-text-field-wrapper';
|
|
@@ -55,6 +56,8 @@ $mat-calendar-table-header: '.mat-calendar-table-header';
|
|
|
55
56
|
$mat-calendar-body-disabled: '.mat-calendar-body-disabled';
|
|
56
57
|
$mat-toolbar: '.mat-toolbar';
|
|
57
58
|
$mat-list-item-unscoped-content: '.mat-mdc-list-item-unscoped-content';
|
|
59
|
+
$mat-list-item: '.mat-mdc-list-item';
|
|
60
|
+
$mat-list-item-end: '.mdc-list-item__end';
|
|
58
61
|
$mat-text-field-no-label: '.mdc-text-field--no-label';
|
|
59
62
|
$mat-form-field-infix: '.mat-mdc-form-field-infix';
|
|
60
63
|
$mat-form-field-error-wrapper: '.mat-mdc-form-field-error-wrapper';
|
package/lib/testing/index.d.ts
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
export * from './core.story.module';
|
|
18
17
|
export * from './noop-translate.module';
|
|
19
18
|
export * from './noop-auth.module';
|
|
20
19
|
export * from './unit-testing-utils';
|
|
@@ -12,6 +12,7 @@ export declare class NoopTranslationService implements TranslationService {
|
|
|
12
12
|
use(): any;
|
|
13
13
|
loadTranslation(): void;
|
|
14
14
|
get(key: string | Array<string>): Observable<string | any>;
|
|
15
|
+
getLocale(): any;
|
|
15
16
|
instant(key: string | Array<string>): string | any;
|
|
16
17
|
static ɵfac: i0.ɵɵFactoryDeclaration<NoopTranslationService, never>;
|
|
17
18
|
static ɵprov: i0.ɵɵInjectableDeclaration<NoopTranslationService>;
|
|
@@ -25,6 +25,7 @@ import { MatFormFieldHarness } from '@angular/material/form-field/testing';
|
|
|
25
25
|
import { MatInputHarness } from '@angular/material/input/testing';
|
|
26
26
|
import { ComponentFixture } from '@angular/core/testing';
|
|
27
27
|
import { MatTabHarness } from '@angular/material/tabs/testing';
|
|
28
|
+
import { MatListOptionHarness } from '@angular/material/list/testing';
|
|
28
29
|
export declare class UnitTestingUtils {
|
|
29
30
|
private debugElement?;
|
|
30
31
|
private loader?;
|
|
@@ -122,4 +123,7 @@ export declare class UnitTestingUtils {
|
|
|
122
123
|
checkIfMatSnackbarExists(): Promise<boolean>;
|
|
123
124
|
/** MatProgressBar related methods */
|
|
124
125
|
getMatProgressBarHost(): Promise<TestElement>;
|
|
126
|
+
/** MatListOption related methods */
|
|
127
|
+
getMatListOption(): Promise<MatListOptionHarness>;
|
|
128
|
+
getAllMatListOptions(): Promise<MatListOptionHarness[]>;
|
|
125
129
|
}
|
|
@@ -81,6 +81,12 @@ export declare class TranslationService {
|
|
|
81
81
|
* @returns Translated text
|
|
82
82
|
*/
|
|
83
83
|
get(key: string | Array<string>, interpolateParams?: any): Observable<string | any>;
|
|
84
|
+
/**
|
|
85
|
+
* Determines the preferred locale for the current user.
|
|
86
|
+
*
|
|
87
|
+
* @returns Locale identifier resolved from the browser or the default translation locale
|
|
88
|
+
*/
|
|
89
|
+
getLocale(): string;
|
|
84
90
|
/**
|
|
85
91
|
* Directly returns the translation for the supplied key.
|
|
86
92
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfresco/adf-core",
|
|
3
3
|
"description": "Alfresco ADF core",
|
|
4
|
-
"version": "8.2.0
|
|
4
|
+
"version": "8.2.0",
|
|
5
5
|
"author": "Hyland Software, Inc. and its affiliates",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -63,11 +63,10 @@
|
|
|
63
63
|
"@angular/router": ">=16.0.0",
|
|
64
64
|
"@mat-datetimepicker/core": ">=12.0.1",
|
|
65
65
|
"@ngx-translate/core": ">=16.0.0",
|
|
66
|
-
"@alfresco/js-api": ">=9.2.0
|
|
67
|
-
"@alfresco/adf-extensions": ">=8.2.0
|
|
66
|
+
"@alfresco/js-api": ">=9.2.0",
|
|
67
|
+
"@alfresco/adf-extensions": ">=8.2.0",
|
|
68
68
|
"minimatch": ">=10.0.0",
|
|
69
|
-
"pdfjs-dist": ">=3.3.122"
|
|
70
|
-
"ts-morph": ">=20.0.0"
|
|
69
|
+
"pdfjs-dist": ">=3.3.122"
|
|
71
70
|
},
|
|
72
71
|
"keywords": [
|
|
73
72
|
"core",
|
|
@@ -15,10 +15,9 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import { Rule, Tree } from '@angular-devkit/schematics';
|
|
18
|
-
import { Project } from 'ts-morph';
|
|
19
18
|
/**
|
|
20
19
|
* @returns Schematic rule for updating imports
|
|
21
20
|
*/
|
|
22
21
|
export declare function updateAlfrescoApiImports(): Rule;
|
|
23
|
-
export declare const visitor: (filePath: string, tree: Pick<Tree, "read" | "overwrite"
|
|
22
|
+
export declare const visitor: (filePath: string, tree: Pick<Tree, "read" | "overwrite">) => void;
|
|
24
23
|
export default updateAlfrescoApiImports;
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.visitor = void 0;
|
|
20
20
|
exports.updateAlfrescoApiImports = updateAlfrescoApiImports;
|
|
21
|
+
const ts = require("typescript");
|
|
21
22
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
22
|
-
const ts_morph_1 = require("ts-morph");
|
|
23
23
|
const alfrescoApiServiceMigration = {
|
|
24
24
|
change: {
|
|
25
25
|
importedValue: 'AlfrescoApiService',
|
|
@@ -55,14 +55,12 @@ const migrations = [alfrescoApiServiceMigration, alfrescoApiMockMigration, alfre
|
|
|
55
55
|
* @returns Schematic rule for updating imports
|
|
56
56
|
*/
|
|
57
57
|
function updateAlfrescoApiImports() {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return (tree, _context) => {
|
|
61
|
-
tree.visit((filePath) => (0, exports.visitor)(filePath, tree, project));
|
|
58
|
+
return (tree) => {
|
|
59
|
+
tree.visit((filePath) => (0, exports.visitor)(filePath, tree));
|
|
62
60
|
return tree;
|
|
63
61
|
};
|
|
64
62
|
}
|
|
65
|
-
const visitor = (filePath, tree
|
|
63
|
+
const visitor = (filePath, tree) => {
|
|
66
64
|
if (!filePath.includes('/.git/') &&
|
|
67
65
|
!filePath.includes('/node_modules/') &&
|
|
68
66
|
!filePath.includes('/.angular/') &&
|
|
@@ -72,8 +70,10 @@ const visitor = (filePath, tree, project) => {
|
|
|
72
70
|
if (!bufferFileContent) {
|
|
73
71
|
throw new schematics_1.SchematicsException(`Could not read file: ${filePath}`);
|
|
74
72
|
}
|
|
73
|
+
const fileContent = bufferFileContent.toString();
|
|
74
|
+
const sourceFile = ts.createSourceFile(filePath, fileContent, ts.ScriptTarget.Latest, true);
|
|
75
75
|
migrations.forEach((migrationData) => {
|
|
76
|
-
const fileWithUpdatedImport = moveImport(
|
|
76
|
+
const fileWithUpdatedImport = moveImport(bufferFileContent, sourceFile, migrationData);
|
|
77
77
|
if (fileWithUpdatedImport) {
|
|
78
78
|
tree.overwrite(filePath, fileWithUpdatedImport);
|
|
79
79
|
}
|
|
@@ -81,64 +81,51 @@ const visitor = (filePath, tree, project) => {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
exports.visitor = visitor;
|
|
84
|
-
const moveImport = (
|
|
85
|
-
var _a
|
|
84
|
+
const moveImport = (bufferFileContent, sourceFile, migrationData) => {
|
|
85
|
+
var _a;
|
|
86
86
|
const fileContent = bufferFileContent.toString();
|
|
87
87
|
const predictImport = fileContent.includes(migrationData.change.importedValue);
|
|
88
|
-
if (predictImport) {
|
|
89
|
-
|
|
90
|
-
const alfrescoApiImportResult = getImportedValueFromSource(sourceFile, {
|
|
91
|
-
importedIdentifier: migrationData.change.importedValue,
|
|
92
|
-
from: migrationData.change.importSource
|
|
93
|
-
});
|
|
94
|
-
if (alfrescoApiImportResult === null || alfrescoApiImportResult === void 0 ? void 0 : alfrescoApiImportResult.importedValue) {
|
|
95
|
-
if (alfrescoApiImportResult.allImportedValuesCount === 1) {
|
|
96
|
-
// There is only one import e.g. import { A } from 'A';
|
|
97
|
-
// Therefore, we need to remove whole import statement
|
|
98
|
-
(_b = alfrescoApiImportResult.importSource) === null || _b === void 0 ? void 0 : _b.remove();
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
(_c = alfrescoApiImportResult.importedValue) === null || _c === void 0 ? void 0 : _c.remove();
|
|
102
|
-
}
|
|
103
|
-
const alfrescoContentServiceImport = getSourceImport(sourceFile, migrationData.to.importSource);
|
|
104
|
-
if (alfrescoContentServiceImport) {
|
|
105
|
-
alfrescoContentServiceImport.addNamedImport(migrationData.to.importedValue);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
sourceFile.insertStatements(sourceFile.getImportDeclarations().length + 1, `import { ${migrationData.to.importedValue} } from '${migrationData.to.importSource}';`);
|
|
109
|
-
}
|
|
110
|
-
return sourceFile.getFullText();
|
|
111
|
-
}
|
|
88
|
+
if (!predictImport) {
|
|
89
|
+
return undefined;
|
|
112
90
|
}
|
|
113
|
-
|
|
114
|
-
};
|
|
115
|
-
const getSourceImport = (sourceFile, from) => {
|
|
116
|
-
const moduleImports = sourceFile.getImportDeclarations();
|
|
91
|
+
const moduleImports = sourceFile.statements.filter(ts.isImportDeclaration);
|
|
117
92
|
const importDeclaration = moduleImports.find((moduleImport) => {
|
|
118
|
-
const currentImportSource = moduleImport.
|
|
119
|
-
return currentImportSource ===
|
|
93
|
+
const currentImportSource = moduleImport.moduleSpecifier.getText().replace(/['"]/g, '');
|
|
94
|
+
return currentImportSource === migrationData.change.importSource;
|
|
120
95
|
});
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const getImportedValueFromSource = (sourceFile, searchedImport) => {
|
|
124
|
-
var _a;
|
|
125
|
-
const importSource = getSourceImport(sourceFile, searchedImport.from);
|
|
126
|
-
if (!importSource) {
|
|
127
|
-
return {
|
|
128
|
-
importedValue: undefined,
|
|
129
|
-
importSource: undefined,
|
|
130
|
-
allImportedValuesCount: undefined
|
|
131
|
-
};
|
|
96
|
+
if (!((_a = importDeclaration === null || importDeclaration === void 0 ? void 0 : importDeclaration.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings)) {
|
|
97
|
+
return undefined;
|
|
132
98
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
99
|
+
if (!ts.isNamedImports(importDeclaration.importClause.namedBindings)) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
const namedImportsElements = importDeclaration.importClause.namedBindings.elements;
|
|
103
|
+
const importedValue = namedImportsElements.find((binding) => binding.name.text === migrationData.change.importedValue);
|
|
104
|
+
if (importedValue) {
|
|
105
|
+
let updatedContent = namedImportsElements.length === 1
|
|
106
|
+
? removeTextRange(fileContent, importDeclaration.getFullStart(), importDeclaration.getEnd())
|
|
107
|
+
: removeTextRange(fileContent, importedValue.getFullStart(), importedValue.getEnd());
|
|
108
|
+
const alreadyImported = moduleImports.some((moduleImport) => {
|
|
109
|
+
var _a;
|
|
110
|
+
const currentImportSource = moduleImport.moduleSpecifier.getText().replace(/['"]/g, '');
|
|
111
|
+
return (currentImportSource === migrationData.to.importSource &&
|
|
112
|
+
((_a = moduleImport.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings) &&
|
|
113
|
+
ts.isNamedImports(moduleImport.importClause.namedBindings) &&
|
|
114
|
+
moduleImport.importClause.namedBindings.elements.some((element) => element.name.text === migrationData.to.importedValue));
|
|
115
|
+
});
|
|
116
|
+
if (!alreadyImported) {
|
|
117
|
+
const firstNonImport = sourceFile.statements.find((statement) => !ts.isImportDeclaration(statement));
|
|
118
|
+
const insertPosition = firstNonImport ? firstNonImport.getFullStart() : fileContent.length;
|
|
119
|
+
updatedContent =
|
|
120
|
+
updatedContent.slice(0, insertPosition).trimEnd() +
|
|
121
|
+
`\nimport { ${migrationData.to.importedValue} } from '${migrationData.to.importSource}';\n` +
|
|
122
|
+
updatedContent.slice(insertPosition);
|
|
123
|
+
}
|
|
124
|
+
updatedContent = updatedContent.replace(/^\s*\n+/g, '').replace(/\n{3,}/g, '\n\n');
|
|
125
|
+
return updatedContent;
|
|
126
|
+
}
|
|
127
|
+
return undefined;
|
|
142
128
|
};
|
|
129
|
+
const removeTextRange = (text, start, end) => text.slice(0, start) + text.slice(end);
|
|
143
130
|
exports.default = updateAlfrescoApiImports;
|
|
144
131
|
//# sourceMappingURL=index.js.map
|