PHP 7.4.33
Preview: form.js.map Size: 8.05 KB
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/next/dist/client/form.js.map
{"version":3,"sources":["../../src/client/form.tsx"],"sourcesContent":["'use client'\n\nimport { type FormEvent, useContext, forwardRef } from 'react'\nimport { addBasePath } from './add-base-path'\nimport { RouterContext } from '../shared/lib/router-context.shared-runtime'\nimport type { NextRouter } from './router'\nimport {\n  checkFormActionUrl,\n  createFormSubmitDestinationUrl,\n  DISALLOWED_FORM_PROPS,\n  hasReactClientActionAttributes,\n  hasUnsupportedSubmitterAttributes,\n  type FormProps,\n} from './form-shared'\n\nexport type { FormProps }\n\nconst Form = forwardRef<HTMLFormElement, FormProps>(function FormComponent(\n  { replace, scroll, prefetch: prefetchProp, ...props },\n  ref\n) {\n  const router = useContext(RouterContext)\n\n  const actionProp = props.action\n  const isNavigatingForm = typeof actionProp === 'string'\n\n  // Validate `action`\n  if (process.env.NODE_ENV === 'development') {\n    if (isNavigatingForm) {\n      checkFormActionUrl(actionProp, 'action')\n    }\n  }\n\n  // Validate `prefetch`\n  if (process.env.NODE_ENV === 'development') {\n    if (prefetchProp !== undefined) {\n      console.error(\n        'Passing `prefetch` to a <Form> has no effect in the pages directory.'\n      )\n    }\n  }\n\n  // Validate `scroll` and `replace`\n  if (process.env.NODE_ENV === 'development') {\n    if (!isNavigatingForm && (replace !== undefined || scroll !== undefined)) {\n      console.error(\n        'Passing `replace` or `scroll` to a <Form> whose `action` is a function has no effect.\\n' +\n          'See the relevant docs to learn how to control this behavior for navigations triggered from actions:\\n' +\n          '  `router.replace()` - https://nextjs.org/docs/pages/api-reference/functions/use-router#routerreplace\\n'\n      )\n    }\n  }\n\n  // Clean up any unsupported form props (and warn if present)\n  for (const key of DISALLOWED_FORM_PROPS) {\n    if (key in props) {\n      if (process.env.NODE_ENV === 'development') {\n        console.error(`<Form> does not support changing \\`${key}\\`.`)\n      }\n      delete (props as Record<string, unknown>)[key]\n    }\n  }\n\n  if (!isNavigatingForm) {\n    return <form {...props} ref={ref} />\n  }\n\n  const actionHref = addBasePath(actionProp)\n\n  return (\n    <form\n      {...props}\n      ref={ref}\n      action={actionHref}\n      onSubmit={(event) =>\n        onFormSubmit(event, {\n          router,\n          actionHref,\n          replace,\n          scroll,\n          onSubmit: props.onSubmit,\n        })\n      }\n    />\n  )\n})\n\nexport default Form\n\nfunction onFormSubmit(\n  event: FormEvent<HTMLFormElement>,\n  {\n    actionHref,\n    onSubmit,\n    replace,\n    scroll,\n    router,\n  }: {\n    actionHref: string\n    onSubmit: FormProps['onSubmit']\n    replace: FormProps['replace']\n    scroll: FormProps['scroll']\n    router: NextRouter | null\n  }\n) {\n  if (typeof onSubmit === 'function') {\n    onSubmit(event)\n\n    // if the user called event.preventDefault(), do nothing.\n    // (this matches what Link does for `onClick`)\n    if (event.defaultPrevented) {\n      return\n    }\n  }\n\n  if (!router) {\n    // Form was somehow used outside of the router (but not in app/, the implementation is forked!).\n    // We can't perform a soft navigation, so let the native submit handling do its thing.\n    return\n  }\n\n  const formElement = event.currentTarget\n  const submitter = (event.nativeEvent as SubmitEvent).submitter\n\n  let action = actionHref\n\n  if (submitter) {\n    // this is page-router-only, so we don't need to worry about false positives\n    // from the attributes that react adds for server actions.\n    if (hasUnsupportedSubmitterAttributes(submitter)) {\n      return\n    }\n\n    // client actions have `formAction=\"javascript:...\"`. We obviously can't prefetch/navigate to that.\n    if (hasReactClientActionAttributes(submitter)) {\n      return\n    }\n\n    // If the submitter specified an alternate formAction,\n    // use that URL instead -- this is what a native form would do.\n    // NOTE: `submitter.formAction` is unreliable, because it will give us `location.href` if it *wasn't* set\n    // NOTE: this should not have `basePath` added, because we can't add it before hydration\n    const submitterFormAction = submitter.getAttribute('formAction')\n    if (submitterFormAction !== null) {\n      if (process.env.NODE_ENV === 'development') {\n        checkFormActionUrl(submitterFormAction, 'formAction')\n      }\n      action = submitterFormAction\n    }\n  }\n\n  const targetUrl = createFormSubmitDestinationUrl(action, formElement)\n\n  // Finally, no more reasons for bailing out.\n  event.preventDefault()\n\n  const method = replace ? 'replace' : 'push'\n  const targetHref = targetUrl.href // TODO: will pages router be happy about an absolute URL here?\n\n  // TODO(form): Make this use a transition so that pending states work\n  //\n  // Unlike the app router, pages router doesn't use startTransition,\n  // and can't easily be wrapped in one because of implementation details\n  // (e.g. it doesn't use any react state)\n  // But it's important to have this wrapped in a transition because\n  // pending states from e.g. `useFormStatus` rely on that.\n  // So this needs some follow up work.\n  router[method](targetHref, undefined, { scroll })\n}\n"],"names":["Form","forwardRef","FormComponent","ref","replace","scroll","prefetch","prefetchProp","props","router","useContext","RouterContext","actionProp","action","isNavigatingForm","process","env","NODE_ENV","checkFormActionUrl","undefined","console","error","key","DISALLOWED_FORM_PROPS","form","actionHref","addBasePath","onSubmit","event","onFormSubmit","defaultPrevented","formElement","currentTarget","submitter","nativeEvent","hasUnsupportedSubmitterAttributes","hasReactClientActionAttributes","submitterFormAction","getAttribute","targetUrl","createFormSubmitDestinationUrl","preventDefault","method","targetHref","href"],"mappings":"AAAA;;;;;+BAuFA;;;eAAA;;;;uBArFuD;6BAC3B;4CACE;4BASvB;AAIP,MAAMA,qBAAOC,IAAAA,iBAAU,EAA6B,SAASC,cAC3D,KAAqD,EACrDC,GAAG;IADH,IAAA,EAAEC,OAAO,EAAEC,MAAM,EAAEC,UAAUC,YAAY,EAAE,GAAGC,OAAO,GAArD;IAGA,MAAMC,SAASC,IAAAA,iBAAU,EAACC,yCAAa;IAEvC,MAAMC,aAAaJ,MAAMK,MAAM;IAC/B,MAAMC,mBAAmB,OAAOF,eAAe;IAE/C,oBAAoB;IACpB,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,IAAIH,kBAAkB;YACpBI,IAAAA,8BAAkB,EAACN,YAAY;QACjC;IACF;IAEA,sBAAsB;IACtB,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;QAC1C,IAAIV,iBAAiBY,WAAW;YAC9BC,QAAQC,KAAK,CACX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0DAA0D;QAC1D,IAAIE,IAAAA,6CAAiC,EAACF,YAAY;YAChD;QACF;QAEA,mGAAmG;QACnG,IAAIG,IAAAA,0CAA8B,EAACH,YAAY;YAC7C;QACF;QAEA,sDAAsD;QACtD,+DAA+D;QAC/D,yGAAyG;QACzG,wFAAwF;QACxF,MAAMI,sBAAsBJ,UAAUK,YAAY,CAAC;QACnD,IAAID,wBAAwB,MAAM;YAChC,IAAItB,QAAQC,GAAG,CAACC,QAAQ,KAAK,eAAe;gBAC1CC,IAAAA,8BAAkB,EAACmB,qBAAqB;YAC1C;YACAxB,SAASwB;QACX;IACF;IAEA,MAAME,YAAYC,IAAAA,0CAA8B,EAAC3B,QAAQkB;IAEzD,4CAA4C;IAC5CH,MAAMa,cAAc;IAEpB,MAAMC,SAAStC,UAAU,YAAY;IACrC,MAAMuC,aAAaJ,UAAUK,IAAI,CAAC,+DAA+D;;IAEjG,qEAAqE;IACrE,EAAE;IACF,mEAAmE;IACnE,uEAAuE;IACvE,wCAAwC;IACxC,kEAAkE;IAClE,yDAAyD;IACzD,qCAAqC;IACrCnC,MAAM,CAACiC,OAAO,CAACC,YAAYxB,WAAW;QAAEd;IAAO;AACjD"}

