@creatio-devkit/common 0.820.2 → 0.822.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/esm2022/lib/base-exports.mjs +1 -1
- package/esm2022/lib/internal/decorators/design-time-view-element/design-time-view-element.decorator.mjs +3 -1
- package/esm2022/lib/internal/models/design-time-view-element-registry-item.mjs +1 -1
- package/esm2022/lib/internal/models/index.mjs +2 -1
- package/esm2022/lib/internal/models/internal-interface-designer-item-registration-config.model.mjs +1 -1
- package/esm2022/lib/internal/models/internal-module-definition.mjs +1 -1
- package/esm2022/lib/internal/models/lazy-module-metadata.mjs +1 -1
- package/esm2022/lib/internal/models/lazy-module-ref.mjs +4 -4
- package/esm2022/lib/internal/models/view-element/angular-view-element-registration-config.model.mjs +1 -1
- package/esm2022/lib/internal/services/design-time-view-element-registry/design-time-view-element-registry.mjs +1 -1
- package/esm2022/lib/internal/services/global-converters-registry/converter-registry.mjs +8 -4
- package/esm2022/lib/internal/services/request-handler-registry/request-handler-registry.service.mjs +23 -21
- package/esm2022/lib/internal/services/validator-registry/validator-registry.mjs +9 -6
- package/esm2022/lib/internal/services/view-element-registry/view-element-registry.mjs +1 -1
- package/esm2022/lib/internal/utils/metadata-utils.mjs +1 -1
- package/esm2022/lib/public/decorators/inject/inject.decorator.mjs +1 -1
- package/esm2022/lib/public/decorators/interface-designer-item/interface-designer-item.decorator.mjs +3 -1
- package/esm2022/lib/public/decorators/module/module.decorator.mjs +1 -1
- package/esm2022/lib/public/decorators/view-element/view-element.decorator.mjs +3 -5
- package/esm2022/lib/public/functions/bootstrap-crt-module.mjs +8 -8
- package/esm2022/lib/public/functions/define-render-config.mjs +16 -0
- package/esm2022/lib/public/functions/index.mjs +2 -1
- package/esm2022/lib/public/models/view-element/base-view-element-registration-config.mjs +1 -1
- package/esm2022/lib/public/models/view-element/view-element-registration-config.mjs +1 -1
- package/esm2022/lib/public/models/view-element/view-element-render-strategy.mjs +4 -2
- package/fesm2022/creatio-devkit-common.mjs +628 -604
- package/fesm2022/creatio-devkit-common.mjs.map +1 -1
- package/index.d.ts +61 -8
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ɵAggregationType as _AggregationType, ɵAggregationFunction as _AggregationFunction, ɵAggregationEvalType as _AggregationEvalType, ɵDatePartType as _DatePartType, ɵFunctionType as _FunctionType, ɵOrderDirection as _OrderDirection, ɵgenerateGuid as _generateGuid, ɵNextHandlerAlreadySpecifiedException as _NextHandlerAlreadySpecifiedException, ɵBaseRequest as _BaseRequest, ɵSchemaViewMaskRequest as _SchemaViewMaskRequest, ɵSchemaViewMaskRequestAction as _SchemaViewMaskRequestAction } from '@creatio/base';
|
|
2
2
|
export { ɵAggregationEvalType as AggregationEvalType, ɵAggregationFunction as AggregationFunction, ɵAggregationFunctionColumn as AggregationFunctionColumn, ɵAggregationFunctionExpression as AggregationFunctionExpression, ɵAggregationSubQueryColumn as AggregationSubQueryColumn, ɵAggregationSubQueryExpression as AggregationSubQueryExpression, ɵAggregationType as AggregationType, ɵArgumentEmptyException as ArgumentEmptyException, ɵArgumentFunctionExpression as ArgumentFunctionExpression, ɵArgumentOutOfRangeException as ArgumentOutOfRangeException, ɵArithmeticExpression as ArithmeticExpression, ɵArithmeticOperation as ArithmeticOperation, ɵArithmeticQueryColumn as ArithmeticQueryColumn, ɵBaseExpression as BaseExpression, ɵBaseExpressionParser as BaseExpressionParser, ɵBaseFilter as BaseFilter, ɵBaseFilterParser as BaseFilterParser, ɵBaseFilterableQuery as BaseFilterableQuery, ɵBaseQuery as BaseQuery, ɵBaseQueryColumn as BaseQueryColumn, ɵBaseRequest as BaseRequest, ɵBetweenFilter as BetweenFilter, ɵColumnExpression as ColumnExpression, ɵCompareFilter as CompareFilter, ɵComparisonType as ComparisonType, ɵDataSchemaAttributeType as DataSchemaAttributeType, ɵDataSchemaAttributeUsageType as DataSchemaAttributeUsageType, ɵDataSchemaType as DataSchemaType, ɵDataSourceScope as DataSourceScope, ɵDataValueType as DataValueType, ɵDatePartFunctionColumn as DatePartFunctionColumn, ɵDatePartFunctionExpression as DatePartFunctionExpression, ɵDatePartType as DatePartType, ɵDefaultValueSource as DefaultValueSource, ɵDeleteQuery as DeleteQuery, ɵEMPTY_GUID as EMPTY_GUID, ɵEntityQueryColumn as EntityQueryColumn, ɵEntitySchemaQuery as EntitySchemaQuery, ɵExistsFilter as ExistsFilter, ɵExpressionMock as ExpressionMock, ɵExpressionParser as ExpressionParser, ɵExpressionResolver as ExpressionResolver, ɵExpressionType as ExpressionType, ɵFilterGroup as FilterGroup, ɵFilterMock as FilterMock, ɵFilterParser as FilterParser, ɵFilterResolver as FilterResolver, ɵFilterType as FilterType, ɵFunctionExpression as FunctionExpression, ɵFunctionType as FunctionType, ɵInFilter as InFilter, ɵInsertQuery as InsertQuery, ɵIsNullFilter as IsNullFilter, ɵItemNotFoundException as ItemNotFoundException, ɵLengthFunctionColumn as LengthFunctionColumn, ɵLengthFunctionExpression as LengthFunctionExpression, ɵLogicalOperatorType as LogicalOperatorType, ɵMacrosFunctionColumn as MacrosFunctionColumn, ɵMacrosFunctionExpression as MacrosFunctionExpression, ɵMessageChannelType as MessageChannelType, ɵModelInPageAction as ModelInPageAction, ɵModelParameterType as ModelParameterType, ɵNextHandlerAlreadySpecifiedException as NextHandlerAlreadySpecifiedException, ɵOrderDirection as OrderDirection, ɵParameterExpression as ParameterExpression, ɵParameterQueryColumn as ParameterQueryColumn, ɵPlatformAPIs as PlatformAPIs, ɵQueryMacrosType as QueryMacrosType, ɵQueryOperationType as QueryOperationType, ɵSchemaViewMaskRequest as SchemaViewMaskRequest, ɵSchemaViewMaskRequestAction as SchemaViewMaskRequestAction, ɵSelectLocalizationQuery as SelectLocalizationQuery, ɵSingleFilter as SingleFilter, ɵSubQueryColumn as SubQueryColumn, ɵSubQueryExpression as SubQueryExpression, ɵSubscription as Subscription, ɵUpdateQuery as UpdateQuery, ɵValidationUtilities as ValidationUtilities, ɵWindowFunctionColumn as WindowFunctionColumn, ɵWindowFunctionExpression as WindowFunctionExpression, ɵencodeDate as encodeDate, ɵgenerateGuid as generateGuid, ɵisEmptyGuid as isEmptyGuid, ɵisGuid as isGuid, ɵtoLocalISOString as toLocalISOString } from '@creatio/base';
|
|
3
|
-
import { get, set, upperFirst, camelCase, isEqual, cloneDeep } from 'lodash';
|
|
3
|
+
import { get, set, upperFirst, camelCase, isEqual, cloneDeep, isEmpty } from 'lodash';
|
|
4
4
|
import 'reflect-metadata';
|
|
5
5
|
import { __decorate, __metadata } from 'tslib';
|
|
6
6
|
|
|
@@ -931,19 +931,6 @@ function ImplementUsingHandlerChain(config) {
|
|
|
931
931
|
};
|
|
932
932
|
}
|
|
933
933
|
|
|
934
|
-
/**
|
|
935
|
-
* @internal
|
|
936
|
-
*/
|
|
937
|
-
function objectDeepKeys(obj) {
|
|
938
|
-
if (obj === null || typeof obj !== 'object') {
|
|
939
|
-
return [];
|
|
940
|
-
}
|
|
941
|
-
return Object.keys(obj)
|
|
942
|
-
.filter((key) => obj[key] instanceof Object)
|
|
943
|
-
.map((key) => objectDeepKeys(obj[key]).map((k) => [key, ...k]))
|
|
944
|
-
.reduce((x, y) => [...x, ...y], Object.keys(obj).map((x) => [x]));
|
|
945
|
-
}
|
|
946
|
-
|
|
947
934
|
/**
|
|
948
935
|
* @internal
|
|
949
936
|
*/
|
|
@@ -1040,18 +1027,19 @@ class InternalRequestHandlerRegistryType {
|
|
|
1040
1027
|
*/
|
|
1041
1028
|
static addRequestHandler(handlerType, config) {
|
|
1042
1029
|
const existingHandler = this._requestHandlersMap.get(handlerType);
|
|
1043
|
-
if (
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
},
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1030
|
+
if (existingHandler && (!existingHandler.instanceConfig?.lazy || existingHandler.instanceType)) {
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
const mergedConfig = {
|
|
1034
|
+
instanceType: config.instanceType,
|
|
1035
|
+
instanceConfig: {
|
|
1036
|
+
...(existingHandler?.instanceConfig ?? {}),
|
|
1037
|
+
...config.instanceConfig,
|
|
1038
|
+
},
|
|
1039
|
+
};
|
|
1040
|
+
this._requestHandlersMap.set(handlerType, mergedConfig);
|
|
1041
|
+
for (const listener of this._addItemListeners) {
|
|
1042
|
+
listener(handlerType, mergedConfig);
|
|
1055
1043
|
}
|
|
1056
1044
|
}
|
|
1057
1045
|
/**
|
|
@@ -1059,11 +1047,12 @@ class InternalRequestHandlerRegistryType {
|
|
|
1059
1047
|
*/
|
|
1060
1048
|
static removeRequestHandler(handlerType) {
|
|
1061
1049
|
const config = this._requestHandlersMap.get(handlerType);
|
|
1062
|
-
if (config) {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1050
|
+
if (!config) {
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
this._requestHandlersMap.delete(handlerType);
|
|
1054
|
+
for (const listener of this._removeItemListeners) {
|
|
1055
|
+
listener(handlerType, config);
|
|
1067
1056
|
}
|
|
1068
1057
|
}
|
|
1069
1058
|
static clear() {
|
|
@@ -1093,16 +1082,16 @@ class RequestHandlerRegistryService {
|
|
|
1093
1082
|
/**
|
|
1094
1083
|
* Register request handler class.
|
|
1095
1084
|
* @param config Request handler registration config.
|
|
1096
|
-
* @param
|
|
1085
|
+
* @param typeRef Request handler type reference (constructor).
|
|
1097
1086
|
*/
|
|
1098
|
-
static register(config,
|
|
1087
|
+
static register(config, typeRef) {
|
|
1099
1088
|
const requestType = config.requestType;
|
|
1100
1089
|
const requestHandlerType = config.type;
|
|
1101
1090
|
if (!requestType) {
|
|
1102
1091
|
throw new Error(`Error when register ${requestHandlerType}. Request type not specified.`);
|
|
1103
1092
|
}
|
|
1104
1093
|
const requestHandlerMapValue = {
|
|
1105
|
-
instanceType:
|
|
1094
|
+
instanceType: typeRef,
|
|
1106
1095
|
instanceConfig: config,
|
|
1107
1096
|
};
|
|
1108
1097
|
RequestHandlerRegistryService._internalRegistry.addRequestHandler(requestHandlerType, requestHandlerMapValue);
|
|
@@ -1150,17 +1139,21 @@ class ConverterRegistry extends ɵBaseRegistry {
|
|
|
1150
1139
|
static has(type) {
|
|
1151
1140
|
return this.store.typeInfos.has(type);
|
|
1152
1141
|
}
|
|
1142
|
+
static find(type) {
|
|
1143
|
+
return this.store.typeInfos.get(type);
|
|
1144
|
+
}
|
|
1153
1145
|
static get(type) {
|
|
1154
|
-
|
|
1146
|
+
const registryItem = this.find(type);
|
|
1147
|
+
if (!registryItem) {
|
|
1155
1148
|
throw new Error(`'${type}' converter doesn't exist`);
|
|
1156
1149
|
}
|
|
1157
|
-
return
|
|
1150
|
+
return registryItem;
|
|
1158
1151
|
}
|
|
1159
1152
|
static register(item) {
|
|
1160
1153
|
checkTypeNameFormat(item.type, 'ConverterTypeName');
|
|
1161
1154
|
checkCrtTypeNamePascalCase(item.type);
|
|
1162
1155
|
// TODO RND-21723
|
|
1163
|
-
const existingItem = this.
|
|
1156
|
+
const existingItem = this.find(item.type);
|
|
1164
1157
|
this.store.typeInfos.set(item.type, {
|
|
1165
1158
|
...(existingItem ?? {}),
|
|
1166
1159
|
...item,
|
|
@@ -1367,16 +1360,19 @@ const validatorRegistryKey = 'ValidatorRegistry';
|
|
|
1367
1360
|
*/
|
|
1368
1361
|
class ValidatorRegistry extends ɵBaseRegistry {
|
|
1369
1362
|
static { this.registryKey = validatorRegistryKey; }
|
|
1370
|
-
static
|
|
1371
|
-
const
|
|
1372
|
-
if (
|
|
1363
|
+
static _hasWithAnotherTypeRef(configType, typeRef) {
|
|
1364
|
+
const existingItem = ValidatorRegistry.items.get(configType);
|
|
1365
|
+
if (!existingItem) {
|
|
1373
1366
|
return false;
|
|
1374
1367
|
}
|
|
1375
|
-
|
|
1368
|
+
if (existingItem.lazy && !existingItem.typeRef) {
|
|
1369
|
+
return false;
|
|
1370
|
+
}
|
|
1371
|
+
return existingItem.typeRef !== typeRef;
|
|
1376
1372
|
}
|
|
1377
1373
|
static validate(config) {
|
|
1378
1374
|
checkTypeNameFormat(config.type, 'ValidatorTypeName');
|
|
1379
|
-
if (config.typeRef && ValidatorRegistry.
|
|
1375
|
+
if (config.typeRef && ValidatorRegistry._hasWithAnotherTypeRef(config.type, config.typeRef)) {
|
|
1380
1376
|
throw new Error(`Error when register ${config.type}. Element with this type has already exist`);
|
|
1381
1377
|
}
|
|
1382
1378
|
}
|
|
@@ -1430,6 +1426,77 @@ class ChatMessageTypeRegistry extends ɵBaseRegistry {
|
|
|
1430
1426
|
}
|
|
1431
1427
|
}
|
|
1432
1428
|
|
|
1429
|
+
/**
|
|
1430
|
+
* @public
|
|
1431
|
+
* @description Function allows to register user-defined component as view element in Creatio platform.
|
|
1432
|
+
* @param config - registration config. {@link ViewElementRegistrationConfig}
|
|
1433
|
+
* @example
|
|
1434
|
+
* sdk.registerViewElement({
|
|
1435
|
+
* type: 'usr.Timeline',
|
|
1436
|
+
* selector: 'usr-timeline',
|
|
1437
|
+
* inputs: {
|
|
1438
|
+
* primaryColumnValue: {},
|
|
1439
|
+
* cardSchemaName: {},
|
|
1440
|
+
* entitySchemaName: {}
|
|
1441
|
+
* }
|
|
1442
|
+
* });
|
|
1443
|
+
*/
|
|
1444
|
+
function registerViewElement(config) {
|
|
1445
|
+
ViewElementRegistry.validate(config);
|
|
1446
|
+
ViewElementRegistry.register(config);
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
/**
|
|
1450
|
+
* @internal
|
|
1451
|
+
* @description Function allows to register angular component as view element in Creatio platform.
|
|
1452
|
+
*/
|
|
1453
|
+
function registerAngularViewElement(config, typeRef) {
|
|
1454
|
+
ViewElementRegistry.validate(config);
|
|
1455
|
+
ViewElementRegistry.register({
|
|
1456
|
+
...config,
|
|
1457
|
+
typeRef,
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* @internal
|
|
1463
|
+
*/
|
|
1464
|
+
class LazyModuleRef {
|
|
1465
|
+
get typeRef() {
|
|
1466
|
+
return this._typeRef;
|
|
1467
|
+
}
|
|
1468
|
+
constructor(_moduleDefinition, _bootstrapFn,
|
|
1469
|
+
/** Name of source build ('host' or remote name) */
|
|
1470
|
+
sourceName) {
|
|
1471
|
+
this._moduleDefinition = _moduleDefinition;
|
|
1472
|
+
this._bootstrapFn = _bootstrapFn;
|
|
1473
|
+
this.sourceName = sourceName;
|
|
1474
|
+
}
|
|
1475
|
+
loadAndBootstrap() {
|
|
1476
|
+
if (!this._modulePromise) {
|
|
1477
|
+
this._modulePromise = this._moduleDefinition.load().then((type) => {
|
|
1478
|
+
this._typeRef = type;
|
|
1479
|
+
this._bootstrapFn(type);
|
|
1480
|
+
return type;
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
return this._modulePromise;
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* @internal
|
|
1489
|
+
*/
|
|
1490
|
+
function objectDeepKeys(obj) {
|
|
1491
|
+
if (obj === null || typeof obj !== 'object') {
|
|
1492
|
+
return [];
|
|
1493
|
+
}
|
|
1494
|
+
return Object.keys(obj)
|
|
1495
|
+
.filter((key) => obj[key] instanceof Object)
|
|
1496
|
+
.map((key) => objectDeepKeys(obj[key]).map((k) => [key, ...k]))
|
|
1497
|
+
.reduce((x, y) => [...x, ...y], Object.keys(obj).map((x) => [x]));
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1433
1500
|
/**
|
|
1434
1501
|
* @internal
|
|
1435
1502
|
*/
|
|
@@ -1540,17 +1607,19 @@ var ViewElementReuseStrategy;
|
|
|
1540
1607
|
})(ViewElementReuseStrategy || (ViewElementReuseStrategy = {}));
|
|
1541
1608
|
|
|
1542
1609
|
/**
|
|
1543
|
-
* @
|
|
1610
|
+
* @public
|
|
1544
1611
|
* @description Render strategy for view element.
|
|
1545
1612
|
*/
|
|
1546
1613
|
var ViewElementRenderStrategy;
|
|
1547
1614
|
(function (ViewElementRenderStrategy) {
|
|
1548
1615
|
/**
|
|
1549
1616
|
* @description Default render strategy.
|
|
1617
|
+
* The element is rendered immediately.
|
|
1550
1618
|
*/
|
|
1551
1619
|
ViewElementRenderStrategy["Default"] = "default";
|
|
1552
1620
|
/**
|
|
1553
1621
|
* @description On viewport render strategy.
|
|
1622
|
+
* The element is rendered only when it becomes visible in the viewport.
|
|
1554
1623
|
*/
|
|
1555
1624
|
ViewElementRenderStrategy["OnViewport"] = "on-viewport";
|
|
1556
1625
|
})(ViewElementRenderStrategy || (ViewElementRenderStrategy = {}));
|
|
@@ -1639,722 +1708,677 @@ function applyLocalizeMetadataFn(obj, localizeMetadata) {
|
|
|
1639
1708
|
/**
|
|
1640
1709
|
* @internal
|
|
1641
1710
|
*/
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
const registrationConfig = {
|
|
1647
|
-
...config,
|
|
1648
|
-
typeRef: type,
|
|
1649
|
-
inputs,
|
|
1650
|
-
};
|
|
1651
|
-
setDesignTimeViewElementMetadata(registrationConfig, type);
|
|
1652
|
-
};
|
|
1711
|
+
function checkRemoteName(remoteName) {
|
|
1712
|
+
if (!RemoteEntriesRegistry.items.has(remoteName)) {
|
|
1713
|
+
throw new Error(`Remote entry with name '${remoteName}' does not exist`);
|
|
1714
|
+
}
|
|
1653
1715
|
}
|
|
1654
|
-
|
|
1655
1716
|
/**
|
|
1656
1717
|
* @internal
|
|
1657
|
-
* @hostPublicApi
|
|
1658
1718
|
*/
|
|
1659
|
-
|
|
1719
|
+
function resistantForEach(items, callback) {
|
|
1720
|
+
items.forEach((item) => {
|
|
1721
|
+
try {
|
|
1722
|
+
callback(item);
|
|
1723
|
+
}
|
|
1724
|
+
catch (error) {
|
|
1725
|
+
console.error(error);
|
|
1726
|
+
}
|
|
1727
|
+
});
|
|
1660
1728
|
}
|
|
1661
|
-
|
|
1662
1729
|
/**
|
|
1663
1730
|
* @internal
|
|
1664
|
-
* @class MethodInvokeRequest
|
|
1665
|
-
* @description Definition of invoke method request.
|
|
1666
|
-
* @extends {ɵBaseRequest} {@link ɵBaseRequest}
|
|
1667
|
-
* @property {string} method - method name.
|
|
1668
|
-
* @property {unknown[]} args - arguments passing to the method.
|
|
1669
1731
|
*/
|
|
1670
|
-
|
|
1732
|
+
function registerViewElements(types) {
|
|
1733
|
+
resistantForEach(types, (type) => {
|
|
1734
|
+
const registrationConfig = getViewElementMetadata(type);
|
|
1735
|
+
ViewElementRegistry.validate(registrationConfig);
|
|
1736
|
+
ViewElementRegistry.register(registrationConfig);
|
|
1737
|
+
});
|
|
1671
1738
|
}
|
|
1672
|
-
|
|
1673
1739
|
/**
|
|
1674
1740
|
* @internal
|
|
1675
1741
|
*/
|
|
1676
|
-
|
|
1677
|
-
(
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1742
|
+
function registerLazyViewElements(configs, lazyModuleRef) {
|
|
1743
|
+
resistantForEach(configs, (config) => {
|
|
1744
|
+
const registryItem = { ...config, lazy: true, lazyModuleRef };
|
|
1745
|
+
ViewElementRegistry.validate(registryItem);
|
|
1746
|
+
ViewElementRegistry.register(registryItem);
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1682
1749
|
/**
|
|
1683
1750
|
* @internal
|
|
1684
1751
|
*/
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
constructor(_metadata, _bootstrapFn,
|
|
1690
|
-
/** Name of source build ('host' or remote name) */
|
|
1691
|
-
sourceName) {
|
|
1692
|
-
this._metadata = _metadata;
|
|
1693
|
-
this._bootstrapFn = _bootstrapFn;
|
|
1694
|
-
this.sourceName = sourceName;
|
|
1695
|
-
}
|
|
1696
|
-
loadAndBootstrap() {
|
|
1697
|
-
if (!this._modulePromise) {
|
|
1698
|
-
this._modulePromise = this._metadata.load().then((type) => {
|
|
1699
|
-
this._typeRef = type;
|
|
1700
|
-
this._bootstrapFn(type);
|
|
1701
|
-
return type;
|
|
1702
|
-
});
|
|
1752
|
+
function registerInterfaceDesignerItems(types, localizeFn) {
|
|
1753
|
+
resistantForEach(types, (type) => {
|
|
1754
|
+
if (!hasInterfaceDesignerItemMetadata(type)) {
|
|
1755
|
+
return;
|
|
1703
1756
|
}
|
|
1704
|
-
|
|
1705
|
-
|
|
1757
|
+
let config = getInterfaceDesignerItemMetadata(type);
|
|
1758
|
+
config = applyLocalizeMetadataFn(config, localizeFn);
|
|
1759
|
+
const viewElementMetadata = getViewElementMetadata(type);
|
|
1760
|
+
config.type = viewElementMetadata.type;
|
|
1761
|
+
InterfaceDesignerItemRegistry.validate(config);
|
|
1762
|
+
InterfaceDesignerItemRegistry.register(config);
|
|
1763
|
+
});
|
|
1706
1764
|
}
|
|
1707
|
-
|
|
1708
1765
|
/**
|
|
1709
|
-
* @
|
|
1710
|
-
* @description Creatio platform interacts with input's of user-defined component through CrtInput decorator.
|
|
1711
|
-
* @param config {@link CrtInputRegistrationConfig}
|
|
1712
|
-
*
|
|
1713
|
-
* @example
|
|
1714
|
-
* export class AppComponent {
|
|
1715
|
-
* @CrtInput()
|
|
1716
|
-
* public value!: string;
|
|
1717
|
-
* }
|
|
1766
|
+
* @internal
|
|
1718
1767
|
*/
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
};
|
|
1726
|
-
}
|
|
1727
|
-
Reflect.defineMetadata(crtInputPrefix + propertyKey.toString(), config, target.constructor);
|
|
1728
|
-
};
|
|
1768
|
+
function registerDesignTimeViewElements(types) {
|
|
1769
|
+
resistantForEach(types, (type) => {
|
|
1770
|
+
const registrationConfig = getDesignTimeViewElementMetadata(type);
|
|
1771
|
+
DesignTimeViewElementRegistry.validate(registrationConfig);
|
|
1772
|
+
DesignTimeViewElementRegistry.register(registrationConfig);
|
|
1773
|
+
});
|
|
1729
1774
|
}
|
|
1730
|
-
|
|
1731
1775
|
/**
|
|
1732
|
-
* @
|
|
1733
|
-
* @description User-defined components could notify Creatio platform about changes through CrtOutput decorator.
|
|
1734
|
-
* @example
|
|
1735
|
-
* export class AppComponent {
|
|
1736
|
-
* @Input()
|
|
1737
|
-
* @CrtOutput()
|
|
1738
|
-
* public valueChange;
|
|
1739
|
-
* }
|
|
1776
|
+
* @internal
|
|
1740
1777
|
*/
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1778
|
+
function registerValidators(types, options) {
|
|
1779
|
+
resistantForEach(types, (type) => {
|
|
1780
|
+
const metadata = getValidatorMetadata(type);
|
|
1781
|
+
const registrationConfig = {
|
|
1782
|
+
...metadata,
|
|
1783
|
+
instantiate: function (injectionContext) {
|
|
1784
|
+
const resolveDependency = options?.resolveDependency
|
|
1785
|
+
? (token) => options.resolveDependency(token, injectionContext)
|
|
1786
|
+
: null;
|
|
1787
|
+
return instantiate(type, resolveDependency);
|
|
1788
|
+
},
|
|
1789
|
+
};
|
|
1790
|
+
ValidatorRegistry.validate(registrationConfig);
|
|
1791
|
+
ValidatorRegistry.register(registrationConfig);
|
|
1792
|
+
});
|
|
1746
1793
|
}
|
|
1747
|
-
|
|
1748
1794
|
/**
|
|
1749
|
-
* @
|
|
1750
|
-
* @description User-defined components receive validationInfo changes through CrtValidationInput decorator.
|
|
1751
|
-
* Make sure you have defined input for every validationInfo input.
|
|
1752
|
-
* To properly declare validationInfo field:
|
|
1753
|
-
* 1. Declare input field inside inputs section. For example `value`
|
|
1754
|
-
* 2. In validationInputs section declare same field which ends with ValidationInfo.
|
|
1755
|
-
* For previous example `valueValidationInfo`
|
|
1756
|
-
*
|
|
1757
|
-
* @example
|
|
1758
|
-
* export class AppComponent {
|
|
1759
|
-
* @CrtInput()
|
|
1760
|
-
public value;
|
|
1761
|
-
*
|
|
1762
|
-
* @CrtValidationInput()
|
|
1763
|
-
* public valueValidationInfo;
|
|
1764
|
-
* }
|
|
1795
|
+
* @internal
|
|
1765
1796
|
*/
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1797
|
+
function registerLazyValidators(configs, lazyModuleRef) {
|
|
1798
|
+
resistantForEach(configs, (config) => {
|
|
1799
|
+
const registryItem = { ...config, lazy: true, lazyModuleRef };
|
|
1800
|
+
ValidatorRegistry.validate(registryItem);
|
|
1801
|
+
ValidatorRegistry.register(registryItem);
|
|
1802
|
+
});
|
|
1771
1803
|
}
|
|
1772
|
-
|
|
1773
1804
|
/**
|
|
1774
1805
|
* @internal
|
|
1775
1806
|
*/
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
validationInputs,
|
|
1788
|
-
};
|
|
1789
|
-
const registrationConfig = 'selector' in config
|
|
1790
|
-
? { ...baseRegistrationConfig, selector: config.selector }
|
|
1791
|
-
: { ...baseRegistrationConfig, typeRef: type };
|
|
1792
|
-
registrationConfig.reuseStrategy = config?.reuseStrategy ?? ViewElementReuseStrategy.Rerender;
|
|
1793
|
-
registrationConfig.placeholderSize = config.placeholderSize ?? {
|
|
1794
|
-
height: VIEW_ELEMENT_DEFAULT_HEIGHT,
|
|
1807
|
+
function registerConverters(types, options) {
|
|
1808
|
+
resistantForEach(types, (type) => {
|
|
1809
|
+
const metadata = getConverterMetadata(type);
|
|
1810
|
+
const registrationConfig = {
|
|
1811
|
+
...metadata,
|
|
1812
|
+
instantiate: function (injectionContext) {
|
|
1813
|
+
const resolveDependency = options?.resolveDependency
|
|
1814
|
+
? (token) => options.resolveDependency(token, injectionContext)
|
|
1815
|
+
: null;
|
|
1816
|
+
return instantiate(type, resolveDependency);
|
|
1817
|
+
},
|
|
1795
1818
|
};
|
|
1796
|
-
|
|
1797
|
-
};
|
|
1819
|
+
ConverterRegistry.register(registrationConfig);
|
|
1820
|
+
});
|
|
1798
1821
|
}
|
|
1799
|
-
|
|
1800
1822
|
/**
|
|
1801
1823
|
* @internal
|
|
1802
1824
|
*/
|
|
1803
|
-
function
|
|
1804
|
-
|
|
1825
|
+
function registerLazyConverters(descriptors, lazyModuleRef) {
|
|
1826
|
+
resistantForEach(descriptors, (descriptor) => {
|
|
1827
|
+
const registryItem = { ...descriptor, lazy: true, lazyModuleRef };
|
|
1828
|
+
ConverterRegistry.register(registryItem);
|
|
1829
|
+
});
|
|
1805
1830
|
}
|
|
1806
|
-
|
|
1807
1831
|
/**
|
|
1808
1832
|
* @internal
|
|
1809
1833
|
*/
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
const toolbarConfig = Array.isArray(config.toolbarConfig)
|
|
1815
|
-
? config.toolbarConfig[0]
|
|
1816
|
-
: config.toolbarConfig;
|
|
1817
|
-
config.typeCaption = toolbarConfig.caption;
|
|
1818
|
-
}
|
|
1834
|
+
function registerRequestHandlers(types, options, remoteName) {
|
|
1835
|
+
if (options.moduleType === 'remote' && !remoteName) {
|
|
1836
|
+
console.error("To use request handlers, 'remoteName' parameter should be specified.");
|
|
1837
|
+
return;
|
|
1819
1838
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1839
|
+
resistantForEach(types, (type) => {
|
|
1840
|
+
const metadata = getRequestHandlerMetadata(type);
|
|
1841
|
+
let registrationConfig;
|
|
1842
|
+
const createHandler = (injectionContext) => {
|
|
1843
|
+
const resolveDependency = options?.resolveDependency
|
|
1844
|
+
? (token) => options.resolveDependency(token, injectionContext)
|
|
1845
|
+
: null;
|
|
1846
|
+
return instantiate(type, resolveDependency);
|
|
1847
|
+
};
|
|
1848
|
+
if (options.moduleType === 'host') {
|
|
1849
|
+
registrationConfig = {
|
|
1850
|
+
...metadata,
|
|
1851
|
+
source: { type: HandlerSourceType.Host },
|
|
1852
|
+
createHandler,
|
|
1853
|
+
};
|
|
1854
|
+
}
|
|
1855
|
+
else {
|
|
1856
|
+
const remote = RemoteEntriesRegistry.items.get(remoteName);
|
|
1857
|
+
registrationConfig = {
|
|
1858
|
+
...metadata,
|
|
1859
|
+
source: {
|
|
1860
|
+
type: HandlerSourceType.Remote,
|
|
1861
|
+
packageName: remote.packageName,
|
|
1862
|
+
},
|
|
1863
|
+
createHandler,
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
RequestHandlerRegistryService.register(registrationConfig, type);
|
|
1867
|
+
});
|
|
1843
1868
|
}
|
|
1844
|
-
|
|
1845
1869
|
/**
|
|
1846
1870
|
* @internal
|
|
1847
1871
|
*/
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
if (!config) {
|
|
1851
|
-
return (type) => {
|
|
1852
|
-
// the decorator won't do anything by itself,
|
|
1853
|
-
// but will be used by the compiler to generate class metadata,
|
|
1854
|
-
// which is required for DI
|
|
1855
|
-
};
|
|
1856
|
-
}
|
|
1857
|
-
return function (type) {
|
|
1858
|
-
checkTypeNameFormat(config.type, 'ValidatorTypeName');
|
|
1872
|
+
function registerLazyRequestHandlers(descriptors, options, remoteName, lazyModuleRef) {
|
|
1873
|
+
resistantForEach(descriptors, (descriptor) => {
|
|
1859
1874
|
const registrationConfig = {
|
|
1860
|
-
...
|
|
1861
|
-
|
|
1875
|
+
...descriptor,
|
|
1876
|
+
lazy: true,
|
|
1877
|
+
lazyModuleRef,
|
|
1862
1878
|
};
|
|
1863
|
-
|
|
1864
|
-
|
|
1879
|
+
if (options.moduleType === 'host') {
|
|
1880
|
+
registrationConfig.source = { type: HandlerSourceType.Host };
|
|
1881
|
+
}
|
|
1882
|
+
else {
|
|
1883
|
+
const remote = RemoteEntriesRegistry.items.get(remoteName);
|
|
1884
|
+
registrationConfig.source = {
|
|
1885
|
+
type: HandlerSourceType.Remote,
|
|
1886
|
+
packageName: remote.packageName,
|
|
1887
|
+
};
|
|
1888
|
+
}
|
|
1889
|
+
RequestHandlerRegistryService.register(registrationConfig);
|
|
1890
|
+
});
|
|
1865
1891
|
}
|
|
1866
|
-
|
|
1867
1892
|
/**
|
|
1868
1893
|
* @internal
|
|
1869
1894
|
*/
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
}
|
|
1895
|
+
function bootstrapLazyCrtModule(name, descriptor, options, lazyModuleRef) {
|
|
1896
|
+
try {
|
|
1897
|
+
if (descriptor.viewElements) {
|
|
1898
|
+
registerLazyViewElements(descriptor.viewElements, lazyModuleRef);
|
|
1899
|
+
}
|
|
1900
|
+
if (descriptor.requestHandlers) {
|
|
1901
|
+
registerLazyRequestHandlers(descriptor.requestHandlers, options, name, lazyModuleRef);
|
|
1902
|
+
}
|
|
1903
|
+
if (descriptor.validators) {
|
|
1904
|
+
registerLazyValidators(descriptor.validators, lazyModuleRef);
|
|
1905
|
+
}
|
|
1906
|
+
if (descriptor.converters) {
|
|
1907
|
+
registerLazyConverters(descriptor.converters, lazyModuleRef);
|
|
1908
|
+
}
|
|
1909
|
+
descriptor.includes?.forEach((m) => {
|
|
1910
|
+
bootstrapLazyCrtModule(name, m, options, lazyModuleRef);
|
|
1911
|
+
});
|
|
1878
1912
|
}
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
checkCrtTypeNamePascalCase(config.type);
|
|
1882
|
-
setRequestHandlerMetadata(config, type);
|
|
1883
|
-
};
|
|
1884
|
-
}
|
|
1885
|
-
|
|
1886
|
-
/**
|
|
1887
|
-
* @internal
|
|
1888
|
-
*/
|
|
1889
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1890
|
-
function CrtConverter(config) {
|
|
1891
|
-
if (!config) {
|
|
1892
|
-
return (type) => { };
|
|
1913
|
+
catch (error) {
|
|
1914
|
+
console.error(error);
|
|
1893
1915
|
}
|
|
1894
|
-
return function (typeRef) {
|
|
1895
|
-
const type = typeof config === 'string' ? config : config.type;
|
|
1896
|
-
checkTypeNameFormat(type, 'converterTypeName');
|
|
1897
|
-
const registrationConfig = {
|
|
1898
|
-
type: type,
|
|
1899
|
-
typeRef: typeRef,
|
|
1900
|
-
};
|
|
1901
|
-
setConverterMetadata(registrationConfig, typeRef);
|
|
1902
|
-
};
|
|
1903
|
-
}
|
|
1904
|
-
|
|
1905
|
-
/**
|
|
1906
|
-
* @public
|
|
1907
|
-
* @description CrtChatMessageType decorator allows user to register components as a message type in chat.
|
|
1908
|
-
* @param config - registration config. {@link ChatMessageTypeRegistrationConfig}.
|
|
1909
|
-
*
|
|
1910
|
-
* @example
|
|
1911
|
-
* @CrtChatMessageType({
|
|
1912
|
-
* selector: 'usr-video-message',
|
|
1913
|
-
* messageType: 'video',
|
|
1914
|
-
* })
|
|
1915
|
-
* export class AppComponent { }
|
|
1916
|
-
*/
|
|
1917
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1918
|
-
function CrtChatMessageType(config) {
|
|
1919
|
-
return function (type) {
|
|
1920
|
-
ChatMessageTypeRegistry.register(config.messageType, config.selector);
|
|
1921
|
-
};
|
|
1922
1916
|
}
|
|
1923
|
-
|
|
1924
|
-
/**
|
|
1925
|
-
* @internal
|
|
1926
|
-
*/
|
|
1927
|
-
var DataSourceLoadType;
|
|
1928
|
-
(function (DataSourceLoadType) {
|
|
1929
|
-
DataSourceLoadType["LoadNext"] = "loadNext";
|
|
1930
|
-
DataSourceLoadType["Load"] = "load";
|
|
1931
|
-
DataSourceLoadType["Reload"] = "reload";
|
|
1932
|
-
})(DataSourceLoadType || (DataSourceLoadType = {}));
|
|
1933
|
-
|
|
1934
1917
|
/**
|
|
1935
1918
|
* @internal
|
|
1936
1919
|
*/
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1920
|
+
function bootstrapDefaultCrtModule(name, type, options, root) {
|
|
1921
|
+
if (bootstrappedCrtModules.has(type)) {
|
|
1922
|
+
return;
|
|
1923
|
+
}
|
|
1924
|
+
const source = options.moduleType === 'host' ? 'host' : name;
|
|
1925
|
+
bootstrappedCrtModules.set(type, { source, root, options });
|
|
1926
|
+
try {
|
|
1927
|
+
const moduleDefinition = getModuleMetadata(type);
|
|
1928
|
+
if (moduleDefinition.viewElements) {
|
|
1929
|
+
registerViewElements(moduleDefinition.viewElements);
|
|
1930
|
+
registerInterfaceDesignerItems(moduleDefinition.viewElements, options?.localizeMetadata);
|
|
1931
|
+
}
|
|
1932
|
+
if (moduleDefinition.designTimeViewElements) {
|
|
1933
|
+
registerDesignTimeViewElements(moduleDefinition.designTimeViewElements);
|
|
1934
|
+
}
|
|
1935
|
+
if (moduleDefinition.requestHandlers) {
|
|
1936
|
+
registerRequestHandlers(moduleDefinition.requestHandlers, options, name);
|
|
1937
|
+
}
|
|
1938
|
+
if (moduleDefinition.validators) {
|
|
1939
|
+
registerValidators(moduleDefinition.validators, options);
|
|
1940
|
+
}
|
|
1941
|
+
if (moduleDefinition.converters) {
|
|
1942
|
+
registerConverters(moduleDefinition.converters, options);
|
|
1943
|
+
}
|
|
1944
|
+
moduleDefinition.includes?.forEach((includedModuleMetadata) => {
|
|
1945
|
+
if (typeof includedModuleMetadata === 'function') {
|
|
1946
|
+
bootstrapDefaultCrtModule(name, includedModuleMetadata, options, false);
|
|
1947
|
+
bootstrapPredefinedModules(name, includedModuleMetadata, options);
|
|
1948
|
+
}
|
|
1949
|
+
else if (typeof includedModuleMetadata === 'object') {
|
|
1950
|
+
if (options.moduleType === 'remote' && !name) {
|
|
1951
|
+
console.error("To use lazy loading, 'remoteName' parameter should be specified.");
|
|
1952
|
+
return;
|
|
1953
|
+
}
|
|
1954
|
+
const ref = new LazyModuleRef(includedModuleMetadata, (x) => bootstrapDefaultCrtModule(name, x, options, false), source);
|
|
1955
|
+
bootstrapLazyCrtModule(name, includedModuleMetadata, options, ref);
|
|
1956
|
+
LazyModulesManager.instance.add(ref);
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
catch (error) {
|
|
1961
|
+
console.error(error);
|
|
1962
|
+
}
|
|
1973
1963
|
}
|
|
1974
|
-
|
|
1975
1964
|
/**
|
|
1976
1965
|
* @internal
|
|
1977
1966
|
*/
|
|
1978
|
-
function
|
|
1979
|
-
|
|
1980
|
-
|
|
1967
|
+
function bootstrapPredefinedModules(name, type, options) {
|
|
1968
|
+
const modulePrefix = 'module:';
|
|
1969
|
+
const metadataKeys = Reflect.getOwnMetadataKeys(type);
|
|
1970
|
+
for (const key of metadataKeys) {
|
|
1971
|
+
if (typeof key === 'string' && key.startsWith(modulePrefix)) {
|
|
1972
|
+
const moduleType = key.substring(modulePrefix.length);
|
|
1973
|
+
const predefinedBootstrapper = Reflect.getOwnMetadata('moduleBootstrapper:' + moduleType, type);
|
|
1974
|
+
try {
|
|
1975
|
+
predefinedBootstrapper(name, type, options);
|
|
1976
|
+
}
|
|
1977
|
+
catch (error) {
|
|
1978
|
+
console.error(error);
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
1981
|
}
|
|
1982
1982
|
}
|
|
1983
1983
|
/**
|
|
1984
1984
|
* @internal
|
|
1985
1985
|
*/
|
|
1986
|
-
function
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1986
|
+
function bootstrapCrtModule(...args) {
|
|
1987
|
+
const name = typeof args[0] === 'string' ? args.shift() : undefined;
|
|
1988
|
+
const type = args[0];
|
|
1989
|
+
const options = args[1] ?? {};
|
|
1990
|
+
options.moduleType ??= 'remote';
|
|
1991
|
+
if (name) {
|
|
1992
|
+
if (options.moduleType === 'remote') {
|
|
1993
|
+
checkRemoteName(name);
|
|
1990
1994
|
}
|
|
1991
|
-
|
|
1992
|
-
|
|
1995
|
+
else {
|
|
1996
|
+
throw new Error('Host module cannot have name');
|
|
1993
1997
|
}
|
|
1994
|
-
}
|
|
1998
|
+
}
|
|
1999
|
+
bootstrapDefaultCrtModule(name, type, options, true);
|
|
2000
|
+
bootstrapPredefinedModules(name, type, options);
|
|
2001
|
+
if (options.moduleType === 'remote') {
|
|
2002
|
+
BootstrapNotifier.instance.notify(type);
|
|
2003
|
+
}
|
|
1995
2004
|
}
|
|
2005
|
+
|
|
1996
2006
|
/**
|
|
1997
|
-
* @
|
|
2007
|
+
* @public
|
|
2008
|
+
* @description Use this function in decorators to indicate that a value should be localized.
|
|
2009
|
+
* Note that the "localizeMetadata" bootstrap option should be provided,
|
|
2010
|
+
* otherwise the value cannot be localized.
|
|
2011
|
+
*
|
|
2012
|
+
* @example
|
|
2013
|
+
*
|
|
2014
|
+
* ### Using 'localize' in decorator
|
|
2015
|
+
* ```ts
|
|
2016
|
+
* @CrtInterfaceDesignerItem({
|
|
2017
|
+
* toolbarConfig: {
|
|
2018
|
+
* caption: localize('MyElement.Caption')
|
|
2019
|
+
* }
|
|
2020
|
+
* })
|
|
2021
|
+
* class MyElement {}
|
|
2022
|
+
* ```
|
|
2023
|
+
* ### Passing 'localizeMetadata' bootstrap option
|
|
2024
|
+
* ```ts
|
|
2025
|
+
* bootstrapCrtModule(MyModule, {
|
|
2026
|
+
* localizeMetadata: (key: string) => thirdPartyTranslateService.translate(key)
|
|
2027
|
+
* });
|
|
2028
|
+
* ```
|
|
1998
2029
|
*/
|
|
1999
|
-
function
|
|
2000
|
-
|
|
2001
|
-
const registrationConfig = getViewElementMetadata(type);
|
|
2002
|
-
ViewElementRegistry.validate(registrationConfig);
|
|
2003
|
-
ViewElementRegistry.register(registrationConfig);
|
|
2004
|
-
});
|
|
2030
|
+
function localize(key) {
|
|
2031
|
+
return new LocalizableValue(key);
|
|
2005
2032
|
}
|
|
2033
|
+
|
|
2006
2034
|
/**
|
|
2007
2035
|
* @internal
|
|
2008
2036
|
*/
|
|
2009
|
-
function
|
|
2010
|
-
|
|
2011
|
-
const
|
|
2012
|
-
|
|
2013
|
-
ViewElementRegistry.register(registryItem);
|
|
2037
|
+
function registerHandlerChainServices(types) {
|
|
2038
|
+
types?.forEach((type) => {
|
|
2039
|
+
const registrationConfig = getHandlerChainServiceMetadata(type);
|
|
2040
|
+
HandlerChainServicesRegistry.register(registrationConfig);
|
|
2014
2041
|
});
|
|
2015
2042
|
}
|
|
2016
2043
|
/**
|
|
2017
2044
|
* @internal
|
|
2018
2045
|
*/
|
|
2019
|
-
function
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2046
|
+
function _bootstrapCrtModuleHandlerChainServices(type) {
|
|
2047
|
+
const moduleDefinition = getModuleMetadata(type);
|
|
2048
|
+
if (moduleDefinition.handlerChainServices) {
|
|
2049
|
+
registerHandlerChainServices(moduleDefinition.handlerChainServices);
|
|
2050
|
+
}
|
|
2051
|
+
moduleDefinition.includes?.forEach((t) => {
|
|
2052
|
+
if (typeof t === 'function') {
|
|
2053
|
+
_bootstrapCrtModuleHandlerChainServices(t);
|
|
2023
2054
|
}
|
|
2024
|
-
let config = getInterfaceDesignerItemMetadata(type);
|
|
2025
|
-
config = applyLocalizeMetadataFn(config, localizeFn);
|
|
2026
|
-
const viewElementMetadata = getViewElementMetadata(type);
|
|
2027
|
-
config.type = viewElementMetadata.type;
|
|
2028
|
-
InterfaceDesignerItemRegistry.validate(config);
|
|
2029
|
-
InterfaceDesignerItemRegistry.register(config);
|
|
2030
2055
|
});
|
|
2031
2056
|
}
|
|
2032
2057
|
/**
|
|
2033
2058
|
* @internal
|
|
2034
2059
|
*/
|
|
2035
|
-
function
|
|
2036
|
-
|
|
2037
|
-
const registrationConfig = getDesignTimeViewElementMetadata(type);
|
|
2038
|
-
DesignTimeViewElementRegistry.validate(registrationConfig);
|
|
2039
|
-
DesignTimeViewElementRegistry.register(registrationConfig);
|
|
2040
|
-
});
|
|
2060
|
+
function bootstrapCrtModuleHandlerChainServices(type) {
|
|
2061
|
+
_bootstrapCrtModuleHandlerChainServices(type);
|
|
2041
2062
|
}
|
|
2063
|
+
|
|
2042
2064
|
/**
|
|
2043
2065
|
* @internal
|
|
2066
|
+
* Clears global registries, resets state of global services.
|
|
2067
|
+
* Can be used in unit tests to clear global registries after bootstrapping module.
|
|
2068
|
+
* @example
|
|
2069
|
+
* beforeEach(() => {
|
|
2070
|
+
* bootstrapCrtModule('test', TestModule);
|
|
2071
|
+
* });
|
|
2072
|
+
*
|
|
2073
|
+
* afterEach(() => {
|
|
2074
|
+
* resetGlobals();
|
|
2075
|
+
* });
|
|
2044
2076
|
*/
|
|
2045
|
-
function
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
ValidatorRegistry.validate(registrationConfig);
|
|
2058
|
-
ValidatorRegistry.register(registrationConfig);
|
|
2059
|
-
});
|
|
2077
|
+
function resetGlobals() {
|
|
2078
|
+
bootstrappedCrtModules.clear();
|
|
2079
|
+
ViewElementRegistry.viewElements.clear();
|
|
2080
|
+
InternalRequestHandlerRegistry.clear();
|
|
2081
|
+
HandlerChainService.instance.clear();
|
|
2082
|
+
ValidatorRegistry.items.clear();
|
|
2083
|
+
ConverterRegistry.clear();
|
|
2084
|
+
RemoteEntriesRegistry.items.clear();
|
|
2085
|
+
PkgTopology.items.clear();
|
|
2086
|
+
LazyModulesManager.instance.clear();
|
|
2087
|
+
LazyModulesManager.instance.lazyLoadingDisabled = false;
|
|
2088
|
+
DesignTimeViewElementRegistry.infos.clear();
|
|
2060
2089
|
}
|
|
2090
|
+
|
|
2061
2091
|
/**
|
|
2062
2092
|
* @internal
|
|
2093
|
+
* @description Defines render configuration for view element.
|
|
2063
2094
|
*/
|
|
2064
|
-
function
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2095
|
+
function defineRenderConfig(config) {
|
|
2096
|
+
if (isEmpty(config.renderStrategy) && 'placeholderSize' in config) {
|
|
2097
|
+
config.renderStrategy = ViewElementRenderStrategy.OnViewport;
|
|
2098
|
+
}
|
|
2099
|
+
if (config.renderStrategy === ViewElementRenderStrategy.OnViewport && !config.placeholderSize) {
|
|
2100
|
+
config.placeholderSize = { height: VIEW_ELEMENT_DEFAULT_HEIGHT };
|
|
2101
|
+
}
|
|
2070
2102
|
}
|
|
2103
|
+
|
|
2071
2104
|
/**
|
|
2072
2105
|
* @internal
|
|
2073
2106
|
*/
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2107
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2108
|
+
function CrtDesignTimeViewElement(config) {
|
|
2109
|
+
return function (type) {
|
|
2110
|
+
const inputs = getCrtInputsMetadata(type);
|
|
2077
2111
|
const registrationConfig = {
|
|
2078
|
-
...
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
? (token) => options.resolveDependency(token, injectionContext)
|
|
2082
|
-
: null;
|
|
2083
|
-
return instantiate(type, resolveDependency);
|
|
2084
|
-
},
|
|
2112
|
+
...config,
|
|
2113
|
+
typeRef: type,
|
|
2114
|
+
inputs,
|
|
2085
2115
|
};
|
|
2086
|
-
|
|
2087
|
-
|
|
2116
|
+
defineRenderConfig(registrationConfig);
|
|
2117
|
+
setDesignTimeViewElementMetadata(registrationConfig, type);
|
|
2118
|
+
};
|
|
2088
2119
|
}
|
|
2120
|
+
|
|
2089
2121
|
/**
|
|
2090
2122
|
* @internal
|
|
2123
|
+
* @hostPublicApi
|
|
2091
2124
|
*/
|
|
2092
|
-
|
|
2093
|
-
resistantForEach(descriptors, (descriptor) => {
|
|
2094
|
-
const registryItem = { ...descriptor, lazy: true, lazyModuleRef };
|
|
2095
|
-
ConverterRegistry.register(registryItem);
|
|
2096
|
-
});
|
|
2125
|
+
class InterfaceDesignerItemRegistrationConfig {
|
|
2097
2126
|
}
|
|
2127
|
+
|
|
2098
2128
|
/**
|
|
2099
2129
|
* @internal
|
|
2130
|
+
* @class MethodInvokeRequest
|
|
2131
|
+
* @description Definition of invoke method request.
|
|
2132
|
+
* @extends {ɵBaseRequest} {@link ɵBaseRequest}
|
|
2133
|
+
* @property {string} method - method name.
|
|
2134
|
+
* @property {unknown[]} args - arguments passing to the method.
|
|
2100
2135
|
*/
|
|
2101
|
-
|
|
2102
|
-
if (options.moduleType === 'remote' && !remoteName) {
|
|
2103
|
-
console.error("To use request handlers, 'remoteName' parameter should be specified.");
|
|
2104
|
-
return;
|
|
2105
|
-
}
|
|
2106
|
-
resistantForEach(types, (type) => {
|
|
2107
|
-
const metadata = getRequestHandlerMetadata(type);
|
|
2108
|
-
let registrationConfig;
|
|
2109
|
-
const createHandler = (injectionContext) => {
|
|
2110
|
-
const resolveDependency = options?.resolveDependency
|
|
2111
|
-
? (token) => options.resolveDependency(token, injectionContext)
|
|
2112
|
-
: null;
|
|
2113
|
-
return instantiate(type, resolveDependency);
|
|
2114
|
-
};
|
|
2115
|
-
if (options.moduleType === 'host') {
|
|
2116
|
-
registrationConfig = {
|
|
2117
|
-
...metadata,
|
|
2118
|
-
source: { type: HandlerSourceType.Host },
|
|
2119
|
-
createHandler,
|
|
2120
|
-
};
|
|
2121
|
-
}
|
|
2122
|
-
else {
|
|
2123
|
-
const remote = RemoteEntriesRegistry.items.get(remoteName);
|
|
2124
|
-
registrationConfig = {
|
|
2125
|
-
...metadata,
|
|
2126
|
-
source: {
|
|
2127
|
-
type: HandlerSourceType.Remote,
|
|
2128
|
-
packageName: remote.packageName,
|
|
2129
|
-
},
|
|
2130
|
-
createHandler,
|
|
2131
|
-
};
|
|
2132
|
-
}
|
|
2133
|
-
RequestHandlerRegistryService.register(registrationConfig, type);
|
|
2134
|
-
});
|
|
2136
|
+
class MethodInvokeRequest extends _BaseRequest {
|
|
2135
2137
|
}
|
|
2138
|
+
|
|
2136
2139
|
/**
|
|
2137
2140
|
* @internal
|
|
2138
2141
|
*/
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2142
|
+
var RemoteEntryType;
|
|
2143
|
+
(function (RemoteEntryType) {
|
|
2144
|
+
RemoteEntryType["Script"] = "script";
|
|
2145
|
+
RemoteEntryType["Module"] = "module";
|
|
2146
|
+
})(RemoteEntryType || (RemoteEntryType = {}));
|
|
2147
|
+
|
|
2148
|
+
/**
|
|
2149
|
+
* @public
|
|
2150
|
+
* @description Creatio platform interacts with input's of user-defined component through CrtInput decorator.
|
|
2151
|
+
* @param config {@link CrtInputRegistrationConfig}
|
|
2152
|
+
*
|
|
2153
|
+
* @example
|
|
2154
|
+
* export class AppComponent {
|
|
2155
|
+
* @CrtInput()
|
|
2156
|
+
* public value!: string;
|
|
2157
|
+
* }
|
|
2158
|
+
*/
|
|
2159
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2160
|
+
function CrtInput(config) {
|
|
2161
|
+
return function (target, propertyKey) {
|
|
2162
|
+
if (!config) {
|
|
2163
|
+
config = {
|
|
2164
|
+
propertyBindable: false,
|
|
2154
2165
|
};
|
|
2155
2166
|
}
|
|
2156
|
-
|
|
2157
|
-
}
|
|
2167
|
+
Reflect.defineMetadata(crtInputPrefix + propertyKey.toString(), config, target.constructor);
|
|
2168
|
+
};
|
|
2158
2169
|
}
|
|
2170
|
+
|
|
2159
2171
|
/**
|
|
2160
|
-
* @
|
|
2172
|
+
* @public
|
|
2173
|
+
* @description User-defined components could notify Creatio platform about changes through CrtOutput decorator.
|
|
2174
|
+
* @example
|
|
2175
|
+
* export class AppComponent {
|
|
2176
|
+
* @Input()
|
|
2177
|
+
* @CrtOutput()
|
|
2178
|
+
* public valueChange;
|
|
2179
|
+
* }
|
|
2161
2180
|
*/
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2181
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2182
|
+
function CrtOutput() {
|
|
2183
|
+
return function (target, propertyKey) {
|
|
2184
|
+
Reflect.defineMetadata(crtOutputPrefix + propertyKey.toString(), {}, target.constructor);
|
|
2185
|
+
};
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
/**
|
|
2189
|
+
* @public
|
|
2190
|
+
* @description User-defined components receive validationInfo changes through CrtValidationInput decorator.
|
|
2191
|
+
* Make sure you have defined input for every validationInfo input.
|
|
2192
|
+
* To properly declare validationInfo field:
|
|
2193
|
+
* 1. Declare input field inside inputs section. For example `value`
|
|
2194
|
+
* 2. In validationInputs section declare same field which ends with ValidationInfo.
|
|
2195
|
+
* For previous example `valueValidationInfo`
|
|
2196
|
+
*
|
|
2197
|
+
* @example
|
|
2198
|
+
* export class AppComponent {
|
|
2199
|
+
* @CrtInput()
|
|
2200
|
+
public value;
|
|
2201
|
+
*
|
|
2202
|
+
* @CrtValidationInput()
|
|
2203
|
+
* public valueValidationInfo;
|
|
2204
|
+
* }
|
|
2205
|
+
*/
|
|
2206
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2207
|
+
function CrtValidationInput() {
|
|
2208
|
+
return function (target, propertyKey) {
|
|
2209
|
+
Reflect.defineMetadata(crtValidationInputPrefix + propertyKey.toString(), {}, target.constructor);
|
|
2210
|
+
};
|
|
2183
2211
|
}
|
|
2212
|
+
|
|
2184
2213
|
/**
|
|
2185
2214
|
* @internal
|
|
2186
2215
|
*/
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
const
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
}
|
|
2208
|
-
if (moduleDefinition.converters) {
|
|
2209
|
-
registerConverters(moduleDefinition.converters, options);
|
|
2210
|
-
}
|
|
2211
|
-
moduleDefinition.includes?.forEach((t) => {
|
|
2212
|
-
if (typeof t === 'function') {
|
|
2213
|
-
bootstrapDefaultCrtModule(name, t, options, false);
|
|
2214
|
-
bootstrapPredefinedModules(name, t, options);
|
|
2215
|
-
}
|
|
2216
|
-
else if (typeof t === 'object') {
|
|
2217
|
-
if (options.moduleType === 'remote' && !name) {
|
|
2218
|
-
console.error("To use lazy loading, 'remoteName' parameter should be specified.");
|
|
2219
|
-
return;
|
|
2220
|
-
}
|
|
2221
|
-
const ref = new LazyModuleRef(t, (x) => bootstrapDefaultCrtModule(name, x, options, false), source);
|
|
2222
|
-
bootstrapLazyCrtModule(name, t, options, ref);
|
|
2223
|
-
LazyModulesManager.instance.add(ref);
|
|
2224
|
-
}
|
|
2225
|
-
});
|
|
2226
|
-
}
|
|
2227
|
-
catch (error) {
|
|
2228
|
-
console.error(error);
|
|
2229
|
-
}
|
|
2216
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2217
|
+
function CrtViewElement(config) {
|
|
2218
|
+
return function (type) {
|
|
2219
|
+
checkTypeNamePascalCase(config.type);
|
|
2220
|
+
const inputs = getCrtInputsMetadata(type);
|
|
2221
|
+
const outputs = getCrtOutputsMetadata(type);
|
|
2222
|
+
const validationInputs = getCrtValidationInputsMetadata(type);
|
|
2223
|
+
const baseRegistrationConfig = {
|
|
2224
|
+
...config,
|
|
2225
|
+
inputs,
|
|
2226
|
+
outputs,
|
|
2227
|
+
validationInputs,
|
|
2228
|
+
};
|
|
2229
|
+
const registrationConfig = 'selector' in config
|
|
2230
|
+
? { ...baseRegistrationConfig, selector: config.selector }
|
|
2231
|
+
: { ...baseRegistrationConfig, typeRef: type };
|
|
2232
|
+
registrationConfig.reuseStrategy = config?.reuseStrategy ?? ViewElementReuseStrategy.Rerender;
|
|
2233
|
+
defineRenderConfig(registrationConfig);
|
|
2234
|
+
setViewElementMetadata(registrationConfig, type);
|
|
2235
|
+
};
|
|
2230
2236
|
}
|
|
2237
|
+
|
|
2231
2238
|
/**
|
|
2232
2239
|
* @internal
|
|
2233
2240
|
*/
|
|
2234
|
-
function
|
|
2235
|
-
|
|
2236
|
-
const metadataKeys = Reflect.getOwnMetadataKeys(type);
|
|
2237
|
-
for (const key of metadataKeys) {
|
|
2238
|
-
if (typeof key === 'string' && key.startsWith(modulePrefix)) {
|
|
2239
|
-
const moduleType = key.substring(modulePrefix.length);
|
|
2240
|
-
const predefinedBootstrapper = Reflect.getOwnMetadata('moduleBootstrapper:' + moduleType, type);
|
|
2241
|
-
try {
|
|
2242
|
-
predefinedBootstrapper(name, type, options);
|
|
2243
|
-
}
|
|
2244
|
-
catch (error) {
|
|
2245
|
-
console.error(error);
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2241
|
+
function CrtModule(moduleDefinition) {
|
|
2242
|
+
return (type) => setModuleMetadata(moduleDefinition, type);
|
|
2249
2243
|
}
|
|
2244
|
+
|
|
2250
2245
|
/**
|
|
2251
2246
|
* @internal
|
|
2252
2247
|
*/
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
}
|
|
2262
|
-
else {
|
|
2263
|
-
throw new Error('Host module cannot have name');
|
|
2248
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2249
|
+
function CrtInterfaceDesignerItem(config) {
|
|
2250
|
+
function _applyTypeCaption() {
|
|
2251
|
+
if (!config.typeCaption && config.toolbarConfig) {
|
|
2252
|
+
const toolbarConfig = Array.isArray(config.toolbarConfig)
|
|
2253
|
+
? config.toolbarConfig[0]
|
|
2254
|
+
: config.toolbarConfig;
|
|
2255
|
+
config.typeCaption = toolbarConfig.caption;
|
|
2264
2256
|
}
|
|
2265
2257
|
}
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2258
|
+
return function (type) {
|
|
2259
|
+
config.typeRef = type;
|
|
2260
|
+
config.viewElementGroupType ??= ViewElementGroupType.CustomElements;
|
|
2261
|
+
_applyTypeCaption();
|
|
2262
|
+
defineRenderConfig(config);
|
|
2263
|
+
setInterfaceDesignerItemMetadata(config, type);
|
|
2264
|
+
};
|
|
2271
2265
|
}
|
|
2272
2266
|
|
|
2273
2267
|
/**
|
|
2274
2268
|
* @public
|
|
2275
|
-
* @description
|
|
2276
|
-
*
|
|
2277
|
-
*
|
|
2278
|
-
*
|
|
2269
|
+
* @description
|
|
2270
|
+
* Constructor parameter decorator.
|
|
2271
|
+
* Mark parameter as dependency that should be obtained by token.
|
|
2272
|
+
* @param token - token by which the dependency instance will be obtained
|
|
2279
2273
|
* @example
|
|
2280
|
-
*
|
|
2281
|
-
*
|
|
2282
|
-
*
|
|
2283
|
-
* @CrtInterfaceDesignerItem({
|
|
2284
|
-
* toolbarConfig: {
|
|
2285
|
-
* caption: localize('MyElement.Caption')
|
|
2286
|
-
* }
|
|
2287
|
-
* })
|
|
2288
|
-
* class MyElement {}
|
|
2289
|
-
* ```
|
|
2290
|
-
* ### Passing 'localizeMetadata' bootstrap option
|
|
2291
|
-
* ```ts
|
|
2292
|
-
* bootstrapCrtModule(MyModule, {
|
|
2293
|
-
* localizeMetadata: (key: string) => thirdPartyTranslateService.translate(key)
|
|
2294
|
-
* });
|
|
2295
|
-
* ```
|
|
2274
|
+
* class MyHandler {
|
|
2275
|
+
* constructor(@CrtInject(USER_NAME_TOKEN) userName: string) {}
|
|
2276
|
+
* }
|
|
2296
2277
|
*/
|
|
2297
|
-
function
|
|
2298
|
-
return
|
|
2278
|
+
function CrtInject(token) {
|
|
2279
|
+
return function (target, paramKey, paramIndex) {
|
|
2280
|
+
Reflect.defineMetadata(crtInjectPrefix + paramIndex, token, target);
|
|
2281
|
+
};
|
|
2299
2282
|
}
|
|
2300
2283
|
|
|
2301
2284
|
/**
|
|
2302
2285
|
* @internal
|
|
2303
2286
|
*/
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2287
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2288
|
+
function CrtValidator(config) {
|
|
2289
|
+
if (!config) {
|
|
2290
|
+
return (type) => {
|
|
2291
|
+
// the decorator won't do anything by itself,
|
|
2292
|
+
// but will be used by the compiler to generate class metadata,
|
|
2293
|
+
// which is required for DI
|
|
2294
|
+
};
|
|
2295
|
+
}
|
|
2296
|
+
return function (type) {
|
|
2297
|
+
checkTypeNameFormat(config.type, 'ValidatorTypeName');
|
|
2298
|
+
const registrationConfig = {
|
|
2299
|
+
...config,
|
|
2300
|
+
typeRef: type,
|
|
2301
|
+
};
|
|
2302
|
+
setValidatorMetadata(registrationConfig, type);
|
|
2303
|
+
};
|
|
2309
2304
|
}
|
|
2305
|
+
|
|
2310
2306
|
/**
|
|
2311
2307
|
* @internal
|
|
2312
2308
|
*/
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
if (
|
|
2316
|
-
|
|
2309
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2310
|
+
function CrtRequestHandler(config) {
|
|
2311
|
+
if (!config) {
|
|
2312
|
+
return (type) => {
|
|
2313
|
+
// the decorator won't do anything by itself,
|
|
2314
|
+
// but will be used by the compiler to generate class metadata,
|
|
2315
|
+
// which is required for DI
|
|
2316
|
+
};
|
|
2317
2317
|
}
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
}
|
|
2318
|
+
return function (type) {
|
|
2319
|
+
checkTypeNameFormat(config.type, 'RequestHandlerTypeName');
|
|
2320
|
+
checkCrtTypeNamePascalCase(config.type);
|
|
2321
|
+
setRequestHandlerMetadata(config, type);
|
|
2322
|
+
};
|
|
2323
2323
|
}
|
|
2324
|
+
|
|
2324
2325
|
/**
|
|
2325
2326
|
* @internal
|
|
2326
2327
|
*/
|
|
2327
|
-
|
|
2328
|
-
|
|
2328
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2329
|
+
function CrtConverter(config) {
|
|
2330
|
+
if (!config) {
|
|
2331
|
+
return (type) => { };
|
|
2332
|
+
}
|
|
2333
|
+
return function (typeRef) {
|
|
2334
|
+
const type = typeof config === 'string' ? config : config.type;
|
|
2335
|
+
checkTypeNameFormat(type, 'converterTypeName');
|
|
2336
|
+
const registrationConfig = {
|
|
2337
|
+
type: type,
|
|
2338
|
+
typeRef: typeRef,
|
|
2339
|
+
};
|
|
2340
|
+
setConverterMetadata(registrationConfig, typeRef);
|
|
2341
|
+
};
|
|
2329
2342
|
}
|
|
2330
2343
|
|
|
2331
2344
|
/**
|
|
2332
|
-
* @
|
|
2333
|
-
*
|
|
2334
|
-
*
|
|
2335
|
-
* @example
|
|
2336
|
-
* beforeEach(() => {
|
|
2337
|
-
* bootstrapCrtModule('test', TestModule);
|
|
2338
|
-
* });
|
|
2345
|
+
* @public
|
|
2346
|
+
* @description CrtChatMessageType decorator allows user to register components as a message type in chat.
|
|
2347
|
+
* @param config - registration config. {@link ChatMessageTypeRegistrationConfig}.
|
|
2339
2348
|
*
|
|
2340
|
-
*
|
|
2341
|
-
*
|
|
2342
|
-
*
|
|
2349
|
+
* @example
|
|
2350
|
+
* @CrtChatMessageType({
|
|
2351
|
+
* selector: 'usr-video-message',
|
|
2352
|
+
* messageType: 'video',
|
|
2353
|
+
* })
|
|
2354
|
+
* export class AppComponent { }
|
|
2343
2355
|
*/
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
ValidatorRegistry.items.clear();
|
|
2350
|
-
ConverterRegistry.clear();
|
|
2351
|
-
RemoteEntriesRegistry.items.clear();
|
|
2352
|
-
PkgTopology.items.clear();
|
|
2353
|
-
LazyModulesManager.instance.clear();
|
|
2354
|
-
LazyModulesManager.instance.lazyLoadingDisabled = false;
|
|
2355
|
-
DesignTimeViewElementRegistry.infos.clear();
|
|
2356
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2357
|
+
function CrtChatMessageType(config) {
|
|
2358
|
+
return function (type) {
|
|
2359
|
+
ChatMessageTypeRegistry.register(config.messageType, config.selector);
|
|
2360
|
+
};
|
|
2356
2361
|
}
|
|
2357
2362
|
|
|
2363
|
+
/**
|
|
2364
|
+
* @internal
|
|
2365
|
+
*/
|
|
2366
|
+
var DataSourceLoadType;
|
|
2367
|
+
(function (DataSourceLoadType) {
|
|
2368
|
+
DataSourceLoadType["LoadNext"] = "loadNext";
|
|
2369
|
+
DataSourceLoadType["Load"] = "load";
|
|
2370
|
+
DataSourceLoadType["Reload"] = "reload";
|
|
2371
|
+
})(DataSourceLoadType || (DataSourceLoadType = {}));
|
|
2372
|
+
|
|
2373
|
+
/**
|
|
2374
|
+
* @internal
|
|
2375
|
+
*/
|
|
2376
|
+
var ViewElementProperty;
|
|
2377
|
+
(function (ViewElementProperty) {
|
|
2378
|
+
ViewElementProperty["Readonly"] = "READONLY_PROPERTY";
|
|
2379
|
+
ViewElementProperty["Disabled"] = "DISABLED_PROPERTY";
|
|
2380
|
+
})(ViewElementProperty || (ViewElementProperty = {}));
|
|
2381
|
+
|
|
2358
2382
|
/**
|
|
2359
2383
|
* @public
|
|
2360
2384
|
* @abstract
|
|
@@ -2814,5 +2838,5 @@ __decorate([
|
|
|
2814
2838
|
* Generated bundle index. Do not edit.
|
|
2815
2839
|
*/
|
|
2816
2840
|
|
|
2817
|
-
export { BaseRequestHandler, BaseValidator, BootstrapNotifier, ChatMessageTypeRegistry, ConverterRegistry, CrtChatMessageType, CrtConverter, CrtDesignTimeViewElement, CrtInject, CrtInput, CrtInputRegistrationConfig, CrtInterfaceDesignerItem, CrtModule, CrtOutput, CrtRequest, CrtRequestHandler, CrtValidationInput, CrtValidator, CrtViewElement, CrtZoneService, DataRequest, DataSourceLoadType, DesignTimeViewElementRegistry, DesignerToolGroupType, DialogService, FeatureService, HandleViewModelAttributeChangeRequest, HandlerChainService, HandlerChainServicesRegistry, HandlerSourceType, HandlersOrderComparer, HttpClientService, ImplementUsingHandlerChain, InterfaceDesignerItemRegistrationConfig, InterfaceDesignerItemRegistry, InternalRequestHandlerRegistry, InternalRequestHandlerRegistryType, LazyModuleRef, LazyModulesManager, LicenseService, LocalizableValue, MaskService, MessageChannelService, MethodInvokeRequest, Model, PkgTopology, RemoteEntriesRegistry, RemoteEntryType, RequestHandlerRegistryService, RequestRegistryService, RightsService, SysSetting, SysSettingValue, SysSettingsService, SysValuesService, VIEW_ELEMENT_DEFAULT_HEIGHT, ValidatorMapValue, ValidatorRegistry, ViewElementDataGroupType, ViewElementGroupType, ViewElementProperty, ViewElementRegistry, ViewElementRenderStrategy, ViewElementReuseStrategy, _from, applyLocalizeMetadataFn, bootstrapCrtModule, bootstrapCrtModuleHandlerChainServices, bootstrappedCrtModules, callOnContextCreateHooks, callOnContextDestroyHooks, callOnContextUpdateHooks, checkCrtTypeNamePascalCase, checkIfTypeRegistered, checkOnlyOneRegistration, checkTypeNameFormat, checkTypeNamePascalCase, crtInjectPrefix, crtInputPrefix, crtOutputPrefix, crtValidationInputPrefix, designTimeViewElementRegistryKey, getConverterMetadata, getCrtInputsMetadata, getCrtOutputsMetadata, getCrtValidationInputsMetadata, getDeepModuleDependencies, getDesignTimeViewElementMetadata, getHandlerChainServiceMetadata, getInterfaceDesignerItemMetadata, getModuleMetadata, getRequestHandlerMetadata, getTypeDependencies, getValidatorMetadata, getViewElementMetadata, hasInterfaceDesignerItemMetadata, instantiate, interfaceDesignerItemRegistryKey, isComponentPropertyBindable, localize, matchScopes, objectDeepKeys, registerAngularViewElement, registerViewElement, registryKey, resetGlobals, setConverterMetadata, setDesignTimeViewElementMetadata, setInterfaceDesignerItemMetadata, setModuleMetadata, setRequestHandlerMetadata, setValidatorMetadata, setViewElementMetadata, toAggregationEval, toAggregationEvalType, toAggregationFunction, toAggregationType, toDatePart, toDatePartType, toNumericFunctionType, toOrderDirection, toPascalCase, toSortDirection, toStringFunctionType, validatorRegistryKey, viewElementRegistryKey, ɵBaseRegistry, ɵcheckTypeNameFormat, ɵinstantiate };
|
|
2841
|
+
export { BaseRequestHandler, BaseValidator, BootstrapNotifier, ChatMessageTypeRegistry, ConverterRegistry, CrtChatMessageType, CrtConverter, CrtDesignTimeViewElement, CrtInject, CrtInput, CrtInputRegistrationConfig, CrtInterfaceDesignerItem, CrtModule, CrtOutput, CrtRequest, CrtRequestHandler, CrtValidationInput, CrtValidator, CrtViewElement, CrtZoneService, DataRequest, DataSourceLoadType, DesignTimeViewElementRegistry, DesignerToolGroupType, DialogService, FeatureService, HandleViewModelAttributeChangeRequest, HandlerChainService, HandlerChainServicesRegistry, HandlerSourceType, HandlersOrderComparer, HttpClientService, ImplementUsingHandlerChain, InterfaceDesignerItemRegistrationConfig, InterfaceDesignerItemRegistry, InternalRequestHandlerRegistry, InternalRequestHandlerRegistryType, LazyModuleRef, LazyModulesManager, LicenseService, LocalizableValue, MaskService, MessageChannelService, MethodInvokeRequest, Model, PkgTopology, RemoteEntriesRegistry, RemoteEntryType, RequestHandlerRegistryService, RequestRegistryService, RightsService, SysSetting, SysSettingValue, SysSettingsService, SysValuesService, VIEW_ELEMENT_DEFAULT_HEIGHT, ValidatorMapValue, ValidatorRegistry, ViewElementDataGroupType, ViewElementGroupType, ViewElementProperty, ViewElementRegistry, ViewElementRenderStrategy, ViewElementReuseStrategy, _from, applyLocalizeMetadataFn, bootstrapCrtModule, bootstrapCrtModuleHandlerChainServices, bootstrappedCrtModules, callOnContextCreateHooks, callOnContextDestroyHooks, callOnContextUpdateHooks, checkCrtTypeNamePascalCase, checkIfTypeRegistered, checkOnlyOneRegistration, checkTypeNameFormat, checkTypeNamePascalCase, crtInjectPrefix, crtInputPrefix, crtOutputPrefix, crtValidationInputPrefix, defineRenderConfig, designTimeViewElementRegistryKey, getConverterMetadata, getCrtInputsMetadata, getCrtOutputsMetadata, getCrtValidationInputsMetadata, getDeepModuleDependencies, getDesignTimeViewElementMetadata, getHandlerChainServiceMetadata, getInterfaceDesignerItemMetadata, getModuleMetadata, getRequestHandlerMetadata, getTypeDependencies, getValidatorMetadata, getViewElementMetadata, hasInterfaceDesignerItemMetadata, instantiate, interfaceDesignerItemRegistryKey, isComponentPropertyBindable, localize, matchScopes, objectDeepKeys, registerAngularViewElement, registerViewElement, registryKey, resetGlobals, setConverterMetadata, setDesignTimeViewElementMetadata, setInterfaceDesignerItemMetadata, setModuleMetadata, setRequestHandlerMetadata, setValidatorMetadata, setViewElementMetadata, toAggregationEval, toAggregationEvalType, toAggregationFunction, toAggregationType, toDatePart, toDatePartType, toNumericFunctionType, toOrderDirection, toPascalCase, toSortDirection, toStringFunctionType, validatorRegistryKey, viewElementRegistryKey, ɵBaseRegistry, ɵcheckTypeNameFormat, ɵinstantiate };
|
|
2818
2842
|
//# sourceMappingURL=creatio-devkit-common.mjs.map
|