PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path."
// [jim] use central ivar, not at-version tag on every single component,
// so we can update the version in one place when branching.
self.jetVersion = env.opts.query.jetVersion;
self.typedefs = [];
self.decorators = undefined;
self.getImportDetails = function(doc){
if (doc.meta && doc.meta.filename && doc.meta.filename.indexOf('/') >=0 && !self.isStylingOrOverview) {
var moduleName ='';
if (doc.ojmodule) {
moduleName = doc.ojmodule.replace(/\"/g,'').replace(/'/g, '');
}
else{
var _tmparr = doc.meta.filename.split('/');
// last element is the js file name, the element before that is the src folder which is the module name
moduleName = _tmparr[_tmparr.length - 2];
}
if(!moduleName || moduleName==='none' || moduleName===''){
debugger;
}
var importSample = '';
if(self.isCustomElement){
if(!doc.virtual){//avoid abstract components
importSample = '//To typecheck the element APIs, import as below.
';
let custElemName = `${doc.domInterface}`;
if (doc.pack){
moduleName = doc.pack + '/' + moduleName;
}
importSample = importSample + 'import {'+ custElemName + '} from "' + moduleName + '";
';
importSample = importSample + '//For the transpiled javascript to load the element\'s module, import as below
';
importSample = importSample + 'import "' + moduleName + '";';
}
}
else if (doc.kind === 'interface' && doc.ojtsnoexport && doc.ojtsmodule){//interface not exported directly but can be referred as a type through module
//eg:- ConventionMethods in ojmodule
let exportedParent = doc.memberof;
if(exportedParent.startsWith('oj.')){
exportedParent = exportedParent.substring(3);
}
importSample = '//To use this interface, import as below.
';
importSample = importSample + 'import '+ exportedParent + '= require("ojs/' + moduleName + '");
';
importSample = importSample + '//To access this interface in your code,
';
importSample = importSample + 'let myConventionMethod: '+ exportedParent + '.' + doc.id + ';';
}
else if (doc.kind === 'interface' && doc.ojtsmodule){//interface exported directly to be referred as a type through module
//eg:- Converter in ojconverter
let exportedType = doc.id;
if(exportedType.startsWith('oj.')){
exportedType = exportedType.substring(3);
}
importSample = '//To use this interface, import as below.
';
importSample = importSample + 'import '+ exportedType + '= require("ojs/' + moduleName + '");
';
importSample = importSample + '//To access this interface in your code:
';
importSample = importSample + 'declare class My' + exportedType + ' implements '+ exportedType;
}
else if (doc.kind === 'interface' && doc.ojtsnamespace){
let exportedParent = doc.ojtsnamespace;
//this is the case where we pushed a interface into the module's namespace because we cant export multiple things form a module.
//eg:- SortComparators in arraydataprovider module
importSample = '//To use this interface, import as below.
';
importSample = importSample + 'import '+ exportedParent + '= require("ojs/' + moduleName + '");
';
importSample = importSample + '//To access this interface in your code,
';
importSample = importSample + 'let myVariable: '+ exportedParent + '.' + doc.id + ';';
}
else if (doc.kind === 'interface' && !doc.ojtsnoexport){ //all other interfaces which are exported
importSample = '//To use this interface, import as below.
';
importSample = importSample + 'import {'+ doc.id + '} from "ojs/' + moduleName + '";';
}
else if(doc.kind === 'interface'){
//there is nothing in this category.
}
else if(doc.kind === 'class' && doc.ojtsmodule && !doc.ojtsnoexport){
//classes which are actually exported as modules. eg:- Context, Logger, ArrayDataprovider etc.
importSample = '//This class is exported directly as module. To import it
';
importSample = importSample + 'import '+ doc.id + '= require("ojs/' + moduleName + '");
';
}
else if(doc.kind === 'class' && doc.ojtsmodule && doc.ojtsnoexport && doc.ojtsexportastype){
//These are the classes which are not exported. But they are made available for typechecking as an interface.
//Eg:- BusyContext, RouterState etc.
let exportedParent = doc.ojtsexportastype;
importSample = '//This class is not exported from module and can not be accessed in runtime.
';
importSample = importSample + '//However to enable typechecking and ducktyping, you can access it as an interface.
';
importSample = importSample + 'import '+ exportedParent + '= require("ojs/' + moduleName + '");
';
importSample = importSample + '//To access this type in your code,
';
importSample = importSample + 'class MyClass implements '+ exportedParent + '.' + doc.id + '{
';
importSample = importSample + '//or,
';
importSample = importSample + 'let myVariable: '+ exportedParent + '.' + doc.id + ';';
}
else if(doc.kind === 'class' && !doc.ojtsmodule && !doc.ojtsnoexport){
//classes which are returned as part of an umbrella object from the module.
//eg:- ColorValidator, AttributeGroupHandler, FetchByKeysMixin
importSample = '//To import this class, use the format below.
';
importSample = importSample + 'import {'+ doc.id + '} from "ojs/' + moduleName + '";';
}
else if(doc.kind === 'class' && !doc.ojtsmodule && doc.ojtsnoexport && doc.ojtsexportastype){
//classes which are not returned as part of an umbrella object from the module,
//but is exported as an interface for ducktyping or typechecking
//eg:- Converter, Validator
importSample = '//This class is not exported from module and can not be accessed in runtime.
';
importSample = importSample + '//However to enable typechecking and ducktyping, you can access it as an interface.
';
importSample = importSample + 'import {'+ doc.id + '} from "ojs/' + moduleName + '";
';
importSample = importSample + '//To access this type in your code,
';
importSample = importSample + 'class MyClass implements '+ doc.id + '{
';
importSample = importSample + '//or,
';
importSample = importSample + 'let myVariable: '+ doc.id + ';';
}
else if (doc.kind === 'class' && doc.ojtsnoexport){
//classes which are not exported from a module. These cant be accessed from Typescript
importSample = '//This class is not exported from module and can not be accessed.
';
}
else if (doc.kind === 'class'){
//we should never be here
}
else if (doc.kind === 'namespace' && doc.ojtsmodule && !doc.ojtsnoexport){
//namespace which are actually exported as modules. eg:- ModuleAnimations, Composite etc.
importSample = '//This namespace exports multiple static methods or members. To import
';
importSample = importSample + 'import * as '+ doc.id + ' from "ojs/' + moduleName + '";
';
importSample = importSample + '//Now you can access the methods as '+ doc.id + '.methodName and so on
';
}
else if (doc.kind === 'namespace' && doc.ojtsnoexport){
//namespace which are not exported at all eg:- ojModule
importSample = '//This namespace is not exported from module and can not be accessed.
';
//non exported namespace
}
else if(doc.kind === 'namespace' && !doc.ojtsmodule && !doc.ojtsnoexport){
//namespaces which are returned as part of an umbrella object from the module.
//eg:- FetchByKeysMixin
importSample = '//To import this namespace, use the format below.
';
importSample = importSample + 'import {'+ doc.id + '} from "ojs/' + moduleName + '";';
}
else{
//we should never be here
}
// if we have decorators, provide an import sample
if (self.decorators){
importSample+= '
';
importSample+= '//This module also exports compiler decorators. To import a decorator use the named import format, for example:
';
importSample+= `import {${self.decorators[0].id}} from "ojs/${moduleName}";`;
}
if(importSample){
var importString = `
`+importSample+`
`;
return importString;
}
return null;
}
else{
return null;
}
};
self.getGenericsDetails = function(doc){
if(doc.tstype && doc.tstype.value && doc.tstype.genericParameters){
let returnString = '';
var dstType = doc.tstype.genericParameters;
dstType.forEach(function(item){
returnString = returnString+''+item.name+' | '+item.description+' |
'
});
returnString = 'Parameter | Description |
'+returnString+'
';
return returnString;
}
return null;
};
self.getAccessibilitySections = function(doc){
let accessibleObj = {
touchDoc:false,
keyboardDoc: false,
accessibilityDoc: false
};
if (doc) {
const description = doc.classdesc || doc.description || "";
if (description.indexOf('"touch-section"') > 0 || doc.fragments.touchDoc){
accessibleObj.touchDoc = true;
}
if (description.indexOf('"keyboard-section"') > 0 || doc.fragments.keyboardDoc){
accessibleObj.keyboardDoc = true;
}
if ((description.indexOf('"a11y-section"') > 0) ||
doc.fragments.a11yKeyboard ||
doc.fragments.a11y ||
doc.fragments.buttonsetCommon ||
doc.fragments.a11yKeyboard ||
doc.fragments.comboboxCommon || doc.fragments.selectCommon){
accessibleObj.accessibilityDoc = true;
}
}
return accessibleObj;
};
docs.forEach(function(doc, i) {
self.componentId = doc.id;
self.propertyNameToAttribute = doc.propertyNameToAttribute;
self.componentCamelCaseName = doc.camelCaseName;
self.componentKebabCaseName = doc.tagWithoutBrackets;
var sortMembers = function(data) {
var public = [],
nonPublic = [],
bindingOnly = [],
subIds = [],
contextObjects = [],
fragments = {},
children = [],
styleclasses = [],
stylesets = [],
styletemplates = [],
stylevariablesets = [],
decorators = [],
slots = [];
data.forEach(function(m) {
if (m.ojsubid){
//subIds.push(m);
if(m.ojnodecontext){
contextObjects.push(m);
}
}
else if(m.ojnodecontext){
contextObjects.push(m);
}
else if (m.ojbindingonly)
bindingOnly.push(m);
else if (m.ojfragment)
fragments[m.name] = m.description;
else if (m.ojchild)
children.push(m);
else if (m.ojslot)
slots.push(m);
else if (m.isstyleclass)
styleclasses.push(m);
else if (m.isstyleset)
stylesets.push(m);
else if (m.isstyletemplate)
styletemplates.push(m);
else if (m.isstylevariableset)
stylevariablesets.push(m);
else if(m.ojdecorator)
decorators.push(m);
else if (m.access === 'protected' || m.access === 'private') {
// for components, don't doc internal API's.
//if (!self.isCustomElement) nonPublic.push(m);
} else
public.push(m);
});
var result = {
"public": public,
"nonPublic": nonPublic,
"bindingOnly": bindingOnly,
"subIds": subIds,
"fragments": fragments,
"contextObjects": contextObjects,
"children": children,
"slots": slots,
"styleclasses": styleclasses,
"stylesets": stylesets,
"styletemplates": styletemplates,
"stylevariablesets": stylevariablesets,
"decorators": decorators
};
return result;
};
var members;
if (title === 'Global'){
members = self.find({kind: 'member', name:{has: self.globals}, memberof: {isUndefined:true}});
}
else{
members = self.find({kind: 'member', memberof: doc.longname, ojhidden:{isBoolean: false}});
}
if (members && members.length) {
// Normally, members is returned in sorted order, so that the original OOTB JSDoc template didn't need a sort here,
// but without this sort, we get this incorrect order:
// valueFormats.y valueFormats.y2 valueFormats.y.converter valueFormats.y2.converter
// which is not only undesirable, but it breaks the ordering needed for the tree functionality of the QuickNav.
members.sort(function(a, b) {
// ccsenter: we need to make sure that if we have ids such as columns, columns[].row, etc and we also have other ids
// like columnsDefault, columnsDefault.row, the sort order will actually try to keep the parent-child hierarchies so
// the correct order would actually be columns, columns[]., columnsDefault, columnsDefault.
// right now the order is as follows:
// columns, columnsDefault, columnsDefault., columns[]. which is wrong
// because we loose the hierarchy.
var aid, bid;
aid = a.id.replace(/\[\]/, '');
bid = b.id.replace(/\[\]/, '');
//var aid = a.id;
//var bid = b.id;
return (aid < bid) ? -1 : (aid > bid) ? 1 : 0;
});
var membersObj = sortMembers(members);
doc.fragments = membersObj.fragments;
} else {
doc.fragments = {};
}
var methods;
if (title === 'Global'){
methods = self.find({kind: 'function', name:{has: self.globals}, memberof: {isUndefined:true}});
}
else{
methods = self.find({kind: 'function', memberof: doc.longname, ojhidden:{isBoolean: false}});
}
if (methods && methods.length) {
var methodsObj = sortMembers(methods);
if (methodsObj.decorators && methodsObj.decorators.length > 0){
self.decorators = methodsObj.decorators;
}
}
var className = self.getDeprecatedClass(doc);
if (title === 'Global'){
self.typedefs = self.find({kind: 'typedef', name:{has: self.globals}, memberof: {isUndefined:true}, access:{"!is":["private", "protected"]}});
}
else{
self.typedefs = self.find({kind: 'typedef', memberof: doc.longname, access:{"!is":["private", "protected"]}});
}
?>
- Since:
=0 && !self.isStylingOrOverview) {
if (doc.ojmodule) {
self.moduleName = doc.ojmodule.replace(/\"/g,'').replace(/'/g, '');
}
else{
var _tmparr = doc.meta.filename.split('/');
// last element is the js file name, the element before that is the src folder which is the module name
self.moduleName = _tmparr[_tmparr.length - 2];
}
if (self.moduleName.toLowerCase() !== 'none') { ?>
- Module:
0){ ?>
0 ){
hasMigrationSection = true;
}
//var hasDomColumn = hasChildren && hasSlots;
//[csaba] we want to show the Slots section even if there's just the inherited Default slot (in many cases)
var hasDomColumn = hasChildren || hasSlots;
var hasFieldsColumn = members && membersObj && membersObj.public.length > 0;
var hasEventsColumn = events && events.length && events.forEach;
var hasMethodsColumn = methods && methods.length;
var hasTypeDefColumn = self.typedefs && self.typedefs.length;
var hasDecorators = methodsObj && methodsObj.decorators && methodsObj.decorators.length > 0;
var hasOtherColumn = hasStyleItems || touchDoc || keyboardDoc || accessibilityDoc || hasMigrationSection;
var columnCount = !!hasDomColumn + !!hasFieldsColumn + !!hasEventsColumn + !!hasMethodsColumn + !!hasTypeDefColumn + !!hasDecorators + !!hasOtherColumn;
// only show QuickNav if is non-empty
if (columnCount && !self.isStylingOrOverview) {
// TODO: this tag should be a nav, not a section, but the JSDoc theming assumes that the site-wide nav
// down the left-hand side is the only nav on the page, so this will require redoing that theming. ?>
1) {
let parentEntryExists = false;
if(i > 0) {
let prevProperty = membersObj.public[i-1].id;
let propertyPrefix = currentProperty.substring(0,currentProperty.lastIndexOf("."));
// if *any* ancestor prop contains '[' then is subproperty of array-valued property
membersObj.public[i].isSubpropOfArray = propertyPrefix.indexOf('[') > -1;
// For properties of array objects, ignore square parents when checking parent name
if (propertyPrefix.slice(propertyPrefix.length-2) === '[]') {
propertyPrefix = propertyPrefix.substring(0, propertyPrefix.length-2);
}
if(prevProperty.lastIndexOf(propertyPrefix, 0) === 0){
parentEntryExists = true;
}
}
if(!parentEntryExists) {
throw new Error("Parent doc entry is required for nested property's field. \"" + currentProperty +"\" in " + doc.id);
}
}
if (property.length > currentLevel) {
// Create nested list if in a sub-properties ?>
0) {
// Close previous list item if at the same level ?>
currentLevel) { ?>
0) {
hasTypeDef = true;
break;
}
}
}
}
if (hasTypeDef) {?>
Non-public Fields
Binding Attributes
Context Objects
Sub-ID's
for non-JS doc. The only part of it that would otherwise
// actually show up today is the Constructor section, but that could change given bug
// 22314026: "always show jsdoc sections for linkability". Could fine-tune this later if
// (say) we ever want non-JS doc to support @requires someModuleName.
if (!self.isStylingOrOverview) { ?>
Mixes In
Requires
Classes
-
Namespaces
-
Styling Classes
Styling
0;
var hasDefault = membersObj.children.length > 0;
?>
Slots
JET components that allow child content support slots.
Please see the slots section
of the JET component overview doc for more information on allowed slot content and slot types.
Non-public Fields
Note: Extending JET components
is not currently supported. Thus, non-public fields are for internal use only.
Binding Attributes
Binding attributes are similar to component properties, but are exposed only via the
ojComponent
binding.
Context Objects
Each context object contains, at minimum, a subId
property,
whose value is a string that identifies a particular DOM node in this element. It can have additional properties to further specify the desired node. See getContextByNode for more details.
Properties:
Following are the valid subIds:
Sub-ID's
Each subId locator object contains, at minimum, a subId
property,
whose value is a string that identifies a particular DOM node in this element. It can have additional properties to further specify the desired node. See getNodeBySubId and getSubIdByNode methods for more details.
Properties:
Following are the valid subIds:
Events
Methods
Non-public Methods
Note: Extending JET components
is not currently supported. Thus, non-public methods are for internal use only.
Type Definitions
0) { ?>
Decorators
// the token is substituted with the template evaluated typedef content
if (doc.fragments){
for (let p in doc.fragments){
let description = doc.fragments[p];
// look for <%typdef%> tokens
let tokenStartIdx = description.indexOf('<%');
while (tokenStartIdx >=0){
let tokenEndIdx = description.indexOf('%>', tokenStartIdx);
if ( tokenEndIdx > tokenStartIdx){
//extract the target name from the token
let targetname = description.substring(tokenStartIdx+2, tokenEndIdx);
let typedefname = targetname;
let typedefs = self.find({kind:"typedef", longname: typedefname});
if (typedefs == undefined){
typedefs = self.find({kind:"typedef", name: typedefname});
}
if (typedefs.length){
// we can only pull in properties of one typedef but can inject in several places
let typedefobj = typedefs[0];
self.docInProgress = typedefobj;
let result = self.partial('details.tmpl', typedefobj);
self.docInProgress = null;
let regex = new RegExp('<%' + targetname + '%>');
description = description.replace(regex, result);
}
tokenStartIdx = description.indexOf('<%', tokenEndIdx + 2);
}
}
doc.fragments[p] = description;
}
}
?>