@pisell/materials 1.0.48 → 1.0.49
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +2 -2
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +2 -2
- package/es/components/DragSortList/index.d.ts +32 -0
- package/es/components/DragSortList/index.js +85 -0
- package/es/components/MultipleContainersSortList/index.d.ts +25 -0
- package/es/components/MultipleContainersSortList/index.js +164 -0
- package/es/components/MultipleContainersSortList/index.less +6 -0
- package/es/components/Pagination/index.d.ts +14 -0
- package/es/components/Pagination/index.js +185 -0
- package/es/components/Pagination/index.less +215 -0
- package/es/components/auto-complete/index.d.ts +7 -0
- package/es/components/auto-complete/index.js +4 -0
- package/es/components/button/index.d.ts +8 -0
- package/es/components/button/index.js +15 -0
- package/es/components/calendar/index.d.ts +3 -0
- package/es/components/calendar/index.js +4 -0
- package/es/components/cascader/index.d.ts +2 -0
- package/es/components/cascader/index.js +6 -0
- package/es/components/checkbox/index.d.ts +3 -0
- package/es/components/checkbox/index.js +5 -0
- package/es/components/config-provider/index.d.ts +8 -0
- package/es/components/config-provider/index.js +29 -0
- package/es/components/date-picker/index.d.ts +3 -0
- package/es/components/date-picker/index.js +22 -0
- package/es/components/div/index.d.ts +7 -0
- package/es/components/div/index.js +10 -0
- package/es/components/drawer/index.d.ts +2 -0
- package/es/components/drawer/index.js +13 -0
- package/es/components/dropdown/index.d.ts +3 -0
- package/es/components/dropdown/index.js +13 -0
- package/es/components/filter/components/Dropdown/index.d.ts +16 -0
- package/es/components/filter/components/Dropdown/index.js +103 -0
- package/es/components/filter/components/Dropdown/index.less +76 -0
- package/es/components/filter/components/FilterButton/index.d.ts +9 -0
- package/es/components/filter/components/FilterButton/index.js +30 -0
- package/es/components/filter/components/FilterButton/index.less +0 -0
- package/es/components/filter/components/FilterItem/index.d.ts +11 -0
- package/es/components/filter/components/FilterItem/index.js +19 -0
- package/es/components/filter/components/FilterItem/index.less +0 -0
- package/es/components/filter/components/QuickFilter/index.d.ts +7 -0
- package/es/components/filter/components/QuickFilter/index.js +20 -0
- package/es/components/filter/components/items/index.d.ts +42 -0
- package/es/components/filter/components/items/index.js +13 -0
- package/es/components/filter/components/items/text/Editor/index.d.ts +3 -0
- package/es/components/filter/components/items/text/Editor/index.js +10 -0
- package/es/components/filter/components/items/text/Editor/index.less +0 -0
- package/es/components/filter/components/items/text/Preview/index.d.ts +3 -0
- package/es/components/filter/components/items/text/Preview/index.js +17 -0
- package/es/components/filter/components/items/text/Preview/index.less +0 -0
- package/es/components/filter/components/items/text/index.d.ts +12 -0
- package/es/components/filter/components/items/text/index.js +13 -0
- package/es/components/filter/components/items/text/index.less +0 -0
- package/es/components/filter/index.d.ts +12 -0
- package/es/components/filter/index.js +42 -0
- package/es/components/form/index.d.ts +8 -0
- package/es/components/form/index.js +132 -0
- package/es/components/icon/index.d.ts +12 -0
- package/es/components/icon/index.js +40 -0
- package/es/components/iconfont/index.d.ts +6 -0
- package/es/components/iconfont/index.js +13 -0
- package/es/components/iconfont/index.less +0 -0
- package/es/components/input/index.d.ts +11 -0
- package/es/components/input/index.js +12 -0
- package/es/components/modal/index.d.ts +2 -0
- package/es/components/modal/index.js +18 -0
- package/es/components/page/index.d.ts +6 -0
- package/es/components/page/index.js +172 -0
- package/es/components/radio/index.d.ts +3 -0
- package/es/components/radio/index.js +5 -0
- package/es/components/select/index.d.ts +7 -0
- package/es/components/select/index.js +4 -0
- package/es/components/skeleton/index.d.ts +3 -0
- package/es/components/skeleton/index.js +4 -0
- package/es/components/slider/index.d.ts +3 -0
- package/es/components/slider/index.js +16 -0
- package/es/components/table/Actions/Sort/index.d.ts +12 -0
- package/es/components/table/Actions/Sort/index.js +59 -0
- package/es/components/table/Actions/Sort/index.less +0 -0
- package/es/components/table/Actions/index.d.ts +4 -0
- package/es/components/table/Actions/index.js +28 -0
- package/es/components/table/Actions/index.less +40 -0
- package/es/components/table/BasicTable/index.d.ts +4 -0
- package/es/components/table/BasicTable/index.js +58 -0
- package/es/components/table/Header/Buttons/index.d.ts +3 -0
- package/es/components/table/Header/Buttons/index.js +10 -0
- package/es/components/table/Header/Buttons/index.less +0 -0
- package/es/components/table/Header/index.d.ts +4 -0
- package/es/components/table/Header/index.js +20 -0
- package/es/components/table/Header/index.less +16 -0
- package/es/components/table/Summary/index.d.ts +4 -0
- package/es/components/table/Summary/index.js +12 -0
- package/es/components/table/Summary/index.less +5 -0
- package/es/components/table/Table/AddFieldModal/index.d.ts +3 -0
- package/es/components/table/Table/AddFieldModal/index.js +140 -0
- package/es/components/table/Table/AddFieldModal/index.less +84 -0
- package/es/components/table/Table/SelectField/index.d.ts +3 -0
- package/es/components/table/Table/SelectField/index.js +89 -0
- package/es/components/table/Table/SelectField/index.less +97 -0
- package/es/components/table/Table/fields/date/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/date/Config/index.js +4 -0
- package/es/components/table/Table/fields/date/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/date/Edit/index.js +47 -0
- package/es/components/table/Table/fields/date/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/date/Show/index.js +18 -0
- package/es/components/table/Table/fields/date/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/date/Sort/index.js +4 -0
- package/es/components/table/Table/fields/date/index.d.ts +14 -0
- package/es/components/table/Table/fields/date/index.js +17 -0
- package/es/components/table/Table/fields/image/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/image/Config/index.js +4 -0
- package/es/components/table/Table/fields/image/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/image/Edit/index.js +23 -0
- package/es/components/table/Table/fields/image/Edit/index.less +0 -0
- package/es/components/table/Table/fields/image/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/image/Show/index.js +19 -0
- package/es/components/table/Table/fields/image/Show/index.less +0 -0
- package/es/components/table/Table/fields/image/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/image/Sort/index.js +4 -0
- package/es/components/table/Table/fields/image/index.d.ts +14 -0
- package/es/components/table/Table/fields/image/index.js +17 -0
- package/es/components/table/Table/fields/image/index.less +0 -0
- package/es/components/table/Table/fields/index.d.ts +251 -0
- package/es/components/table/Table/fields/index.js +34 -0
- package/es/components/table/Table/fields/link/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/link/Config/index.js +4 -0
- package/es/components/table/Table/fields/link/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/link/Edit/index.js +59 -0
- package/es/components/table/Table/fields/link/Edit/index.less +0 -0
- package/es/components/table/Table/fields/link/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/link/Show/index.js +32 -0
- package/es/components/table/Table/fields/link/Show/index.less +0 -0
- package/es/components/table/Table/fields/link/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/link/Sort/index.js +4 -0
- package/es/components/table/Table/fields/link/index.d.ts +14 -0
- package/es/components/table/Table/fields/link/index.js +17 -0
- package/es/components/table/Table/fields/link/index.less +0 -0
- package/es/components/table/Table/fields/number/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/number/Config/index.js +4 -0
- package/es/components/table/Table/fields/number/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/number/Edit/index.js +24 -0
- package/es/components/table/Table/fields/number/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/number/Show/index.js +16 -0
- package/es/components/table/Table/fields/number/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/number/Sort/index.js +4 -0
- package/es/components/table/Table/fields/number/index.d.ts +14 -0
- package/es/components/table/Table/fields/number/index.js +17 -0
- package/es/components/table/Table/fields/rangePicker/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/rangePicker/Config/index.js +4 -0
- package/es/components/table/Table/fields/rangePicker/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/rangePicker/Edit/index.js +105 -0
- package/es/components/table/Table/fields/rangePicker/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/rangePicker/Show/index.js +16 -0
- package/es/components/table/Table/fields/rangePicker/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/rangePicker/Sort/index.js +4 -0
- package/es/components/table/Table/fields/rangePicker/index.d.ts +14 -0
- package/es/components/table/Table/fields/rangePicker/index.js +17 -0
- package/es/components/table/Table/fields/search/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/search/Config/index.js +4 -0
- package/es/components/table/Table/fields/search/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/search/Edit/index.js +28 -0
- package/es/components/table/Table/fields/search/Edit/index.less +0 -0
- package/es/components/table/Table/fields/search/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/search/Show/index.js +16 -0
- package/es/components/table/Table/fields/search/Show/index.less +0 -0
- package/es/components/table/Table/fields/search/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/search/Sort/index.js +4 -0
- package/es/components/table/Table/fields/search/index.d.ts +14 -0
- package/es/components/table/Table/fields/search/index.js +17 -0
- package/es/components/table/Table/fields/search/index.less +0 -0
- package/es/components/table/Table/fields/select/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/select/Config/index.js +4 -0
- package/es/components/table/Table/fields/select/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/select/Edit/index.js +23 -0
- package/es/components/table/Table/fields/select/Edit/index.less +0 -0
- package/es/components/table/Table/fields/select/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/select/Show/index.js +27 -0
- package/es/components/table/Table/fields/select/Show/index.less +0 -0
- package/es/components/table/Table/fields/select/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/select/Sort/index.js +4 -0
- package/es/components/table/Table/fields/select/index.d.ts +14 -0
- package/es/components/table/Table/fields/select/index.js +17 -0
- package/es/components/table/Table/fields/select/index.less +0 -0
- package/es/components/table/Table/fields/text/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/text/Config/index.js +4 -0
- package/es/components/table/Table/fields/text/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/text/Edit/index.js +23 -0
- package/es/components/table/Table/fields/text/Edit/index.less +0 -0
- package/es/components/table/Table/fields/text/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/text/Show/index.js +16 -0
- package/es/components/table/Table/fields/text/Show/index.less +0 -0
- package/es/components/table/Table/fields/text/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/text/Sort/index.js +4 -0
- package/es/components/table/Table/fields/text/index.d.ts +14 -0
- package/es/components/table/Table/fields/text/index.js +17 -0
- package/es/components/table/Table/fields/text/index.less +0 -0
- package/es/components/table/Table/fields/types/index.d.ts +27 -0
- package/es/components/table/Table/fields/types/index.js +1 -0
- package/es/components/table/Table/index.d.ts +4 -0
- package/es/components/table/Table/index.js +126 -0
- package/es/components/table/Table/index.less +15 -0
- package/es/components/table/Table/tableConfig/SortRow/index.d.ts +4 -0
- package/es/components/table/Table/tableConfig/SortRow/index.js +39 -0
- package/es/components/table/Table/tableConfig/SortRow/index.less +0 -0
- package/es/components/table/Table/tableConfig/body/CellContent/index.d.ts +4 -0
- package/es/components/table/Table/tableConfig/body/CellContent/index.js +14 -0
- package/es/components/table/Table/tableConfig/body/CellContent/index.less +16 -0
- package/es/components/table/Table/tableConfig/body/CellProvider/index.d.ts +4 -0
- package/es/components/table/Table/tableConfig/body/CellProvider/index.js +143 -0
- package/es/components/table/Table/tableConfig/body/CellProvider/index.less +15 -0
- package/es/components/table/Table/tableConfig/body/index.d.ts +30 -0
- package/es/components/table/Table/tableConfig/body/index.js +48 -0
- package/es/components/table/Table/tableConfig/body/index.less +10 -0
- package/es/components/table/Table/tableConfig/header/CellProvider/index.d.ts +14 -0
- package/es/components/table/Table/tableConfig/header/CellProvider/index.js +21 -0
- package/es/components/table/Table/tableConfig/header/CellProvider/index.less +36 -0
- package/es/components/table/Table/tableConfig/header/index.d.ts +18 -0
- package/es/components/table/Table/tableConfig/header/index.js +53 -0
- package/es/components/table/Table/tableConfig/header/index.less +0 -0
- package/es/components/table/Table/tableConfig/summary/index.d.ts +3 -0
- package/es/components/table/Table/tableConfig/summary/index.js +18 -0
- package/es/components/table/Table/tableConfig/summary/index.less +0 -0
- package/es/components/table/index.d.ts +17 -0
- package/es/components/table/index.js +106 -0
- package/es/components/table/index.less +7 -0
- package/es/components/table/model.d.ts +19 -0
- package/es/components/table/model.js +115 -0
- package/es/components/tabs/index.d.ts +11 -0
- package/es/components/tabs/index.js +93 -0
- package/es/components/time-picker/index.d.ts +3 -0
- package/es/components/time-picker/index.js +4 -0
- package/es/components/tree-select/index.d.ts +2 -0
- package/es/components/tree-select/index.js +6 -0
- package/es/components/upload/index.d.ts +3 -0
- package/es/components/upload/index.js +4 -0
- package/es/hooks/index.d.ts +3 -0
- package/es/hooks/index.js +3 -0
- package/es/hooks/useResponsive.d.ts +4 -0
- package/es/hooks/useResponsive.js +95 -0
- package/es/hooks/useSharedState.d.ts +11 -0
- package/es/hooks/useSharedState.js +18 -0
- package/es/index.d.ts +65 -0
- package/es/index.js +90 -0
- package/es/utils/hoc.d.ts +17 -0
- package/es/utils/hoc.js +82 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/es/utils/miniRedux.d.ts +17 -0
- package/es/utils/miniRedux.js +69 -0
- package/es/utils/warning.d.ts +1 -0
- package/es/utils/warning.js +6 -0
- package/lib/components/DragSortList/index.d.ts +32 -0
- package/lib/components/DragSortList/index.js +119 -0
- package/lib/components/MultipleContainersSortList/index.d.ts +25 -0
- package/lib/components/MultipleContainersSortList/index.js +192 -0
- package/lib/components/MultipleContainersSortList/index.less +6 -0
- package/lib/components/Pagination/index.d.ts +14 -0
- package/lib/components/Pagination/index.js +158 -0
- package/lib/components/Pagination/index.less +215 -0
- package/lib/components/auto-complete/index.d.ts +7 -0
- package/lib/components/auto-complete/index.js +28 -0
- package/lib/components/button/index.d.ts +8 -0
- package/lib/components/button/index.js +47 -0
- package/lib/components/calendar/index.d.ts +3 -0
- package/lib/components/calendar/index.js +32 -0
- package/lib/components/cascader/index.d.ts +2 -0
- package/lib/components/cascader/index.js +28 -0
- package/lib/components/checkbox/index.d.ts +3 -0
- package/lib/components/checkbox/index.js +29 -0
- package/lib/components/config-provider/index.d.ts +8 -0
- package/lib/components/config-provider/index.js +54 -0
- package/lib/components/date-picker/index.d.ts +3 -0
- package/lib/components/date-picker/index.js +50 -0
- package/lib/components/div/index.d.ts +7 -0
- package/lib/components/div/index.js +40 -0
- package/lib/components/drawer/index.d.ts +2 -0
- package/lib/components/drawer/index.js +45 -0
- package/lib/components/dropdown/index.d.ts +3 -0
- package/lib/components/dropdown/index.js +45 -0
- package/lib/components/filter/components/Dropdown/index.d.ts +16 -0
- package/lib/components/filter/components/Dropdown/index.js +123 -0
- package/lib/components/filter/components/Dropdown/index.less +76 -0
- package/lib/components/filter/components/FilterButton/index.d.ts +9 -0
- package/lib/components/filter/components/FilterButton/index.js +65 -0
- package/lib/components/filter/components/FilterButton/index.less +0 -0
- package/lib/components/filter/components/FilterItem/index.d.ts +11 -0
- package/lib/components/filter/components/FilterItem/index.js +47 -0
- package/lib/components/filter/components/FilterItem/index.less +0 -0
- package/lib/components/filter/components/QuickFilter/index.d.ts +7 -0
- package/lib/components/filter/components/QuickFilter/index.js +53 -0
- package/lib/components/filter/components/items/index.d.ts +42 -0
- package/lib/components/filter/components/items/index.js +56 -0
- package/lib/components/filter/components/items/text/Editor/index.d.ts +3 -0
- package/lib/components/filter/components/items/text/Editor/index.js +29 -0
- package/lib/components/filter/components/items/text/Editor/index.less +0 -0
- package/lib/components/filter/components/items/text/Preview/index.d.ts +3 -0
- package/lib/components/filter/components/items/text/Preview/index.js +38 -0
- package/lib/components/filter/components/items/text/Preview/index.less +0 -0
- package/lib/components/filter/components/items/text/index.d.ts +12 -0
- package/lib/components/filter/components/items/text/index.js +47 -0
- package/lib/components/filter/components/items/text/index.less +0 -0
- package/lib/components/filter/index.d.ts +12 -0
- package/lib/components/filter/index.js +54 -0
- package/lib/components/form/index.d.ts +8 -0
- package/lib/components/form/index.js +114 -0
- package/lib/components/icon/index.d.ts +12 -0
- package/lib/components/icon/index.js +52 -0
- package/lib/components/iconfont/index.d.ts +6 -0
- package/lib/components/iconfont/index.js +44 -0
- package/lib/components/iconfont/index.less +0 -0
- package/lib/components/input/index.d.ts +11 -0
- package/lib/components/input/index.js +38 -0
- package/lib/components/modal/index.d.ts +2 -0
- package/lib/components/modal/index.js +50 -0
- package/lib/components/page/index.d.ts +6 -0
- package/lib/components/page/index.js +197 -0
- package/lib/components/radio/index.d.ts +3 -0
- package/lib/components/radio/index.js +29 -0
- package/lib/components/select/index.d.ts +7 -0
- package/lib/components/select/index.js +28 -0
- package/lib/components/skeleton/index.d.ts +3 -0
- package/lib/components/skeleton/index.js +28 -0
- package/lib/components/slider/index.d.ts +3 -0
- package/lib/components/slider/index.js +47 -0
- package/lib/components/table/Actions/Sort/index.d.ts +12 -0
- package/lib/components/table/Actions/Sort/index.js +86 -0
- package/lib/components/table/Actions/Sort/index.less +0 -0
- package/lib/components/table/Actions/index.d.ts +4 -0
- package/lib/components/table/Actions/index.js +46 -0
- package/lib/components/table/Actions/index.less +40 -0
- package/lib/components/table/BasicTable/index.d.ts +4 -0
- package/lib/components/table/BasicTable/index.js +83 -0
- package/lib/components/table/Header/Buttons/index.d.ts +3 -0
- package/lib/components/table/Header/Buttons/index.js +43 -0
- package/lib/components/table/Header/Buttons/index.less +0 -0
- package/lib/components/table/Header/index.d.ts +4 -0
- package/lib/components/table/Header/index.js +44 -0
- package/lib/components/table/Header/index.less +16 -0
- package/lib/components/table/Summary/index.d.ts +4 -0
- package/lib/components/table/Summary/index.js +43 -0
- package/lib/components/table/Summary/index.less +5 -0
- package/lib/components/table/Table/AddFieldModal/index.d.ts +3 -0
- package/lib/components/table/Table/AddFieldModal/index.js +159 -0
- package/lib/components/table/Table/AddFieldModal/index.less +84 -0
- package/lib/components/table/Table/SelectField/index.d.ts +3 -0
- package/lib/components/table/Table/SelectField/index.js +124 -0
- package/lib/components/table/Table/SelectField/index.less +97 -0
- package/lib/components/table/Table/fields/date/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/date/Config/index.js +28 -0
- package/lib/components/table/Table/fields/date/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/date/Edit/index.js +68 -0
- package/lib/components/table/Table/fields/date/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/date/Show/index.js +49 -0
- package/lib/components/table/Table/fields/date/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/date/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/date/index.d.ts +14 -0
- package/lib/components/table/Table/fields/date/index.js +51 -0
- package/lib/components/table/Table/fields/image/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/image/Config/index.js +28 -0
- package/lib/components/table/Table/fields/image/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/image/Edit/index.js +53 -0
- package/lib/components/table/Table/fields/image/Edit/index.less +0 -0
- package/lib/components/table/Table/fields/image/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/image/Show/index.js +37 -0
- package/lib/components/table/Table/fields/image/Show/index.less +0 -0
- package/lib/components/table/Table/fields/image/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/image/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/image/index.d.ts +14 -0
- package/lib/components/table/Table/fields/image/index.js +51 -0
- package/lib/components/table/Table/fields/image/index.less +0 -0
- package/lib/components/table/Table/fields/index.d.ts +251 -0
- package/lib/components/table/Table/fields/index.js +77 -0
- package/lib/components/table/Table/fields/link/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/link/Config/index.js +28 -0
- package/lib/components/table/Table/fields/link/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/link/Edit/index.js +78 -0
- package/lib/components/table/Table/fields/link/Edit/index.less +0 -0
- package/lib/components/table/Table/fields/link/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/link/Show/index.js +57 -0
- package/lib/components/table/Table/fields/link/Show/index.less +0 -0
- package/lib/components/table/Table/fields/link/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/link/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/link/index.d.ts +14 -0
- package/lib/components/table/Table/fields/link/index.js +51 -0
- package/lib/components/table/Table/fields/link/index.less +0 -0
- package/lib/components/table/Table/fields/number/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/number/Config/index.js +28 -0
- package/lib/components/table/Table/fields/number/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/number/Edit/index.js +44 -0
- package/lib/components/table/Table/fields/number/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/number/Show/index.js +37 -0
- package/lib/components/table/Table/fields/number/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/number/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/number/index.d.ts +14 -0
- package/lib/components/table/Table/fields/number/index.js +51 -0
- package/lib/components/table/Table/fields/rangePicker/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/rangePicker/Config/index.js +28 -0
- package/lib/components/table/Table/fields/rangePicker/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/rangePicker/Edit/index.js +130 -0
- package/lib/components/table/Table/fields/rangePicker/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/rangePicker/Show/index.js +37 -0
- package/lib/components/table/Table/fields/rangePicker/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/rangePicker/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/rangePicker/index.d.ts +14 -0
- package/lib/components/table/Table/fields/rangePicker/index.js +51 -0
- package/lib/components/table/Table/fields/search/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/search/Config/index.js +28 -0
- package/lib/components/table/Table/fields/search/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/search/Edit/index.js +51 -0
- package/lib/components/table/Table/fields/search/Edit/index.less +0 -0
- package/lib/components/table/Table/fields/search/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/search/Show/index.js +37 -0
- package/lib/components/table/Table/fields/search/Show/index.less +0 -0
- package/lib/components/table/Table/fields/search/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/search/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/search/index.d.ts +14 -0
- package/lib/components/table/Table/fields/search/index.js +51 -0
- package/lib/components/table/Table/fields/search/index.less +0 -0
- package/lib/components/table/Table/fields/select/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/select/Config/index.js +28 -0
- package/lib/components/table/Table/fields/select/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/select/Edit/index.js +53 -0
- package/lib/components/table/Table/fields/select/Edit/index.less +0 -0
- package/lib/components/table/Table/fields/select/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/select/Show/index.js +46 -0
- package/lib/components/table/Table/fields/select/Show/index.less +0 -0
- package/lib/components/table/Table/fields/select/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/select/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/select/index.d.ts +14 -0
- package/lib/components/table/Table/fields/select/index.js +51 -0
- package/lib/components/table/Table/fields/select/index.less +0 -0
- package/lib/components/table/Table/fields/text/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/text/Config/index.js +28 -0
- package/lib/components/table/Table/fields/text/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/text/Edit/index.js +53 -0
- package/lib/components/table/Table/fields/text/Edit/index.less +0 -0
- package/lib/components/table/Table/fields/text/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/text/Show/index.js +37 -0
- package/lib/components/table/Table/fields/text/Show/index.less +0 -0
- package/lib/components/table/Table/fields/text/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/text/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/text/index.d.ts +14 -0
- package/lib/components/table/Table/fields/text/index.js +51 -0
- package/lib/components/table/Table/fields/text/index.less +0 -0
- package/lib/components/table/Table/fields/types/index.d.ts +27 -0
- package/lib/components/table/Table/fields/types/index.js +17 -0
- package/lib/components/table/Table/index.d.ts +4 -0
- package/lib/components/table/Table/index.js +143 -0
- package/lib/components/table/Table/index.less +15 -0
- package/lib/components/table/Table/tableConfig/SortRow/index.d.ts +4 -0
- package/lib/components/table/Table/tableConfig/SortRow/index.js +58 -0
- package/lib/components/table/Table/tableConfig/SortRow/index.less +0 -0
- package/lib/components/table/Table/tableConfig/body/CellContent/index.d.ts +4 -0
- package/lib/components/table/Table/tableConfig/body/CellContent/index.js +49 -0
- package/lib/components/table/Table/tableConfig/body/CellContent/index.less +16 -0
- package/lib/components/table/Table/tableConfig/body/CellProvider/index.d.ts +4 -0
- package/lib/components/table/Table/tableConfig/body/CellProvider/index.js +146 -0
- package/lib/components/table/Table/tableConfig/body/CellProvider/index.less +15 -0
- package/lib/components/table/Table/tableConfig/body/index.d.ts +30 -0
- package/lib/components/table/Table/tableConfig/body/index.js +80 -0
- package/lib/components/table/Table/tableConfig/body/index.less +10 -0
- package/lib/components/table/Table/tableConfig/header/CellProvider/index.d.ts +14 -0
- package/lib/components/table/Table/tableConfig/header/CellProvider/index.js +47 -0
- package/lib/components/table/Table/tableConfig/header/CellProvider/index.less +36 -0
- package/lib/components/table/Table/tableConfig/header/index.d.ts +18 -0
- package/lib/components/table/Table/tableConfig/header/index.js +106 -0
- package/lib/components/table/Table/tableConfig/header/index.less +0 -0
- package/lib/components/table/Table/tableConfig/summary/index.d.ts +3 -0
- package/lib/components/table/Table/tableConfig/summary/index.js +47 -0
- package/lib/components/table/Table/tableConfig/summary/index.less +0 -0
- package/lib/components/table/index.d.ts +17 -0
- package/lib/components/table/index.js +117 -0
- package/lib/components/table/index.less +7 -0
- package/lib/components/table/model.d.ts +19 -0
- package/lib/components/table/model.js +148 -0
- package/lib/components/tabs/index.d.ts +11 -0
- package/lib/components/tabs/index.js +92 -0
- package/lib/components/time-picker/index.d.ts +3 -0
- package/lib/components/time-picker/index.js +31 -0
- package/lib/components/tree-select/index.d.ts +2 -0
- package/lib/components/tree-select/index.js +40 -0
- package/lib/components/upload/index.d.ts +3 -0
- package/lib/components/upload/index.js +28 -0
- package/lib/hooks/index.d.ts +3 -0
- package/lib/hooks/index.js +42 -0
- package/lib/hooks/useResponsive.d.ts +4 -0
- package/lib/hooks/useResponsive.js +104 -0
- package/lib/hooks/useSharedState.d.ts +11 -0
- package/lib/hooks/useSharedState.js +33 -0
- package/lib/index.d.ts +65 -0
- package/lib/index.js +231 -0
- package/lib/utils/hoc.d.ts +17 -0
- package/lib/utils/hoc.js +102 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +29 -0
- package/lib/utils/miniRedux.d.ts +17 -0
- package/lib/utils/miniRedux.js +86 -0
- package/lib/utils/warning.d.ts +1 -0
- package/lib/utils/warning.js +31 -0
- package/package.json +2 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["index"],
|
|
3
|
+
_excluded2 = ["onResize", "width", "field_type", "lock", "editable", "dataIndex"];
|
|
4
|
+
var _templateObject;
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
13
|
+
//@ts-ignore
|
|
14
|
+
import { Resizable } from "react-resizable";
|
|
15
|
+
import "react-resizable/css/styles.css";
|
|
16
|
+
import styled from "styled-components";
|
|
17
|
+
import CellProvider from "./CellProvider";
|
|
18
|
+
import React from "react";
|
|
19
|
+
var ResizeCellStyle = styled(Resizable)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t&::before {\n\t\tposition: absolute;\n\t\ttop: 50%;\n\t\tright: 0;\n\t\twidth: 1px;\n\t\theight: 1.6em;\n\t\tbackground-color: rgba(0, 0, 0, 0.06);\n\t\ttransform: translateY(-50%);\n\t\ttransition: background-color 0.3s;\n\t\tcontent: \"\";\n\t}\n\n\t&:last-child::before {\n\t\tdisplay: none;\n\t}\n\n\t.react-resizable {\n\t\tposition: relative;\n\t\tbackground-clip: padding-box;\n\t}\n\n\t.react-resizable-handle {\n\t\tposition: absolute;\n\t\twidth: 10px;\n\t\theight: 100%;\n\t\tbottom: 0;\n\t\tcursor: col-resize;\n\t\tbackground-image: none;\n\t\tz-index: 1;\n\t}\n"])));
|
|
20
|
+
var CustomHeaderRow = function CustomHeaderRow(_ref) {
|
|
21
|
+
var index = _ref.index,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
return /*#__PURE__*/React.createElement("tr", props);
|
|
24
|
+
};
|
|
25
|
+
var CustomHeaderCell = function CustomHeaderCell(props) {
|
|
26
|
+
var onResize = props.onResize,
|
|
27
|
+
width = props.width,
|
|
28
|
+
field_type = props.field_type,
|
|
29
|
+
lock = props.lock,
|
|
30
|
+
editable = props.editable,
|
|
31
|
+
dataIndex = props.dataIndex,
|
|
32
|
+
restProps = _objectWithoutProperties(props, _excluded2);
|
|
33
|
+
var isCheckbox = !props.record;
|
|
34
|
+
|
|
35
|
+
// checkbox 不居中, 添加padding
|
|
36
|
+
if (isCheckbox) {
|
|
37
|
+
restProps.style = _objectSpread(_objectSpread({}, restProps.style), {}, {
|
|
38
|
+
paddingInlineStart: 8
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return /*#__PURE__*/React.createElement(ResizeCellStyle, {
|
|
42
|
+
width: width || 200,
|
|
43
|
+
height: 0,
|
|
44
|
+
onResize: onResize,
|
|
45
|
+
draggableOpts: {
|
|
46
|
+
enableUserSelectHack: false
|
|
47
|
+
}
|
|
48
|
+
}, /*#__PURE__*/React.createElement("td", restProps, /*#__PURE__*/React.createElement(CellProvider, props)));
|
|
49
|
+
};
|
|
50
|
+
export default {
|
|
51
|
+
Row: CustomHeaderRow,
|
|
52
|
+
Cell: CustomHeaderCell
|
|
53
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Table } from "antd";
|
|
2
|
+
import React from "react";
|
|
3
|
+
var summary = function summary(props) {
|
|
4
|
+
console.log("summary", props);
|
|
5
|
+
return /*#__PURE__*/React.createElement(Table.Summary, {
|
|
6
|
+
fixed: true
|
|
7
|
+
}, /*#__PURE__*/React.createElement(Table.Summary.Row, null, /*#__PURE__*/React.createElement(Table.Summary.Cell, {
|
|
8
|
+
index: 0,
|
|
9
|
+
colSpan: 24
|
|
10
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
11
|
+
style: {
|
|
12
|
+
paddingLeft: 20,
|
|
13
|
+
cursor: "pointer",
|
|
14
|
+
color: "#777777"
|
|
15
|
+
}
|
|
16
|
+
}, "+ Click to add"))));
|
|
17
|
+
};
|
|
18
|
+
export default summary;
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
declare type GridViewProps = {
|
|
4
|
+
columns: any;
|
|
5
|
+
dataSource: any[];
|
|
6
|
+
dispatch: any;
|
|
7
|
+
style: any;
|
|
8
|
+
pagination: any;
|
|
9
|
+
filter: any;
|
|
10
|
+
buttons: any;
|
|
11
|
+
sort: any;
|
|
12
|
+
title: any;
|
|
13
|
+
onValuesChange: (changedValues: any, values: any) => void;
|
|
14
|
+
summary: any;
|
|
15
|
+
};
|
|
16
|
+
declare const GridView: React.FC<GridViewProps>;
|
|
17
|
+
export default GridView;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["dataSource", "columns", "dispatch", "style", "filter", "sort", "buttons", "title", "summary", "onValuesChange"];
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
import React, { useEffect, useMemo } from "react";
|
|
17
|
+
import { Form } from "antd";
|
|
18
|
+
import Header from "./Header";
|
|
19
|
+
import Actions from "./Actions";
|
|
20
|
+
import Summary from "./Summary";
|
|
21
|
+
import GridViewTable from "./Table";
|
|
22
|
+
import { useSharedState } from "../../hooks";
|
|
23
|
+
import "./index.less";
|
|
24
|
+
import { Provider, Context } from "./model";
|
|
25
|
+
var GridView = Provider(function (props) {
|
|
26
|
+
var modal = useSharedState(Context);
|
|
27
|
+
var _Form$useForm = Form.useForm(),
|
|
28
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
29
|
+
form = _Form$useForm2[0];
|
|
30
|
+
var dataSource = props.dataSource,
|
|
31
|
+
columns = props.columns,
|
|
32
|
+
dispatch = props.dispatch,
|
|
33
|
+
style = props.style,
|
|
34
|
+
filter = props.filter,
|
|
35
|
+
sort = props.sort,
|
|
36
|
+
buttons = props.buttons,
|
|
37
|
+
title = props.title,
|
|
38
|
+
summary = props.summary,
|
|
39
|
+
_onValuesChange = props.onValuesChange,
|
|
40
|
+
other = _objectWithoutProperties(props, _excluded);
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
modal.dispatch({
|
|
43
|
+
type: "setDefaultColumns",
|
|
44
|
+
payload: columns
|
|
45
|
+
});
|
|
46
|
+
}, [columns]);
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
modal.dispatch({
|
|
49
|
+
type: "setDataSource",
|
|
50
|
+
payload: dataSource
|
|
51
|
+
});
|
|
52
|
+
}, [dataSource]);
|
|
53
|
+
useEffect(function () {
|
|
54
|
+
// modal.dispatch({
|
|
55
|
+
// type: "setQuickFilter",
|
|
56
|
+
// payload: filter?.list?.slice?.(0, 3) || [],
|
|
57
|
+
// });
|
|
58
|
+
// modal.dispatch({
|
|
59
|
+
// type: "setOtherFilter",
|
|
60
|
+
// payload: filter?.list?.slice?.(3) || [],
|
|
61
|
+
// });
|
|
62
|
+
}, [filter]);
|
|
63
|
+
var initialValues = useMemo(function () {
|
|
64
|
+
return ((filter === null || filter === void 0 ? void 0 : filter.list) || []).reduce(function (p, c) {
|
|
65
|
+
var _c$other;
|
|
66
|
+
return _objectSpread(_objectSpread({}, p), {}, _defineProperty({}, c.name, c === null || c === void 0 ? void 0 : (_c$other = c.other) === null || _c$other === void 0 ? void 0 : _c$other.defaultValue));
|
|
67
|
+
}, {});
|
|
68
|
+
}, [filter === null || filter === void 0 ? void 0 : filter.list]);
|
|
69
|
+
return /*#__PURE__*/React.createElement(Form, {
|
|
70
|
+
form: form,
|
|
71
|
+
layout: "vertical",
|
|
72
|
+
onValuesChange: function onValuesChange(cur, values) {
|
|
73
|
+
var _values = _objectSpread({}, values);
|
|
74
|
+
var currentKey = Object.keys(cur)[0];
|
|
75
|
+
if (currentKey !== "pagination") {
|
|
76
|
+
_values.pagination = _objectSpread(_objectSpread({}, _values.pagination), {}, {
|
|
77
|
+
page: 1
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
var _other$pagination;
|
|
81
|
+
if ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > (other === null || other === void 0 ? void 0 : (_other$pagination = other.pagination) === null || _other$pagination === void 0 ? void 0 : _other$pagination.pageSize)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
form.setFieldsValue({
|
|
86
|
+
pagination: _values.pagination
|
|
87
|
+
});
|
|
88
|
+
_onValuesChange(cur, values);
|
|
89
|
+
},
|
|
90
|
+
initialValues: initialValues
|
|
91
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "materials-grid",
|
|
93
|
+
style: style
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Header, {
|
|
95
|
+
title: title,
|
|
96
|
+
buttons: buttons
|
|
97
|
+
}), /*#__PURE__*/React.createElement(Actions, {
|
|
98
|
+
filter: filter,
|
|
99
|
+
sort: sort
|
|
100
|
+
}), /*#__PURE__*/React.createElement(Summary, {
|
|
101
|
+
summary: summary
|
|
102
|
+
}), /*#__PURE__*/React.createElement(GridViewTable, {
|
|
103
|
+
tableProps: other
|
|
104
|
+
})));
|
|
105
|
+
});
|
|
106
|
+
export default GridView;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FilterItemProps } from "./Actions/Filter/Dropdown";
|
|
3
|
+
interface FormState {
|
|
4
|
+
dataSource: any[];
|
|
5
|
+
defaultColumns: any[];
|
|
6
|
+
currentCell: any;
|
|
7
|
+
setting: any;
|
|
8
|
+
quickFilter: FilterItemProps[];
|
|
9
|
+
otherFilter: FilterItemProps[];
|
|
10
|
+
}
|
|
11
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
12
|
+
state: FormState;
|
|
13
|
+
} & {
|
|
14
|
+
dispatch: (params: {
|
|
15
|
+
type: string;
|
|
16
|
+
payload: any;
|
|
17
|
+
}) => void;
|
|
18
|
+
}>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import getContext from "../../utils/miniRedux";
|
|
8
|
+
var defaultState = {
|
|
9
|
+
dataSource: [{
|
|
10
|
+
key: "1",
|
|
11
|
+
id: 1,
|
|
12
|
+
name: "Olivia Rhye",
|
|
13
|
+
age: "32",
|
|
14
|
+
address: "London, Park Lane no. 0",
|
|
15
|
+
image: ["https://file.mypisell-dev.com//static/avatar.png"]
|
|
16
|
+
}, {
|
|
17
|
+
key: "2",
|
|
18
|
+
id: 2,
|
|
19
|
+
name: "Dianne Russell",
|
|
20
|
+
age: "32",
|
|
21
|
+
address: "London, Park Lane no. 1",
|
|
22
|
+
image: ["https://file.mypisell-dev.com//static/avatar.png"]
|
|
23
|
+
}],
|
|
24
|
+
defaultColumns: [{
|
|
25
|
+
title: "Name",
|
|
26
|
+
dataIndex: "name",
|
|
27
|
+
field_type: "text",
|
|
28
|
+
editable: true,
|
|
29
|
+
width: 200,
|
|
30
|
+
fixed: "left",
|
|
31
|
+
lock: true
|
|
32
|
+
}, {
|
|
33
|
+
title: "Age",
|
|
34
|
+
dataIndex: "age",
|
|
35
|
+
editable: true,
|
|
36
|
+
width: 200,
|
|
37
|
+
field_type: "text",
|
|
38
|
+
lock: true
|
|
39
|
+
}, {
|
|
40
|
+
title: "Address",
|
|
41
|
+
dataIndex: "address",
|
|
42
|
+
editable: true,
|
|
43
|
+
width: 200,
|
|
44
|
+
field_type: "text"
|
|
45
|
+
}, {
|
|
46
|
+
title: "Image",
|
|
47
|
+
dataIndex: "image",
|
|
48
|
+
editable: true,
|
|
49
|
+
width: 200,
|
|
50
|
+
field_type: "image"
|
|
51
|
+
}],
|
|
52
|
+
currentCell: null,
|
|
53
|
+
quickFilter: [],
|
|
54
|
+
otherFilter: [],
|
|
55
|
+
setting: {
|
|
56
|
+
field: {
|
|
57
|
+
edit: 0
|
|
58
|
+
},
|
|
59
|
+
data: {
|
|
60
|
+
edit: 0
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var _getContext = getContext({
|
|
65
|
+
namespace: "state",
|
|
66
|
+
state: defaultState,
|
|
67
|
+
reducers: {
|
|
68
|
+
setDataSource: function setDataSource(state, payload) {
|
|
69
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
70
|
+
dataSource: payload
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
setDefaultColumns: function setDefaultColumns(state, payload) {
|
|
74
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
75
|
+
defaultColumns: payload.map(function (d) {
|
|
76
|
+
return formatColumn(d);
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
setCurrentCell: function setCurrentCell(state, payload) {
|
|
81
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
82
|
+
currentCell: payload
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
setQuickFilter: function setQuickFilter(state, payload) {
|
|
86
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
87
|
+
quickFilter: payload
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
syncStorage: function syncStorage(state, payload) {
|
|
91
|
+
return _objectSpread({}, state);
|
|
92
|
+
},
|
|
93
|
+
init: function init(state, payload) {
|
|
94
|
+
// 这里进行初始化, 比如 同步storage数据
|
|
95
|
+
return _objectSpread({}, state);
|
|
96
|
+
},
|
|
97
|
+
setOtherFilter: function setOtherFilter(state, payload) {
|
|
98
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
99
|
+
otherFilter: payload
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
Provider = _getContext.Provider,
|
|
105
|
+
Context = _getContext.Context;
|
|
106
|
+
export { Provider, Context };
|
|
107
|
+
var formatColumn = function formatColumn(item) {
|
|
108
|
+
var _other = _objectSpread({
|
|
109
|
+
editable: true,
|
|
110
|
+
width: 100,
|
|
111
|
+
field_type: "text",
|
|
112
|
+
lock: true
|
|
113
|
+
}, item.other || {});
|
|
114
|
+
return _objectSpread(_objectSpread({}, _other), item);
|
|
115
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
declare class Tabs extends Component<any> {
|
|
3
|
+
state: {
|
|
4
|
+
activeKey: any;
|
|
5
|
+
};
|
|
6
|
+
private _handleChange;
|
|
7
|
+
setActiveKey: (key: string) => void;
|
|
8
|
+
getActiveKey: () => any;
|
|
9
|
+
render(): JSX.Element;
|
|
10
|
+
}
|
|
11
|
+
export default Tabs;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var _excluded = ["tab"];
|
|
2
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
12
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
13
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
15
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
16
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
17
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
18
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
20
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
21
|
+
import React, { Component } from 'react';
|
|
22
|
+
import { Tabs as OriginalTabs } from 'antd';
|
|
23
|
+
import { warning } from "../../utils/warning";
|
|
24
|
+
var Tabs = /*#__PURE__*/function (_Component) {
|
|
25
|
+
_inherits(Tabs, _Component);
|
|
26
|
+
var _super = _createSuper(Tabs);
|
|
27
|
+
function Tabs() {
|
|
28
|
+
var _this$props$activeKey;
|
|
29
|
+
var _this;
|
|
30
|
+
_classCallCheck(this, Tabs);
|
|
31
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
32
|
+
args[_key] = arguments[_key];
|
|
33
|
+
}
|
|
34
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
35
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
36
|
+
activeKey: (_this$props$activeKey = _this.props.activeKey) !== null && _this$props$activeKey !== void 0 ? _this$props$activeKey : _this.props.defaultActiveKey
|
|
37
|
+
});
|
|
38
|
+
_defineProperty(_assertThisInitialized(_this), "_handleChange", function (key) {
|
|
39
|
+
_this.setActiveKey(key);
|
|
40
|
+
});
|
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "setActiveKey", function (key) {
|
|
42
|
+
var _this$props$onChange = _this.props.onChange,
|
|
43
|
+
onChange = _this$props$onChange === void 0 ? function () {} : _this$props$onChange;
|
|
44
|
+
_this.setState({
|
|
45
|
+
activeKey: key
|
|
46
|
+
});
|
|
47
|
+
onChange(key);
|
|
48
|
+
});
|
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "getActiveKey", function () {
|
|
50
|
+
return _this.state.activeKey;
|
|
51
|
+
});
|
|
52
|
+
return _this;
|
|
53
|
+
}
|
|
54
|
+
_createClass(Tabs, [{
|
|
55
|
+
key: "render",
|
|
56
|
+
value: function render() {
|
|
57
|
+
var props = this.props;
|
|
58
|
+
var activeKey = this.state.activeKey;
|
|
59
|
+
var children = props.children;
|
|
60
|
+
var items = props.items;
|
|
61
|
+
|
|
62
|
+
// props.items 存在,只认 props.items
|
|
63
|
+
// 兼容代码:props.childrens 反推 props.items
|
|
64
|
+
if (!props.items && Array.isArray(children) && children.length > 0) {
|
|
65
|
+
warning('Tabs.TabPane is deprecated. Please use `items` directly.');
|
|
66
|
+
items = children.map(function (node) {
|
|
67
|
+
if ( /*#__PURE__*/React.isValidElement(node)) {
|
|
68
|
+
var key = node.key,
|
|
69
|
+
_props = node.props;
|
|
70
|
+
var _ref = _props || {},
|
|
71
|
+
tab = _ref.tab,
|
|
72
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
73
|
+
var item = _objectSpread(_objectSpread({
|
|
74
|
+
key: String(key)
|
|
75
|
+
}, restProps), {}, {
|
|
76
|
+
label: tab
|
|
77
|
+
});
|
|
78
|
+
return item;
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}).filter(Boolean);
|
|
82
|
+
}
|
|
83
|
+
return /*#__PURE__*/React.createElement(OriginalTabs, _extends({}, props, {
|
|
84
|
+
items: items,
|
|
85
|
+
activeKey: activeKey,
|
|
86
|
+
onChange: this._handleChange
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
}]);
|
|
90
|
+
return Tabs;
|
|
91
|
+
}(Component);
|
|
92
|
+
Tabs.TabPane = OriginalTabs.TabPane;
|
|
93
|
+
export default Tabs;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
4
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
5
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
|
+
import { useEffect, useState, useMemo } from 'react';
|
|
9
|
+
import { isBrowser } from "../utils";
|
|
10
|
+
var subscribers = new Set();
|
|
11
|
+
var info;
|
|
12
|
+
var responsiveConfig = {
|
|
13
|
+
phone: 0,
|
|
14
|
+
ipad: 700,
|
|
15
|
+
pc: 1080
|
|
16
|
+
};
|
|
17
|
+
function handleResize() {
|
|
18
|
+
var oldInfo = info;
|
|
19
|
+
calculate();
|
|
20
|
+
if (oldInfo === info) return;
|
|
21
|
+
var _iterator = _createForOfIteratorHelper(subscribers),
|
|
22
|
+
_step;
|
|
23
|
+
try {
|
|
24
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
25
|
+
var subscriber = _step.value;
|
|
26
|
+
subscriber();
|
|
27
|
+
}
|
|
28
|
+
} catch (err) {
|
|
29
|
+
_iterator.e(err);
|
|
30
|
+
} finally {
|
|
31
|
+
_iterator.f();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
var listening = false;
|
|
35
|
+
function calculate() {
|
|
36
|
+
var width = window.innerWidth;
|
|
37
|
+
var newInfo = {};
|
|
38
|
+
var shouldUpdate = false;
|
|
39
|
+
for (var _i = 0, _Object$keys = Object.keys(responsiveConfig); _i < _Object$keys.length; _i++) {
|
|
40
|
+
var key = _Object$keys[_i];
|
|
41
|
+
newInfo[key] = width >= responsiveConfig[key];
|
|
42
|
+
if (newInfo[key] !== info[key]) {
|
|
43
|
+
shouldUpdate = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (shouldUpdate) {
|
|
47
|
+
info = newInfo;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function configResponsive(config) {
|
|
51
|
+
responsiveConfig = config;
|
|
52
|
+
if (info) calculate();
|
|
53
|
+
}
|
|
54
|
+
export default function useResponsive() {
|
|
55
|
+
if (isBrowser && !listening) {
|
|
56
|
+
info = {};
|
|
57
|
+
calculate();
|
|
58
|
+
window.addEventListener('resize', handleResize);
|
|
59
|
+
listening = true;
|
|
60
|
+
}
|
|
61
|
+
var _useState = useState(info),
|
|
62
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
63
|
+
state = _useState2[0],
|
|
64
|
+
setState = _useState2[1];
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
if (!isBrowser) return;
|
|
67
|
+
|
|
68
|
+
// In React 18's StrictMode, useEffect perform twice, resize listener is remove, so handleResize is never perform.
|
|
69
|
+
// https://github.com/alibaba/hooks/issues/1910
|
|
70
|
+
if (!listening) {
|
|
71
|
+
window.addEventListener('resize', handleResize);
|
|
72
|
+
}
|
|
73
|
+
var subscriber = function subscriber() {
|
|
74
|
+
setState(info);
|
|
75
|
+
};
|
|
76
|
+
subscribers.add(subscriber);
|
|
77
|
+
return function () {
|
|
78
|
+
subscribers.delete(subscriber);
|
|
79
|
+
if (subscribers.size === 0) {
|
|
80
|
+
window.removeEventListener('resize', handleResize);
|
|
81
|
+
listening = false;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
var current = useMemo(function () {
|
|
86
|
+
if (state !== null && state !== void 0 && state.pc) {
|
|
87
|
+
return 'pc';
|
|
88
|
+
}
|
|
89
|
+
if (state !== null && state !== void 0 && state.ipad) {
|
|
90
|
+
return 'ipad';
|
|
91
|
+
}
|
|
92
|
+
return 'phone';
|
|
93
|
+
}, [state]);
|
|
94
|
+
return current;
|
|
95
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Context } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @title: 使用状态管理器的自定义钩子函数
|
|
4
|
+
* @description:
|
|
5
|
+
* @param {useMyContext} MyContext
|
|
6
|
+
* @return {*}
|
|
7
|
+
* @Author: zhiwei.Wang
|
|
8
|
+
* @Date: 2023-07-05 10:23
|
|
9
|
+
*/
|
|
10
|
+
declare const useSharedState: <T>(MyContext: Context<T>) => NonNullable<T>;
|
|
11
|
+
export default useSharedState;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @title: 使用状态管理器的自定义钩子函数
|
|
5
|
+
* @description:
|
|
6
|
+
* @param {useMyContext} MyContext
|
|
7
|
+
* @return {*}
|
|
8
|
+
* @Author: zhiwei.Wang
|
|
9
|
+
* @Date: 2023-07-05 10:23
|
|
10
|
+
*/
|
|
11
|
+
var useSharedState = function useSharedState(MyContext) {
|
|
12
|
+
var context = useContext(MyContext);
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error('useMyContext must be used within a MyStateProvider');
|
|
15
|
+
}
|
|
16
|
+
return context;
|
|
17
|
+
};
|
|
18
|
+
export default useSharedState;
|