mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-08-29 04:47:10 +08:00
Update common imports
This commit is contained in:
parent
c1171e1da4
commit
f552d39fc2
31 changed files with 138 additions and 106 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
import {ButtonInterface} from '../../common/components/button/button.model';
|
||||
import {Field} from '../../common/record/field.model';
|
||||
import {FieldActions} from "../../common/metadata/metadata.model";
|
||||
|
||||
export interface FieldGridColumn {
|
||||
field?: Field;
|
||||
|
|
|
@ -25,18 +25,6 @@
|
|||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {
|
||||
Action,
|
||||
deepClone,
|
||||
Field,
|
||||
MapEntry,
|
||||
Record,
|
||||
RecordMapper,
|
||||
RecordMapperRegistry,
|
||||
StringArrayMap,
|
||||
StringArrayMatrix,
|
||||
ViewMode
|
||||
} from 'common';
|
||||
import {FieldActionData, FieldActionHandler} from "../field.action";
|
||||
import {AsyncActionInput, AsyncActionService} from "../../../../services/process/processes/async-action/async-action";
|
||||
import {ActiveFieldsChecker} from "../../../../services/condition-operators/active-fields-checker.service";
|
||||
|
@ -44,6 +32,15 @@ import {MessageService} from "../../../../services/message/message.service";
|
|||
import {ProcessService} from "../../../../services/process/process.service";
|
||||
import {BaseSaveRecordMapper} from "../../../../store/record/record-mappers/base-save.record-mapper";
|
||||
import {take} from "rxjs/operators";
|
||||
import {ViewMode} from "../../../../common/views/view.model";
|
||||
import {RecordMapperRegistry} from "../../../../common/record/record-mappers/record-mapper.registry";
|
||||
import {StringArrayMap} from "../../../../common/types/string-map";
|
||||
import {StringArrayMatrix} from "../../../../common/types/string-matrix";
|
||||
import {Record} from "../../../../common/record/record.model";
|
||||
import {deepClone} from "../../../../common/utils/object-utils";
|
||||
import {MapEntry} from "../../../../common/types/overridable-map";
|
||||
import {RecordMapper} from "../../../../common/record/record-mappers/record-mapper.model";
|
||||
import {Field} from "../../../../common/record/field.model";
|
||||
|
||||
|
||||
@Injectable({
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ViewMode} from 'common';
|
||||
import {FieldActionData, FieldActionHandler} from '../field.action';
|
||||
import {ViewMode} from "../../../../common/views/view.model";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ALL_VIEW_MODES} from 'common';
|
||||
import {FieldActionData, FieldActionHandler} from '../field.action';
|
||||
import { Clipboard } from '@angular/cdk/clipboard';
|
||||
import {Clipboard} from '@angular/cdk/clipboard';
|
||||
import {ALL_VIEW_MODES} from "../../../../common/views/view.model";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -37,7 +37,7 @@ export class FieldCopyAction extends FieldActionHandler {
|
|||
key = 'copy';
|
||||
modes = ALL_VIEW_MODES;
|
||||
|
||||
constructor( private clipboard: Clipboard) {
|
||||
constructor(private clipboard: Clipboard) {
|
||||
super();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
* the words "Supercharged by SuiteCRM".
|
||||
*/
|
||||
|
||||
import {Action, ActionData, ActionHandler} from 'common';
|
||||
import {RecordViewStore} from '../../../views/record/store/record-view/record-view.store';
|
||||
import {Action, ActionData, ActionHandler} from "../../../common/actions/action.model";
|
||||
|
||||
export interface FieldActionData extends ActionData {
|
||||
store: RecordViewStore;
|
||||
|
@ -36,7 +36,7 @@ export abstract class FieldActionHandler extends ActionHandler<FieldActionData>
|
|||
|
||||
abstract run(data: FieldActionData): void;
|
||||
|
||||
shouldDisplay(data: FieldActionData): boolean{
|
||||
shouldDisplay(data: FieldActionData): boolean {
|
||||
return true
|
||||
};
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Action, ActionContext, ViewMode} from 'common';
|
||||
import {combineLatest, Observable} from 'rxjs';
|
||||
import {map, take} from 'rxjs/operators';
|
||||
import {MetadataStore} from '../../../store/metadata/metadata.store.service';
|
||||
|
@ -40,6 +39,8 @@ import {BaseFieldActionsAdapter} from '../../../services/actions/base-field-acti
|
|||
import {SelectModalService} from '../../../services/modals/select-modal.service';
|
||||
import {RecordViewStore} from '../../../views/record/store/record-view/record-view.store';
|
||||
import {AppMetadataStore} from "../../../store/app-metadata/app-metadata.store.service";
|
||||
import {Action, ActionContext} from "../../../common/actions/action.model";
|
||||
import {ViewMode} from "../../../common/views/view.model";
|
||||
|
||||
@Injectable()
|
||||
export class FieldActionsAdapter extends BaseFieldActionsAdapter<FieldActionData> {
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
* the words "Supercharged by SuiteCRM".
|
||||
*/
|
||||
|
||||
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
|
||||
import {Action, ActionContext, ActionDataSource} from '../../common/actions/action.model';
|
||||
import {Component, ElementRef, HostListener, Input, OnDestroy, OnInit, signal} from '@angular/core';
|
||||
import {Action, ActionContext, ActionDataSource, ActiveLineAction} from '../../common/actions/action.model';
|
||||
import {Button, ButtonInterface} from '../../common/components/button/button.model';
|
||||
import {ButtonGroupInterface} from '../../common/components/button/button-group.model';
|
||||
import {isFalse} from '../../common/utils/value-utils';
|
||||
|
@ -60,7 +60,7 @@ export class LineActionMenuComponent implements OnInit, OnDestroy {
|
|||
configState = new BehaviorSubject<ButtonGroupInterface>({buttons: []});
|
||||
config$ = this.configState.asObservable();
|
||||
actions: Action[];
|
||||
isActive:boolean = false;
|
||||
isActive: boolean = false;
|
||||
|
||||
isClickedOutside = signal<boolean>(false)
|
||||
|
||||
|
@ -88,7 +88,8 @@ export class LineActionMenuComponent implements OnInit, OnDestroy {
|
|||
protected screenSize: ScreenSizeObserverService,
|
||||
protected systemConfigStore: SystemConfigStore,
|
||||
private el: ElementRef
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.subs.push(this.config.getActions({record: this.record}).pipe(
|
||||
|
@ -203,7 +204,7 @@ export class LineActionMenuComponent implements OnInit, OnDestroy {
|
|||
|
||||
toggleExpand(recordId: string) {
|
||||
const activeId = this.activeLineAction.getActiveAction();
|
||||
if(activeId === recordId && !this.isClickedOutside()){
|
||||
if (activeId === recordId && !this.isClickedOutside()) {
|
||||
this.activeLineAction.resetActiveAction();
|
||||
} else {
|
||||
this.activeLineAction.setActiveAction(recordId);
|
||||
|
|
|
@ -25,13 +25,13 @@
|
|||
*/
|
||||
|
||||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
|
||||
import {LineActionMenuComponent} from './line-action-menu.component';
|
||||
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {ImageModule} from '../image/image.module';
|
||||
import {ButtonGroupModule} from '../button-group/button-group.module';
|
||||
import {CommonModule} from "@angular/common";
|
||||
import {LineActionMenuComponent} from "./line-action-menu.component";
|
||||
|
||||
@NgModule({
|
||||
declarations: [LineActionMenuComponent],
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
|
||||
import {Component, Input, OnDestroy, OnInit} from '@angular/core';
|
||||
import {combineLatestWith, BehaviorSubject, Observable, of, Subscription} from 'rxjs';
|
||||
import {BehaviorSubject, combineLatestWith, Observable, of, Subscription} from 'rxjs';
|
||||
import {map, shareReplay} from 'rxjs/operators';
|
||||
import {ColumnDefinition} from '../../../common/metadata/list.metadata.model';
|
||||
import {Field} from '../../../common/record/field.model';
|
||||
|
@ -37,6 +37,7 @@ import {TableConfig} from '../table.model';
|
|||
import {SortDirectionDataSource} from '../../sort-button/sort-button.model';
|
||||
import {LoadingBufferFactory} from '../../../services/ui/loading-buffer/loading-buffer.factory';
|
||||
import {LoadingBuffer} from '../../../services/ui/loading-buffer/loading-buffer.service';
|
||||
import {ActiveLineAction} from "../../../common/actions/action.model";
|
||||
|
||||
interface TableViewModel {
|
||||
columns: ColumnDefinition[];
|
||||
|
@ -56,9 +57,9 @@ export class TableBodyComponent implements OnInit, OnDestroy {
|
|||
@Input() config: TableConfig;
|
||||
|
||||
private activeAction: BehaviorSubject<string> = new BehaviorSubject<string>('');
|
||||
protected activeAction$: Observable<string> =this.activeAction.asObservable();
|
||||
protected activeAction$: Observable<string> = this.activeAction.asObservable();
|
||||
|
||||
activeLineAction: ActiveLineAction
|
||||
activeLineAction: ActiveLineAction;
|
||||
|
||||
maxColumns = 4;
|
||||
popoverColumns: ColumnDefinition[];
|
||||
|
@ -143,7 +144,7 @@ export class TableBodyComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
record.metadata.queryParams = {
|
||||
offset: (index + 1 ) + ((this.currentPage - 1) * this.pageSize)
|
||||
offset: (index + 1) + ((this.currentPage - 1) * this.pageSize)
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -200,7 +201,7 @@ export class TableBodyComponent implements OnInit, OnDestroy {
|
|||
return displayedColumns;
|
||||
}
|
||||
|
||||
buildHiddenColumns(metaFields: ColumnDefinition[], displayedColumns:string[]): ColumnDefinition[] {
|
||||
buildHiddenColumns(metaFields: ColumnDefinition[], displayedColumns: string[]): ColumnDefinition[] {
|
||||
const fields = metaFields.filter(function (field) {
|
||||
return !field.hasOwnProperty('default')
|
||||
|| (field.hasOwnProperty('default') && field.default === true);
|
||||
|
@ -214,7 +215,7 @@ export class TableBodyComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}
|
||||
|
||||
let hiddenColumns= fields.filter(obj => missingFields.includes(obj.name));
|
||||
let hiddenColumns = fields.filter(obj => missingFields.includes(obj.name));
|
||||
|
||||
return hiddenColumns;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import {MessageService} from '../../../../services/message/message.service';
|
|||
import {RecordManager} from '../../../../services/record/record.manager';
|
||||
import {BaseSaveRecordMapper} from '../../../../store/record/record-mappers/base-save.record-mapper';
|
||||
import {Observable} from 'rxjs';
|
||||
import {ObjectMap} from "../../../../common/types/object-map";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
|
|
|
@ -43,6 +43,7 @@ import {RecordManager} from '../../../../services/record/record.manager';
|
|||
import {FieldManager} from '../../../../services/record/field/field.manager';
|
||||
import {LanguageStore} from '../../../../store/language/language.store';
|
||||
import {signal} from "@angular/core";
|
||||
import {ObjectMap} from "../../../../common/types/object-map";
|
||||
|
||||
const initialState = {
|
||||
id: '',
|
||||
|
@ -179,11 +180,11 @@ export class SavedFilterRecordStore extends RecordStore {
|
|||
*/
|
||||
protected initRecord(record: SavedFilter): void {
|
||||
|
||||
if(this.metadata) {
|
||||
if (this.metadata) {
|
||||
record.metadata = this.metadata;
|
||||
}
|
||||
|
||||
if(!record?.validationTriggered) {
|
||||
if (!record?.validationTriggered) {
|
||||
record.validationTriggered = signal(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ import {BehaviorSubject, combineLatestWith, forkJoin, Observable, of, Subscripti
|
|||
import {Record} from '../../../../common/record/record.model';
|
||||
import {SearchCriteria} from '../../../../common/views/list/search-criteria.model';
|
||||
import {ColumnDefinition, SearchMetaFieldMap} from '../../../../common/metadata/list.metadata.model';
|
||||
import {ViewContext} from '../../../../common/views/view.model';
|
||||
import {ViewMode} from '../../../../common/views/view.model';
|
||||
import {ViewContext, ViewMode} from '../../../../common/views/view.model';
|
||||
import {ViewFieldDefinition} from '../../../../common/metadata/metadata.model';
|
||||
import {deepClone} from '../../../../common/utils/object-utils';
|
||||
import {catchError, distinctUntilChanged, filter, finalize, map, startWith, take, tap} from 'rxjs/operators';
|
||||
|
@ -45,6 +44,7 @@ import {LanguageStore} from '../../../../store/language/language.store';
|
|||
import {SavedFilterRecordStore} from './saved-filter-record.store';
|
||||
import {SavedFilterRecordStoreFactory} from './saved-filter-record.store.factory';
|
||||
import {RecordValidationHandler} from "../../../../services/record/validation/record-validation.handler";
|
||||
import {ObjectMap} from "../../../../common/types/object-map";
|
||||
|
||||
const initialState: FilterContainerState = {
|
||||
module: '',
|
||||
|
|
|
@ -34,6 +34,7 @@ import {ButtonInterface} from '../../common/components/button/button.model';
|
|||
import {FieldManager} from '../../services/record/field/field.manager';
|
||||
import {FieldRegistry} from '../field.registry';
|
||||
import {FieldLogicDisplayManager} from '../field-logic-display/field-logic-display.manager';
|
||||
import {ViewMode} from "../../common/views/view.model";
|
||||
|
||||
@Component({
|
||||
selector: 'scrm-line-items-field',
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Action, ActionContext, ActionManager} from 'common';
|
||||
import {AsyncActionInput, AsyncActionService} from '../process/processes/async-action/async-action';
|
||||
import {MessageService} from '../message/message.service';
|
||||
import {ConfirmationModalService} from '../modals/confirmation-modal.service';
|
||||
|
@ -34,6 +33,7 @@ import {LanguageStore} from '../../store/language/language.store';
|
|||
import {SelectModalService} from '../modals/select-modal.service';
|
||||
import {MetadataStore} from '../../store/metadata/metadata.store.service';
|
||||
import {AppMetadataStore} from "../../store/app-metadata/app-metadata.store.service";
|
||||
import {Action, ActionContext, ActionManager} from "../../common/actions/action.model";
|
||||
|
||||
@Injectable()
|
||||
export abstract class BaseFieldActionsAdapter<D> extends BaseActionsAdapter<D> {
|
||||
|
|
|
@ -29,11 +29,10 @@ import {Record} from '../../common/record/record.model';
|
|||
import {Field} from '../../common/record/field.model';
|
||||
import {StringArrayMap} from '../../common/types/string-map';
|
||||
import {StringArrayMatrix} from '../../common/types/string-matrix';
|
||||
import {isFalse} from '';
|
||||
import {isTrue} from '';
|
||||
import {LogicRuleValues} from '';
|
||||
import {isEmpty} from "lodash-es";
|
||||
import {ConditionOperatorManager} from "./condition-operator.manager";
|
||||
import {isFalse, isTrue} from "../../common/utils/value-utils";
|
||||
import {LogicRuleValues} from "../../common/metadata/metadata.model";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {ValidationManager} from '../validation/validation.manager';
|
||||
import {DataTypeFormatter} from '../../formatters/data-type.formatter.service';
|
||||
import {isTrue} from '../../../common/utils/value-utils';
|
||||
import {isFalse, isTrue} from '../../../common/utils/value-utils';
|
||||
import {ObjectMap} from '../../../common/types/object-map';
|
||||
import {AttributeDependency, BaseField, DisplayType, Field, FieldDefinition} from '../../../common/record/field.model';
|
||||
import {FieldLogic, FieldLogicMap} from '../../../common/actions/field-logic-action.model';
|
||||
|
|
|
@ -25,25 +25,23 @@
|
|||
*/
|
||||
import {Injectable} from "@angular/core";
|
||||
import {Observable, of} from "rxjs";
|
||||
import {
|
||||
FieldDefinitionMap,
|
||||
isVoid,
|
||||
Record,
|
||||
ViewFieldDefinition,
|
||||
ViewFieldDefinitionMap,
|
||||
FieldMetadata,
|
||||
FieldLogicMap} from "common";
|
||||
import {map} from "rxjs/operators";
|
||||
import {SystemConfigStore} from "../../store/system-config/system-config.store";
|
||||
import {Metadata, RecordViewMetadata} from "../../store/metadata/metadata.store.service";
|
||||
import {isEmpty} from "lodash-es";
|
||||
import {FieldDefinitionMap, FieldMetadata} from "../../common/record/field.model";
|
||||
import {Record} from "../../common/record/record.model";
|
||||
import {isVoid} from "../../common/utils/value-utils";
|
||||
import {ViewFieldDefinition, ViewFieldDefinitionMap} from "../../common/metadata/metadata.model";
|
||||
import {FieldLogicMap} from "../../common/actions/field-logic-action.model";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class RecordConvertService {
|
||||
|
||||
constructor(protected systemConfigStore: SystemConfigStore) { }
|
||||
constructor(protected systemConfigStore: SystemConfigStore) {
|
||||
}
|
||||
|
||||
public duplicateOnModule(prevRecord: Record, newRecord: Record, vardefs: FieldDefinitionMap, moduleMetadata: Metadata): Record {
|
||||
|
||||
|
@ -96,7 +94,7 @@ export class RecordConvertService {
|
|||
return;
|
||||
}
|
||||
|
||||
if (vardef.type == 'relate'){
|
||||
if (vardef.type == 'relate') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,10 @@
|
|||
* feasible for technical reasons, the Appropriate Legal Notices must display
|
||||
* the words "Supercharged by SuiteCRM".
|
||||
*/
|
||||
import {Field, FieldAttributeMap, FieldMap, Record} from "common";
|
||||
import {AsyncValidatorFn, ValidatorFn} from "@angular/forms";
|
||||
import {Injectable} from "@angular/core";
|
||||
import {Record} from "../../../common/record/record.model";
|
||||
import {Field, FieldAttributeMap, FieldMap} from "../../../common/record/field.model";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
|
|
@ -26,9 +26,13 @@
|
|||
|
||||
import {ValidatorInterface} from '../validator.Interface';
|
||||
import {AbstractControl} from '@angular/forms';
|
||||
import {Field, isTrue, Record, StandardValidationErrors, StandardValidatorFn, ViewFieldDefinition} from 'common';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {FormControlUtils} from "../../field/form-control.utils";
|
||||
import {ViewFieldDefinition} from "../../../../common/metadata/metadata.model";
|
||||
import {StandardValidationErrors, StandardValidatorFn} from "../../../../common/services/validators/validators.model";
|
||||
import {Field} from "../../../../common/record/field.model";
|
||||
import {Record} from "../../../../common/record/record.model";
|
||||
import {isTrue} from "../../../../common/utils/value-utils";
|
||||
|
||||
export const lineItemsRequiredValidator = (viewField: ViewFieldDefinition, record: Record, utils: FormControlUtils): StandardValidatorFn => (
|
||||
(control: AbstractControl): StandardValidationErrors | null => {
|
||||
|
|
|
@ -30,8 +30,9 @@ import {AbstractControl} from '@angular/forms';
|
|||
import {isTrue} from '../../../../common/utils/value-utils';
|
||||
import {FormControlUtils} from '../../field/form-control.utils';
|
||||
import {Record} from '../../../../common/record/record.model';
|
||||
import {StandardValidatorFn, StandardValidationErrors} from '../../../../common/services/validators/validators.model';
|
||||
import {StandardValidationErrors, StandardValidatorFn} from '../../../../common/services/validators/validators.model';
|
||||
import {ViewFieldDefinition} from '../../../../common/metadata/metadata.model';
|
||||
import {Field} from "../../../../common/record/field.model";
|
||||
|
||||
export const requiredValidator = (utils: FormControlUtils): StandardValidatorFn => (
|
||||
(control: AbstractControl): StandardValidationErrors | null => {
|
||||
|
|
|
@ -34,11 +34,12 @@ import {FieldDefinitionMap} from '../../common/record/field.model';
|
|||
import {deepClone} from '../../common/utils/object-utils';
|
||||
import {RecentlyViewed} from '../../common/record/recently-viewed.model';
|
||||
import {Favorite} from '../../common/record/favorites.model';
|
||||
import {Panel, TabDefinitions} from '../../common/metadata/metadata.model';
|
||||
import {FieldActions, Panel, TabDefinitions} from '../../common/metadata/metadata.model';
|
||||
import {SubPanelMeta} from '../../common/metadata/subpanel.metadata.model';
|
||||
import {WidgetMetadata} from '../../common/metadata/widget.metadata';
|
||||
import {StateStore} from '../state';
|
||||
import {AppStateStore} from '../app-state/app-state.store';
|
||||
import {ObjectMap} from "../../common/types/object-map";
|
||||
|
||||
export interface SummaryTemplates {
|
||||
[key: string]: string;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {RecordMapperRegistry, ViewFieldDefinition} from 'common';
|
||||
import {RecordStore} from './record.store';
|
||||
import {Observable} from 'rxjs';
|
||||
import {RecordFetchGQL} from './graphql/api.record.get';
|
||||
|
@ -35,6 +34,7 @@ import {RecordManager} from '../../services/record/record.manager';
|
|||
import {BaseSaveRecordMapper} from './record-mappers/base-save.record-mapper';
|
||||
import {RecordMapperRegistry} from '../../common/record/record-mappers/record-mapper.registry';
|
||||
import {ViewFieldDefinition} from '../../common/metadata/metadata.model';
|
||||
import {ObjectMap} from "../../common/types/object-map";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
|
|
|
@ -37,6 +37,7 @@ import {RecordMapperRegistry} from '../../common/record/record-mappers/record-ma
|
|||
import {ViewFieldDefinition} from '../../common/metadata/metadata.model';
|
||||
import {MapEntry} from '../../common/types/overridable-map';
|
||||
import {signal} from "@angular/core";
|
||||
import {ObjectMap} from "../../common/types/object-map";
|
||||
|
||||
const initialState = {
|
||||
id: '',
|
||||
|
@ -95,7 +96,7 @@ export class RecordStore {
|
|||
this.init(this.internalState);
|
||||
}));
|
||||
|
||||
if(metadata$) {
|
||||
if (metadata$) {
|
||||
this.subs.push(metadata$.subscribe(metadata => {
|
||||
this.setMetadata(metadata);
|
||||
}));
|
||||
|
@ -305,11 +306,11 @@ export class RecordStore {
|
|||
*/
|
||||
protected initRecord(record: Record, initDefaultValues: boolean = false): void {
|
||||
|
||||
if(this.metadata) {
|
||||
if (this.metadata) {
|
||||
record.metadata = this.metadata;
|
||||
}
|
||||
|
||||
if(!record?.validationTriggered) {
|
||||
if (!record?.validationTriggered) {
|
||||
record.validationTriggered = signal(false);
|
||||
}
|
||||
|
||||
|
@ -366,7 +367,7 @@ export class RecordStore {
|
|||
}
|
||||
|
||||
public setMetadata(metadata: ObjectMap): void {
|
||||
if(!metadata) {
|
||||
if (!metadata) {
|
||||
return;
|
||||
}
|
||||
this.metadata = metadata;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ViewMode} from 'common';
|
||||
import {take} from 'rxjs/operators';
|
||||
import {RecordActionData, RecordActionHandler} from '../record.action';
|
||||
import {MessageService} from '../../../../services/message/message.service';
|
||||
|
@ -34,6 +33,7 @@ import {NotificationStore} from '../../../../store/notification/notification.sto
|
|||
import {RecentlyViewedService} from "../../../../services/navigation/recently-viewed/recently-viewed.service";
|
||||
import {RecordPaginationService} from "../../store/record-pagination/record-pagination.service";
|
||||
import {SystemConfigStore} from "../../../../store/system-config/system-config.store";
|
||||
import {ViewMode} from "../../../../common/views/view.model";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
import {ChangeDetectionStrategy, Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import {CommonModule} from "@angular/common";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {PaginationCount, PageSelection, PaginationType, ObjectMap, ViewMode, ButtonInterface, ModalButtonInterface} from "common";
|
||||
import {combineLatestWith, Observable, Subscription} from "rxjs";
|
||||
import {filter, map, tap} from "rxjs/operators";
|
||||
import {toNumber} from "lodash-es";
|
||||
|
@ -43,6 +42,11 @@ import {RecordPaginationService} from "../../store/record-pagination/record-pagi
|
|||
import {RecordPaginationStore} from "../../store/record-pagination/record-pagination.store";
|
||||
import {NgbModal} from "@ng-bootstrap/ng-bootstrap";
|
||||
import {ButtonModule} from "../../../../components/button/button.module";
|
||||
import {PageSelection, PaginationCount, PaginationType} from "../../../../common/views/list/list-navigation.model";
|
||||
import {ViewMode} from "../../../../common/views/view.model";
|
||||
import {ObjectMap} from "../../../../common/types/object-map";
|
||||
import {ButtonInterface} from "../../../../common/components/button/button.model";
|
||||
import {ModalButtonInterface} from "../../../../common/components/modal/modal.model";
|
||||
|
||||
interface RecordPaginationViewModel {
|
||||
appStrings: LanguageStringMap;
|
||||
|
@ -106,7 +110,7 @@ export class RecordPaginationComponent implements OnInit, OnDestroy {
|
|||
this.currentPage = this.recordPaginationStore.getCurrentPage();
|
||||
this.pageSize = this.recordPaginationStore.getPageSize();
|
||||
this.totalRecordsCount = this.recordPaginationStore.getRecordsCount();
|
||||
this.paginationType= this.preferences.getUserPreference('listview_pagination_type') ?? this.systemConfigStore.getConfigValue('listview_pagination_type');
|
||||
this.paginationType = this.preferences.getUserPreference('listview_pagination_type') ?? this.systemConfigStore.getConfigValue('listview_pagination_type');
|
||||
this.recordPaginationService.paginationType = this.paginationType;
|
||||
this.subs.push(this.mode$.subscribe(mode => {
|
||||
this.mode = mode;
|
||||
|
@ -132,7 +136,7 @@ export class RecordPaginationComponent implements OnInit, OnDestroy {
|
|||
},
|
||||
icon: 'paginate_next',
|
||||
iconKlass: 'sicon-2x',
|
||||
disabled: this.currentIndex === this.totalRecordsCount || this.isRecordsLoading,
|
||||
disabled: this.currentIndex === this.totalRecordsCount || this.isRecordsLoading,
|
||||
onClick: () => this.nextRecord()
|
||||
} as ButtonInterface;
|
||||
|
||||
|
@ -147,10 +151,16 @@ export class RecordPaginationComponent implements OnInit, OnDestroy {
|
|||
if (!isRecordPaginationExist || !isRecordValid || (this.currentIndex > this.totalRecordsCount)) {
|
||||
paginationEnabled = false;
|
||||
}
|
||||
this.prevButton = { ...this.prevButton, titleKey: appStrings['LBL_SEARCH_PREV'] || '' } as ButtonInterface;
|
||||
this.nextButton = { ...this.nextButton, titleKey: appStrings['LBL_SEARCH_NEXT'] || '' } as ButtonInterface;
|
||||
this.prevButton = {
|
||||
...this.prevButton,
|
||||
titleKey: appStrings['LBL_SEARCH_PREV'] || ''
|
||||
} as ButtonInterface;
|
||||
this.nextButton = {
|
||||
...this.nextButton,
|
||||
titleKey: appStrings['LBL_SEARCH_NEXT'] || ''
|
||||
} as ButtonInterface;
|
||||
|
||||
return { appStrings, pageCount, paginationEnabled };
|
||||
return {appStrings, pageCount, paginationEnabled};
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -208,7 +218,7 @@ export class RecordPaginationComponent implements OnInit, OnDestroy {
|
|||
let nextRecordIndex = this.currentIndex % this.pageSize;
|
||||
let nextPageThreshold = this.currentIndex - ((this.currentPage - 1) * this.pageSize);
|
||||
|
||||
if (nextPageThreshold > this.recordIds.length -1) {
|
||||
if (nextPageThreshold > this.recordIds.length - 1) {
|
||||
this.loadPage(PageSelection.NEXT);
|
||||
} else {
|
||||
if (this.mode === 'edit' && this.recordViewStore.recordStore.isDirty() && !this.isSaveContinueClicked) {
|
||||
|
@ -223,7 +233,7 @@ export class RecordPaginationComponent implements OnInit, OnDestroy {
|
|||
this.isRecordsLoading = true;
|
||||
let nextRecordIndex = 0;
|
||||
let isPaginationLoadMore = false;
|
||||
if(this.paginationType === PaginationType.LOAD_MORE) {
|
||||
if (this.paginationType === PaginationType.LOAD_MORE) {
|
||||
isPaginationLoadMore = true;
|
||||
}
|
||||
if (direction === PageSelection.PREVIOUS) {
|
||||
|
@ -232,7 +242,7 @@ export class RecordPaginationComponent implements OnInit, OnDestroy {
|
|||
nextRecordIndex = this.currentIndex;
|
||||
}
|
||||
|
||||
if (isPaginationLoadMore && direction !== PageSelection.PREVIOUS ) {
|
||||
if (isPaginationLoadMore && direction !== PageSelection.PREVIOUS) {
|
||||
const jump = this.preferences.getUserPreference('list_max_entries_per_page') ?? this.systemConfigStore.getConfigValue('list_max_entries_per_page');
|
||||
const pagination = this.recordPaginationStore.recordListStore.getPagination();
|
||||
const currentPageSize = pagination.pageSize || 0;
|
||||
|
@ -257,12 +267,12 @@ export class RecordPaginationComponent implements OnInit, OnDestroy {
|
|||
|
||||
protected navigateNextRoute(nextRecordIndex: number): void {
|
||||
const nextRoute = this.buildRoute(this.recordIds[nextRecordIndex]);
|
||||
this.router.navigate([nextRoute], { queryParams: { offset: this.currentIndex + 1 }});
|
||||
this.router.navigate([nextRoute], {queryParams: {offset: this.currentIndex + 1}});
|
||||
}
|
||||
|
||||
protected navigatePrevRoute(nextRecordIndex: number): void {
|
||||
const nextRoute = this.buildRoute(this.recordIds[nextRecordIndex]);
|
||||
this.router.navigate([nextRoute], { queryParams: { offset: this.currentIndex - 1 }});
|
||||
this.router.navigate([nextRoute], {queryParams: {offset: this.currentIndex - 1}});
|
||||
}
|
||||
|
||||
protected showConfirmationModal(direction: PageSelection, nextRecordIndex: number): void {
|
||||
|
|
|
@ -23,8 +23,9 @@
|
|||
* feasible for technical reasons, the Appropriate Legal Notices must display
|
||||
* the words "Supercharged by SuiteCRM".
|
||||
*/
|
||||
import {ObjectMap} from "../../../../common/types/object-map";
|
||||
import {Pagination} from "../../../../common/views/list/list-navigation.model";
|
||||
|
||||
import {Pagination, ObjectMap} from 'common';
|
||||
|
||||
export interface RecordPaginationModel {
|
||||
recordIds: ObjectMap[],
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
*/
|
||||
|
||||
import {Injectable} from "@angular/core";
|
||||
import {Pagination, PaginationType, Record, ObjectMap, emptyObject} from 'common';
|
||||
import {AppStateStore} from "../../../../store/app-state/app-state.store";
|
||||
import {UserPreferenceStore} from "../../../../store/user-preference/user-preference.store";
|
||||
import {LocalStorageService} from "../../../../services/local-storage/local-storage.service";
|
||||
|
@ -33,6 +32,10 @@ import {BehaviorSubject, Subscription} from "rxjs";
|
|||
import {ActivatedRoute} from "@angular/router";
|
||||
import {toNumber} from "lodash-es";
|
||||
import {RecordPaginationModel} from "./record-pagination.model";
|
||||
import {Pagination, PaginationType} from "../../../../common/views/list/list-navigation.model";
|
||||
import {ObjectMap} from "../../../../common/types/object-map";
|
||||
import {Record} from "../../../../common/record/record.model";
|
||||
import {emptyObject} from "../../../../common/utils/object-utils";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -50,7 +53,8 @@ export class RecordPaginationService {
|
|||
protected preferences: UserPreferenceStore,
|
||||
protected appStateStore: AppStateStore,
|
||||
protected route: ActivatedRoute,
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
public triggerNextRecord(value: boolean): void {
|
||||
this.nextRecordSubject.next(value);
|
||||
|
@ -81,7 +85,7 @@ export class RecordPaginationService {
|
|||
}
|
||||
|
||||
public mapRecordIds(records: Record[]): ObjectMap[] {
|
||||
return records.map(record => ({ id: record.id }));
|
||||
return records.map(record => ({id: record.id}));
|
||||
}
|
||||
|
||||
public getModule(): string {
|
||||
|
@ -112,7 +116,7 @@ export class RecordPaginationService {
|
|||
|
||||
let index = (offset - 1) % pageSize;
|
||||
if (this.paginationType === PaginationType.LOAD_MORE) {
|
||||
index = offset - 1;
|
||||
index = offset - 1;
|
||||
}
|
||||
if (index >= 0 && index < recordIds.length) {
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {deepClone, Pagination, ObjectMap, SortingSelection, SearchCriteria, emptyObject} from 'common';
|
||||
import {BehaviorSubject, Observable, of, Subscription} from "rxjs";
|
||||
import {distinctUntilChanged, map, shareReplay} from "rxjs/operators";
|
||||
import {isArray, union} from "lodash-es";
|
||||
|
@ -37,6 +36,10 @@ import {SavedFilterMap} from "../../../../store/saved-filters/saved-filter.model
|
|||
import {LocalStorageService} from "../../../../services/local-storage/local-storage.service";
|
||||
import {RecordPaginationService} from "./record-pagination.service";
|
||||
import {RecordPaginationModel} from "./record-pagination.model";
|
||||
import {ObjectMap} from "../../../../common/types/object-map";
|
||||
import {Pagination, SortingSelection} from "../../../../common/views/list/list-navigation.model";
|
||||
import {deepClone, emptyObject} from "../../../../common/utils/object-utils";
|
||||
import {SearchCriteria} from "../../../../common/views/list/search-criteria.model";
|
||||
|
||||
export interface RecordPaginationState {
|
||||
paginationEnabled?: boolean;
|
||||
|
@ -51,7 +54,7 @@ const initialState: RecordPaginationState = {
|
|||
};
|
||||
|
||||
@Injectable()
|
||||
export class RecordPaginationStore {
|
||||
export class RecordPaginationStore {
|
||||
|
||||
recordListStore: RecordListStore;
|
||||
|
||||
|
@ -196,7 +199,7 @@ export class RecordPaginationStore {
|
|||
this.updateSearchCriteria(filters, reload)
|
||||
}
|
||||
|
||||
protected updateSearchCriteria(filters:SavedFilterMap, reload = true): void {
|
||||
protected updateSearchCriteria(filters: SavedFilterMap, reload = true): void {
|
||||
let criteria = this.mergeCriteria(filters);
|
||||
this.recordListStore.updateSearchCriteria(criteria, reload);
|
||||
}
|
||||
|
|
|
@ -24,23 +24,21 @@
|
|||
* the words "Supercharged by SuiteCRM".
|
||||
*/
|
||||
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import { BehaviorSubject, combineLatest, combineLatestWith, Observable, of, Subscription } from 'rxjs';
|
||||
import { catchError, distinctUntilChanged, finalize, map, take, tap } from 'rxjs/operators';
|
||||
import {Injectable} from '@angular/core';
|
||||
import { Params } from '@angular/router';
|
||||
import {isEmpty} from 'lodash-es';
|
||||
import {BehaviorSubject, combineLatest, combineLatestWith, Observable, of, Subscription} from 'rxjs';
|
||||
import {catchError, distinctUntilChanged, finalize, map, take, tap} from 'rxjs/operators';
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {Params} from '@angular/router';
|
||||
import {isVoid} from '../../../../common/utils/value-utils';
|
||||
import {deepClone} from '../../../../common/utils/object-utils';
|
||||
import {BooleanMap} from '../../../../common/types/boolean-map';
|
||||
import {Field, FieldDefinitionMap, FieldMetadata} from '../../../../common/record/field.model';
|
||||
import {FieldDefinitionMap, FieldMetadata} from '../../../../common/record/field.model';
|
||||
import {FieldLogicMap} from '../../../../common/actions/field-logic-action.model';
|
||||
import {Record} from '../../../../common/record/record.model';
|
||||
import {Panel, PanelRow} from '../../../../common/metadata/metadata.model';
|
||||
import {Panel, PanelRow, ViewFieldDefinition, ViewFieldDefinitionMap} from '../../../../common/metadata/metadata.model';
|
||||
import {StatisticsMap, StatisticsQueryMap} from '../../../../common/statistics/statistics.model';
|
||||
import {SubPanelMeta} from '../../../../common/metadata/subpanel.metadata.model';
|
||||
import {ViewContext} from '../../../../common/views/view.model';
|
||||
import {ViewFieldDefinition, ViewFieldDefinitionMap} from '../../../../common/metadata/metadata.model';
|
||||
import {ViewMode} from '../../../../common/views/view.model';
|
||||
import {ViewContext, ViewMode} from '../../../../common/views/view.model';
|
||||
import {RecordViewData, RecordViewModel, RecordViewState} from './record-view.store.model';
|
||||
import {NavigationStore} from '../../../../store/navigation/navigation.store';
|
||||
import {StateStore} from '../../../../store/state';
|
||||
|
@ -69,6 +67,7 @@ import {PanelLogicManager} from '../../../../components/panel-logic/panel-logic.
|
|||
import {RecordConvertService} from "../../../../services/record/record-convert.service";
|
||||
import {FieldActionsAdapterFactory} from "../../../../components/field-layout/adapters/field.actions.adapter.factory";
|
||||
import {RecordValidationHandler} from "../../../../services/record/validation/record-validation.handler";
|
||||
import {ObjectMap} from "../../../../common/types/object-map";
|
||||
|
||||
const initialState: RecordViewState = {
|
||||
module: '',
|
||||
|
|
|
@ -7,12 +7,7 @@
|
|||
"jasmine"
|
||||
],
|
||||
"paths": {
|
||||
"common": [
|
||||
"dist/common/common",
|
||||
"dist/common"
|
||||
],
|
||||
"core": [
|
||||
"dist/core/core",
|
||||
"dist/core"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -26,7 +26,12 @@
|
|||
|
||||
import {APP_INITIALIZER, NgModule} from '@angular/core';
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi, withXsrfConfiguration } from '@angular/common/http';
|
||||
import {
|
||||
HTTP_INTERCEPTORS,
|
||||
provideHttpClient,
|
||||
withInterceptorsFromDi,
|
||||
withXsrfConfiguration
|
||||
} from '@angular/common/http';
|
||||
|
||||
import {Apollo, ApolloModule} from 'apollo-angular';
|
||||
import {HttpLink} from 'apollo-angular/http';
|
||||
|
@ -58,8 +63,8 @@ import {
|
|||
NavbarUiModule,
|
||||
RecordListModalModule,
|
||||
RecordModule,
|
||||
TableModule,
|
||||
SidebarComponent
|
||||
SidebarComponent,
|
||||
TableModule
|
||||
} from 'core';
|
||||
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
|
@ -68,16 +73,19 @@ import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
|
|||
import {environment} from '../environments/environment';
|
||||
import {RouteReuseStrategy} from '@angular/router';
|
||||
import {AppRouteReuseStrategy} from './app-router-reuse-strategy';
|
||||
import {AppInit} from '@app/app-initializer';
|
||||
import {AppInit} from './app-initializer';
|
||||
import {GraphQLError} from 'graphql';
|
||||
import {AngularSvgIconModule} from 'angular-svg-icon';
|
||||
import {APP_BASE_HREF} from "@angular/common";
|
||||
|
||||
export const initializeApp = (appInitService: AppInit) => (): Promise<any> => appInitService.init();
|
||||
|
||||
@NgModule({ declarations: [
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
],
|
||||
bootstrap: [AppComponent], imports: [BrowserModule,
|
||||
bootstrap: [AppComponent], imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
FooterUiModule,
|
||||
NavbarUiModule,
|
||||
|
@ -100,9 +108,11 @@ export const initializeApp = (appInitService: AppInit) => (): Promise<any> => ap
|
|||
MessageModalModule,
|
||||
RecordListModalModule,
|
||||
ApolloModule,
|
||||
SidebarComponent], providers: [
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
|
||||
{ provide: RouteReuseStrategy, useClass: AppRouteReuseStrategy },
|
||||
SidebarComponent
|
||||
],
|
||||
providers: [
|
||||
{provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true},
|
||||
{provide: RouteReuseStrategy, useClass: AppRouteReuseStrategy},
|
||||
AppInit,
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
|
@ -114,9 +124,10 @@ export const initializeApp = (appInitService: AppInit) => (): Promise<any> => ap
|
|||
withXsrfConfiguration({
|
||||
cookieName: 'XSRF-TOKEN',
|
||||
headerName: 'X-XSRF-TOKEN'
|
||||
})
|
||||
})
|
||||
)
|
||||
] })
|
||||
],
|
||||
})
|
||||
export class AppModule {
|
||||
constructor(apollo: Apollo, httpLink: HttpLink, protected auth: AuthService, protected appStore: AppStateStore, protected baseRoute: BaseRouteService) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue