@sarafapp/iron_core 1.0.64 → 1.0.66
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/package.json +2 -2
- package/dist/core/src/BaseModel.d.ts +0 -45
- package/dist/core/src/Utils.d.ts +0 -4
- package/dist/core/src/accessHandling/AccessControl.d.ts +0 -10
- package/dist/core/src/accessHandling/AccessLevel.d.ts +0 -13
- package/dist/core/src/accessHandling/Accessible.d.ts +0 -3
- package/dist/core/src/accessHandling/EveryDirectiveAccess.d.ts +0 -4
- package/dist/core/src/accessHandling/SSO/AuthorizationDirective.d.ts +0 -17
- package/dist/core/src/accessHandling/SSO/AuthorizationService.d.ts +0 -17
- package/dist/core/src/accessHandling/SSO/EveryLevelAuthorizationDirective.d.ts +0 -4
- package/dist/core/src/accessHandling/SSO/SomeLevelsAuthorizationDirective.d.ts +0 -4
- package/dist/core/src/accessHandling/SomeDirectiveAccess.d.ts +0 -4
- package/dist/core/src/accessHandling/index.d.ts +0 -9
- package/dist/core/src/baseDirective/BeforeMountDirective.d.ts +0 -3
- package/dist/core/src/baseDirective/BeforeUnMountDirective.d.ts +0 -3
- package/dist/core/src/baseDirective/BeforeUpdateDirective.d.ts +0 -3
- package/dist/core/src/baseDirective/CreatedDirective.d.ts +0 -3
- package/dist/core/src/baseDirective/MountedDirective.d.ts +0 -3
- package/dist/core/src/baseDirective/UnMountedDirective.d.ts +0 -3
- package/dist/core/src/baseDirective/UpdateDirective.d.ts +0 -3
- package/dist/core/src/baseDirective/index.d.ts +0 -7
- package/dist/core/src/baseForm/BaseRequestBodyFilter.d.ts +0 -4
- package/dist/core/src/baseForm/FormManager.d.ts +0 -18
- package/dist/core/src/baseForm/InputControl.d.ts +0 -40
- package/dist/core/src/baseForm/InputControlBuilder.d.ts +0 -16
- package/dist/core/src/baseForm/InputControlData.d.ts +0 -15
- package/dist/core/src/baseForm/RequestBodyFilter.d.ts +0 -3
- package/dist/core/src/baseForm/TouchSensitiveForm.d.ts +0 -9
- package/dist/core/src/baseForm/UseForm.d.ts +0 -18
- package/dist/core/src/baseForm/index.d.ts +0 -8
- package/dist/core/src/baseSchedule/Schedule.d.ts +0 -3
- package/dist/core/src/baseSchedule/Scheduler.d.ts +0 -8
- package/dist/core/src/baseSchedule/index.d.ts +0 -2
- package/dist/core/src/baseTable/BaseTable.d.ts +0 -47
- package/dist/core/src/baseTable/Constants.d.ts +0 -13
- package/dist/core/src/baseTable/OnDestory.d.ts +0 -3
- package/dist/core/src/baseTable/RowActionSource.d.ts +0 -4
- package/dist/core/src/baseTable/RowClick.d.ts +0 -3
- package/dist/core/src/baseTable/RowDoubleClick.d.ts +0 -3
- package/dist/core/src/baseTable/RowMetaClick.d.ts +0 -3
- package/dist/core/src/baseTable/SelectableTable.d.ts +0 -19
- package/dist/core/src/baseTable/TableAction.d.ts +0 -8
- package/dist/core/src/baseTable/TableHeaderSchema.d.ts +0 -27
- package/dist/core/src/baseTable/TableLoader.d.ts +0 -3
- package/dist/core/src/baseTable/TablePaginate.d.ts +0 -3
- package/dist/core/src/baseTable/TableService.d.ts +0 -9
- package/dist/core/src/baseTable/TableSort.d.ts +0 -4
- package/dist/core/src/baseTable/TableSummarySchema.d.ts +0 -9
- package/dist/core/src/baseTable/generator/SelectableTableGenerator.d.ts +0 -14
- package/dist/core/src/baseTable/generator/TableCellComponentRegistry.d.ts +0 -7
- package/dist/core/src/baseTable/generator/TableConfig.d.ts +0 -7
- package/dist/core/src/baseTable/generator/TableGenerator.d.ts +0 -37
- package/dist/core/src/baseTable/generator/TableSource.d.ts +0 -24
- package/dist/core/src/baseTable/index.d.ts +0 -23
- package/dist/core/src/baseTable/moduleConnection/Action.d.ts +0 -3
- package/dist/core/src/baseTable/moduleConnection/Column.d.ts +0 -3
- package/dist/core/src/baseTable/moduleConnection/Table.d.ts +0 -4
- package/dist/core/src/baseTable/moduleConnection/TableDestroy.d.ts +0 -2
- package/dist/core/src/baseTable/moduleConnection/TableRowClick.d.ts +0 -2
- package/dist/core/src/baseTable/moduleConnection/generator/GColumn.d.ts +0 -2
- package/dist/core/src/baseTable/moduleConnection/generator/GTable.d.ts +0 -2
- package/dist/core/src/composables/UseCrud.d.ts +0 -10
- package/dist/core/src/composables/UseData.d.ts +0 -15
- package/dist/core/src/composables/UseLoadingStatus.d.ts +0 -15
- package/dist/core/src/composables/UseParams.d.ts +0 -17
- package/dist/core/src/composables/UseRepository.d.ts +0 -67
- package/dist/core/src/composables/UseState.d.ts +0 -2
- package/dist/core/src/composables/UseStaticTableService.d.ts +0 -5
- package/dist/core/src/composables/index.d.ts +0 -7
- package/dist/core/src/constants/Constants.d.ts +0 -108
- package/dist/core/src/constants/index.d.ts +0 -1
- package/dist/core/src/crudService/CrudService.d.ts +0 -22
- package/dist/core/src/crudService/index.d.ts +0 -1
- package/dist/core/src/dateHandling/Constants.d.ts +0 -5
- package/dist/core/src/dateHandling/Converter.d.ts +0 -5
- package/dist/core/src/dateHandling/JalaliDateSetup.d.ts +0 -1
- package/dist/core/src/dateHandling/Model.d.ts +0 -12
- package/dist/core/src/dateHandling/Utils.d.ts +0 -8
- package/dist/core/src/dateHandling/index.d.ts +0 -5
- package/dist/core/src/debounce/DebounceAction.d.ts +0 -4
- package/dist/core/src/debounce/DebounceService.d.ts +0 -9
- package/dist/core/src/debounce/index.d.ts +0 -2
- package/dist/core/src/deviceManagement/Constants.d.ts +0 -4
- package/dist/core/src/deviceManagement/Visibility.d.ts +0 -4
- package/dist/core/src/deviceManagement/VisibilityManager.d.ts +0 -6
- package/dist/core/src/deviceManagement/index.d.ts +0 -3
- package/dist/core/src/errorHandling/ErrorHandler.d.ts +0 -3
- package/dist/core/src/errorHandling/HandleError.d.ts +0 -2
- package/dist/core/src/errorHandling/index.d.ts +0 -2
- package/dist/core/src/eventSystem/CustomEventDispatcher.d.ts +0 -5
- package/dist/core/src/eventSystem/Model.d.ts +0 -8
- package/dist/core/src/eventSystem/OnEvent.d.ts +0 -1
- package/dist/core/src/eventSystem/index.d.ts +0 -3
- package/dist/core/src/feedbackHandling/FailureFeedback.d.ts +0 -3
- package/dist/core/src/feedbackHandling/Feedback.d.ts +0 -11
- package/dist/core/src/feedbackHandling/HandleFeedback.d.ts +0 -2
- package/dist/core/src/feedbackHandling/InfoFeedback.d.ts +0 -3
- package/dist/core/src/feedbackHandling/SuccessFeedback.d.ts +0 -3
- package/dist/core/src/feedbackHandling/WarningFeedback.d.ts +0 -3
- package/dist/core/src/feedbackHandling/index.d.ts +0 -6
- package/dist/core/src/httpClient/ApiBuilder.d.ts +0 -14
- package/dist/core/src/httpClient/ErrorHandlerRegistry.d.ts +0 -10
- package/dist/core/src/httpClient/HttpClient.d.ts +0 -14
- package/dist/core/src/httpClient/Interceptor.d.ts +0 -4
- package/dist/core/src/httpClient/index.d.ts +0 -4
- package/dist/core/src/initializer/ApplicationInitializer.d.ts +0 -6
- package/dist/core/src/initializer/Initializer.d.ts +0 -3
- package/dist/core/src/initializer/index.d.ts +0 -2
- package/dist/core/src/json/JsonMapper.d.ts +0 -18
- package/dist/core/src/json/index.d.ts +0 -1
- package/dist/core/src/layout/Constants.d.ts +0 -10
- package/dist/core/src/layout/DialogService.d.ts +0 -406
- package/dist/core/src/layout/DrawerService.d.ts +0 -14
- package/dist/core/src/layout/Toast.d.ts +0 -8
- package/dist/core/src/layout/index.d.ts +0 -4
- package/dist/core/src/lib/Constants.d.ts +0 -20
- package/dist/core/src/lib/Formatter.d.ts +0 -10
- package/dist/core/src/lib/Util.d.ts +0 -12
- package/dist/core/src/lib/index.d.ts +0 -3
- package/dist/core/src/observables/AbstractSubject.d.ts +0 -7
- package/dist/core/src/observables/BehaviorSubject.d.ts +0 -16
- package/dist/core/src/observables/Observer.d.ts +0 -3
- package/dist/core/src/observables/Subject.d.ts +0 -6
- package/dist/core/src/observables/index.d.ts +0 -4
- package/dist/core/src/process/Proccess.d.ts +0 -9
- package/dist/core/src/process/ProcessManager.d.ts +0 -10
- package/dist/core/src/process/index.d.ts +0 -2
- package/dist/core/src/repository/Params.d.ts +0 -11
- package/dist/core/src/repository/Repository.d.ts +0 -38
- package/dist/core/src/repository/SyncDetail.d.ts +0 -5
- package/dist/core/src/repository/index.d.ts +0 -4
- package/dist/core/src/repository/model.d.ts +0 -5
- package/dist/core/src/routeGuard/RouteGuard.d.ts +0 -7
- package/dist/core/src/routeGuard/index.d.ts +0 -1
- package/dist/core/src/search/client/ClientArraySearch.d.ts +0 -4
- package/dist/core/src/search/client/ClientSearch.d.ts +0 -3
- package/dist/core/src/search/index.d.ts +0 -2
- package/dist/core/src/sort/SortDetail.d.ts +0 -6
- package/dist/core/src/sort/client/Sorter.d.ts +0 -6
- package/dist/core/src/sort/index.d.ts +0 -4
- package/dist/core/src/sort/strategies/SimpleSort.d.ts +0 -5
- package/dist/core/src/sort/strategies/SortStrategy.d.ts +0 -4
- package/dist/core/src/types/Global.d.ts +0 -1
- package/dist/core/src/types/index.d.ts +0 -1
- package/dist/core/src/validators/Validator.d.ts +0 -4
- package/dist/core/src/validators/index.d.ts +0 -1
- package/dist/core/src/webSocket/Constants.d.ts +0 -6
- package/dist/core/src/webSocket/Model.d.ts +0 -6
- package/dist/core/src/webSocket/WebSocketService.d.ts +0 -30
- package/dist/core/src/webSocket/index.d.ts +0 -3
- package/dist/example-vue/src/AntTableConfig.d.ts +0 -6
- package/dist/example-vue/src/TableService.d.ts +0 -12
- package/dist/example-vue/src/TextCell.vue.d.ts +0 -5
- package/dist/example-vue/src/app/App.vue.d.ts +0 -2
- package/dist/example-vue/src/app/router/index.d.ts +0 -1
- package/dist/example-vue/src/app/screens/Index.vue.d.ts +0 -2
- package/dist/example-vue/src/main.d.ts +0 -0
- package/src/BaseModel.ts +0 -127
- package/src/Utils.ts +0 -16
- package/src/accessHandling/AccessControl.ts +0 -33
- package/src/accessHandling/AccessLevel.ts +0 -52
- package/src/accessHandling/Accessible.ts +0 -3
- package/src/accessHandling/EveryDirectiveAccess.ts +0 -7
- package/src/accessHandling/SSO/AuthorizationDirective.ts +0 -65
- package/src/accessHandling/SSO/AuthorizationService.ts +0 -74
- package/src/accessHandling/SSO/EveryLevelAuthorizationDirective.ts +0 -7
- package/src/accessHandling/SSO/SomeLevelsAuthorizationDirective.ts +0 -7
- package/src/accessHandling/SomeDirectiveAccess.ts +0 -7
- package/src/accessHandling/index.ts +0 -9
- package/src/baseDirective/BeforeMountDirective.ts +0 -3
- package/src/baseDirective/BeforeUnMountDirective.ts +0 -3
- package/src/baseDirective/BeforeUpdateDirective.ts +0 -3
- package/src/baseDirective/CreatedDirective.ts +0 -3
- package/src/baseDirective/MountedDirective.ts +0 -3
- package/src/baseDirective/UnMountedDirective.ts +0 -3
- package/src/baseDirective/UpdateDirective.ts +0 -3
- package/src/baseDirective/index.ts +0 -7
- package/src/baseForm/BaseRequestBodyFilter.ts +0 -7
- package/src/baseForm/FormManager.ts +0 -95
- package/src/baseForm/InputControl.ts +0 -182
- package/src/baseForm/InputControlBuilder.ts +0 -59
- package/src/baseForm/InputControlData.ts +0 -16
- package/src/baseForm/RequestBodyFilter.ts +0 -3
- package/src/baseForm/TouchSensitiveForm.ts +0 -47
- package/src/baseForm/UseForm.ts +0 -32
- package/src/baseForm/index.ts +0 -8
- package/src/baseSchedule/Schedule.ts +0 -3
- package/src/baseSchedule/Scheduler.ts +0 -29
- package/src/baseSchedule/index.ts +0 -2
- package/src/baseTable/BaseTable.ts +0 -162
- package/src/baseTable/Constants.ts +0 -26
- package/src/baseTable/OnDestory.ts +0 -3
- package/src/baseTable/RowActionSource.ts +0 -5
- package/src/baseTable/RowClick.ts +0 -3
- package/src/baseTable/RowDoubleClick.ts +0 -3
- package/src/baseTable/RowMetaClick.ts +0 -3
- package/src/baseTable/SelectableTable.ts +0 -86
- package/src/baseTable/TableAction.ts +0 -10
- package/src/baseTable/TableHeaderSchema.ts +0 -44
- package/src/baseTable/TableLoader.ts +0 -3
- package/src/baseTable/TablePaginate.ts +0 -3
- package/src/baseTable/TableService.ts +0 -10
- package/src/baseTable/TableSort.ts +0 -5
- package/src/baseTable/TableSummarySchema.ts +0 -11
- package/src/baseTable/generator/SelectableTableGenerator.ts +0 -65
- package/src/baseTable/generator/TableCellComponentRegistry.ts +0 -15
- package/src/baseTable/generator/TableConfig.ts +0 -18
- package/src/baseTable/generator/TableGenerator.ts +0 -147
- package/src/baseTable/generator/TableSource.ts +0 -34
- package/src/baseTable/index.ts +0 -43
- package/src/baseTable/moduleConnection/Action.ts +0 -12
- package/src/baseTable/moduleConnection/Column.ts +0 -11
- package/src/baseTable/moduleConnection/Table.ts +0 -49
- package/src/baseTable/moduleConnection/TableDestroy.ts +0 -7
- package/src/baseTable/moduleConnection/TableRowClick.ts +0 -7
- package/src/baseTable/moduleConnection/generator/GColumn.ts +0 -10
- package/src/baseTable/moduleConnection/generator/GTable.ts +0 -11
- package/src/composables/UseCrud.ts +0 -53
- package/src/composables/UseData.ts +0 -70
- package/src/composables/UseLoadingStatus.ts +0 -65
- package/src/composables/UseParams.ts +0 -93
- package/src/composables/UseRepository.ts +0 -207
- package/src/composables/UseState.ts +0 -30
- package/src/composables/UseStaticTableService.ts +0 -45
- package/src/composables/index.ts +0 -7
- package/src/constants/Constants.ts +0 -126
- package/src/constants/index.ts +0 -19
- package/src/crudService/CrudService.ts +0 -121
- package/src/crudService/index.ts +0 -1
- package/src/dateHandling/Constants.ts +0 -5
- package/src/dateHandling/Converter.ts +0 -15
- package/src/dateHandling/JalaliDateSetup.ts +0 -42
- package/src/dateHandling/Model.ts +0 -27
- package/src/dateHandling/Utils.ts +0 -49
- package/src/dateHandling/index.ts +0 -5
- package/src/debounce/DebounceAction.ts +0 -4
- package/src/debounce/DebounceService.ts +0 -27
- package/src/debounce/index.ts +0 -2
- package/src/deviceManagement/Constants.ts +0 -4
- package/src/deviceManagement/Visibility.ts +0 -4
- package/src/deviceManagement/VisibilityManager.ts +0 -18
- package/src/deviceManagement/index.ts +0 -3
- package/src/errorHandling/ErrorHandler.ts +0 -3
- package/src/errorHandling/HandleError.ts +0 -20
- package/src/errorHandling/index.ts +0 -2
- package/src/eventSystem/CustomEventDispatcher.ts +0 -13
- package/src/eventSystem/Model.ts +0 -29
- package/src/eventSystem/OnEvent.ts +0 -25
- package/src/eventSystem/index.ts +0 -3
- package/src/feedbackHandling/FailureFeedback.ts +0 -3
- package/src/feedbackHandling/Feedback.ts +0 -34
- package/src/feedbackHandling/HandleFeedback.ts +0 -28
- package/src/feedbackHandling/InfoFeedback.ts +0 -3
- package/src/feedbackHandling/SuccessFeedback.ts +0 -3
- package/src/feedbackHandling/WarningFeedback.ts +0 -3
- package/src/feedbackHandling/index.ts +0 -6
- package/src/httpClient/ApiBuilder.ts +0 -57
- package/src/httpClient/ErrorHandlerRegistry.ts +0 -29
- package/src/httpClient/HttpClient.ts +0 -77
- package/src/httpClient/Interceptor.ts +0 -5
- package/src/httpClient/index.ts +0 -4
- package/src/initializer/ApplicationInitializer.ts +0 -15
- package/src/initializer/Initializer.ts +0 -3
- package/src/initializer/index.ts +0 -2
- package/src/json/JsonMapper.ts +0 -48
- package/src/json/index.ts +0 -1
- package/src/layout/Constants.ts +0 -11
- package/src/layout/DialogService.ts +0 -75
- package/src/layout/DrawerService.ts +0 -25
- package/src/layout/Toast.ts +0 -14
- package/src/layout/index.ts +0 -4
- package/src/lib/Constants.ts +0 -433
- package/src/lib/Formatter.ts +0 -68
- package/src/lib/Util.ts +0 -113
- package/src/lib/index.ts +0 -3
- package/src/observables/AbstractSubject.ts +0 -21
- package/src/observables/BehaviorSubject.ts +0 -58
- package/src/observables/Observer.ts +0 -3
- package/src/observables/Subject.ts +0 -9
- package/src/observables/index.ts +0 -4
- package/src/process/Proccess.ts +0 -21
- package/src/process/ProcessManager.ts +0 -31
- package/src/process/index.ts +0 -2
- package/src/repository/Params.ts +0 -10
- package/src/repository/Repository.ts +0 -44
- package/src/repository/SyncDetail.ts +0 -8
- package/src/repository/index.ts +0 -4
- package/src/repository/model.ts +0 -9
- package/src/routeGuard/RouteGuard.ts +0 -38
- package/src/routeGuard/index.ts +0 -1
- package/src/search/client/ClientArraySearch.ts +0 -25
- package/src/search/client/ClientSearch.ts +0 -3
- package/src/search/index.ts +0 -2
- package/src/sort/SortDetail.ts +0 -11
- package/src/sort/client/Sorter.ts +0 -28
- package/src/sort/index.ts +0 -4
- package/src/sort/strategies/SimpleSort.ts +0 -35
- package/src/sort/strategies/SortStrategy.ts +0 -4
- package/src/types/Global.ts +0 -1
- package/src/types/index.ts +0 -1
- package/src/validators/Validator.ts +0 -5
- package/src/validators/index.ts +0 -1
- package/src/webSocket/Constants.ts +0 -6
- package/src/webSocket/Model.ts +0 -16
- package/src/webSocket/WebSocketService.ts +0 -153
- package/src/webSocket/index.ts +0 -3
- package/vite.config.ts +0 -55
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { TableHeaderSchema } from "./TableHeaderSchema";
|
|
2
|
-
import { BaseModel } from "../BaseModel";
|
|
3
|
-
import { CellType, HeaderType, TableHeaderAlign } from "../constants";
|
|
4
|
-
|
|
5
|
-
export const TABLE_COLUMN_DEFAULT_WIDTH = "150px";
|
|
6
|
-
export const TABLE_COLUMN_DEFAULT_COLSPAN = 2;
|
|
7
|
-
|
|
8
|
-
export const TABLE_ACTION_COLUMN: TableHeaderSchema<BaseModel> = {
|
|
9
|
-
path: "id",
|
|
10
|
-
key: "id",
|
|
11
|
-
title: "عملیات",
|
|
12
|
-
colspan: TABLE_COLUMN_DEFAULT_COLSPAN,
|
|
13
|
-
width: TABLE_COLUMN_DEFAULT_WIDTH,
|
|
14
|
-
cellType: CellType.ACTION,
|
|
15
|
-
align: TableHeaderAlign.Center,
|
|
16
|
-
headerType: HeaderType.Text,
|
|
17
|
-
accessLevel: null,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const TABLE_COLUMN_DEFAULT_VALUES = {
|
|
21
|
-
width: TABLE_COLUMN_DEFAULT_WIDTH,
|
|
22
|
-
align: TableHeaderAlign.Center,
|
|
23
|
-
headerType: HeaderType.Text,
|
|
24
|
-
cellType: CellType.Text,
|
|
25
|
-
colspan: TABLE_COLUMN_DEFAULT_COLSPAN,
|
|
26
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { BaseTable } from './BaseTable'
|
|
2
|
-
import { BehaviorSubject } from '../observables/BehaviorSubject'
|
|
3
|
-
import { type SortDetail } from '../sort'
|
|
4
|
-
import type { BaseModel } from '../BaseModel'
|
|
5
|
-
import type { TableService } from './TableService'
|
|
6
|
-
|
|
7
|
-
export abstract class SelectableTable<
|
|
8
|
-
Model extends BaseModel,
|
|
9
|
-
> extends BaseTable<Model> {
|
|
10
|
-
public selectedRows: BehaviorSubject<Map<number, Model>> =
|
|
11
|
-
new BehaviorSubject(new Map<number, Model>());
|
|
12
|
-
|
|
13
|
-
constructor(service: TableService<Model>) {
|
|
14
|
-
super(service);
|
|
15
|
-
this.rowSelect = this.rowSelect.bind(this);
|
|
16
|
-
this.selectAll = this.selectAll.bind(this);
|
|
17
|
-
this.isEveryRowSelected = this.isEveryRowSelected.bind(this);
|
|
18
|
-
this.handlePagination = this.handlePagination.bind(this);
|
|
19
|
-
this.clearAllSelectedItems = this.clearAllSelectedItems.bind(this);
|
|
20
|
-
this.getSelectedRows = this.getSelectedRows.bind(this);
|
|
21
|
-
this.getSelectedRowsAsArray = this.getSelectedRowsAsArray.bind(this);
|
|
22
|
-
this.getSelectedRowIds = this.getSelectedRowIds.bind(this);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public rowSelect(row: Model) {
|
|
26
|
-
if (this.getSelectedRowsValue().has(row.id)) {
|
|
27
|
-
this.getSelectedRowsValue().delete(row.id);
|
|
28
|
-
this.selectedRows.next(this.selectedRows.getValue());
|
|
29
|
-
} else {
|
|
30
|
-
this.selectedRows.getValue().set(row.id, row);
|
|
31
|
-
this.selectedRows.next(this.selectedRows.getValue());
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public selectAll() {
|
|
36
|
-
if (this.isEveryRowSelected()) {
|
|
37
|
-
this.clearAllSelectedItems();
|
|
38
|
-
} else {
|
|
39
|
-
for (const row of this.loadedRows) {
|
|
40
|
-
this.selectedRows.getValue().set(row.id, row);
|
|
41
|
-
this.selectedRows.next(this.selectedRows.getValue());
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
private isEveryRowSelected() {
|
|
47
|
-
return (
|
|
48
|
-
this.getSelectedRowsValue().size === this.currentPageSize ||
|
|
49
|
-
this.loadedRows.length === this.getSelectedRowsValue().size
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
protected override async handlePagination(
|
|
54
|
-
nextPage: number,
|
|
55
|
-
pageSize: number,
|
|
56
|
-
) {
|
|
57
|
-
this.clearAllSelectedItems();
|
|
58
|
-
return await super.handlePagination(nextPage, pageSize);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
protected override async handleSort(sortDetail: SortDetail<Model>) {
|
|
62
|
-
this.clearAllSelectedItems();
|
|
63
|
-
return await super.handleSort(sortDetail);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public clearAllSelectedItems() {
|
|
67
|
-
this.selectedRows.getValue().clear();
|
|
68
|
-
this.selectedRows.next(this.selectedRows.getValue());
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public getSelectedRows() {
|
|
72
|
-
return this.selectedRows;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public getSelectedRowsAsArray() {
|
|
76
|
-
return Array.from(this.selectedRows.getValue().values());
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public getSelectedRowIds() {
|
|
80
|
-
return Array.from(this.selectedRows.getValue().keys());
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public getSelectedRowsValue() {
|
|
84
|
-
return this.selectedRows.getValue();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Accessible } from "../accessHandling";
|
|
2
|
-
|
|
3
|
-
export interface TableAction<Model> extends Accessible {
|
|
4
|
-
readonly actionName: string;
|
|
5
|
-
handler(row: Model): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface ActionDecorator<Model> extends TableAction<Model> {
|
|
9
|
-
isAvailable(model: Model): boolean
|
|
10
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CellType,
|
|
3
|
-
HeaderType,
|
|
4
|
-
LoadingStatus,
|
|
5
|
-
SortOrder,
|
|
6
|
-
TableHeaderAlign,
|
|
7
|
-
} from "../constants";
|
|
8
|
-
import { TABLE_COLUMN_DEFAULT_VALUES } from "./Constants";
|
|
9
|
-
import type { Accessible } from "../accessHandling";
|
|
10
|
-
|
|
11
|
-
export interface TableHeaderSchema<Model> extends Accessible {
|
|
12
|
-
path?: keyof Model;
|
|
13
|
-
title: string;
|
|
14
|
-
getProps?: (row: Model) => Record<string, unknown>;
|
|
15
|
-
key: keyof Model;
|
|
16
|
-
cellType?: CellType | string;
|
|
17
|
-
align?: TableHeaderAlign;
|
|
18
|
-
headerType?: HeaderType;
|
|
19
|
-
colspan?: number;
|
|
20
|
-
width?: string | number;
|
|
21
|
-
ellipsis?: boolean;
|
|
22
|
-
maxWidth?: number;
|
|
23
|
-
minWidth?: number;
|
|
24
|
-
resizable?: boolean;
|
|
25
|
-
sortOrder?: SortOrder;
|
|
26
|
-
sorter?: boolean;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface TableRenderingData<Model> {
|
|
30
|
-
totalItems: number;
|
|
31
|
-
currentPage: number;
|
|
32
|
-
rows: Model[];
|
|
33
|
-
loadingStatus: Set<LoadingStatus>;
|
|
34
|
-
currentPageItems: Model[];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function generateHeader<Model>(
|
|
38
|
-
header: TableHeaderSchema<Model>,
|
|
39
|
-
): TableHeaderSchema<Model> {
|
|
40
|
-
return {
|
|
41
|
-
...TABLE_COLUMN_DEFAULT_VALUES,
|
|
42
|
-
...header,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SortDetail } from "../sort";
|
|
2
|
-
import { FetchListResponse } from '../repository/model'
|
|
3
|
-
import type { TableRenderingData } from "./TableHeaderSchema";
|
|
4
|
-
|
|
5
|
-
export interface TableService<Model> {
|
|
6
|
-
fetchRows(): Promise<FetchListResponse<Model>>;
|
|
7
|
-
paginate(nextPage: number, pageSize: number): Promise<FetchListResponse<Model>>;
|
|
8
|
-
sort(sortDetail: SortDetail<Model>): Promise<FetchListResponse<Model>>;
|
|
9
|
-
getData(): TableRenderingData<Model>;
|
|
10
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { TableGenerator } from "./TableGenerator";
|
|
2
|
-
import { type TableSource } from "./TableSource";
|
|
3
|
-
import { BehaviorSubject } from "../../observables";
|
|
4
|
-
|
|
5
|
-
export class SelectableTableGenerator<T> extends TableGenerator<T> {
|
|
6
|
-
public selectedRows: BehaviorSubject<Map<number, T>> = new BehaviorSubject(
|
|
7
|
-
new Map(),
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
constructor(tableSource: TableSource<T>) {
|
|
11
|
-
super(tableSource);
|
|
12
|
-
this.selectRow = this.selectRow.bind(this);
|
|
13
|
-
this.selectAll = this.selectAll.bind(this);
|
|
14
|
-
this.isEveryRowSelected = this.isEveryRowSelected.bind(this);
|
|
15
|
-
this.clearAllSelectedItems = this.clearAllSelectedItems.bind(this);
|
|
16
|
-
this.getSelectedRowsAsArray = this.getSelectedRowsAsArray.bind(this);
|
|
17
|
-
this.getSelectedRowIds = this.getSelectedRowIds.bind(this);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public selectRow(row: T) {
|
|
21
|
-
const selectedRows = this.getSelectedRows();
|
|
22
|
-
if (selectedRows.has(row["id"])) {
|
|
23
|
-
selectedRows.delete(row["id"]);
|
|
24
|
-
this.selectedRows.next(this.selectedRows.getValue());
|
|
25
|
-
} else {
|
|
26
|
-
selectedRows.set(row["id"], row);
|
|
27
|
-
this.selectedRows.next(this.selectedRows.getValue());
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public selectAll() {
|
|
32
|
-
if (this.isEveryRowSelected()) {
|
|
33
|
-
this.clearAllSelectedItems();
|
|
34
|
-
} else {
|
|
35
|
-
for (const row of this.rows.getValue()) {
|
|
36
|
-
this.selectedRows.getValue().set(row["id"], row);
|
|
37
|
-
this.selectedRows.next(this.selectedRows.getValue());
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private isEveryRowSelected() {
|
|
43
|
-
return (
|
|
44
|
-
this.getSelectedRows().size === this.currentPageSize.getValue() ||
|
|
45
|
-
this.rows.getValue().length === this.getSelectedRows().size
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public clearAllSelectedItems() {
|
|
50
|
-
this.getSelectedRows().clear();
|
|
51
|
-
this.selectedRows.next(this.selectedRows.getValue);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public getSelectedRows() {
|
|
55
|
-
return this.selectedRows.getValue();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public getSelectedRowsAsArray() {
|
|
59
|
-
return Array.from(this.selectedRows.getValue().values());
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public getSelectedRowIds() {
|
|
63
|
-
return Array.from(this.selectedRows.getValue().keys());
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type Initializer } from "../../initializer";
|
|
2
|
-
|
|
3
|
-
export abstract class TableCellComponentRegistry implements Initializer {
|
|
4
|
-
private registeredComponents: Map<string, unknown> = new Map();
|
|
5
|
-
|
|
6
|
-
public initialize(): void {
|
|
7
|
-
this.registerComponents();
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
protected abstract registerComponents(): void;
|
|
11
|
-
|
|
12
|
-
public getRegisteredComponents() {
|
|
13
|
-
return this.registeredComponents;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { TableCellComponentRegistry } from "./TableCellComponentRegistry";
|
|
2
|
-
|
|
3
|
-
export class TableConfig {
|
|
4
|
-
private cellComponentRegistry: TableCellComponentRegistry;
|
|
5
|
-
|
|
6
|
-
constructor() {
|
|
7
|
-
this.setCellComponentRegistry = this.setCellComponentRegistry.bind(this);
|
|
8
|
-
this.getCellComponentRegistry = this.getCellComponentRegistry.bind(this);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public setCellComponentRegistry(registry: TableCellComponentRegistry) {
|
|
12
|
-
this.cellComponentRegistry = registry;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public getCellComponentRegistry() {
|
|
16
|
-
return this.cellComponentRegistry;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { BehaviorSubject } from "../../observables";
|
|
2
|
-
import { SortDetail } from "../../sort";
|
|
3
|
-
import { SortOrder } from "../../constants";
|
|
4
|
-
import { type TableHeaderSchema } from "../TableHeaderSchema";
|
|
5
|
-
import { type Nullable } from "../../types";
|
|
6
|
-
import { type TableSummarySchema } from "../TableSummarySchema";
|
|
7
|
-
import { type TableSource } from "./TableSource";
|
|
8
|
-
import { type Accessible, AccessLevel } from "../../accessHandling";
|
|
9
|
-
import { type TableAction } from "../TableAction";
|
|
10
|
-
|
|
11
|
-
export class TableGenerator<T> {
|
|
12
|
-
public rows: BehaviorSubject<T[]> = new BehaviorSubject<T[]>([]);
|
|
13
|
-
public headerSchema: BehaviorSubject<TableHeaderSchema<T>[]> =
|
|
14
|
-
new BehaviorSubject([]);
|
|
15
|
-
|
|
16
|
-
public currentPage: BehaviorSubject<number> = new BehaviorSubject<number>(1);
|
|
17
|
-
public currentPageSize: BehaviorSubject<number> = new BehaviorSubject(20);
|
|
18
|
-
public totalItems: BehaviorSubject<number> = new BehaviorSubject<number>(0);
|
|
19
|
-
protected currentSortDetail: BehaviorSubject<SortDetail<T>> =
|
|
20
|
-
new BehaviorSubject<SortDetail<T>>(new SortDetail("id", SortOrder.DESC));
|
|
21
|
-
|
|
22
|
-
public scrollDetail: BehaviorSubject<
|
|
23
|
-
Nullable<boolean | { x?: number; y?: number }>
|
|
24
|
-
> = new BehaviorSubject(null);
|
|
25
|
-
|
|
26
|
-
public isExpandable: BehaviorSubject<boolean> = new BehaviorSubject(false);
|
|
27
|
-
|
|
28
|
-
protected tableSource: TableSource<T>;
|
|
29
|
-
protected accessService: AccessLevel;
|
|
30
|
-
|
|
31
|
-
constructor(tableSource: TableSource<T>) {
|
|
32
|
-
this.tableSource = tableSource;
|
|
33
|
-
this.accessService = AccessLevel.GetInstance();
|
|
34
|
-
this.load = this.load.bind(this);
|
|
35
|
-
this.paginate = this.paginate.bind(this);
|
|
36
|
-
this.shouldSendSortRequest = this.shouldSendSortRequest.bind(this);
|
|
37
|
-
this.sort = this.sort.bind(this);
|
|
38
|
-
this.handleClick = this.handleClick.bind(this);
|
|
39
|
-
this.handleMetaClick = this.handleMetaClick.bind(this);
|
|
40
|
-
this.handleDoubleClick = this.handleDoubleClick.bind(this);
|
|
41
|
-
this.hasAnyAction = this.hasAnyAction.bind(this);
|
|
42
|
-
this.loadSummarySchema = this.loadSummarySchema.bind(this);
|
|
43
|
-
this.filterItemsBaseOnAccessLevel =
|
|
44
|
-
this.filterItemsBaseOnAccessLevel.bind(this);
|
|
45
|
-
this.paginate = this.paginate.bind(this);
|
|
46
|
-
this.shouldSendPaginationRequest =
|
|
47
|
-
this.shouldSendPaginationRequest.bind(this);
|
|
48
|
-
this.getRowActions = this.getRowActions.bind(this);
|
|
49
|
-
this.onDestroy = this.onDestroy.bind(this);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
public async load(): Promise<void> {
|
|
53
|
-
this.rows.next(await this.tableSource.loadRows());
|
|
54
|
-
|
|
55
|
-
this.headerSchema.next(
|
|
56
|
-
this.filterItemsBaseOnAccessLevel(
|
|
57
|
-
await this.tableSource.loadHeaderSchema(),
|
|
58
|
-
),
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public async paginate(nextPage: number, pageSize: number): Promise<void> {
|
|
63
|
-
if (!this.shouldSendPaginationRequest(nextPage, pageSize)) return;
|
|
64
|
-
|
|
65
|
-
this.currentPage.next(nextPage);
|
|
66
|
-
this.currentPageSize.next(pageSize);
|
|
67
|
-
|
|
68
|
-
this.rows.next(await this.tableSource.paginate(nextPage, pageSize));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
private shouldSendPaginationRequest(
|
|
72
|
-
nextPage: number,
|
|
73
|
-
pageSize: number,
|
|
74
|
-
): boolean {
|
|
75
|
-
return (
|
|
76
|
-
this.currentPage.getValue() !== nextPage ||
|
|
77
|
-
this.currentPageSize.getValue() !== pageSize
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public async sort(sortDetail: SortDetail<T>) {
|
|
82
|
-
if (!this.shouldSendSortRequest(sortDetail)) return;
|
|
83
|
-
this.currentSortDetail.next(sortDetail);
|
|
84
|
-
this.rows.next(await this.tableSource.sort(sortDetail));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private shouldSendSortRequest(sortDetail: SortDetail<T>): boolean {
|
|
88
|
-
return (
|
|
89
|
-
sortDetail.key !== this.currentSortDetail.getValue().key ||
|
|
90
|
-
sortDetail.order !== this.currentSortDetail.getValue().order
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public async handleClick(row: T): Promise<void> {
|
|
95
|
-
if (this.tableSource["onRowClick"]) {
|
|
96
|
-
await this.tableSource["onRowClick"](row);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
public async handleMetaClick(row: T): Promise<void> {
|
|
101
|
-
if (this.tableSource["onRowMetaClick"]) {
|
|
102
|
-
await this.tableSource["onRowMetaClick"](row);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
public async handleDoubleClick(row: T): Promise<void> {
|
|
107
|
-
if (this.tableSource["onRowDoubleClick"]) {
|
|
108
|
-
await this.tableSource["onRowDoubleClick"](row);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
public hasAnyAction() {
|
|
113
|
-
for (const row of this.rows.getValue()) {
|
|
114
|
-
if (this.getRowActions(row).length) return true;
|
|
115
|
-
}
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
public getRowActions(row: T): TableAction<T>[] {
|
|
120
|
-
return this.filterItemsBaseOnAccessLevel(
|
|
121
|
-
this.tableSource.loadRowActions(row),
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
public loadSummarySchema(): TableSummarySchema {
|
|
126
|
-
if (this.tableSource["loadSummarySchema"]) {
|
|
127
|
-
return this.tableSource["loadSummarySchema"]();
|
|
128
|
-
}
|
|
129
|
-
return {
|
|
130
|
-
summaryTitle: "",
|
|
131
|
-
summaryItems: [],
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
private filterItemsBaseOnAccessLevel<T>(items: Accessible[]): T[] {
|
|
136
|
-
return items.filter((item) => {
|
|
137
|
-
if (item.hasAccess) {
|
|
138
|
-
return item.hasAccess();
|
|
139
|
-
}
|
|
140
|
-
return true;
|
|
141
|
-
}) as T[];
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
public async onDestroy(): Promise<void> {
|
|
145
|
-
this.tableSource.onTableDestroy();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { TableHeaderSchema } from "../TableHeaderSchema";
|
|
2
|
-
import { SortDetail } from "../../sort";
|
|
3
|
-
import { TableSummarySchema } from "../TableSummarySchema";
|
|
4
|
-
import { TableAction } from "../TableAction";
|
|
5
|
-
|
|
6
|
-
export interface TableSource<T> {
|
|
7
|
-
loadRows(): Promise<T[]>;
|
|
8
|
-
|
|
9
|
-
loadHeaderSchema(): Promise<TableHeaderSchema<T>[]>;
|
|
10
|
-
|
|
11
|
-
loadRowActions(row: T): TableAction<T>[];
|
|
12
|
-
|
|
13
|
-
paginate(nextPage: number, pageSize: number): Promise<T[]>;
|
|
14
|
-
|
|
15
|
-
sort(sortDetail: SortDetail<T>): Promise<T[]>;
|
|
16
|
-
|
|
17
|
-
onTableDestroy(): void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface RowClick<T> extends TableSource<T> {
|
|
21
|
-
onRowClick(row: T): Promise<void>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface RowMetaClick<T> extends TableSource<T> {
|
|
25
|
-
onRowMetaClick(row: T): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface handleDoubleClick<T> extends TableSource<T> {
|
|
29
|
-
onRowDoubleClick(row: T): Promise<void>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface TableSummary<T> extends TableSource<T> {
|
|
33
|
-
loadSummarySchema(): Promise<TableSummarySchema>;
|
|
34
|
-
}
|
package/src/baseTable/index.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export type { TableAction } from "./TableAction";
|
|
2
|
-
export type { TableService } from "./TableService";
|
|
3
|
-
export type { Destroy } from "./OnDestory";
|
|
4
|
-
export type { RowActionSource } from "./RowActionSource";
|
|
5
|
-
export type { TableLoader } from "./TableLoader";
|
|
6
|
-
export type { TablePaginate } from "./TablePaginate";
|
|
7
|
-
export {
|
|
8
|
-
TABLE_ACTION_COLUMN,
|
|
9
|
-
TABLE_COLUMN_DEFAULT_VALUES,
|
|
10
|
-
TABLE_COLUMN_DEFAULT_COLSPAN,
|
|
11
|
-
TABLE_COLUMN_DEFAULT_WIDTH,
|
|
12
|
-
} from "./Constants";
|
|
13
|
-
export { BaseTable } from "./BaseTable";
|
|
14
|
-
export { SelectableTable } from "./SelectableTable";
|
|
15
|
-
export {
|
|
16
|
-
type TableHeaderSchema,
|
|
17
|
-
type TableRenderingData,
|
|
18
|
-
generateHeader,
|
|
19
|
-
} from "./TableHeaderSchema";
|
|
20
|
-
export {
|
|
21
|
-
type TableSummaryItem,
|
|
22
|
-
type TableSummarySchema,
|
|
23
|
-
} from "./TableSummarySchema";
|
|
24
|
-
export { Column } from "./moduleConnection/Column";
|
|
25
|
-
export { Table } from "./moduleConnection/Table";
|
|
26
|
-
export { Action } from "./moduleConnection/Action";
|
|
27
|
-
export { TableDestroy } from "./moduleConnection/TableDestroy";
|
|
28
|
-
export { TableRowClick } from "./moduleConnection/TableRowClick";
|
|
29
|
-
|
|
30
|
-
// Table Generator
|
|
31
|
-
export {
|
|
32
|
-
type TableSource,
|
|
33
|
-
type TableSummary,
|
|
34
|
-
type RowClick,
|
|
35
|
-
type RowMetaClick,
|
|
36
|
-
type handleDoubleClick,
|
|
37
|
-
} from "./generator/TableSource";
|
|
38
|
-
export { SelectableTableGenerator } from "./generator/SelectableTableGenerator";
|
|
39
|
-
export { TableGenerator } from "./generator/TableGenerator";
|
|
40
|
-
export { TableConfig } from "./generator/TableConfig";
|
|
41
|
-
export { TableCellComponentRegistry } from "./generator/TableCellComponentRegistry";
|
|
42
|
-
export { GColumn } from "./moduleConnection/generator/GColumn";
|
|
43
|
-
export { GTable } from "./moduleConnection/generator/GTable";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ActionDecorator } from '../TableAction'
|
|
2
|
-
import type { BaseModel } from '../../BaseModel'
|
|
3
|
-
|
|
4
|
-
export function Action<Model extends BaseModel>(actionDetail: Omit<ActionDecorator<Model>, 'handler'>) {
|
|
5
|
-
return function ActionDecorator(target: BaseModel, _propertyKey: string, propertyDescriptor: PropertyDescriptor) {
|
|
6
|
-
if (!target.constructor.prototype.actions) {
|
|
7
|
-
target.constructor.prototype.actions = []
|
|
8
|
-
}
|
|
9
|
-
(actionDetail as ActionDecorator<Model>).handler = propertyDescriptor.value
|
|
10
|
-
target.constructor.prototype.actions.push(actionDetail)
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TableHeaderSchema } from '../TableHeaderSchema'
|
|
2
|
-
import type { BaseModel } from '../../BaseModel'
|
|
3
|
-
|
|
4
|
-
export function Column<Model extends BaseModel>(header: TableHeaderSchema<Model>) {
|
|
5
|
-
return function ColumnDecorator(target: BaseModel, propertyKey: string) {
|
|
6
|
-
if (!target.constructor.prototype.headers) {
|
|
7
|
-
target.constructor.prototype.headers = []
|
|
8
|
-
}
|
|
9
|
-
target.constructor.prototype.headers.push({path: propertyKey, ...header });
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { BaseTable, type TableHeaderSchema } from "../index";
|
|
2
|
-
import { type ActionDecorator, type TableAction } from "../TableAction";
|
|
3
|
-
import type { BaseModel } from "../../BaseModel";
|
|
4
|
-
import type { SelectableTable } from "../SelectableTable";
|
|
5
|
-
|
|
6
|
-
export function Table<Model extends BaseModel>(
|
|
7
|
-
table: typeof BaseTable<Model> | typeof SelectableTable<Model>,
|
|
8
|
-
) {
|
|
9
|
-
return function TableDecorator(constructor: Function) {
|
|
10
|
-
async function loadHeader(): Promise<TableHeaderSchema<Model>[]> {
|
|
11
|
-
constructor.prototype._table = this as BaseTable<Model>;
|
|
12
|
-
return constructor.prototype.headers;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function getActions(row: Model): TableAction<Model>[] {
|
|
16
|
-
const tableActions: TableAction<Model>[] = [];
|
|
17
|
-
const modelActions = (constructor.prototype.actions ||
|
|
18
|
-
[]) as ActionDecorator<Model>[];
|
|
19
|
-
|
|
20
|
-
for (const action of modelActions) {
|
|
21
|
-
if (!action.isAvailable(row)) continue;
|
|
22
|
-
const actionToPush: TableAction<Model> = {
|
|
23
|
-
handler: action.handler.bind(row),
|
|
24
|
-
accessLevel: action.accessLevel,
|
|
25
|
-
actionName: action.actionName,
|
|
26
|
-
};
|
|
27
|
-
tableActions.push(actionToPush);
|
|
28
|
-
}
|
|
29
|
-
return tableActions;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async function rowClick(row: Model) {
|
|
33
|
-
if (constructor.prototype.rowClick) {
|
|
34
|
-
await constructor.prototype.rowClick.call(row);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async function onDestroy() {
|
|
39
|
-
if (constructor.prototype.tableDestroy) {
|
|
40
|
-
await constructor.prototype.tableDestroy();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
table.prototype.loadHeader = loadHeader;
|
|
45
|
-
table.prototype.getActions = getActions;
|
|
46
|
-
table.prototype.handleClick = rowClick;
|
|
47
|
-
table.prototype.onDestroy = onDestroy;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { BaseModel } from '../../BaseModel'
|
|
2
|
-
|
|
3
|
-
export function TableDestroy() {
|
|
4
|
-
return function TableDestroyDecorator(target: BaseModel, _propertyKey: string, descriptor: PropertyDescriptor) {
|
|
5
|
-
target.constructor.prototype.tableDestroy = descriptor.value;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { BaseModel } from '../../BaseModel'
|
|
2
|
-
|
|
3
|
-
export function TableRowClick() {
|
|
4
|
-
return function TableRowClickDecorator(target: BaseModel, _propertyKey: string, descriptor: PropertyDescriptor) {
|
|
5
|
-
target.constructor.prototype.rowClick = descriptor.value;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type TableHeaderSchema } from "../../index";
|
|
2
|
-
|
|
3
|
-
export function GColumn<T>(header: TableHeaderSchema<T>) {
|
|
4
|
-
return function GColumnDecorator(target: T, propertyKey: string) {
|
|
5
|
-
if (!target.constructor.prototype.headers) {
|
|
6
|
-
target.constructor.prototype.headers = [];
|
|
7
|
-
}
|
|
8
|
-
target.constructor.prototype.headers.push({ path: propertyKey, ...header });
|
|
9
|
-
};
|
|
10
|
-
}
|