@vtx/components 4.0.0-beta.1 → 4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +31 -19
- package/dist/1077.66b69576.async.js +0 -1
- package/dist/1572.2b90c634.async.js +0 -1
- package/dist/1632.03c8f7ad.async.js +0 -2
- package/dist/2267.aeefe75c.async.js +0 -137
- package/dist/2791.54c703a9.async.js +0 -5
- package/dist/2952.348f2c3f.async.js +0 -654
- package/dist/3421.4387ba14.async.js +0 -1264
- package/dist/3500.29895123.async.js +0 -1
- package/dist/404.html +0 -17
- package/dist/4195.93b9d34d.async.js +0 -1
- package/dist/4680.bca43384.async.js +0 -1
- package/dist/7965.a57e8f9a.async.js +0 -1
- package/dist/8300.66a39b1b.async.js +0 -1
- package/dist/8982.8e38e68e.async.js +0 -1
- package/dist/9877.87ec0c28.async.js +0 -11
- package/dist/VtxColorPicker__demos.60d61929.async.js +0 -1
- package/dist/VtxCombogrid__demos.8c798bc7.async.js +0 -1
- package/dist/VtxDatagrid__demos.e07857d0.async.js +0 -1
- package/dist/VtxEllipsisText__demos.2e269d20.async.js +0 -1
- package/dist/VtxExportAsync__demos.13e3bb1c.async.js +0 -1
- package/dist/VtxExport__demos.1cce5217.async.js +0 -1
- package/dist/VtxFormLayout__demos.b8bb038a.async.js +0 -1
- package/dist/VtxImage__demos.774c697e.async.js +0 -1
- package/dist/VtxImport2__demos.8182b8d2.async.js +0 -1
- package/dist/VtxImport__demos.3865c4e9.async.js +0 -1
- package/dist/VtxInput__demos.5fd77ccb.async.js +0 -1
- package/dist/VtxModal__demos.e0aae505.async.js +0 -1
- package/dist/VtxPageLayout__demos.b1cd7624.async.js +0 -1
- package/dist/VtxRpsFrame__demos.07c3fb5e.async.js +0 -1
- package/dist/VtxScrollableRow__demos.eeb18c3c.async.js +0 -1
- package/dist/VtxSearch__demos.f6b048ae.async.js +0 -1
- package/dist/VtxSelect__demos.0e8f1c52.async.js +0 -1
- package/dist/VtxSignature__demos.d0c4bcac.async.js +0 -1
- package/dist/VtxSplitPane__demos.6dda4f09.async.js +0 -1
- package/dist/VtxStatisticsColumn__demos.b2be3e4b.async.js +0 -1
- package/dist/VtxTimePicker__demos.ced305a6.async.js +0 -1
- package/dist/VtxTreeSelect__demos.daab9057.async.js +0 -1
- package/dist/VtxTree__demos.15550a80.async.js +0 -1
- package/dist/VtxUpload__demos.794c746a.async.js +0 -1
- package/dist/VtxWangEditor__demos.92b4daf1.async.js +0 -1
- package/dist/changelog/index.html +0 -17
- package/dist/components/index.html +0 -17
- package/dist/components/vtx-color-picker/index.html +0 -17
- package/dist/components/vtx-combogrid/index.html +0 -17
- package/dist/components/vtx-datagrid/index.html +0 -17
- package/dist/components/vtx-date-picker/index.html +0 -17
- package/dist/components/vtx-ellipsis-text/index.html +0 -17
- package/dist/components/vtx-export/index.html +0 -17
- package/dist/components/vtx-export-async/index.html +0 -17
- package/dist/components/vtx-form-layout/index.html +0 -17
- package/dist/components/vtx-image/index.html +0 -17
- package/dist/components/vtx-import/index.html +0 -17
- package/dist/components/vtx-import2/index.html +0 -17
- package/dist/components/vtx-input/index.html +0 -17
- package/dist/components/vtx-modal/index.html +0 -17
- package/dist/components/vtx-page-layout/index.html +0 -17
- package/dist/components/vtx-rps-frame/index.html +0 -17
- package/dist/components/vtx-scrollable-row/index.html +0 -17
- package/dist/components/vtx-search/index.html +0 -17
- package/dist/components/vtx-select/index.html +0 -17
- package/dist/components/vtx-signature/index.html +0 -17
- package/dist/components/vtx-split-pane/index.html +0 -17
- package/dist/components/vtx-statistics-column/index.html +0 -17
- package/dist/components/vtx-time-picker/index.html +0 -17
- package/dist/components/vtx-tree/index.html +0 -17
- package/dist/components/vtx-tree-select/index.html +0 -17
- package/dist/components/vtx-upload/index.html +0 -17
- package/dist/components/vtx-wang-editor/index.html +0 -17
- package/dist/demos.f6817f69.async.js +0 -1
- package/dist/docs/api-changes/index.html +0 -17
- package/dist/docs/index.html +0 -17
- package/dist/docs/migration-guide/index.html +0 -17
- package/dist/dumi__tmp-production__dumi__theme__ContextWrapper.aca58684.async.js +0 -1
- package/dist/favicon.ico +0 -0
- package/dist/icon.png +0 -0
- package/dist/index.html +0 -17
- package/dist/meta__site.2e323023.async.js +0 -5392
- package/dist/meta__site.51651769.chunk.css +0 -9
- package/dist/meta__vtx-search.5ddbd36b.async.js +0 -5
- package/dist/nm__dumi-theme-vortex-style__dist__layouts__DemoLayout__index.7cea644e.async.js +0 -1
- package/dist/nm__dumi-theme-vortex-style__dist__layouts__DocLayout__index.eec80432.chunk.css +0 -1
- package/dist/nm__dumi__dist__client__pages__404.0d35bb9e.async.js +0 -1
- package/dist/nm__dumi__dist__client__pages__404.8b85f2d9.chunk.css +0 -1
- package/dist/nm__dumi__dist__client__pages__Demo__index.578aa5c0.chunk.css +0 -1
- package/dist/nm__dumi__dist__client__pages__Demo__index.88d92ec7.async.js +0 -1
- package/dist/preload_helper.214f203a.js +0 -1
- package/dist/site__changelog.md.33be0665.chunk.css +0 -1
- package/dist/site__changelog.md.ca6f70d0.async.js +0 -1
- package/dist/site__components__index.md.1c0dd566.async.js +0 -1
- package/dist/site__components__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-color-picker__index.md.0b5f09f9.async.js +0 -1
- package/dist/site__components__vtx-color-picker__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-combogrid__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-combogrid__index.md.5c184a19.async.js +0 -19
- package/dist/site__components__vtx-datagrid__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-datagrid__index.md.3b6b11a0.async.js +0 -58
- package/dist/site__components__vtx-date-picker__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-date-picker__index.md.e498db68.async.js +0 -1
- package/dist/site__components__vtx-ellipsis-text__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-ellipsis-text__index.md.3df8b85b.async.js +0 -1
- package/dist/site__components__vtx-export-async__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-export-async__index.md.7ad10351.async.js +0 -50
- package/dist/site__components__vtx-export__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-export__index.md.ae512624.async.js +0 -6
- package/dist/site__components__vtx-form-layout__index.md.26ce0de4.async.js +0 -1
- package/dist/site__components__vtx-form-layout__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-image__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-image__index.md.51d7fede.async.js +0 -7
- package/dist/site__components__vtx-import2__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-import2__index.md.3d03da86.async.js +0 -22
- package/dist/site__components__vtx-import__index.md.2706afc2.async.js +0 -1
- package/dist/site__components__vtx-import__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-input__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-input__index.md.dbe2e571.async.js +0 -1
- package/dist/site__components__vtx-modal__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-modal__index.md.6a9b2eda.async.js +0 -9
- package/dist/site__components__vtx-page-layout__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-page-layout__index.md.46cefa9b.async.js +0 -1
- package/dist/site__components__vtx-rps-frame__index.md.0126d79c.async.js +0 -1
- package/dist/site__components__vtx-rps-frame__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-scrollable-row__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-scrollable-row__index.md.83c9c112.async.js +0 -1
- package/dist/site__components__vtx-search__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-search__index.md.a36329f4.async.js +0 -5
- package/dist/site__components__vtx-select__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-select__index.md.d4b9a187.async.js +0 -6
- package/dist/site__components__vtx-signature__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-signature__index.md.e502b176.async.js +0 -1
- package/dist/site__components__vtx-split-pane__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-split-pane__index.md.744d87da.async.js +0 -1
- package/dist/site__components__vtx-statistics-column__index.md.106749e3.async.js +0 -1
- package/dist/site__components__vtx-statistics-column__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-time-picker__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-time-picker__index.md.c9f4700c.async.js +0 -1
- package/dist/site__components__vtx-tree-select__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-tree-select__index.md.49b56c10.async.js +0 -1
- package/dist/site__components__vtx-tree__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-tree__index.md.4c124fad.async.js +0 -1
- package/dist/site__components__vtx-upload__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-upload__index.md.57969550.async.js +0 -6
- package/dist/site__components__vtx-wang-editor__index.md.33be0665.chunk.css +0 -1
- package/dist/site__components__vtx-wang-editor__index.md.b98b12a6.async.js +0 -7
- package/dist/site__docs__api-changes.md.33be0665.chunk.css +0 -1
- package/dist/site__docs__api-changes.md.aaa38736.async.js +0 -6
- package/dist/site__docs__index.md.33be0665.chunk.css +0 -1
- package/dist/site__docs__index.md.586150c4.async.js +0 -53
- package/dist/site__docs__migration-guide.md.02f5996d.async.js +0 -194
- package/dist/site__docs__migration-guide.md.33be0665.chunk.css +0 -1
- package/dist/site__index.md.33be0665.chunk.css +0 -1
- package/dist/site__index.md.634bf57a.async.js +0 -1
- package/dist/sitemap.xml +0 -1
- package/dist/umi.f49a7748.css +0 -1
- package/dist/umi.f610424c.js +0 -877
- package/dist/vtx-search__index.md.33be0665.chunk.css +0 -1
- package/dist/vtx-search__index.md.37a39d66.async.js +0 -5
- package/dist/~demos/:id/index.html +0 -17
- package/dist/~demos/site-components-vtx-date-picker-demo-demo1/index.html +0 -17
- package/dist/~demos/site-components-vtx-date-picker-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxcolorpicker-demo-base/index.html +0 -17
- package/dist/~demos/vtxcolorpicker-demo-base-form/index.html +0 -17
- package/dist/~demos/vtxcombogrid-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxcombogrid-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxcombogrid-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxcombogrid-demo-demo4/index.html +0 -17
- package/dist/~demos/vtxcombogrid-demo-demo5/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo10/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo4/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo5/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo6/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo7/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo8/index.html +0 -17
- package/dist/~demos/vtxdatagrid-demo-demo9/index.html +0 -17
- package/dist/~demos/vtxellipsistext-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxexport-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxexportasync-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo10/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo4/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo5/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo6/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo7/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo8/index.html +0 -17
- package/dist/~demos/vtxformlayout-demo-demo9/index.html +0 -17
- package/dist/~demos/vtximage-demo-demo1/index.html +0 -17
- package/dist/~demos/vtximage-demo-demo2/index.html +0 -17
- package/dist/~demos/vtximage-demo-demo3/index.html +0 -17
- package/dist/~demos/vtximage-demo-demo4/index.html +0 -17
- package/dist/~demos/vtximport-demo-base/index.html +0 -17
- package/dist/~demos/vtximport2-demo-base/index.html +0 -17
- package/dist/~demos/vtxinput-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxinput-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxinput-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxmodal-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxmodal-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxmodal-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxpagelayout-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxpagelayout-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxpagelayout-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxpagelayout-demo-demo4/index.html +0 -17
- package/dist/~demos/vtxrpsframe-demo-base/index.html +0 -17
- package/dist/~demos/vtxscrollablerow-demo-demo/index.html +0 -17
- package/dist/~demos/vtxsearch-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxsearch-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxsearch-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxsearch-demo-demo4/index.html +0 -17
- package/dist/~demos/vtxselect-demo-base/index.html +0 -17
- package/dist/~demos/vtxselect-demo-base-multiple/index.html +0 -17
- package/dist/~demos/vtxsignature-demo-demo/index.html +0 -17
- package/dist/~demos/vtxsignature-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxsplitpane-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxsplitpane-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxsplitpane-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxsplitpane-demo-demo4/index.html +0 -17
- package/dist/~demos/vtxstatisticscolumn-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxstatisticscolumn-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxstatisticscolumn-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxtimepicker-demo-base/index.html +0 -17
- package/dist/~demos/vtxtree-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxtree-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxtree-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxtreeselect-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxtreeselect-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxtreeselect-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxupload-demo-demo1/index.html +0 -17
- package/dist/~demos/vtxupload-demo-demo2/index.html +0 -17
- package/dist/~demos/vtxupload-demo-demo3/index.html +0 -17
- package/dist/~demos/vtxwangeditor-demo-demo1/index.html +0 -17
- package/es/index.js +0 -74
- package/es/utils/columnSort.js +0 -23
- package/es/utils/components/DropdownFooter/index.js +0 -53
- package/es/utils/components/DropdownFooter/style.js +0 -25
- package/es/utils/components/ErrorBoundary/index.js +0 -53
- package/es/utils/components/FieldLabel/index.js +0 -144
- package/es/utils/components/FieldLabel/style.js +0 -93
- package/es/utils/components/FilterDropdown/index.js +0 -62
- package/es/utils/components/FilterDropdown/style.js +0 -26
- package/es/utils/components/InlineErrorFormItem/index.js +0 -156
- package/es/utils/components/InlineErrorFormItem/style.js +0 -47
- package/es/utils/components/LabelIconTip/index.js +0 -68
- package/es/utils/components/LabelIconTip/style.js +0 -47
- package/es/utils/components/ProFormContext/index.js +0 -41
- package/es/utils/conversionMomentValue/index.js +0 -163
- package/es/utils/dateArrayFormatter/index.js +0 -36
- package/es/utils/filterSpecialCharacters.js +0 -82
- package/es/utils/genColumnKey.js +0 -6
- package/es/utils/genCopyable/index.js +0 -59
- package/es/utils/getComponentProps.js +0 -7
- package/es/utils/getFieldPropsOrFormItemProps/index.js +0 -16
- package/es/utils/getPlaceholder.js +0 -5
- package/es/utils/getToken.js +0 -6
- package/es/utils/hooks/useDebounceFn/index.js +0 -71
- package/es/utils/hooks/useDebounceValue/index.js +0 -40
- package/es/utils/hooks/useDeepCompareEffect/index.js +0 -24
- package/es/utils/hooks/useDeepCompareMemo/index.js +0 -15
- package/es/utils/hooks/useDocumentTitle/index.js +0 -10
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/es/utils/hooks/useForceRender/index.js +0 -18
- package/es/utils/hooks/useLatest/index.js +0 -10
- package/es/utils/hooks/usePrevious/index.js +0 -8
- package/es/utils/hooks/useReactiveRef/index.js +0 -7
- package/es/utils/hooks/useRefCallback/index.js +0 -26
- package/es/utils/hooks/useRefFunction/index.js +0 -13
- package/es/utils/index.js +0 -73
- package/es/utils/isBrowser/index.d.ts +0 -9
- package/es/utils/isBrowser/index.js +0 -16
- package/es/utils/isDeepEqualReact/index.js +0 -95
- package/es/utils/isDropdownValueType/index.js +0 -7
- package/es/utils/isFunction.js +0 -3
- package/es/utils/isImg/index.js +0 -4
- package/es/utils/isNil/index.js +0 -3
- package/es/utils/isObject/index.js +0 -3
- package/es/utils/isObject.js +0 -3
- package/es/utils/isUrl/index.js +0 -17
- package/es/utils/merge/index.js +0 -36
- package/es/utils/nanoid/index.js +0 -29
- package/es/utils/omitBoolean/index.js +0 -11
- package/es/utils/omitUndefined/index.js +0 -12
- package/es/utils/omitUndefinedAndEmptyArr/index.js +0 -14
- package/es/utils/parseValueToMoment/index.js +0 -28
- package/es/utils/pickProFormItemProps/index.js +0 -15
- package/es/utils/pickProProps/index.js +0 -15
- package/es/utils/proFieldParsingText/index.js +0 -161
- package/es/utils/runFunction/index.js +0 -10
- package/es/utils/sortByGivenOrder.js +0 -36
- package/es/utils/sortByKeyArrayExtract.js +0 -38
- package/es/utils/stringify/index.js +0 -10
- package/es/utils/transformKeySubmitValue/index.js +0 -330
- package/es/utils/useColSize.js +0 -20
- package/es/utils/useEditableArray/index.js +0 -906
- package/es/utils/useEditableMap/index.js +0 -214
- package/es/utils/useInterval.js +0 -12
- package/es/utils/useMediaQuery/index.js +0 -106
- package/es/utils/useMediaQuery/query.js +0 -30
- package/es/utils/useMountMergeState/index.js +0 -2
- package/es/utils/useSet.js +0 -38
- package/es/version.js +0 -3
- package/es/vtx-color-picker/index.js +0 -164
- package/es/vtx-color-picker/style/index.js +0 -54
- package/es/vtx-combogrid/Combogrid.js +0 -247
- package/es/vtx-combogrid/index.js +0 -121
- package/es/vtx-combogrid/style/index.js +0 -42
- package/es/vtx-datagrid/Alert/index.js +0 -49
- package/es/vtx-datagrid/Alert/style.js +0 -44
- package/es/vtx-datagrid/Store/Provide.js +0 -441
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +0 -526
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +0 -86
- package/es/vtx-datagrid/ToolBar/components/Density/index.js +0 -48
- package/es/vtx-datagrid/ToolBar/components/Fullscreen/index.js +0 -77
- package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +0 -71
- package/es/vtx-datagrid/ToolBar/index.js +0 -88
- package/es/vtx-datagrid/ToolBar/style.js +0 -59
- package/es/vtx-datagrid/index.js +0 -363
- package/es/vtx-datagrid/renderColumnButtons.js +0 -98
- package/es/vtx-datagrid/style/index.js +0 -80
- package/es/vtx-datagrid/style/index.less +0 -242
- package/es/vtx-date-picker/QdatePicker.js +0 -152
- package/es/vtx-date-picker/generatePicker.js +0 -104
- package/es/vtx-date-picker/index.js +0 -49
- package/es/vtx-date-picker/style/index.js +0 -39
- package/es/vtx-date-picker/style/index.less +0 -39
- package/es/vtx-ellipsis-text/index.js +0 -52
- package/es/vtx-ellipsis-text/style/index.js +0 -29
- package/es/vtx-export/index.js +0 -197
- package/es/vtx-export/style/index.js +0 -24
- package/es/vtx-export-async/ColumnsSelect.js +0 -63
- package/es/vtx-export-async/History.js +0 -256
- package/es/vtx-export-async/index.js +0 -402
- package/es/vtx-export-async/style/index.js +0 -49
- package/es/vtx-export-async/util.js +0 -51
- package/es/vtx-form-layout/Card.js +0 -74
- package/es/vtx-form-layout/Divider.js +0 -22
- package/es/vtx-form-layout/FormItem.js +0 -136
- package/es/vtx-form-layout/Pane.js +0 -41
- package/es/vtx-form-layout/Row.js +0 -19
- package/es/vtx-form-layout/context.js +0 -2
- package/es/vtx-form-layout/index.js +0 -80
- package/es/vtx-form-layout/style/index.js +0 -262
- package/es/vtx-icon/index.js +0 -78
- package/es/vtx-icon/svg/alignRightOutlined.js +0 -29
- package/es/vtx-icon/svg/columnHeightOutlined.js +0 -25
- package/es/vtx-icon/svg/downOutlined.js +0 -24
- package/es/vtx-icon/svg/fullscreen.js +0 -25
- package/es/vtx-icon/svg/redoOutlined.js +0 -29
- package/es/vtx-icon/svg/rightOutlined.js +0 -24
- package/es/vtx-icon/svg/settingOutlined.js +0 -29
- package/es/vtx-image/Image.js +0 -257
- package/es/vtx-image/Preview.js +0 -140
- package/es/vtx-image/PreviewGroup.js +0 -81
- package/es/vtx-image/index.js +0 -4
- package/es/vtx-image/style/index.js +0 -91
- package/es/vtx-import/index.js +0 -416
- package/es/vtx-import/result.js +0 -81
- package/es/vtx-import/style/index.js +0 -19
- package/es/vtx-import2/CheckResult.js +0 -45
- package/es/vtx-import2/Content.js +0 -103
- package/es/vtx-import2/DownloadSvg.js +0 -41
- package/es/vtx-import2/ImportResult.js +0 -57
- package/es/vtx-import2/UploadSvg.js +0 -41
- package/es/vtx-import2/index.js +0 -453
- package/es/vtx-import2/style/index.js +0 -99
- package/es/vtx-input/TextArea/index.js +0 -61
- package/es/vtx-input/TextArea/style.js +0 -30
- package/es/vtx-input/index.js +0 -92
- package/es/vtx-input/style/index.js +0 -24
- package/es/vtx-input/useLength.js +0 -21
- package/es/vtx-modal/Title.js +0 -34
- package/es/vtx-modal/index.js +0 -243
- package/es/vtx-modal/style/index.js +0 -109
- package/es/vtx-page-layout/Basic.js +0 -28
- package/es/vtx-page-layout/Content.js +0 -43
- package/es/vtx-page-layout/Pane.js +0 -40
- package/es/vtx-page-layout/TabLayout.js +0 -65
- package/es/vtx-page-layout/TableLayout.js +0 -163
- package/es/vtx-page-layout/TableWrap.js +0 -36
- package/es/vtx-page-layout/TreeLayout.js +0 -79
- package/es/vtx-page-layout/container.js +0 -68
- package/es/vtx-page-layout/index.js +0 -26
- package/es/vtx-page-layout/style/index.js +0 -129
- package/es/vtx-provider/index.js +0 -317
- package/es/vtx-provider/intl.js +0 -140
- package/es/vtx-provider/locale/ar_EG.js +0 -71
- package/es/vtx-provider/locale/ca_ES.js +0 -71
- package/es/vtx-provider/locale/cs_CZ.js +0 -74
- package/es/vtx-provider/locale/de_DE.js +0 -71
- package/es/vtx-provider/locale/en_GB.js +0 -73
- package/es/vtx-provider/locale/en_US.js +0 -181
- package/es/vtx-provider/locale/es_ES.js +0 -71
- package/es/vtx-provider/locale/fa_IR.js +0 -71
- package/es/vtx-provider/locale/fr_FR.js +0 -71
- package/es/vtx-provider/locale/he_IL.js +0 -74
- package/es/vtx-provider/locale/hr_HR.js +0 -71
- package/es/vtx-provider/locale/id_ID.js +0 -71
- package/es/vtx-provider/locale/it_IT.js +0 -71
- package/es/vtx-provider/locale/ja_JP.js +0 -71
- package/es/vtx-provider/locale/ko_KR.js +0 -71
- package/es/vtx-provider/locale/mn_MN.js +0 -71
- package/es/vtx-provider/locale/ms_MY.js +0 -71
- package/es/vtx-provider/locale/nl_NL.js +0 -74
- package/es/vtx-provider/locale/pl_PL.js +0 -71
- package/es/vtx-provider/locale/pt_BR.js +0 -71
- package/es/vtx-provider/locale/ro_RO.js +0 -74
- package/es/vtx-provider/locale/ru_RU.js +0 -71
- package/es/vtx-provider/locale/sk_SK.js +0 -74
- package/es/vtx-provider/locale/sr_RS.js +0 -71
- package/es/vtx-provider/locale/sv_SE.js +0 -74
- package/es/vtx-provider/locale/th_TH.js +0 -74
- package/es/vtx-provider/locale/tr_TR.js +0 -71
- package/es/vtx-provider/locale/uk_UA.js +0 -74
- package/es/vtx-provider/locale/uz_UZ.js +0 -71
- package/es/vtx-provider/locale/vi_VN.js +0 -71
- package/es/vtx-provider/locale/zh_CN.js +0 -183
- package/es/vtx-provider/locale/zh_HK.js +0 -83
- package/es/vtx-provider/locale/zh_TW.js +0 -74
- package/es/vtx-provider/typing/layoutToken.js +0 -60
- package/es/vtx-provider/useStyle/index.js +0 -110
- package/es/vtx-provider/utils/merge.js +0 -27
- package/es/vtx-rps-frame/index.js +0 -164
- package/es/vtx-rps-frame/style/index.js +0 -26
- package/es/vtx-scrollable-row/index.js +0 -183
- package/es/vtx-scrollable-row/style/index.js +0 -108
- package/es/vtx-search/index.js +0 -350
- package/es/vtx-search/style/index.js +0 -94
- package/es/vtx-select/index.js +0 -252
- package/es/vtx-select/style/index.js +0 -75
- package/es/vtx-signature/index.js +0 -119
- package/es/vtx-signature/style/index.js +0 -47
- package/es/vtx-split-pane/Resizer.js +0 -47
- package/es/vtx-split-pane/SplitPane.js +0 -60
- package/es/vtx-split-pane/index.js +0 -3
- package/es/vtx-split-pane/style/index.js +0 -133
- package/es/vtx-statistics-column/Back.js +0 -27
- package/es/vtx-statistics-column/Item.js +0 -54
- package/es/vtx-statistics-column/Total.js +0 -54
- package/es/vtx-statistics-column/context.js +0 -2
- package/es/vtx-statistics-column/index.js +0 -54
- package/es/vtx-statistics-column/style/index.js +0 -72
- package/es/vtx-time-picker/index.js +0 -37
- package/es/vtx-time-picker/style/index.js +0 -0
- package/es/vtx-transfer/Transfer.js +0 -247
- package/es/vtx-transfer/index.js +0 -3
- package/es/vtx-transfer/style/index.js +0 -42
- package/es/vtx-tree/index.js +0 -341
- package/es/vtx-tree/style/index.js +0 -50
- package/es/vtx-tree/utils.js +0 -73
- package/es/vtx-tree-select/index.js +0 -290
- package/es/vtx-tree-select/style/index.js +0 -72
- package/es/vtx-upload/FilePreview.js +0 -111
- package/es/vtx-upload/index.js +0 -468
- package/es/vtx-upload/style/index.js +0 -83
- package/es/vtx-wang-editor/index.js +0 -245
- package/es/vtx-wang-editor/style/index.js +0 -33
- package/es/vtx-wang-editor/style/index.less +0 -12
- package/es/vtx-wang-editor/wangEditorUtil.js +0 -226
- package/lib/index.js +0 -375
- package/lib/utils/columnSort.js +0 -29
- package/lib/utils/components/DropdownFooter/index.js +0 -62
- package/lib/utils/components/DropdownFooter/style.js +0 -31
- package/lib/utils/components/ErrorBoundary/index.js +0 -59
- package/lib/utils/components/FieldLabel/index.js +0 -152
- package/lib/utils/components/FieldLabel/style.js +0 -99
- package/lib/utils/components/FilterDropdown/index.js +0 -70
- package/lib/utils/components/FilterDropdown/style.js +0 -32
- package/lib/utils/components/InlineErrorFormItem/index.js +0 -162
- package/lib/utils/components/InlineErrorFormItem/style.js +0 -53
- package/lib/utils/components/LabelIconTip/index.js +0 -73
- package/lib/utils/components/LabelIconTip/style.js +0 -53
- package/lib/utils/components/ProFormContext/index.js +0 -48
- package/lib/utils/conversionMomentValue/index.js +0 -170
- package/lib/utils/dateArrayFormatter/index.js +0 -43
- package/lib/utils/filterSpecialCharacters.js +0 -89
- package/lib/utils/genColumnKey.js +0 -12
- package/lib/utils/genCopyable/index.js +0 -66
- package/lib/utils/getComponentProps.js +0 -13
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +0 -21
- package/lib/utils/getPlaceholder.js +0 -11
- package/lib/utils/getToken.js +0 -12
- package/lib/utils/hooks/useDebounceFn/index.js +0 -77
- package/lib/utils/hooks/useDebounceValue/index.js +0 -45
- package/lib/utils/hooks/useDeepCompareEffect/index.js +0 -33
- package/lib/utils/hooks/useDeepCompareMemo/index.js +0 -21
- package/lib/utils/hooks/useDocumentTitle/index.js +0 -16
- package/lib/utils/hooks/useFetchData/index.js +0 -89
- package/lib/utils/hooks/useForceRender/index.js +0 -24
- package/lib/utils/hooks/useLatest/index.js +0 -15
- package/lib/utils/hooks/usePrevious/index.js +0 -14
- package/lib/utils/hooks/useReactiveRef/index.js +0 -14
- package/lib/utils/hooks/useRefCallback/index.js +0 -31
- package/lib/utils/hooks/useRefFunction/index.js +0 -18
- package/lib/utils/index.js +0 -436
- package/lib/utils/isBrowser/index.d.ts +0 -9
- package/lib/utils/isBrowser/index.js +0 -22
- package/lib/utils/isDeepEqualReact/index.js +0 -101
- package/lib/utils/isDropdownValueType/index.js +0 -13
- package/lib/utils/isFunction.js +0 -9
- package/lib/utils/isImg/index.js +0 -10
- package/lib/utils/isNil/index.js +0 -9
- package/lib/utils/isObject/index.js +0 -9
- package/lib/utils/isObject.js +0 -9
- package/lib/utils/isUrl/index.js +0 -23
- package/lib/utils/merge/index.js +0 -41
- package/lib/utils/nanoid/index.js +0 -35
- package/lib/utils/omitBoolean/index.js +0 -17
- package/lib/utils/omitUndefined/index.js +0 -18
- package/lib/utils/omitUndefinedAndEmptyArr/index.js +0 -20
- package/lib/utils/parseValueToMoment/index.js +0 -35
- package/lib/utils/pickProFormItemProps/index.js +0 -21
- package/lib/utils/pickProProps/index.js +0 -21
- package/lib/utils/proFieldParsingText/index.js +0 -166
- package/lib/utils/runFunction/index.js +0 -16
- package/lib/utils/sortByGivenOrder.js +0 -42
- package/lib/utils/sortByKeyArrayExtract.js +0 -44
- package/lib/utils/stringify/index.js +0 -21
- package/lib/utils/transformKeySubmitValue/index.js +0 -337
- package/lib/utils/useColSize.js +0 -26
- package/lib/utils/useEditableArray/index.js +0 -918
- package/lib/utils/useEditableMap/index.js +0 -219
- package/lib/utils/useInterval.js +0 -18
- package/lib/utils/useMediaQuery/index.js +0 -112
- package/lib/utils/useMediaQuery/query.js +0 -36
- package/lib/utils/useMountMergeState/index.js +0 -12
- package/lib/utils/useSet.js +0 -43
- package/lib/version.js +0 -9
- package/lib/vtx-color-picker/index.js +0 -171
- package/lib/vtx-color-picker/style/index.js +0 -60
- package/lib/vtx-combogrid/Combogrid.js +0 -255
- package/lib/vtx-combogrid/index.js +0 -129
- package/lib/vtx-combogrid/style/index.js +0 -48
- package/lib/vtx-datagrid/Alert/index.js +0 -57
- package/lib/vtx-datagrid/Alert/style.js +0 -50
- package/lib/vtx-datagrid/Store/Provide.js +0 -446
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +0 -531
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +0 -92
- package/lib/vtx-datagrid/ToolBar/components/Density/index.js +0 -54
- package/lib/vtx-datagrid/ToolBar/components/Fullscreen/index.js +0 -83
- package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +0 -77
- package/lib/vtx-datagrid/ToolBar/index.js +0 -96
- package/lib/vtx-datagrid/ToolBar/style.js +0 -65
- package/lib/vtx-datagrid/index.js +0 -371
- package/lib/vtx-datagrid/renderColumnButtons.js +0 -104
- package/lib/vtx-datagrid/style/index.js +0 -86
- package/lib/vtx-datagrid/style/index.less +0 -242
- package/lib/vtx-date-picker/QdatePicker.js +0 -157
- package/lib/vtx-date-picker/generatePicker.js +0 -111
- package/lib/vtx-date-picker/index.js +0 -55
- package/lib/vtx-date-picker/style/index.js +0 -45
- package/lib/vtx-date-picker/style/index.less +0 -39
- package/lib/vtx-ellipsis-text/index.js +0 -60
- package/lib/vtx-ellipsis-text/style/index.js +0 -35
- package/lib/vtx-export/index.js +0 -203
- package/lib/vtx-export/style/index.js +0 -30
- package/lib/vtx-export-async/ColumnsSelect.js +0 -69
- package/lib/vtx-export-async/History.js +0 -264
- package/lib/vtx-export-async/index.js +0 -409
- package/lib/vtx-export-async/style/index.js +0 -55
- package/lib/vtx-export-async/util.js +0 -57
- package/lib/vtx-form-layout/Card.js +0 -83
- package/lib/vtx-form-layout/Divider.js +0 -31
- package/lib/vtx-form-layout/FormItem.js +0 -142
- package/lib/vtx-form-layout/Pane.js +0 -50
- package/lib/vtx-form-layout/Row.js +0 -26
- package/lib/vtx-form-layout/context.js +0 -8
- package/lib/vtx-form-layout/index.js +0 -89
- package/lib/vtx-form-layout/style/index.js +0 -268
- package/lib/vtx-icon/index.js +0 -90
- package/lib/vtx-icon/svg/alignRightOutlined.js +0 -34
- package/lib/vtx-icon/svg/columnHeightOutlined.js +0 -31
- package/lib/vtx-icon/svg/downOutlined.js +0 -30
- package/lib/vtx-icon/svg/fullscreen.js +0 -31
- package/lib/vtx-icon/svg/redoOutlined.js +0 -34
- package/lib/vtx-icon/svg/rightOutlined.js +0 -30
- package/lib/vtx-icon/svg/settingOutlined.js +0 -34
- package/lib/vtx-image/Image.js +0 -264
- package/lib/vtx-image/Preview.js +0 -146
- package/lib/vtx-image/PreviewGroup.js +0 -91
- package/lib/vtx-image/index.js +0 -31
- package/lib/vtx-image/style/index.js +0 -97
- package/lib/vtx-import/index.js +0 -424
- package/lib/vtx-import/result.js +0 -88
- package/lib/vtx-import/style/index.js +0 -25
- package/lib/vtx-import2/CheckResult.js +0 -50
- package/lib/vtx-import2/Content.js +0 -112
- package/lib/vtx-import2/DownloadSvg.js +0 -47
- package/lib/vtx-import2/ImportResult.js +0 -62
- package/lib/vtx-import2/UploadSvg.js +0 -47
- package/lib/vtx-import2/index.js +0 -458
- package/lib/vtx-import2/style/index.js +0 -105
- package/lib/vtx-input/TextArea/index.js +0 -70
- package/lib/vtx-input/TextArea/style.js +0 -36
- package/lib/vtx-input/index.js +0 -100
- package/lib/vtx-input/style/index.js +0 -30
- package/lib/vtx-input/useLength.js +0 -27
- package/lib/vtx-modal/Title.js +0 -42
- package/lib/vtx-modal/index.js +0 -249
- package/lib/vtx-modal/style/index.js +0 -115
- package/lib/vtx-page-layout/Basic.js +0 -36
- package/lib/vtx-page-layout/Content.js +0 -50
- package/lib/vtx-page-layout/Pane.js +0 -47
- package/lib/vtx-page-layout/TabLayout.js +0 -70
- package/lib/vtx-page-layout/TableLayout.js +0 -172
- package/lib/vtx-page-layout/TableWrap.js +0 -43
- package/lib/vtx-page-layout/TreeLayout.js +0 -84
- package/lib/vtx-page-layout/container.js +0 -74
- package/lib/vtx-page-layout/index.js +0 -32
- package/lib/vtx-page-layout/style/index.js +0 -136
- package/lib/vtx-provider/index.js +0 -352
- package/lib/vtx-provider/intl.js +0 -145
- package/lib/vtx-provider/locale/ar_EG.js +0 -77
- package/lib/vtx-provider/locale/ca_ES.js +0 -77
- package/lib/vtx-provider/locale/cs_CZ.js +0 -80
- package/lib/vtx-provider/locale/de_DE.js +0 -77
- package/lib/vtx-provider/locale/en_GB.js +0 -79
- package/lib/vtx-provider/locale/en_US.js +0 -187
- package/lib/vtx-provider/locale/es_ES.js +0 -77
- package/lib/vtx-provider/locale/fa_IR.js +0 -77
- package/lib/vtx-provider/locale/fr_FR.js +0 -77
- package/lib/vtx-provider/locale/he_IL.js +0 -80
- package/lib/vtx-provider/locale/hr_HR.js +0 -77
- package/lib/vtx-provider/locale/id_ID.js +0 -77
- package/lib/vtx-provider/locale/it_IT.js +0 -77
- package/lib/vtx-provider/locale/ja_JP.js +0 -77
- package/lib/vtx-provider/locale/ko_KR.js +0 -77
- package/lib/vtx-provider/locale/mn_MN.js +0 -77
- package/lib/vtx-provider/locale/ms_MY.js +0 -77
- package/lib/vtx-provider/locale/nl_NL.js +0 -80
- package/lib/vtx-provider/locale/pl_PL.js +0 -77
- package/lib/vtx-provider/locale/pt_BR.js +0 -77
- package/lib/vtx-provider/locale/ro_RO.js +0 -80
- package/lib/vtx-provider/locale/ru_RU.js +0 -77
- package/lib/vtx-provider/locale/sk_SK.js +0 -80
- package/lib/vtx-provider/locale/sr_RS.js +0 -77
- package/lib/vtx-provider/locale/sv_SE.js +0 -80
- package/lib/vtx-provider/locale/th_TH.js +0 -80
- package/lib/vtx-provider/locale/tr_TR.js +0 -77
- package/lib/vtx-provider/locale/uk_UA.js +0 -80
- package/lib/vtx-provider/locale/uz_UZ.js +0 -77
- package/lib/vtx-provider/locale/vi_VN.js +0 -77
- package/lib/vtx-provider/locale/zh_CN.js +0 -189
- package/lib/vtx-provider/locale/zh_HK.js +0 -89
- package/lib/vtx-provider/locale/zh_TW.js +0 -80
- package/lib/vtx-provider/typing/layoutToken.js +0 -66
- package/lib/vtx-provider/useStyle/index.js +0 -116
- package/lib/vtx-provider/utils/merge.js +0 -33
- package/lib/vtx-rps-frame/index.js +0 -173
- package/lib/vtx-rps-frame/style/index.js +0 -32
- package/lib/vtx-scrollable-row/index.js +0 -193
- package/lib/vtx-scrollable-row/style/index.js +0 -114
- package/lib/vtx-search/index.js +0 -355
- package/lib/vtx-search/style/index.js +0 -101
- package/lib/vtx-select/index.js +0 -259
- package/lib/vtx-select/style/index.js +0 -81
- package/lib/vtx-signature/index.js +0 -127
- package/lib/vtx-signature/style/index.js +0 -53
- package/lib/vtx-split-pane/Resizer.js +0 -52
- package/lib/vtx-split-pane/SplitPane.js +0 -68
- package/lib/vtx-split-pane/index.js +0 -15
- package/lib/vtx-split-pane/style/index.js +0 -139
- package/lib/vtx-statistics-column/Back.js +0 -36
- package/lib/vtx-statistics-column/Item.js +0 -62
- package/lib/vtx-statistics-column/Total.js +0 -62
- package/lib/vtx-statistics-column/context.js +0 -8
- package/lib/vtx-statistics-column/index.js +0 -63
- package/lib/vtx-statistics-column/style/index.js +0 -78
- package/lib/vtx-time-picker/index.js +0 -45
- package/lib/vtx-time-picker/style/index.js +0 -1
- package/lib/vtx-transfer/Transfer.js +0 -255
- package/lib/vtx-transfer/index.js +0 -15
- package/lib/vtx-transfer/style/index.js +0 -48
- package/lib/vtx-tree/index.js +0 -348
- package/lib/vtx-tree/style/index.js +0 -56
- package/lib/vtx-tree/utils.js +0 -80
- package/lib/vtx-tree-select/index.js +0 -296
- package/lib/vtx-tree-select/style/index.js +0 -78
- package/lib/vtx-upload/FilePreview.js +0 -116
- package/lib/vtx-upload/index.js +0 -474
- package/lib/vtx-upload/style/index.js +0 -89
- package/lib/vtx-wang-editor/index.js +0 -251
- package/lib/vtx-wang-editor/style/index.js +0 -39
- package/lib/vtx-wang-editor/style/index.less +0 -12
- package/lib/vtx-wang-editor/wangEditorUtil.js +0 -236
|
@@ -1,906 +0,0 @@
|
|
|
1
|
-
var _excluded = ["map_row_parentKey"],
|
|
2
|
-
_excluded2 = ["map_row_parentKey", "map_row_key"],
|
|
3
|
-
_excluded3 = ["map_row_key"];
|
|
4
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
|
-
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
|
|
9
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
16
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
24
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
26
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
27
|
-
import { LoadingOutlined } from '@ant-design/icons';
|
|
28
|
-
import { get, warning as rcWarning, set, useMergedState } from '@rc-component/util';
|
|
29
|
-
import { Form, Popconfirm, message } from 'antd';
|
|
30
|
-
import useLazyKVMap from 'antd/lib/table/hooks/useLazyKVMap';
|
|
31
|
-
import React, { createRef, forwardRef, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
32
|
-
import { useDebounceFn, useRefFunction } from '..';
|
|
33
|
-
import { useIntl } from "../../vtx-provider";
|
|
34
|
-
import { ProFormContext } from "../components/ProFormContext";
|
|
35
|
-
import { useDeepCompareEffectDebounce } from "../hooks/useDeepCompareEffect";
|
|
36
|
-
import { usePrevious } from "../hooks/usePrevious";
|
|
37
|
-
import { merge } from "../merge";
|
|
38
|
-
import { useMountMergeState } from "../useMountMergeState";
|
|
39
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
40
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
41
|
-
var noteOnce = rcWarning.noteOnce;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* 显示警告信息
|
|
45
|
-
* @param messageStr
|
|
46
|
-
*/
|
|
47
|
-
var warning = function warning(messageStr) {
|
|
48
|
-
return message.warning(messageStr);
|
|
49
|
-
};
|
|
50
|
-
export var recordKeyToString = function recordKeyToString(rowKey) {
|
|
51
|
-
if (Array.isArray(rowKey)) return rowKey.join(',');
|
|
52
|
-
return rowKey;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* 使用map 来删除数据,性能一般 但是准确率比较高
|
|
57
|
-
*
|
|
58
|
-
* @param keyProps
|
|
59
|
-
* @param action
|
|
60
|
-
*/
|
|
61
|
-
export function editableRowByKey(keyProps, action) {
|
|
62
|
-
var _recordKeyToString;
|
|
63
|
-
var getRowKey = keyProps.getRowKey,
|
|
64
|
-
row = keyProps.row,
|
|
65
|
-
data = keyProps.data,
|
|
66
|
-
_keyProps$childrenCol = keyProps.childrenColumnName,
|
|
67
|
-
childrenColumnName = _keyProps$childrenCol === void 0 ? 'children' : _keyProps$childrenCol;
|
|
68
|
-
var key = (_recordKeyToString = recordKeyToString(keyProps.key)) === null || _recordKeyToString === void 0 ? void 0 : _recordKeyToString.toString();
|
|
69
|
-
var kvMap = new Map();
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* 打平这个数组
|
|
73
|
-
*
|
|
74
|
-
* @param records
|
|
75
|
-
* @param parentKey
|
|
76
|
-
*/
|
|
77
|
-
function dig(records, map_row_parentKey, map_row_index) {
|
|
78
|
-
records.forEach(function (record, index) {
|
|
79
|
-
var eachIndex = (map_row_index || 0) * 10 + index;
|
|
80
|
-
var recordKey = getRowKey(record, eachIndex).toString();
|
|
81
|
-
// children 取在前面方便拼的时候按照反顺序放回去
|
|
82
|
-
if (record && _typeof(record) === 'object' && childrenColumnName in record) {
|
|
83
|
-
dig(record[childrenColumnName] || [], recordKey, eachIndex);
|
|
84
|
-
}
|
|
85
|
-
var newRecord = _objectSpread(_objectSpread({}, record), {}, {
|
|
86
|
-
map_row_key: recordKey,
|
|
87
|
-
children: undefined,
|
|
88
|
-
map_row_parentKey: map_row_parentKey
|
|
89
|
-
});
|
|
90
|
-
delete newRecord.children;
|
|
91
|
-
if (!map_row_parentKey) {
|
|
92
|
-
delete newRecord.map_row_parentKey;
|
|
93
|
-
}
|
|
94
|
-
kvMap.set(recordKey, newRecord);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
if (action === 'top') {
|
|
98
|
-
kvMap.set(key, _objectSpread(_objectSpread({}, kvMap.get(key)), row));
|
|
99
|
-
}
|
|
100
|
-
dig(data);
|
|
101
|
-
if (action === 'update') {
|
|
102
|
-
kvMap.set(key, _objectSpread(_objectSpread({}, kvMap.get(key)), row));
|
|
103
|
-
}
|
|
104
|
-
if (action === 'delete') {
|
|
105
|
-
kvMap.delete(key);
|
|
106
|
-
}
|
|
107
|
-
var fill = function fill(map) {
|
|
108
|
-
var kvArrayMap = new Map();
|
|
109
|
-
var kvSource = [];
|
|
110
|
-
var fillNewRecord = function fillNewRecord() {
|
|
111
|
-
var fillChildren = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
112
|
-
map.forEach(function (value) {
|
|
113
|
-
if (value.map_row_parentKey && !value.map_row_key) {
|
|
114
|
-
var map_row_parentKey = value.map_row_parentKey,
|
|
115
|
-
rest = _objectWithoutProperties(value, _excluded);
|
|
116
|
-
if (!kvArrayMap.has(map_row_parentKey)) {
|
|
117
|
-
kvArrayMap.set(map_row_parentKey, []);
|
|
118
|
-
}
|
|
119
|
-
if (fillChildren) {
|
|
120
|
-
var _kvArrayMap$get;
|
|
121
|
-
(_kvArrayMap$get = kvArrayMap.get(map_row_parentKey)) === null || _kvArrayMap$get === void 0 || _kvArrayMap$get.push(rest);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
fillNewRecord(action === 'top');
|
|
127
|
-
map.forEach(function (value) {
|
|
128
|
-
if (value.map_row_parentKey && value.map_row_key) {
|
|
129
|
-
var _kvArrayMap$get2;
|
|
130
|
-
var map_row_parentKey = value.map_row_parentKey,
|
|
131
|
-
map_row_key = value.map_row_key,
|
|
132
|
-
rest = _objectWithoutProperties(value, _excluded2);
|
|
133
|
-
if (kvArrayMap.has(map_row_key)) {
|
|
134
|
-
rest[childrenColumnName] = kvArrayMap.get(map_row_key);
|
|
135
|
-
}
|
|
136
|
-
if (!kvArrayMap.has(map_row_parentKey)) {
|
|
137
|
-
kvArrayMap.set(map_row_parentKey, []);
|
|
138
|
-
}
|
|
139
|
-
(_kvArrayMap$get2 = kvArrayMap.get(map_row_parentKey)) === null || _kvArrayMap$get2 === void 0 || _kvArrayMap$get2.push(rest);
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
fillNewRecord(action === 'update');
|
|
143
|
-
map.forEach(function (value) {
|
|
144
|
-
if (!value.map_row_parentKey) {
|
|
145
|
-
var map_row_key = value.map_row_key,
|
|
146
|
-
rest = _objectWithoutProperties(value, _excluded3);
|
|
147
|
-
if (map_row_key && kvArrayMap.has(map_row_key)) {
|
|
148
|
-
var item = _objectSpread(_objectSpread({}, rest), {}, _defineProperty({}, childrenColumnName, kvArrayMap.get(map_row_key)));
|
|
149
|
-
kvSource.push(item);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
kvSource.push(rest);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
return kvSource;
|
|
156
|
-
};
|
|
157
|
-
return fill(kvMap);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* 保存按钮的dom
|
|
162
|
-
*
|
|
163
|
-
* @param ActionRenderConfig
|
|
164
|
-
*/
|
|
165
|
-
export function SaveEditableAction(_ref, ref) {
|
|
166
|
-
var recordKey = _ref.recordKey,
|
|
167
|
-
onSave = _ref.onSave,
|
|
168
|
-
row = _ref.row,
|
|
169
|
-
children = _ref.children,
|
|
170
|
-
newLineConfig = _ref.newLineConfig,
|
|
171
|
-
editorType = _ref.editorType,
|
|
172
|
-
tableName = _ref.tableName;
|
|
173
|
-
var context = useContext(ProFormContext);
|
|
174
|
-
var form = Form.useFormInstance();
|
|
175
|
-
var _useMountMergeState = useMountMergeState(false),
|
|
176
|
-
_useMountMergeState2 = _slicedToArray(_useMountMergeState, 2),
|
|
177
|
-
loading = _useMountMergeState2[0],
|
|
178
|
-
setLoading = _useMountMergeState2[1];
|
|
179
|
-
var save = useRefFunction( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
180
|
-
var _context$getFieldForm, isMapEditor, namePath, fields, _recordKey, recordKeyPath, curValue, data, res;
|
|
181
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
182
|
-
while (1) switch (_context.prev = _context.next) {
|
|
183
|
-
case 0:
|
|
184
|
-
_context.prev = 0;
|
|
185
|
-
isMapEditor = editorType === 'Map'; // 为了兼容类型为 array 的 dataIndex,当 recordKey 是一个数组时,用于获取表单值的 key 只取第一项,
|
|
186
|
-
// 从表单中获取回来之后,再根据 namepath 获取具体的某个字段并设置
|
|
187
|
-
namePath = [tableName, Array.isArray(recordKey) ? recordKey[0] : recordKey].map(function (key) {
|
|
188
|
-
return key === null || key === void 0 ? void 0 : key.toString();
|
|
189
|
-
}).flat(1).filter(Boolean);
|
|
190
|
-
setLoading(true);
|
|
191
|
-
_context.next = 6;
|
|
192
|
-
return form.validateFields(namePath, {
|
|
193
|
-
recursive: true
|
|
194
|
-
});
|
|
195
|
-
case 6:
|
|
196
|
-
fields = (context === null || context === void 0 || (_context$getFieldForm = context.getFieldFormatValue) === null || _context$getFieldForm === void 0 ? void 0 : _context$getFieldForm.call(context, namePath)) || form.getFieldValue(namePath); // 处理 dataIndex 为数组的情况
|
|
197
|
-
if (Array.isArray(recordKey) && recordKey.length > 1) {
|
|
198
|
-
// 获取 namepath
|
|
199
|
-
_recordKey = _toArray(recordKey), recordKeyPath = _recordKey.slice(1); // 将目标值获取出来并设置到 fields 当中
|
|
200
|
-
curValue = get(fields, recordKeyPath);
|
|
201
|
-
set(fields, recordKeyPath, curValue);
|
|
202
|
-
}
|
|
203
|
-
data = isMapEditor ? set({}, namePath, fields) : fields; // 获取数据并保存
|
|
204
|
-
_context.next = 11;
|
|
205
|
-
return onSave === null || onSave === void 0 ? void 0 : onSave(recordKey,
|
|
206
|
-
// 如果是 map 模式,fields 就是一个值,所以需要set 到对象中
|
|
207
|
-
// 数据模式 fields 是一个对象,所以不需要
|
|
208
|
-
merge({}, row, data), row, newLineConfig);
|
|
209
|
-
case 11:
|
|
210
|
-
res = _context.sent;
|
|
211
|
-
setLoading(false);
|
|
212
|
-
return _context.abrupt("return", res);
|
|
213
|
-
case 16:
|
|
214
|
-
_context.prev = 16;
|
|
215
|
-
_context.t0 = _context["catch"](0);
|
|
216
|
-
setLoading(false);
|
|
217
|
-
throw _context.t0;
|
|
218
|
-
case 20:
|
|
219
|
-
case "end":
|
|
220
|
-
return _context.stop();
|
|
221
|
-
}
|
|
222
|
-
}, _callee, null, [[0, 16]]);
|
|
223
|
-
})));
|
|
224
|
-
|
|
225
|
-
// 保存数据
|
|
226
|
-
useImperativeHandle(ref, function () {
|
|
227
|
-
return {
|
|
228
|
-
save: save
|
|
229
|
-
};
|
|
230
|
-
}, [save]);
|
|
231
|
-
return /*#__PURE__*/_jsxs("a", {
|
|
232
|
-
onClick: ( /*#__PURE__*/function () {
|
|
233
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
|
|
234
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
235
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
236
|
-
case 0:
|
|
237
|
-
e.stopPropagation();
|
|
238
|
-
e.preventDefault();
|
|
239
|
-
_context2.prev = 2;
|
|
240
|
-
_context2.next = 5;
|
|
241
|
-
return save();
|
|
242
|
-
case 5:
|
|
243
|
-
_context2.next = 9;
|
|
244
|
-
break;
|
|
245
|
-
case 7:
|
|
246
|
-
_context2.prev = 7;
|
|
247
|
-
_context2.t0 = _context2["catch"](2);
|
|
248
|
-
case 9:
|
|
249
|
-
case "end":
|
|
250
|
-
return _context2.stop();
|
|
251
|
-
}
|
|
252
|
-
}, _callee2, null, [[2, 7]]);
|
|
253
|
-
}));
|
|
254
|
-
return function (_x) {
|
|
255
|
-
return _ref3.apply(this, arguments);
|
|
256
|
-
};
|
|
257
|
-
}()),
|
|
258
|
-
children: [loading ? /*#__PURE__*/_jsx(LoadingOutlined, {
|
|
259
|
-
style: {
|
|
260
|
-
marginInlineEnd: 8
|
|
261
|
-
}
|
|
262
|
-
}) : null, children || '保存']
|
|
263
|
-
}, "save");
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* 删除按钮 dom
|
|
268
|
-
*
|
|
269
|
-
* @param ActionRenderConfig
|
|
270
|
-
*/
|
|
271
|
-
export var DeleteEditableAction = function DeleteEditableAction(_ref4) {
|
|
272
|
-
var recordKey = _ref4.recordKey,
|
|
273
|
-
onDelete = _ref4.onDelete,
|
|
274
|
-
preEditRowRef = _ref4.preEditRowRef,
|
|
275
|
-
row = _ref4.row,
|
|
276
|
-
children = _ref4.children,
|
|
277
|
-
deletePopconfirmMessage = _ref4.deletePopconfirmMessage;
|
|
278
|
-
var _useMountMergeState3 = useMountMergeState(function () {
|
|
279
|
-
return false;
|
|
280
|
-
}),
|
|
281
|
-
_useMountMergeState4 = _slicedToArray(_useMountMergeState3, 2),
|
|
282
|
-
loading = _useMountMergeState4[0],
|
|
283
|
-
setLoading = _useMountMergeState4[1];
|
|
284
|
-
var _onConfirm = useRefFunction( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
285
|
-
var res;
|
|
286
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
287
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
288
|
-
case 0:
|
|
289
|
-
_context3.prev = 0;
|
|
290
|
-
setLoading(true);
|
|
291
|
-
_context3.next = 4;
|
|
292
|
-
return onDelete === null || onDelete === void 0 ? void 0 : onDelete(recordKey, row);
|
|
293
|
-
case 4:
|
|
294
|
-
res = _context3.sent;
|
|
295
|
-
setLoading(false);
|
|
296
|
-
return _context3.abrupt("return", res);
|
|
297
|
-
case 9:
|
|
298
|
-
_context3.prev = 9;
|
|
299
|
-
_context3.t0 = _context3["catch"](0);
|
|
300
|
-
setLoading(false);
|
|
301
|
-
return _context3.abrupt("return", null);
|
|
302
|
-
case 13:
|
|
303
|
-
_context3.prev = 13;
|
|
304
|
-
if (preEditRowRef) preEditRowRef.current = null;
|
|
305
|
-
return _context3.finish(13);
|
|
306
|
-
case 16:
|
|
307
|
-
case "end":
|
|
308
|
-
return _context3.stop();
|
|
309
|
-
}
|
|
310
|
-
}, _callee3, null, [[0, 9, 13, 16]]);
|
|
311
|
-
})));
|
|
312
|
-
return children !== false ? /*#__PURE__*/_jsx(Popconfirm, {
|
|
313
|
-
title: deletePopconfirmMessage,
|
|
314
|
-
onConfirm: function onConfirm() {
|
|
315
|
-
return _onConfirm();
|
|
316
|
-
},
|
|
317
|
-
children: /*#__PURE__*/_jsxs("a", {
|
|
318
|
-
children: [loading ? /*#__PURE__*/_jsx(LoadingOutlined, {
|
|
319
|
-
style: {
|
|
320
|
-
marginInlineEnd: 8
|
|
321
|
-
}
|
|
322
|
-
}) : null, children || '删除']
|
|
323
|
-
})
|
|
324
|
-
}, "delete") : null;
|
|
325
|
-
};
|
|
326
|
-
var CancelEditableAction = function CancelEditableAction(props) {
|
|
327
|
-
var recordKey = props.recordKey,
|
|
328
|
-
tableName = props.tableName,
|
|
329
|
-
newLineConfig = props.newLineConfig,
|
|
330
|
-
editorType = props.editorType,
|
|
331
|
-
onCancel = props.onCancel,
|
|
332
|
-
cancelEditable = props.cancelEditable,
|
|
333
|
-
row = props.row,
|
|
334
|
-
cancelText = props.cancelText,
|
|
335
|
-
preEditRowRef = props.preEditRowRef;
|
|
336
|
-
var context = useContext(ProFormContext);
|
|
337
|
-
var form = Form.useFormInstance();
|
|
338
|
-
return /*#__PURE__*/_jsx("a", {
|
|
339
|
-
onClick: ( /*#__PURE__*/function () {
|
|
340
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(e) {
|
|
341
|
-
var _context$getFieldForm2;
|
|
342
|
-
var isMapEditor, namePath, fields, record, res, _props$onDelete;
|
|
343
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
344
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
345
|
-
case 0:
|
|
346
|
-
e.stopPropagation();
|
|
347
|
-
e.preventDefault();
|
|
348
|
-
isMapEditor = editorType === 'Map';
|
|
349
|
-
namePath = [tableName, recordKey].flat(1).filter(Boolean);
|
|
350
|
-
fields = (context === null || context === void 0 || (_context$getFieldForm2 = context.getFieldFormatValue) === null || _context$getFieldForm2 === void 0 ? void 0 : _context$getFieldForm2.call(context, namePath)) || (form === null || form === void 0 ? void 0 : form.getFieldValue(namePath));
|
|
351
|
-
record = isMapEditor ? set({}, namePath, fields) : fields;
|
|
352
|
-
_context4.next = 8;
|
|
353
|
-
return onCancel === null || onCancel === void 0 ? void 0 : onCancel(recordKey, record, row, newLineConfig);
|
|
354
|
-
case 8:
|
|
355
|
-
res = _context4.sent;
|
|
356
|
-
_context4.next = 11;
|
|
357
|
-
return cancelEditable(recordKey);
|
|
358
|
-
case 11:
|
|
359
|
-
if (!((preEditRowRef === null || preEditRowRef === void 0 ? void 0 : preEditRowRef.current) !== null)) {
|
|
360
|
-
_context4.next = 15;
|
|
361
|
-
break;
|
|
362
|
-
}
|
|
363
|
-
form.setFieldsValue(set({}, namePath, preEditRowRef === null || preEditRowRef === void 0 ? void 0 : preEditRowRef.current));
|
|
364
|
-
_context4.next = 17;
|
|
365
|
-
break;
|
|
366
|
-
case 15:
|
|
367
|
-
_context4.next = 17;
|
|
368
|
-
return (_props$onDelete = props.onDelete) === null || _props$onDelete === void 0 ? void 0 : _props$onDelete.call(props, recordKey, row);
|
|
369
|
-
case 17:
|
|
370
|
-
if (preEditRowRef) preEditRowRef.current = null;
|
|
371
|
-
return _context4.abrupt("return", res);
|
|
372
|
-
case 19:
|
|
373
|
-
case "end":
|
|
374
|
-
return _context4.stop();
|
|
375
|
-
}
|
|
376
|
-
}, _callee4);
|
|
377
|
-
}));
|
|
378
|
-
return function (_x2) {
|
|
379
|
-
return _ref6.apply(this, arguments);
|
|
380
|
-
};
|
|
381
|
-
}()),
|
|
382
|
-
children: cancelText || '取消'
|
|
383
|
-
}, "cancel");
|
|
384
|
-
};
|
|
385
|
-
export function defaultActionRender(row, config) {
|
|
386
|
-
var recordKey = config.recordKey,
|
|
387
|
-
newLineConfig = config.newLineConfig,
|
|
388
|
-
saveText = config.saveText,
|
|
389
|
-
deleteText = config.deleteText;
|
|
390
|
-
var SaveEditableActionRef = /*#__PURE__*/forwardRef(SaveEditableAction);
|
|
391
|
-
var saveRef = /*#__PURE__*/createRef();
|
|
392
|
-
return {
|
|
393
|
-
save: /*#__PURE__*/_jsx(SaveEditableActionRef, _objectSpread(_objectSpread({}, config), {}, {
|
|
394
|
-
row: row,
|
|
395
|
-
ref: saveRef,
|
|
396
|
-
children: saveText
|
|
397
|
-
}), 'save' + recordKey),
|
|
398
|
-
saveRef: saveRef,
|
|
399
|
-
delete: (newLineConfig === null || newLineConfig === void 0 ? void 0 : newLineConfig.options.recordKey) !== recordKey ? /*#__PURE__*/_jsx(DeleteEditableAction, _objectSpread(_objectSpread({}, config), {}, {
|
|
400
|
-
row: row,
|
|
401
|
-
children: deleteText
|
|
402
|
-
}), 'delete' + recordKey) : undefined,
|
|
403
|
-
cancel: /*#__PURE__*/_jsx(CancelEditableAction, _objectSpread(_objectSpread({}, config), {}, {
|
|
404
|
-
row: row
|
|
405
|
-
}), 'cancel' + recordKey)
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* 一个方便的hooks 用于维护编辑的状态
|
|
411
|
-
*
|
|
412
|
-
* @param props
|
|
413
|
-
*/
|
|
414
|
-
export function useEditableArray(props) {
|
|
415
|
-
// Internationalization
|
|
416
|
-
var intl = useIntl();
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* 点击开始编辑之前的保存数据用的
|
|
420
|
-
*/
|
|
421
|
-
var preEditRowRef = useRef(null);
|
|
422
|
-
var _useState = useState(undefined),
|
|
423
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
424
|
-
newLineRecordCache = _useState2[0],
|
|
425
|
-
setNewLineRecordCache = _useState2[1];
|
|
426
|
-
var resetMapRef = function resetMapRef() {
|
|
427
|
-
var map = new Map();
|
|
428
|
-
//存在children时会覆盖Map的key,导致使用数组索引查找key错误
|
|
429
|
-
var loopGetKey = function loopGetKey(dataSource, parentKey) {
|
|
430
|
-
dataSource === null || dataSource === void 0 || dataSource.forEach(function (record, index) {
|
|
431
|
-
var _recordKeyToString2;
|
|
432
|
-
var key = parentKey === undefined || parentKey === null ? index.toString() : parentKey + '_' + index.toString();
|
|
433
|
-
map.set(key, recordKeyToString(props.getRowKey(record, -1)));
|
|
434
|
-
map.set((_recordKeyToString2 = recordKeyToString(props.getRowKey(record, -1))) === null || _recordKeyToString2 === void 0 ? void 0 : _recordKeyToString2.toString(), key);
|
|
435
|
-
if (props.childrenColumnName && record !== null && record !== void 0 && record[props.childrenColumnName]) {
|
|
436
|
-
loopGetKey(record[props.childrenColumnName], key);
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
};
|
|
440
|
-
loopGetKey(props.dataSource);
|
|
441
|
-
return map;
|
|
442
|
-
};
|
|
443
|
-
var initDataSourceKeyIndexMap = useMemo(function () {
|
|
444
|
-
return resetMapRef();
|
|
445
|
-
}, []);
|
|
446
|
-
var dataSourceKeyIndexMapRef = useRef(initDataSourceKeyIndexMap);
|
|
447
|
-
var newLineRecordRef = useRef(undefined);
|
|
448
|
-
useDeepCompareEffectDebounce(function () {
|
|
449
|
-
dataSourceKeyIndexMapRef.current = resetMapRef();
|
|
450
|
-
}, [props.dataSource]);
|
|
451
|
-
|
|
452
|
-
// 这里这么做是为了存上次的状态,不然每次存一下再拿
|
|
453
|
-
newLineRecordRef.current = newLineRecordCache;
|
|
454
|
-
var editableType = props.type || 'single';
|
|
455
|
-
var _useLazyKVMap = useLazyKVMap(props.dataSource, 'children', props.getRowKey),
|
|
456
|
-
_useLazyKVMap2 = _slicedToArray(_useLazyKVMap, 1),
|
|
457
|
-
getRecordByKey = _useLazyKVMap2[0];
|
|
458
|
-
var _useMergedState = useMergedState([], {
|
|
459
|
-
value: props.editableKeys,
|
|
460
|
-
onChange: props.onChange ? function (keys) {
|
|
461
|
-
var _props$onChange, _keys$filter, _keys$map$filter;
|
|
462
|
-
props === null || props === void 0 || (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, // 计算编辑的key
|
|
463
|
-
(_keys$filter = keys === null || keys === void 0 ? void 0 : keys.filter(function (key) {
|
|
464
|
-
return key !== undefined;
|
|
465
|
-
})) !== null && _keys$filter !== void 0 ? _keys$filter : [], // 计算编辑的行
|
|
466
|
-
(_keys$map$filter = keys === null || keys === void 0 ? void 0 : keys.map(function (key) {
|
|
467
|
-
return getRecordByKey(key);
|
|
468
|
-
}).filter(function (key) {
|
|
469
|
-
return key !== undefined;
|
|
470
|
-
})) !== null && _keys$map$filter !== void 0 ? _keys$map$filter : []);
|
|
471
|
-
} : undefined
|
|
472
|
-
}),
|
|
473
|
-
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
474
|
-
editableKeys = _useMergedState2[0],
|
|
475
|
-
setEditableRowKeys = _useMergedState2[1];
|
|
476
|
-
|
|
477
|
-
/** 一个用来标志的set 提供了方便的 api 来去重什么的 */
|
|
478
|
-
var editableKeysSet = useMemo(function () {
|
|
479
|
-
var keys = editableType === 'single' ? editableKeys === null || editableKeys === void 0 ? void 0 : editableKeys.slice(0, 1) : editableKeys;
|
|
480
|
-
return new Set(keys);
|
|
481
|
-
}, [(editableKeys || []).join(','), editableType]);
|
|
482
|
-
var editableKeysRef = usePrevious(editableKeys);
|
|
483
|
-
|
|
484
|
-
/** 这行是不是编辑状态 */
|
|
485
|
-
var isEditable = useRefFunction(function (row) {
|
|
486
|
-
var _props$getRowKey, _props$getRowKey$toSt, _props$getRowKey2, _props$getRowKey2$toS;
|
|
487
|
-
// 为了兼容一下name 模式的 indexKey,所以需要判断两次,一次是index,一次是没有 index 的
|
|
488
|
-
var recordKeyOrIndex = (_props$getRowKey = props.getRowKey(row, row.index)) === null || _props$getRowKey === void 0 || (_props$getRowKey$toSt = _props$getRowKey.toString) === null || _props$getRowKey$toSt === void 0 ? void 0 : _props$getRowKey$toSt.call(_props$getRowKey);
|
|
489
|
-
// 这里是不设置 index 的地方
|
|
490
|
-
var recordKey = (_props$getRowKey2 = props.getRowKey(row, -1)) === null || _props$getRowKey2 === void 0 || (_props$getRowKey2$toS = _props$getRowKey2.toString) === null || _props$getRowKey2$toS === void 0 ? void 0 : _props$getRowKey2$toS.call(_props$getRowKey2);
|
|
491
|
-
|
|
492
|
-
// 都转化为了字符串,不然 number 和 string
|
|
493
|
-
var stringEditableKeys = editableKeys === null || editableKeys === void 0 ? void 0 : editableKeys.map(function (key) {
|
|
494
|
-
return key === null || key === void 0 ? void 0 : key.toString();
|
|
495
|
-
});
|
|
496
|
-
var stringEditableKeysRef = (editableKeysRef === null || editableKeysRef === void 0 ? void 0 : editableKeysRef.map(function (key) {
|
|
497
|
-
return key === null || key === void 0 ? void 0 : key.toString();
|
|
498
|
-
})) || [];
|
|
499
|
-
var preIsEditable = props.tableName && !!(stringEditableKeysRef !== null && stringEditableKeysRef !== void 0 && stringEditableKeysRef.includes(recordKey)) || !!(stringEditableKeysRef !== null && stringEditableKeysRef !== void 0 && stringEditableKeysRef.includes(recordKeyOrIndex));
|
|
500
|
-
return {
|
|
501
|
-
recordKey: recordKey,
|
|
502
|
-
isEditable: props.tableName && (stringEditableKeys === null || stringEditableKeys === void 0 ? void 0 : stringEditableKeys.includes(recordKey)) || (stringEditableKeys === null || stringEditableKeys === void 0 ? void 0 : stringEditableKeys.includes(recordKeyOrIndex)),
|
|
503
|
-
preIsEditable: preIsEditable
|
|
504
|
-
};
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* 进入编辑状态
|
|
509
|
-
*
|
|
510
|
-
* @param recordKey
|
|
511
|
-
*/
|
|
512
|
-
var startEditable = useRefFunction(function (recordKey, record) {
|
|
513
|
-
var _ref7, _props$dataSource;
|
|
514
|
-
// 如果是单行的话,不允许多行编辑
|
|
515
|
-
if (editableKeysSet.size > 0 && editableType === 'single' && props.onlyOneLineEditorAlertMessage !== false) {
|
|
516
|
-
warning(props.onlyOneLineEditorAlertMessage || intl.getMessage('editableTable.onlyOneLineEditor', '只能同时编辑一行'));
|
|
517
|
-
return false;
|
|
518
|
-
}
|
|
519
|
-
editableKeysSet.add(recordKey);
|
|
520
|
-
setEditableRowKeys(Array.from(editableKeysSet));
|
|
521
|
-
|
|
522
|
-
// 这里是为了存上次的状态,不然取消的时候就丢掉了
|
|
523
|
-
preEditRowRef.current = (_ref7 = record !== null && record !== void 0 ? record : (_props$dataSource = props.dataSource) === null || _props$dataSource === void 0 ? void 0 : _props$dataSource.find(function (recordData, index) {
|
|
524
|
-
return props.getRowKey(recordData, index) === recordKey;
|
|
525
|
-
})) !== null && _ref7 !== void 0 ? _ref7 : null;
|
|
526
|
-
return true;
|
|
527
|
-
});
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* 退出编辑状态
|
|
531
|
-
*
|
|
532
|
-
* @param recordKey
|
|
533
|
-
*/
|
|
534
|
-
var cancelEditable = useRefFunction( /*#__PURE__*/function () {
|
|
535
|
-
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(recordKey, needReTry) {
|
|
536
|
-
var relayKey, key;
|
|
537
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
538
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
539
|
-
case 0:
|
|
540
|
-
relayKey = recordKeyToString(recordKey).toString();
|
|
541
|
-
key = dataSourceKeyIndexMapRef.current.get(relayKey);
|
|
542
|
-
/** 如果没找到key,转化一下再去找 */
|
|
543
|
-
if (!(!editableKeysSet.has(relayKey) && key && (needReTry !== null && needReTry !== void 0 ? needReTry : true) && props.tableName)) {
|
|
544
|
-
_context5.next = 5;
|
|
545
|
-
break;
|
|
546
|
-
}
|
|
547
|
-
cancelEditable(key, false);
|
|
548
|
-
return _context5.abrupt("return");
|
|
549
|
-
case 5:
|
|
550
|
-
/** 如果这个是 new Line 直接删除 */
|
|
551
|
-
if (newLineRecordCache && newLineRecordCache.options.recordKey === recordKey) {
|
|
552
|
-
setNewLineRecordCache(undefined);
|
|
553
|
-
}
|
|
554
|
-
editableKeysSet.delete(relayKey);
|
|
555
|
-
editableKeysSet.delete(recordKeyToString(recordKey));
|
|
556
|
-
setEditableRowKeys(Array.from(editableKeysSet));
|
|
557
|
-
return _context5.abrupt("return", true);
|
|
558
|
-
case 10:
|
|
559
|
-
case "end":
|
|
560
|
-
return _context5.stop();
|
|
561
|
-
}
|
|
562
|
-
}, _callee5);
|
|
563
|
-
}));
|
|
564
|
-
return function (_x3, _x4) {
|
|
565
|
-
return _ref8.apply(this, arguments);
|
|
566
|
-
};
|
|
567
|
-
}());
|
|
568
|
-
var propsOnValuesChange = useDebounceFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
569
|
-
var _props$onValuesChange;
|
|
570
|
-
var _len,
|
|
571
|
-
rest,
|
|
572
|
-
_key,
|
|
573
|
-
_args6 = arguments;
|
|
574
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
575
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
576
|
-
case 0:
|
|
577
|
-
for (_len = _args6.length, rest = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
578
|
-
rest[_key] = _args6[_key];
|
|
579
|
-
}
|
|
580
|
-
(_props$onValuesChange = props.onValuesChange) === null || _props$onValuesChange === void 0 || _props$onValuesChange.call.apply(_props$onValuesChange, [props].concat(rest));
|
|
581
|
-
case 2:
|
|
582
|
-
case "end":
|
|
583
|
-
return _context6.stop();
|
|
584
|
-
}
|
|
585
|
-
}, _callee6);
|
|
586
|
-
})), 64);
|
|
587
|
-
var onValuesChange = useRefFunction(function (value, values) {
|
|
588
|
-
var _Object$keys$pop;
|
|
589
|
-
if (!props.onValuesChange) {
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
var dataSource = props.dataSource;
|
|
593
|
-
|
|
594
|
-
// 这里是把正在编辑中的所有表单数据都修改掉
|
|
595
|
-
// 不然会用 props 里面的 dataSource,数据只有正在编辑中的
|
|
596
|
-
// Object.keys(get(values, [props.tableName || ''].flat(1)) || values).forEach((recordKey) => {
|
|
597
|
-
editableKeys === null || editableKeys === void 0 || editableKeys.forEach(function (eachRecordKey) {
|
|
598
|
-
if ((newLineRecordCache === null || newLineRecordCache === void 0 ? void 0 : newLineRecordCache.options.recordKey) === eachRecordKey) return;
|
|
599
|
-
var recordKey = eachRecordKey.toString();
|
|
600
|
-
// 如果数据在这个 form 中没有展示,也不显示
|
|
601
|
-
var editRow = get(values, [props.tableName || '', recordKey].flat(1).filter(function (key) {
|
|
602
|
-
return key || key === 0;
|
|
603
|
-
}));
|
|
604
|
-
if (!editRow) return;
|
|
605
|
-
dataSource = editableRowByKey({
|
|
606
|
-
data: dataSource,
|
|
607
|
-
getRowKey: props.getRowKey,
|
|
608
|
-
row: editRow,
|
|
609
|
-
key: recordKey,
|
|
610
|
-
childrenColumnName: props.childrenColumnName || 'children'
|
|
611
|
-
}, 'update');
|
|
612
|
-
});
|
|
613
|
-
var relayValue = value;
|
|
614
|
-
var recordKey = (_Object$keys$pop = Object.keys(relayValue || {}).pop()) === null || _Object$keys$pop === void 0 ? void 0 : _Object$keys$pop.toString();
|
|
615
|
-
|
|
616
|
-
//从form 和 cache 中取得数据
|
|
617
|
-
var newLineRecordData = _objectSpread(_objectSpread({}, newLineRecordCache === null || newLineRecordCache === void 0 ? void 0 : newLineRecordCache.defaultValue), get(values, [props.tableName || '', recordKey.toString()].flat(1).filter(function (key) {
|
|
618
|
-
return key || key === 0;
|
|
619
|
-
})));
|
|
620
|
-
|
|
621
|
-
/** 如果已经在 dataSource 中存在了,直接 find */
|
|
622
|
-
var editRow = dataSourceKeyIndexMapRef.current.has(recordKeyToString(recordKey)) ? dataSource.find(function (item, index) {
|
|
623
|
-
var _props$getRowKey3;
|
|
624
|
-
var key = (_props$getRowKey3 = props.getRowKey(item, index)) === null || _props$getRowKey3 === void 0 ? void 0 : _props$getRowKey3.toString();
|
|
625
|
-
return key === recordKey;
|
|
626
|
-
}) : newLineRecordData;
|
|
627
|
-
propsOnValuesChange.run(editRow || newLineRecordData, dataSource);
|
|
628
|
-
});
|
|
629
|
-
var saveRefsMap = useRef(new Map());
|
|
630
|
-
useEffect(function () {
|
|
631
|
-
// 确保只保留编辑状态的,其它的都删除掉
|
|
632
|
-
saveRefsMap.current.forEach(function (ref, key) {
|
|
633
|
-
if (!editableKeysSet.has(key)) {
|
|
634
|
-
saveRefsMap.current.delete(key);
|
|
635
|
-
}
|
|
636
|
-
});
|
|
637
|
-
}, [saveRefsMap, editableKeysSet]);
|
|
638
|
-
/**
|
|
639
|
-
* 保存编辑行
|
|
640
|
-
*
|
|
641
|
-
* @param recordKey
|
|
642
|
-
* @param needReTry
|
|
643
|
-
*/
|
|
644
|
-
var saveEditable = useRefFunction( /*#__PURE__*/function () {
|
|
645
|
-
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(recordKey, needReTry) {
|
|
646
|
-
var relayKey, key, saveRef, _saveRef$current;
|
|
647
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
648
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
649
|
-
case 0:
|
|
650
|
-
relayKey = recordKeyToString(recordKey);
|
|
651
|
-
key = dataSourceKeyIndexMapRef.current.get(recordKey.toString());
|
|
652
|
-
/** 如果没找到key,转化一下再去找 */
|
|
653
|
-
if (!(!editableKeysSet.has(relayKey) && key && (needReTry !== null && needReTry !== void 0 ? needReTry : true) && props.tableName)) {
|
|
654
|
-
_context7.next = 6;
|
|
655
|
-
break;
|
|
656
|
-
}
|
|
657
|
-
_context7.next = 5;
|
|
658
|
-
return saveEditable(key, false);
|
|
659
|
-
case 5:
|
|
660
|
-
return _context7.abrupt("return", _context7.sent);
|
|
661
|
-
case 6:
|
|
662
|
-
saveRef = saveRefsMap.current.get(relayKey) || saveRefsMap.current.get(relayKey.toString());
|
|
663
|
-
_context7.prev = 7;
|
|
664
|
-
_context7.next = 10;
|
|
665
|
-
return saveRef === null || saveRef === void 0 || (_saveRef$current = saveRef.current) === null || _saveRef$current === void 0 ? void 0 : _saveRef$current.save();
|
|
666
|
-
case 10:
|
|
667
|
-
_context7.next = 15;
|
|
668
|
-
break;
|
|
669
|
-
case 12:
|
|
670
|
-
_context7.prev = 12;
|
|
671
|
-
_context7.t0 = _context7["catch"](7);
|
|
672
|
-
return _context7.abrupt("return", false);
|
|
673
|
-
case 15:
|
|
674
|
-
editableKeysSet.delete(relayKey);
|
|
675
|
-
editableKeysSet.delete(relayKey.toString());
|
|
676
|
-
setEditableRowKeys(Array.from(editableKeysSet));
|
|
677
|
-
return _context7.abrupt("return", true);
|
|
678
|
-
case 19:
|
|
679
|
-
case "end":
|
|
680
|
-
return _context7.stop();
|
|
681
|
-
}
|
|
682
|
-
}, _callee7, null, [[7, 12]]);
|
|
683
|
-
}));
|
|
684
|
-
return function (_x5, _x6) {
|
|
685
|
-
return _ref10.apply(this, arguments);
|
|
686
|
-
};
|
|
687
|
-
}());
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* 同时只能支持一行,取消之后数据消息,不会触发 dataSource
|
|
691
|
-
*
|
|
692
|
-
* @param row
|
|
693
|
-
* @param options
|
|
694
|
-
* @name 增加新的行
|
|
695
|
-
*/
|
|
696
|
-
var addEditRecord = useRefFunction(function (row, options) {
|
|
697
|
-
if (options !== null && options !== void 0 && options.parentKey && !dataSourceKeyIndexMapRef.current.has(recordKeyToString(options === null || options === void 0 ? void 0 : options.parentKey).toString())) {
|
|
698
|
-
console.warn("can't find record by key", options === null || options === void 0 ? void 0 : options.parentKey);
|
|
699
|
-
return false;
|
|
700
|
-
}
|
|
701
|
-
// 暂时不支持多行新增
|
|
702
|
-
if (newLineRecordRef.current && props.onlyAddOneLineAlertMessage !== false) {
|
|
703
|
-
warning(props.onlyAddOneLineAlertMessage || intl.getMessage('editableTable.onlyAddOneLine', '只能新增一行'));
|
|
704
|
-
return false;
|
|
705
|
-
}
|
|
706
|
-
// 如果是单行的话,不允许多行编辑
|
|
707
|
-
if (editableKeysSet.size > 0 && editableType === 'single' && props.onlyOneLineEditorAlertMessage !== false) {
|
|
708
|
-
warning(props.onlyOneLineEditorAlertMessage || intl.getMessage('editableTable.onlyOneLineEditor', '只能同时编辑一行'));
|
|
709
|
-
return false;
|
|
710
|
-
}
|
|
711
|
-
// 防止多次渲染
|
|
712
|
-
var recordKey = props.getRowKey(row, -1);
|
|
713
|
-
if (!recordKey && recordKey !== 0) {
|
|
714
|
-
noteOnce(!!recordKey, '请设置 recordCreatorProps.record 并返回一个唯一的key \n https://@vtx/components.ant.design/components/editable-table#editable-%E6%96%B0%E5%BB%BA%E8%A1%8C');
|
|
715
|
-
throw new Error('请设置 recordCreatorProps.record 并返回一个唯一的key');
|
|
716
|
-
}
|
|
717
|
-
editableKeysSet.add(recordKey);
|
|
718
|
-
setEditableRowKeys(Array.from(editableKeysSet));
|
|
719
|
-
|
|
720
|
-
// 如果是dataSource 新增模式的话,取消再开始编辑,
|
|
721
|
-
// 这样就可以把新增到 dataSource的数据进入编辑模式了
|
|
722
|
-
// [a,b,cache] => [a,b,c]
|
|
723
|
-
if ((options === null || options === void 0 ? void 0 : options.newRecordType) === 'dataSource' || props.tableName) {
|
|
724
|
-
var _recordKeyToString3;
|
|
725
|
-
var actionProps = {
|
|
726
|
-
data: props.dataSource,
|
|
727
|
-
getRowKey: props.getRowKey,
|
|
728
|
-
row: _objectSpread(_objectSpread({}, row), {}, {
|
|
729
|
-
map_row_parentKey: options !== null && options !== void 0 && options.parentKey ? (_recordKeyToString3 = recordKeyToString(options === null || options === void 0 ? void 0 : options.parentKey)) === null || _recordKeyToString3 === void 0 ? void 0 : _recordKeyToString3.toString() : undefined
|
|
730
|
-
}),
|
|
731
|
-
key: recordKey,
|
|
732
|
-
childrenColumnName: props.childrenColumnName || 'children'
|
|
733
|
-
};
|
|
734
|
-
props.setDataSource(editableRowByKey(actionProps, (options === null || options === void 0 ? void 0 : options.position) === 'top' ? 'top' : 'update'));
|
|
735
|
-
} else {
|
|
736
|
-
setNewLineRecordCache({
|
|
737
|
-
defaultValue: row,
|
|
738
|
-
options: _objectSpread(_objectSpread({}, options), {}, {
|
|
739
|
-
recordKey: recordKey
|
|
740
|
-
})
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
return true;
|
|
744
|
-
});
|
|
745
|
-
var saveText = (props === null || props === void 0 ? void 0 : props.saveText) || intl.getMessage('editableTable.action.save', '保存');
|
|
746
|
-
var deleteText = (props === null || props === void 0 ? void 0 : props.deleteText) || intl.getMessage('editableTable.action.delete', '删除');
|
|
747
|
-
var cancelText = (props === null || props === void 0 ? void 0 : props.cancelText) || intl.getMessage('editableTable.action.cancel', '取消');
|
|
748
|
-
var actionSaveRef = useRefFunction( /*#__PURE__*/function () {
|
|
749
|
-
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(recordKey, editRow, originRow, newLine) {
|
|
750
|
-
var _props$onSave, _recordKeyToString4, _options$parentKey;
|
|
751
|
-
var res, _ref12, options, actionProps;
|
|
752
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
753
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
754
|
-
case 0:
|
|
755
|
-
_context8.next = 2;
|
|
756
|
-
return props === null || props === void 0 || (_props$onSave = props.onSave) === null || _props$onSave === void 0 ? void 0 : _props$onSave.call(props, recordKey, editRow, originRow, newLine);
|
|
757
|
-
case 2:
|
|
758
|
-
res = _context8.sent;
|
|
759
|
-
_context8.next = 5;
|
|
760
|
-
return cancelEditable(recordKey);
|
|
761
|
-
case 5:
|
|
762
|
-
_ref12 = newLine || newLineRecordRef.current || {}, options = _ref12.options;
|
|
763
|
-
if (!(!(options !== null && options !== void 0 && options.parentKey) && (options === null || options === void 0 ? void 0 : options.recordKey) === recordKey)) {
|
|
764
|
-
_context8.next = 9;
|
|
765
|
-
break;
|
|
766
|
-
}
|
|
767
|
-
if ((options === null || options === void 0 ? void 0 : options.position) === 'top') {
|
|
768
|
-
props.setDataSource([editRow].concat(_toConsumableArray(props.dataSource)));
|
|
769
|
-
} else {
|
|
770
|
-
props.setDataSource([].concat(_toConsumableArray(props.dataSource), [editRow]));
|
|
771
|
-
}
|
|
772
|
-
return _context8.abrupt("return", res);
|
|
773
|
-
case 9:
|
|
774
|
-
actionProps = {
|
|
775
|
-
data: props.dataSource,
|
|
776
|
-
getRowKey: props.getRowKey,
|
|
777
|
-
row: options ? _objectSpread(_objectSpread({}, editRow), {}, {
|
|
778
|
-
map_row_parentKey: (_recordKeyToString4 = recordKeyToString((_options$parentKey = options === null || options === void 0 ? void 0 : options.parentKey) !== null && _options$parentKey !== void 0 ? _options$parentKey : '')) === null || _recordKeyToString4 === void 0 ? void 0 : _recordKeyToString4.toString()
|
|
779
|
-
}) : editRow,
|
|
780
|
-
key: recordKey,
|
|
781
|
-
childrenColumnName: props.childrenColumnName || 'children'
|
|
782
|
-
};
|
|
783
|
-
props.setDataSource(editableRowByKey(actionProps, (options === null || options === void 0 ? void 0 : options.position) === 'top' ? 'top' : 'update'));
|
|
784
|
-
_context8.next = 13;
|
|
785
|
-
return cancelEditable(recordKey);
|
|
786
|
-
case 13:
|
|
787
|
-
return _context8.abrupt("return", res);
|
|
788
|
-
case 14:
|
|
789
|
-
case "end":
|
|
790
|
-
return _context8.stop();
|
|
791
|
-
}
|
|
792
|
-
}, _callee8);
|
|
793
|
-
}));
|
|
794
|
-
return function (_x7, _x8, _x9, _x10) {
|
|
795
|
-
return _ref11.apply(this, arguments);
|
|
796
|
-
};
|
|
797
|
-
}());
|
|
798
|
-
var actionDeleteRef = useRefFunction( /*#__PURE__*/function () {
|
|
799
|
-
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(recordKey, editRow) {
|
|
800
|
-
var _props$onDelete2;
|
|
801
|
-
var actionProps, res;
|
|
802
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
803
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
804
|
-
case 0:
|
|
805
|
-
actionProps = {
|
|
806
|
-
data: props.dataSource,
|
|
807
|
-
getRowKey: props.getRowKey,
|
|
808
|
-
row: editRow,
|
|
809
|
-
key: recordKey,
|
|
810
|
-
childrenColumnName: props.childrenColumnName || 'children'
|
|
811
|
-
};
|
|
812
|
-
_context9.next = 3;
|
|
813
|
-
return props === null || props === void 0 || (_props$onDelete2 = props.onDelete) === null || _props$onDelete2 === void 0 ? void 0 : _props$onDelete2.call(props, recordKey, editRow);
|
|
814
|
-
case 3:
|
|
815
|
-
res = _context9.sent;
|
|
816
|
-
_context9.next = 6;
|
|
817
|
-
return cancelEditable(recordKey, false);
|
|
818
|
-
case 6:
|
|
819
|
-
props.setDataSource(editableRowByKey(actionProps, 'delete'));
|
|
820
|
-
return _context9.abrupt("return", res);
|
|
821
|
-
case 8:
|
|
822
|
-
case "end":
|
|
823
|
-
return _context9.stop();
|
|
824
|
-
}
|
|
825
|
-
}, _callee9);
|
|
826
|
-
}));
|
|
827
|
-
return function (_x11, _x12) {
|
|
828
|
-
return _ref13.apply(this, arguments);
|
|
829
|
-
};
|
|
830
|
-
}());
|
|
831
|
-
var actionCancelRef = useRefFunction( /*#__PURE__*/function () {
|
|
832
|
-
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(recordKey, editRow, originRow, newLine) {
|
|
833
|
-
var _props$onCancel;
|
|
834
|
-
var res;
|
|
835
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
836
|
-
while (1) switch (_context10.prev = _context10.next) {
|
|
837
|
-
case 0:
|
|
838
|
-
_context10.next = 2;
|
|
839
|
-
return props === null || props === void 0 || (_props$onCancel = props.onCancel) === null || _props$onCancel === void 0 ? void 0 : _props$onCancel.call(props, recordKey, editRow, originRow, newLine);
|
|
840
|
-
case 2:
|
|
841
|
-
res = _context10.sent;
|
|
842
|
-
return _context10.abrupt("return", res);
|
|
843
|
-
case 4:
|
|
844
|
-
case "end":
|
|
845
|
-
return _context10.stop();
|
|
846
|
-
}
|
|
847
|
-
}, _callee10);
|
|
848
|
-
}));
|
|
849
|
-
return function (_x13, _x14, _x15, _x16) {
|
|
850
|
-
return _ref14.apply(this, arguments);
|
|
851
|
-
};
|
|
852
|
-
}());
|
|
853
|
-
|
|
854
|
-
// 如果传入了自定义的actionRender,使用useRefFunction以确保内部的事件处理函数可以访问最新的state
|
|
855
|
-
var existCustomActionRender = props.actionRender && typeof props.actionRender === 'function';
|
|
856
|
-
var customActionRender = existCustomActionRender ? props.actionRender : function () {};
|
|
857
|
-
var customActionRenderRef = useRefFunction(customActionRender);
|
|
858
|
-
var actionRender = function actionRender(row) {
|
|
859
|
-
var key = props.getRowKey(row, row.index);
|
|
860
|
-
var config = {
|
|
861
|
-
saveText: saveText,
|
|
862
|
-
cancelText: cancelText,
|
|
863
|
-
deleteText: deleteText,
|
|
864
|
-
addEditRecord: addEditRecord,
|
|
865
|
-
recordKey: key,
|
|
866
|
-
cancelEditable: cancelEditable,
|
|
867
|
-
index: row.index,
|
|
868
|
-
tableName: props.tableName,
|
|
869
|
-
newLineConfig: newLineRecordCache,
|
|
870
|
-
onCancel: actionCancelRef,
|
|
871
|
-
onDelete: actionDeleteRef,
|
|
872
|
-
onSave: actionSaveRef,
|
|
873
|
-
editableKeys: editableKeys,
|
|
874
|
-
setEditableRowKeys: setEditableRowKeys,
|
|
875
|
-
preEditRowRef: preEditRowRef,
|
|
876
|
-
deletePopconfirmMessage: props.deletePopconfirmMessage || "".concat(intl.getMessage('deleteThisLine', '删除此项'), "?")
|
|
877
|
-
};
|
|
878
|
-
var renderResult = defaultActionRender(row, config);
|
|
879
|
-
// 缓存一下saveRef
|
|
880
|
-
if (props.tableName) {
|
|
881
|
-
saveRefsMap.current.set(dataSourceKeyIndexMapRef.current.get(recordKeyToString(key)) || recordKeyToString(key), renderResult.saveRef);
|
|
882
|
-
} else {
|
|
883
|
-
saveRefsMap.current.set(recordKeyToString(key), renderResult.saveRef);
|
|
884
|
-
}
|
|
885
|
-
if (existCustomActionRender) return customActionRenderRef(row, config, {
|
|
886
|
-
save: renderResult.save,
|
|
887
|
-
delete: renderResult.delete,
|
|
888
|
-
cancel: renderResult.cancel
|
|
889
|
-
});
|
|
890
|
-
return [renderResult.save, renderResult.delete, renderResult.cancel];
|
|
891
|
-
};
|
|
892
|
-
return {
|
|
893
|
-
editableKeys: editableKeys,
|
|
894
|
-
setEditableRowKeys: setEditableRowKeys,
|
|
895
|
-
isEditable: isEditable,
|
|
896
|
-
actionRender: actionRender,
|
|
897
|
-
startEditable: startEditable,
|
|
898
|
-
cancelEditable: cancelEditable,
|
|
899
|
-
addEditRecord: addEditRecord,
|
|
900
|
-
saveEditable: saveEditable,
|
|
901
|
-
newLineRecord: newLineRecordCache,
|
|
902
|
-
preEditableKeys: editableKeysRef,
|
|
903
|
-
onValuesChange: onValuesChange,
|
|
904
|
-
getRealIndex: props.getRealIndex
|
|
905
|
-
};
|
|
906
|
-
}
|