@etsoo/materialui 1.4.67 → 1.4.69
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/__tests__/ComboBox.tsx +1 -7
- package/__tests__/tsconfig.json +1 -1
- package/lib/cjs/AddresSelector.js +141 -0
- package/lib/cjs/AuditDisplay.js +52 -0
- package/lib/cjs/AutocompleteExtendedProps.js +2 -0
- package/lib/cjs/BackButton.js +38 -0
- package/lib/cjs/BridgeCloseButton.js +35 -0
- package/lib/cjs/ButtonLink.js +22 -0
- package/lib/cjs/ButtonPopover.js +63 -0
- package/lib/cjs/ComboBox.js +134 -0
- package/lib/cjs/ComboBoxMultiple.js +132 -0
- package/lib/cjs/ComboBoxPro.js +71 -0
- package/lib/cjs/CountdownButton.js +91 -0
- package/lib/cjs/CountryList.js +29 -0
- package/lib/cjs/CultureDataTable.js +48 -0
- package/lib/cjs/CustomFabProps.js +2 -0
- package/lib/cjs/DataGridEx.js +333 -0
- package/lib/cjs/DataGridRenderers.js +105 -0
- package/lib/cjs/DataSteps.js +93 -0
- package/lib/cjs/DataTable.js +52 -0
- package/lib/cjs/DialogButton.js +43 -0
- package/lib/cjs/DnDList.js +222 -0
- package/lib/cjs/DraggablePaperComponent.js +19 -0
- package/lib/cjs/EmailInput.js +17 -0
- package/lib/cjs/FabBox.js +42 -0
- package/lib/cjs/FieldSetEx.js +32 -0
- package/lib/cjs/FileUploadButton.js +46 -0
- package/lib/cjs/FlexBox.js +22 -0
- package/lib/cjs/GridDataCacheType.js +2 -0
- package/lib/cjs/GridDataFormat.js +46 -0
- package/lib/cjs/GridUtils.js +90 -0
- package/lib/cjs/HiSelector.js +49 -0
- package/lib/cjs/HiSelectorTL.js +43 -0
- package/lib/cjs/IconButtonLink.js +19 -0
- package/lib/cjs/InputField.js +54 -0
- package/lib/cjs/InputTipField.js +50 -0
- package/lib/cjs/IntInputField.js +116 -0
- package/lib/cjs/ItemList.js +71 -0
- package/lib/{LineChart.d.ts → cjs/LineChart.d.ts} +1 -1
- package/lib/cjs/LineChart.js +59 -0
- package/lib/cjs/ListChooser.js +95 -0
- package/lib/cjs/ListItemRightIcon.js +11 -0
- package/lib/cjs/ListMoreDisplay.js +101 -0
- package/lib/cjs/LoadingButton.js +47 -0
- package/lib/cjs/MUGlobal.js +189 -0
- package/lib/cjs/MUUtils.js +58 -0
- package/lib/cjs/MaskInput.d.ts +40 -0
- package/lib/cjs/MaskInput.js +54 -0
- package/lib/cjs/MenuButton.js +68 -0
- package/lib/cjs/MobileListItemRenderer.js +33 -0
- package/lib/cjs/MoneyInputField.js +18 -0
- package/lib/cjs/MoreFab.js +100 -0
- package/lib/cjs/NotifierMU.js +368 -0
- package/lib/cjs/NotifierPopupProps.js +2 -0
- package/lib/cjs/NotifierPromptProps.js +2 -0
- package/lib/cjs/NumberInputField.js +32 -0
- package/lib/cjs/OptionBool.js +17 -0
- package/lib/cjs/OptionGroup.js +108 -0
- package/lib/cjs/OptionGroupFlag.js +92 -0
- package/lib/cjs/PList.js +19 -0
- package/lib/cjs/PercentCircularProgress.js +20 -0
- package/lib/cjs/PercentLinearProgress.js +11 -0
- package/lib/cjs/ProgressCount.js +79 -0
- package/lib/cjs/PullToRefreshUI.js +29 -0
- package/lib/cjs/QuickList.js +48 -0
- package/lib/cjs/RegionsRQ.js +2 -0
- package/lib/cjs/ResponsibleContainer.js +196 -0
- package/lib/cjs/ResponsiveStyleValue.js +2 -0
- package/lib/cjs/ScrollTopFab.js +30 -0
- package/lib/cjs/ScrollerListEx.js +168 -0
- package/lib/cjs/SearchBar.js +270 -0
- package/lib/cjs/SearchField.js +52 -0
- package/lib/cjs/SearchOptionGroup.js +17 -0
- package/lib/cjs/SelectBool.js +22 -0
- package/lib/cjs/SelectEx.js +180 -0
- package/lib/cjs/ShowDataComparison.js +63 -0
- package/lib/cjs/Switch.js +40 -0
- package/lib/cjs/SwitchAnt.js +48 -0
- package/lib/cjs/SwitchField.js +36 -0
- package/lib/cjs/TabBox.js +34 -0
- package/lib/{TableEx.d.ts → cjs/TableEx.d.ts} +1 -2
- package/lib/cjs/TableEx.js +294 -0
- package/lib/cjs/TagList.js +62 -0
- package/lib/cjs/TagListPro.js +66 -0
- package/lib/cjs/TextFieldEx.js +145 -0
- package/lib/cjs/Tiplist.js +211 -0
- package/lib/cjs/TiplistPro.js +206 -0
- package/lib/cjs/TooltipClick.js +46 -0
- package/lib/cjs/TwoFieldInput.js +69 -0
- package/lib/cjs/UserAvatar.js +26 -0
- package/lib/cjs/UserAvatarEditor.js +169 -0
- package/lib/cjs/app/CommonApp.js +32 -0
- package/lib/cjs/app/IServiceApp.js +11 -0
- package/lib/cjs/app/IServiceAppSettings.js +2 -0
- package/lib/cjs/app/IServicePage.js +2 -0
- package/lib/cjs/app/IServiceUser.js +2 -0
- package/lib/cjs/app/ISmartERPUser.js +2 -0
- package/lib/cjs/app/Labels.js +65 -0
- package/lib/cjs/app/ReactApp.js +387 -0
- package/lib/cjs/app/ServiceApp.js +232 -0
- package/lib/cjs/custom/CustomFieldUtils.js +152 -0
- package/lib/cjs/custom/CustomFieldViewer.js +57 -0
- package/lib/cjs/custom/CustomFieldWindow.js +95 -0
- package/lib/cjs/custom/FieldAmountLabel.js +47 -0
- package/lib/cjs/custom/FieldCheckbox.js +56 -0
- package/lib/cjs/custom/FieldCombobox.js +47 -0
- package/lib/cjs/custom/FieldDateInput.js +50 -0
- package/lib/cjs/custom/FieldDivider.js +19 -0
- package/lib/cjs/custom/FieldInput.js +34 -0
- package/lib/cjs/custom/FieldJson.js +57 -0
- package/lib/cjs/custom/FieldLabel.js +35 -0
- package/lib/cjs/custom/FieldNumberInput.js +44 -0
- package/lib/cjs/custom/FieldRadio.js +56 -0
- package/lib/cjs/custom/FieldSelect.js +55 -0
- package/lib/cjs/custom/FieldSwitch.js +49 -0
- package/lib/cjs/custom/FieldTexarea.js +35 -0
- package/lib/cjs/index.js +134 -0
- package/lib/cjs/messages/MessageUtils.js +76 -0
- package/lib/cjs/messages/OperationMessageContainer.js +49 -0
- package/lib/cjs/messages/OperationMessageDto.js +2 -0
- package/lib/cjs/messages/OperationMessageHandler.js +2 -0
- package/lib/cjs/messages/RefreshHandler.js +2 -0
- package/lib/cjs/messages/SignalRUser.js +2 -0
- package/lib/cjs/pages/CommonPage.js +64 -0
- package/lib/cjs/pages/DataGridPage.js +114 -0
- package/lib/cjs/pages/DataGridPageProps.js +2 -0
- package/lib/cjs/pages/DrawerHeader.js +16 -0
- package/lib/cjs/pages/EditPage.js +30 -0
- package/lib/cjs/pages/FixedListPage.js +104 -0
- package/lib/cjs/pages/LeftDrawer.js +37 -0
- package/lib/cjs/pages/ListPage.js +83 -0
- package/lib/cjs/pages/ResponsivePage.js +53 -0
- package/lib/cjs/pages/SearchPageProps.js +2 -0
- package/lib/cjs/pages/TablePage.js +72 -0
- package/lib/cjs/pages/UserMenu.js +91 -0
- package/lib/cjs/pages/ViewPage.js +160 -0
- package/lib/cjs/texts/DateText.js +28 -0
- package/lib/cjs/texts/MoneyText.js +19 -0
- package/lib/cjs/texts/NumberText.js +17 -0
- package/lib/mjs/AddresSelector.d.ts +107 -0
- package/lib/mjs/AuditDisplay.d.ts +31 -0
- package/lib/mjs/AutocompleteExtendedProps.d.ts +73 -0
- package/lib/mjs/BackButton.d.ts +12 -0
- package/lib/mjs/BridgeCloseButton.d.ts +22 -0
- package/lib/mjs/ButtonLink.d.ts +20 -0
- package/lib/mjs/ButtonPopover.d.ts +29 -0
- package/lib/mjs/ComboBox.d.ts +45 -0
- package/lib/mjs/ComboBoxMultiple.d.ts +41 -0
- package/lib/mjs/ComboBoxPro.d.ts +31 -0
- package/lib/mjs/CountdownButton.d.ts +27 -0
- package/lib/mjs/CountryList.d.ts +30 -0
- package/lib/mjs/CultureDataTable.d.ts +19 -0
- package/lib/mjs/CustomFabProps.d.ts +27 -0
- package/lib/mjs/DataGridEx.d.ts +101 -0
- package/lib/mjs/DataGridRenderers.d.ts +22 -0
- package/lib/mjs/DataSteps.d.ts +38 -0
- package/lib/mjs/DataTable.d.ts +27 -0
- package/lib/mjs/DialogButton.d.ts +54 -0
- package/lib/mjs/DnDList.d.ts +104 -0
- package/lib/mjs/DraggablePaperComponent.d.ts +7 -0
- package/lib/mjs/EmailInput.d.ts +10 -0
- package/lib/mjs/FabBox.d.ts +26 -0
- package/lib/mjs/FieldSetEx.d.ts +21 -0
- package/lib/mjs/FileUploadButton.d.ts +36 -0
- package/lib/mjs/FlexBox.d.ts +13 -0
- package/lib/mjs/GridDataCacheType.d.ts +9 -0
- package/lib/mjs/GridDataFormat.d.ts +10 -0
- package/lib/mjs/GridUtils.d.ts +44 -0
- package/lib/mjs/HiSelector.d.ts +79 -0
- package/lib/mjs/HiSelectorTL.d.ts +67 -0
- package/lib/mjs/IconButtonLink.d.ts +20 -0
- package/lib/mjs/InputField.d.ts +80 -0
- package/lib/mjs/InputTipField.d.ts +38 -0
- package/lib/mjs/IntInputField.d.ts +55 -0
- package/lib/mjs/ItemList.d.ts +68 -0
- package/lib/mjs/LineChart.d.ts +28 -0
- package/lib/{LineChart.js → mjs/LineChart.js} +2 -1
- package/lib/mjs/ListChooser.d.ts +64 -0
- package/lib/mjs/ListItemRightIcon.d.ts +5 -0
- package/lib/mjs/ListMoreDisplay.d.ts +38 -0
- package/lib/mjs/LoadingButton.d.ts +15 -0
- package/lib/mjs/MUGlobal.d.ts +101 -0
- package/lib/mjs/MUUtils.d.ts +22 -0
- package/lib/mjs/MaskInput.d.ts +40 -0
- package/lib/{MaskInput.js → mjs/MaskInput.js} +7 -1
- package/lib/mjs/MenuButton.d.ts +9 -0
- package/lib/mjs/MobileListItemRenderer.d.ts +17 -0
- package/lib/mjs/MoneyInputField.d.ts +10 -0
- package/lib/mjs/MoreFab.d.ts +45 -0
- package/lib/mjs/NotifierMU.d.ts +48 -0
- package/lib/mjs/NotifierPopupProps.d.ts +5 -0
- package/lib/mjs/NotifierPromptProps.d.ts +21 -0
- package/lib/mjs/NumberInputField.d.ts +42 -0
- package/lib/mjs/OptionBool.d.ts +12 -0
- package/lib/mjs/OptionGroup.d.ts +80 -0
- package/lib/mjs/OptionGroupFlag.d.ts +76 -0
- package/lib/mjs/PList.d.ts +14 -0
- package/lib/mjs/PercentCircularProgress.d.ts +7 -0
- package/lib/mjs/PercentLinearProgress.d.ts +7 -0
- package/lib/mjs/ProgressCount.d.ts +43 -0
- package/lib/mjs/PullToRefreshUI.d.ts +8 -0
- package/lib/mjs/QuickList.d.ts +56 -0
- package/lib/mjs/RegionsRQ.d.ts +22 -0
- package/lib/mjs/ResponsibleContainer.d.ts +98 -0
- package/lib/mjs/ResponsiveStyleValue.d.ts +7 -0
- package/lib/mjs/ScrollTopFab.d.ts +6 -0
- package/lib/mjs/ScrollerListEx.d.ts +75 -0
- package/lib/mjs/SearchBar.d.ts +32 -0
- package/lib/mjs/SearchField.d.ts +24 -0
- package/lib/mjs/SearchOptionGroup.d.ts +8 -0
- package/lib/mjs/SelectBool.d.ts +12 -0
- package/lib/mjs/SelectEx.d.ts +74 -0
- package/lib/mjs/ShowDataComparison.d.ts +15 -0
- package/lib/mjs/Switch.d.ts +28 -0
- package/lib/mjs/SwitchAnt.d.ts +24 -0
- package/lib/mjs/SwitchField.d.ts +45 -0
- package/lib/mjs/TabBox.d.ts +54 -0
- package/lib/mjs/TableEx.d.ts +64 -0
- package/lib/mjs/TagList.d.ts +21 -0
- package/lib/mjs/TagListPro.d.ts +22 -0
- package/lib/mjs/TextFieldEx.d.ts +157 -0
- package/lib/mjs/Tiplist.d.ts +29 -0
- package/lib/mjs/TiplistPro.d.ts +60 -0
- package/lib/mjs/TooltipClick.d.ts +15 -0
- package/lib/mjs/TwoFieldInput.d.ts +22 -0
- package/lib/mjs/UserAvatar.d.ts +23 -0
- package/lib/mjs/UserAvatarEditor.d.ts +60 -0
- package/lib/mjs/app/CommonApp.d.ts +21 -0
- package/lib/mjs/app/IServiceApp.d.ts +41 -0
- package/lib/mjs/app/IServiceAppSettings.d.ts +6 -0
- package/lib/mjs/app/IServicePage.d.ts +6 -0
- package/lib/mjs/app/IServiceUser.d.ts +42 -0
- package/lib/mjs/app/ISmartERPUser.d.ts +21 -0
- package/lib/mjs/app/Labels.d.ts +65 -0
- package/lib/mjs/app/ReactApp.d.ts +252 -0
- package/lib/mjs/app/ServiceApp.d.ts +76 -0
- package/lib/mjs/custom/CustomFieldUtils.d.ts +56 -0
- package/lib/mjs/custom/CustomFieldViewer.d.ts +50 -0
- package/lib/mjs/custom/CustomFieldWindow.d.ts +55 -0
- package/lib/mjs/custom/FieldAmountLabel.d.ts +7 -0
- package/lib/mjs/custom/FieldCheckbox.d.ts +8 -0
- package/lib/mjs/custom/FieldCombobox.d.ts +8 -0
- package/lib/mjs/custom/FieldDateInput.d.ts +7 -0
- package/lib/mjs/custom/FieldDivider.d.ts +7 -0
- package/lib/mjs/custom/FieldInput.d.ts +7 -0
- package/lib/mjs/custom/FieldJson.d.ts +7 -0
- package/lib/mjs/custom/FieldLabel.d.ts +7 -0
- package/lib/mjs/custom/FieldNumberInput.d.ts +7 -0
- package/lib/mjs/custom/FieldRadio.d.ts +8 -0
- package/lib/mjs/custom/FieldSelect.d.ts +8 -0
- package/lib/mjs/custom/FieldSwitch.d.ts +7 -0
- package/lib/mjs/custom/FieldTexarea.d.ts +7 -0
- package/lib/mjs/index.js +118 -0
- package/lib/mjs/messages/MessageUtils.d.ts +52 -0
- package/lib/mjs/messages/OperationMessageContainer.d.ts +24 -0
- package/lib/mjs/messages/OperationMessageDto.d.ts +26 -0
- package/lib/mjs/messages/OperationMessageHandler.d.ts +24 -0
- package/lib/mjs/messages/RefreshHandler.d.ts +5 -0
- package/lib/mjs/messages/SignalRUser.d.ts +31 -0
- package/lib/mjs/pages/CommonPage.d.ts +72 -0
- package/lib/mjs/pages/DataGridPage.d.ts +7 -0
- package/lib/mjs/pages/DataGridPageProps.d.ts +18 -0
- package/lib/mjs/pages/DrawerHeader.d.ts +4 -0
- package/lib/mjs/pages/EditPage.d.ts +46 -0
- package/lib/mjs/pages/FixedListPage.d.ts +14 -0
- package/lib/mjs/pages/LeftDrawer.d.ts +35 -0
- package/lib/mjs/pages/ListPage.d.ts +12 -0
- package/lib/mjs/pages/ResponsivePage.d.ts +56 -0
- package/lib/mjs/pages/SearchPageProps.d.ts +36 -0
- package/lib/mjs/pages/TablePage.d.ts +13 -0
- package/lib/mjs/pages/UserMenu.d.ts +40 -0
- package/lib/mjs/pages/ViewPage.d.ts +104 -0
- package/lib/{pages → mjs/pages}/ViewPage.js +1 -1
- package/lib/mjs/texts/DateText.d.ts +33 -0
- package/lib/mjs/texts/MoneyText.d.ts +20 -0
- package/lib/mjs/texts/NumberText.d.ts +24 -0
- package/package.json +17 -9
- package/src/LineChart.tsx +3 -3
- package/src/MaskInput.tsx +23 -10
- package/src/TableEx.tsx +1 -1
- package/src/pages/ViewPage.tsx +1 -1
- package/tsconfig.cjs.json +19 -0
- package/tsconfig.json +1 -1
- package/lib/MaskInput.d.ts +0 -34
- /package/lib/{AddresSelector.d.ts → cjs/AddresSelector.d.ts} +0 -0
- /package/lib/{AuditDisplay.d.ts → cjs/AuditDisplay.d.ts} +0 -0
- /package/lib/{AutocompleteExtendedProps.d.ts → cjs/AutocompleteExtendedProps.d.ts} +0 -0
- /package/lib/{BackButton.d.ts → cjs/BackButton.d.ts} +0 -0
- /package/lib/{BridgeCloseButton.d.ts → cjs/BridgeCloseButton.d.ts} +0 -0
- /package/lib/{ButtonLink.d.ts → cjs/ButtonLink.d.ts} +0 -0
- /package/lib/{ButtonPopover.d.ts → cjs/ButtonPopover.d.ts} +0 -0
- /package/lib/{ComboBox.d.ts → cjs/ComboBox.d.ts} +0 -0
- /package/lib/{ComboBoxMultiple.d.ts → cjs/ComboBoxMultiple.d.ts} +0 -0
- /package/lib/{ComboBoxPro.d.ts → cjs/ComboBoxPro.d.ts} +0 -0
- /package/lib/{CountdownButton.d.ts → cjs/CountdownButton.d.ts} +0 -0
- /package/lib/{CountryList.d.ts → cjs/CountryList.d.ts} +0 -0
- /package/lib/{CultureDataTable.d.ts → cjs/CultureDataTable.d.ts} +0 -0
- /package/lib/{CustomFabProps.d.ts → cjs/CustomFabProps.d.ts} +0 -0
- /package/lib/{DataGridEx.d.ts → cjs/DataGridEx.d.ts} +0 -0
- /package/lib/{DataGridRenderers.d.ts → cjs/DataGridRenderers.d.ts} +0 -0
- /package/lib/{DataSteps.d.ts → cjs/DataSteps.d.ts} +0 -0
- /package/lib/{DataTable.d.ts → cjs/DataTable.d.ts} +0 -0
- /package/lib/{DialogButton.d.ts → cjs/DialogButton.d.ts} +0 -0
- /package/lib/{DnDList.d.ts → cjs/DnDList.d.ts} +0 -0
- /package/lib/{DraggablePaperComponent.d.ts → cjs/DraggablePaperComponent.d.ts} +0 -0
- /package/lib/{EmailInput.d.ts → cjs/EmailInput.d.ts} +0 -0
- /package/lib/{FabBox.d.ts → cjs/FabBox.d.ts} +0 -0
- /package/lib/{FieldSetEx.d.ts → cjs/FieldSetEx.d.ts} +0 -0
- /package/lib/{FileUploadButton.d.ts → cjs/FileUploadButton.d.ts} +0 -0
- /package/lib/{FlexBox.d.ts → cjs/FlexBox.d.ts} +0 -0
- /package/lib/{GridDataCacheType.d.ts → cjs/GridDataCacheType.d.ts} +0 -0
- /package/lib/{GridDataFormat.d.ts → cjs/GridDataFormat.d.ts} +0 -0
- /package/lib/{GridUtils.d.ts → cjs/GridUtils.d.ts} +0 -0
- /package/lib/{HiSelector.d.ts → cjs/HiSelector.d.ts} +0 -0
- /package/lib/{HiSelectorTL.d.ts → cjs/HiSelectorTL.d.ts} +0 -0
- /package/lib/{IconButtonLink.d.ts → cjs/IconButtonLink.d.ts} +0 -0
- /package/lib/{InputField.d.ts → cjs/InputField.d.ts} +0 -0
- /package/lib/{InputTipField.d.ts → cjs/InputTipField.d.ts} +0 -0
- /package/lib/{IntInputField.d.ts → cjs/IntInputField.d.ts} +0 -0
- /package/lib/{ItemList.d.ts → cjs/ItemList.d.ts} +0 -0
- /package/lib/{ListChooser.d.ts → cjs/ListChooser.d.ts} +0 -0
- /package/lib/{ListItemRightIcon.d.ts → cjs/ListItemRightIcon.d.ts} +0 -0
- /package/lib/{ListMoreDisplay.d.ts → cjs/ListMoreDisplay.d.ts} +0 -0
- /package/lib/{LoadingButton.d.ts → cjs/LoadingButton.d.ts} +0 -0
- /package/lib/{MUGlobal.d.ts → cjs/MUGlobal.d.ts} +0 -0
- /package/lib/{MUUtils.d.ts → cjs/MUUtils.d.ts} +0 -0
- /package/lib/{MenuButton.d.ts → cjs/MenuButton.d.ts} +0 -0
- /package/lib/{MobileListItemRenderer.d.ts → cjs/MobileListItemRenderer.d.ts} +0 -0
- /package/lib/{MoneyInputField.d.ts → cjs/MoneyInputField.d.ts} +0 -0
- /package/lib/{MoreFab.d.ts → cjs/MoreFab.d.ts} +0 -0
- /package/lib/{NotifierMU.d.ts → cjs/NotifierMU.d.ts} +0 -0
- /package/lib/{NotifierPopupProps.d.ts → cjs/NotifierPopupProps.d.ts} +0 -0
- /package/lib/{NotifierPromptProps.d.ts → cjs/NotifierPromptProps.d.ts} +0 -0
- /package/lib/{NumberInputField.d.ts → cjs/NumberInputField.d.ts} +0 -0
- /package/lib/{OptionBool.d.ts → cjs/OptionBool.d.ts} +0 -0
- /package/lib/{OptionGroup.d.ts → cjs/OptionGroup.d.ts} +0 -0
- /package/lib/{OptionGroupFlag.d.ts → cjs/OptionGroupFlag.d.ts} +0 -0
- /package/lib/{PList.d.ts → cjs/PList.d.ts} +0 -0
- /package/lib/{PercentCircularProgress.d.ts → cjs/PercentCircularProgress.d.ts} +0 -0
- /package/lib/{PercentLinearProgress.d.ts → cjs/PercentLinearProgress.d.ts} +0 -0
- /package/lib/{ProgressCount.d.ts → cjs/ProgressCount.d.ts} +0 -0
- /package/lib/{PullToRefreshUI.d.ts → cjs/PullToRefreshUI.d.ts} +0 -0
- /package/lib/{QuickList.d.ts → cjs/QuickList.d.ts} +0 -0
- /package/lib/{RegionsRQ.d.ts → cjs/RegionsRQ.d.ts} +0 -0
- /package/lib/{ResponsibleContainer.d.ts → cjs/ResponsibleContainer.d.ts} +0 -0
- /package/lib/{ResponsiveStyleValue.d.ts → cjs/ResponsiveStyleValue.d.ts} +0 -0
- /package/lib/{ScrollTopFab.d.ts → cjs/ScrollTopFab.d.ts} +0 -0
- /package/lib/{ScrollerListEx.d.ts → cjs/ScrollerListEx.d.ts} +0 -0
- /package/lib/{SearchBar.d.ts → cjs/SearchBar.d.ts} +0 -0
- /package/lib/{SearchField.d.ts → cjs/SearchField.d.ts} +0 -0
- /package/lib/{SearchOptionGroup.d.ts → cjs/SearchOptionGroup.d.ts} +0 -0
- /package/lib/{SelectBool.d.ts → cjs/SelectBool.d.ts} +0 -0
- /package/lib/{SelectEx.d.ts → cjs/SelectEx.d.ts} +0 -0
- /package/lib/{ShowDataComparison.d.ts → cjs/ShowDataComparison.d.ts} +0 -0
- /package/lib/{Switch.d.ts → cjs/Switch.d.ts} +0 -0
- /package/lib/{SwitchAnt.d.ts → cjs/SwitchAnt.d.ts} +0 -0
- /package/lib/{SwitchField.d.ts → cjs/SwitchField.d.ts} +0 -0
- /package/lib/{TabBox.d.ts → cjs/TabBox.d.ts} +0 -0
- /package/lib/{TagList.d.ts → cjs/TagList.d.ts} +0 -0
- /package/lib/{TagListPro.d.ts → cjs/TagListPro.d.ts} +0 -0
- /package/lib/{TextFieldEx.d.ts → cjs/TextFieldEx.d.ts} +0 -0
- /package/lib/{Tiplist.d.ts → cjs/Tiplist.d.ts} +0 -0
- /package/lib/{TiplistPro.d.ts → cjs/TiplistPro.d.ts} +0 -0
- /package/lib/{TooltipClick.d.ts → cjs/TooltipClick.d.ts} +0 -0
- /package/lib/{TwoFieldInput.d.ts → cjs/TwoFieldInput.d.ts} +0 -0
- /package/lib/{UserAvatar.d.ts → cjs/UserAvatar.d.ts} +0 -0
- /package/lib/{UserAvatarEditor.d.ts → cjs/UserAvatarEditor.d.ts} +0 -0
- /package/lib/{app → cjs/app}/CommonApp.d.ts +0 -0
- /package/lib/{app → cjs/app}/IServiceApp.d.ts +0 -0
- /package/lib/{app → cjs/app}/IServiceAppSettings.d.ts +0 -0
- /package/lib/{app → cjs/app}/IServicePage.d.ts +0 -0
- /package/lib/{app → cjs/app}/IServiceUser.d.ts +0 -0
- /package/lib/{app → cjs/app}/ISmartERPUser.d.ts +0 -0
- /package/lib/{app → cjs/app}/Labels.d.ts +0 -0
- /package/lib/{app → cjs/app}/ReactApp.d.ts +0 -0
- /package/lib/{app → cjs/app}/ServiceApp.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/CustomFieldUtils.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/CustomFieldViewer.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/CustomFieldWindow.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldAmountLabel.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldCheckbox.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldCombobox.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldDateInput.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldDivider.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldInput.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldJson.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldLabel.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldNumberInput.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldRadio.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldSelect.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldSwitch.d.ts +0 -0
- /package/lib/{custom → cjs/custom}/FieldTexarea.d.ts +0 -0
- /package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/lib/{messages → cjs/messages}/MessageUtils.d.ts +0 -0
- /package/lib/{messages → cjs/messages}/OperationMessageContainer.d.ts +0 -0
- /package/lib/{messages → cjs/messages}/OperationMessageDto.d.ts +0 -0
- /package/lib/{messages → cjs/messages}/OperationMessageHandler.d.ts +0 -0
- /package/lib/{messages → cjs/messages}/RefreshHandler.d.ts +0 -0
- /package/lib/{messages → cjs/messages}/SignalRUser.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/CommonPage.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/DataGridPage.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/DataGridPageProps.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/DrawerHeader.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/EditPage.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/FixedListPage.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/LeftDrawer.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/ListPage.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/ResponsivePage.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/SearchPageProps.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/TablePage.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/UserMenu.d.ts +0 -0
- /package/lib/{pages → cjs/pages}/ViewPage.d.ts +0 -0
- /package/lib/{texts → cjs/texts}/DateText.d.ts +0 -0
- /package/lib/{texts → cjs/texts}/MoneyText.d.ts +0 -0
- /package/lib/{texts → cjs/texts}/NumberText.d.ts +0 -0
- /package/lib/{AddresSelector.js → mjs/AddresSelector.js} +0 -0
- /package/lib/{AuditDisplay.js → mjs/AuditDisplay.js} +0 -0
- /package/lib/{AutocompleteExtendedProps.js → mjs/AutocompleteExtendedProps.js} +0 -0
- /package/lib/{BackButton.js → mjs/BackButton.js} +0 -0
- /package/lib/{BridgeCloseButton.js → mjs/BridgeCloseButton.js} +0 -0
- /package/lib/{ButtonLink.js → mjs/ButtonLink.js} +0 -0
- /package/lib/{ButtonPopover.js → mjs/ButtonPopover.js} +0 -0
- /package/lib/{ComboBox.js → mjs/ComboBox.js} +0 -0
- /package/lib/{ComboBoxMultiple.js → mjs/ComboBoxMultiple.js} +0 -0
- /package/lib/{ComboBoxPro.js → mjs/ComboBoxPro.js} +0 -0
- /package/lib/{CountdownButton.js → mjs/CountdownButton.js} +0 -0
- /package/lib/{CountryList.js → mjs/CountryList.js} +0 -0
- /package/lib/{CultureDataTable.js → mjs/CultureDataTable.js} +0 -0
- /package/lib/{CustomFabProps.js → mjs/CustomFabProps.js} +0 -0
- /package/lib/{DataGridEx.js → mjs/DataGridEx.js} +0 -0
- /package/lib/{DataGridRenderers.js → mjs/DataGridRenderers.js} +0 -0
- /package/lib/{DataSteps.js → mjs/DataSteps.js} +0 -0
- /package/lib/{DataTable.js → mjs/DataTable.js} +0 -0
- /package/lib/{DialogButton.js → mjs/DialogButton.js} +0 -0
- /package/lib/{DnDList.js → mjs/DnDList.js} +0 -0
- /package/lib/{DraggablePaperComponent.js → mjs/DraggablePaperComponent.js} +0 -0
- /package/lib/{EmailInput.js → mjs/EmailInput.js} +0 -0
- /package/lib/{FabBox.js → mjs/FabBox.js} +0 -0
- /package/lib/{FieldSetEx.js → mjs/FieldSetEx.js} +0 -0
- /package/lib/{FileUploadButton.js → mjs/FileUploadButton.js} +0 -0
- /package/lib/{FlexBox.js → mjs/FlexBox.js} +0 -0
- /package/lib/{GridDataCacheType.js → mjs/GridDataCacheType.js} +0 -0
- /package/lib/{GridDataFormat.js → mjs/GridDataFormat.js} +0 -0
- /package/lib/{GridUtils.js → mjs/GridUtils.js} +0 -0
- /package/lib/{HiSelector.js → mjs/HiSelector.js} +0 -0
- /package/lib/{HiSelectorTL.js → mjs/HiSelectorTL.js} +0 -0
- /package/lib/{IconButtonLink.js → mjs/IconButtonLink.js} +0 -0
- /package/lib/{InputField.js → mjs/InputField.js} +0 -0
- /package/lib/{InputTipField.js → mjs/InputTipField.js} +0 -0
- /package/lib/{IntInputField.js → mjs/IntInputField.js} +0 -0
- /package/lib/{ItemList.js → mjs/ItemList.js} +0 -0
- /package/lib/{ListChooser.js → mjs/ListChooser.js} +0 -0
- /package/lib/{ListItemRightIcon.js → mjs/ListItemRightIcon.js} +0 -0
- /package/lib/{ListMoreDisplay.js → mjs/ListMoreDisplay.js} +0 -0
- /package/lib/{LoadingButton.js → mjs/LoadingButton.js} +0 -0
- /package/lib/{MUGlobal.js → mjs/MUGlobal.js} +0 -0
- /package/lib/{MUUtils.js → mjs/MUUtils.js} +0 -0
- /package/lib/{MenuButton.js → mjs/MenuButton.js} +0 -0
- /package/lib/{MobileListItemRenderer.js → mjs/MobileListItemRenderer.js} +0 -0
- /package/lib/{MoneyInputField.js → mjs/MoneyInputField.js} +0 -0
- /package/lib/{MoreFab.js → mjs/MoreFab.js} +0 -0
- /package/lib/{NotifierMU.js → mjs/NotifierMU.js} +0 -0
- /package/lib/{NotifierPopupProps.js → mjs/NotifierPopupProps.js} +0 -0
- /package/lib/{NotifierPromptProps.js → mjs/NotifierPromptProps.js} +0 -0
- /package/lib/{NumberInputField.js → mjs/NumberInputField.js} +0 -0
- /package/lib/{OptionBool.js → mjs/OptionBool.js} +0 -0
- /package/lib/{OptionGroup.js → mjs/OptionGroup.js} +0 -0
- /package/lib/{OptionGroupFlag.js → mjs/OptionGroupFlag.js} +0 -0
- /package/lib/{PList.js → mjs/PList.js} +0 -0
- /package/lib/{PercentCircularProgress.js → mjs/PercentCircularProgress.js} +0 -0
- /package/lib/{PercentLinearProgress.js → mjs/PercentLinearProgress.js} +0 -0
- /package/lib/{ProgressCount.js → mjs/ProgressCount.js} +0 -0
- /package/lib/{PullToRefreshUI.js → mjs/PullToRefreshUI.js} +0 -0
- /package/lib/{QuickList.js → mjs/QuickList.js} +0 -0
- /package/lib/{RegionsRQ.js → mjs/RegionsRQ.js} +0 -0
- /package/lib/{ResponsibleContainer.js → mjs/ResponsibleContainer.js} +0 -0
- /package/lib/{ResponsiveStyleValue.js → mjs/ResponsiveStyleValue.js} +0 -0
- /package/lib/{ScrollTopFab.js → mjs/ScrollTopFab.js} +0 -0
- /package/lib/{ScrollerListEx.js → mjs/ScrollerListEx.js} +0 -0
- /package/lib/{SearchBar.js → mjs/SearchBar.js} +0 -0
- /package/lib/{SearchField.js → mjs/SearchField.js} +0 -0
- /package/lib/{SearchOptionGroup.js → mjs/SearchOptionGroup.js} +0 -0
- /package/lib/{SelectBool.js → mjs/SelectBool.js} +0 -0
- /package/lib/{SelectEx.js → mjs/SelectEx.js} +0 -0
- /package/lib/{ShowDataComparison.js → mjs/ShowDataComparison.js} +0 -0
- /package/lib/{Switch.js → mjs/Switch.js} +0 -0
- /package/lib/{SwitchAnt.js → mjs/SwitchAnt.js} +0 -0
- /package/lib/{SwitchField.js → mjs/SwitchField.js} +0 -0
- /package/lib/{TabBox.js → mjs/TabBox.js} +0 -0
- /package/lib/{TableEx.js → mjs/TableEx.js} +0 -0
- /package/lib/{TagList.js → mjs/TagList.js} +0 -0
- /package/lib/{TagListPro.js → mjs/TagListPro.js} +0 -0
- /package/lib/{TextFieldEx.js → mjs/TextFieldEx.js} +0 -0
- /package/lib/{Tiplist.js → mjs/Tiplist.js} +0 -0
- /package/lib/{TiplistPro.js → mjs/TiplistPro.js} +0 -0
- /package/lib/{TooltipClick.js → mjs/TooltipClick.js} +0 -0
- /package/lib/{TwoFieldInput.js → mjs/TwoFieldInput.js} +0 -0
- /package/lib/{UserAvatar.js → mjs/UserAvatar.js} +0 -0
- /package/lib/{UserAvatarEditor.js → mjs/UserAvatarEditor.js} +0 -0
- /package/lib/{app → mjs/app}/CommonApp.js +0 -0
- /package/lib/{app → mjs/app}/IServiceApp.js +0 -0
- /package/lib/{app → mjs/app}/IServiceAppSettings.js +0 -0
- /package/lib/{app → mjs/app}/IServicePage.js +0 -0
- /package/lib/{app → mjs/app}/IServiceUser.js +0 -0
- /package/lib/{app → mjs/app}/ISmartERPUser.js +0 -0
- /package/lib/{app → mjs/app}/Labels.js +0 -0
- /package/lib/{app → mjs/app}/ReactApp.js +0 -0
- /package/lib/{app → mjs/app}/ServiceApp.js +0 -0
- /package/lib/{custom → mjs/custom}/CustomFieldUtils.js +0 -0
- /package/lib/{custom → mjs/custom}/CustomFieldViewer.js +0 -0
- /package/lib/{custom → mjs/custom}/CustomFieldWindow.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldAmountLabel.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldCheckbox.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldCombobox.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldDateInput.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldDivider.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldInput.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldJson.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldLabel.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldNumberInput.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldRadio.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldSelect.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldSwitch.js +0 -0
- /package/lib/{custom → mjs/custom}/FieldTexarea.js +0 -0
- /package/lib/{index.js → mjs/index.d.ts} +0 -0
- /package/lib/{messages → mjs/messages}/MessageUtils.js +0 -0
- /package/lib/{messages → mjs/messages}/OperationMessageContainer.js +0 -0
- /package/lib/{messages → mjs/messages}/OperationMessageDto.js +0 -0
- /package/lib/{messages → mjs/messages}/OperationMessageHandler.js +0 -0
- /package/lib/{messages → mjs/messages}/RefreshHandler.js +0 -0
- /package/lib/{messages → mjs/messages}/SignalRUser.js +0 -0
- /package/lib/{pages → mjs/pages}/CommonPage.js +0 -0
- /package/lib/{pages → mjs/pages}/DataGridPage.js +0 -0
- /package/lib/{pages → mjs/pages}/DataGridPageProps.js +0 -0
- /package/lib/{pages → mjs/pages}/DrawerHeader.js +0 -0
- /package/lib/{pages → mjs/pages}/EditPage.js +0 -0
- /package/lib/{pages → mjs/pages}/FixedListPage.js +0 -0
- /package/lib/{pages → mjs/pages}/LeftDrawer.js +0 -0
- /package/lib/{pages → mjs/pages}/ListPage.js +0 -0
- /package/lib/{pages → mjs/pages}/ResponsivePage.js +0 -0
- /package/lib/{pages → mjs/pages}/SearchPageProps.js +0 -0
- /package/lib/{pages → mjs/pages}/TablePage.js +0 -0
- /package/lib/{pages → mjs/pages}/UserMenu.js +0 -0
- /package/lib/{texts → mjs/texts}/DateText.js +0 -0
- /package/lib/{texts → mjs/texts}/MoneyText.js +0 -0
- /package/lib/{texts → mjs/texts}/NumberText.js +0 -0
- /package/{vite.config.ts → vite.config.mts} +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UserAvatarEditor = UserAvatarEditor;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const material_1 = require("@mui/material");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const RotateLeft_1 = __importDefault(require("@mui/icons-material/RotateLeft"));
|
|
11
|
+
const RotateRight_1 = __importDefault(require("@mui/icons-material/RotateRight"));
|
|
12
|
+
const ClearAll_1 = __importDefault(require("@mui/icons-material/ClearAll"));
|
|
13
|
+
const Image_1 = __importDefault(require("@mui/icons-material/Image"));
|
|
14
|
+
const Done_1 = __importDefault(require("@mui/icons-material/Done"));
|
|
15
|
+
const Remove_1 = __importDefault(require("@mui/icons-material/Remove"));
|
|
16
|
+
const Add_1 = __importDefault(require("@mui/icons-material/Add"));
|
|
17
|
+
const Labels_1 = require("./app/Labels");
|
|
18
|
+
const FileUploadButton_1 = require("./FileUploadButton");
|
|
19
|
+
const defaultSize = 300;
|
|
20
|
+
const defaultState = {
|
|
21
|
+
scale: 1,
|
|
22
|
+
rotate: 0
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* User avatar editor
|
|
26
|
+
* https://github.com/mosch/react-avatar-editor
|
|
27
|
+
* @param props Props
|
|
28
|
+
* @returns Component
|
|
29
|
+
*/
|
|
30
|
+
function UserAvatarEditor(props) {
|
|
31
|
+
// Labels
|
|
32
|
+
const labels = Labels_1.Labels.UserAvatarEditor;
|
|
33
|
+
// Destruct
|
|
34
|
+
const { border = 30, image, maxWidth, onDone, scaledResult = false, width = defaultSize, height = defaultSize, range = [0.1, 2, 0.1], selectFileLabel = labels.selectFile + "..." } = props;
|
|
35
|
+
// Container width
|
|
36
|
+
const containerWidth = width + 2 * border + 44 + 4;
|
|
37
|
+
// Calculated max width
|
|
38
|
+
const maxWidthCalculated = maxWidth == null || maxWidth < defaultSize ? 2 * width : maxWidth;
|
|
39
|
+
// Ref
|
|
40
|
+
const ref = react_1.default.createRef();
|
|
41
|
+
// Image type
|
|
42
|
+
const type = react_1.default.useRef("image/jpeg");
|
|
43
|
+
// Button ref
|
|
44
|
+
const buttonRef = react_1.default.createRef();
|
|
45
|
+
// Preview image state
|
|
46
|
+
const [previewImage, setPreviewImage] = react_1.default.useState(image);
|
|
47
|
+
react_1.default.useEffect(() => setPreviewImage(image), [image]);
|
|
48
|
+
// Is ready state
|
|
49
|
+
const [ready, setReady] = react_1.default.useState(false);
|
|
50
|
+
// Editor states
|
|
51
|
+
const [editorState, setEditorState] = react_1.default.useState(defaultState);
|
|
52
|
+
// Height
|
|
53
|
+
// noHeight: height is not set and will be updated dynamically
|
|
54
|
+
const noHeight = height <= 0;
|
|
55
|
+
const [localHeight, setHeight] = react_1.default.useState(noHeight ? defaultSize : height);
|
|
56
|
+
// Range
|
|
57
|
+
const [min, max, step] = range;
|
|
58
|
+
const marks = [
|
|
59
|
+
{
|
|
60
|
+
value: min,
|
|
61
|
+
label: min.toString()
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
value: max,
|
|
65
|
+
label: max.toString()
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
if (min < 1) {
|
|
69
|
+
marks.splice(1, 0, { value: 1, label: "1" });
|
|
70
|
+
}
|
|
71
|
+
// Handle zoom
|
|
72
|
+
const handleZoom = (_event, value, _activeThumb) => {
|
|
73
|
+
const scale = typeof value === "number" ? value : value[0];
|
|
74
|
+
setScale(scale);
|
|
75
|
+
};
|
|
76
|
+
const setScale = (scale) => {
|
|
77
|
+
const newState = { ...editorState, scale };
|
|
78
|
+
setEditorState(newState);
|
|
79
|
+
};
|
|
80
|
+
const adjustScale = (isAdd) => {
|
|
81
|
+
setScale(editorState.scale + (isAdd ? step : -step));
|
|
82
|
+
};
|
|
83
|
+
// Handle image load
|
|
84
|
+
const handleLoad = (imageInfo) => {
|
|
85
|
+
// Ignore too small images
|
|
86
|
+
if (imageInfo.resource.width < 10 || imageInfo.resource.height < 10)
|
|
87
|
+
return;
|
|
88
|
+
if (noHeight) {
|
|
89
|
+
setHeight((imageInfo.height * width) / imageInfo.width);
|
|
90
|
+
}
|
|
91
|
+
setReady(true);
|
|
92
|
+
};
|
|
93
|
+
// Handle file upload
|
|
94
|
+
const handleFileUpload = (files) => {
|
|
95
|
+
// Reset all settings
|
|
96
|
+
handleReset();
|
|
97
|
+
// Set new preview image
|
|
98
|
+
const file = files[0];
|
|
99
|
+
type.current = file.type;
|
|
100
|
+
setPreviewImage(file);
|
|
101
|
+
// Set ready state
|
|
102
|
+
setReady(false);
|
|
103
|
+
// Make the submit button visible
|
|
104
|
+
buttonRef.current?.scrollIntoView(false);
|
|
105
|
+
};
|
|
106
|
+
// Handle reset
|
|
107
|
+
const handleReset = () => {
|
|
108
|
+
setEditorState({ ...defaultState });
|
|
109
|
+
};
|
|
110
|
+
const resetUI = () => {
|
|
111
|
+
setReady(false);
|
|
112
|
+
setPreviewImage(undefined);
|
|
113
|
+
handleReset();
|
|
114
|
+
};
|
|
115
|
+
// Handle rotate
|
|
116
|
+
const handleRotate = (r) => {
|
|
117
|
+
let rotate = editorState.rotate + r;
|
|
118
|
+
if (rotate >= 360 || rotate <= -360)
|
|
119
|
+
rotate = 0;
|
|
120
|
+
const newState = { ...editorState, rotate };
|
|
121
|
+
setEditorState(newState);
|
|
122
|
+
};
|
|
123
|
+
// Handle done
|
|
124
|
+
const handleDone = async () => {
|
|
125
|
+
// Data
|
|
126
|
+
var data = scaledResult
|
|
127
|
+
? ref.current?.getImageScaledToCanvas()
|
|
128
|
+
: ref.current?.getImage();
|
|
129
|
+
if (data == null)
|
|
130
|
+
return;
|
|
131
|
+
// pica
|
|
132
|
+
const pica = (await import("pica")).default;
|
|
133
|
+
const picaInstance = pica();
|
|
134
|
+
// toBlob helper
|
|
135
|
+
// Convenience method, similar to canvas.toBlob(), but with promise interface & polyfill for old browsers.
|
|
136
|
+
const toBlob = (canvas, mimeType = type.current, quality = 1) => {
|
|
137
|
+
return picaInstance.toBlob(canvas, mimeType, quality);
|
|
138
|
+
};
|
|
139
|
+
if (data.width > maxWidthCalculated) {
|
|
140
|
+
// Target height
|
|
141
|
+
const heightCalculated = (localHeight * maxWidthCalculated) / width;
|
|
142
|
+
// Target
|
|
143
|
+
const to = document.createElement("canvas");
|
|
144
|
+
to.width = maxWidthCalculated;
|
|
145
|
+
to.height = heightCalculated;
|
|
146
|
+
// Large photo, resize it
|
|
147
|
+
// https://github.com/nodeca/pica
|
|
148
|
+
const canvas = await picaInstance.resize(data, to, {
|
|
149
|
+
unsharpAmount: 160,
|
|
150
|
+
unsharpRadius: 0.6,
|
|
151
|
+
unsharpThreshold: 1
|
|
152
|
+
});
|
|
153
|
+
const result = await onDone(canvas, toBlob, type.current);
|
|
154
|
+
if (result) {
|
|
155
|
+
resetUI();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
const result = await onDone(data, toBlob, type.current);
|
|
160
|
+
if (result) {
|
|
161
|
+
resetUI();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
// Load the component
|
|
166
|
+
const AE = react_1.default.lazy(() => import("react-avatar-editor"));
|
|
167
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "column", spacing: 0.5, width: containerWidth, children: [(0, jsx_runtime_1.jsx)(FileUploadButton_1.FileUploadButton, { variant: "outlined", size: "medium", startIcon: (0, jsx_runtime_1.jsx)(Image_1.default, {}), fullWidth: true, onUploadFiles: handleFileUpload, inputProps: { multiple: false, accept: "image/png, image/jpeg" }, children: selectFileLabel }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", spacing: 0.5, children: [(0, jsx_runtime_1.jsx)(react_1.default.Suspense, { fallback: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rounded", width: width, height: localHeight }), children: (0, jsx_runtime_1.jsx)(AE, { ref: ref, border: border, width: width, height: localHeight, onLoadSuccess: handleLoad, image: previewImage ??
|
|
168
|
+
"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", scale: editorState.scale, rotate: editorState.rotate }) }), (0, jsx_runtime_1.jsxs)(material_1.ButtonGroup, { size: "small", orientation: "vertical", disabled: !ready, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: () => handleRotate(90), title: labels.rotateRight, children: (0, jsx_runtime_1.jsx)(RotateRight_1.default, {}) }), (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: () => handleRotate(-90), title: labels.rotateLeft, children: (0, jsx_runtime_1.jsx)(RotateLeft_1.default, {}) }), (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: handleReset, title: labels.reset, children: (0, jsx_runtime_1.jsx)(ClearAll_1.default, {}) })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { spacing: 0.5, direction: "row", sx: { paddingBottom: 2 }, alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", disabled: !ready || editorState.scale <= min, onClick: () => adjustScale(false), children: (0, jsx_runtime_1.jsx)(Remove_1.default, {}) }), (0, jsx_runtime_1.jsx)(material_1.Slider, { title: labels.zoom, disabled: !ready, min: min, max: max, step: step, value: editorState.scale, valueLabelDisplay: "auto", valueLabelFormat: (value) => `${Math.round(100 * value) / 100}`, marks: marks, onChange: handleZoom }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", disabled: !ready || editorState.scale >= max, onClick: () => adjustScale(true), children: (0, jsx_runtime_1.jsx)(Add_1.default, {}) })] }), (0, jsx_runtime_1.jsx)(material_1.Button, { ref: buttonRef, variant: "contained", startIcon: (0, jsx_runtime_1.jsx)(Done_1.default, {}), disabled: !ready, onClick: handleDone, children: labels.done })] }));
|
|
169
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommonApp = void 0;
|
|
4
|
+
const react_1 = require("@etsoo/react");
|
|
5
|
+
const ReactApp_1 = require("./ReactApp");
|
|
6
|
+
/**
|
|
7
|
+
* Common independent application
|
|
8
|
+
* 通用独立程序
|
|
9
|
+
*/
|
|
10
|
+
class CommonApp extends ReactApp_1.ReactApp {
|
|
11
|
+
/**
|
|
12
|
+
* Constructor
|
|
13
|
+
* @param settings Settings
|
|
14
|
+
* @param name Application name
|
|
15
|
+
* @param debug Debug mode
|
|
16
|
+
*/
|
|
17
|
+
constructor(settings, name, debug = false) {
|
|
18
|
+
super(settings, name, debug);
|
|
19
|
+
// Add persisted fields
|
|
20
|
+
this.persistedFields.push(react_1.CoreConstants.FieldUserIdSaved);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Init call update fields in local storage
|
|
24
|
+
* @returns Fields
|
|
25
|
+
*/
|
|
26
|
+
initCallEncryptedUpdateFields() {
|
|
27
|
+
const fields = super.initCallEncryptedUpdateFields();
|
|
28
|
+
fields.push(react_1.CoreConstants.FieldUserIdSaved);
|
|
29
|
+
return fields;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.CommonApp = CommonApp;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ServiceAppContext = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
/**
|
|
9
|
+
* Service application context
|
|
10
|
+
*/
|
|
11
|
+
exports.ServiceAppContext = react_1.default.createContext(null);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Labels = void 0;
|
|
4
|
+
const shared_1 = require("@etsoo/shared");
|
|
5
|
+
/**
|
|
6
|
+
* Labels
|
|
7
|
+
*/
|
|
8
|
+
var Labels;
|
|
9
|
+
(function (Labels) {
|
|
10
|
+
/**
|
|
11
|
+
* Common page labels
|
|
12
|
+
*/
|
|
13
|
+
Labels.CommonPage = {
|
|
14
|
+
add: "Add",
|
|
15
|
+
back: "Back",
|
|
16
|
+
delete: "Delete",
|
|
17
|
+
more: "More",
|
|
18
|
+
pullToRefresh: "Pull down to refresh",
|
|
19
|
+
refresh: "Refresh",
|
|
20
|
+
refreshing: "Refreshing",
|
|
21
|
+
releaseToRefresh: "Release to refresh",
|
|
22
|
+
reset: "Reset",
|
|
23
|
+
save: "Save",
|
|
24
|
+
scrollTop: "Scroll to top",
|
|
25
|
+
submit: "Submit"
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Notification MU labels
|
|
29
|
+
*/
|
|
30
|
+
Labels.NotificationMU = {
|
|
31
|
+
alertTitle: "Warning",
|
|
32
|
+
alertOK: "OK",
|
|
33
|
+
confirmTitle: "Confirm",
|
|
34
|
+
confirmYes: "OK",
|
|
35
|
+
confirmNo: "Cancel",
|
|
36
|
+
promptTitle: "Input",
|
|
37
|
+
promptCancel: "Cancel",
|
|
38
|
+
promptOK: "OK",
|
|
39
|
+
loading: "Loading",
|
|
40
|
+
success: "Success",
|
|
41
|
+
warning: "Warning",
|
|
42
|
+
info: "Information"
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* UserAvatarEditor labels
|
|
46
|
+
*/
|
|
47
|
+
Labels.UserAvatarEditor = {
|
|
48
|
+
done: "Done",
|
|
49
|
+
reset: "Reset",
|
|
50
|
+
rotateLeft: "Rotate left 90°",
|
|
51
|
+
rotateRight: "Rotate right 90°",
|
|
52
|
+
selectFile: "Select file",
|
|
53
|
+
zoom: "Zoom"
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Set components' labels
|
|
57
|
+
* @param labels Labels
|
|
58
|
+
* @param reference Key reference
|
|
59
|
+
*/
|
|
60
|
+
Labels.setLabels = (labels, reference = {}) => {
|
|
61
|
+
shared_1.Utils.setLabels(Labels.CommonPage, labels, reference.commonPage);
|
|
62
|
+
shared_1.Utils.setLabels(Labels.NotificationMU, labels, reference.notificationMU);
|
|
63
|
+
shared_1.Utils.setLabels(Labels.UserAvatarEditor, labels, reference.userAvatarEditor);
|
|
64
|
+
};
|
|
65
|
+
})(Labels || (exports.Labels = Labels = {}));
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ReactApp = exports.globalApp = exports.ReactAppContext = void 0;
|
|
7
|
+
exports.ReactAppStateDetector = ReactAppStateDetector;
|
|
8
|
+
const appscript_1 = require("@etsoo/appscript");
|
|
9
|
+
const notificationbase_1 = require("@etsoo/notificationbase");
|
|
10
|
+
const shared_1 = require("@etsoo/shared");
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const NotifierMU_1 = require("../NotifierMU");
|
|
13
|
+
const ProgressCount_1 = require("../ProgressCount");
|
|
14
|
+
const Labels_1 = require("./Labels");
|
|
15
|
+
const react_2 = require("@etsoo/react");
|
|
16
|
+
/**
|
|
17
|
+
* React application context
|
|
18
|
+
*/
|
|
19
|
+
exports.ReactAppContext = react_1.default.createContext(null);
|
|
20
|
+
/**
|
|
21
|
+
* React app state detector
|
|
22
|
+
* Case 1: undefined, when refresh the whole page
|
|
23
|
+
* Case 2: false, unauthorized
|
|
24
|
+
* Case 3: true, authorized or considered as authorized (maynot, like token expiry)
|
|
25
|
+
* Case 4: property or properties changed
|
|
26
|
+
* @param props Props
|
|
27
|
+
* @returns Component
|
|
28
|
+
*/
|
|
29
|
+
function ReactAppStateDetector(props) {
|
|
30
|
+
// Destruct
|
|
31
|
+
const { targetFields, update } = props;
|
|
32
|
+
// Context
|
|
33
|
+
const { state } = exports.globalApp == null
|
|
34
|
+
? {}
|
|
35
|
+
: react_1.default.useContext(exports.globalApp.userState.context);
|
|
36
|
+
// Ready
|
|
37
|
+
react_1.default.useEffect(() => {
|
|
38
|
+
// Match fields
|
|
39
|
+
const changedFields = state.lastChangedFields;
|
|
40
|
+
let matchedFields;
|
|
41
|
+
if (targetFields == null || changedFields == null) {
|
|
42
|
+
matchedFields = changedFields;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
matchedFields = [];
|
|
46
|
+
targetFields.forEach((targetField) => {
|
|
47
|
+
if (changedFields.includes(targetField))
|
|
48
|
+
matchedFields?.push(targetField);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// Callback
|
|
52
|
+
update(state.authorized, matchedFields);
|
|
53
|
+
}, [state]);
|
|
54
|
+
// return
|
|
55
|
+
return react_1.default.createElement(react_1.default.Fragment);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* React application
|
|
59
|
+
*/
|
|
60
|
+
class ReactApp extends appscript_1.CoreApp {
|
|
61
|
+
static _notifierProvider;
|
|
62
|
+
/**
|
|
63
|
+
* Get notifier provider
|
|
64
|
+
*/
|
|
65
|
+
static get notifierProvider() {
|
|
66
|
+
return this._notifierProvider;
|
|
67
|
+
}
|
|
68
|
+
static createNotifier(debug) {
|
|
69
|
+
// Notifier
|
|
70
|
+
ReactApp._notifierProvider = NotifierMU_1.NotifierMU.setup(undefined, debug);
|
|
71
|
+
return NotifierMU_1.NotifierMU.instance;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Culture state
|
|
75
|
+
*/
|
|
76
|
+
cultureState;
|
|
77
|
+
/**
|
|
78
|
+
* Page state
|
|
79
|
+
*/
|
|
80
|
+
pageState;
|
|
81
|
+
/**
|
|
82
|
+
* User state
|
|
83
|
+
*/
|
|
84
|
+
userState = new react_2.UserState();
|
|
85
|
+
/**
|
|
86
|
+
* Is screen size down 'sm'
|
|
87
|
+
*/
|
|
88
|
+
smDown;
|
|
89
|
+
/**
|
|
90
|
+
* Is screen size up 'md'
|
|
91
|
+
*/
|
|
92
|
+
mdUp;
|
|
93
|
+
/**
|
|
94
|
+
* Navigate function
|
|
95
|
+
*/
|
|
96
|
+
navigateFunction;
|
|
97
|
+
/**
|
|
98
|
+
* Page state dispatch
|
|
99
|
+
*/
|
|
100
|
+
pageStateDispatch;
|
|
101
|
+
/**
|
|
102
|
+
* User state dispatch
|
|
103
|
+
*/
|
|
104
|
+
userStateDispatch;
|
|
105
|
+
/**
|
|
106
|
+
* Constructor
|
|
107
|
+
* @param settings Settings
|
|
108
|
+
* @param name Application name
|
|
109
|
+
* @param debug Debug mode
|
|
110
|
+
*/
|
|
111
|
+
constructor(settings, name, debug = false) {
|
|
112
|
+
super(settings, null, ReactApp.createNotifier(debug), new shared_1.WindowStorage(), name, debug);
|
|
113
|
+
if (appscript_1.BridgeUtils.host) {
|
|
114
|
+
appscript_1.BridgeUtils.host.onUpdate((app, version) => {
|
|
115
|
+
this.notifier.message(notificationbase_1.NotificationMessageType.Success, this.get("updateTip") + `(${[app, version].join(", ")})`, this.get("updateReady"));
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
this.cultureState = new react_2.CultureState(settings.currentCulture);
|
|
119
|
+
this.pageState = new react_2.PageState();
|
|
120
|
+
exports.globalApp = this;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Override alert action result
|
|
124
|
+
* @param result Action result
|
|
125
|
+
* @param callback Callback
|
|
126
|
+
* @param forceToLocal Force to local labels
|
|
127
|
+
*/
|
|
128
|
+
alertResult(result, callback, forceToLocal) {
|
|
129
|
+
const message = typeof result === "string"
|
|
130
|
+
? result
|
|
131
|
+
: this.formatResult(result, forceToLocal);
|
|
132
|
+
if (message.endsWith(")")) {
|
|
133
|
+
const startPos = message.lastIndexOf("(");
|
|
134
|
+
if (startPos > 0) {
|
|
135
|
+
const main = message.substring(0, startPos).trim();
|
|
136
|
+
const tip = message.substring(startPos);
|
|
137
|
+
const titleNode = react_1.default.createElement(react_1.default.Fragment, null, main, react_1.default.createElement("br"), react_1.default.createElement("span", { style: { fontSize: "9px" } }, tip));
|
|
138
|
+
this.notifier.alert(titleNode, callback);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
super.alertResult(message, callback);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Change culture
|
|
146
|
+
* @param culture New culture definition
|
|
147
|
+
*/
|
|
148
|
+
async changeCulture(culture) {
|
|
149
|
+
// Super call to update cultrue
|
|
150
|
+
const resources = await super.changeCulture(culture);
|
|
151
|
+
// Update component labels
|
|
152
|
+
Labels_1.Labels.setLabels(resources, {
|
|
153
|
+
notificationMU: {
|
|
154
|
+
alertTitle: "warning",
|
|
155
|
+
alertOK: "ok",
|
|
156
|
+
confirmTitle: "confirm",
|
|
157
|
+
confirmYes: "ok",
|
|
158
|
+
confirmNo: "cancel",
|
|
159
|
+
promptTitle: "prompt",
|
|
160
|
+
promptCancel: "cancel",
|
|
161
|
+
promptOK: "ok"
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
// Document title
|
|
165
|
+
// Default is servier name's label or appName label
|
|
166
|
+
const title = this.get(this.name) ?? this.get("appName") ?? this.name;
|
|
167
|
+
const host = appscript_1.BridgeUtils.host;
|
|
168
|
+
if (host) {
|
|
169
|
+
// Notify host
|
|
170
|
+
host.changeCulture(culture.name);
|
|
171
|
+
host.setTitle(title);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
document.title = title;
|
|
175
|
+
}
|
|
176
|
+
return resources;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Change culture extended
|
|
180
|
+
* @param dispatch Dispatch method
|
|
181
|
+
* @param culture New culture definition
|
|
182
|
+
*/
|
|
183
|
+
changeCultureEx(dispatch, culture) {
|
|
184
|
+
// Same?
|
|
185
|
+
if (culture.name === this.culture)
|
|
186
|
+
return;
|
|
187
|
+
// Super call
|
|
188
|
+
this.changeCulture(culture).then(() => {
|
|
189
|
+
// Dispatch action
|
|
190
|
+
dispatch(culture);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get date format props
|
|
195
|
+
* @returns Props
|
|
196
|
+
*/
|
|
197
|
+
getDateFormatProps() {
|
|
198
|
+
return { culture: this.culture, timeZone: this.getTimeZone() };
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Get money format props
|
|
202
|
+
* @param currency Currency, if undefined, default currency applied
|
|
203
|
+
* @returns Props
|
|
204
|
+
*/
|
|
205
|
+
getMoneyFormatProps(currency) {
|
|
206
|
+
return { culture: this.culture, currency: currency ?? this.currency };
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Fresh countdown UI
|
|
210
|
+
* @param callback Callback
|
|
211
|
+
*/
|
|
212
|
+
freshCountdownUI(callback) {
|
|
213
|
+
// Labels
|
|
214
|
+
const labels = this.getLabels("cancel", "tokenExpiry");
|
|
215
|
+
// Progress
|
|
216
|
+
const progress = react_1.default.createElement(ProgressCount_1.ProgressCount, {
|
|
217
|
+
seconds: 30,
|
|
218
|
+
valueUnit: "s",
|
|
219
|
+
onComplete: () => {
|
|
220
|
+
// Stop the progress
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
// Popup
|
|
225
|
+
this.notifier.alert(labels.tokenExpiry, async () => {
|
|
226
|
+
if (callback)
|
|
227
|
+
await callback();
|
|
228
|
+
else
|
|
229
|
+
await this.tryLogin();
|
|
230
|
+
}, undefined, {
|
|
231
|
+
okLabel: labels.cancel,
|
|
232
|
+
primaryButtonProps: { fullWidth: true, autoFocus: false },
|
|
233
|
+
inputs: progress
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Try login
|
|
238
|
+
* @param data Try login parameters
|
|
239
|
+
* @returns Result
|
|
240
|
+
*/
|
|
241
|
+
async tryLogin(data) {
|
|
242
|
+
// Destruct
|
|
243
|
+
const { onFailure = (type) => {
|
|
244
|
+
console.log(`Try login failed: ${type}.`);
|
|
245
|
+
this.toLoginPage(rest);
|
|
246
|
+
}, onSuccess, ...rest } = data ?? {};
|
|
247
|
+
// Check status
|
|
248
|
+
const result = await super.tryLogin(data);
|
|
249
|
+
if (!result) {
|
|
250
|
+
onFailure("ReactAppSuperTryLoginFailed");
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
// Refresh token
|
|
254
|
+
await this.refreshToken({
|
|
255
|
+
showLoading: data?.showLoading
|
|
256
|
+
}, (result) => {
|
|
257
|
+
if (result === true) {
|
|
258
|
+
onSuccess?.();
|
|
259
|
+
}
|
|
260
|
+
else if (result === false) {
|
|
261
|
+
onFailure("ReactAppRefreshTokenFailed");
|
|
262
|
+
}
|
|
263
|
+
else if (result != null && !this.tryLoginIgnoreResult(result)) {
|
|
264
|
+
onFailure("ReactAppRefreshTokenFailed: " + JSON.stringify(result));
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
// Ignore other results
|
|
268
|
+
onFailure("ReactAppRefreshTokenIgnoredFailure: " + JSON.stringify(result));
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Check if the action result should be ignored during try login
|
|
276
|
+
* @param result Action result
|
|
277
|
+
* @returns Result
|
|
278
|
+
*/
|
|
279
|
+
tryLoginIgnoreResult(result) {
|
|
280
|
+
// Ignore no token warning
|
|
281
|
+
if (result.type === "noData" && result.field === "token")
|
|
282
|
+
return true;
|
|
283
|
+
else
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Set page data
|
|
288
|
+
* @param data Page data
|
|
289
|
+
*/
|
|
290
|
+
setPageData(data) {
|
|
291
|
+
// Dispatch the change
|
|
292
|
+
if (this.pageStateDispatch != null) {
|
|
293
|
+
this.pageStateDispatch({
|
|
294
|
+
type: react_2.PageActionType.Data,
|
|
295
|
+
data
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Set page title and subtitle
|
|
301
|
+
* @param title Page title
|
|
302
|
+
* @param subtitle Page subtitle
|
|
303
|
+
*/
|
|
304
|
+
setPageTitle(title, subtitle) {
|
|
305
|
+
// Data
|
|
306
|
+
const data = { title, subtitle };
|
|
307
|
+
// Dispatch the change
|
|
308
|
+
if (this.pageStateDispatch != null) {
|
|
309
|
+
this.pageStateDispatch({
|
|
310
|
+
type: react_2.PageActionType.Title,
|
|
311
|
+
data
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Navigate to Url or delta
|
|
317
|
+
* @param url Url or delta
|
|
318
|
+
* @param options Options
|
|
319
|
+
*/
|
|
320
|
+
navigate(to, options) {
|
|
321
|
+
if (this.navigateFunction == null)
|
|
322
|
+
super.navigate(to, options);
|
|
323
|
+
else if (typeof to === "number")
|
|
324
|
+
this.navigateFunction(to);
|
|
325
|
+
else
|
|
326
|
+
this.navigateFunction(to, options);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Set page title and data
|
|
330
|
+
* @param key Page title resource key
|
|
331
|
+
*/
|
|
332
|
+
setPageKey(key) {
|
|
333
|
+
this.setPageTitle(this.get(key) ?? "");
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Show input dialog
|
|
337
|
+
* @param props Props
|
|
338
|
+
*/
|
|
339
|
+
showInputDialog({ title, message, callback, ...rest }) {
|
|
340
|
+
return this.notifier.prompt(message, callback, title, rest);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* User login extended
|
|
344
|
+
* @param user New user
|
|
345
|
+
* @param refreshToken Refresh token
|
|
346
|
+
* @param dispatch User state dispatch
|
|
347
|
+
*/
|
|
348
|
+
userLogin(user, refreshToken, dispatch) {
|
|
349
|
+
// Super call, set token
|
|
350
|
+
super.userLogin(user, refreshToken);
|
|
351
|
+
// Dispatch action
|
|
352
|
+
if (this.userStateDispatch != null && dispatch !== false)
|
|
353
|
+
this.userStateDispatch({
|
|
354
|
+
type: react_2.UserActionType.Login,
|
|
355
|
+
user
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* User logout
|
|
360
|
+
* @param clearToken Clear refresh token or not
|
|
361
|
+
* @param noTrigger No trigger for state change
|
|
362
|
+
*/
|
|
363
|
+
userLogout(clearToken = true, noTrigger = false) {
|
|
364
|
+
// Super call
|
|
365
|
+
super.userLogout(clearToken);
|
|
366
|
+
// Dispatch action
|
|
367
|
+
if (!noTrigger && this.userStateDispatch != null)
|
|
368
|
+
this.userStateDispatch({
|
|
369
|
+
type: react_2.UserActionType.Logout
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* User unauthorized
|
|
374
|
+
*/
|
|
375
|
+
userUnauthorized() {
|
|
376
|
+
// Super call
|
|
377
|
+
super.userUnauthorized();
|
|
378
|
+
if (this.userStateDispatch != null) {
|
|
379
|
+
// There is delay during state update
|
|
380
|
+
// Not a good idea to try login multiple times with API calls
|
|
381
|
+
this.userStateDispatch({
|
|
382
|
+
type: react_2.UserActionType.Unauthorized
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
exports.ReactApp = ReactApp;
|