docs: show the source code link in order models reference (#13398)

This commit is contained in:
Shahed Nasser
2025-09-03 10:36:59 +03:00
committed by GitHub
parent 1578e1ad22
commit f1149ea170
23 changed files with 29 additions and 29 deletions

View File

@@ -192,6 +192,7 @@ You should only use the methods in this reference when implementing complex cust
Functions: false,
Methods: false,
},
internalType: "model-ref",
},
[`^modules/${snakeCaseModuleName}_models`]: {
reflectionDescription: `This documentation provides a reference to the data models in the ${titleModuleName} Module`,
@@ -207,6 +208,7 @@ You should only use the methods in this reference when implementing complex cust
Variables: "Data Models",
}
: {},
internalType: "model-ref",
},
} as FormattingOptionsType)
}, {} as FormattingOptionsType),

View File

@@ -180,7 +180,7 @@ export function registerHelpers(theme: MarkdownTheme) {
shouldExpandPropertiesHelper(theme)
shouldExpandDeclarationChildrenHelper(theme)
startSectionsHelper(theme)
ifDmlEntityHelper()
ifDmlEntityHelper(theme)
dmlPropertiesHelper()
ifWorkflowStepHelper()
stepInputHelper(theme)

View File

@@ -1,12 +1,16 @@
import Handlebars from "handlebars"
import { DeclarationReflection } from "typedoc"
import { isDmlEntity } from "utils"
import { MarkdownTheme } from "../../theme.js"
export default function () {
export default function (theme: MarkdownTheme) {
Handlebars.registerHelper(
"ifDmlEntity",
function (this: DeclarationReflection, options: Handlebars.HelperOptions) {
return isDmlEntity(this) ? options.fn(this) : options.inverse(this)
const { internalType } = theme.getFormattingOptionsForLocation()
return isDmlEntity(this) || internalType === "model-ref"
? options.fn(this)
: options.inverse(this)
}
)
}

View File

@@ -115,10 +115,7 @@ export default function (theme: MarkdownTheme) {
str += `Handlers consuming this hook accept the following input.\n\n`
str += Handlebars.helpers.parameterComponent.call(
cleanUpHookInput(
signatures[0].parameters,
this.name === "addToCartWorkflow" && hook.name === "validate"
),
cleanUpHookInput(signatures[0].parameters),
{
hash: {
sectionTitle: hook.name,

View File

@@ -103,6 +103,7 @@ export type FormattingOptionType = {
workflowDiagramComponent?: string
isEventsReference?: boolean
sortMembers?: boolean
internalType?: string
}
export type AllowedProjectDocumentsOption = {

View File

@@ -41,15 +41,11 @@ export function getHookChildren(
}
export function cleanUpHookInput(
parameters: ParameterReflection[],
debug = false
parameters: ParameterReflection[]
): (ParameterReflection | DeclarationReflection)[] {
const hasInvokeParameter = parameters.some(
(parameter) => parameter.name === "invoke"
)
if (debug) {
console.log(parameters, hasInvokeParameter)
}
if (hasInvokeParameter) {
return getHookInputFromInvoke(parameters)
}