@creatio-devkit/common 0.820.2 → 0.821.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 +3 -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/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/view-element-registry/view-element-registry.mjs +1 -1
- package/esm2022/lib/internal/utils/metadata-utils.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/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 +518 -503
- package/fesm2022/creatio-devkit-common.mjs.map +1 -1
- package/index.d.ts +56 -7
- 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
|
*/
|
|
@@ -1430,6 +1417,77 @@ class ChatMessageTypeRegistry extends ɵBaseRegistry {
|
|
|
1430
1417
|
}
|
|
1431
1418
|
}
|
|
1432
1419
|
|
|
1420
|
+
/**
|
|
1421
|
+
* @public
|
|
1422
|
+
* @description Function allows to register user-defined component as view element in Creatio platform.
|
|
1423
|
+
* @param config - registration config. {@link ViewElementRegistrationConfig}
|
|
1424
|
+
* @example
|
|
1425
|
+
* sdk.registerViewElement({
|
|
1426
|
+
* type: 'usr.Timeline',
|
|
1427
|
+
* selector: 'usr-timeline',
|
|
1428
|
+
* inputs: {
|
|
1429
|
+
* primaryColumnValue: {},
|
|
1430
|
+
* cardSchemaName: {},
|
|
1431
|
+
* entitySchemaName: {}
|
|
1432
|
+
* }
|
|
1433
|
+
* });
|
|
1434
|
+
*/
|
|
1435
|
+
function registerViewElement(config) {
|
|
1436
|
+
ViewElementRegistry.validate(config);
|
|
1437
|
+
ViewElementRegistry.register(config);
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
/**
|
|
1441
|
+
* @internal
|
|
1442
|
+
* @description Function allows to register angular component as view element in Creatio platform.
|
|
1443
|
+
*/
|
|
1444
|
+
function registerAngularViewElement(config, typeRef) {
|
|
1445
|
+
ViewElementRegistry.validate(config);
|
|
1446
|
+
ViewElementRegistry.register({
|
|
1447
|
+
...config,
|
|
1448
|
+
typeRef,
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
/**
|
|
1453
|
+
* @internal
|
|
1454
|
+
*/
|
|
1455
|
+
class LazyModuleRef {
|
|
1456
|
+
get typeRef() {
|
|
1457
|
+
return this._typeRef;
|
|
1458
|
+
}
|
|
1459
|
+
constructor(_metadata, _bootstrapFn,
|
|
1460
|
+
/** Name of source build ('host' or remote name) */
|
|
1461
|
+
sourceName) {
|
|
1462
|
+
this._metadata = _metadata;
|
|
1463
|
+
this._bootstrapFn = _bootstrapFn;
|
|
1464
|
+
this.sourceName = sourceName;
|
|
1465
|
+
}
|
|
1466
|
+
loadAndBootstrap() {
|
|
1467
|
+
if (!this._modulePromise) {
|
|
1468
|
+
this._modulePromise = this._metadata.load().then((type) => {
|
|
1469
|
+
this._typeRef = type;
|
|
1470
|
+
this._bootstrapFn(type);
|
|
1471
|
+
return type;
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
return this._modulePromise;
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
/**
|
|
1479
|
+
* @internal
|
|
1480
|
+
*/
|
|
1481
|
+
function objectDeepKeys(obj) {
|
|
1482
|
+
if (obj === null || typeof obj !== 'object') {
|
|
1483
|
+
return [];
|
|
1484
|
+
}
|
|
1485
|
+
return Object.keys(obj)
|
|
1486
|
+
.filter((key) => obj[key] instanceof Object)
|
|
1487
|
+
.map((key) => objectDeepKeys(obj[key]).map((k) => [key, ...k]))
|
|
1488
|
+
.reduce((x, y) => [...x, ...y], Object.keys(obj).map((x) => [x]));
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1433
1491
|
/**
|
|
1434
1492
|
* @internal
|
|
1435
1493
|
*/
|
|
@@ -1540,17 +1598,19 @@ var ViewElementReuseStrategy;
|
|
|
1540
1598
|
})(ViewElementReuseStrategy || (ViewElementReuseStrategy = {}));
|
|
1541
1599
|
|
|
1542
1600
|
/**
|
|
1543
|
-
* @
|
|
1601
|
+
* @public
|
|
1544
1602
|
* @description Render strategy for view element.
|
|
1545
1603
|
*/
|
|
1546
1604
|
var ViewElementRenderStrategy;
|
|
1547
1605
|
(function (ViewElementRenderStrategy) {
|
|
1548
1606
|
/**
|
|
1549
1607
|
* @description Default render strategy.
|
|
1608
|
+
* The element is rendered immediately.
|
|
1550
1609
|
*/
|
|
1551
1610
|
ViewElementRenderStrategy["Default"] = "default";
|
|
1552
1611
|
/**
|
|
1553
1612
|
* @description On viewport render strategy.
|
|
1613
|
+
* The element is rendered only when it becomes visible in the viewport.
|
|
1554
1614
|
*/
|
|
1555
1615
|
ViewElementRenderStrategy["OnViewport"] = "on-viewport";
|
|
1556
1616
|
})(ViewElementRenderStrategy || (ViewElementRenderStrategy = {}));
|
|
@@ -1639,424 +1699,88 @@ function applyLocalizeMetadataFn(obj, localizeMetadata) {
|
|
|
1639
1699
|
/**
|
|
1640
1700
|
* @internal
|
|
1641
1701
|
*/
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
const registrationConfig = {
|
|
1647
|
-
...config,
|
|
1648
|
-
typeRef: type,
|
|
1649
|
-
inputs,
|
|
1650
|
-
};
|
|
1651
|
-
setDesignTimeViewElementMetadata(registrationConfig, type);
|
|
1652
|
-
};
|
|
1702
|
+
function checkRemoteName(remoteName) {
|
|
1703
|
+
if (!RemoteEntriesRegistry.items.has(remoteName)) {
|
|
1704
|
+
throw new Error(`Remote entry with name '${remoteName}' does not exist`);
|
|
1705
|
+
}
|
|
1653
1706
|
}
|
|
1654
|
-
|
|
1655
1707
|
/**
|
|
1656
1708
|
* @internal
|
|
1657
|
-
* @hostPublicApi
|
|
1658
1709
|
*/
|
|
1659
|
-
|
|
1710
|
+
function resistantForEach(items, callback) {
|
|
1711
|
+
items.forEach((item) => {
|
|
1712
|
+
try {
|
|
1713
|
+
callback(item);
|
|
1714
|
+
}
|
|
1715
|
+
catch (error) {
|
|
1716
|
+
console.error(error);
|
|
1717
|
+
}
|
|
1718
|
+
});
|
|
1660
1719
|
}
|
|
1661
|
-
|
|
1662
1720
|
/**
|
|
1663
1721
|
* @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
1722
|
*/
|
|
1670
|
-
|
|
1723
|
+
function registerViewElements(types) {
|
|
1724
|
+
resistantForEach(types, (type) => {
|
|
1725
|
+
const registrationConfig = getViewElementMetadata(type);
|
|
1726
|
+
ViewElementRegistry.validate(registrationConfig);
|
|
1727
|
+
ViewElementRegistry.register(registrationConfig);
|
|
1728
|
+
});
|
|
1671
1729
|
}
|
|
1672
|
-
|
|
1673
|
-
/**
|
|
1674
|
-
* @internal
|
|
1675
|
-
*/
|
|
1676
|
-
var RemoteEntryType;
|
|
1677
|
-
(function (RemoteEntryType) {
|
|
1678
|
-
RemoteEntryType["Script"] = "script";
|
|
1679
|
-
RemoteEntryType["Module"] = "module";
|
|
1680
|
-
})(RemoteEntryType || (RemoteEntryType = {}));
|
|
1681
|
-
|
|
1682
1730
|
/**
|
|
1683
1731
|
* @internal
|
|
1684
1732
|
*/
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
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
|
-
});
|
|
1703
|
-
}
|
|
1704
|
-
return this._modulePromise;
|
|
1705
|
-
}
|
|
1733
|
+
function registerLazyViewElements(configs, lazyModuleRef) {
|
|
1734
|
+
resistantForEach(configs, (config) => {
|
|
1735
|
+
const registryItem = { ...config, lazy: true, lazyModuleRef };
|
|
1736
|
+
ViewElementRegistry.validate(registryItem);
|
|
1737
|
+
ViewElementRegistry.register(registryItem);
|
|
1738
|
+
});
|
|
1706
1739
|
}
|
|
1707
|
-
|
|
1708
1740
|
/**
|
|
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
|
-
* }
|
|
1741
|
+
* @internal
|
|
1718
1742
|
*/
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
config = {
|
|
1724
|
-
propertyBindable: false,
|
|
1725
|
-
};
|
|
1743
|
+
function registerInterfaceDesignerItems(types, localizeFn) {
|
|
1744
|
+
resistantForEach(types, (type) => {
|
|
1745
|
+
if (!hasInterfaceDesignerItemMetadata(type)) {
|
|
1746
|
+
return;
|
|
1726
1747
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1748
|
+
let config = getInterfaceDesignerItemMetadata(type);
|
|
1749
|
+
config = applyLocalizeMetadataFn(config, localizeFn);
|
|
1750
|
+
const viewElementMetadata = getViewElementMetadata(type);
|
|
1751
|
+
config.type = viewElementMetadata.type;
|
|
1752
|
+
InterfaceDesignerItemRegistry.validate(config);
|
|
1753
|
+
InterfaceDesignerItemRegistry.register(config);
|
|
1754
|
+
});
|
|
1729
1755
|
}
|
|
1730
|
-
|
|
1731
1756
|
/**
|
|
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
|
-
* }
|
|
1757
|
+
* @internal
|
|
1740
1758
|
*/
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1759
|
+
function registerDesignTimeViewElements(types) {
|
|
1760
|
+
resistantForEach(types, (type) => {
|
|
1761
|
+
const registrationConfig = getDesignTimeViewElementMetadata(type);
|
|
1762
|
+
DesignTimeViewElementRegistry.validate(registrationConfig);
|
|
1763
|
+
DesignTimeViewElementRegistry.register(registrationConfig);
|
|
1764
|
+
});
|
|
1746
1765
|
}
|
|
1747
|
-
|
|
1748
1766
|
/**
|
|
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
|
-
* }
|
|
1767
|
+
* @internal
|
|
1765
1768
|
*/
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
const outputs = getCrtOutputsMetadata(type);
|
|
1782
|
-
const validationInputs = getCrtValidationInputsMetadata(type);
|
|
1783
|
-
const baseRegistrationConfig = {
|
|
1784
|
-
...config,
|
|
1785
|
-
inputs,
|
|
1786
|
-
outputs,
|
|
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,
|
|
1795
|
-
};
|
|
1796
|
-
setViewElementMetadata(registrationConfig, type);
|
|
1797
|
-
};
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
/**
|
|
1801
|
-
* @internal
|
|
1802
|
-
*/
|
|
1803
|
-
function CrtModule(moduleDefinition) {
|
|
1804
|
-
return (type) => setModuleMetadata(moduleDefinition, type);
|
|
1805
|
-
}
|
|
1806
|
-
|
|
1807
|
-
/**
|
|
1808
|
-
* @internal
|
|
1809
|
-
*/
|
|
1810
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1811
|
-
function CrtInterfaceDesignerItem(config) {
|
|
1812
|
-
function _applyTypeCaption() {
|
|
1813
|
-
if (!config.typeCaption && config.toolbarConfig) {
|
|
1814
|
-
const toolbarConfig = Array.isArray(config.toolbarConfig)
|
|
1815
|
-
? config.toolbarConfig[0]
|
|
1816
|
-
: config.toolbarConfig;
|
|
1817
|
-
config.typeCaption = toolbarConfig.caption;
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
return function (type) {
|
|
1821
|
-
config.typeRef = type;
|
|
1822
|
-
config.viewElementGroupType ??= ViewElementGroupType.CustomElements;
|
|
1823
|
-
_applyTypeCaption();
|
|
1824
|
-
setInterfaceDesignerItemMetadata(config, type);
|
|
1825
|
-
};
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
/**
|
|
1829
|
-
* @public
|
|
1830
|
-
* @description
|
|
1831
|
-
* Constructor parameter decorator.
|
|
1832
|
-
* Mark parameter as dependency that should be obtained by token.
|
|
1833
|
-
* @param token - token by which the dependency instance will be obtained
|
|
1834
|
-
* @example
|
|
1835
|
-
* class MyHandler {
|
|
1836
|
-
* constructor(@CrtInject(USER_NAME_TOKEN) userName: string) {}
|
|
1837
|
-
* }
|
|
1838
|
-
*/
|
|
1839
|
-
function CrtInject(token) {
|
|
1840
|
-
return function (target, paramKey, paramIndex) {
|
|
1841
|
-
Reflect.defineMetadata(crtInjectPrefix + paramIndex, token, target);
|
|
1842
|
-
};
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
/**
|
|
1846
|
-
* @internal
|
|
1847
|
-
*/
|
|
1848
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1849
|
-
function CrtValidator(config) {
|
|
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');
|
|
1859
|
-
const registrationConfig = {
|
|
1860
|
-
...config,
|
|
1861
|
-
typeRef: type,
|
|
1862
|
-
};
|
|
1863
|
-
setValidatorMetadata(registrationConfig, type);
|
|
1864
|
-
};
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
/**
|
|
1868
|
-
* @internal
|
|
1869
|
-
*/
|
|
1870
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1871
|
-
function CrtRequestHandler(config) {
|
|
1872
|
-
if (!config) {
|
|
1873
|
-
return (type) => {
|
|
1874
|
-
// the decorator won't do anything by itself,
|
|
1875
|
-
// but will be used by the compiler to generate class metadata,
|
|
1876
|
-
// which is required for DI
|
|
1877
|
-
};
|
|
1878
|
-
}
|
|
1879
|
-
return function (type) {
|
|
1880
|
-
checkTypeNameFormat(config.type, 'RequestHandlerTypeName');
|
|
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) => { };
|
|
1893
|
-
}
|
|
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
|
-
}
|
|
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
|
-
/**
|
|
1935
|
-
* @internal
|
|
1936
|
-
*/
|
|
1937
|
-
var ViewElementProperty;
|
|
1938
|
-
(function (ViewElementProperty) {
|
|
1939
|
-
ViewElementProperty["Readonly"] = "READONLY_PROPERTY";
|
|
1940
|
-
ViewElementProperty["Disabled"] = "DISABLED_PROPERTY";
|
|
1941
|
-
})(ViewElementProperty || (ViewElementProperty = {}));
|
|
1942
|
-
|
|
1943
|
-
/**
|
|
1944
|
-
* @public
|
|
1945
|
-
* @description Function allows to register user-defined component as view element in Creatio platform.
|
|
1946
|
-
* @param config - registration config. {@link ViewElementRegistrationConfig}
|
|
1947
|
-
* @example
|
|
1948
|
-
* sdk.registerViewElement({
|
|
1949
|
-
* type: 'usr.Timeline',
|
|
1950
|
-
* selector: 'usr-timeline',
|
|
1951
|
-
* inputs: {
|
|
1952
|
-
* primaryColumnValue: {},
|
|
1953
|
-
* cardSchemaName: {},
|
|
1954
|
-
* entitySchemaName: {}
|
|
1955
|
-
* }
|
|
1956
|
-
* });
|
|
1957
|
-
*/
|
|
1958
|
-
function registerViewElement(config) {
|
|
1959
|
-
ViewElementRegistry.validate(config);
|
|
1960
|
-
ViewElementRegistry.register(config);
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
/**
|
|
1964
|
-
* @internal
|
|
1965
|
-
* @description Function allows to register angular component as view element in Creatio platform.
|
|
1966
|
-
*/
|
|
1967
|
-
function registerAngularViewElement(config, typeRef) {
|
|
1968
|
-
ViewElementRegistry.validate(config);
|
|
1969
|
-
ViewElementRegistry.register({
|
|
1970
|
-
...config,
|
|
1971
|
-
typeRef,
|
|
1972
|
-
});
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
/**
|
|
1976
|
-
* @internal
|
|
1977
|
-
*/
|
|
1978
|
-
function checkRemoteName(remoteName) {
|
|
1979
|
-
if (!RemoteEntriesRegistry.items.has(remoteName)) {
|
|
1980
|
-
throw new Error(`Remote entry with name '${remoteName}' does not exist`);
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
/**
|
|
1984
|
-
* @internal
|
|
1985
|
-
*/
|
|
1986
|
-
function resistantForEach(items, callback) {
|
|
1987
|
-
items.forEach((item) => {
|
|
1988
|
-
try {
|
|
1989
|
-
callback(item);
|
|
1990
|
-
}
|
|
1991
|
-
catch (error) {
|
|
1992
|
-
console.error(error);
|
|
1993
|
-
}
|
|
1994
|
-
});
|
|
1995
|
-
}
|
|
1996
|
-
/**
|
|
1997
|
-
* @internal
|
|
1998
|
-
*/
|
|
1999
|
-
function registerViewElements(types) {
|
|
2000
|
-
resistantForEach(types, (type) => {
|
|
2001
|
-
const registrationConfig = getViewElementMetadata(type);
|
|
2002
|
-
ViewElementRegistry.validate(registrationConfig);
|
|
2003
|
-
ViewElementRegistry.register(registrationConfig);
|
|
2004
|
-
});
|
|
2005
|
-
}
|
|
2006
|
-
/**
|
|
2007
|
-
* @internal
|
|
2008
|
-
*/
|
|
2009
|
-
function registerLazyViewElements(configs, lazyModuleRef) {
|
|
2010
|
-
resistantForEach(configs, (config) => {
|
|
2011
|
-
const registryItem = { ...config, lazy: true, lazyModuleRef };
|
|
2012
|
-
ViewElementRegistry.validate(registryItem);
|
|
2013
|
-
ViewElementRegistry.register(registryItem);
|
|
2014
|
-
});
|
|
2015
|
-
}
|
|
2016
|
-
/**
|
|
2017
|
-
* @internal
|
|
2018
|
-
*/
|
|
2019
|
-
function registerInterfaceDesignerItems(types, localizeFn) {
|
|
2020
|
-
resistantForEach(types, (type) => {
|
|
2021
|
-
if (!hasInterfaceDesignerItemMetadata(type)) {
|
|
2022
|
-
return;
|
|
2023
|
-
}
|
|
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
|
-
});
|
|
2031
|
-
}
|
|
2032
|
-
/**
|
|
2033
|
-
* @internal
|
|
2034
|
-
*/
|
|
2035
|
-
function registerDesignTimeViewElements(types) {
|
|
2036
|
-
resistantForEach(types, (type) => {
|
|
2037
|
-
const registrationConfig = getDesignTimeViewElementMetadata(type);
|
|
2038
|
-
DesignTimeViewElementRegistry.validate(registrationConfig);
|
|
2039
|
-
DesignTimeViewElementRegistry.register(registrationConfig);
|
|
2040
|
-
});
|
|
2041
|
-
}
|
|
2042
|
-
/**
|
|
2043
|
-
* @internal
|
|
2044
|
-
*/
|
|
2045
|
-
function registerValidators(types, options) {
|
|
2046
|
-
resistantForEach(types, (type) => {
|
|
2047
|
-
const metadata = getValidatorMetadata(type);
|
|
2048
|
-
const registrationConfig = {
|
|
2049
|
-
...metadata,
|
|
2050
|
-
instantiate: function (injectionContext) {
|
|
2051
|
-
const resolveDependency = options?.resolveDependency
|
|
2052
|
-
? (token) => options.resolveDependency(token, injectionContext)
|
|
2053
|
-
: null;
|
|
2054
|
-
return instantiate(type, resolveDependency);
|
|
2055
|
-
},
|
|
2056
|
-
};
|
|
2057
|
-
ValidatorRegistry.validate(registrationConfig);
|
|
2058
|
-
ValidatorRegistry.register(registrationConfig);
|
|
2059
|
-
});
|
|
1769
|
+
function registerValidators(types, options) {
|
|
1770
|
+
resistantForEach(types, (type) => {
|
|
1771
|
+
const metadata = getValidatorMetadata(type);
|
|
1772
|
+
const registrationConfig = {
|
|
1773
|
+
...metadata,
|
|
1774
|
+
instantiate: function (injectionContext) {
|
|
1775
|
+
const resolveDependency = options?.resolveDependency
|
|
1776
|
+
? (token) => options.resolveDependency(token, injectionContext)
|
|
1777
|
+
: null;
|
|
1778
|
+
return instantiate(type, resolveDependency);
|
|
1779
|
+
},
|
|
1780
|
+
};
|
|
1781
|
+
ValidatorRegistry.validate(registrationConfig);
|
|
1782
|
+
ValidatorRegistry.register(registrationConfig);
|
|
1783
|
+
});
|
|
2060
1784
|
}
|
|
2061
1785
|
/**
|
|
2062
1786
|
* @internal
|
|
@@ -2231,130 +1955,421 @@ function bootstrapDefaultCrtModule(name, type, options, root) {
|
|
|
2231
1955
|
/**
|
|
2232
1956
|
* @internal
|
|
2233
1957
|
*/
|
|
2234
|
-
function bootstrapPredefinedModules(name, type, options) {
|
|
2235
|
-
const modulePrefix = 'module:';
|
|
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
|
-
}
|
|
1958
|
+
function bootstrapPredefinedModules(name, type, options) {
|
|
1959
|
+
const modulePrefix = 'module:';
|
|
1960
|
+
const metadataKeys = Reflect.getOwnMetadataKeys(type);
|
|
1961
|
+
for (const key of metadataKeys) {
|
|
1962
|
+
if (typeof key === 'string' && key.startsWith(modulePrefix)) {
|
|
1963
|
+
const moduleType = key.substring(modulePrefix.length);
|
|
1964
|
+
const predefinedBootstrapper = Reflect.getOwnMetadata('moduleBootstrapper:' + moduleType, type);
|
|
1965
|
+
try {
|
|
1966
|
+
predefinedBootstrapper(name, type, options);
|
|
1967
|
+
}
|
|
1968
|
+
catch (error) {
|
|
1969
|
+
console.error(error);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
/**
|
|
1975
|
+
* @internal
|
|
1976
|
+
*/
|
|
1977
|
+
function bootstrapCrtModule(...args) {
|
|
1978
|
+
const name = typeof args[0] === 'string' ? args.shift() : undefined;
|
|
1979
|
+
const type = args[0];
|
|
1980
|
+
const options = args[1] ?? {};
|
|
1981
|
+
options.moduleType ??= 'remote';
|
|
1982
|
+
if (name) {
|
|
1983
|
+
if (options.moduleType === 'remote') {
|
|
1984
|
+
checkRemoteName(name);
|
|
1985
|
+
}
|
|
1986
|
+
else {
|
|
1987
|
+
throw new Error('Host module cannot have name');
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
bootstrapDefaultCrtModule(name, type, options, true);
|
|
1991
|
+
bootstrapPredefinedModules(name, type, options);
|
|
1992
|
+
if (options.moduleType === 'remote') {
|
|
1993
|
+
BootstrapNotifier.instance.notify(type);
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
/**
|
|
1998
|
+
* @public
|
|
1999
|
+
* @description Use this function in decorators to indicate that a value should be localized.
|
|
2000
|
+
* Note that the "localizeMetadata" bootstrap option should be provided,
|
|
2001
|
+
* otherwise the value cannot be localized.
|
|
2002
|
+
*
|
|
2003
|
+
* @example
|
|
2004
|
+
*
|
|
2005
|
+
* ### Using 'localize' in decorator
|
|
2006
|
+
* ```ts
|
|
2007
|
+
* @CrtInterfaceDesignerItem({
|
|
2008
|
+
* toolbarConfig: {
|
|
2009
|
+
* caption: localize('MyElement.Caption')
|
|
2010
|
+
* }
|
|
2011
|
+
* })
|
|
2012
|
+
* class MyElement {}
|
|
2013
|
+
* ```
|
|
2014
|
+
* ### Passing 'localizeMetadata' bootstrap option
|
|
2015
|
+
* ```ts
|
|
2016
|
+
* bootstrapCrtModule(MyModule, {
|
|
2017
|
+
* localizeMetadata: (key: string) => thirdPartyTranslateService.translate(key)
|
|
2018
|
+
* });
|
|
2019
|
+
* ```
|
|
2020
|
+
*/
|
|
2021
|
+
function localize(key) {
|
|
2022
|
+
return new LocalizableValue(key);
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
/**
|
|
2026
|
+
* @internal
|
|
2027
|
+
*/
|
|
2028
|
+
function registerHandlerChainServices(types) {
|
|
2029
|
+
types?.forEach((type) => {
|
|
2030
|
+
const registrationConfig = getHandlerChainServiceMetadata(type);
|
|
2031
|
+
HandlerChainServicesRegistry.register(registrationConfig);
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
/**
|
|
2035
|
+
* @internal
|
|
2036
|
+
*/
|
|
2037
|
+
function _bootstrapCrtModuleHandlerChainServices(type) {
|
|
2038
|
+
const moduleDefinition = getModuleMetadata(type);
|
|
2039
|
+
if (moduleDefinition.handlerChainServices) {
|
|
2040
|
+
registerHandlerChainServices(moduleDefinition.handlerChainServices);
|
|
2041
|
+
}
|
|
2042
|
+
moduleDefinition.includes?.forEach((t) => {
|
|
2043
|
+
if (typeof t === 'function') {
|
|
2044
|
+
_bootstrapCrtModuleHandlerChainServices(t);
|
|
2045
|
+
}
|
|
2046
|
+
});
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* @internal
|
|
2050
|
+
*/
|
|
2051
|
+
function bootstrapCrtModuleHandlerChainServices(type) {
|
|
2052
|
+
_bootstrapCrtModuleHandlerChainServices(type);
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
/**
|
|
2056
|
+
* @internal
|
|
2057
|
+
* Clears global registries, resets state of global services.
|
|
2058
|
+
* Can be used in unit tests to clear global registries after bootstrapping module.
|
|
2059
|
+
* @example
|
|
2060
|
+
* beforeEach(() => {
|
|
2061
|
+
* bootstrapCrtModule('test', TestModule);
|
|
2062
|
+
* });
|
|
2063
|
+
*
|
|
2064
|
+
* afterEach(() => {
|
|
2065
|
+
* resetGlobals();
|
|
2066
|
+
* });
|
|
2067
|
+
*/
|
|
2068
|
+
function resetGlobals() {
|
|
2069
|
+
bootstrappedCrtModules.clear();
|
|
2070
|
+
ViewElementRegistry.viewElements.clear();
|
|
2071
|
+
InternalRequestHandlerRegistry.clear();
|
|
2072
|
+
HandlerChainService.instance.clear();
|
|
2073
|
+
ValidatorRegistry.items.clear();
|
|
2074
|
+
ConverterRegistry.clear();
|
|
2075
|
+
RemoteEntriesRegistry.items.clear();
|
|
2076
|
+
PkgTopology.items.clear();
|
|
2077
|
+
LazyModulesManager.instance.clear();
|
|
2078
|
+
LazyModulesManager.instance.lazyLoadingDisabled = false;
|
|
2079
|
+
DesignTimeViewElementRegistry.infos.clear();
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
/**
|
|
2083
|
+
* @internal
|
|
2084
|
+
* @description Defines render configuration for view element.
|
|
2085
|
+
*/
|
|
2086
|
+
function defineRenderConfig(config) {
|
|
2087
|
+
if (isEmpty(config.renderStrategy) && 'placeholderSize' in config) {
|
|
2088
|
+
config.renderStrategy = ViewElementRenderStrategy.OnViewport;
|
|
2089
|
+
}
|
|
2090
|
+
if (config.renderStrategy === ViewElementRenderStrategy.OnViewport && !config.placeholderSize) {
|
|
2091
|
+
config.placeholderSize = { height: VIEW_ELEMENT_DEFAULT_HEIGHT };
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* @internal
|
|
2097
|
+
*/
|
|
2098
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2099
|
+
function CrtDesignTimeViewElement(config) {
|
|
2100
|
+
return function (type) {
|
|
2101
|
+
const inputs = getCrtInputsMetadata(type);
|
|
2102
|
+
const registrationConfig = {
|
|
2103
|
+
...config,
|
|
2104
|
+
typeRef: type,
|
|
2105
|
+
inputs,
|
|
2106
|
+
};
|
|
2107
|
+
defineRenderConfig(registrationConfig);
|
|
2108
|
+
setDesignTimeViewElementMetadata(registrationConfig, type);
|
|
2109
|
+
};
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
/**
|
|
2113
|
+
* @internal
|
|
2114
|
+
* @hostPublicApi
|
|
2115
|
+
*/
|
|
2116
|
+
class InterfaceDesignerItemRegistrationConfig {
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
/**
|
|
2120
|
+
* @internal
|
|
2121
|
+
* @class MethodInvokeRequest
|
|
2122
|
+
* @description Definition of invoke method request.
|
|
2123
|
+
* @extends {ɵBaseRequest} {@link ɵBaseRequest}
|
|
2124
|
+
* @property {string} method - method name.
|
|
2125
|
+
* @property {unknown[]} args - arguments passing to the method.
|
|
2126
|
+
*/
|
|
2127
|
+
class MethodInvokeRequest extends _BaseRequest {
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
/**
|
|
2131
|
+
* @internal
|
|
2132
|
+
*/
|
|
2133
|
+
var RemoteEntryType;
|
|
2134
|
+
(function (RemoteEntryType) {
|
|
2135
|
+
RemoteEntryType["Script"] = "script";
|
|
2136
|
+
RemoteEntryType["Module"] = "module";
|
|
2137
|
+
})(RemoteEntryType || (RemoteEntryType = {}));
|
|
2138
|
+
|
|
2139
|
+
/**
|
|
2140
|
+
* @public
|
|
2141
|
+
* @description Creatio platform interacts with input's of user-defined component through CrtInput decorator.
|
|
2142
|
+
* @param config {@link CrtInputRegistrationConfig}
|
|
2143
|
+
*
|
|
2144
|
+
* @example
|
|
2145
|
+
* export class AppComponent {
|
|
2146
|
+
* @CrtInput()
|
|
2147
|
+
* public value!: string;
|
|
2148
|
+
* }
|
|
2149
|
+
*/
|
|
2150
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2151
|
+
function CrtInput(config) {
|
|
2152
|
+
return function (target, propertyKey) {
|
|
2153
|
+
if (!config) {
|
|
2154
|
+
config = {
|
|
2155
|
+
propertyBindable: false,
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
2158
|
+
Reflect.defineMetadata(crtInputPrefix + propertyKey.toString(), config, target.constructor);
|
|
2159
|
+
};
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
/**
|
|
2163
|
+
* @public
|
|
2164
|
+
* @description User-defined components could notify Creatio platform about changes through CrtOutput decorator.
|
|
2165
|
+
* @example
|
|
2166
|
+
* export class AppComponent {
|
|
2167
|
+
* @Input()
|
|
2168
|
+
* @CrtOutput()
|
|
2169
|
+
* public valueChange;
|
|
2170
|
+
* }
|
|
2171
|
+
*/
|
|
2172
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2173
|
+
function CrtOutput() {
|
|
2174
|
+
return function (target, propertyKey) {
|
|
2175
|
+
Reflect.defineMetadata(crtOutputPrefix + propertyKey.toString(), {}, target.constructor);
|
|
2176
|
+
};
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
/**
|
|
2180
|
+
* @public
|
|
2181
|
+
* @description User-defined components receive validationInfo changes through CrtValidationInput decorator.
|
|
2182
|
+
* Make sure you have defined input for every validationInfo input.
|
|
2183
|
+
* To properly declare validationInfo field:
|
|
2184
|
+
* 1. Declare input field inside inputs section. For example `value`
|
|
2185
|
+
* 2. In validationInputs section declare same field which ends with ValidationInfo.
|
|
2186
|
+
* For previous example `valueValidationInfo`
|
|
2187
|
+
*
|
|
2188
|
+
* @example
|
|
2189
|
+
* export class AppComponent {
|
|
2190
|
+
* @CrtInput()
|
|
2191
|
+
public value;
|
|
2192
|
+
*
|
|
2193
|
+
* @CrtValidationInput()
|
|
2194
|
+
* public valueValidationInfo;
|
|
2195
|
+
* }
|
|
2196
|
+
*/
|
|
2197
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2198
|
+
function CrtValidationInput() {
|
|
2199
|
+
return function (target, propertyKey) {
|
|
2200
|
+
Reflect.defineMetadata(crtValidationInputPrefix + propertyKey.toString(), {}, target.constructor);
|
|
2201
|
+
};
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
/**
|
|
2205
|
+
* @internal
|
|
2206
|
+
*/
|
|
2207
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2208
|
+
function CrtViewElement(config) {
|
|
2209
|
+
return function (type) {
|
|
2210
|
+
checkTypeNamePascalCase(config.type);
|
|
2211
|
+
const inputs = getCrtInputsMetadata(type);
|
|
2212
|
+
const outputs = getCrtOutputsMetadata(type);
|
|
2213
|
+
const validationInputs = getCrtValidationInputsMetadata(type);
|
|
2214
|
+
const baseRegistrationConfig = {
|
|
2215
|
+
...config,
|
|
2216
|
+
inputs,
|
|
2217
|
+
outputs,
|
|
2218
|
+
validationInputs,
|
|
2219
|
+
};
|
|
2220
|
+
const registrationConfig = 'selector' in config
|
|
2221
|
+
? { ...baseRegistrationConfig, selector: config.selector }
|
|
2222
|
+
: { ...baseRegistrationConfig, typeRef: type };
|
|
2223
|
+
registrationConfig.reuseStrategy = config?.reuseStrategy ?? ViewElementReuseStrategy.Rerender;
|
|
2224
|
+
defineRenderConfig(registrationConfig);
|
|
2225
|
+
setViewElementMetadata(registrationConfig, type);
|
|
2226
|
+
};
|
|
2249
2227
|
}
|
|
2228
|
+
|
|
2250
2229
|
/**
|
|
2251
2230
|
* @internal
|
|
2252
2231
|
*/
|
|
2253
|
-
function
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2232
|
+
function CrtModule(moduleDefinition) {
|
|
2233
|
+
return (type) => setModuleMetadata(moduleDefinition, type);
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
/**
|
|
2237
|
+
* @internal
|
|
2238
|
+
*/
|
|
2239
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2240
|
+
function CrtInterfaceDesignerItem(config) {
|
|
2241
|
+
function _applyTypeCaption() {
|
|
2242
|
+
if (!config.typeCaption && config.toolbarConfig) {
|
|
2243
|
+
const toolbarConfig = Array.isArray(config.toolbarConfig)
|
|
2244
|
+
? config.toolbarConfig[0]
|
|
2245
|
+
: config.toolbarConfig;
|
|
2246
|
+
config.typeCaption = toolbarConfig.caption;
|
|
2264
2247
|
}
|
|
2265
2248
|
}
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2249
|
+
return function (type) {
|
|
2250
|
+
config.typeRef = type;
|
|
2251
|
+
config.viewElementGroupType ??= ViewElementGroupType.CustomElements;
|
|
2252
|
+
_applyTypeCaption();
|
|
2253
|
+
defineRenderConfig(config);
|
|
2254
|
+
setInterfaceDesignerItemMetadata(config, type);
|
|
2255
|
+
};
|
|
2271
2256
|
}
|
|
2272
2257
|
|
|
2273
2258
|
/**
|
|
2274
2259
|
* @public
|
|
2275
|
-
* @description
|
|
2276
|
-
*
|
|
2277
|
-
*
|
|
2278
|
-
*
|
|
2260
|
+
* @description
|
|
2261
|
+
* Constructor parameter decorator.
|
|
2262
|
+
* Mark parameter as dependency that should be obtained by token.
|
|
2263
|
+
* @param token - token by which the dependency instance will be obtained
|
|
2279
2264
|
* @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
|
-
* ```
|
|
2265
|
+
* class MyHandler {
|
|
2266
|
+
* constructor(@CrtInject(USER_NAME_TOKEN) userName: string) {}
|
|
2267
|
+
* }
|
|
2296
2268
|
*/
|
|
2297
|
-
function
|
|
2298
|
-
return
|
|
2269
|
+
function CrtInject(token) {
|
|
2270
|
+
return function (target, paramKey, paramIndex) {
|
|
2271
|
+
Reflect.defineMetadata(crtInjectPrefix + paramIndex, token, target);
|
|
2272
|
+
};
|
|
2299
2273
|
}
|
|
2300
2274
|
|
|
2301
2275
|
/**
|
|
2302
2276
|
* @internal
|
|
2303
2277
|
*/
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2278
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2279
|
+
function CrtValidator(config) {
|
|
2280
|
+
if (!config) {
|
|
2281
|
+
return (type) => {
|
|
2282
|
+
// the decorator won't do anything by itself,
|
|
2283
|
+
// but will be used by the compiler to generate class metadata,
|
|
2284
|
+
// which is required for DI
|
|
2285
|
+
};
|
|
2286
|
+
}
|
|
2287
|
+
return function (type) {
|
|
2288
|
+
checkTypeNameFormat(config.type, 'ValidatorTypeName');
|
|
2289
|
+
const registrationConfig = {
|
|
2290
|
+
...config,
|
|
2291
|
+
typeRef: type,
|
|
2292
|
+
};
|
|
2293
|
+
setValidatorMetadata(registrationConfig, type);
|
|
2294
|
+
};
|
|
2309
2295
|
}
|
|
2296
|
+
|
|
2310
2297
|
/**
|
|
2311
2298
|
* @internal
|
|
2312
2299
|
*/
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
if (
|
|
2316
|
-
|
|
2300
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2301
|
+
function CrtRequestHandler(config) {
|
|
2302
|
+
if (!config) {
|
|
2303
|
+
return (type) => {
|
|
2304
|
+
// the decorator won't do anything by itself,
|
|
2305
|
+
// but will be used by the compiler to generate class metadata,
|
|
2306
|
+
// which is required for DI
|
|
2307
|
+
};
|
|
2317
2308
|
}
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
}
|
|
2309
|
+
return function (type) {
|
|
2310
|
+
checkTypeNameFormat(config.type, 'RequestHandlerTypeName');
|
|
2311
|
+
checkCrtTypeNamePascalCase(config.type);
|
|
2312
|
+
setRequestHandlerMetadata(config, type);
|
|
2313
|
+
};
|
|
2323
2314
|
}
|
|
2315
|
+
|
|
2324
2316
|
/**
|
|
2325
2317
|
* @internal
|
|
2326
2318
|
*/
|
|
2327
|
-
|
|
2328
|
-
|
|
2319
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2320
|
+
function CrtConverter(config) {
|
|
2321
|
+
if (!config) {
|
|
2322
|
+
return (type) => { };
|
|
2323
|
+
}
|
|
2324
|
+
return function (typeRef) {
|
|
2325
|
+
const type = typeof config === 'string' ? config : config.type;
|
|
2326
|
+
checkTypeNameFormat(type, 'converterTypeName');
|
|
2327
|
+
const registrationConfig = {
|
|
2328
|
+
type: type,
|
|
2329
|
+
typeRef: typeRef,
|
|
2330
|
+
};
|
|
2331
|
+
setConverterMetadata(registrationConfig, typeRef);
|
|
2332
|
+
};
|
|
2329
2333
|
}
|
|
2330
2334
|
|
|
2331
2335
|
/**
|
|
2332
|
-
* @
|
|
2333
|
-
*
|
|
2334
|
-
*
|
|
2335
|
-
* @example
|
|
2336
|
-
* beforeEach(() => {
|
|
2337
|
-
* bootstrapCrtModule('test', TestModule);
|
|
2338
|
-
* });
|
|
2336
|
+
* @public
|
|
2337
|
+
* @description CrtChatMessageType decorator allows user to register components as a message type in chat.
|
|
2338
|
+
* @param config - registration config. {@link ChatMessageTypeRegistrationConfig}.
|
|
2339
2339
|
*
|
|
2340
|
-
*
|
|
2341
|
-
*
|
|
2342
|
-
*
|
|
2340
|
+
* @example
|
|
2341
|
+
* @CrtChatMessageType({
|
|
2342
|
+
* selector: 'usr-video-message',
|
|
2343
|
+
* messageType: 'video',
|
|
2344
|
+
* })
|
|
2345
|
+
* export class AppComponent { }
|
|
2343
2346
|
*/
|
|
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();
|
|
2347
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2348
|
+
function CrtChatMessageType(config) {
|
|
2349
|
+
return function (type) {
|
|
2350
|
+
ChatMessageTypeRegistry.register(config.messageType, config.selector);
|
|
2351
|
+
};
|
|
2356
2352
|
}
|
|
2357
2353
|
|
|
2354
|
+
/**
|
|
2355
|
+
* @internal
|
|
2356
|
+
*/
|
|
2357
|
+
var DataSourceLoadType;
|
|
2358
|
+
(function (DataSourceLoadType) {
|
|
2359
|
+
DataSourceLoadType["LoadNext"] = "loadNext";
|
|
2360
|
+
DataSourceLoadType["Load"] = "load";
|
|
2361
|
+
DataSourceLoadType["Reload"] = "reload";
|
|
2362
|
+
})(DataSourceLoadType || (DataSourceLoadType = {}));
|
|
2363
|
+
|
|
2364
|
+
/**
|
|
2365
|
+
* @internal
|
|
2366
|
+
*/
|
|
2367
|
+
var ViewElementProperty;
|
|
2368
|
+
(function (ViewElementProperty) {
|
|
2369
|
+
ViewElementProperty["Readonly"] = "READONLY_PROPERTY";
|
|
2370
|
+
ViewElementProperty["Disabled"] = "DISABLED_PROPERTY";
|
|
2371
|
+
})(ViewElementProperty || (ViewElementProperty = {}));
|
|
2372
|
+
|
|
2358
2373
|
/**
|
|
2359
2374
|
* @public
|
|
2360
2375
|
* @abstract
|
|
@@ -2814,5 +2829,5 @@ __decorate([
|
|
|
2814
2829
|
* Generated bundle index. Do not edit.
|
|
2815
2830
|
*/
|
|
2816
2831
|
|
|
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 };
|
|
2832
|
+
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
2833
|
//# sourceMappingURL=creatio-devkit-common.mjs.map
|