See Hive Interface Registration for details.
As a reference you can always check the example project (.template-project
or custom-js-4-partners
).
Add or update the following packages:
Please compare with the
package.json
of the latest example projects (.template-project
orcustom-js-4-partners
), on where to add them.
There are two package.json
files: One in the root directory and one per project.
Changes in the root directory should not be required!
Every typing which represents a record-component must be moved inside a hive.d.ts
file.
If the current typings-file only contains such interfaces it can simply be renamed.
Otherwise it's best practice to split them up in at least two files:
This step is done automatically but noted for the sake of completeness.
For every 'Hive typing file' a file is created inside /src/typings-generated-objs/
.
These files should never be modified!
All generated files should be imported and registered at the very beginning.
For easier usage make sure that all your interfaces follow the same naming convention.
E.g.: Identical to component-name, ending with 'Record', beginning with 'I', etc.
import { CmpUtils } from '@combeenation/custom-js-utils';
import HiveCmpItf from './typings-generated-objs/myproject-typings.hive.d-ti';
CfgrUtils.onCfgrReady(() => {
// Example 1: all interfaces match the cmp-name
CmpUtils.registerInterfaceSuite(HiveCmpItf);
// Example 2: all interfaces end with 'Record'
CmpUtils.registerInterfaceSuite(HiveCmpItf, { namePostfix: 'Record' });
// Example: same as Example 1 with one additional mapping ->
// Cmp 'SpecialCmp' uses Interface 'ProductRecord'
CmpUtils.registerInterfaceSuite(HiveCmpItf, {
mappings: {
'SpecialCmp': HiveCmpItf.ProductRecord
}
});
// YOUR CODE
}
If there are special cases like multiple components using the same interface, it's possible to configure this as well.
For details see CmpUtils.registerInterfaceSuite and its options Cbn.CJS.CmpInterfaceSuiteOptions.
Test all features of the project and check for any errors in the Console of your DevTools.
Generated using TypeDoc