@canlooks/can-ui 0.0.70 → 0.0.72
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/LICENSE +1 -1
- package/dist/cjs/components/actionSheet/actionSheet.js +9 -4
- package/dist/cjs/components/alert/alert.style.d.ts +2 -2
- package/dist/cjs/components/app/appDialog.js +28 -24
- package/dist/cjs/components/autocomplete/autocomplete.js +21 -27
- package/dist/cjs/components/avatar/avatar.d.ts +2 -2
- package/dist/cjs/components/avatar/avatar.js +6 -5
- package/dist/cjs/components/avatar/avatarGroup.js +1 -1
- package/dist/cjs/components/bubbleConfirm/bubbleConfirm.js +9 -2
- package/dist/cjs/components/bubbleConfirm/bubbleConfirm.style.d.ts +1 -1
- package/dist/cjs/components/calendar/calendar.style.js +124 -124
- package/dist/cjs/components/cascade/cascade.d.ts +2 -2
- package/dist/cjs/components/cascade/cascade.js +33 -21
- package/dist/cjs/components/cascade/cascadePanel.js +23 -13
- package/dist/cjs/components/checkboxBase/checkboxBase.d.ts +2 -2
- package/dist/cjs/components/checkboxBase/checkboxBase.js +9 -2
- package/dist/cjs/components/checkboxBase/checkboxBase.style.d.ts +1 -1
- package/dist/cjs/components/checkboxBaseGroup/checkboxBaseGroup.js +2 -2
- package/dist/cjs/components/clickAway/clickAway.d.ts +28 -28
- package/dist/cjs/components/colorPicker/colorPicker.d.ts +2 -2
- package/dist/cjs/components/colorPicker/colorPicker.js +2 -2
- package/dist/cjs/components/counter/counter.js +9 -10
- package/dist/cjs/components/curd/curd.d.ts +10 -12
- package/dist/cjs/components/curd/curd.js +38 -33
- package/dist/cjs/components/curd/curd.style.d.ts +2 -1
- package/dist/cjs/components/curd/curd.style.js +14 -4
- package/dist/cjs/components/curd/curdDialog.js +2 -1
- package/dist/cjs/components/curd/curdFilterable.d.ts +21 -0
- package/dist/cjs/components/curd/{curdFilter.js → curdFilterable.js} +19 -24
- package/dist/cjs/components/curd/index.d.ts +1 -1
- package/dist/cjs/components/curd/index.js +1 -1
- package/dist/cjs/components/dataGrid/columnResize.js +2 -2
- package/dist/cjs/components/dataGrid/dataGrid.d.ts +29 -12
- package/dist/cjs/components/dataGrid/dataGrid.js +46 -20
- package/dist/cjs/components/dataGrid/dataGrid.style.d.ts +5 -3
- package/dist/cjs/components/dataGrid/dataGrid.style.js +38 -33
- package/dist/cjs/components/dataGrid/dataGridHead.d.ts +4 -1
- package/dist/cjs/components/dataGrid/dataGridHead.js +28 -19
- package/dist/cjs/components/dataGrid/dataGridRows.js +1 -1
- package/dist/cjs/components/dataGrid/filterBubbleContent.d.ts +19 -0
- package/dist/cjs/components/dataGrid/filterBubbleContent.js +42 -0
- package/dist/cjs/components/dateTimePicker/dateTimePicker.d.ts +2 -2
- package/dist/cjs/components/dateTimePicker/dateTimePicker.js +27 -9
- package/dist/cjs/components/dateTimePicker/dateTimePicker.style.d.ts +1 -1
- package/dist/cjs/components/dateTimeRangePicker/dateTimeRangePicker.d.ts +4 -3
- package/dist/cjs/components/dateTimeRangePicker/dateTimeRangePicker.js +45 -23
- package/dist/cjs/components/descriptions/descriptions.js +2 -0
- package/dist/cjs/components/descriptions/descriptions.style.d.ts +1 -1
- package/dist/cjs/components/dialog/dialog.d.ts +1 -1
- package/dist/cjs/components/dialog/dialog.js +2 -2
- package/dist/cjs/components/dialog/dialog.style.d.ts +2 -2
- package/dist/cjs/components/draggable/draggable.d.ts +12 -2
- package/dist/cjs/components/draggable/draggable.js +34 -4
- package/dist/cjs/components/flex/flex.d.ts +7 -4
- package/dist/cjs/components/flex/flex.js +3 -3
- package/dist/cjs/components/form/form.d.ts +10 -5
- package/dist/cjs/components/form/form.js +45 -9
- package/dist/cjs/components/form/formItem.d.ts +12 -7
- package/dist/cjs/components/form/formItem.js +47 -33
- package/dist/cjs/components/form/formRelatable.js +2 -1
- package/dist/cjs/components/gallery/gallery.style.d.ts +1 -1
- package/dist/cjs/components/gallery/imageItem.js +1 -1
- package/dist/cjs/components/grid/grid.d.ts +5 -5
- package/dist/cjs/components/grid/gridItem.d.ts +8 -7
- package/dist/cjs/components/grid/gridItem.js +2 -3
- package/dist/cjs/components/image/image.d.ts +4 -4
- package/dist/cjs/components/input/input.d.ts +2 -2
- package/dist/cjs/components/input/input.js +9 -2
- package/dist/cjs/components/inputBase/inputBase.d.ts +16 -11
- package/dist/cjs/components/inputBase/inputBase.js +23 -12
- package/dist/cjs/components/loading/loading.d.ts +3 -1
- package/dist/cjs/components/loading/loading.js +2 -2
- package/dist/cjs/components/loading/loading.style.js +4 -3
- package/dist/cjs/components/loadingIndicator/loadingIndicator.d.ts +4 -2
- package/dist/cjs/components/loadingIndicator/loadingIndicator.js +2 -2
- package/dist/cjs/components/loadingIndicator/loadingIndicator.style.d.ts +1 -1
- package/dist/cjs/components/loadingIndicator/loadingIndicator.style.js +1 -2
- package/dist/cjs/components/loadingMask/loadingMask.js +1 -1
- package/dist/cjs/components/menu/menu.js +1 -1
- package/dist/cjs/components/menuItem/menuItem.d.ts +2 -2
- package/dist/cjs/components/optionsBase/optionsBase.js +1 -0
- package/dist/cjs/components/overlayBase/overlayBase.js +9 -6
- package/dist/cjs/components/overlayBase/overlayBase.style.js +0 -3
- package/dist/cjs/components/palette/palette.style.d.ts +1 -1
- package/dist/cjs/components/pickerDialog/pickerDialog.js +20 -7
- package/dist/cjs/components/pickerDialog/pickerDialog.style.d.ts +1 -1
- package/dist/cjs/components/popper/popper.d.ts +5 -2
- package/dist/cjs/components/popper/popper.js +31 -12
- package/dist/cjs/components/popper/popper.style.js +1 -2
- package/dist/cjs/components/progress/progress.js +1 -1
- package/dist/cjs/components/resizable/resizable.style.d.ts +1 -1
- package/dist/cjs/components/segmented/segmented.style.d.ts +1 -1
- package/dist/cjs/components/select/select.d.ts +2 -2
- package/dist/cjs/components/select/select.js +44 -20
- package/dist/cjs/components/selectedList/selectedItem.d.ts +1 -1
- package/dist/cjs/components/selectedList/selectedItem.js +2 -2
- package/dist/cjs/components/selectionContext/selectionContext.d.ts +0 -1
- package/dist/cjs/components/selectionContext/selectionHook.d.ts +1 -1
- package/dist/cjs/components/selectionContext/selectionHook.js +2 -2
- package/dist/cjs/components/serialInput/index.d.ts +1 -0
- package/dist/cjs/components/serialInput/index.js +4 -0
- package/dist/cjs/components/serialInput/serialInput.d.ts +21 -0
- package/dist/cjs/components/serialInput/serialInput.js +58 -0
- package/dist/cjs/components/serialInput/serialInput.style.d.ts +6 -0
- package/dist/cjs/components/serialInput/serialInput.style.js +13 -0
- package/dist/cjs/components/skeleton/skeleton.d.ts +2 -2
- package/dist/cjs/components/slidableActions/slidableActionsAction.js +15 -6
- package/dist/cjs/components/slider/slider.d.ts +2 -2
- package/dist/cjs/components/slider/slider.js +15 -21
- package/dist/cjs/components/snackbarBase/snackbarBase.style.d.ts +1 -1
- package/dist/cjs/components/snackbarBase/snackbarBase.style.js +1 -3
- package/dist/cjs/components/sortableItem/sortableItem.js +9 -10
- package/dist/cjs/components/status/status.d.ts +6 -6
- package/dist/cjs/components/switch/switch.d.ts +2 -2
- package/dist/cjs/components/table/table.d.ts +3 -3
- package/dist/cjs/components/table/table.style.d.ts +1 -1
- package/dist/cjs/components/table/tableSticky.d.ts +5 -5
- package/dist/cjs/components/table/tableSticky.js +4 -4
- package/dist/cjs/components/tabs/tabs.style.d.ts +3 -3
- package/dist/cjs/components/tag/tag.d.ts +1 -1
- package/dist/cjs/components/tag/tag.js +2 -1
- package/dist/cjs/components/tag/tag.style.d.ts +1 -1
- package/dist/cjs/components/textarea/textarea.d.ts +2 -2
- package/dist/cjs/components/textarea/textarea.js +5 -1
- package/dist/cjs/components/toggleButton/toggleButton.js +1 -1
- package/dist/cjs/components/transfer/transfer.style.d.ts +2 -2
- package/dist/cjs/components/transitionBase/collapse.js +36 -14
- package/dist/cjs/components/transitionBase/transitionBase.js +1 -1
- package/dist/cjs/components/transitionBase/transitionBase.style.js +1 -1
- package/dist/cjs/components/transportStyle/transportStyle.d.ts +1 -1
- package/dist/cjs/components/transportStyle/transportStyle.js +2 -3
- package/dist/cjs/components/tree/tree.d.ts +17 -4
- package/dist/cjs/components/tree/tree.js +15 -14
- package/dist/cjs/components/tree/tree.style.d.ts +9 -3
- package/dist/cjs/components/tree/tree.style.js +135 -4
- package/dist/cjs/components/tree/treeDnd.d.ts +25 -0
- package/dist/cjs/components/tree/treeDnd.js +23 -0
- package/dist/cjs/components/tree/treeNode.d.ts +2 -2
- package/dist/cjs/components/tree/treeNode.js +94 -16
- package/dist/cjs/components/treeSelect/treeSelect.d.ts +2 -2
- package/dist/cjs/components/treeSelect/treeSelect.js +3 -3
- package/dist/cjs/components/upload/upload.d.ts +2 -2
- package/dist/cjs/components/upload/upload.js +5 -2
- package/dist/cjs/components/upload/upload.style.d.ts +2 -2
- package/dist/cjs/extensions/curd/curd.d.ts +20 -0
- package/dist/cjs/extensions/curd/curd.js +20 -0
- package/dist/cjs/extensions/documentViewer/pdfViewer.d.ts +2 -2
- package/dist/cjs/extensions/reactiveForm/index.d.ts +2 -0
- package/dist/cjs/extensions/reactiveForm/index.js +5 -0
- package/dist/cjs/extensions/reactiveForm/reactiveForm.d.ts +40 -0
- package/dist/cjs/extensions/reactiveForm/reactiveForm.js +50 -0
- package/dist/cjs/extensions/reactiveForm/reactiveFormItem.d.ts +7 -0
- package/dist/cjs/extensions/reactiveForm/reactiveFormItem.js +39 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/types.d.ts +2 -2
- package/dist/cjs/utils/curd.js +5 -2
- package/dist/cjs/utils/dataGrid.d.ts +3 -2
- package/dist/cjs/utils/hooks.js +3 -3
- package/dist/cjs/utils/index.d.ts +2 -2
- package/dist/cjs/utils/index.js +2 -2
- package/dist/cjs/utils/utils.d.ts +17 -9
- package/dist/cjs/utils/utils.js +59 -16
- package/dist/esm/components/actionSheet/actionSheet.js +10 -5
- package/dist/esm/components/alert/alert.style.d.ts +2 -2
- package/dist/esm/components/app/appDialog.js +28 -24
- package/dist/esm/components/autocomplete/autocomplete.js +22 -28
- package/dist/esm/components/avatar/avatar.d.ts +2 -2
- package/dist/esm/components/avatar/avatar.js +7 -6
- package/dist/esm/components/avatar/avatarGroup.js +1 -1
- package/dist/esm/components/bubbleConfirm/bubbleConfirm.js +10 -3
- package/dist/esm/components/bubbleConfirm/bubbleConfirm.style.d.ts +1 -1
- package/dist/esm/components/calendar/calendar.style.js +124 -124
- package/dist/esm/components/cascade/cascade.d.ts +2 -2
- package/dist/esm/components/cascade/cascade.js +34 -22
- package/dist/esm/components/cascade/cascadePanel.js +24 -14
- package/dist/esm/components/checkboxBase/checkboxBase.d.ts +2 -2
- package/dist/esm/components/checkboxBase/checkboxBase.js +10 -3
- package/dist/esm/components/checkboxBase/checkboxBase.style.d.ts +1 -1
- package/dist/esm/components/checkboxBaseGroup/checkboxBaseGroup.js +3 -3
- package/dist/esm/components/clickAway/clickAway.d.ts +28 -28
- package/dist/esm/components/colorPicker/colorPicker.d.ts +2 -2
- package/dist/esm/components/colorPicker/colorPicker.js +3 -3
- package/dist/esm/components/counter/counter.js +10 -11
- package/dist/esm/components/curd/curd.d.ts +10 -12
- package/dist/esm/components/curd/curd.js +39 -34
- package/dist/esm/components/curd/curd.style.d.ts +2 -1
- package/dist/esm/components/curd/curd.style.js +14 -4
- package/dist/esm/components/curd/curdDialog.js +2 -1
- package/dist/esm/components/curd/curdFilterable.d.ts +21 -0
- package/dist/esm/components/curd/{curdFilter.js → curdFilterable.js} +20 -25
- package/dist/esm/components/curd/index.d.ts +1 -1
- package/dist/esm/components/curd/index.js +1 -1
- package/dist/esm/components/dataGrid/columnResize.js +3 -3
- package/dist/esm/components/dataGrid/dataGrid.d.ts +29 -12
- package/dist/esm/components/dataGrid/dataGrid.js +48 -22
- package/dist/esm/components/dataGrid/dataGrid.style.d.ts +5 -3
- package/dist/esm/components/dataGrid/dataGrid.style.js +38 -33
- package/dist/esm/components/dataGrid/dataGridHead.d.ts +4 -1
- package/dist/esm/components/dataGrid/dataGridHead.js +29 -20
- package/dist/esm/components/dataGrid/dataGridRows.js +1 -1
- package/dist/esm/components/dataGrid/filterBubbleContent.d.ts +19 -0
- package/dist/esm/components/dataGrid/filterBubbleContent.js +39 -0
- package/dist/esm/components/dateTimePicker/dateTimePicker.d.ts +2 -2
- package/dist/esm/components/dateTimePicker/dateTimePicker.js +28 -10
- package/dist/esm/components/dateTimePicker/dateTimePicker.style.d.ts +1 -1
- package/dist/esm/components/dateTimeRangePicker/dateTimeRangePicker.d.ts +4 -3
- package/dist/esm/components/dateTimeRangePicker/dateTimeRangePicker.js +46 -24
- package/dist/esm/components/descriptions/descriptions.js +2 -0
- package/dist/esm/components/descriptions/descriptions.style.d.ts +1 -1
- package/dist/esm/components/dialog/dialog.d.ts +1 -1
- package/dist/esm/components/dialog/dialog.js +2 -2
- package/dist/esm/components/dialog/dialog.style.d.ts +2 -2
- package/dist/esm/components/draggable/draggable.d.ts +12 -2
- package/dist/esm/components/draggable/draggable.js +35 -5
- package/dist/esm/components/flex/flex.d.ts +7 -4
- package/dist/esm/components/flex/flex.js +2 -2
- package/dist/esm/components/form/form.d.ts +10 -5
- package/dist/esm/components/form/form.js +43 -9
- package/dist/esm/components/form/formItem.d.ts +12 -7
- package/dist/esm/components/form/formItem.js +49 -35
- package/dist/esm/components/form/formRelatable.js +3 -2
- package/dist/esm/components/gallery/gallery.style.d.ts +1 -1
- package/dist/esm/components/gallery/imageItem.js +1 -1
- package/dist/esm/components/grid/grid.d.ts +5 -5
- package/dist/esm/components/grid/gridItem.d.ts +8 -7
- package/dist/esm/components/grid/gridItem.js +2 -2
- package/dist/esm/components/image/image.d.ts +4 -4
- package/dist/esm/components/input/input.d.ts +2 -2
- package/dist/esm/components/input/input.js +10 -3
- package/dist/esm/components/inputBase/inputBase.d.ts +16 -11
- package/dist/esm/components/inputBase/inputBase.js +25 -14
- package/dist/esm/components/loading/loading.d.ts +3 -1
- package/dist/esm/components/loading/loading.js +2 -2
- package/dist/esm/components/loading/loading.style.js +4 -3
- package/dist/esm/components/loadingIndicator/loadingIndicator.d.ts +4 -2
- package/dist/esm/components/loadingIndicator/loadingIndicator.js +2 -2
- package/dist/esm/components/loadingIndicator/loadingIndicator.style.d.ts +1 -1
- package/dist/esm/components/loadingIndicator/loadingIndicator.style.js +1 -2
- package/dist/esm/components/loadingMask/loadingMask.js +1 -1
- package/dist/esm/components/menu/menu.js +2 -2
- package/dist/esm/components/menuItem/menuItem.d.ts +2 -2
- package/dist/esm/components/optionsBase/optionsBase.js +1 -0
- package/dist/esm/components/overlayBase/overlayBase.js +10 -7
- package/dist/esm/components/overlayBase/overlayBase.style.js +0 -3
- package/dist/esm/components/palette/palette.style.d.ts +1 -1
- package/dist/esm/components/pickerDialog/pickerDialog.js +21 -8
- package/dist/esm/components/pickerDialog/pickerDialog.style.d.ts +1 -1
- package/dist/esm/components/popper/popper.d.ts +5 -2
- package/dist/esm/components/popper/popper.js +31 -12
- package/dist/esm/components/popper/popper.style.js +1 -2
- package/dist/esm/components/progress/progress.js +1 -1
- package/dist/esm/components/resizable/resizable.style.d.ts +1 -1
- package/dist/esm/components/segmented/segmented.style.d.ts +1 -1
- package/dist/esm/components/select/select.d.ts +2 -2
- package/dist/esm/components/select/select.js +46 -22
- package/dist/esm/components/selectedList/selectedItem.d.ts +1 -1
- package/dist/esm/components/selectedList/selectedItem.js +2 -2
- package/dist/esm/components/selectionContext/selectionContext.d.ts +0 -1
- package/dist/esm/components/selectionContext/selectionHook.d.ts +1 -1
- package/dist/esm/components/selectionContext/selectionHook.js +1 -1
- package/dist/esm/components/serialInput/index.d.ts +1 -0
- package/dist/esm/components/serialInput/index.js +1 -0
- package/dist/esm/components/serialInput/serialInput.d.ts +21 -0
- package/dist/esm/components/serialInput/serialInput.js +55 -0
- package/dist/esm/components/serialInput/serialInput.style.d.ts +6 -0
- package/dist/esm/components/serialInput/serialInput.style.js +10 -0
- package/dist/esm/components/skeleton/skeleton.d.ts +2 -2
- package/dist/esm/components/slidableActions/slidableActionsAction.js +16 -7
- package/dist/esm/components/slider/slider.d.ts +2 -2
- package/dist/esm/components/slider/slider.js +16 -22
- package/dist/esm/components/snackbarBase/snackbarBase.style.d.ts +1 -1
- package/dist/esm/components/snackbarBase/snackbarBase.style.js +1 -3
- package/dist/esm/components/sortableItem/sortableItem.js +10 -11
- package/dist/esm/components/status/status.d.ts +6 -6
- package/dist/esm/components/switch/switch.d.ts +2 -2
- package/dist/esm/components/table/table.d.ts +3 -3
- package/dist/esm/components/table/table.style.d.ts +1 -1
- package/dist/esm/components/table/tableSticky.d.ts +5 -5
- package/dist/esm/components/table/tableSticky.js +3 -3
- package/dist/esm/components/tabs/tabs.style.d.ts +3 -3
- package/dist/esm/components/tag/tag.d.ts +1 -1
- package/dist/esm/components/tag/tag.js +2 -1
- package/dist/esm/components/tag/tag.style.d.ts +1 -1
- package/dist/esm/components/textarea/textarea.d.ts +2 -2
- package/dist/esm/components/textarea/textarea.js +6 -2
- package/dist/esm/components/toggleButton/toggleButton.js +2 -2
- package/dist/esm/components/transfer/transfer.style.d.ts +2 -2
- package/dist/esm/components/transitionBase/collapse.js +38 -16
- package/dist/esm/components/transitionBase/transitionBase.js +1 -1
- package/dist/esm/components/transitionBase/transitionBase.style.js +1 -1
- package/dist/esm/components/transportStyle/transportStyle.d.ts +1 -1
- package/dist/esm/components/transportStyle/transportStyle.js +2 -2
- package/dist/esm/components/tree/tree.d.ts +17 -4
- package/dist/esm/components/tree/tree.js +17 -16
- package/dist/esm/components/tree/tree.style.d.ts +9 -3
- package/dist/esm/components/tree/tree.style.js +135 -4
- package/dist/esm/components/tree/treeDnd.d.ts +25 -0
- package/dist/esm/components/tree/treeDnd.js +19 -0
- package/dist/esm/components/tree/treeNode.d.ts +2 -2
- package/dist/esm/components/tree/treeNode.js +96 -18
- package/dist/esm/components/treeSelect/treeSelect.d.ts +2 -2
- package/dist/esm/components/treeSelect/treeSelect.js +4 -4
- package/dist/esm/components/upload/upload.d.ts +2 -2
- package/dist/esm/components/upload/upload.js +6 -3
- package/dist/esm/components/upload/upload.style.d.ts +2 -2
- package/dist/esm/extensions/curd/curd.d.ts +20 -0
- package/dist/esm/extensions/curd/curd.js +20 -0
- package/dist/esm/extensions/documentViewer/pdfViewer.d.ts +2 -2
- package/dist/esm/extensions/reactiveForm/index.d.ts +2 -0
- package/dist/esm/extensions/reactiveForm/index.js +2 -0
- package/dist/esm/extensions/reactiveForm/reactiveForm.d.ts +40 -0
- package/dist/esm/extensions/reactiveForm/reactiveForm.js +46 -0
- package/dist/esm/extensions/reactiveForm/reactiveFormItem.d.ts +7 -0
- package/dist/esm/extensions/reactiveForm/reactiveFormItem.js +36 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/types.d.ts +2 -2
- package/dist/esm/utils/curd.js +5 -2
- package/dist/esm/utils/dataGrid.d.ts +3 -2
- package/dist/esm/utils/hooks.js +3 -3
- package/dist/esm/utils/index.d.ts +2 -2
- package/dist/esm/utils/index.js +2 -2
- package/dist/esm/utils/utils.d.ts +17 -9
- package/dist/esm/utils/utils.js +58 -16
- package/extensions/curd.cjs +5 -5
- package/extensions/documentViewer.cjs +5 -5
- package/extensions/reactiveForm.cjs +5 -0
- package/extensions/reactiveForm.d.ts +1 -0
- package/extensions/reactiveForm.js +1 -0
- package/extensions/textFormatter.cjs +5 -5
- package/package.json +6 -6
- package/dist/cjs/components/curd/curdFilter.d.ts +0 -16
- package/dist/esm/components/curd/curdFilter.d.ts +0 -16
- package/documentation/bootstrap.mjs +0 -8
- package/documentation/dist/assets/index-DvrKS6Tv.js +0 -7747
- package/documentation/dist/atom-one-dark.min.css +0 -1
- package/documentation/dist/components/accordion.md +0 -38
- package/documentation/dist/components/actionSheet.md +0 -49
- package/documentation/dist/components/alert.md +0 -38
- package/documentation/dist/components/anchorList.md +0 -36
- package/documentation/dist/components/autocomplete.md +0 -68
- package/documentation/dist/components/avatar.md +0 -79
- package/documentation/dist/components/badge.md +0 -33
- package/documentation/dist/components/bottomNavigation.md +0 -39
- package/documentation/dist/components/breadcrumb.md +0 -28
- package/documentation/dist/components/bubbleConfirm.md +0 -34
- package/documentation/dist/components/button.md +0 -62
- package/documentation/dist/components/card.md +0 -30
- package/documentation/dist/components/cascade.md +0 -48
- package/documentation/dist/components/checkbox.md +0 -36
- package/documentation/dist/components/colorPicker.md +0 -27
- package/documentation/dist/components/contextMenu.md +0 -27
- package/documentation/dist/components/counter.md +0 -29
- package/documentation/dist/components/dataGrid.md +0 -112
- package/documentation/dist/components/dateTimePicker.md +0 -35
- package/documentation/dist/components/dateTimeRangePicker.md +0 -36
- package/documentation/dist/components/descriptions.md +0 -35
- package/documentation/dist/components/dialog.md +0 -56
- package/documentation/dist/components/divider.md +0 -26
- package/documentation/dist/components/drawer.md +0 -40
- package/documentation/dist/components/flex.md +0 -20
- package/documentation/dist/components/form.md +0 -131
- package/documentation/dist/components/formDialog.md +0 -36
- package/documentation/dist/components/grid.md +0 -34
- package/documentation/dist/components/highlight.md +0 -26
- package/documentation/dist/components/image.md +0 -90
- package/documentation/dist/components/input.md +0 -39
- package/documentation/dist/components/loading.md +0 -46
- package/documentation/dist/components/menu.md +0 -85
- package/documentation/dist/components/pagination.md +0 -38
- package/documentation/dist/components/pickerDialog.md +0 -56
- package/documentation/dist/components/placeholder.md +0 -30
- package/documentation/dist/components/progress.md +0 -43
- package/documentation/dist/components/radio.md +0 -37
- package/documentation/dist/components/rating.md +0 -35
- package/documentation/dist/components/resizable.md +0 -41
- package/documentation/dist/components/scrollbar.md +0 -31
- package/documentation/dist/components/segmented.md +0 -57
- package/documentation/dist/components/select.md +0 -30
- package/documentation/dist/components/skeleton.md +0 -26
- package/documentation/dist/components/slidableActions.md +0 -53
- package/documentation/dist/guide/appComponent.md +0 -30
- package/documentation/dist/guide/globalMethods.md +0 -238
- package/documentation/dist/guide/icon.md +0 -57
- package/documentation/dist/guide/introduction.md +0 -2
- package/documentation/dist/guide/overrideProps.md +0 -0
- package/documentation/dist/guide/startup.md +0 -23
- package/documentation/dist/guide/theme.md +0 -249
- package/documentation/dist/index.html +0 -13
- package/documentation/dist/logo.png +0 -0
- package/documentation/vite.config.mjs +0 -18
|
@@ -3,7 +3,7 @@ import { memo, useMemo } from 'react';
|
|
|
3
3
|
import { Popper } from '../popper';
|
|
4
4
|
import { InputBase } from '../inputBase';
|
|
5
5
|
import { classes, colorPickerPopperStyle, style } from './colorPicker.style';
|
|
6
|
-
import { clsx,
|
|
6
|
+
import { clsx, colorTransfer, useControlled, useTouchSpread, mergeComponentProps } from '../../utils';
|
|
7
7
|
import { useTheme } from '../theme';
|
|
8
8
|
import { Palette } from '../palette';
|
|
9
9
|
import Color from 'color';
|
|
@@ -14,8 +14,8 @@ export const ColorPicker = memo(({ inputProps, popperProps, popperRef, size, sha
|
|
|
14
14
|
return (_jsxs("div", { ...props, css: style, className: clsx(classes.root, props.className), "data-size": size, "data-shape": shape, children: [presets?.map((color, i) => {
|
|
15
15
|
const colorInstance = Color(typeof color === 'string' ? colorTransfer(color, theme) : color);
|
|
16
16
|
return (_jsx(BlockItem, { selected: colorInstance.hex() === innerValue.current.hex(), color: Color(color), onClick: () => setInnerValue(Color(color, 'hex')) }, i));
|
|
17
|
-
}), _jsx(Popper, { css: colorPickerPopperStyle, defaultOpen: defaultOpen, open: open, onOpenChange: onOpenChange, trigger: ['click', 'enter'], placement: "bottomLeft", content: _jsx(Palette, { value: innerValue.current, onChange: setInnerValue }), ...popperProps, popperRef: popperRef, children: _jsx(InputBase, { className: classes.inputBase, size: size, shape: shape === 'circular' ? 'rounded' : shape, children:
|
|
18
|
-
_jsx("div", { className: classes.label, children: label }), _jsx("input", { ...
|
|
17
|
+
}), _jsx(Popper, { css: colorPickerPopperStyle, defaultOpen: defaultOpen, open: open, onOpenChange: onOpenChange, trigger: ['click', 'enter'], placement: "bottomLeft", content: _jsx(Palette, { value: innerValue.current, onChange: setInnerValue }), ...popperProps, popperRef: popperRef, children: _jsx(InputBase, { className: classes.inputBase, size: size, shape: shape === 'circular' ? 'rounded' : shape, children: inputBaseProps => _jsxs(_Fragment, { children: [_jsx(BlockItem, { color: innerValue.current }), !!label &&
|
|
18
|
+
_jsx("div", { className: classes.label, children: label }), _jsx("input", { ...mergeComponentProps(inputProps, inputBaseProps), "data-hidden": "true" })] }) }) })] }));
|
|
19
19
|
});
|
|
20
20
|
function BlockItem({ color, onClick, selected }) {
|
|
21
21
|
const light = useMemo(() => color.luminosity() >= .8, [color]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { classes, style } from './counter.style';
|
|
4
|
-
import { clsx, useControlled } from '../../utils';
|
|
4
|
+
import { clsx, mergeComponentProps, useControlled } from '../../utils';
|
|
5
5
|
import { Button } from '../button';
|
|
6
6
|
import { Input } from '../input';
|
|
7
7
|
import { Flex } from '../flex';
|
|
@@ -18,14 +18,13 @@ export const Counter = memo(({ size, min = -Infinity, max = Infinity, step = 1,
|
|
|
18
18
|
const clickHandler = (dir) => {
|
|
19
19
|
setInnerValue(Math.max(min, Math.min(max, innerValue.current + dir * step)));
|
|
20
20
|
};
|
|
21
|
-
return (_jsxs(Flex, { compact: true, ...props, css: style, className: clsx(classes.root, props.className), children: [_jsx(Button, { disabled: innerValue.current <= min, ...commonButtonProps,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
setInnerValue(+e.target.value)
|
|
27
|
-
} }), _jsx(Button, { disabled: innerValue.current >= max, ...commonButtonProps,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, children: _jsx(Icon, { icon: faPlus }) })] }));
|
|
21
|
+
return (_jsxs(Flex, { compact: true, ...props, css: style, className: clsx(classes.root, props.className), children: [_jsx(Button, { disabled: innerValue.current <= min, ...mergeComponentProps(commonButtonProps, decreaseProps, {
|
|
22
|
+
onClick: () => clickHandler(-1)
|
|
23
|
+
}), children: _jsx(Icon, { icon: faMinus }) }), _jsx(Input, { type: "number", widthAdaptable: true, size: size, min: min, max: max, step: step, precision: precision, ...mergeComponentProps(inputProps, {
|
|
24
|
+
className: classes.input,
|
|
25
|
+
value: innerValue.current,
|
|
26
|
+
onChange: e => setInnerValue(+e.target.value)
|
|
27
|
+
}) }), _jsx(Button, { disabled: innerValue.current >= max, ...mergeComponentProps(commonButtonProps, increaseProps, {
|
|
28
|
+
onClick: () => clickHandler(1)
|
|
29
|
+
}), children: _jsx(Icon, { icon: faPlus }) })] }));
|
|
31
30
|
});
|
|
@@ -2,7 +2,7 @@ import { ReactElement, ReactNode, Ref } from 'react';
|
|
|
2
2
|
import { DivProps, Id, Obj } from '../../types';
|
|
3
3
|
import { ColumnType, DataGridBaseProps, DataGridMultipleProps, DataGridSingleProps, OrderType, RowType } from '../dataGrid';
|
|
4
4
|
import { FormItemProps, FormProps, FormRef, FormValue } from '../form';
|
|
5
|
-
import {
|
|
5
|
+
import { CurdFilterable, CurdFilterableProps } from './curdFilterable';
|
|
6
6
|
import { FieldPath } from '../../utils';
|
|
7
7
|
import { ButtonProps } from '../button';
|
|
8
8
|
import { CurdDialogProps } from './curdDialog';
|
|
@@ -12,28 +12,28 @@ export type CurdFormItemProps<I = any> = FormItemProps<I> & {
|
|
|
12
12
|
order?: number;
|
|
13
13
|
} & Obj;
|
|
14
14
|
export type CurdFormItemType<I = any> = CurdFormItemProps<I> | ReactElement | true;
|
|
15
|
-
export interface CurdColumn<R extends RowType = RowType> extends Omit<ColumnType<R>, 'children'> {
|
|
15
|
+
export interface CurdColumn<R extends RowType = RowType> extends Omit<ColumnType<R>, 'filter' | 'children'> {
|
|
16
16
|
/** 在表格中隐藏,表明该列只用于filter或form */
|
|
17
17
|
hideInTable?: boolean;
|
|
18
18
|
filter?: CurdFormItemType | (() => CurdFormItemType);
|
|
19
|
+
filterInline?: ColumnType<R>['filter'];
|
|
19
20
|
form?: CurdFormItemType | ((activeRow?: R) => CurdFormItemType);
|
|
20
21
|
}
|
|
21
|
-
export type LoadRowsReturn<R extends RowType> = {
|
|
22
|
+
export type LoadRowsReturn<R extends RowType = RowType> = {
|
|
22
23
|
rows: R[];
|
|
23
24
|
/** 必须返回总数才能使翻页正常工作 */
|
|
24
25
|
total: number;
|
|
25
26
|
};
|
|
26
27
|
type EachRowType<R extends RowType, T> = T | ((row: R) => T);
|
|
27
28
|
export type CurdRef<R extends RowType = RowType, F extends FormValue = FormValue> = {
|
|
28
|
-
openCreateDialog(
|
|
29
|
+
openCreateDialog(defaultValue?: F): Promise<F> | undefined;
|
|
29
30
|
selectSingle(): Promise<R> | undefined;
|
|
30
31
|
selectMultiple(selected?: Id[]): Promise<Id[]> | undefined;
|
|
31
32
|
};
|
|
32
|
-
export interface CurdBaseProps<R extends RowType, F extends FormValue> extends Omit<DataGridBaseProps<R>, 'ref'> {
|
|
33
|
+
export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue = FormValue> extends Omit<DataGridBaseProps<R>, 'ref' | 'columns' | 'filterPredicate'> {
|
|
33
34
|
ref?: Ref<CurdRef<R, F>>;
|
|
34
35
|
/** 默认属性会传递给DataGrid组件,外层包裹元素的属性使用wrapperProps */
|
|
35
36
|
wrapperProps?: DivProps;
|
|
36
|
-
wrapperRef?: Ref<HTMLDivElement>;
|
|
37
37
|
/** 嵌入式样式通常用于Dialog或Card组件内 */
|
|
38
38
|
variant?: 'standard' | 'embeded';
|
|
39
39
|
loadRows?: (pagination?: {
|
|
@@ -57,11 +57,9 @@ export interface CurdBaseProps<R extends RowType, F extends FormValue> extends O
|
|
|
57
57
|
order?: Id[];
|
|
58
58
|
onOrderChange?(order: Id[]): void;
|
|
59
59
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
onFilter?(filterValue: FormValue): void;
|
|
64
|
-
renderFilter?(filterProps: CurdFilterProps<R>): ReactNode;
|
|
60
|
+
filterableProps?: Omit<CurdFilterableProps, 'columns'>;
|
|
61
|
+
renderFilterable?(filterableProps: CurdFilterableProps): ReactNode;
|
|
62
|
+
renderFilterConditions?: CurdFilterableProps['renderFilterConditions'];
|
|
65
63
|
copyable?: boolean;
|
|
66
64
|
creatable?: boolean;
|
|
67
65
|
updatable?: EachRowType<R, boolean>;
|
|
@@ -100,7 +98,7 @@ interface CurdMultipleProps<R extends RowType, F extends FormValue = FormValue,
|
|
|
100
98
|
export type CurdProps<R extends RowType, F extends FormValue = FormValue, V extends Id = Id> = CurdSingleProps<R, F, V> | CurdMultipleProps<R, F, V>;
|
|
101
99
|
export declare const Curd: {
|
|
102
100
|
<R extends RowType, F extends FormValue = FormValue, V extends Id = Id>(props: CurdProps<R, F, V>): ReactElement;
|
|
103
|
-
Filter: typeof
|
|
101
|
+
Filter: typeof CurdFilterable;
|
|
104
102
|
CONTROL_COLUMN: symbol;
|
|
105
103
|
};
|
|
106
104
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { memo, useCallback, useEffect, useMemo, useRef, useImperativeHandle } from 'react';
|
|
3
3
|
import { DataGrid } from '../dataGrid';
|
|
4
|
-
import {
|
|
4
|
+
import { Form } from '../form';
|
|
5
|
+
import { CurdFilterable } from './curdFilterable';
|
|
5
6
|
import { classes, style } from './curd.style';
|
|
6
|
-
import { clsx,
|
|
7
|
+
import { clsx, useControlled, useCurdColumns, useDerivedState, useLoading, useSync, mergeComponentProps } from '../../utils';
|
|
7
8
|
import { Button } from '../button';
|
|
8
9
|
import { Tooltip } from '../tooltip';
|
|
9
10
|
import { CurdColumnConfig } from './curdColumnConfig';
|
|
@@ -20,14 +21,14 @@ import { faPenToSquare } from '@fortawesome/free-regular-svg-icons/faPenToSquare
|
|
|
20
21
|
import { faPlus } from '@fortawesome/free-solid-svg-icons/faPlus';
|
|
21
22
|
import { faRotateRight } from '@fortawesome/free-solid-svg-icons/faRotateRight';
|
|
22
23
|
export const Curd = memo((props) => {
|
|
23
|
-
const { ref, wrapperProps,
|
|
24
|
+
const { ref, wrapperProps, variant = 'standard', loadRows, columns, toolbarLeft, toolbarRight, reloadable = true, onReload, resizable = true, columnConfigurable = true, filterProps, initialFilterValue, onFilter, filterableProps, renderFilterable, renderFilterConditions, copyable, creatable = true, updatable = true, deletable = true, createButtonProps, updateButtonProps, deleteButtonProps, deleteConfirmProps, controlColumnTitle = '操作', renderExtraControl, titleKey, dataName = '', createName = '添加', updateName = '编辑', deleteName = '删除', onCreate, onUpdate, onDelete, rowToForm, dialogProps, formProps, formRef, onChange, ...dataGridProps } = props;
|
|
24
25
|
/**
|
|
25
26
|
* -------------------------------------------------------------
|
|
26
27
|
* ref
|
|
27
28
|
*/
|
|
28
29
|
useImperativeHandle(ref, () => ({
|
|
29
|
-
openCreateDialog(
|
|
30
|
-
return curdDialogRef.current?.open(void 0,
|
|
30
|
+
openCreateDialog(defaultValue) {
|
|
31
|
+
return curdDialogRef.current?.open(void 0, defaultValue);
|
|
31
32
|
},
|
|
32
33
|
selectSingle() {
|
|
33
34
|
return curdDialogRef.current?.selectSingle();
|
|
@@ -41,22 +42,20 @@ export const Curd = memo((props) => {
|
|
|
41
42
|
* 筛选部分
|
|
42
43
|
*/
|
|
43
44
|
const innerFilterRef = useRef(null);
|
|
44
|
-
const
|
|
45
|
-
|
|
45
|
+
const filterHandler = (value) => {
|
|
46
|
+
onFilter?.(value);
|
|
47
|
+
innerLoadRows().then();
|
|
48
|
+
};
|
|
49
|
+
const renderFilterableFn = () => {
|
|
46
50
|
const _filterProps = {
|
|
47
|
-
|
|
48
|
-
...
|
|
49
|
-
|
|
50
|
-
columns,
|
|
51
|
-
onFilter: useCallback((filterValue) => {
|
|
52
|
-
syncOnFilter.current?.(filterValue);
|
|
53
|
-
syncLoadRows.current();
|
|
54
|
-
}, [])
|
|
51
|
+
renderFilterConditions,
|
|
52
|
+
...filterableProps,
|
|
53
|
+
columns
|
|
55
54
|
};
|
|
56
|
-
if (
|
|
57
|
-
return
|
|
55
|
+
if (renderFilterable) {
|
|
56
|
+
return renderFilterable(_filterProps);
|
|
58
57
|
}
|
|
59
|
-
return _jsx(
|
|
58
|
+
return _jsx(CurdFilterable, { ..._filterProps });
|
|
60
59
|
};
|
|
61
60
|
/**
|
|
62
61
|
* -------------------------------------------------------------
|
|
@@ -98,6 +97,7 @@ export const Curd = memo((props) => {
|
|
|
98
97
|
const [innerOrderColumn, setInnerOrderColumn] = useControlled(props.defaultOrderColumn, props.orderColumn);
|
|
99
98
|
const [innerOrderType, setInnerOrderType] = useControlled(props.defaultOrderType || 'descend', props.orderType);
|
|
100
99
|
const orderChangeHandler = (orderColumn, orderType) => {
|
|
100
|
+
dataGridProps?.onOrderChange?.(orderColumn, orderType);
|
|
101
101
|
setInnerOrderColumn(orderColumn);
|
|
102
102
|
setInnerOrderType(orderType);
|
|
103
103
|
};
|
|
@@ -122,13 +122,13 @@ export const Curd = memo((props) => {
|
|
|
122
122
|
page: innerPage.current,
|
|
123
123
|
pageSize: innerPageSize.current,
|
|
124
124
|
}
|
|
125
|
-
: void 0, innerFilterRef.current
|
|
125
|
+
: void 0, innerFilterRef.current.getFormValue(), innerOrderColumn.current
|
|
126
126
|
? {
|
|
127
127
|
field: innerOrderColumn.current,
|
|
128
128
|
type: innerOrderType.current
|
|
129
129
|
}
|
|
130
130
|
: void 0);
|
|
131
|
-
if (res) {
|
|
131
|
+
if (typeof res === 'object' && res !== null) {
|
|
132
132
|
setInnerRows(res.rows);
|
|
133
133
|
setInnerTotal(res.total);
|
|
134
134
|
}
|
|
@@ -141,7 +141,6 @@ export const Curd = memo((props) => {
|
|
|
141
141
|
onReload?.();
|
|
142
142
|
innerLoadRows().then();
|
|
143
143
|
};
|
|
144
|
-
const syncLoadRows = useSync(innerLoadRows);
|
|
145
144
|
/**
|
|
146
145
|
* -------------------------------------------------------------
|
|
147
146
|
* 弹窗与曾删改部分
|
|
@@ -185,19 +184,25 @@ export const Curd = memo((props) => {
|
|
|
185
184
|
innerLoadRows().then();
|
|
186
185
|
message.success(deleteName + '成功').then();
|
|
187
186
|
};
|
|
188
|
-
return (_jsxs("div", { ...wrapperProps,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
187
|
+
return (_jsxs("div", { ...wrapperProps, css: style, className: clsx(classes.root, wrapperProps?.className), "data-variant": variant, children: [_jsxs(Form, { ...mergeComponentProps({
|
|
188
|
+
variant: 'plain',
|
|
189
|
+
initialValue: initialFilterValue
|
|
190
|
+
}, filterProps, {
|
|
191
|
+
ref: innerFilterRef,
|
|
192
|
+
onFinish: filterHandler
|
|
193
|
+
}), children: [renderFilterableFn(), (creatable || toolbarLeft || toolbarRight || reloadable || resizable || columnConfigurable) &&
|
|
194
|
+
_jsxs("div", { className: classes.toolbar, children: [_jsxs("div", { className: classes.toolbarLeft, children: [creatable &&
|
|
195
|
+
_jsxs(Button, { prefix: _jsx(Icon, { icon: faPlus }), ...createButtonProps, onClick: createHandler, children: [createName, dataName] }), toolbarLeft] }), _jsxs("div", { className: classes.toolbarRight, children: [!!toolbarRight &&
|
|
196
|
+
_jsxs(_Fragment, { children: [toolbarRight, _jsx(Divider, { className: classes.divider, orientation: "vertical" })] }), reloadable &&
|
|
197
|
+
_jsx(Tooltip, { title: "\u5237\u65B0", children: _jsx(Button, { shape: "circular", variant: "text", color: "text.secondary", prefix: _jsx(Icon, { icon: faRotateRight }), loading: innerLoading.current, onClick: reloadHandler }) }), resizable &&
|
|
198
|
+
_jsx(CurdResizable, { innerSize: innerSize.current, setInnerSize: setInnerSize }), columnConfigurable &&
|
|
199
|
+
_jsx(CurdColumnConfig, { columns: orderedColumns, innerVisible: innerVisible.current, setInnerVisible: setInnerVisible, setInnerOrder: setInnerOrder })] })] }), _jsx("div", { className: classes.card, children: _jsx(DataGrid, { ...dataGridProps, columns: actualColumns, tableProps: {
|
|
200
|
+
...props.tableProps,
|
|
201
|
+
...resizable && { size: innerSize.current }
|
|
202
|
+
}, loading: innerLoading.current, rows: innerRows.current, paginatable: !loadRows && props.paginatable, renderPagination: loadRows && props.paginatable !== false
|
|
203
|
+
? () => _jsx(Pagination, { ...props.paginationProps, total: innerTotal.current, page: innerPage.current, onPageChange: setInnerPage, pageSize: innerPageSize.current, onPageSizeChange: setInnerPageSize })
|
|
204
|
+
: props.renderPagination, orderColumn: innerOrderColumn.current, orderType: innerOrderType.current, onOrderChange: orderChangeHandler }) })] }), (creatable || updatable) &&
|
|
200
205
|
_jsx(CurdDialog, { ...dialogProps, ref: curdDialogRef, onFinish: finishHandler, curdProps: props })] }));
|
|
201
206
|
});
|
|
202
|
-
Curd.Filter =
|
|
207
|
+
Curd.Filter = CurdFilterable;
|
|
203
208
|
Curd.CONTROL_COLUMN = Symbol('control-column');
|
|
@@ -2,16 +2,17 @@ export declare const classes: {
|
|
|
2
2
|
filter: string;
|
|
3
3
|
divider: string;
|
|
4
4
|
toolbar: string;
|
|
5
|
+
control: string;
|
|
5
6
|
filterGridContainer: string;
|
|
6
7
|
filterGrid: string;
|
|
7
8
|
filterItem: string;
|
|
8
9
|
filterControl: string;
|
|
9
10
|
filtered: string;
|
|
10
11
|
filteredTitle: string;
|
|
12
|
+
filteredContent: string;
|
|
11
13
|
toolbarLeft: string;
|
|
12
14
|
toolbarRight: string;
|
|
13
15
|
card: string;
|
|
14
|
-
control: string;
|
|
15
16
|
dialogTitle: string;
|
|
16
17
|
copyButton: string;
|
|
17
18
|
} & {
|
|
@@ -10,6 +10,7 @@ export const classes = defineInnerClasses('curd', [
|
|
|
10
10
|
'filterControl',
|
|
11
11
|
'filtered',
|
|
12
12
|
'filteredTitle',
|
|
13
|
+
'filteredContent',
|
|
13
14
|
'toolbar',
|
|
14
15
|
'toolbarLeft',
|
|
15
16
|
'toolbarRight',
|
|
@@ -29,27 +30,36 @@ export const style = defineCss(({ spacing, text, background, borderRadius }) =>
|
|
|
29
30
|
|
|
30
31
|
.${classes.filter} {
|
|
31
32
|
display: flex;
|
|
33
|
+
gap: ${spacing[6]}px;
|
|
32
34
|
|
|
33
|
-
.${classes.filterGridContainer}
|
|
34
|
-
.${classes.filterGrid} {
|
|
35
|
+
.${classes.filterGrid}, .${classes.filterGridContainer} {
|
|
35
36
|
flex: 1;
|
|
37
|
+
opacity: 1;
|
|
38
|
+
justify-content: flex-end;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
.${classes.filterControl} {
|
|
39
42
|
align-self: flex-end;
|
|
40
|
-
margin-bottom: ${spacing[
|
|
43
|
+
margin-bottom: ${spacing[6]}px;
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
.${classes.filtered} {
|
|
45
48
|
display: flex;
|
|
46
49
|
align-items: center;
|
|
47
|
-
margin-bottom: ${spacing[
|
|
50
|
+
margin-bottom: ${spacing[6]}px;
|
|
48
51
|
|
|
49
52
|
.${classes.filteredTitle} {
|
|
50
53
|
color: ${text.secondary};
|
|
51
54
|
font-size: ${13 / 14}em;
|
|
52
55
|
}
|
|
56
|
+
|
|
57
|
+
.${classes.filteredContent} {
|
|
58
|
+
flex: 1;
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-wrap: wrap;
|
|
61
|
+
gap: ${spacing[2]}px;
|
|
62
|
+
}
|
|
53
63
|
}
|
|
54
64
|
|
|
55
65
|
.${classes.toolbar} {
|
|
@@ -89,7 +89,8 @@ export const CurdDialog = memo(({ ref, onFinish, curdProps, ...props }) => {
|
|
|
89
89
|
* ----------------------------------------------------------------
|
|
90
90
|
* 结果处理与loading
|
|
91
91
|
*/
|
|
92
|
-
const confirmHandler = async () => {
|
|
92
|
+
const confirmHandler = async (e) => {
|
|
93
|
+
props.onConfirm?.(e);
|
|
93
94
|
await innerFormRef.current.submit();
|
|
94
95
|
};
|
|
95
96
|
const [innerLoading, finishHandler] = useLoading(async (value) => {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { FormRef, FormValue } from '../form';
|
|
3
|
+
import { CurdBaseProps } from './curd';
|
|
4
|
+
import { ButtonProps } from '../button';
|
|
5
|
+
import { DivProps } from '../../types';
|
|
6
|
+
export interface CurdFilterableProps<F extends FormValue = FormValue> extends DivProps {
|
|
7
|
+
columns?: CurdBaseProps<any, F>['columns'];
|
|
8
|
+
/**
|
|
9
|
+
* 筛选项是否可收起与展开。若开启此功能,至少保证第一行每项的高度一致,否则可能出现样式问题
|
|
10
|
+
*/
|
|
11
|
+
expandable?: boolean;
|
|
12
|
+
/** 是否显示"筛选"按钮,默认为`true`
|
|
13
|
+
* @enum true onFilter只会在点击按钮时触发
|
|
14
|
+
* @enum false 每次触发onChange的同时会触发onFilter
|
|
15
|
+
*/
|
|
16
|
+
showButton?: boolean;
|
|
17
|
+
/** 渲染已生效的筛选条件 */
|
|
18
|
+
renderFilterConditions?(filterValue: F, formInstance: FormRef<F>): ReactNode;
|
|
19
|
+
buttonProps?: ButtonProps;
|
|
20
|
+
}
|
|
21
|
+
export declare const CurdFilterable: <F extends FormValue = FormValue>(props: CurdFilterableProps<F>) => ReactElement;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { createElement as _createElement } from "@emotion/react";
|
|
3
3
|
import { isValidElement, memo, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { FormItem, useFormContext, useFormValueContext } from '../form';
|
|
5
5
|
import { classes } from './curd.style';
|
|
6
|
-
import { clsx,
|
|
6
|
+
import { clsx, columnsToFilterItem, isUnset } from '../../utils';
|
|
7
7
|
import { Grid } from '../grid';
|
|
8
8
|
import { Button } from '../button';
|
|
9
9
|
import { Collapse } from '../transitionBase';
|
|
@@ -11,7 +11,7 @@ import { useTheme } from '../theme';
|
|
|
11
11
|
import { Icon } from '../icon';
|
|
12
12
|
import { faChevronDown } from '@fortawesome/free-solid-svg-icons/faChevronDown';
|
|
13
13
|
import { faFilter } from '@fortawesome/free-solid-svg-icons/faFilter';
|
|
14
|
-
export const
|
|
14
|
+
export const CurdFilterable = memo(({ columns, expandable, showButton = true, renderFilterConditions, buttonProps, ...props }) => {
|
|
15
15
|
const { spacing } = useTheme();
|
|
16
16
|
const items = useMemo(() => {
|
|
17
17
|
return columnsToFilterItem(columns);
|
|
@@ -31,29 +31,24 @@ export const CurdFilter = memo(({ ref, columns, expandable, showButton, renderCo
|
|
|
31
31
|
* --------------------------------------------------------------
|
|
32
32
|
* 触发筛选
|
|
33
33
|
*/
|
|
34
|
-
const formRef =
|
|
35
|
-
const
|
|
34
|
+
const { formRef } = useFormContext();
|
|
35
|
+
const filterButtonClick = (e) => {
|
|
36
36
|
buttonProps?.onClick?.(e);
|
|
37
|
-
|
|
38
|
-
onFilter?.(filterValue);
|
|
39
|
-
renderConditions && setFilteredConditions(filterValue);
|
|
37
|
+
formRef.current.submit().then();
|
|
40
38
|
};
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
* --------------------------------------------------------------
|
|
48
|
-
* 已生效的筛选条件
|
|
49
|
-
*/
|
|
50
|
-
const [filteredConditions, setFilteredConditions] = useState({});
|
|
51
|
-
return (_jsxs(_Fragment, { children: [_jsx(Form, { ...props, ref: cloneRef(ref, formRef), className: clsx(classes.filter, props.className), variant: "plain", onChange: changeHandler, children: !!items?.length &&
|
|
52
|
-
_jsxs(_Fragment, { children: [expandable
|
|
53
|
-
? _jsx(Collapse, { className: classes.filterGridContainer, in: expanded, collapsedSize: () => firstItemRef.current?.offsetHeight || 56, appear: false, children: renderedGrid })
|
|
54
|
-
: renderedGrid, (expandable || showButton) &&
|
|
55
|
-
_jsxs("div", { className: classes.filterControl, children: [expandable &&
|
|
39
|
+
const _expandable = expandable && items && items.length > 1;
|
|
40
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { ...props, className: clsx(classes.filter, props.className), children: !!items?.length &&
|
|
41
|
+
_jsxs(_Fragment, { children: [_expandable
|
|
42
|
+
? _jsx(Collapse, { className: classes.filterGridContainer, in: expanded, collapsedSize: () => firstItemRef.current?.offsetHeight || 50, appear: false, children: renderedGrid })
|
|
43
|
+
: renderedGrid, (_expandable || showButton) &&
|
|
44
|
+
_jsxs("div", { className: classes.filterControl, children: [_expandable &&
|
|
56
45
|
_jsx(Button, { variant: "text", suffix: _jsx(Icon, { icon: faChevronDown, style: { rotate: expanded ? '180deg' : void 0 } }), onClick: () => setExpanded(o => !o), children: expanded ? '收起' : '展开' }), showButton &&
|
|
57
|
-
_jsx(Button, { prefix: _jsx(Icon, { icon: faFilter }), variant: "outlined", ...buttonProps, onClick:
|
|
58
|
-
|
|
46
|
+
_jsx(Button, { prefix: _jsx(Icon, { icon: faFilter }), variant: "outlined", ...buttonProps, onClick: filterButtonClick, children: buttonProps?.children ?? '筛选' })] })] }) }), _jsx(FilterConditions, { renderFilterConditions: renderFilterConditions })] }));
|
|
47
|
+
});
|
|
48
|
+
const FilterConditions = memo(({ renderFilterConditions }) => {
|
|
49
|
+
const { formRef } = useFormContext();
|
|
50
|
+
const { formValue } = useFormValueContext();
|
|
51
|
+
const filterConditions = renderFilterConditions?.(formValue, formRef.current);
|
|
52
|
+
return !isUnset(filterConditions) &&
|
|
53
|
+
_jsxs("div", { className: classes.filtered, children: [_jsx("div", { className: classes.filteredTitle, children: "\u5DF2\u7B5B\u9009\uFF1A" }), _jsx("div", { className: classes.filteredContent, children: filterConditions })] });
|
|
59
54
|
});
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
2
2
|
import { ThCell } from '../table';
|
|
3
3
|
import { createContext, useContext, useRef } from 'react';
|
|
4
4
|
import { classes } from './dataGrid.style';
|
|
5
|
-
import { useDraggable } from '../../utils';
|
|
5
|
+
import { cloneRef, useDraggable } from '../../utils';
|
|
6
6
|
const ColumnResizeContextProvider = createContext({
|
|
7
7
|
columnResizable: false,
|
|
8
8
|
columnRefs: { current: [] },
|
|
@@ -57,10 +57,10 @@ function ResizableColumn(props) {
|
|
|
57
57
|
if (!columnResizable) {
|
|
58
58
|
return _jsx(ThCell, { ...props });
|
|
59
59
|
}
|
|
60
|
-
return (_jsxs(ThCell, { ...props, ref: r => {
|
|
60
|
+
return (_jsxs(ThCell, { ...props, ref: cloneRef(r => {
|
|
61
61
|
if (r) {
|
|
62
62
|
columnRefs.current.push(r);
|
|
63
63
|
cellRef.current = r;
|
|
64
64
|
}
|
|
65
|
-
}, children: [props.children, _jsx("div", { className: classes.resizeHandle, ...draggableHandles })] }));
|
|
65
|
+
}, props.ref), children: [props.children, _jsx("div", { className: classes.resizeHandle, ...draggableHandles })] }));
|
|
66
66
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, { ComponentProps, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { DivProps, Id, Obj, ToRequired } from '../../types';
|
|
3
3
|
import { SelectionContextProps } from '../selectionContext';
|
|
4
4
|
import { PaginationProps } from '../pagination';
|
|
@@ -6,9 +6,10 @@ import { TableProps } from '../table';
|
|
|
6
6
|
import { CheckboxProps } from '../checkbox';
|
|
7
7
|
import { RadioProps } from '../radio';
|
|
8
8
|
import { FieldPath } from '../../utils';
|
|
9
|
+
import { FormProps, FormValue } from '../form';
|
|
10
|
+
import { FilterControlProps, FilterOptionsProps } from './filterBubbleContent';
|
|
9
11
|
export type RowType = Obj;
|
|
10
|
-
export
|
|
11
|
-
export interface ColumnType<R extends RowType = RowType> extends Omit<JSX.IntrinsicElements['td'], 'key' | 'ref' | 'title' | 'children'>, Omit<JSX.IntrinsicElements['th'], 'key' | 'ref' | 'title' | 'children'> {
|
|
12
|
+
export interface ColumnType<R extends RowType = RowType> extends Omit<ComponentProps<'td'>, 'key' | 'ref' | 'title' | 'children'>, Omit<ComponentProps<'th'>, 'key' | 'ref' | 'title' | 'children'> {
|
|
12
13
|
title?: ReactNode;
|
|
13
14
|
/** 若不指定key,默认使用{@link field}作为key */
|
|
14
15
|
key?: string | number;
|
|
@@ -18,15 +19,24 @@ export interface ColumnType<R extends RowType = RowType> extends Omit<JSX.Intrin
|
|
|
18
19
|
/** 指定children后,下列属性均不生效 */
|
|
19
20
|
field?: FieldPath;
|
|
20
21
|
render?(row: R, index?: number, rows?: R[]): ReactNode;
|
|
21
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* @enum true 使用服务端排序,组件只做样式处理,不做数据排序处理;
|
|
24
|
+
* @enum function 本地排序需指定 `正序` 的排序方法,倒序会自动处理
|
|
25
|
+
*/
|
|
22
26
|
sorter?: boolean | ((a: R, b: R) => number);
|
|
27
|
+
/**
|
|
28
|
+
* @enum true 不会弹出气泡框,需配合{@link DataGridBaseProps.onFilterClick}实现筛选逻辑
|
|
29
|
+
* @enum FilterOptionsProps 传递至`OptionsBase`组件
|
|
30
|
+
* @enum FilterControlProps 自定义渲染气泡内容
|
|
31
|
+
*/
|
|
32
|
+
filter?: boolean | FilterOptionsProps | FilterControlProps;
|
|
23
33
|
/** @private 内部使用,在{@link useDataGridColumns}内赋值 */
|
|
24
|
-
_key?:
|
|
34
|
+
_key?: Id;
|
|
25
35
|
/** @private 内部使用,在{@link DataGridHead}内计算 */
|
|
26
36
|
_negativeRowSpan?: number;
|
|
27
37
|
}
|
|
28
|
-
type DataGridSharedProps<R extends RowType> = {
|
|
29
|
-
rowProps?(row: R, index: number, rows: R[]):
|
|
38
|
+
type DataGridSharedProps<R extends RowType = RowType> = {
|
|
39
|
+
rowProps?(row: R, index: number, rows: R[]): ComponentProps<'tr'>;
|
|
30
40
|
/** 数据的主键名,默认为`id` */
|
|
31
41
|
primaryKey?: keyof R;
|
|
32
42
|
/**
|
|
@@ -41,9 +51,16 @@ type DataGridSharedProps<R extends RowType> = {
|
|
|
41
51
|
indent?: number;
|
|
42
52
|
renderExpandIcon?(key: Id, isExpand: boolean, expanded: Id[]): ReactNode;
|
|
43
53
|
};
|
|
44
|
-
export
|
|
54
|
+
export type OrderType = 'ascend' | 'descend';
|
|
55
|
+
export interface DataGridBaseProps<R extends RowType = RowType> extends DataGridSharedProps<R>, Omit<DivProps, 'defaultValue' | 'onChange'> {
|
|
45
56
|
columns?: (ColumnType<R> | symbol)[];
|
|
46
57
|
rows?: R[];
|
|
58
|
+
filterProps?: FormProps;
|
|
59
|
+
initialFilterValue?: FormValue;
|
|
60
|
+
onFilter?(filterValue: FormValue): void;
|
|
61
|
+
onFilterClick?(column: Id, e: React.MouseEvent<HTMLButtonElement>): void;
|
|
62
|
+
/** 若需要本地筛选,必须指定该方法 */
|
|
63
|
+
filterPredicate?(row: R, index: number, filterValue: FormValue): any;
|
|
47
64
|
defaultOrderColumn?: Id;
|
|
48
65
|
orderColumn?: Id;
|
|
49
66
|
defaultOrderType?: OrderType;
|
|
@@ -78,20 +95,20 @@ export interface DataGridBaseProps<R extends RowType> extends DataGridSharedProp
|
|
|
78
95
|
striped?: TableProps['striped'];
|
|
79
96
|
tableProps?: TableProps;
|
|
80
97
|
}
|
|
81
|
-
export interface DataGridSingleProps<R extends RowType, V extends Id = Id> extends DataGridBaseProps<R> {
|
|
98
|
+
export interface DataGridSingleProps<R extends RowType = RowType, V extends Id = Id> extends DataGridBaseProps<R> {
|
|
82
99
|
multiple?: false;
|
|
83
100
|
defaultValue?: V;
|
|
84
101
|
value?: V;
|
|
85
102
|
onChange?(value: V): void;
|
|
86
103
|
}
|
|
87
|
-
export interface DataGridMultipleProps<R extends RowType, V extends Id = Id> extends DataGridBaseProps<R> {
|
|
104
|
+
export interface DataGridMultipleProps<R extends RowType = RowType, V extends Id = Id> extends DataGridBaseProps<R> {
|
|
88
105
|
multiple: true;
|
|
89
106
|
defaultValue?: V[];
|
|
90
107
|
value?: V[];
|
|
91
108
|
onChange?(value: V[]): void;
|
|
92
109
|
}
|
|
93
|
-
export type DataGridProps<R extends RowType, V extends Id = Id> = DataGridSingleProps<R, V> | DataGridMultipleProps<R, V>;
|
|
94
|
-
interface IDataGridContext<R extends RowType> extends ToRequired<DataGridSharedProps<R>, 'primaryKey' | 'childrenKey' | 'clickRowToSelect' | 'indent'> {
|
|
110
|
+
export type DataGridProps<R extends RowType = RowType, V extends Id = Id> = DataGridSingleProps<R, V> | DataGridMultipleProps<R, V>;
|
|
111
|
+
interface IDataGridContext<R extends RowType = RowType> extends ToRequired<DataGridSharedProps<R>, 'primaryKey' | 'childrenKey' | 'clickRowToSelect' | 'indent'> {
|
|
95
112
|
expandedSet: Set<Id>;
|
|
96
113
|
flattedColumns: (symbol | ColumnType<R>)[] | undefined;
|
|
97
114
|
toggleExpanded(key: Id): void;
|