Directory Contents

Dirs: 10 × Files: 141
Name Size Perms Modified Actions
app-dir DIR
- drwxr-xr-x 2025-03-28 11:04:45
Edit Download
compat DIR
- drwxr-xr-x 2025-03-28 11:04:45
Edit Download
- drwxr-xr-x 2025-03-28 11:04:45
Edit Download
dev DIR
- drwxr-xr-x 2025-03-28 11:04:45
Edit Download
legacy DIR
- drwxr-xr-x 2025-03-28 11:04:45
Edit Download
lib DIR
- drwxr-xr-x 2025-03-28 11:04:45
Edit Download
portal DIR
- drwxr-xr-x 2025-03-28 11:04:45
Edit Download
- drwxr-xr-x 2025-03-28 11:04:45
Edit Download
request DIR
- drwxr-xr-x 2025-03-28 11:04:45
Edit Download
tracing DIR
- drwxr-xr-x 2025-03-28 11:04:45
Edit Download
79 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
1010 B lrw-r--r-- 2025-03-28 11:04:38
Edit Download
956 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
121 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
1.03 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
801 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
285 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
2.75 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
3.97 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
111 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
1.73 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
1.41 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
278 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
1.93 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
1.94 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
90 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
1.62 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
2.03 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
540 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
10.86 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
15.63 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
40 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
4.44 KB lrw-r--r-- 2025-03-28 11:04:38
Edit Download
5.03 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
24 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
830 B lrw-r--r-- 2025-03-28 11:04:38
Edit Download
660 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
11 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
929 B lrw-r--r-- 2025-03-28 11:04:38
Edit Download
1.03 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
24 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
914 B lrw-r--r-- 2025-03-28 11:04:38
Edit Download
733 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
11 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
3.10 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
3.11 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
363 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
1.23 KB lrw-r--r-- 2025-03-28 11:04:39
Edit Download
1.50 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
141 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
922 B lrw-r--r-- 2025-03-28 11:04:40
Edit Download
639 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
985 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
2.92 KB lrw-r--r-- 2025-03-28 11:04:40
Edit Download
4.13 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
2.80 KB lrw-r--r-- 2025-03-28 11:04:45
Edit Download
6.96 KB lrw-r--r-- 2025-03-28 11:04:40
Edit Download
10.48 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
489 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
5.68 KB lrw-r--r-- 2025-03-28 11:04:40
Edit Download
8.05 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
220 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
1.52 KB lrw-r--r-- 2025-03-28 11:04:40
Edit Download
2.27 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
60 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
807 B lrw-r--r-- 2025-03-28 11:04:40
Edit Download
588 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
1.02 KB lrw-r--r-- 2025-03-28 11:04:45
Edit Download
6.64 KB lrw-r--r-- 2025-03-28 11:04:40
Edit Download
11.01 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
1.31 KB lrw-r--r-- 2025-03-28 11:04:45
Edit Download
13.76 KB lrw-r--r-- 2025-03-28 11:04:40
Edit Download
21.02 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
736 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
32.57 KB lrw-r--r-- 2025-03-28 11:04:40
Edit Download
51.00 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
4.57 KB lrw-r--r-- 2025-03-28 11:04:45
Edit Download
16.81 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
30.06 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
11 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
1.89 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
2.87 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
20 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
1.20 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.16 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
11 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
1.40 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
2.15 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
87 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
737 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
788 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
144 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
883 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
806 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
190 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
1.42 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.67 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
75 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
6.58 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
7.74 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
1.34 KB lrw-r--r-- 2025-03-28 11:04:45
Edit Download
7.42 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
11.81 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
62 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
1.05 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
1.10 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
77 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
1.12 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
1.26 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
265 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
1.42 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
1.38 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
396 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
3.64 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
5.56 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
115 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
3.23 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
3.45 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
1.70 KB lrw-r--r-- 2025-03-28 11:04:45
Edit Download
13.64 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
22.46 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
1.05 KB lrw-r--r-- 2025-03-28 11:04:45
Edit Download
6.56 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
8.60 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
923 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
13.50 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
18.06 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
86 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
2.31 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
3.03 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
544 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
1.49 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
1.89 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
53 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
1006 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
736 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
412 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
3.75 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
6.47 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
139 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
2.35 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
3.40 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
156 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
1.08 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
991 B lrw-r--r-- 2025-03-28 11:04:44
Edit Download
11 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
2.23 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
2.46 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
505 B lrw-r--r-- 2025-03-28 11:04:45
Edit Download
1.42 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
1.86 KB lrw-r--r-- 2025-03-28 11:04:44
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).