feffery_antd_components 0.4.3-rc6 → 0.4.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/CONTRIBUTING.md +4 -4
- package/DESCRIPTION +1 -1
- package/LICENSE +21 -21
- package/MANIFEST.in +6 -6
- package/Project.toml +1 -1
- package/README-en_US.md +73 -73
- package/README.md +87 -87
- package/bug_fix.py +21 -36
- package/fac-logo.svg +151 -151
- package/feffery_antd_components/AntdAccordion.py +7 -7
- package/feffery_antd_components/AntdAffix.py +2 -2
- package/feffery_antd_components/AntdAlert.py +5 -5
- package/feffery_antd_components/AntdAnchor.py +5 -5
- package/feffery_antd_components/AntdAvatar.py +4 -4
- package/feffery_antd_components/AntdAvatarGroup.py +1 -1
- package/feffery_antd_components/AntdBackTop.py +4 -4
- package/feffery_antd_components/AntdBadge.py +5 -5
- package/feffery_antd_components/AntdBreadcrumb.py +4 -4
- package/feffery_antd_components/AntdButton.py +14 -14
- package/feffery_antd_components/AntdCalendar.py +4 -4
- package/feffery_antd_components/AntdCard.py +5 -5
- package/feffery_antd_components/AntdCardGrid.py +3 -3
- package/feffery_antd_components/AntdCardMeta.py +1 -1
- package/feffery_antd_components/AntdCarousel.py +13 -13
- package/feffery_antd_components/AntdCascader.py +16 -17
- package/feffery_antd_components/AntdCenter.py +3 -3
- package/feffery_antd_components/AntdCheckCard.py +7 -7
- package/feffery_antd_components/AntdCheckCardGroup.py +9 -9
- package/feffery_antd_components/AntdCheckableTag.py +2 -2
- package/feffery_antd_components/AntdCheckbox.py +8 -8
- package/feffery_antd_components/AntdCheckboxGroup.py +6 -6
- package/feffery_antd_components/AntdCol.py +5 -5
- package/feffery_antd_components/AntdCollapse.py +8 -8
- package/feffery_antd_components/AntdColorPicker.py +13 -13
- package/feffery_antd_components/AntdComment.py +7 -7
- package/feffery_antd_components/AntdCompact.py +3 -3
- package/feffery_antd_components/AntdConfigProvider.py +6 -6
- package/feffery_antd_components/AntdContent.py +1 -1
- package/feffery_antd_components/AntdCopyText.py +2 -2
- package/feffery_antd_components/AntdCountdown.py +1 -1
- package/feffery_antd_components/AntdCountup.py +1 -1
- package/feffery_antd_components/AntdCustomSkeleton.py +5 -5
- package/feffery_antd_components/AntdDatePicker.py +13 -13
- package/feffery_antd_components/AntdDateRangePicker.py +12 -12
- package/feffery_antd_components/AntdDescriptionItem.py +2 -2
- package/feffery_antd_components/AntdDescriptions.py +6 -6
- package/feffery_antd_components/AntdDivider.py +5 -5
- package/feffery_antd_components/AntdDraggerUpload.py +15 -15
- package/feffery_antd_components/AntdDrawer.py +12 -12
- package/feffery_antd_components/AntdDropdown.py +18 -18
- package/feffery_antd_components/AntdEmpty.py +2 -2
- package/feffery_antd_components/AntdFlex.py +6 -6
- package/feffery_antd_components/AntdFloatButton.py +5 -5
- package/feffery_antd_components/AntdFloatButtonGroup.py +3 -3
- package/feffery_antd_components/AntdFooter.py +1 -1
- package/feffery_antd_components/AntdForm.py +10 -6
- package/feffery_antd_components/AntdFormItem.py +4 -4
- package/feffery_antd_components/AntdFormRender.py +2 -2
- package/feffery_antd_components/AntdHappyProvider.py +2 -2
- package/feffery_antd_components/AntdHeader.py +1 -1
- package/feffery_antd_components/AntdIcon.py +3 -3
- package/feffery_antd_components/AntdImage.py +6 -6
- package/feffery_antd_components/AntdImageGroup.py +6 -6
- package/feffery_antd_components/AntdInput.py +17 -17
- package/feffery_antd_components/AntdInputNumber.py +12 -12
- package/feffery_antd_components/AntdLayout.py +1 -1
- package/feffery_antd_components/AntdMentions.py +9 -9
- package/feffery_antd_components/AntdMenu.py +9 -9
- package/feffery_antd_components/AntdMessage.py +3 -3
- package/feffery_antd_components/AntdModal.py +28 -28
- package/feffery_antd_components/AntdNotification.py +9 -9
- package/feffery_antd_components/AntdOTP.py +7 -7
- package/feffery_antd_components/AntdPageHeader.py +5 -5
- package/feffery_antd_components/AntdPagination.py +15 -15
- package/feffery_antd_components/AntdParagraph.py +2 -2
- package/feffery_antd_components/AntdPictureUpload.py +28 -28
- package/feffery_antd_components/AntdPopconfirm.py +21 -21
- package/feffery_antd_components/AntdPopover.py +9 -9
- package/feffery_antd_components/AntdPopupCard.py +9 -9
- package/feffery_antd_components/AntdProgress.py +9 -9
- package/feffery_antd_components/AntdQRCode.py +10 -10
- package/feffery_antd_components/AntdRadioGroup.py +9 -9
- package/feffery_antd_components/AntdRate.py +9 -9
- package/feffery_antd_components/AntdResult.py +1 -1
- package/feffery_antd_components/AntdRibbon.py +2 -2
- package/feffery_antd_components/AntdRow.py +3 -3
- package/feffery_antd_components/AntdSegmented.py +9 -9
- package/feffery_antd_components/AntdSegmentedColoring.py +11 -11
- package/feffery_antd_components/AntdSelect.py +19 -19
- package/feffery_antd_components/AntdSider.py +6 -6
- package/feffery_antd_components/AntdSkeleton.py +11 -11
- package/feffery_antd_components/AntdSkeletonAvatar.py +3 -3
- package/feffery_antd_components/AntdSkeletonButton.py +5 -5
- package/feffery_antd_components/AntdSkeletonImage.py +1 -1
- package/feffery_antd_components/AntdSkeletonInput.py +3 -3
- package/feffery_antd_components/AntdSlider.py +10 -10
- package/feffery_antd_components/AntdSpace.py +4 -4
- package/feffery_antd_components/AntdSpin.py +7 -8
- package/feffery_antd_components/AntdSplitter.py +5 -5
- package/feffery_antd_components/AntdSpoiler.py +5 -5
- package/feffery_antd_components/AntdStatistic.py +2 -2
- package/feffery_antd_components/AntdSteps.py +8 -8
- package/feffery_antd_components/AntdSwitch.py +8 -8
- package/feffery_antd_components/AntdTable.py +64 -63
- package/feffery_antd_components/AntdTabs.py +13 -14
- package/feffery_antd_components/AntdTag.py +4 -4
- package/feffery_antd_components/AntdText.py +2 -2
- package/feffery_antd_components/AntdTimePicker.py +16 -16
- package/feffery_antd_components/AntdTimeRangePicker.py +15 -15
- package/feffery_antd_components/AntdTimeline.py +2 -2
- package/feffery_antd_components/AntdTitle.py +2 -2
- package/feffery_antd_components/AntdTooltip.py +9 -9
- package/feffery_antd_components/AntdTour.py +9 -9
- package/feffery_antd_components/AntdTransfer.py +11 -11
- package/feffery_antd_components/AntdTree.py +17 -17
- package/feffery_antd_components/AntdTreeSelect.py +18 -18
- package/feffery_antd_components/AntdUpload.py +18 -18
- package/feffery_antd_components/AntdWatermark.py +6 -6
- package/feffery_antd_components/Fragment.py +1 -1
- package/feffery_antd_components/__init__.py +88 -88
- package/feffery_antd_components/_icons.py +559 -559
- package/feffery_antd_components/alias.py +222 -222
- package/feffery_antd_components/async-antd_table.js +2 -2
- package/feffery_antd_components/async-data_display.js +1 -1
- package/feffery_antd_components/async-data_entry.js +3 -3
- package/feffery_antd_components/async-upload.js +2 -2
- package/feffery_antd_components/feffery_antd_components.min.js +8 -8
- package/feffery_antd_components/metadata.json +1 -1
- package/feffery_antd_components/package-info.json +111 -96
- package/feffery_antd_components/utils.py +262 -262
- package/package.json +111 -96
- package/pytest.ini +5 -5
- package/release-to-test-pypi.sh +1 -1
- package/requirements.txt +2 -2
- package/review_checklist.md +47 -47
- package/ruff.toml +4 -4
- package/setup.py +33 -33
- package/src/jl/'feffery'_antdform.jl +2 -1
- package/src/jl/'feffery'_antdtable.jl +7 -6
- package/src/lib/components/dataDisplay/AntdAccordion.react.js +232 -232
- package/src/lib/components/dataDisplay/AntdAvatar.react.js +177 -177
- package/src/lib/components/dataDisplay/AntdAvatarGroup.react.js +133 -133
- package/src/lib/components/dataDisplay/AntdBadge.react.js +196 -196
- package/src/lib/components/dataDisplay/AntdCarousel.react.js +187 -187
- package/src/lib/components/dataDisplay/AntdCheckableTag.react.js +105 -105
- package/src/lib/components/dataDisplay/AntdCollapse.react.js +239 -239
- package/src/lib/components/dataDisplay/AntdComment.react.js +251 -251
- package/src/lib/components/dataDisplay/AntdCountdown.react.js +143 -143
- package/src/lib/components/dataDisplay/AntdCountup.react.js +133 -133
- package/src/lib/components/dataDisplay/AntdEmpty.react.js +162 -162
- package/src/lib/components/dataDisplay/AntdImage.react.js +202 -202
- package/src/lib/components/dataDisplay/AntdImageGroup.react.js +181 -181
- package/src/lib/components/dataDisplay/AntdPopover.react.js +220 -220
- package/src/lib/components/dataDisplay/AntdQRCode.react.js +191 -191
- package/src/lib/components/dataDisplay/AntdRibbon.react.js +105 -105
- package/src/lib/components/dataDisplay/AntdSegmented.react.js +234 -234
- package/src/lib/components/dataDisplay/AntdSpoiler.react.js +154 -154
- package/src/lib/components/dataDisplay/AntdStatistic.react.js +168 -168
- package/src/lib/components/dataDisplay/AntdTable.react.js +1859 -1858
- package/src/lib/components/dataDisplay/AntdTabs.react.js +352 -352
- package/src/lib/components/dataDisplay/AntdTag.react.js +135 -135
- package/src/lib/components/dataDisplay/AntdTimeline.react.js +136 -136
- package/src/lib/components/dataDisplay/AntdTooltip.react.js +230 -230
- package/src/lib/components/dataDisplay/AntdTree.react.js +641 -641
- package/src/lib/components/dataDisplay/card/AntdCard.react.js +249 -249
- package/src/lib/components/dataDisplay/card/AntdCardGrid.react.js +99 -99
- package/src/lib/components/dataDisplay/card/AntdCardMeta.react.js +97 -97
- package/src/lib/components/dataDisplay/descriptions/AntdDescriptionItem.react.js +130 -130
- package/src/lib/components/dataDisplay/descriptions/AntdDescriptions.react.js +237 -237
- package/src/lib/components/dataEntry/AntdCalendar.react.js +205 -205
- package/src/lib/components/dataEntry/AntdCascader.react.js +435 -435
- package/src/lib/components/dataEntry/AntdCheckbox.react.js +182 -182
- package/src/lib/components/dataEntry/AntdCheckboxGroup.react.js +193 -193
- package/src/lib/components/dataEntry/AntdColorPicker.react.js +240 -240
- package/src/lib/components/dataEntry/AntdDatePicker.react.js +432 -432
- package/src/lib/components/dataEntry/AntdDateRangePicker.react.js +439 -439
- package/src/lib/components/dataEntry/AntdInput.react.js +423 -423
- package/src/lib/components/dataEntry/AntdInputNumber.react.js +329 -329
- package/src/lib/components/dataEntry/AntdMentions.react.js +236 -236
- package/src/lib/components/dataEntry/AntdOTP.react.js +186 -186
- package/src/lib/components/dataEntry/AntdRadioGroup.react.js +241 -241
- package/src/lib/components/dataEntry/AntdRate.react.js +199 -199
- package/src/lib/components/dataEntry/AntdSegmentedColoring.react.js +251 -251
- package/src/lib/components/dataEntry/AntdSelect.react.js +492 -492
- package/src/lib/components/dataEntry/AntdSlider.react.js +325 -325
- package/src/lib/components/dataEntry/AntdSwitch.react.js +210 -210
- package/src/lib/components/dataEntry/AntdTimePicker.react.js +344 -344
- package/src/lib/components/dataEntry/AntdTimeRangePicker.react.js +325 -325
- package/src/lib/components/dataEntry/AntdTransfer.react.js +317 -317
- package/src/lib/components/dataEntry/AntdTreeSelect.react.js +573 -573
- package/src/lib/components/dataEntry/check-card/AntdCheckCard.react.js +186 -186
- package/src/lib/components/dataEntry/check-card/AntdCheckCardGroup.react.js +214 -214
- package/src/lib/components/dataEntry/form/AntdForm.react.js +201 -194
- package/src/lib/components/dataEntry/form/AntdFormItem.react.js +210 -210
- package/src/lib/components/dataEntry/upload/AntdDraggerUpload.react.js +504 -504
- package/src/lib/components/dataEntry/upload/AntdPictureUpload.react.js +530 -530
- package/src/lib/components/dataEntry/upload/AntdUpload.react.js +537 -537
- package/src/lib/components/feedback/AntdAlert.react.js +185 -185
- package/src/lib/components/feedback/AntdDrawer.react.js +306 -306
- package/src/lib/components/feedback/AntdMessage.react.js +143 -143
- package/src/lib/components/feedback/AntdModal.react.js +530 -530
- package/src/lib/components/feedback/AntdNotification.react.js +211 -211
- package/src/lib/components/feedback/AntdPopconfirm.react.js +433 -433
- package/src/lib/components/feedback/AntdPopupCard.react.js +362 -362
- package/src/lib/components/feedback/AntdProgress.react.js +300 -300
- package/src/lib/components/feedback/AntdResult.react.js +125 -125
- package/src/lib/components/feedback/AntdSpin.react.js +273 -273
- package/src/lib/components/feedback/skeleton/AntdCustomSkeleton.react.js +197 -197
- package/src/lib/components/feedback/skeleton/AntdSkeleton.react.js +291 -291
- package/src/lib/components/feedback/skeleton/AntdSkeletonAvatar.react.js +109 -109
- package/src/lib/components/feedback/skeleton/AntdSkeletonButton.react.js +114 -114
- package/src/lib/components/feedback/skeleton/AntdSkeletonImage.react.js +82 -82
- package/src/lib/components/feedback/skeleton/AntdSkeletonInput.react.js +98 -98
- package/src/lib/components/formRender/AntdFormRender.react.js +945 -945
- package/src/lib/components/general/AntdButton.react.js +328 -328
- package/src/lib/components/general/AntdFloatButton.react.js +157 -157
- package/src/lib/components/general/AntdFloatButtonGroup.react.js +162 -162
- package/src/lib/components/general/AntdIcon.react.js +176 -176
- package/src/lib/components/general/typography/AntdParagraph.react.js +202 -202
- package/src/lib/components/general/typography/AntdText.react.js +194 -194
- package/src/lib/components/general/typography/AntdTitle.react.js +186 -186
- package/src/lib/components/icons.react.js +1136 -1136
- package/src/lib/components/layout/AntdCenter.react.js +122 -122
- package/src/lib/components/layout/AntdCompact.react.js +108 -108
- package/src/lib/components/layout/AntdContent.react.js +92 -92
- package/src/lib/components/layout/AntdDivider.react.js +219 -219
- package/src/lib/components/layout/AntdFlex.react.js +143 -143
- package/src/lib/components/layout/AntdFooter.react.js +92 -92
- package/src/lib/components/layout/AntdHeader.react.js +92 -92
- package/src/lib/components/layout/AntdLayout.react.js +90 -90
- package/src/lib/components/layout/AntdSider.react.js +162 -162
- package/src/lib/components/layout/AntdSpace.react.js +213 -213
- package/src/lib/components/layout/AntdSplitter.react.js +173 -173
- package/src/lib/components/layout/grid/AntdCol.react.js +349 -349
- package/src/lib/components/layout/grid/AntdRow.react.js +152 -152
- package/src/lib/components/locales.react.js +197 -197
- package/src/lib/components/navigation/AntdAnchor.react.js +208 -208
- package/src/lib/components/navigation/AntdBreadcrumb.react.js +270 -270
- package/src/lib/components/navigation/AntdDropdown.react.js +469 -469
- package/src/lib/components/navigation/AntdMenu.react.js +573 -649
- package/src/lib/components/navigation/AntdPageHeader.react.js +139 -139
- package/src/lib/components/navigation/AntdPagination.react.js +303 -303
- package/src/lib/components/navigation/AntdSteps.react.js +199 -199
- package/src/lib/components/other/AntdAffix.react.js +120 -120
- package/src/lib/components/other/AntdBackTop.react.js +128 -128
- package/src/lib/components/other/AntdConfigProvider.react.js +246 -246
- package/src/lib/components/other/AntdCopyText.react.js +138 -138
- package/src/lib/components/other/AntdHappyProvider.react.js +50 -50
- package/src/lib/components/other/AntdTour.react.js +277 -277
- package/src/lib/components/other/AntdWatermark.react.js +179 -179
- package/src/lib/components/other/Fragment.react.js +50 -50
- package/src/lib/components/styles.css +513 -513
- package/src/lib/components/utils.js +51 -51
- package/src/lib/contexts/FormContext.js +4 -4
- package/src/lib/contexts/FormItemContext.js +4 -4
- package/src/lib/contexts/PropsContext.js +4 -4
- package/src/lib/fragments/AntdTable.react.js +2215 -2200
- package/src/lib/fragments/dataDisplay/AntdAccordion.react.js +101 -101
- package/src/lib/fragments/dataDisplay/AntdAvatar.react.js +127 -127
- package/src/lib/fragments/dataDisplay/AntdAvatarGroup.react.js +51 -51
- package/src/lib/fragments/dataDisplay/AntdBadge.react.js +73 -73
- package/src/lib/fragments/dataDisplay/AntdCarousel.react.js +71 -71
- package/src/lib/fragments/dataDisplay/AntdCheckableTag.react.js +57 -57
- package/src/lib/fragments/dataDisplay/AntdComment.react.js +178 -178
- package/src/lib/fragments/dataDisplay/AntdCountdown.react.js +83 -83
- package/src/lib/fragments/dataDisplay/AntdCountup.react.js +70 -70
- package/src/lib/fragments/dataDisplay/AntdEmpty.react.js +71 -71
- package/src/lib/fragments/dataDisplay/AntdImage.react.js +206 -206
- package/src/lib/fragments/dataDisplay/AntdImageGroup.react.js +91 -91
- package/src/lib/fragments/dataDisplay/AntdPopover.react.js +106 -106
- package/src/lib/fragments/dataDisplay/AntdQRCode.react.js +93 -93
- package/src/lib/fragments/dataDisplay/AntdRibbon.react.js +53 -53
- package/src/lib/fragments/dataDisplay/AntdSegmented.react.js +129 -129
- package/src/lib/fragments/dataDisplay/AntdSpoiler.react.js +96 -96
- package/src/lib/fragments/dataDisplay/AntdTabs.react.js +211 -211
- package/src/lib/fragments/dataDisplay/AntdTag.react.js +66 -66
- package/src/lib/fragments/dataDisplay/AntdTimeline.react.js +67 -67
- package/src/lib/fragments/dataDisplay/AntdTooltip.react.js +98 -98
- package/src/lib/fragments/dataDisplay/AntdTree.react.js +581 -581
- package/src/lib/fragments/dataDisplay/card/AntdCard.react.js +104 -104
- package/src/lib/fragments/dataDisplay/card/AntdCardGrid.react.js +54 -54
- package/src/lib/fragments/dataDisplay/card/AntdCardMeta.react.js +54 -54
- package/src/lib/fragments/dataDisplay/descriptions/AntdDescriptionItem.react.js +56 -56
- package/src/lib/fragments/dataDisplay/descriptions/AntdDescriptions.react.js +139 -139
- package/src/lib/fragments/dataEntry/AntdCalendar.react.js +178 -178
- package/src/lib/fragments/dataEntry/AntdCascader.react.js +319 -319
- package/src/lib/fragments/dataEntry/AntdCheckbox.react.js +119 -119
- package/src/lib/fragments/dataEntry/AntdCheckboxGroup.react.js +122 -122
- package/src/lib/fragments/dataEntry/AntdColorPicker.react.js +244 -244
- package/src/lib/fragments/dataEntry/AntdDatePicker.react.js +586 -586
- package/src/lib/fragments/dataEntry/AntdDateRangePicker.react.js +628 -628
- package/src/lib/fragments/dataEntry/AntdInput.react.js +450 -450
- package/src/lib/fragments/dataEntry/AntdInputNumber.react.js +194 -194
- package/src/lib/fragments/dataEntry/AntdMentions.react.js +180 -180
- package/src/lib/fragments/dataEntry/AntdOTP.react.js +127 -127
- package/src/lib/fragments/dataEntry/AntdRadioGroup.react.js +203 -203
- package/src/lib/fragments/dataEntry/AntdRate.react.js +131 -131
- package/src/lib/fragments/dataEntry/AntdSegmentedColoring.react.js +246 -246
- package/src/lib/fragments/dataEntry/AntdSelect.react.js +373 -373
- package/src/lib/fragments/dataEntry/AntdSlider.react.js +177 -177
- package/src/lib/fragments/dataEntry/AntdSwitch.react.js +132 -132
- package/src/lib/fragments/dataEntry/AntdTimePicker.react.js +191 -191
- package/src/lib/fragments/dataEntry/AntdTimeRangePicker.react.js +213 -213
- package/src/lib/fragments/dataEntry/AntdTransfer.react.js +183 -183
- package/src/lib/fragments/dataEntry/AntdTreeSelect.react.js +355 -355
- package/src/lib/fragments/dataEntry/check-card/AntdCheckCard.react.js +111 -111
- package/src/lib/fragments/dataEntry/check-card/AntdCheckCardGroup.react.js +122 -122
- package/src/lib/fragments/dataEntry/form/AntdForm.react.js +126 -120
- package/src/lib/fragments/dataEntry/form/AntdFormItem.react.js +85 -84
- package/src/lib/fragments/formRender/AntdFormRender.react.js +179 -179
- package/src/lib/fragments/upload/AntdDraggerUpload.react.js +622 -622
- package/src/lib/fragments/upload/AntdPictureUpload.react.js +577 -577
- package/src/lib/fragments/upload/AntdUpload.react.js +613 -613
- package/src/lib/hooks/useCss.js +28 -28
- package/src/lib/hooks/useStickyOffset.js +115 -115
- package/src/lib/index.js +240 -240
- package/src/lib/internal_components/UtilsLink.react.js +82 -0
- package/src/lib/store/formStore.js +54 -47
- package/tests/dash3.0tests/AntdQRCode/347/273/204/344/273/266loading/347/212/266/346/200/201/351/207/215/346/236/204/test.py +51 -51
- package/tests/dash3.0tests/AntdTable/345/207/275/346/225/260/345/274/217/346/224/271/351/200/240/test.py +62 -62
- package/tests/dash3.0tests/_dashprivate_layout/346/224/271/345/212/250/346/265/213/350/257/225/test.py +50 -50
- package/tests/dash3.0tests/loading_state/346/224/271/345/212/250/346/265/213/350/257/225/test.py +38 -38
- package/tests/dash3.0tests//345/207/275/346/225/260/345/274/217/347/273/204/344/273/266/351/273/230/350/256/244/345/200/274/351/207/215/346/236/204/test.py +30 -30
- package/tests/dash3.0tests//345/212/240/350/275/275/345/212/250/347/224/273/347/261/273/347/273/204/344/273/266/351/207/215/346/236/204/346/265/213/350/257/225/test.py +62 -62
- package/tests/dash3.0tests//347/273/204/344/273/266/345/261/236/346/200/247/345/237/272/347/241/200/346/214/201/344/271/205/345/214/226/351/207/215/346/236/204/346/265/213/350/257/225/test.py +25 -25
- package/tests/dataDisplay/AntdAccordion/feat_size.py +36 -36
- package/tests/dataDisplay/AntdAccordion/feat_styles.py +35 -35
- package/tests/dataDisplay/AntdCard/refactor_delete_props.py +83 -83
- package/tests/dataDisplay/AntdCarousel/feat_auto_play_dot_duration.py +34 -34
- package/tests/dataDisplay/AntdCollapse/feat_size.py +30 -30
- package/tests/dataDisplay/AntdCollapse/feat_styles.py +29 -29
- package/tests/dataDisplay/AntdCountdown/feat_finish_event.py +41 -41
- package/tests/dataDisplay/AntdCountdown/refactor_to_timer.py +57 -57
- package/tests/dataDisplay/AntdCountup/refactor_to_timer.py +57 -57
- package/tests/dataDisplay/AntdDescriptions/feat_span_filled.py +42 -42
- package/tests/dataDisplay/AntdImage/debug_preview_toolbar.py +23 -23
- package/tests/dataDisplay/AntdSegmented/feat_shape.py +39 -39
- package/tests/dataDisplay/AntdSegmented/feat_simple_options.py +43 -43
- package/tests/dataDisplay/AntdSegmented/feat_vertical.py +32 -32
- package/tests/dataDisplay/AntdTable/feat_button_mode_like_dcc_link.py +125 -0
- package/tests/dataDisplay/AntdTable/feat_button_mode_refactor.py +143 -143
- package/tests/dataDisplay/AntdTable/feat_button_mode_tooltip.py +47 -47
- package/tests/dataDisplay/AntdTable/feat_columns_fixed_bool.py +40 -40
- package/tests/dataDisplay/AntdTable/feat_columns_min_width.py +51 -51
- package/tests/dataDisplay/AntdTable/feat_columns_sort_order.py +131 -131
- package/tests/dataDisplay/AntdTable/feat_editable_disabled_keys.py +71 -71
- package/tests/dataDisplay/AntdTable/feat_header_align.py +38 -38
- package/tests/dataDisplay/AntdTable/feat_link_mode_like_dcc_link.py +49 -0
- package/tests/dataDisplay/AntdTable/feat_loading.py +76 -76
- package/tests/dataDisplay/AntdTable/feat_mini_chart_color.py +139 -139
- package/tests/dataDisplay/AntdTable/feat_row_class_name.py +39 -39
- package/tests/dataDisplay/AntdTable/feat_row_class_name_func.py +41 -41
- package/tests/dataDisplay/AntdTable/feat_select_mode_show_search.py +70 -70
- package/tests/dataDisplay/AntdTable/feat_sticky_header.py +81 -81
- package/tests/dataDisplay/AntdTable/feat_table_scroll.py +54 -54
- package/tests/dataDisplay/AntdTable/feat_tag_mode_tooltip.py +88 -88
- package/tests/dataDisplay/AntdTable/feat_title_popover_nodes.py +94 -79
- package/tests/dataDisplay/AntdTable/fix_context_locale.py +37 -37
- package/tests/dataDisplay/AntdTable/fix_field_bool.py +50 -50
- package/tests/dataDisplay/AntdTable/fix_nested_editable.py +115 -115
- package/tests/dataDisplay/AntdTable/fix_select_with_editable.py +84 -84
- package/tests/dataDisplay/AntdTable/fix_server_side_mode_filter_search.py +194 -194
- package/tests/dataDisplay/AntdTable/fix_summary.py +474 -474
- package/tests/dataDisplay/AntdTable/fix_summary_multi_level_header.py +85 -85
- package/tests/dataDisplay/AntdTable/fix_zero_value_filter.py +34 -34
- package/tests/dataDisplay/AntdTable/perf_button_mode_auto_wrap.py +39 -39
- package/tests/dataDisplay/AntdTable/perf_editable_column_format_constrait_message.py +65 -65
- package/tests/dataDisplay/AntdTable/refactor_mini_progress_mode.py +134 -134
- package/tests/dataDisplay/AntdTable/rollback_title_popover_info.py +46 -0
- package/tests/dataDisplay/AntdTabs/feat_item_icon.py +39 -39
- package/tests/dataDisplay/AntdTabs/feat_placeholder.py +124 -124
- package/tests/dataDisplay/AntdTabs/feat_tab_bar_style.py +40 -40
- package/tests/dataDisplay/AntdTree/feat_async_data_load.py +71 -71
- package/tests/dataDisplay/descriptions/AntdDescriptions/feat_extra.py +83 -83
- package/tests/dataEntry/AntdCalendar/feat_custom_cells.py +52 -52
- package/tests/dataEntry/AntdCascader/feat_prefix.py +62 -62
- package/tests/dataEntry/AntdCascader/feat_suffix_icon.py +62 -62
- package/tests/dataEntry/AntdCascader/fix_read_only.py +74 -74
- package/tests/dataEntry/AntdDatePicker/feat_custom_cells.py +79 -79
- package/tests/dataEntry/AntdDatePicker/feat_picker_value.py +38 -38
- package/tests/dataEntry/AntdDatePicker/feat_prefix.py +21 -21
- package/tests/dataEntry/AntdDatePicker/feat_suffix_icon.py +21 -21
- package/tests/dataEntry/AntdDateRangePicker/feat_custom_cells.py +79 -79
- package/tests/dataEntry/AntdDateRangePicker/feat_picker_value.py +38 -38
- package/tests/dataEntry/AntdDateRangePicker/feat_prefix.py +21 -21
- package/tests/dataEntry/AntdDateRangePicker/feat_suffix_icon.py +21 -21
- package/tests/dataEntry/AntdForm/feat_batch_control_tooltips.py +35 -0
- package/tests/dataEntry/AntdForm/feat_optional_batch_control.py +62 -62
- package/tests/dataEntry/AntdForm/fix_checkbox.py +65 -65
- package/tests/dataEntry/AntdRadioGroup/feat_block.py +40 -40
- package/tests/dataEntry/AntdSelect/feat_locale_ru.py +24 -24
- package/tests/dataEntry/AntdSelect/feat_max_count.py +28 -28
- package/tests/dataEntry/AntdSelect/feat_prefix.py +26 -26
- package/tests/dataEntry/AntdSelect/feat_show_search.py +32 -32
- package/tests/dataEntry/AntdSelect/feat_suffix_icon.py +46 -46
- package/tests/dataEntry/AntdSelect/fix_read_only.py +50 -50
- package/tests/dataEntry/AntdSelect/fix_read_only_with_allow_clear.py +29 -29
- package/tests/dataEntry/AntdSlider/feat_range_editable.py +49 -49
- package/tests/dataEntry/AntdTimePicker/feat_prefix.py +21 -21
- package/tests/dataEntry/AntdTimePicker/feat_suffix_icon.py +21 -21
- package/tests/dataEntry/AntdTimeRangePicker/feat_prefix.py +21 -21
- package/tests/dataEntry/AntdTimeRangePicker/feat_suffix_icon.py +21 -21
- package/tests/dataEntry/AntdTreeSelect/feat_async_data_load.py +69 -69
- package/tests/dataEntry/AntdTreeSelect/feat_max_count.py +71 -71
- package/tests/dataEntry/AntdTreeSelect/feat_prefix.py +43 -43
- package/tests/dataEntry/AntdTreeSelect/fix_read_only.py +50 -50
- package/tests/dataEntry/AntdUpload/feat_pastable.py +22 -22
- package/tests/dataEntry/AntdUpload/fix_follow_theme.py +28 -28
- package/tests/feat_variant_underlined.py +100 -100
- package/tests/feedback/AntdAlert/feat_icon.py +35 -35
- package/tests/feedback/AntdMessage/fix_follow_config_provider.py +44 -44
- package/tests/feedback/AntdModal/feat_force_render.py +57 -57
- package/tests/feedback/AntdModal/feat_loading_title.py +92 -92
- package/tests/feedback/AntdModal/feat_prevent_close.py +54 -54
- package/tests/feedback/AntdModal/feat_responsive_width.py +31 -31
- package/tests/feedback/AntdNotification/feat_component_content.py +64 -64
- package/tests/feedback/AntdNotification/feat_number_of_stack.py +40 -40
- package/tests/feedback/AntdNotification/feat_show_progress.py +40 -40
- package/tests/feedback/AntdNotification/fix_follow_config_provider.py +46 -46
- package/tests/feedback/AntdPopupCard/feat_force_render.py +61 -61
- package/tests/feedback/AntdProgress/feat_percent_position.py +39 -39
- package/tests/feedback/AntdProgress/perf_size.py +26 -26
- package/tests/feedback/AntdProgress/perf_steps.py +37 -37
- package/tests/feedback/AntdProgress/perf_stroke_color.py +58 -58
- package/tests/feedback/AntdResult/feat_extra.py +26 -26
- package/tests/feedback/AntdSkeleton/fix_dash3.py +43 -43
- package/tests/general/AntdButton/feat_color_and_variant.py +40 -40
- package/tests/general/AntdButton/feat_preset_color.py +46 -46
- package/tests/general/AntdFloatButtonGroup/feat_placement.py +83 -83
- package/tests/general/AntdFloatButtonGroup/feat_tooltip.py +34 -34
- package/tests/general/AntdIcon/feat_iconfont.py +41 -41
- package/tests/layout/AntdCenter/feat_use_token.py +41 -41
- package/tests/layout/AntdDivider/feat_plain.py +21 -21
- package/tests/layout/AntdDivider/feat_size.py +36 -36
- package/tests/layout/AntdSplitter/feat_AntdSplitter.py +210 -210
- package/tests/layout/AntdSplitter/feat_lazy.py +56 -56
- package/tests/layout/AntdSplitter/refactor.py +303 -303
- package/tests/navigation/AntdAnchor/feat_current_anchor.py +43 -43
- package/tests/navigation/AntdAnchor/feat_direction.py +43 -43
- package/tests/navigation/AntdAnchor/feat_replace.py +43 -43
- package/tests/navigation/AntdBreadcrumb/feat_menu_item_event.py +64 -64
- package/tests/navigation/AntdBreadcrumb/refactor_items.py +140 -140
- package/tests/navigation/AntdDropdown/feat_extra.py +29 -29
- package/tests/navigation/AntdMenu/feat_currentItem.py +85 -85
- package/tests/navigation/AntdMenu/feat_currentItemPath.py +85 -85
- package/tests/navigation/AntdMenu/feat_currentKeyPath.py +85 -85
- package/tests/navigation/AntdMenu/feat_custom_icon.py +57 -57
- package/tests/navigation/AntdMenu/feat_expandIcon.py +70 -70
- package/tests/navigation/AntdMenu/feat_triggerSubMenuAction.py +67 -67
- package/tests/navigation/AntdMenu/fix_onlyExpandCurrentSubMenu.py +57 -57
- package/tests/navigation/AntdMenu/fix_with_sider.py +71 -71
- package/tests/navigation/AntdPagination/feat_align.py +31 -31
- package/tests/other/AntdAffix/feat_listen_affixed.py +41 -41
- package/tests/other/AntdBackTop/refactor.py +18 -18
- package/tests/other/AntdConfigProvider/feat_use_css.py +67 -67
- package/tests/other/AntdCopyText/feat_copy_table.py +67 -67
- package/tests/other/AntdCopyText/feat_tooltips.py +61 -61
- package/tests/other/AntdHappyProvider/feat_component.py +60 -60
- package/tests/other/Fragment/feat_use_token.py +32 -32
- package/usage.py +34 -34
- package/webpack.config.js +181 -181
- package/webpack.serve.config.js +12 -12
|
@@ -1,587 +1,587 @@
|
|
|
1
|
-
// react核心
|
|
2
|
-
import React, { useState, useEffect, useContext } from 'react';
|
|
3
|
-
// antd核心
|
|
4
|
-
import { DatePicker, ConfigProvider } from 'antd';
|
|
5
|
-
// 辅助库
|
|
6
|
-
import dayjs from 'dayjs';
|
|
7
|
-
import isoWeek from 'dayjs/plugin/isoWeek';
|
|
8
|
-
import advancedFormat from 'dayjs/plugin/advancedFormat';
|
|
9
|
-
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
|
|
10
|
-
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
|
11
|
-
import { isString, isUndefined, isObject } from 'lodash';
|
|
12
|
-
import { pickBy } from 'ramda';
|
|
13
|
-
import 'dayjs/locale/zh-cn';
|
|
14
|
-
import { str2Locale } from '../../components/locales.react';
|
|
15
|
-
import { useLoading } from '../../components/utils';
|
|
16
|
-
// 自定义hooks
|
|
17
|
-
import useCss from '../../hooks/useCss';
|
|
18
|
-
// 上下文
|
|
19
|
-
import PropsContext from '../../contexts/PropsContext';
|
|
20
|
-
import FormContext from '../../contexts/FormContext';
|
|
21
|
-
// 状态管理
|
|
22
|
-
import useFormStore from '../../store/formStore';
|
|
23
|
-
// 参数类型
|
|
24
|
-
import { propTypes, defaultProps } from '../../components/dataEntry/AntdDatePicker.react';
|
|
25
|
-
|
|
26
|
-
// 调用dayjs额外插件模块
|
|
27
|
-
dayjs.extend(isoWeek)
|
|
28
|
-
dayjs.extend(advancedFormat)
|
|
29
|
-
dayjs.extend(isSameOrAfter)
|
|
30
|
-
dayjs.extend(isSameOrBefore)
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* 日期选择组件AntdDatePicker
|
|
34
|
-
*/
|
|
35
|
-
const AntdDatePicker = (props) => {
|
|
36
|
-
let {
|
|
37
|
-
id,
|
|
38
|
-
className,
|
|
39
|
-
style,
|
|
40
|
-
popupClassName,
|
|
41
|
-
key,
|
|
42
|
-
name,
|
|
43
|
-
enableBatchControl,
|
|
44
|
-
locale,
|
|
45
|
-
setProps,
|
|
46
|
-
picker,
|
|
47
|
-
format,
|
|
48
|
-
firstDayOfWeek,
|
|
49
|
-
disabled,
|
|
50
|
-
showTime,
|
|
51
|
-
allowClear,
|
|
52
|
-
autoFocus,
|
|
53
|
-
placeholder,
|
|
54
|
-
disabledDatesStrategy,
|
|
55
|
-
pickerValue,
|
|
56
|
-
value,
|
|
57
|
-
defaultValue,
|
|
58
|
-
bordered,
|
|
59
|
-
variant,
|
|
60
|
-
size,
|
|
61
|
-
status,
|
|
62
|
-
popupContainer,
|
|
63
|
-
readOnly,
|
|
64
|
-
placement,
|
|
65
|
-
extraFooter,
|
|
66
|
-
showToday,
|
|
67
|
-
presets,
|
|
68
|
-
customCells,
|
|
69
|
-
prefix,
|
|
70
|
-
suffixIcon,
|
|
71
|
-
persistence,
|
|
72
|
-
persisted_props,
|
|
73
|
-
persistence_type,
|
|
74
|
-
batchPropsNames,
|
|
75
|
-
needConfirm,
|
|
76
|
-
...others
|
|
77
|
-
} = props;
|
|
78
|
-
|
|
79
|
-
const [rawValue, setRawValue] = useState(null);
|
|
80
|
-
|
|
81
|
-
// 解决value经回调更新后,rawValue未更新的问题
|
|
82
|
-
useEffect(() => {
|
|
83
|
-
if (formId && (name || id) && enableBatchControl) {
|
|
84
|
-
if (currentFormValue) {
|
|
85
|
-
setRawValue(dayjs(currentFormValue, format));
|
|
86
|
-
} else {
|
|
87
|
-
setRawValue(null);
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
if (value) {
|
|
91
|
-
setRawValue(dayjs(value, format));
|
|
92
|
-
} else {
|
|
93
|
-
setRawValue(null);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}, [value, currentFormValue])
|
|
97
|
-
|
|
98
|
-
// 批属性监听
|
|
99
|
-
useEffect(() => {
|
|
100
|
-
if (batchPropsNames && batchPropsNames.length !== 0) {
|
|
101
|
-
let _batchPropsValues = {};
|
|
102
|
-
for (let propName of batchPropsNames) {
|
|
103
|
-
_batchPropsValues[propName] = props[propName];
|
|
104
|
-
}
|
|
105
|
-
setProps({
|
|
106
|
-
batchPropsValues: _batchPropsValues
|
|
107
|
-
})
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
const context = useContext(PropsContext)
|
|
112
|
-
const formId = useContext(FormContext)
|
|
113
|
-
|
|
114
|
-
const updateItemValue = useFormStore((state) => state.updateItemValue)
|
|
115
|
-
const deleteItemValue = useFormStore((state) => state.deleteItemValue)
|
|
116
|
-
|
|
117
|
-
locale = (context && context.locale) || locale
|
|
118
|
-
|
|
119
|
-
// 收集当前组件相关表单值
|
|
120
|
-
const currentFormValue = useFormStore(state => state.values?.[formId]?.[name || id])
|
|
121
|
-
|
|
122
|
-
// 处理组件卸载后,对应表单项值的清除
|
|
123
|
-
useEffect(() => {
|
|
124
|
-
return () => {
|
|
125
|
-
// 若上文中存在有效表单id
|
|
126
|
-
if (formId && (name || id) && enableBatchControl) {
|
|
127
|
-
// 表单值更新
|
|
128
|
-
deleteItemValue(formId, name || id)
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}, [name, id])
|
|
132
|
-
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
// 初始化value
|
|
135
|
-
if (defaultValue && !value) {
|
|
136
|
-
// 当defaultValue不为空且value为空时,为value初始化defaultValue对应值
|
|
137
|
-
setProps({ value: defaultValue })
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// 调整不同showTime下的format缺省参数
|
|
141
|
-
if (showTime && !format) {
|
|
142
|
-
setProps({
|
|
143
|
-
format: 'YYYY-MM-DD HH:mm:ss'
|
|
144
|
-
})
|
|
145
|
-
} else if (!showTime && !format) {
|
|
146
|
-
setProps({
|
|
147
|
-
format: 'YYYY-MM-DD'
|
|
148
|
-
})
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// 处理pickerValue缺省赋值
|
|
152
|
-
if (!pickerValue) {
|
|
153
|
-
setProps({
|
|
154
|
-
pickerValue: dayjs(new Date()).format(format || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'))
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
}, [])
|
|
158
|
-
|
|
159
|
-
useEffect(() => {
|
|
160
|
-
if (!isUndefined(firstDayOfWeek)) {
|
|
161
|
-
dayjs.locale(
|
|
162
|
-
locale === 'en-us' ? 'en' : locale,
|
|
163
|
-
{
|
|
164
|
-
week: {
|
|
165
|
-
dow: firstDayOfWeek
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
}
|
|
170
|
-
}, [firstDayOfWeek])
|
|
171
|
-
|
|
172
|
-
const onChange = (date, dateString) => {
|
|
173
|
-
if (isString(dateString)) {
|
|
174
|
-
// AntdForm表单批量控制
|
|
175
|
-
if (formId && (name || id) && enableBatchControl) {
|
|
176
|
-
// 表单值更新
|
|
177
|
-
updateItemValue(formId, name || id, dateString)
|
|
178
|
-
}
|
|
179
|
-
// 更新rawValue
|
|
180
|
-
setRawValue(date);
|
|
181
|
-
setProps({ value: dateString })
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const checkDisabledDate = current => {
|
|
186
|
-
|
|
187
|
-
// 根据disabledDatesStrategy设定的各个子条件进行是否禁用判断
|
|
188
|
-
for (let i = 0; i < disabledDatesStrategy.length; i++) {
|
|
189
|
-
let strategy = disabledDatesStrategy[i];
|
|
190
|
-
// 判断当前子策略方式
|
|
191
|
-
if (strategy.mode === 'eq') {
|
|
192
|
-
// 判断当前子策略约束目标
|
|
193
|
-
if (strategy.target === 'day') {
|
|
194
|
-
if (current.date() === strategy.value) {
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
} else if (strategy.target === 'month') {
|
|
198
|
-
if (current.month() === strategy.value) {
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
} else if (strategy.target === 'quarter') {
|
|
202
|
-
if (current.quarter() === strategy.value) {
|
|
203
|
-
return true;
|
|
204
|
-
}
|
|
205
|
-
} else if (strategy.target === 'year') {
|
|
206
|
-
if (current.year() === strategy.value) {
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
} else if (strategy.target === 'dayOfYear') {
|
|
210
|
-
if (current.dayOfYear() === strategy.value) {
|
|
211
|
-
return true;
|
|
212
|
-
}
|
|
213
|
-
} else if (strategy.target === 'dayOfWeek') {
|
|
214
|
-
if (current.isoWeekday() === strategy.value) {
|
|
215
|
-
return true;
|
|
216
|
-
}
|
|
217
|
-
} else if (strategy.target === 'specific-date') {
|
|
218
|
-
if (current.isSame(dayjs(strategy.value, 'YYYY-MM-DD'))) {
|
|
219
|
-
return true;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
} else if (strategy.mode === 'ne') {
|
|
223
|
-
// 判断当前子策略约束目标
|
|
224
|
-
if (strategy.target === 'day') {
|
|
225
|
-
if (current.date() !== strategy.value) {
|
|
226
|
-
return true;
|
|
227
|
-
}
|
|
228
|
-
} else if (strategy.target === 'month') {
|
|
229
|
-
if (current.month() !== strategy.value) {
|
|
230
|
-
return true;
|
|
231
|
-
}
|
|
232
|
-
} else if (strategy.target === 'quarter') {
|
|
233
|
-
if (current.quarter() !== strategy.value) {
|
|
234
|
-
return true;
|
|
235
|
-
}
|
|
236
|
-
} else if (strategy.target === 'year') {
|
|
237
|
-
if (current.year() !== strategy.value) {
|
|
238
|
-
return true;
|
|
239
|
-
}
|
|
240
|
-
} else if (strategy.target === 'dayOfYear') {
|
|
241
|
-
if (current.dayOfYear() !== strategy.value) {
|
|
242
|
-
return true;
|
|
243
|
-
}
|
|
244
|
-
} else if (strategy.target === 'dayOfWeek') {
|
|
245
|
-
if (current.isoWeekday() !== strategy.value) {
|
|
246
|
-
return true;
|
|
247
|
-
}
|
|
248
|
-
} else if (strategy.target === 'specific-date') {
|
|
249
|
-
if (!current.isSame(dayjs(strategy.value, 'YYYY-MM-DD'))) {
|
|
250
|
-
return true;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
} else if (strategy.mode === 'le') {
|
|
254
|
-
// 判断当前子策略约束目标
|
|
255
|
-
if (strategy.target === 'day') {
|
|
256
|
-
if (current.date() <= strategy.value) {
|
|
257
|
-
return true;
|
|
258
|
-
}
|
|
259
|
-
} else if (strategy.target === 'month') {
|
|
260
|
-
if (current.month() <= strategy.value) {
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
} else if (strategy.target === 'quarter') {
|
|
264
|
-
if (current.quarter() <= strategy.value) {
|
|
265
|
-
return true;
|
|
266
|
-
}
|
|
267
|
-
} else if (strategy.target === 'year') {
|
|
268
|
-
if (current.year() <= strategy.value) {
|
|
269
|
-
return true;
|
|
270
|
-
}
|
|
271
|
-
} else if (strategy.target === 'dayOfYear') {
|
|
272
|
-
if (current.dayOfYear() <= strategy.value) {
|
|
273
|
-
return true;
|
|
274
|
-
}
|
|
275
|
-
} else if (strategy.target === 'dayOfWeek') {
|
|
276
|
-
if (current.isoWeekday() <= strategy.value) {
|
|
277
|
-
return true;
|
|
278
|
-
}
|
|
279
|
-
} else if (strategy.target === 'specific-date') {
|
|
280
|
-
if (current.isSameOrBefore(dayjs(strategy.value, 'YYYY-MM-DD'))) {
|
|
281
|
-
return true;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
} else if (strategy.mode === 'lt') {
|
|
285
|
-
// 判断当前子策略约束目标
|
|
286
|
-
if (strategy.target === 'day') {
|
|
287
|
-
if (current.date() < strategy.value) {
|
|
288
|
-
return true;
|
|
289
|
-
}
|
|
290
|
-
} else if (strategy.target === 'month') {
|
|
291
|
-
if (current.month() < strategy.value) {
|
|
292
|
-
return true;
|
|
293
|
-
}
|
|
294
|
-
} else if (strategy.target === 'quarter') {
|
|
295
|
-
if (current.quarter() < strategy.value) {
|
|
296
|
-
return true;
|
|
297
|
-
}
|
|
298
|
-
} else if (strategy.target === 'year') {
|
|
299
|
-
if (current.year() < strategy.value) {
|
|
300
|
-
return true;
|
|
301
|
-
}
|
|
302
|
-
} else if (strategy.target === 'dayOfYear') {
|
|
303
|
-
if (current.dayOfYear() < strategy.value) {
|
|
304
|
-
return true;
|
|
305
|
-
}
|
|
306
|
-
} else if (strategy.target === 'dayOfWeek') {
|
|
307
|
-
if (current.isoWeekday() < strategy.value) {
|
|
308
|
-
return true;
|
|
309
|
-
}
|
|
310
|
-
} else if (strategy.target === 'specific-date') {
|
|
311
|
-
if (current.isBefore(dayjs(strategy.value, 'YYYY-MM-DD'))) {
|
|
312
|
-
return true;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
} else if (strategy.mode === 'ge') {
|
|
316
|
-
// 判断当前子策略约束目标
|
|
317
|
-
if (strategy.target === 'day') {
|
|
318
|
-
if (current.date() >= strategy.value) {
|
|
319
|
-
return true;
|
|
320
|
-
}
|
|
321
|
-
} else if (strategy.target === 'month') {
|
|
322
|
-
if (current.month() >= strategy.value) {
|
|
323
|
-
return true;
|
|
324
|
-
}
|
|
325
|
-
} else if (strategy.target === 'quarter') {
|
|
326
|
-
if (current.quarter() >= strategy.value) {
|
|
327
|
-
return true;
|
|
328
|
-
}
|
|
329
|
-
} else if (strategy.target === 'year') {
|
|
330
|
-
if (current.year() >= strategy.value) {
|
|
331
|
-
return true;
|
|
332
|
-
}
|
|
333
|
-
} else if (strategy.target === 'dayOfYear') {
|
|
334
|
-
if (current.dayOfYear() >= strategy.value) {
|
|
335
|
-
return true;
|
|
336
|
-
}
|
|
337
|
-
} else if (strategy.target === 'dayOfWeek') {
|
|
338
|
-
if (current.isoWeekday() >= strategy.value) {
|
|
339
|
-
return true;
|
|
340
|
-
}
|
|
341
|
-
} else if (strategy.target === 'specific-date') {
|
|
342
|
-
if (current.isSameOrAfter(dayjs(strategy.value, 'YYYY-MM-DD'))) {
|
|
343
|
-
return true;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
} else if (strategy.mode === 'gt') {
|
|
347
|
-
// 判断当前子策略约束目标
|
|
348
|
-
if (strategy.target === 'day') {
|
|
349
|
-
if (current.date() > strategy.value) {
|
|
350
|
-
return true;
|
|
351
|
-
}
|
|
352
|
-
} else if (strategy.target === 'month') {
|
|
353
|
-
if (current.month() > strategy.value) {
|
|
354
|
-
return true;
|
|
355
|
-
}
|
|
356
|
-
} else if (strategy.target === 'quarter') {
|
|
357
|
-
if (current.quarter() > strategy.value) {
|
|
358
|
-
return true;
|
|
359
|
-
}
|
|
360
|
-
} else if (strategy.target === 'year') {
|
|
361
|
-
if (current.year() > strategy.value) {
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
|
-
} else if (strategy.target === 'dayOfYear') {
|
|
365
|
-
if (current.dayOfYear() > strategy.value) {
|
|
366
|
-
return true;
|
|
367
|
-
}
|
|
368
|
-
} else if (strategy.target === 'dayOfWeek') {
|
|
369
|
-
if (current.isoWeekday() > strategy.value) {
|
|
370
|
-
return true;
|
|
371
|
-
}
|
|
372
|
-
} else if (strategy.target === 'specific-date') {
|
|
373
|
-
if (current.isAfter(dayjs(strategy.value, 'YYYY-MM-DD'))) {
|
|
374
|
-
return true;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
} else if (strategy.mode === 'in') {
|
|
378
|
-
// 判断当前子策略约束目标
|
|
379
|
-
if (strategy.target === 'day') {
|
|
380
|
-
if (strategy.value.includes(current.date())) {
|
|
381
|
-
return true;
|
|
382
|
-
}
|
|
383
|
-
} else if (strategy.target === 'month') {
|
|
384
|
-
if (strategy.value.includes(current.month())) {
|
|
385
|
-
return true;
|
|
386
|
-
}
|
|
387
|
-
} else if (strategy.target === 'quarter') {
|
|
388
|
-
if (strategy.value.includes(current.quarter())) {
|
|
389
|
-
return true;
|
|
390
|
-
}
|
|
391
|
-
} else if (strategy.target === 'year') {
|
|
392
|
-
if (strategy.value.includes(current.year())) {
|
|
393
|
-
return true;
|
|
394
|
-
}
|
|
395
|
-
} else if (strategy.target === 'dayOfYear') {
|
|
396
|
-
if (strategy.value.includes(current.dayOfYear())) {
|
|
397
|
-
return true;
|
|
398
|
-
}
|
|
399
|
-
} else if (strategy.target === 'dayOfWeek') {
|
|
400
|
-
if (strategy.value.includes(current.isoWeekday())) {
|
|
401
|
-
return true;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
} else if (strategy.mode === 'not-in') {
|
|
405
|
-
// 判断当前子策略约束目标
|
|
406
|
-
if (strategy.target === 'day') {
|
|
407
|
-
if (!strategy.value.includes(current.date())) {
|
|
408
|
-
return true;
|
|
409
|
-
}
|
|
410
|
-
} else if (strategy.target === 'month') {
|
|
411
|
-
if (!strategy.value.includes(current.month())) {
|
|
412
|
-
return true;
|
|
413
|
-
}
|
|
414
|
-
} else if (strategy.target === 'quarter') {
|
|
415
|
-
if (!strategy.value.includes(current.quarter())) {
|
|
416
|
-
return true;
|
|
417
|
-
}
|
|
418
|
-
} else if (strategy.target === 'year') {
|
|
419
|
-
if (!strategy.value.includes(current.year())) {
|
|
420
|
-
return true;
|
|
421
|
-
}
|
|
422
|
-
} else if (strategy.target === 'dayOfYear') {
|
|
423
|
-
if (!strategy.value.includes(current.dayOfYear())) {
|
|
424
|
-
return true;
|
|
425
|
-
}
|
|
426
|
-
} else if (strategy.target === 'dayOfWeek') {
|
|
427
|
-
if (!strategy.value.includes(current.isoWeekday())) {
|
|
428
|
-
return true;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
} else if (strategy.mode === 'in-enumerate-dates') {
|
|
432
|
-
if (strategy.value.includes(current.format(format))) {
|
|
433
|
-
return true;
|
|
434
|
-
}
|
|
435
|
-
} else if (strategy.mode === 'not-in-enumerate-dates') {
|
|
436
|
-
if (!strategy.value.includes(current.format(format))) {
|
|
437
|
-
return true;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
return (
|
|
444
|
-
<div>
|
|
445
|
-
<ConfigProvider
|
|
446
|
-
locale={str2Locale.get(locale)}
|
|
447
|
-
>
|
|
448
|
-
<DatePicker
|
|
449
|
-
// 提取具有data-*或aria-*通配格式的属性
|
|
450
|
-
{...pickBy((_, k) => k.startsWith('data-') || k.startsWith('aria-'), others)}
|
|
451
|
-
id={id}
|
|
452
|
-
className={
|
|
453
|
-
isString(className) ?
|
|
454
|
-
className :
|
|
455
|
-
(className ? useCss(className) : undefined)
|
|
456
|
-
}
|
|
457
|
-
style={style}
|
|
458
|
-
popupClassName={popupClassName}
|
|
459
|
-
key={key}
|
|
460
|
-
format={format}
|
|
461
|
-
onChange={onChange}
|
|
462
|
-
onPanelChange={(v, m) => {
|
|
463
|
-
setProps({
|
|
464
|
-
pickerValue: v.format(format)
|
|
465
|
-
})
|
|
466
|
-
}}
|
|
467
|
-
picker={picker}
|
|
468
|
-
calendarStartDay={firstDayOfWeek}
|
|
469
|
-
disabled={
|
|
470
|
-
context && !isUndefined(context.componentDisabled) ?
|
|
471
|
-
context.componentDisabled :
|
|
472
|
-
disabled
|
|
473
|
-
}
|
|
474
|
-
placeholder={placeholder}
|
|
475
|
-
variant={(
|
|
476
|
-
!variant ?
|
|
477
|
-
(bordered ? 'outlined' : 'borderless') :
|
|
478
|
-
variant
|
|
479
|
-
)}
|
|
480
|
-
size={
|
|
481
|
-
context && !isUndefined(context.componentSize) ?
|
|
482
|
-
context.componentSize :
|
|
483
|
-
size
|
|
484
|
-
}
|
|
485
|
-
disabledDate={disabledDatesStrategy ? checkDisabledDate : undefined}
|
|
486
|
-
pickerValue={pickerValue && dayjs(pickerValue, format)}
|
|
487
|
-
value={
|
|
488
|
-
formId && (name || id) && enableBatchControl ?
|
|
489
|
-
(currentFormValue ? dayjs(currentFormValue, format) : undefined) :
|
|
490
|
-
(rawValue || (value ? dayjs(value, format) : undefined))
|
|
491
|
-
}
|
|
492
|
-
defaultValue={
|
|
493
|
-
formId && (name || id) && enableBatchControl ?
|
|
494
|
-
undefined :
|
|
495
|
-
(defaultValue ? dayjs(defaultValue, format) : undefined)
|
|
496
|
-
}
|
|
497
|
-
showTime={
|
|
498
|
-
// 处理时间选择面板在日期选定后的默认选中值
|
|
499
|
-
isObject(showTime) && showTime.defaultValue ?
|
|
500
|
-
{
|
|
501
|
-
defaultValue: dayjs(
|
|
502
|
-
dayjs(new Date()).format('YYYY-MM-DD') + ' ' + showTime.defaultValue,
|
|
503
|
-
'YYYY-MM-DD' + ' ' + (showTime.format || 'HH:mm:ss')
|
|
504
|
-
)
|
|
505
|
-
} :
|
|
506
|
-
showTime
|
|
507
|
-
}
|
|
508
|
-
allowClear={isUndefined(readOnly) ? allowClear : !readOnly}
|
|
509
|
-
autoFocus={autoFocus}
|
|
510
|
-
status={status}
|
|
511
|
-
placement={placement}
|
|
512
|
-
open={isUndefined(readOnly) || !readOnly ? undefined : false}
|
|
513
|
-
inputReadOnly={readOnly}
|
|
514
|
-
renderExtraFooter={() => extraFooter}
|
|
515
|
-
showNow={showToday}
|
|
516
|
-
needConfirm={needConfirm}
|
|
517
|
-
presets={
|
|
518
|
-
// 处理预设快捷选项列表
|
|
519
|
-
(presets || []).map(
|
|
520
|
-
(preset) => ({
|
|
521
|
-
label: preset.label,
|
|
522
|
-
value: () => {
|
|
523
|
-
return dayjs(preset.value, format)
|
|
524
|
-
}
|
|
525
|
-
})
|
|
526
|
-
)
|
|
527
|
-
}
|
|
528
|
-
cellRender={
|
|
529
|
-
customCells ?
|
|
530
|
-
(current, info) => {
|
|
531
|
-
// 尝试搜索命中项
|
|
532
|
-
let matchCell;
|
|
533
|
-
// 目前仅作用于日期类型
|
|
534
|
-
if (info.type === 'date') {
|
|
535
|
-
matchCell = customCells.filter(item => {
|
|
536
|
-
// 初始化基础条件
|
|
537
|
-
let conditions = true
|
|
538
|
-
// 若具有明确年份
|
|
539
|
-
if (item.year) {
|
|
540
|
-
conditions = conditions && current.year() === item.year
|
|
541
|
-
}
|
|
542
|
-
// 若具有明确月份
|
|
543
|
-
if (item.month) {
|
|
544
|
-
conditions = conditions && current.month() + 1 === item.month
|
|
545
|
-
}
|
|
546
|
-
// 若具有明确日期
|
|
547
|
-
if (item.date) {
|
|
548
|
-
conditions = conditions && current.date() === item.date
|
|
549
|
-
}
|
|
550
|
-
return conditions;
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
if (matchCell.length > 0) {
|
|
554
|
-
return (
|
|
555
|
-
<div className={
|
|
556
|
-
matchCell[0].className ?
|
|
557
|
-
`ant-picker-cell-inner ${matchCell[0].className}` :
|
|
558
|
-
'ant-picker-cell-inner'
|
|
559
|
-
}
|
|
560
|
-
style={matchCell[0].style}
|
|
561
|
-
>
|
|
562
|
-
{current.date()}
|
|
563
|
-
</div>
|
|
564
|
-
);
|
|
565
|
-
}
|
|
566
|
-
return info.originNode;
|
|
567
|
-
} :
|
|
568
|
-
undefined
|
|
569
|
-
}
|
|
570
|
-
prefix={prefix}
|
|
571
|
-
suffixIcon={suffixIcon}
|
|
572
|
-
data-dash-is-loading={useLoading()}
|
|
573
|
-
getPopupContainer={
|
|
574
|
-
popupContainer === 'parent' ?
|
|
575
|
-
(triggerNode) => triggerNode.parentNode :
|
|
576
|
-
undefined
|
|
577
|
-
}
|
|
578
|
-
/>
|
|
579
|
-
</ConfigProvider>
|
|
580
|
-
</div>
|
|
581
|
-
);
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
export default AntdDatePicker;
|
|
585
|
-
|
|
586
|
-
AntdDatePicker.defaultProps = defaultProps;
|
|
1
|
+
// react核心
|
|
2
|
+
import React, { useState, useEffect, useContext } from 'react';
|
|
3
|
+
// antd核心
|
|
4
|
+
import { DatePicker, ConfigProvider } from 'antd';
|
|
5
|
+
// 辅助库
|
|
6
|
+
import dayjs from 'dayjs';
|
|
7
|
+
import isoWeek from 'dayjs/plugin/isoWeek';
|
|
8
|
+
import advancedFormat from 'dayjs/plugin/advancedFormat';
|
|
9
|
+
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
|
|
10
|
+
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
|
11
|
+
import { isString, isUndefined, isObject } from 'lodash';
|
|
12
|
+
import { pickBy } from 'ramda';
|
|
13
|
+
import 'dayjs/locale/zh-cn';
|
|
14
|
+
import { str2Locale } from '../../components/locales.react';
|
|
15
|
+
import { useLoading } from '../../components/utils';
|
|
16
|
+
// 自定义hooks
|
|
17
|
+
import useCss from '../../hooks/useCss';
|
|
18
|
+
// 上下文
|
|
19
|
+
import PropsContext from '../../contexts/PropsContext';
|
|
20
|
+
import FormContext from '../../contexts/FormContext';
|
|
21
|
+
// 状态管理
|
|
22
|
+
import useFormStore from '../../store/formStore';
|
|
23
|
+
// 参数类型
|
|
24
|
+
import { propTypes, defaultProps } from '../../components/dataEntry/AntdDatePicker.react';
|
|
25
|
+
|
|
26
|
+
// 调用dayjs额外插件模块
|
|
27
|
+
dayjs.extend(isoWeek)
|
|
28
|
+
dayjs.extend(advancedFormat)
|
|
29
|
+
dayjs.extend(isSameOrAfter)
|
|
30
|
+
dayjs.extend(isSameOrBefore)
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 日期选择组件AntdDatePicker
|
|
34
|
+
*/
|
|
35
|
+
const AntdDatePicker = (props) => {
|
|
36
|
+
let {
|
|
37
|
+
id,
|
|
38
|
+
className,
|
|
39
|
+
style,
|
|
40
|
+
popupClassName,
|
|
41
|
+
key,
|
|
42
|
+
name,
|
|
43
|
+
enableBatchControl,
|
|
44
|
+
locale,
|
|
45
|
+
setProps,
|
|
46
|
+
picker,
|
|
47
|
+
format,
|
|
48
|
+
firstDayOfWeek,
|
|
49
|
+
disabled,
|
|
50
|
+
showTime,
|
|
51
|
+
allowClear,
|
|
52
|
+
autoFocus,
|
|
53
|
+
placeholder,
|
|
54
|
+
disabledDatesStrategy,
|
|
55
|
+
pickerValue,
|
|
56
|
+
value,
|
|
57
|
+
defaultValue,
|
|
58
|
+
bordered,
|
|
59
|
+
variant,
|
|
60
|
+
size,
|
|
61
|
+
status,
|
|
62
|
+
popupContainer,
|
|
63
|
+
readOnly,
|
|
64
|
+
placement,
|
|
65
|
+
extraFooter,
|
|
66
|
+
showToday,
|
|
67
|
+
presets,
|
|
68
|
+
customCells,
|
|
69
|
+
prefix,
|
|
70
|
+
suffixIcon,
|
|
71
|
+
persistence,
|
|
72
|
+
persisted_props,
|
|
73
|
+
persistence_type,
|
|
74
|
+
batchPropsNames,
|
|
75
|
+
needConfirm,
|
|
76
|
+
...others
|
|
77
|
+
} = props;
|
|
78
|
+
|
|
79
|
+
const [rawValue, setRawValue] = useState(null);
|
|
80
|
+
|
|
81
|
+
// 解决value经回调更新后,rawValue未更新的问题
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (formId && (name || id) && enableBatchControl) {
|
|
84
|
+
if (currentFormValue) {
|
|
85
|
+
setRawValue(dayjs(currentFormValue, format));
|
|
86
|
+
} else {
|
|
87
|
+
setRawValue(null);
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
if (value) {
|
|
91
|
+
setRawValue(dayjs(value, format));
|
|
92
|
+
} else {
|
|
93
|
+
setRawValue(null);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, [value, currentFormValue])
|
|
97
|
+
|
|
98
|
+
// 批属性监听
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (batchPropsNames && batchPropsNames.length !== 0) {
|
|
101
|
+
let _batchPropsValues = {};
|
|
102
|
+
for (let propName of batchPropsNames) {
|
|
103
|
+
_batchPropsValues[propName] = props[propName];
|
|
104
|
+
}
|
|
105
|
+
setProps({
|
|
106
|
+
batchPropsValues: _batchPropsValues
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const context = useContext(PropsContext)
|
|
112
|
+
const formId = useContext(FormContext)
|
|
113
|
+
|
|
114
|
+
const updateItemValue = useFormStore((state) => state.updateItemValue)
|
|
115
|
+
const deleteItemValue = useFormStore((state) => state.deleteItemValue)
|
|
116
|
+
|
|
117
|
+
locale = (context && context.locale) || locale
|
|
118
|
+
|
|
119
|
+
// 收集当前组件相关表单值
|
|
120
|
+
const currentFormValue = useFormStore(state => state.values?.[formId]?.[name || id])
|
|
121
|
+
|
|
122
|
+
// 处理组件卸载后,对应表单项值的清除
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
return () => {
|
|
125
|
+
// 若上文中存在有效表单id
|
|
126
|
+
if (formId && (name || id) && enableBatchControl) {
|
|
127
|
+
// 表单值更新
|
|
128
|
+
deleteItemValue(formId, name || id)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}, [name, id])
|
|
132
|
+
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
// 初始化value
|
|
135
|
+
if (defaultValue && !value) {
|
|
136
|
+
// 当defaultValue不为空且value为空时,为value初始化defaultValue对应值
|
|
137
|
+
setProps({ value: defaultValue })
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// 调整不同showTime下的format缺省参数
|
|
141
|
+
if (showTime && !format) {
|
|
142
|
+
setProps({
|
|
143
|
+
format: 'YYYY-MM-DD HH:mm:ss'
|
|
144
|
+
})
|
|
145
|
+
} else if (!showTime && !format) {
|
|
146
|
+
setProps({
|
|
147
|
+
format: 'YYYY-MM-DD'
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// 处理pickerValue缺省赋值
|
|
152
|
+
if (!pickerValue) {
|
|
153
|
+
setProps({
|
|
154
|
+
pickerValue: dayjs(new Date()).format(format || (showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'))
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
}, [])
|
|
158
|
+
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
if (!isUndefined(firstDayOfWeek)) {
|
|
161
|
+
dayjs.locale(
|
|
162
|
+
locale === 'en-us' ? 'en' : locale,
|
|
163
|
+
{
|
|
164
|
+
week: {
|
|
165
|
+
dow: firstDayOfWeek
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
}, [firstDayOfWeek])
|
|
171
|
+
|
|
172
|
+
const onChange = (date, dateString) => {
|
|
173
|
+
if (isString(dateString)) {
|
|
174
|
+
// AntdForm表单批量控制
|
|
175
|
+
if (formId && (name || id) && enableBatchControl) {
|
|
176
|
+
// 表单值更新
|
|
177
|
+
updateItemValue(formId, name || id, dateString)
|
|
178
|
+
}
|
|
179
|
+
// 更新rawValue
|
|
180
|
+
setRawValue(date);
|
|
181
|
+
setProps({ value: dateString })
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const checkDisabledDate = current => {
|
|
186
|
+
|
|
187
|
+
// 根据disabledDatesStrategy设定的各个子条件进行是否禁用判断
|
|
188
|
+
for (let i = 0; i < disabledDatesStrategy.length; i++) {
|
|
189
|
+
let strategy = disabledDatesStrategy[i];
|
|
190
|
+
// 判断当前子策略方式
|
|
191
|
+
if (strategy.mode === 'eq') {
|
|
192
|
+
// 判断当前子策略约束目标
|
|
193
|
+
if (strategy.target === 'day') {
|
|
194
|
+
if (current.date() === strategy.value) {
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
} else if (strategy.target === 'month') {
|
|
198
|
+
if (current.month() === strategy.value) {
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
} else if (strategy.target === 'quarter') {
|
|
202
|
+
if (current.quarter() === strategy.value) {
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
} else if (strategy.target === 'year') {
|
|
206
|
+
if (current.year() === strategy.value) {
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
} else if (strategy.target === 'dayOfYear') {
|
|
210
|
+
if (current.dayOfYear() === strategy.value) {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
} else if (strategy.target === 'dayOfWeek') {
|
|
214
|
+
if (current.isoWeekday() === strategy.value) {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
} else if (strategy.target === 'specific-date') {
|
|
218
|
+
if (current.isSame(dayjs(strategy.value, 'YYYY-MM-DD'))) {
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
} else if (strategy.mode === 'ne') {
|
|
223
|
+
// 判断当前子策略约束目标
|
|
224
|
+
if (strategy.target === 'day') {
|
|
225
|
+
if (current.date() !== strategy.value) {
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
} else if (strategy.target === 'month') {
|
|
229
|
+
if (current.month() !== strategy.value) {
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
} else if (strategy.target === 'quarter') {
|
|
233
|
+
if (current.quarter() !== strategy.value) {
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
} else if (strategy.target === 'year') {
|
|
237
|
+
if (current.year() !== strategy.value) {
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
} else if (strategy.target === 'dayOfYear') {
|
|
241
|
+
if (current.dayOfYear() !== strategy.value) {
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
} else if (strategy.target === 'dayOfWeek') {
|
|
245
|
+
if (current.isoWeekday() !== strategy.value) {
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
} else if (strategy.target === 'specific-date') {
|
|
249
|
+
if (!current.isSame(dayjs(strategy.value, 'YYYY-MM-DD'))) {
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
} else if (strategy.mode === 'le') {
|
|
254
|
+
// 判断当前子策略约束目标
|
|
255
|
+
if (strategy.target === 'day') {
|
|
256
|
+
if (current.date() <= strategy.value) {
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
} else if (strategy.target === 'month') {
|
|
260
|
+
if (current.month() <= strategy.value) {
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
} else if (strategy.target === 'quarter') {
|
|
264
|
+
if (current.quarter() <= strategy.value) {
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
} else if (strategy.target === 'year') {
|
|
268
|
+
if (current.year() <= strategy.value) {
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
} else if (strategy.target === 'dayOfYear') {
|
|
272
|
+
if (current.dayOfYear() <= strategy.value) {
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
} else if (strategy.target === 'dayOfWeek') {
|
|
276
|
+
if (current.isoWeekday() <= strategy.value) {
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
} else if (strategy.target === 'specific-date') {
|
|
280
|
+
if (current.isSameOrBefore(dayjs(strategy.value, 'YYYY-MM-DD'))) {
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
} else if (strategy.mode === 'lt') {
|
|
285
|
+
// 判断当前子策略约束目标
|
|
286
|
+
if (strategy.target === 'day') {
|
|
287
|
+
if (current.date() < strategy.value) {
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
} else if (strategy.target === 'month') {
|
|
291
|
+
if (current.month() < strategy.value) {
|
|
292
|
+
return true;
|
|
293
|
+
}
|
|
294
|
+
} else if (strategy.target === 'quarter') {
|
|
295
|
+
if (current.quarter() < strategy.value) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
} else if (strategy.target === 'year') {
|
|
299
|
+
if (current.year() < strategy.value) {
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
} else if (strategy.target === 'dayOfYear') {
|
|
303
|
+
if (current.dayOfYear() < strategy.value) {
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
} else if (strategy.target === 'dayOfWeek') {
|
|
307
|
+
if (current.isoWeekday() < strategy.value) {
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
} else if (strategy.target === 'specific-date') {
|
|
311
|
+
if (current.isBefore(dayjs(strategy.value, 'YYYY-MM-DD'))) {
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
} else if (strategy.mode === 'ge') {
|
|
316
|
+
// 判断当前子策略约束目标
|
|
317
|
+
if (strategy.target === 'day') {
|
|
318
|
+
if (current.date() >= strategy.value) {
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
} else if (strategy.target === 'month') {
|
|
322
|
+
if (current.month() >= strategy.value) {
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
} else if (strategy.target === 'quarter') {
|
|
326
|
+
if (current.quarter() >= strategy.value) {
|
|
327
|
+
return true;
|
|
328
|
+
}
|
|
329
|
+
} else if (strategy.target === 'year') {
|
|
330
|
+
if (current.year() >= strategy.value) {
|
|
331
|
+
return true;
|
|
332
|
+
}
|
|
333
|
+
} else if (strategy.target === 'dayOfYear') {
|
|
334
|
+
if (current.dayOfYear() >= strategy.value) {
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
} else if (strategy.target === 'dayOfWeek') {
|
|
338
|
+
if (current.isoWeekday() >= strategy.value) {
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
} else if (strategy.target === 'specific-date') {
|
|
342
|
+
if (current.isSameOrAfter(dayjs(strategy.value, 'YYYY-MM-DD'))) {
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
} else if (strategy.mode === 'gt') {
|
|
347
|
+
// 判断当前子策略约束目标
|
|
348
|
+
if (strategy.target === 'day') {
|
|
349
|
+
if (current.date() > strategy.value) {
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
} else if (strategy.target === 'month') {
|
|
353
|
+
if (current.month() > strategy.value) {
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
} else if (strategy.target === 'quarter') {
|
|
357
|
+
if (current.quarter() > strategy.value) {
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
} else if (strategy.target === 'year') {
|
|
361
|
+
if (current.year() > strategy.value) {
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
} else if (strategy.target === 'dayOfYear') {
|
|
365
|
+
if (current.dayOfYear() > strategy.value) {
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
} else if (strategy.target === 'dayOfWeek') {
|
|
369
|
+
if (current.isoWeekday() > strategy.value) {
|
|
370
|
+
return true;
|
|
371
|
+
}
|
|
372
|
+
} else if (strategy.target === 'specific-date') {
|
|
373
|
+
if (current.isAfter(dayjs(strategy.value, 'YYYY-MM-DD'))) {
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
} else if (strategy.mode === 'in') {
|
|
378
|
+
// 判断当前子策略约束目标
|
|
379
|
+
if (strategy.target === 'day') {
|
|
380
|
+
if (strategy.value.includes(current.date())) {
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
} else if (strategy.target === 'month') {
|
|
384
|
+
if (strategy.value.includes(current.month())) {
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
} else if (strategy.target === 'quarter') {
|
|
388
|
+
if (strategy.value.includes(current.quarter())) {
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
} else if (strategy.target === 'year') {
|
|
392
|
+
if (strategy.value.includes(current.year())) {
|
|
393
|
+
return true;
|
|
394
|
+
}
|
|
395
|
+
} else if (strategy.target === 'dayOfYear') {
|
|
396
|
+
if (strategy.value.includes(current.dayOfYear())) {
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
} else if (strategy.target === 'dayOfWeek') {
|
|
400
|
+
if (strategy.value.includes(current.isoWeekday())) {
|
|
401
|
+
return true;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
} else if (strategy.mode === 'not-in') {
|
|
405
|
+
// 判断当前子策略约束目标
|
|
406
|
+
if (strategy.target === 'day') {
|
|
407
|
+
if (!strategy.value.includes(current.date())) {
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
} else if (strategy.target === 'month') {
|
|
411
|
+
if (!strategy.value.includes(current.month())) {
|
|
412
|
+
return true;
|
|
413
|
+
}
|
|
414
|
+
} else if (strategy.target === 'quarter') {
|
|
415
|
+
if (!strategy.value.includes(current.quarter())) {
|
|
416
|
+
return true;
|
|
417
|
+
}
|
|
418
|
+
} else if (strategy.target === 'year') {
|
|
419
|
+
if (!strategy.value.includes(current.year())) {
|
|
420
|
+
return true;
|
|
421
|
+
}
|
|
422
|
+
} else if (strategy.target === 'dayOfYear') {
|
|
423
|
+
if (!strategy.value.includes(current.dayOfYear())) {
|
|
424
|
+
return true;
|
|
425
|
+
}
|
|
426
|
+
} else if (strategy.target === 'dayOfWeek') {
|
|
427
|
+
if (!strategy.value.includes(current.isoWeekday())) {
|
|
428
|
+
return true;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
} else if (strategy.mode === 'in-enumerate-dates') {
|
|
432
|
+
if (strategy.value.includes(current.format(format))) {
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
435
|
+
} else if (strategy.mode === 'not-in-enumerate-dates') {
|
|
436
|
+
if (!strategy.value.includes(current.format(format))) {
|
|
437
|
+
return true;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
return (
|
|
444
|
+
<div>
|
|
445
|
+
<ConfigProvider
|
|
446
|
+
locale={str2Locale.get(locale)}
|
|
447
|
+
>
|
|
448
|
+
<DatePicker
|
|
449
|
+
// 提取具有data-*或aria-*通配格式的属性
|
|
450
|
+
{...pickBy((_, k) => k.startsWith('data-') || k.startsWith('aria-'), others)}
|
|
451
|
+
id={id}
|
|
452
|
+
className={
|
|
453
|
+
isString(className) ?
|
|
454
|
+
className :
|
|
455
|
+
(className ? useCss(className) : undefined)
|
|
456
|
+
}
|
|
457
|
+
style={style}
|
|
458
|
+
popupClassName={popupClassName}
|
|
459
|
+
key={key}
|
|
460
|
+
format={format}
|
|
461
|
+
onChange={onChange}
|
|
462
|
+
onPanelChange={(v, m) => {
|
|
463
|
+
setProps({
|
|
464
|
+
pickerValue: v.format(format)
|
|
465
|
+
})
|
|
466
|
+
}}
|
|
467
|
+
picker={picker}
|
|
468
|
+
calendarStartDay={firstDayOfWeek}
|
|
469
|
+
disabled={
|
|
470
|
+
context && !isUndefined(context.componentDisabled) ?
|
|
471
|
+
context.componentDisabled :
|
|
472
|
+
disabled
|
|
473
|
+
}
|
|
474
|
+
placeholder={placeholder}
|
|
475
|
+
variant={(
|
|
476
|
+
!variant ?
|
|
477
|
+
(bordered ? 'outlined' : 'borderless') :
|
|
478
|
+
variant
|
|
479
|
+
)}
|
|
480
|
+
size={
|
|
481
|
+
context && !isUndefined(context.componentSize) ?
|
|
482
|
+
context.componentSize :
|
|
483
|
+
size
|
|
484
|
+
}
|
|
485
|
+
disabledDate={disabledDatesStrategy ? checkDisabledDate : undefined}
|
|
486
|
+
pickerValue={pickerValue && dayjs(pickerValue, format)}
|
|
487
|
+
value={
|
|
488
|
+
formId && (name || id) && enableBatchControl ?
|
|
489
|
+
(currentFormValue ? dayjs(currentFormValue, format) : undefined) :
|
|
490
|
+
(rawValue || (value ? dayjs(value, format) : undefined))
|
|
491
|
+
}
|
|
492
|
+
defaultValue={
|
|
493
|
+
formId && (name || id) && enableBatchControl ?
|
|
494
|
+
undefined :
|
|
495
|
+
(defaultValue ? dayjs(defaultValue, format) : undefined)
|
|
496
|
+
}
|
|
497
|
+
showTime={
|
|
498
|
+
// 处理时间选择面板在日期选定后的默认选中值
|
|
499
|
+
isObject(showTime) && showTime.defaultValue ?
|
|
500
|
+
{
|
|
501
|
+
defaultValue: dayjs(
|
|
502
|
+
dayjs(new Date()).format('YYYY-MM-DD') + ' ' + showTime.defaultValue,
|
|
503
|
+
'YYYY-MM-DD' + ' ' + (showTime.format || 'HH:mm:ss')
|
|
504
|
+
)
|
|
505
|
+
} :
|
|
506
|
+
showTime
|
|
507
|
+
}
|
|
508
|
+
allowClear={isUndefined(readOnly) ? allowClear : !readOnly}
|
|
509
|
+
autoFocus={autoFocus}
|
|
510
|
+
status={status}
|
|
511
|
+
placement={placement}
|
|
512
|
+
open={isUndefined(readOnly) || !readOnly ? undefined : false}
|
|
513
|
+
inputReadOnly={readOnly}
|
|
514
|
+
renderExtraFooter={() => extraFooter}
|
|
515
|
+
showNow={showToday}
|
|
516
|
+
needConfirm={needConfirm}
|
|
517
|
+
presets={
|
|
518
|
+
// 处理预设快捷选项列表
|
|
519
|
+
(presets || []).map(
|
|
520
|
+
(preset) => ({
|
|
521
|
+
label: preset.label,
|
|
522
|
+
value: () => {
|
|
523
|
+
return dayjs(preset.value, format)
|
|
524
|
+
}
|
|
525
|
+
})
|
|
526
|
+
)
|
|
527
|
+
}
|
|
528
|
+
cellRender={
|
|
529
|
+
customCells ?
|
|
530
|
+
(current, info) => {
|
|
531
|
+
// 尝试搜索命中项
|
|
532
|
+
let matchCell;
|
|
533
|
+
// 目前仅作用于日期类型
|
|
534
|
+
if (info.type === 'date') {
|
|
535
|
+
matchCell = customCells.filter(item => {
|
|
536
|
+
// 初始化基础条件
|
|
537
|
+
let conditions = true
|
|
538
|
+
// 若具有明确年份
|
|
539
|
+
if (item.year) {
|
|
540
|
+
conditions = conditions && current.year() === item.year
|
|
541
|
+
}
|
|
542
|
+
// 若具有明确月份
|
|
543
|
+
if (item.month) {
|
|
544
|
+
conditions = conditions && current.month() + 1 === item.month
|
|
545
|
+
}
|
|
546
|
+
// 若具有明确日期
|
|
547
|
+
if (item.date) {
|
|
548
|
+
conditions = conditions && current.date() === item.date
|
|
549
|
+
}
|
|
550
|
+
return conditions;
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
if (matchCell.length > 0) {
|
|
554
|
+
return (
|
|
555
|
+
<div className={
|
|
556
|
+
matchCell[0].className ?
|
|
557
|
+
`ant-picker-cell-inner ${matchCell[0].className}` :
|
|
558
|
+
'ant-picker-cell-inner'
|
|
559
|
+
}
|
|
560
|
+
style={matchCell[0].style}
|
|
561
|
+
>
|
|
562
|
+
{current.date()}
|
|
563
|
+
</div>
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
return info.originNode;
|
|
567
|
+
} :
|
|
568
|
+
undefined
|
|
569
|
+
}
|
|
570
|
+
prefix={prefix}
|
|
571
|
+
suffixIcon={suffixIcon}
|
|
572
|
+
data-dash-is-loading={useLoading()}
|
|
573
|
+
getPopupContainer={
|
|
574
|
+
popupContainer === 'parent' ?
|
|
575
|
+
(triggerNode) => triggerNode.parentNode :
|
|
576
|
+
undefined
|
|
577
|
+
}
|
|
578
|
+
/>
|
|
579
|
+
</ConfigProvider>
|
|
580
|
+
</div>
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
export default AntdDatePicker;
|
|
585
|
+
|
|
586
|
+
AntdDatePicker.defaultProps = defaultProps;
|
|
587
587
|
AntdDatePicker.propTypes = propTypes;
|