@cxbox-ui/core 2.0.0-alpha.8 → 2.0.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.
Files changed (127) hide show
  1. package/README.md +261 -28
  2. package/dist/core.d.ts +4274 -0
  3. package/dist/index.js +2 -6
  4. package/dist/index.js.map +1 -0
  5. package/package.json +20 -30
  6. package/dist/actions/index.d.ts +0 -1081
  7. package/dist/api/ObservableApi.d.ts +0 -53
  8. package/dist/api/ObservableApiWrapper.d.ts +0 -11
  9. package/dist/api/index.d.ts +0 -1
  10. package/dist/cxbox-ui-core.cjs.development.js +0 -3692
  11. package/dist/cxbox-ui-core.cjs.production.min.js +0 -2
  12. package/dist/cxbox-ui-core.esm.js +0 -3656
  13. package/dist/cxbox-ui-core.modern.development.js +0 -3586
  14. package/dist/cxbox-ui-core.modern.js +0 -3586
  15. package/dist/cxbox-ui-core.modern.production.min.js +0 -2
  16. package/dist/epics/data/bcCancelCreateDataEpic.d.ts +0 -9
  17. package/dist/epics/data/bcDeleteDataEpic.d.ts +0 -2
  18. package/dist/epics/data/bcFetchDataEpic.d.ts +0 -15
  19. package/dist/epics/data/bcFetchRowMetaRequestEpic.d.ts +0 -17
  20. package/dist/epics/data/bcLoadMoreEpic.d.ts +0 -2
  21. package/dist/epics/data/bcNewDataEpic.d.ts +0 -14
  22. package/dist/epics/data/bcSaveDataEpic.d.ts +0 -24
  23. package/dist/epics/data/bcSelectDepthRecordEpic.d.ts +0 -2
  24. package/dist/epics/data/bcSelectRecordEpic.d.ts +0 -2
  25. package/dist/epics/data/changeAssociationEpic.d.ts +0 -2
  26. package/dist/epics/data/changeAssociationFullEpic.d.ts +0 -5
  27. package/dist/epics/data/changeAssociationSameBcEpic.d.ts +0 -5
  28. package/dist/epics/data/changeChildrenAssociationsEpic.d.ts +0 -2
  29. package/dist/epics/data/changeChildrenAssociationsSameBcEpic.d.ts +0 -2
  30. package/dist/epics/data/changeDescendantsAssociationsFullEpic.d.ts +0 -5
  31. package/dist/epics/data/index.d.ts +0 -20
  32. package/dist/epics/data/inlinePickListFetchDataEpic.d.ts +0 -2
  33. package/dist/epics/data/removeMultivalueTagEpic.d.ts +0 -17
  34. package/dist/epics/data/saveAssociationsActiveEpic.d.ts +0 -7
  35. package/dist/epics/data/saveAssociationsPassiveEpic.d.ts +0 -7
  36. package/dist/epics/data/selectViewEpic.d.ts +0 -11
  37. package/dist/epics/index.d.ts +0 -6
  38. package/dist/epics/router/changeLocationEpic.d.ts +0 -10
  39. package/dist/epics/router/drilldownEpic.d.ts +0 -2
  40. package/dist/epics/router/handleRouterEpic.d.ts +0 -2
  41. package/dist/epics/router/index.d.ts +0 -10
  42. package/dist/epics/router/loginDoneEpic.d.ts +0 -9
  43. package/dist/epics/router/selectScreenEpic.d.ts +0 -7
  44. package/dist/epics/router/selectScreenFailEpic.d.ts +0 -7
  45. package/dist/epics/router/selectViewEpic.d.ts +0 -7
  46. package/dist/epics/router/selectViewFailEpic.d.ts +0 -6
  47. package/dist/epics/router/userDrillDownEpic.d.ts +0 -6
  48. package/dist/epics/router/userDrilldownChangeCursorsEpic.d.ts +0 -2
  49. package/dist/epics/screen/apiErrorEpic.d.ts +0 -2
  50. package/dist/epics/screen/downloadFileByUrlEpic.d.ts +0 -2
  51. package/dist/epics/screen/downloadFileEpic.d.ts +0 -2
  52. package/dist/epics/screen/httpError401Epic.d.ts +0 -2
  53. package/dist/epics/screen/httpError409Epic.d.ts +0 -2
  54. package/dist/epics/screen/httpError418Epic.d.ts +0 -2
  55. package/dist/epics/screen/httpError500Epic.d.ts +0 -2
  56. package/dist/epics/screen/httpErrorDefaultEpic.d.ts +0 -2
  57. package/dist/epics/screen/index.d.ts +0 -10
  58. package/dist/epics/screen/processPostInvokeConfirmEpic.d.ts +0 -2
  59. package/dist/epics/screen/processPostInvokeEpic.d.ts +0 -2
  60. package/dist/epics/session/index.d.ts +0 -5
  61. package/dist/epics/session/loginByAnotherRoleEpic.d.ts +0 -5
  62. package/dist/epics/session/loginDoneEpic.d.ts +0 -6
  63. package/dist/epics/session/refreshMetaAndReloadPageEpic.d.ts +0 -2
  64. package/dist/epics/session/refreshMetaEpic.d.ts +0 -5
  65. package/dist/epics/session/switchRoleEpic.d.ts +0 -5
  66. package/dist/epics/utils/postOperationRoutine.d.ts +0 -13
  67. package/dist/epics/view/clearPendingDataChangesAfterCursorChangeEpic.d.ts +0 -7
  68. package/dist/epics/view/fileUploadConfirmEpic.d.ts +0 -11
  69. package/dist/epics/view/getRowMetaByForceActiveEpic.d.ts +0 -5
  70. package/dist/epics/view/index.d.ts +0 -9
  71. package/dist/epics/view/selectTableCellInitEpic.d.ts +0 -2
  72. package/dist/epics/view/sendOperationAssociateEpic.d.ts +0 -5
  73. package/dist/epics/view/sendOperationEpic.d.ts +0 -10
  74. package/dist/epics/view/showAllTableRecordsInitEpic.d.ts +0 -2
  75. package/dist/epics/view/showAssocPopupEpic.d.ts +0 -2
  76. package/dist/epics/view/showFileUploadPopupEpic.d.ts +0 -5
  77. package/dist/index.d.ts +0 -7
  78. package/dist/interfaces/bc.d.ts +0 -79
  79. package/dist/interfaces/customEpics.d.ts +0 -15
  80. package/dist/interfaces/customMiddlewares.d.ts +0 -35
  81. package/dist/interfaces/data.d.ts +0 -48
  82. package/dist/interfaces/filters.d.ts +0 -32
  83. package/dist/interfaces/index.d.ts +0 -27
  84. package/dist/interfaces/navigation.d.ts +0 -48
  85. package/dist/interfaces/objectMap.d.ts +0 -36
  86. package/dist/interfaces/operation.d.ts +0 -336
  87. package/dist/interfaces/router.d.ts +0 -17
  88. package/dist/interfaces/rowMeta.d.ts +0 -74
  89. package/dist/interfaces/screen.d.ts +0 -28
  90. package/dist/interfaces/session.d.ts +0 -83
  91. package/dist/interfaces/store.d.ts +0 -14
  92. package/dist/interfaces/tree.d.ts +0 -66
  93. package/dist/interfaces/view.d.ts +0 -202
  94. package/dist/interfaces/widget.d.ts +0 -209
  95. package/dist/middlewares/autosaveMiddleware.d.ts +0 -2
  96. package/dist/middlewares/index.d.ts +0 -6
  97. package/dist/middlewares/popupMiddleware.d.ts +0 -2
  98. package/dist/middlewares/preInvokeMiddleware.d.ts +0 -5
  99. package/dist/middlewares/requiredFieldsMiddleware.d.ts +0 -30
  100. package/dist/reducers/ReducerBuilderManager.d.ts +0 -19
  101. package/dist/reducers/data.d.ts +0 -4
  102. package/dist/reducers/depthData.d.ts +0 -4
  103. package/dist/reducers/index.d.ts +0 -6
  104. package/dist/reducers/router.d.ts +0 -9
  105. package/dist/reducers/screen.d.ts +0 -10
  106. package/dist/reducers/session.d.ts +0 -10
  107. package/dist/reducers/view.d.ts +0 -10
  108. package/dist/utils/api.d.ts +0 -25
  109. package/dist/utils/apiError.d.ts +0 -19
  110. package/dist/utils/autosave.d.ts +0 -37
  111. package/dist/utils/bc.d.ts +0 -27
  112. package/dist/utils/breadthFirst.d.ts +0 -21
  113. package/dist/utils/cancelRequestEpic.d.ts +0 -27
  114. package/dist/utils/combineMiddlewares.d.ts +0 -3
  115. package/dist/utils/deleteUndefinedFromObject.d.ts +0 -1
  116. package/dist/utils/exportState.d.ts +0 -0
  117. package/dist/utils/extendPopupWidgetTypes.d.ts +0 -8
  118. package/dist/utils/filters.d.ts +0 -63
  119. package/dist/utils/hierarchy.d.ts +0 -17
  120. package/dist/utils/highlightJson.d.ts +0 -12
  121. package/dist/utils/history.d.ts +0 -50
  122. package/dist/utils/index.d.ts +0 -10
  123. package/dist/utils/operations.d.ts +0 -21
  124. package/dist/utils/others.d.ts +0 -6
  125. package/dist/utils/strings.d.ts +0 -44
  126. package/dist/utils/tree.d.ts +0 -43
  127. package/dist/utils/viewTabs.d.ts +0 -20
@@ -1,27 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { AnyAction } from 'redux';
3
- import { isAnyOf } from '@reduxjs/toolkit';
4
- /**
5
- * Type tweak for backward @reduxjs/toolkit compatibility
6
- */
7
- type TypeGuard<T> = (value: any) => value is T;
8
- interface HasMatchFunction<T> {
9
- match: TypeGuard<T>;
10
- }
11
- /** @public */
12
- type Matcher<T> = HasMatchFunction<T> | TypeGuard<T>;
13
- /**
14
- * Default list of action types which are triggers for request cancel
15
- */
16
- export declare const cancelRequestActionTypes: [Matcher<any>, ...Matcher<any>[]];
17
- /**
18
- * Creator of request cancel epic
19
- *
20
- * @param action$ an observable input
21
- * @param actionTypes list of action types which triggers cancel
22
- * @param cancelFn a callback of request cancelation
23
- * @param cancelActionCreator an action creator which called by request cancelation
24
- * @param filterFn a callback function which filters come actions
25
- */
26
- export declare function cancelRequestEpic(action$: Observable<AnyAction>, actionTypes: Parameters<typeof isAnyOf>, cancelFn: (() => void) | undefined, cancelActionCreator: AnyAction, filterFn?: (actions: AnyAction) => boolean): Observable<AnyAction>;
27
- export {};
@@ -1,3 +0,0 @@
1
- import { Middleware } from 'redux';
2
- import { CustomMiddlewares, CoreMiddlewares } from '../interfaces/customMiddlewares';
3
- export declare function combineMiddlewares(coreMiddlewares: CoreMiddlewares, customMiddlewares?: CustomMiddlewares): Middleware<{}, any, import("redux").Dispatch<import("redux").AnyAction>>[];
@@ -1 +0,0 @@
1
- export declare function deleteUndefinedFromObject(obj: Record<string, any>): void;
File without changes
@@ -1,8 +0,0 @@
1
- import { CustomWidgetDescriptor } from '../interfaces/widget';
2
- /**
3
- * Add new values to `PopupWidgetTypes` from client application
4
- *
5
- * @param customWidgets client's widgets
6
- */
7
- declare function extendPopupWidgetTypes(customWidgets: Record<string, CustomWidgetDescriptor>): void;
8
- export default extendPopupWidgetTypes;
@@ -1,63 +0,0 @@
1
- import { BcFilter, BcSorter, FilterType, FieldType } from '../interfaces';
2
- /**
3
- * Maps an input array of BcFilter objects into a dictionary of GET-request params
4
- *
5
- * Name of the param formed as field name and filter type, separated by dot,
6
- * e.g. `${filter.fieldName}.${filter.type}`
7
- *
8
- * Value of the param is:
9
- * - for non-array values, stringified filter value
10
- * - for array values, a comma-separated list of stringified elements with each element enclosed in double quotes
11
- *
12
- * @see {@link parseFilters} Reverse function
13
- *
14
- * @param filters Filters for business components
15
- * @returns Dictionary of query-params for GET-request
16
- * @category Utils
17
- */
18
- export declare function getFilters(filters: BcFilter[]): Record<string, string>;
19
- /**
20
- * Maps an input array of business component sorters into a dictionary of query params for
21
- * Cxbox API, where values are field names and keys follows the template:
22
- * `_sort.${index}.${item.direction}`
23
- *
24
- * @param sorters Array of business component sorters
25
- * @returns Dictionary of query-params for GET-request
26
- * @category Utils
27
- */
28
- export declare function getSorters(sorters: BcSorter[]): Record<string, string>;
29
- /**
30
- * Function for parsing filters from string into BcFilter type
31
- *
32
- * @see {@link getFilters} Reverse function
33
- * @param defaultFilters string representation of filters
34
- * @category Utils
35
- */
36
- export declare function parseFilters(defaultFilters?: string): BcFilter[];
37
- /**
38
- * Parse sorter string into separate sorter objects.
39
- * String representation of sorters is url based:
40
- * "_sort.{order}.{direction}={fieldKey}&_sort.{order}.{direction}"
41
- *
42
- * fieldKey Sort by field
43
- * order Priority of this specfic sorter
44
- * direction "asc" or "desc"
45
- *
46
- * i.e. "_sort.0.asc=firstName"
47
- *
48
- * @param sorters string representation of sorters
49
- * @category Utils
50
- */
51
- export declare function parseSorters(sorters?: string): BcSorter[];
52
- /**
53
- * Returns appropriate filtration type for specified field type.
54
- *
55
- * - Text-based fields use `contains`
56
- * - Checkbox fields use `specified` (boolean)
57
- * - Dictionary fiels use `equalsOneOf`
58
- *
59
- * All other field types use strict `equals`
60
- *
61
- * @param fieldType Field type
62
- */
63
- export declare function getFilterType(fieldType: FieldType): FilterType.equals | FilterType.contains | FilterType.specified | FilterType.equalsOneOf;
@@ -1,17 +0,0 @@
1
- import { RowMetaField } from '../interfaces/rowMeta';
2
- import { WidgetListField } from '../interfaces/widget';
3
- /**
4
- * Function of calculate hierarchy column width
5
- *
6
- * @param columnName Witch column is match
7
- * @param depthLevel Hierarchy level
8
- * @param fields Widget fields
9
- * @param rowMetaFields Widget field meta
10
- * @param maxDepth Maximum hierarchy depth level
11
- * @param width Custom column width
12
- *
13
- * function return string value as number with 'px' or null
14
- * example '100px'
15
- * Last column dont math width and return null value
16
- */
17
- export declare function getColumnWidth(columnName: string, depthLevel: number, fields: WidgetListField[], rowMetaFields: RowMetaField[], maxDepth: number, width?: number): string;
@@ -1,12 +0,0 @@
1
- /**
2
- * Format json and highlight it as well.
3
- * May not be suitable for handling huge (such as 10MB) JSON.
4
- *
5
- * It's temp solution
6
- *
7
- * @param json JSON to highlight
8
- * @param colorOptions optional color options
9
- * @category Utils
10
- */
11
- declare function highlightJson(json: any, colorOptions?: {}): any;
12
- export default highlightJson;
@@ -1,50 +0,0 @@
1
- /**
2
- * Utilities for urls and browser history
3
- */
4
- import { Route } from '../interfaces';
5
- /**
6
- * Appends '/' in front of `absoluteUrl` argument.
7
- * If `absoluteUrl` alredy starts with `/` then argument returned without changes.
8
- *
9
- * @param absoluteUrl Url
10
- */
11
- export declare function makeRelativeUrl(absoluteUrl: string): string;
12
- /**
13
- * Parses a business component hierarchy url into a dictionary of business components
14
- * and their cursors.
15
- *
16
- * @param bcPath Business component hierarchy url, e.g. `bcName1/cursor1/bcName2/cursor2`
17
- * @category Utils
18
- */
19
- export declare function parseBcCursors(bcPath: string): Record<string, string>;
20
- /**
21
- * TODO
22
- *
23
- * @param literals
24
- * @param placeholders
25
- * @category Utils
26
- */
27
- export declare function buildUrl(literals: TemplateStringsArray, ...placeholders: Array<string | number>): string;
28
- /**
29
- * Default implementation for utility to parse `history`-compatible location to {@link Route | Cxbox UI route}.
30
- *
31
- * Supports three types of URLs:
32
- * - {@link RouteType.screen | RouteType.screen}, i.e. an url referencing some UI entity that can be parsed to Route directly. Example: `/screen/name/view/name/`;
33
- * - {@link RouteType.router | RouteType.router}, i.e. an url without information about entity that should be handled on server side. Example: `/router/server-entity`
34
- * - {@link RouteType.default | RouteType.default}, i.e. an url that leads to default entity of the application. Example: `/`
35
- *
36
- * Reverse function is {@link defaultBuildURL}.
37
- *
38
- * @category Utils
39
- */
40
- export declare function defaultParseURL(url: URL): Route;
41
- /**
42
- * Transform {@link Route | Cxbox UI route} to string url.
43
- *
44
- * Reverse function is {@link defaultParseURL}.
45
- *
46
- * @param route Cxbox UI route
47
- * @category Utils
48
- */
49
- export declare function defaultBuildURL(route: Route): string;
50
- export declare const getRouteFromString: (ulrString: string) => Route;
@@ -1,10 +0,0 @@
1
- export * from './api';
2
- export * from './apiError';
3
- export * from './strings';
4
- export * from './history';
5
- export * from './filters';
6
- export * from './operations';
7
- export * from './bc';
8
- export * from './tree';
9
- export * from './breadthFirst';
10
- export * from './deleteUndefinedFromObject';
@@ -1,21 +0,0 @@
1
- import { Operation, OperationGroup, OperationTypeCrud } from '../interfaces/operation';
2
- import { Store } from '../interfaces/store';
3
- import { sendOperation } from '../actions';
4
- /**
5
- * Extract operations from all operations groups and return them as an array of flat operations
6
- *
7
- * @param operations Operations or operation groups as received from row meta
8
- * @category Utils
9
- */
10
- export declare function flattenOperations(operations: Array<Operation | OperationGroup>): Operation[];
11
- /**
12
- * Check if an operation matches a specified `role` directly by type or by `actionRole` field.
13
- *
14
- * If operation role is unavailable due to the store lacking an appropriate row meta, only `role` is checked.
15
- *
16
- * @param role Expected operation role or 'none' if operation shouldn't match any crud role
17
- * @param payload sendOperation action payload
18
- * @param store Store instance
19
- * @category Utils
20
- */
21
- export declare function matchOperationRole(role: OperationTypeCrud | 'none' | string, payload: ReturnType<typeof sendOperation>['payload'], store: Store): boolean;
@@ -1,6 +0,0 @@
1
- import { FieldType, MultivalueFieldMeta, PickListFieldMeta } from '@cxbox-ui/schema';
2
- export declare function isMultivalueField(fieldType: FieldType): boolean;
3
- export declare function getPopupAssocKeys(fieldMeta: MultivalueFieldMeta | PickListFieldMeta): {
4
- assocValueKey: string;
5
- associateFieldKey: string;
6
- };
@@ -1,44 +0,0 @@
1
- import { Store } from '../interfaces/store';
2
- import { DataItem } from '../interfaces/data';
3
- /**
4
- * TODO
5
- *
6
- * @param literals
7
- * @param placeholders
8
- */
9
- export declare function getTemplate(literals: TemplateStringsArray, ...placeholders: any[]): string;
10
- /**
11
- * Forms a string representation of business components hierarchy with
12
- * respect to business components ancestors and their corresponding cursors
13
- *
14
- * @param bcName Business component name
15
- * @param includeSelf If result hierarchy should include target bc or only ancestors
16
- * @param state
17
- * @category Utils
18
- */
19
- export declare function buildBcUrl(bcName: string, includeSelf: boolean, state: Store): string;
20
- export declare function splitBcUrl(bcUrl: string): string[];
21
- /**
22
- * If there is a template in the field name then returns the formatted string
23
- *
24
- * @param title Field name
25
- * @param dataItem An object in the fields of which tokens should be searched
26
- */
27
- export declare function getFieldTitle(title: string, dataItem?: DataItem): string;
28
- /**
29
- * If there is a template in the field name then returns array of string
30
- *
31
- * Example:
32
- * splitIntoTokens(`The quick brown fox jumps over the lazy dog. If the dog reacted, was it realdogly lazy?`, 'dog')
33
- * ["The quick brown fox jumps over the lazy ", "dog", ". If the ", "dog", " reacted, was it real", "dog", "ly lazy?"]
34
- *
35
- * @param source Field name
36
- * @param search An object in the fields of which tokens should be searched
37
- */
38
- export declare function splitIntoTokens(source: string, search: string | RegExp): string[];
39
- /**
40
- * Convert string to RegExp
41
- *
42
- * @param str Source string
43
- */
44
- export declare function escapedSrc(str: string): RegExp;
@@ -1,43 +0,0 @@
1
- /**
2
- * This module contains utilities for tree-like structures
3
- */
4
- import { DataNode, TreeNodeBidirectional, TreeNodeDescending } from '../interfaces/tree';
5
- /**
6
- * Assigns for each element:
7
- *
8
- * - `parent` property, which is a reference to parent mode found through `parentId` match.
9
- * - `children` property, which is an array of references to child nodes.
10
- *
11
- * `parentId`: '0' considered a root pseudo-node
12
- *
13
- * Orphaned records will be excluded from result and throw a console warning.
14
- *
15
- * @param flat Flat array representation of tree structure
16
- * @returns New array
17
- */
18
- export declare function assignTreeLinks<T extends DataNode>(flat: T[]): (T & TreeNodeBidirectional)[];
19
- /**
20
- * Recursively traverse through each node and their descendant to aggregate ids of all
21
- * descendant nodes into `result` array.
22
- *
23
- * @param nodes Nodes to start search from; their ids also will be part of the result
24
- * @param result An array of ids for found descendant nodes
25
- */
26
- export declare function getDescendants(nodes: TreeNodeDescending[], result: string[]): void;
27
- /**
28
- * Returns array of matching nodes, their direct children and every ancestor node
29
- *
30
- * @param nodes An array to search
31
- * @param matchingNodes Ids of the nodes to match
32
- */
33
- export declare function buildSearchResultTree<T extends TreeNodeBidirectional = TreeNodeBidirectional>(nodes: T[], matchingNodes: string[]): T[];
34
- /**
35
- * Presort items based on their `level` property: each parent is followed by its descendant.
36
- * Items with level `1` considered to be root-level items.
37
- *
38
- * Notice: not very performant and almost always wasted as Cxbox API mostly returns already
39
- * sorted data.ts.
40
- *
41
- * @param data Unsorted data.ts
42
- */
43
- export declare function presort(data: TreeNodeBidirectional[]): TreeNodeBidirectional[];
@@ -1,20 +0,0 @@
1
- import { MenuItem, ViewNavigationCategory, NavigationTab } from '../interfaces/navigation';
2
- /**
3
- * Return navigation tabs array appropriate for specified level of navigation and currently active view
4
- *
5
- * @param navigation Navigation `menu` description from screen meta model
6
- * @param level Target level of navigation
7
- * @param activeView Currently active view
8
- */
9
- export declare function getViewTabs(navigation: Array<Exclude<MenuItem, ViewNavigationCategory>>, level: number, activeView?: string): NavigationTab[];
10
- /**
11
- * Return matching navigation tab for provided navigation item:
12
- * - view name if item is just a view
13
- * - group title and referenced view name, where view is found by breadth-first search through group children
14
- * for default view if `defaultView` is specified on group or first available view otherwise.
15
- *
16
- * TODO: Change Exclude<MenuItem, ViewNavigationCategory> to MenuItem in 2.0.0
17
- *
18
- * @param navigationItem
19
- */
20
- export declare function getReferencedView(navigationItem: Readonly<Exclude<MenuItem, ViewNavigationCategory>>): string;