@cgeui/business-components 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/esm/BatteryPack/common.js +134 -0
- package/dist/esm/BatteryPack/demo/alarmChecked.js +226 -0
- package/dist/esm/BatteryPack/demo/assets/BatteryPackCombined.svg +49 -0
- package/dist/esm/BatteryPack/demo/assets/BatteryPackWithIsor.svg +51 -0
- package/dist/esm/BatteryPack/demo/basic.js +174 -0
- package/dist/esm/BatteryPack/demo/batteryClick.js +178 -0
- package/dist/esm/BatteryPack/demo/combined.js +241 -0
- package/dist/esm/BatteryPack/demo/count.js +176 -0
- package/dist/esm/BatteryPack/demo/fault.js +192 -0
- package/dist/esm/BatteryPack/demo/faultWithIsor.js +235 -0
- package/dist/esm/BatteryPack/demo/lightType.js +207 -0
- package/dist/esm/BatteryPack/demo/multiple.js +177 -0
- package/dist/esm/BatteryPack/demo/setDefaultValue.js +90 -0
- package/dist/esm/BatteryPack/demo/showCellInfo.js +86 -0
- package/dist/esm/BatteryPack/demo/showIsor.js +184 -0
- package/dist/esm/BatteryPack/index.js +624 -0
- package/dist/esm/BatteryPack/index.less +411 -0
- package/dist/esm/BatteryPack/interface.js +1 -0
- package/dist/esm/BatteryPack/theme/dark.less +11 -0
- package/dist/esm/BatteryPack/theme/default.less +14 -0
- package/dist/esm/BatteryPack/theme/index.less +2 -0
- package/dist/esm/BatteryPack/tooltip.less +53 -0
- package/dist/esm/BatteryPack/type.js +1 -0
- package/dist/esm/BatteryPack/utils.js +51 -0
- package/dist/esm/Card/CardTitle/CardTitle.js +23 -0
- package/dist/esm/Card/CardTitle/index.js +1 -0
- package/dist/esm/Card/CardTitle/index.less +15 -0
- package/dist/esm/Card/NormalCard/CatlCard.js +33 -0
- package/dist/esm/Card/NormalCard/index.js +1 -0
- package/dist/esm/Card/NormalCard/index.less +15 -0
- package/dist/esm/Card/assets/icon-notice.svg +4 -0
- package/dist/esm/Card/index.js +2 -0
- package/dist/esm/DataVisualProgress/Components/AnalysisFaultLevelPage.js +52 -0
- package/dist/esm/DataVisualProgress/demo/alarmChecked.js +50 -0
- package/dist/esm/DataVisualProgress/demo/alarmFaultShow.js +115 -0
- package/dist/esm/DataVisualProgress/demo/assets/backgroundImage.svg +47 -0
- package/dist/esm/DataVisualProgress/demo/basic.js +148 -0
- package/dist/esm/DataVisualProgress/demo/data.js +114 -0
- package/dist/esm/DataVisualProgress/demo/dayListOption.js +148 -0
- package/dist/esm/DataVisualProgress/demo/legendData.js +125 -0
- package/dist/esm/DataVisualProgress/demo/occurAlarm.js +486 -0
- package/dist/esm/DataVisualProgress/demo/option.js +1009 -0
- package/dist/esm/DataVisualProgress/demo/timeFilterOption.js +74 -0
- package/dist/esm/DataVisualProgress/index.js +396 -0
- package/dist/esm/DataVisualProgress/interface.js +1 -0
- package/dist/esm/DataVisualProgress/style.less +266 -0
- package/dist/esm/DataVisualProgress/theme/dark.less +5 -0
- package/dist/esm/DataVisualProgress/theme/default.less +5 -0
- package/dist/esm/DataVisualProgress/theme/index.less +2 -0
- package/dist/esm/DataVisualProgress/utils.js +398 -0
- package/dist/esm/EditableInput/demo/basic.js +23 -0
- package/dist/esm/EditableInput/demo/textarea.js +30 -0
- package/dist/esm/EditableInput/index.js +75 -0
- package/dist/esm/EditableInput/index.less +26 -0
- package/dist/esm/EditableInput/interface.js +1 -0
- package/dist/esm/ElectricityPriceChart/config.js +141 -0
- package/dist/esm/ElectricityPriceChart/demo/assets/basic.svg +52 -0
- package/dist/esm/ElectricityPriceChart/demo/basic.js +9 -0
- package/dist/esm/ElectricityPriceChart/demo/legend.js +10 -0
- package/dist/esm/ElectricityPriceChart/demo/multi.js +13 -0
- package/dist/esm/ElectricityPriceChart/demo/noxAxis.js +10 -0
- package/dist/esm/ElectricityPriceChart/demo/show.js +41 -0
- package/dist/esm/ElectricityPriceChart/index.js +53 -0
- package/dist/esm/ElectricityPriceChart/index.less +33 -0
- package/dist/esm/ElectricityPriceChart/interface.js +1 -0
- package/dist/esm/ElectricityPriceChart/locale/en-US.js +8 -0
- package/dist/esm/ElectricityPriceChart/locale/index.js +7 -0
- package/dist/esm/ElectricityPriceChart/locale/zh-CN.js +8 -0
- package/dist/esm/ElectricityPriceChart/utils.js +26 -0
- package/dist/esm/FaultCalendar/demo/basic.js +94 -0
- package/dist/esm/FaultCalendar/demo/basic.less +4 -0
- package/dist/esm/FaultCalendar/index.js +78 -0
- package/dist/esm/FaultCalendar/index.less +158 -0
- package/dist/esm/FaultCalendar/interface.js +1 -0
- package/dist/esm/FaultCalendar/util.js +62 -0
- package/dist/esm/Form/SchemaForm/SchemaForm.js +149 -0
- package/dist/esm/Form/SchemaForm/index.js +38 -0
- package/dist/esm/Form/SchemaForm/index.less +22 -0
- package/dist/esm/Form/StateForm/index.js +110 -0
- package/dist/esm/Form/StateForm/index.less +75 -0
- package/dist/esm/Form/StateFormGroup/StateFormGroup.js +59 -0
- package/dist/esm/Form/StateFormGroup/index.js +1 -0
- package/dist/esm/Form/index.js +2 -0
- package/dist/esm/GroupTagCascader/demo/basic.js +67 -0
- package/dist/esm/GroupTagCascader/demo/index.js +1 -0
- package/dist/esm/GroupTagCascader/index.js +79 -0
- package/dist/esm/GroupTagCascader/interface.js +1 -0
- package/dist/esm/GroupTagCascader/locale/en-US.js +5 -0
- package/dist/esm/GroupTagCascader/locale/index.js +7 -0
- package/dist/esm/GroupTagCascader/locale/zh-CN.js +5 -0
- package/dist/esm/GroupTagCascader/util.js +124 -0
- package/dist/esm/IndicatorCard/index.js +25 -0
- package/dist/esm/IndicatorCard/index.less +30 -0
- package/dist/esm/NumberCard/NumberCard.js +123 -0
- package/dist/esm/NumberCard/demo/assets/icon-cloudAlarm.png +0 -0
- package/dist/esm/NumberCard/demo/assets/icon-localAlarm.png +0 -0
- package/dist/esm/NumberCard/demo/assets/icon-safetyWarning.png +0 -0
- package/dist/esm/NumberCard/demo/basic.js +21 -0
- package/dist/esm/NumberCard/demo/column.js +34 -0
- package/dist/esm/NumberCard/demo/description.js +54 -0
- package/dist/esm/NumberCard/demo/icon.js +51 -0
- package/dist/esm/NumberCard/demo/isShowBasisCompare.js +88 -0
- package/dist/esm/NumberCard/demo/size.js +40 -0
- package/dist/esm/NumberCard/demo/style.js +32 -0
- package/dist/esm/NumberCard/demo/textLayout.js +34 -0
- package/dist/esm/NumberCard/demo/theme.js +57 -0
- package/dist/esm/NumberCard/index.css +166 -0
- package/dist/esm/NumberCard/index.js +1 -0
- package/dist/esm/NumberCard/index.less +367 -0
- package/dist/esm/NumberCard/interface.js +1 -0
- package/dist/esm/NumberCard/util.js +49 -0
- package/dist/esm/OperationButtons/demo/basic.js +81 -0
- package/dist/esm/OperationButtons/index.js +78 -0
- package/dist/esm/OperationButtons/index.less +72 -0
- package/dist/esm/OperationButtons/interface.js +1 -0
- package/dist/esm/PageHeader/demo/basic.js +13 -0
- package/dist/esm/PageHeader/demo/whiteBg.js +49 -0
- package/dist/esm/PageHeader/index.js +15 -0
- package/dist/esm/ProLayout/ViewPage/index.js +31 -0
- package/dist/esm/ProLayout/index.js +172 -0
- package/dist/esm/ProLayout/interface.js +1 -0
- package/dist/esm/ProLayout/style.less +40 -0
- package/dist/esm/ProLayout/utils.js +39 -0
- package/dist/esm/TableInPdf/ItemTable.js +35 -0
- package/dist/esm/TableInPdf/demo/basic.js +63 -0
- package/dist/esm/TableInPdf/index.js +57 -0
- package/dist/esm/TableInPdf/index.less +12 -0
- package/dist/esm/TableInPdf/interface.js +1 -0
- package/dist/esm/TableInPdf/utils.js +10 -0
- package/dist/esm/TablePage/components/drawerForm.js +352 -0
- package/dist/esm/TablePage/components/toolButton.js +168 -0
- package/dist/esm/TablePage/demo/addNewLine.js +72 -0
- package/dist/esm/TablePage/demo/adjust.less +3 -0
- package/dist/esm/TablePage/demo/appendBatchOperation.js +122 -0
- package/dist/esm/TablePage/demo/basic.js +49 -0
- package/dist/esm/TablePage/demo/batchDelete.js +63 -0
- package/dist/esm/TablePage/demo/batchDeleteAndOperation.js +132 -0
- package/dist/esm/TablePage/demo/colorPicker.js +8 -0
- package/dist/esm/TablePage/demo/createdInLine.js +64 -0
- package/dist/esm/TablePage/demo/customForm.js +111 -0
- package/dist/esm/TablePage/demo/drawFormLayout.js +49 -0
- package/dist/esm/TablePage/demo/drawFormTextPlaceholder.js +53 -0
- package/dist/esm/TablePage/demo/formConfig.js +53 -0
- package/dist/esm/TablePage/demo/operationConfig.js +65 -0
- package/dist/esm/TablePage/demo/reactions.js +72 -0
- package/dist/esm/TablePage/demo/reactions2.js +74 -0
- package/dist/esm/TablePage/demo/selectAll.js +122 -0
- package/dist/esm/TablePage/demo/toolButtonOffset.js +53 -0
- package/dist/esm/TablePage/index.css +106 -0
- package/dist/esm/TablePage/index.js +600 -0
- package/dist/esm/TablePage/index.less +171 -0
- package/dist/esm/TablePage/type.js +1 -0
- package/dist/esm/TablePage/utils.js +112 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/interface.js +2 -0
- package/dist/esm/locales/en-US.js +58 -0
- package/dist/esm/locales/index.js +7 -0
- package/dist/esm/locales/zh-CN.js +58 -0
- package/dist/esm/theme/var/common.less +148 -0
- package/dist/esm/theme/var/dark.less +28 -0
- package/dist/esm/theme/var/index.less +5 -0
- package/dist/esm/theme/var/light.less +28 -0
- package/dist/esm/utils/constants/battery.js +14 -0
- package/dist/esm/utils/constants/env.js +6 -0
- package/dist/esm/utils/constants/helper.js +5 -0
- package/dist/esm/utils/constants/table.js +17 -0
- package/dist/esm/utils/formAdapter/BasicAdapter.js +71 -0
- package/dist/esm/utils/formAdapter/FormSchemaAdapter.js +149 -0
- package/dist/esm/utils/index.js +5 -0
- package/dist/esm/utils/locale.js +10 -0
- package/dist/esm/utils/store/action.js +316 -0
- package/dist/esm/utils/store/index.js +44 -0
- package/dist/esm/utils/tableAdapter/CustomFilter.js +206 -0
- package/dist/esm/utils/tableAdapter/index.less +50 -0
- package/dist/esm/utils/tableAdapter/table.js +195 -0
- package/dist/esm/utils/time/index.js +26 -0
- package/dist/esm/utils/types/data.d.ts +51 -0
- package/dist/lib/BatteryPack/common.js +138 -0
- package/dist/lib/BatteryPack/demo/alarmChecked.js +232 -0
- package/dist/lib/BatteryPack/demo/assets/BatteryPackCombined.svg +49 -0
- package/dist/lib/BatteryPack/demo/assets/BatteryPackWithIsor.svg +51 -0
- package/dist/lib/BatteryPack/demo/basic.js +180 -0
- package/dist/lib/BatteryPack/demo/batteryClick.js +184 -0
- package/dist/lib/BatteryPack/demo/combined.js +247 -0
- package/dist/lib/BatteryPack/demo/count.js +182 -0
- package/dist/lib/BatteryPack/demo/fault.js +198 -0
- package/dist/lib/BatteryPack/demo/faultWithIsor.js +242 -0
- package/dist/lib/BatteryPack/demo/lightType.js +211 -0
- package/dist/lib/BatteryPack/demo/multiple.js +183 -0
- package/dist/lib/BatteryPack/demo/setDefaultValue.js +96 -0
- package/dist/lib/BatteryPack/demo/showCellInfo.js +92 -0
- package/dist/lib/BatteryPack/demo/showIsor.js +190 -0
- package/dist/lib/BatteryPack/index.js +627 -0
- package/dist/lib/BatteryPack/index.less +411 -0
- package/dist/lib/BatteryPack/interface.js +5 -0
- package/dist/lib/BatteryPack/theme/dark.less +11 -0
- package/dist/lib/BatteryPack/theme/default.less +14 -0
- package/dist/lib/BatteryPack/theme/index.less +2 -0
- package/dist/lib/BatteryPack/tooltip.less +53 -0
- package/dist/lib/BatteryPack/type.js +5 -0
- package/dist/lib/BatteryPack/utils.js +58 -0
- package/dist/lib/Card/CardTitle/CardTitle.js +29 -0
- package/dist/lib/Card/CardTitle/index.js +13 -0
- package/dist/lib/Card/CardTitle/index.less +15 -0
- package/dist/lib/Card/NormalCard/CatlCard.js +38 -0
- package/dist/lib/Card/NormalCard/index.js +13 -0
- package/dist/lib/Card/NormalCard/index.less +15 -0
- package/dist/lib/Card/assets/icon-notice.svg +4 -0
- package/dist/lib/Card/index.js +27 -0
- package/dist/lib/DataVisualProgress/Components/AnalysisFaultLevelPage.js +56 -0
- package/dist/lib/DataVisualProgress/demo/alarmChecked.js +56 -0
- package/dist/lib/DataVisualProgress/demo/alarmFaultShow.js +121 -0
- package/dist/lib/DataVisualProgress/demo/assets/backgroundImage.svg +47 -0
- package/dist/lib/DataVisualProgress/demo/basic.js +155 -0
- package/dist/lib/DataVisualProgress/demo/data.js +120 -0
- package/dist/lib/DataVisualProgress/demo/dayListOption.js +154 -0
- package/dist/lib/DataVisualProgress/demo/legendData.js +131 -0
- package/dist/lib/DataVisualProgress/demo/occurAlarm.js +492 -0
- package/dist/lib/DataVisualProgress/demo/option.js +1015 -0
- package/dist/lib/DataVisualProgress/demo/timeFilterOption.js +80 -0
- package/dist/lib/DataVisualProgress/index.js +399 -0
- package/dist/lib/DataVisualProgress/interface.js +5 -0
- package/dist/lib/DataVisualProgress/style.less +266 -0
- package/dist/lib/DataVisualProgress/theme/dark.less +5 -0
- package/dist/lib/DataVisualProgress/theme/default.less +5 -0
- package/dist/lib/DataVisualProgress/theme/index.less +2 -0
- package/dist/lib/DataVisualProgress/utils.js +404 -0
- package/dist/lib/EditableInput/demo/basic.js +30 -0
- package/dist/lib/EditableInput/demo/textarea.js +37 -0
- package/dist/lib/EditableInput/index.js +80 -0
- package/dist/lib/EditableInput/index.less +26 -0
- package/dist/lib/EditableInput/interface.js +5 -0
- package/dist/lib/ElectricityPriceChart/config.js +148 -0
- package/dist/lib/ElectricityPriceChart/demo/assets/basic.svg +52 -0
- package/dist/lib/ElectricityPriceChart/demo/basic.js +16 -0
- package/dist/lib/ElectricityPriceChart/demo/legend.js +17 -0
- package/dist/lib/ElectricityPriceChart/demo/multi.js +20 -0
- package/dist/lib/ElectricityPriceChart/demo/noxAxis.js +17 -0
- package/dist/lib/ElectricityPriceChart/demo/show.js +48 -0
- package/dist/lib/ElectricityPriceChart/index.js +58 -0
- package/dist/lib/ElectricityPriceChart/index.less +33 -0
- package/dist/lib/ElectricityPriceChart/interface.js +5 -0
- package/dist/lib/ElectricityPriceChart/locale/en-US.js +14 -0
- package/dist/lib/ElectricityPriceChart/locale/index.js +14 -0
- package/dist/lib/ElectricityPriceChart/locale/zh-CN.js +14 -0
- package/dist/lib/ElectricityPriceChart/utils.js +32 -0
- package/dist/lib/FaultCalendar/demo/basic.js +100 -0
- package/dist/lib/FaultCalendar/demo/basic.less +4 -0
- package/dist/lib/FaultCalendar/index.js +83 -0
- package/dist/lib/FaultCalendar/index.less +158 -0
- package/dist/lib/FaultCalendar/interface.js +5 -0
- package/dist/lib/FaultCalendar/util.js +68 -0
- package/dist/lib/Form/SchemaForm/SchemaForm.js +155 -0
- package/dist/lib/Form/SchemaForm/index.js +45 -0
- package/dist/lib/Form/SchemaForm/index.less +22 -0
- package/dist/lib/Form/StateForm/index.js +115 -0
- package/dist/lib/Form/StateForm/index.less +75 -0
- package/dist/lib/Form/StateFormGroup/StateFormGroup.js +66 -0
- package/dist/lib/Form/StateFormGroup/index.js +13 -0
- package/dist/lib/Form/index.js +28 -0
- package/dist/lib/GroupTagCascader/demo/basic.js +72 -0
- package/dist/lib/GroupTagCascader/demo/index.js +13 -0
- package/dist/lib/GroupTagCascader/index.js +85 -0
- package/dist/lib/GroupTagCascader/interface.js +5 -0
- package/dist/lib/GroupTagCascader/locale/en-US.js +11 -0
- package/dist/lib/GroupTagCascader/locale/index.js +14 -0
- package/dist/lib/GroupTagCascader/locale/zh-CN.js +11 -0
- package/dist/lib/GroupTagCascader/util.js +130 -0
- package/dist/lib/IndicatorCard/index.js +31 -0
- package/dist/lib/IndicatorCard/index.less +30 -0
- package/dist/lib/NumberCard/NumberCard.js +127 -0
- package/dist/lib/NumberCard/demo/assets/icon-cloudAlarm.png +0 -0
- package/dist/lib/NumberCard/demo/assets/icon-localAlarm.png +0 -0
- package/dist/lib/NumberCard/demo/assets/icon-safetyWarning.png +0 -0
- package/dist/lib/NumberCard/demo/basic.js +27 -0
- package/dist/lib/NumberCard/demo/column.js +40 -0
- package/dist/lib/NumberCard/demo/description.js +59 -0
- package/dist/lib/NumberCard/demo/icon.js +56 -0
- package/dist/lib/NumberCard/demo/isShowBasisCompare.js +93 -0
- package/dist/lib/NumberCard/demo/size.js +44 -0
- package/dist/lib/NumberCard/demo/style.js +36 -0
- package/dist/lib/NumberCard/demo/textLayout.js +38 -0
- package/dist/lib/NumberCard/demo/theme.js +61 -0
- package/dist/lib/NumberCard/index.css +166 -0
- package/dist/lib/NumberCard/index.js +13 -0
- package/dist/lib/NumberCard/index.less +367 -0
- package/dist/lib/NumberCard/interface.js +5 -0
- package/dist/lib/NumberCard/util.js +53 -0
- package/dist/lib/OperationButtons/demo/basic.js +88 -0
- package/dist/lib/OperationButtons/index.js +83 -0
- package/dist/lib/OperationButtons/index.less +72 -0
- package/dist/lib/OperationButtons/interface.js +5 -0
- package/dist/lib/PageHeader/demo/basic.js +14 -0
- package/dist/lib/PageHeader/demo/whiteBg.js +50 -0
- package/dist/lib/PageHeader/index.js +20 -0
- package/dist/lib/ProLayout/ViewPage/index.js +36 -0
- package/dist/lib/ProLayout/index.js +179 -0
- package/dist/lib/ProLayout/interface.js +5 -0
- package/dist/lib/ProLayout/style.less +40 -0
- package/dist/lib/ProLayout/utils.js +44 -0
- package/dist/lib/TableInPdf/ItemTable.js +39 -0
- package/dist/lib/TableInPdf/demo/basic.js +68 -0
- package/dist/lib/TableInPdf/index.js +61 -0
- package/dist/lib/TableInPdf/index.less +12 -0
- package/dist/lib/TableInPdf/interface.js +5 -0
- package/dist/lib/TableInPdf/utils.js +15 -0
- package/dist/lib/TablePage/components/drawerForm.js +356 -0
- package/dist/lib/TablePage/components/toolButton.js +173 -0
- package/dist/lib/TablePage/demo/addNewLine.js +78 -0
- package/dist/lib/TablePage/demo/adjust.less +3 -0
- package/dist/lib/TablePage/demo/appendBatchOperation.js +127 -0
- package/dist/lib/TablePage/demo/basic.js +55 -0
- package/dist/lib/TablePage/demo/batchDelete.js +69 -0
- package/dist/lib/TablePage/demo/batchDeleteAndOperation.js +137 -0
- package/dist/lib/TablePage/demo/colorPicker.js +14 -0
- package/dist/lib/TablePage/demo/createdInLine.js +70 -0
- package/dist/lib/TablePage/demo/customForm.js +115 -0
- package/dist/lib/TablePage/demo/drawFormLayout.js +55 -0
- package/dist/lib/TablePage/demo/drawFormTextPlaceholder.js +59 -0
- package/dist/lib/TablePage/demo/formConfig.js +59 -0
- package/dist/lib/TablePage/demo/operationConfig.js +71 -0
- package/dist/lib/TablePage/demo/reactions.js +78 -0
- package/dist/lib/TablePage/demo/reactions2.js +80 -0
- package/dist/lib/TablePage/demo/selectAll.js +127 -0
- package/dist/lib/TablePage/demo/toolButtonOffset.js +59 -0
- package/dist/lib/TablePage/index.css +106 -0
- package/dist/lib/TablePage/index.js +605 -0
- package/dist/lib/TablePage/index.less +171 -0
- package/dist/lib/TablePage/type.js +5 -0
- package/dist/lib/TablePage/utils.js +119 -0
- package/dist/lib/index.js +117 -0
- package/dist/lib/interface.js +11 -0
- package/dist/lib/locales/en-US.js +65 -0
- package/dist/lib/locales/index.js +14 -0
- package/dist/lib/locales/zh-CN.js +65 -0
- package/dist/lib/theme/var/common.less +148 -0
- package/dist/lib/theme/var/dark.less +28 -0
- package/dist/lib/theme/var/index.less +5 -0
- package/dist/lib/theme/var/light.less +28 -0
- package/dist/lib/utils/constants/battery.js +20 -0
- package/dist/lib/utils/constants/env.js +12 -0
- package/dist/lib/utils/constants/helper.js +11 -0
- package/dist/lib/utils/constants/table.js +23 -0
- package/dist/lib/utils/formAdapter/BasicAdapter.js +77 -0
- package/dist/lib/utils/formAdapter/FormSchemaAdapter.js +155 -0
- package/dist/lib/utils/index.js +60 -0
- package/dist/lib/utils/locale.js +16 -0
- package/dist/lib/utils/store/action.js +322 -0
- package/dist/lib/utils/store/index.js +50 -0
- package/dist/lib/utils/tableAdapter/CustomFilter.js +211 -0
- package/dist/lib/utils/tableAdapter/index.less +50 -0
- package/dist/lib/utils/tableAdapter/table.js +200 -0
- package/dist/lib/utils/time/index.js +33 -0
- package/dist/lib/utils/types/data.d.ts +51 -0
- package/package.json +10 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
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); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
import { cloneDeep, merge as _merge } from 'lodash';
|
|
9
|
+
import { useIntl as _useIntl } from 'react-intl';
|
|
10
|
+
export var BasicAdapter = /*#__PURE__*/function () {
|
|
11
|
+
function BasicAdapter(data) {
|
|
12
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
13
|
+
_classCallCheck(this, BasicAdapter);
|
|
14
|
+
_defineProperty(this, "data", void 0);
|
|
15
|
+
_defineProperty(this, "options", void 0);
|
|
16
|
+
_defineProperty(this, "intl", void 0);
|
|
17
|
+
this.data = cloneDeep(data);
|
|
18
|
+
this.options = options;
|
|
19
|
+
this.key();
|
|
20
|
+
if (options !== null && options !== void 0 && options.useIntl) {
|
|
21
|
+
this.useIntl();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
_createClass(BasicAdapter, [{
|
|
25
|
+
key: "key",
|
|
26
|
+
value: function key(_key) {
|
|
27
|
+
this.data.key = _key || this.data.dataIndex || this.data.key || new Date().getTime();
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
key: "useIntl",
|
|
31
|
+
value: function useIntl() {
|
|
32
|
+
if (!this.intl) {
|
|
33
|
+
var _this$options;
|
|
34
|
+
this.intl = ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.customIntl) || _useIntl();
|
|
35
|
+
}
|
|
36
|
+
if (this.data.title) {
|
|
37
|
+
this.data.title = this.intl.formatMessage({
|
|
38
|
+
id: this.data.title
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "sorter",
|
|
45
|
+
value: function sorter() {
|
|
46
|
+
var fn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
47
|
+
this.data.sorter = fn;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "assign",
|
|
52
|
+
value: function assign(params) {
|
|
53
|
+
Object.assign(this.data, params);
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "merge",
|
|
58
|
+
value: function merge(params) {
|
|
59
|
+
_merge(this.data, params);
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "useEnum",
|
|
64
|
+
value: function useEnum(valueEnum) {
|
|
65
|
+
return this.assign({
|
|
66
|
+
enum: valueEnum
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}]);
|
|
70
|
+
return BasicAdapter;
|
|
71
|
+
}();
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
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); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
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); }
|
|
8
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
|
+
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); }; }
|
|
10
|
+
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); }
|
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
|
+
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; } }
|
|
13
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
|
+
import { isFunction } from 'lodash';
|
|
15
|
+
import { BasicAdapter } from "./BasicAdapter";
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
export var FormSchemaAdapter = /*#__PURE__*/function (_BasicAdapter) {
|
|
18
|
+
_inherits(FormSchemaAdapter, _BasicAdapter);
|
|
19
|
+
var _super = _createSuper(FormSchemaAdapter);
|
|
20
|
+
function FormSchemaAdapter(data) {
|
|
21
|
+
var _this;
|
|
22
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
23
|
+
useIntl: true,
|
|
24
|
+
colon: false,
|
|
25
|
+
customIntl: null
|
|
26
|
+
};
|
|
27
|
+
_classCallCheck(this, FormSchemaAdapter);
|
|
28
|
+
_this = _super.call(this, data, options);
|
|
29
|
+
if (!options.colon) {
|
|
30
|
+
_this.colon(false);
|
|
31
|
+
}
|
|
32
|
+
return _this;
|
|
33
|
+
}
|
|
34
|
+
_createClass(FormSchemaAdapter, [{
|
|
35
|
+
key: "required",
|
|
36
|
+
value: function required() {
|
|
37
|
+
var _required = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
38
|
+
return this.assign({
|
|
39
|
+
required: _required
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
key: "useDecorator",
|
|
44
|
+
value: function useDecorator() {
|
|
45
|
+
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'FormItem';
|
|
46
|
+
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
47
|
+
var schema = {};
|
|
48
|
+
schema['x-decorator'] = name;
|
|
49
|
+
if (props) {
|
|
50
|
+
schema['x-decorator-props'] = props;
|
|
51
|
+
}
|
|
52
|
+
return this.merge(schema);
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
key: "useDecoratorProps",
|
|
56
|
+
value: function useDecoratorProps(props) {
|
|
57
|
+
return this.merge({
|
|
58
|
+
'x-decorator-props': props
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
key: "useDirection",
|
|
63
|
+
value: function useDirection(direction) {
|
|
64
|
+
return this.useDecoratorProps({
|
|
65
|
+
className: "flex-".concat(direction)
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "useLabel",
|
|
70
|
+
value: function useLabel(labelRender) {
|
|
71
|
+
var labelJsx = labelRender;
|
|
72
|
+
if (isFunction(labelRender)) {
|
|
73
|
+
labelJsx = labelRender(this.data);
|
|
74
|
+
}
|
|
75
|
+
var Label = function Label() {
|
|
76
|
+
return labelJsx;
|
|
77
|
+
};
|
|
78
|
+
return this.useDecorator('FormItem', {
|
|
79
|
+
label: /*#__PURE__*/_jsx(Label, {})
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
key: "colon",
|
|
84
|
+
value: function colon() {
|
|
85
|
+
var _colon = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
86
|
+
return this.useDecoratorProps({
|
|
87
|
+
colon: _colon
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "readOnly",
|
|
92
|
+
value: function readOnly() {
|
|
93
|
+
return this.assign({
|
|
94
|
+
readOnly: true
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}, {
|
|
98
|
+
key: "readPretty",
|
|
99
|
+
value: function readPretty() {
|
|
100
|
+
return this.assign({
|
|
101
|
+
'x-read-pretty': true
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: "useComponent",
|
|
106
|
+
value: function useComponent() {
|
|
107
|
+
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Input';
|
|
108
|
+
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
109
|
+
var componentSchema = {};
|
|
110
|
+
componentSchema['x-component'] = name;
|
|
111
|
+
if (props) {
|
|
112
|
+
componentSchema['x-component-props'] = props;
|
|
113
|
+
}
|
|
114
|
+
return this.assign(componentSchema);
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
key: "useProperties",
|
|
118
|
+
value: function useProperties() {
|
|
119
|
+
var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
120
|
+
return this.assign({
|
|
121
|
+
properties: properties
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
key: "useValidator",
|
|
126
|
+
value: function useValidator(validator) {
|
|
127
|
+
return this.assign({
|
|
128
|
+
'x-validator': validator
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
key: "useReactions",
|
|
133
|
+
value: function useReactions(fulfill) {
|
|
134
|
+
return this.merge({
|
|
135
|
+
'x-reactions': fulfill
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}, {
|
|
139
|
+
key: "useDependencies",
|
|
140
|
+
value: function useDependencies(dependencies) {
|
|
141
|
+
return this.merge({
|
|
142
|
+
'x-reactions': {
|
|
143
|
+
dependencies: dependencies
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}]);
|
|
148
|
+
return FormSchemaAdapter;
|
|
149
|
+
}(BasicAdapter);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var getLocale = function getLocale() {
|
|
2
|
+
var lang = navigator.cookieEnabled && typeof localStorage !== 'undefined' ? window.localStorage.getItem('locale') : '';
|
|
3
|
+
// support baseNavigator, default true
|
|
4
|
+
var isNavigatorLanguageValid = typeof navigator !== 'undefined' && typeof navigator.language === 'string';
|
|
5
|
+
var browserLang = isNavigatorLanguageValid ? navigator.language.split('-').join('-') : '';
|
|
6
|
+
return lang || browserLang || 'zh-CN';
|
|
7
|
+
};
|
|
8
|
+
export var getInfoByLocales = function getInfoByLocales(info, val) {
|
|
9
|
+
return info.replace('{n}', val);
|
|
10
|
+
};
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
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); } }
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
import ENV from "../constants/env";
|
|
11
|
+
import { debounce, isEqual, isFunction, set } from 'lodash';
|
|
12
|
+
import { makeObservable, observable, action as mAction } from 'mobx';
|
|
13
|
+
export var Action = /*#__PURE__*/_createClass(function Action(action) {
|
|
14
|
+
_classCallCheck(this, Action);
|
|
15
|
+
/**action的名字 */
|
|
16
|
+
_defineProperty(this, "title", void 0);
|
|
17
|
+
/**action对象的名字,即组件名 默认window */
|
|
18
|
+
// targetName: string;
|
|
19
|
+
/**执行action的对象 */
|
|
20
|
+
_defineProperty(this, "target", void 0);
|
|
21
|
+
/**action的方法 */
|
|
22
|
+
_defineProperty(this, "fn", void 0);
|
|
23
|
+
/**action提供外部访问的数据 */
|
|
24
|
+
_defineProperty(this, "data", void 0);
|
|
25
|
+
/**action类型 */
|
|
26
|
+
_defineProperty(this, "type", void 0);
|
|
27
|
+
/**对应target dataSet中的字段 */
|
|
28
|
+
_defineProperty(this, "dataKey", void 0);
|
|
29
|
+
/**处理params的方法 */
|
|
30
|
+
_defineProperty(this, "handlerParamsFn", void 0);
|
|
31
|
+
_defineProperty(this, "throttle", void 0);
|
|
32
|
+
_defineProperty(this, "debounced", void 0);
|
|
33
|
+
this.title = action.title;
|
|
34
|
+
// this.targetName = action.targetName || 'window';
|
|
35
|
+
this.target = action.target || window;
|
|
36
|
+
this.dataKey = action.dataKey;
|
|
37
|
+
this.type = action.type;
|
|
38
|
+
this.throttle = action === null || action === void 0 ? void 0 : action.throttle;
|
|
39
|
+
this.debounced = action.debounced;
|
|
40
|
+
this.fn = action.fn;
|
|
41
|
+
this.handlerParamsFn = action.handlerParamsFn;
|
|
42
|
+
if (this.debounced) {
|
|
43
|
+
this.fn = debounce(this.fn, this.debounced.waitTime);
|
|
44
|
+
}
|
|
45
|
+
this.data = action.data;
|
|
46
|
+
/**TODO
|
|
47
|
+
// this.when = action.when || null;
|
|
48
|
+
// this.on = action.on;
|
|
49
|
+
// this.target=action.target
|
|
50
|
+
// this.type=ation.type
|
|
51
|
+
// this.beforeComplete = action.beforeComplete;
|
|
52
|
+
// this.callback = action.callback;
|
|
53
|
+
// this.isCompleted = action.isCompleted || false;
|
|
54
|
+
// this.isStart = false;
|
|
55
|
+
// this.status = null;
|
|
56
|
+
// makeObservable(this, {
|
|
57
|
+
// title: observable,
|
|
58
|
+
// data: observable,
|
|
59
|
+
// // setData: mAction,
|
|
60
|
+
// // ref: observable,
|
|
61
|
+
// // isCompleted: observable,
|
|
62
|
+
// // isEditing: observable,
|
|
63
|
+
// });
|
|
64
|
+
*/
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// handlerParams(params) {
|
|
68
|
+
// switch (this.type) {
|
|
69
|
+
// case 'setDataSet':
|
|
70
|
+
// return [this.dataKey, params];
|
|
71
|
+
// default:
|
|
72
|
+
// return this.handlerParamsFn?.(params) || params;
|
|
73
|
+
// }
|
|
74
|
+
// }
|
|
75
|
+
|
|
76
|
+
// setData(data) {
|
|
77
|
+
// this.data = data;
|
|
78
|
+
// }
|
|
79
|
+
// run(params) {
|
|
80
|
+
// let res;
|
|
81
|
+
// if (this.fn) {
|
|
82
|
+
// res = this.fn.call(this.target, params);
|
|
83
|
+
// } else {
|
|
84
|
+
// res = this.target[this.type](params);
|
|
85
|
+
// }
|
|
86
|
+
// this.setData(res);
|
|
87
|
+
// if (this.dataKey) {
|
|
88
|
+
// this.target.setDataSet(this.dataKey, res);
|
|
89
|
+
// }
|
|
90
|
+
// return res;
|
|
91
|
+
// }
|
|
92
|
+
);
|
|
93
|
+
export var ActionTarget = /*#__PURE__*/function () {
|
|
94
|
+
function ActionTarget(parmas) {
|
|
95
|
+
_classCallCheck(this, ActionTarget);
|
|
96
|
+
/**action对象的名字,即组件名 默认window */
|
|
97
|
+
_defineProperty(this, "targetName", void 0);
|
|
98
|
+
/**执行action的对象 */
|
|
99
|
+
// _target: any;
|
|
100
|
+
// targets: ActionTargetsType | undefined;
|
|
101
|
+
/**action主体类型 window/scope */
|
|
102
|
+
_defineProperty(this, "type", void 0);
|
|
103
|
+
/**actions */
|
|
104
|
+
_defineProperty(this, "actions", {});
|
|
105
|
+
/**数据集 */
|
|
106
|
+
_defineProperty(this, "dataSet", void 0);
|
|
107
|
+
this.targetName = parmas.targetName;
|
|
108
|
+
this.type = parmas.type || 'scope';
|
|
109
|
+
this.dataSet = parmas.dataSet || {};
|
|
110
|
+
this.initActions(parmas.actionList);
|
|
111
|
+
makeObservable(this, {
|
|
112
|
+
actions: observable,
|
|
113
|
+
dataSet: observable,
|
|
114
|
+
register: mAction,
|
|
115
|
+
// target: computed,
|
|
116
|
+
// actionStore: computed,
|
|
117
|
+
setDataSet: mAction
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
_createClass(ActionTarget, [{
|
|
121
|
+
key: "initActions",
|
|
122
|
+
value: function initActions() {
|
|
123
|
+
var _this = this;
|
|
124
|
+
var actionList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
125
|
+
if (actionList) {
|
|
126
|
+
actionList.forEach(function (element) {
|
|
127
|
+
if (!element.type) {
|
|
128
|
+
throw Error("element.type is required");
|
|
129
|
+
}
|
|
130
|
+
if (!_this.getActionFun(element)) {
|
|
131
|
+
throw Error("element.type ".concat(element.type, " and element.fn is invalid"));
|
|
132
|
+
}
|
|
133
|
+
_this.actions[element.type] = new Action({
|
|
134
|
+
targetName: _this.targetName,
|
|
135
|
+
dataKey: element.dataKey,
|
|
136
|
+
// target: this,
|
|
137
|
+
type: element.type,
|
|
138
|
+
fn: element.fn
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
key: "getActionFun",
|
|
145
|
+
value: function getActionFun(action) {
|
|
146
|
+
var _this2 = this;
|
|
147
|
+
if (this.targetName === 'window') {
|
|
148
|
+
if (!window[action.type]) {
|
|
149
|
+
throw Error("window function ".concat(action.type, " is not exist"));
|
|
150
|
+
}
|
|
151
|
+
return window[action.type];
|
|
152
|
+
}
|
|
153
|
+
if (this[action.type]) {
|
|
154
|
+
return this[action.type];
|
|
155
|
+
}
|
|
156
|
+
if (action.fn) return action.fn;
|
|
157
|
+
// debugger;
|
|
158
|
+
return function () {
|
|
159
|
+
for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
160
|
+
arg[_key] = arguments[_key];
|
|
161
|
+
}
|
|
162
|
+
return _this2.setDataSet.apply(_this2, [action.dataKey].concat(arg));
|
|
163
|
+
};
|
|
164
|
+
// throw Error(`${this.targetName}'s action ${action.type} is invalid`);
|
|
165
|
+
}
|
|
166
|
+
// get actionStore() {
|
|
167
|
+
// return getActionStore();
|
|
168
|
+
// }
|
|
169
|
+
|
|
170
|
+
// get target() {
|
|
171
|
+
// if (this.targetName === 'window') {
|
|
172
|
+
// return window;
|
|
173
|
+
// }
|
|
174
|
+
// if (this.actionStore) {
|
|
175
|
+
// return this.actionStore.getTarget(this.targetName);
|
|
176
|
+
// }
|
|
177
|
+
// }
|
|
178
|
+
}, {
|
|
179
|
+
key: "setDataSet",
|
|
180
|
+
value: function setDataSet() {
|
|
181
|
+
for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
182
|
+
arg[_key2] = arguments[_key2];
|
|
183
|
+
}
|
|
184
|
+
if (arg.length === 1) {
|
|
185
|
+
var _arg$ = arg[0],
|
|
186
|
+
dataKey = _arg$.dataKey,
|
|
187
|
+
value = _arg$.value;
|
|
188
|
+
if (dataKey) {
|
|
189
|
+
if (isEqual(value, this.dataSet[dataKey])) {
|
|
190
|
+
console.log("".concat(dataKey, " value no change"), value);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
set(this.dataSet, dataKey, value);
|
|
194
|
+
} else {
|
|
195
|
+
this.dataSet = arg[0];
|
|
196
|
+
}
|
|
197
|
+
} else if (arg.length === 2) {
|
|
198
|
+
if (arg[0] === undefined) {
|
|
199
|
+
this.dataSet = arg[1];
|
|
200
|
+
} else {
|
|
201
|
+
set(this.dataSet, arg[0], arg[1]);
|
|
202
|
+
}
|
|
203
|
+
} else {
|
|
204
|
+
throw Error("setDataSet params error.".concat(arg));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}, {
|
|
208
|
+
key: "register",
|
|
209
|
+
value: function register(action) {
|
|
210
|
+
if (!action.type) {
|
|
211
|
+
throw Error('register action error');
|
|
212
|
+
}
|
|
213
|
+
if (!this.actions[action.type]) {
|
|
214
|
+
this.actions[action.type] = new Action(action);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}, {
|
|
218
|
+
key: "getAction",
|
|
219
|
+
value: function getAction(type) {
|
|
220
|
+
if (this.actions[type]) {
|
|
221
|
+
return this.actions[type];
|
|
222
|
+
}
|
|
223
|
+
throw Error("action name ".concat(type, " is not exist"));
|
|
224
|
+
}
|
|
225
|
+
}, {
|
|
226
|
+
key: "runAction",
|
|
227
|
+
value: function runAction(actionParmas, params) {
|
|
228
|
+
var paramsHandler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
229
|
+
var action = actionParmas.type ? actionParmas : this.getAction(actionParmas);
|
|
230
|
+
var arg = [isFunction(paramsHandler) ? paramsHandler(params) : params];
|
|
231
|
+
if (action.type !== 'setDataSet' && action.fn) {
|
|
232
|
+
arg.push({
|
|
233
|
+
actionTarget: this,
|
|
234
|
+
action: action
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
return this.getActionFun(action).apply(this, arg);
|
|
238
|
+
}
|
|
239
|
+
}]);
|
|
240
|
+
return ActionTarget;
|
|
241
|
+
}();
|
|
242
|
+
export var ActionStore = /*#__PURE__*/function () {
|
|
243
|
+
function ActionStore() {
|
|
244
|
+
_classCallCheck(this, ActionStore);
|
|
245
|
+
_defineProperty(this, "targets", void 0);
|
|
246
|
+
this.targets = _defineProperty({
|
|
247
|
+
window: new ActionTarget({
|
|
248
|
+
targetName: 'window',
|
|
249
|
+
// target: this,
|
|
250
|
+
actionList: [{
|
|
251
|
+
title: '打开窗口',
|
|
252
|
+
type: 'open'
|
|
253
|
+
}]
|
|
254
|
+
// ajax、link、url、drawer、dialog、confirm、cancel、prev、next、copy、close
|
|
255
|
+
})
|
|
256
|
+
}, ENV.namespace, new ActionTarget({
|
|
257
|
+
targetName: ENV.namespace,
|
|
258
|
+
actionList: [{
|
|
259
|
+
title: '打开详情',
|
|
260
|
+
type: 'lookUp',
|
|
261
|
+
fn: function fn(url) {
|
|
262
|
+
window.location.href = url;
|
|
263
|
+
// history.push(url);
|
|
264
|
+
}
|
|
265
|
+
}, {
|
|
266
|
+
title: '数据导出',
|
|
267
|
+
type: 'export',
|
|
268
|
+
fn: function fn() {}
|
|
269
|
+
}]
|
|
270
|
+
}));
|
|
271
|
+
makeObservable(this, {
|
|
272
|
+
targets: observable,
|
|
273
|
+
register: mAction
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
_createClass(ActionStore, [{
|
|
277
|
+
key: "register",
|
|
278
|
+
value: function register(actionTarget) {
|
|
279
|
+
if (!actionTarget.targetName) {
|
|
280
|
+
throw Error('register action error');
|
|
281
|
+
}
|
|
282
|
+
if (!this.targets[actionTarget.targetName]) {
|
|
283
|
+
// this.targets[action.name] = {};
|
|
284
|
+
this.targets[actionTarget.targetName] = new ActionTarget(_objectSpread(_objectSpread({}, actionTarget), {}, {
|
|
285
|
+
actionList: [{
|
|
286
|
+
type: 'setDataSet'
|
|
287
|
+
}].concat(actionTarget.actionList || [])
|
|
288
|
+
|
|
289
|
+
// targets: this,
|
|
290
|
+
}));
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}, {
|
|
294
|
+
key: "getTarget",
|
|
295
|
+
value: function getTarget(targetName) {
|
|
296
|
+
if (this.targets[targetName]) {
|
|
297
|
+
return this.targets[targetName];
|
|
298
|
+
}
|
|
299
|
+
throw Error("action name ".concat(targetName, " is not exist"));
|
|
300
|
+
}
|
|
301
|
+
}, {
|
|
302
|
+
key: "runTargetAction",
|
|
303
|
+
value: function runTargetAction(_ref) {
|
|
304
|
+
var _ref$targetName = _ref.targetName,
|
|
305
|
+
targetName = _ref$targetName === void 0 ? 'window' : _ref$targetName,
|
|
306
|
+
actionName = _ref.actionName,
|
|
307
|
+
params = _ref.params,
|
|
308
|
+
paramsHandler = _ref.paramsHandler;
|
|
309
|
+
var target = this.getTarget(targetName);
|
|
310
|
+
return target === null || target === void 0 ? void 0 : target.runAction(actionName, params, paramsHandler);
|
|
311
|
+
}
|
|
312
|
+
}]);
|
|
313
|
+
return ActionStore;
|
|
314
|
+
}();
|
|
315
|
+
// export const actionStore = new ActionStore();
|
|
316
|
+
// const getActionStore = () => actionStore;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
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); } }
|
|
3
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
4
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
import { createContext, useContext } from 'react';
|
|
9
|
+
import { ActionStore } from "./action";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
var RootStore = /*#__PURE__*/_createClass(function RootStore(initStore) {
|
|
12
|
+
_classCallCheck(this, RootStore);
|
|
13
|
+
_defineProperty(this, "actionStore", void 0);
|
|
14
|
+
Object.assign(this, initStore);
|
|
15
|
+
});
|
|
16
|
+
var rootStore = new RootStore({
|
|
17
|
+
actionStore: new ActionStore()
|
|
18
|
+
});
|
|
19
|
+
var RootStoreContext = /*#__PURE__*/createContext(rootStore);
|
|
20
|
+
export var RootStoreProvider = function RootStoreProvider(_ref) {
|
|
21
|
+
var children = _ref.children;
|
|
22
|
+
return /*#__PURE__*/_jsx(RootStoreContext.Provider, {
|
|
23
|
+
value: rootStore,
|
|
24
|
+
children: children
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export var useRootStore = function useRootStore() {
|
|
28
|
+
return useContext(RootStoreContext);
|
|
29
|
+
};
|
|
30
|
+
export var useActionStore = function useActionStore(actionTarget) {
|
|
31
|
+
var _useContext = useContext(RootStoreContext),
|
|
32
|
+
actionStore = _useContext.actionStore;
|
|
33
|
+
if (actionTarget) {
|
|
34
|
+
actionStore.register(actionTarget);
|
|
35
|
+
}
|
|
36
|
+
return actionStore;
|
|
37
|
+
};
|
|
38
|
+
export var useActionTargets = function useActionTargets(targetName) {
|
|
39
|
+
var actionStore = useActionStore();
|
|
40
|
+
if (targetName) {
|
|
41
|
+
return actionStore.getTarget(targetName);
|
|
42
|
+
}
|
|
43
|
+
return actionStore.targets;
|
|
44
|
+
};
|