ant-design/16650ef3-async.d2635143.js
2024-11-20 18:30:54 +00:00

1 line
14 KiB
JavaScript

(("undefined"!=typeof globalThis?globalThis:self).makoChunk_antd=("undefined"!=typeof globalThis?globalThis:self).makoChunk_antd||[]).push([["16650ef3"],{"16650ef3":function(e,n,a){"use strict";a.d(n,"__esModule",{value:!0}),a.d(n,"default",{enumerable:!0,get:function(){return u;}});var r=a("777fffbe"),s=a("f19d2b93"),t=r._(a("b622e337")),l=r._(a("97c488ea")),i=a("9c86e52a"),c=r._(a("c96b0d01")),o=a("5b220c3d");function d(){let{texts:e}=(0,i.useRouteMeta)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"markdown",children:[(0,s.jsxs)("p",{children:[e[0].value,(0,s.jsx)("code",{children:e[1].value}),e[2].value,(0,s.jsx)("code",{children:e[3].value}),e[4].value,(0,s.jsx)("code",{children:e[5].value}),e[6].value,(0,s.jsx)("code",{children:e[7].value}),e[8].value]}),(0,s.jsx)(t.default,{lang:"tsx",children:e[9].value}),(0,s.jsxs)("h2",{id:"encapsulating-aggregate-field-components",children:[(0,s.jsx)(l.default,{"aria-hidden":"true",tabIndex:"-1",href:"#encapsulating-aggregate-field-components",sourceType:"a",children:(0,s.jsx)("span",{className:"icon icon-link"})}),"Encapsulating Aggregate Field Components"]}),(0,s.jsxs)("p",{children:[e[10].value,(0,s.jsx)("code",{children:e[11].value}),e[12].value,(0,s.jsx)("code",{children:e[13].value}),e[14].value,(0,s.jsx)("code",{children:e[15].value}),e[16].value,(0,s.jsx)("code",{children:e[17].value}),e[18].value]}),(0,s.jsxs)("h2",{id:"approach-summary",children:[(0,s.jsx)(l.default,{"aria-hidden":"true",tabIndex:"-1",href:"#approach-summary",sourceType:"a",children:(0,s.jsx)("span",{className:"icon icon-link"})}),"Approach Summary"]}),(0,s.jsxs)("p",{children:[e[19].value,(0,s.jsx)("code",{children:e[20].value}),e[21].value,(0,s.jsx)("code",{children:e[22].value}),e[23].value,(0,s.jsx)("code",{children:e[24].value}),e[25].value,(0,s.jsx)("code",{children:e[26].value}),e[27].value,(0,s.jsx)("code",{children:e[28].value}),e[29].value]}),(0,s.jsxs)("h3",{id:"getvalueprops",children:[(0,s.jsx)(l.default,{"aria-hidden":"true",tabIndex:"-1",href:"#getvalueprops",sourceType:"a",children:(0,s.jsx)("span",{className:"icon icon-link"})}),"getValueProps"]}),(0,s.jsxs)("p",{children:[e[30].value,(0,s.jsx)("code",{children:e[31].value}),e[32].value,(0,s.jsx)("code",{children:e[33].value}),e[34].value,(0,s.jsx)("code",{children:e[35].value}),e[36].value,(0,s.jsx)("code",{children:e[37].value}),e[38].value,(0,s.jsx)("code",{children:e[39].value}),e[40].value,(0,s.jsx)("code",{children:e[41].value}),e[42].value,(0,s.jsx)("code",{children:e[43].value}),e[44].value,(0,s.jsx)("code",{children:e[45].value}),e[46].value]}),(0,s.jsx)(t.default,{lang:"tsx",children:e[47].value}),(0,s.jsxs)("h3",{id:"getvaluefromevent",children:[(0,s.jsx)(l.default,{"aria-hidden":"true",tabIndex:"-1",href:"#getvaluefromevent",sourceType:"a",children:(0,s.jsx)("span",{className:"icon icon-link"})}),"getValueFromEvent"]}),(0,s.jsxs)("p",{children:[e[48].value,(0,s.jsx)("code",{children:e[49].value}),e[50].value,(0,s.jsx)("code",{children:e[51].value}),e[52].value,(0,s.jsx)("code",{children:e[53].value}),e[54].value,(0,s.jsx)("code",{children:e[55].value}),e[56].value,(0,s.jsx)("code",{children:e[57].value}),e[58].value]}),(0,s.jsx)(t.default,{lang:"tsx",children:e[59].value}),(0,s.jsxs)("h3",{id:"transform",children:[(0,s.jsx)(l.default,{"aria-hidden":"true",tabIndex:"-1",href:"#transform",sourceType:"a",children:(0,s.jsx)("span",{className:"icon icon-link"})}),"transform"]}),(0,s.jsxs)("p",{children:[e[60].value,(0,s.jsx)("code",{children:e[61].value}),e[62].value,(0,s.jsx)("code",{children:e[63].value}),e[64].value,(0,s.jsx)("code",{children:e[65].value}),e[66].value,(0,s.jsx)("code",{children:e[67].value}),e[68].value,(0,s.jsx)("code",{children:e[69].value}),e[70].value,(0,s.jsx)("code",{children:e[71].value}),e[72].value,(0,s.jsx)("code",{children:e[73].value}),e[74].value,(0,s.jsx)("code",{children:e[75].value}),e[76].value]}),(0,s.jsx)(t.default,{lang:"tsx",children:e[77].value}),(0,s.jsxs)("h2",{id:"final-result",children:[(0,s.jsx)(l.default,{"aria-hidden":"true",tabIndex:"-1",href:"#final-result",sourceType:"a",children:(0,s.jsx)("span",{className:"icon icon-link"})}),"Final Result"]})]}),(0,s.jsx)(i.DumiDemo,{demo:{id:"docs-blog-form-names-demo-en-us-0"},previewerProps:{defaultShowCode:!0,pkgDependencyList:{"@ant-design/compatible":"^5.1.3","@ant-design/happy-work-theme":"^1.0.0","@ant-design/tools":"^18.0.2","@antfu/eslint-config":"^3.8.0","@antv/g6":"^4.8.24","@biomejs/biome":"^1.9.4","@codecov/webpack-plugin":"^1.2.1","@codesandbox/sandpack-react":"^2.19.9","@dnd-kit/core":"^6.1.0","@dnd-kit/modifiers":"^7.0.0","@dnd-kit/sortable":"^8.0.0","@dnd-kit/utilities":"^3.2.2","@emotion/css":"^11.13.4","@emotion/react":"^11.13.3","@emotion/server":"^11.11.0","@eslint-react/eslint-plugin":"^1.15.0","@ianvs/prettier-plugin-sort-imports":"^4.3.1","@inquirer/prompts":"^7.0.0","@madccc/duplicate-package-checker-webpack-plugin":"^1.0.0","@microflash/rehype-figure":"^2.1.1","@npmcli/run-script":"^9.0.1","@octokit/rest":"^21.0.2","@qixian.cs/github-contributors-list":"^2.0.2","@size-limit/file":"^11.1.6","@stackblitz/sdk":"^1.11.0","@testing-library/dom":"^10.4.0","@testing-library/jest-dom":"^6.6.2","@testing-library/react":"^16.0.1","@testing-library/user-event":"^14.5.2","@types/adm-zip":"^0.5.5","@types/ali-oss":"^6.16.11","@types/cli-progress":"^3.11.6","@types/fs-extra":"^11.0.4","@types/gtag.js":"^0.0.20","@types/http-server":"^0.12.4","@types/isomorphic-fetch":"^0.0.39","@types/jest":"^29.5.13","@types/jest-axe":"^3.5.9","@types/jest-environment-puppeteer":"^5.0.6","@types/jest-image-snapshot":"^6.4.0","@types/jquery":"^3.5.31","@types/jsdom":"^21.1.7","@types/lodash":"^4.17.12","@types/minimist":"^1.2.5","@types/node":"^22.7.7","@types/nprogress":"^0.2.3","@types/pixelmatch":"^5.2.6","@types/pngjs":"^6.0.5","@types/prismjs":"^1.26.4","@types/progress":"^2.0.7","@types/qs":"^6.9.16","@types/react":"^18.3.11","@types/react-copy-to-clipboard":"^5.0.7","@types/react-dom":"^18.3.1","@types/react-highlight-words":"^0.20.0","@types/react-resizable":"^3.0.8","@types/semver":"^7.5.8","@types/spinnies":"^0.5.3","@types/tar":"^6.1.13","@types/throttle-debounce":"^5.0.2","@types/warning":"^3.0.3","adm-zip":"^0.5.16","ali-oss":"^6.21.0","antd-img-crop":"^4.23.0","antd-style":"^3.7.0","antd-token-previewer":"^2.0.8",axios:"^1.7.7",chalk:"^4.1.2",cheerio:"^1.0.0","circular-dependency-plugin":"^5.2.2","cli-progress":"^3.12.0","cross-env":"^7.0.3","cross-fetch":"^4.0.0",dekko:"^0.2.1",dotenv:"^16.4.5",dumi:"~2.4.13","dumi-plugin-color-chunk":"^1.1.2",eslint:"^9.13.0","eslint-plugin-compat":"^6.0.1","eslint-plugin-jest":"^28.8.3","eslint-plugin-jsx-a11y":"^6.10.0","eslint-plugin-react-hooks":"^5.0.0","eslint-plugin-react-refresh":"^0.4.13","fast-glob":"^3.3.2","fetch-jsonp":"^1.3.0","fs-extra":"^11.2.0","gh-pages":"^6.2.0",glob:"^11.0.0",html2sketch:"^1.0.2","http-server":"^14.1.1",husky:"^9.1.6","identity-obj-proxy":"^3.0.0",immer:"^10.1.1","is-ci":"^3.0.1","isomorphic-fetch":"^3.0.0",jest:"^29.7.0","jest-axe":"^9.0.0","jest-canvas-mock":"^2.5.2","jest-environment-jsdom":"^29.7.0","jest-environment-node":"^29.7.0","jest-image-snapshot":"^6.4.0","jest-puppeteer":"^10.1.2",jquery:"^3.7.1",jsdom:"^25.0.1","jsonml-to-react-element":"^1.1.11","jsonml.js":"^0.1.0","lint-staged":"^15.2.10",lodash:"^4.17.21","lunar-typescript":"^1.7.5","lz-string":"^1.5.0",minimist:"^1.2.8",mockdate:"^3.0.5","node-fetch":"^3.3.2","node-notifier":"^10.0.1",nprogress:"^0.2.0",open:"^10.1.0",ora:"^8.1.0","p-all":"^5.0.0",pixelmatch:"^6.0.0",pngjs:"^7.0.0",prettier:"^3.3.3","pretty-format":"^29.7.0",prismjs:"^1.29.0",puppeteer:"^23.6.0",qs:"^6.13.0","rc-footer":"^0.6.8","rc-tween-one":"^3.0.6","rc-virtual-list":"^3.15.0",react:"^18.3.1","react-copy-to-clipboard":"^5.1.0","react-countup":"^6.5.3","react-dom":"^18.3.1","react-draggable":"^4.4.6","react-fast-marquee":"^1.6.5","react-highlight-words":"^0.20.0","react-infinite-scroll-component":"^6.1.0","react-intersection-observer":"^9.13.1","react-resizable":"^3.0.5","react-router-dom":"^6.27.0","react-sticky-box":"^2.0.5","regenerator-runtime":"^0.14.1","rehype-stringify":"^10.0.1",remark:"^15.0.1","remark-cli":"^12.0.1","remark-gfm":"^4.0.0","remark-lint":"^10.0.0","remark-lint-no-undefined-references":"^5.0.0","remark-preset-lint-recommended":"^7.0.0","remark-rehype":"^11.1.1",rimraf:"^6.0.1",runes2:"^1.1.4",semver:"^7.6.3",sharp:"^0.33.5","simple-git":"^3.27.0","size-limit":"^11.1.6",spinnies:"^0.5.1",sylvanas:"^0.6.1",tar:"^7.4.3","tar-fs":"^3.0.6",terser:"^5.36.0",tsx:"4.11.2",typedoc:"^0.26.10",typescript:"~5.6.3","vanilla-jsoneditor":"^2.0.0","vanilla-tilt":"^1.8.1",webpack:"^5.95.0","webpack-bundle-analyzer":"^4.10.2","xhr-mock":"^2.5.1","@ant-design/colors":"^7.1.0","@ant-design/cssinjs":"^1.21.1","@ant-design/cssinjs-utils":"^1.1.1","@ant-design/icons":"^5.5.1","@ant-design/react-slick":"~1.1.2","@babel/runtime":"^7.25.7","@ctrl/tinycolor":"^3.6.1","@rc-component/color-picker":"~2.0.1","@rc-component/mutate-observer":"^1.1.0","@rc-component/qrcode":"~1.0.0","@rc-component/tour":"~1.15.1","@rc-component/trigger":"^2.2.5",classnames:"^2.5.1","copy-to-clipboard":"^3.3.3",dayjs:"^1.11.11","rc-cascader":"~3.30.0","rc-checkbox":"~3.3.0","rc-collapse":"~3.9.0","rc-dialog":"~9.6.0","rc-drawer":"~7.2.0","rc-dropdown":"~4.2.0","rc-field-form":"~2.5.1","rc-image":"~7.11.0","rc-input":"~1.6.3","rc-input-number":"~9.3.0","rc-mentions":"~2.17.0","rc-menu":"~9.16.0","rc-motion":"^2.9.3","rc-notification":"~5.6.2","rc-pagination":"~4.3.0","rc-picker":"~4.8.1","rc-progress":"~4.0.0","rc-rate":"~2.13.0","rc-resize-observer":"^1.4.0","rc-segmented":"~2.5.0","rc-select":"~14.16.3","rc-slider":"~11.1.7","rc-steps":"~6.0.1","rc-switch":"~4.1.0","rc-table":"~7.48.1","rc-tabs":"~15.4.0","rc-textarea":"~1.8.2","rc-tooltip":"~6.2.1","rc-tree":"~5.10.1","rc-tree-select":"~5.24.4","rc-upload":"~4.8.1","rc-util":"^5.43.0","scroll-into-view-if-needed":"^3.1.0","throttle-debounce":"^5.0.2"},jsx:"/**\n * defaultShowCode: true\n */\nimport React from 'react';\nimport { Button, Cascader, DatePicker, Form as OriginForm } from 'antd';\nimport dayjs from 'dayjs';\nconst Aggregate = (props) => {\n const form = OriginForm.useFormInstance();\n const { names = [], rules = [], ...rest } = props;\n const [firstName, ...resetNames] = names;\n return (\n <>\n <OriginForm.Item\n name={firstName}\n // Convert the values of names into an array passed to children\n getValueProps={() => {\n const value = names.map((name) => form.getFieldValue(name));\n if (value.every((v) => v === undefined)) {\n return undefined;\n }\n return {\n value,\n };\n }}\n getValueFromEvent={(values) => {\n // Set the form store values for names\n const fieldData = names.map((name, index) => ({\n name,\n value: values?.[index],\n }));\n form.setFields(fieldData);\n return values?.[0];\n }}\n rules={rules.map((rule) => {\n if (typeof rule === 'object' && rule) {\n return {\n ...rule,\n transform: () => {\n // Set the values of the names fields for the rule value\n const values = names.map((name) => form.getFieldValue(name));\n return values;\n },\n };\n }\n return rule;\n })}\n {...rest}\n />\n {/* Bind other fields so they can getFieldValue to get values and setFields to set values */}\n {resetNames.map((name) => (\n <OriginForm.Item key={name?.toString()} name={name} noStyle />\n ))}\n </>\n );\n};\nconst data = {\n province: 'Beijing',\n city: 'Haidian',\n startTime: dayjs(),\n endTime: dayjs().add(1, 'month'),\n};\nconst options = [\n {\n value: 'zhejiang',\n label: 'Zhejiang',\n children: [\n {\n value: 'hangzhou',\n label: 'Hangzhou',\n },\n ],\n },\n {\n value: 'jiangsu',\n label: 'Jiangsu',\n children: [\n {\n value: 'nanjing',\n label: 'Nanjing',\n },\n ],\n },\n];\nconst Form = Object.assign(OriginForm, {\n Aggregate,\n});\nexport default () => (\n <Form initialValues={data} onFinish={(value) => console.log(value)}>\n <Form.Aggregate\n label=\"Address\"\n names={['province', 'city']}\n rules={[\n {\n required: true,\n },\n ]}\n >\n <Cascader options={options} placeholder=\"Please select\" />\n </Form.Aggregate>\n\n <Form.Item label=\"Address (use Default)\" name=\"defaultAddress\">\n <Cascader options={options} placeholder=\"Please select\" />\n </Form.Item>\n\n {/* Similarly, it also applies <DatePicker.RangePicker /> */}\n <Form.Aggregate label=\"Date\" names={['startTime', 'endTime']}>\n <DatePicker.RangePicker />\n </Form.Aggregate>\n\n <Form.Item>\n <Button htmlType=\"submit\" type=\"primary\">\n Submit\n </Button>\n </Form.Item>\n </Form>\n);\n"}}),(0,s.jsxs)("div",{className:"markdown",children:[(0,s.jsxs)("h2",{id:"summary",children:[(0,s.jsx)(l.default,{"aria-hidden":"true",tabIndex:"-1",href:"#summary",sourceType:"a",children:(0,s.jsx)("span",{className:"icon icon-link"})}),"Summary"]}),(0,s.jsxs)("p",{children:[e[78].value,(0,s.jsx)("code",{children:e[79].value}),e[80].value,(0,s.jsx)("code",{children:e[81].value}),e[82].value]}),(0,s.jsxs)("p",{children:[e[83].value,(0,s.jsx)("code",{children:e[84].value}),e[85].value,(0,s.jsx)("code",{children:e[86].value}),e[87].value]}),(0,s.jsxs)("p",{children:[e[88].value,(0,s.jsx)("code",{children:e[89].value}),e[90].value,(0,s.jsx)("code",{children:e[91].value}),e[92].value,(0,s.jsx)("code",{children:e[93].value}),e[94].value]}),(0,s.jsx)("p",{children:e[95].value})]})]});}var u=function(){return(0,s.jsx)(i.DumiPage,{children:(0,s.jsx)(o.Suspense,{fallback:(0,s.jsx)(c.default,{}),children:(0,s.jsx)(d,{})})});};}}]);