@etsoo/materialui 1.4.68 → 1.4.70
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/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 +39 -0
- package/lib/cjs/MaskInput.js +47 -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/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 +74 -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 +39 -0
- package/lib/mjs/MaskInput.js +41 -0
- 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/{pages → mjs/pages}/CommonPage.js +16 -6
- 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 +12 -6
- package/src/LineChart.tsx +3 -3
- package/src/MaskInput.tsx +30 -27
- package/src/pages/CommonPage.tsx +17 -4
- 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/MaskInput.js +0 -42
- /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/{TableEx.d.ts → cjs/TableEx.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}/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
|
@@ -0,0 +1,141 @@
|
|
|
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.AddressField = void 0;
|
|
7
|
+
exports.AddressSelector = AddressSelector;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const material_1 = require("@mui/material");
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
const ReactApp_1 = require("./app/ReactApp");
|
|
12
|
+
const ComboBox_1 = require("./ComboBox");
|
|
13
|
+
const Tiplist_1 = require("./Tiplist");
|
|
14
|
+
/**
|
|
15
|
+
* Address field
|
|
16
|
+
*/
|
|
17
|
+
var AddressField;
|
|
18
|
+
(function (AddressField) {
|
|
19
|
+
AddressField["Region"] = "region";
|
|
20
|
+
AddressField["State"] = "state";
|
|
21
|
+
AddressField["City"] = "city";
|
|
22
|
+
AddressField["District"] = "district";
|
|
23
|
+
})(AddressField || (exports.AddressField = AddressField = {}));
|
|
24
|
+
/**
|
|
25
|
+
* Address selector
|
|
26
|
+
* @param props Props
|
|
27
|
+
*/
|
|
28
|
+
function AddressSelector(props) {
|
|
29
|
+
// Labels
|
|
30
|
+
const { city: cityDefault = "City", district: districtDefault = "District", region: regionDefault = "Region", state: stateDefault = "State" } = ReactApp_1.globalApp?.getLabels("region", "state", "city", "district") ?? {};
|
|
31
|
+
// Destruct
|
|
32
|
+
const { api, city, cityLabel = cityDefault, district, districtLabel = districtDefault, error, favoredIds, helperText, hideRegion, label, onChange, region, regionLabel = regionDefault, required, search, state, stateLabel = stateDefault, breakPoints = { xs: 12, md: 6, lg: hideRegion ? 4 : 3 } } = props;
|
|
33
|
+
const isMounted = react_1.default.useRef(true);
|
|
34
|
+
react_1.default.useEffect(() => () => {
|
|
35
|
+
isMounted.current = false;
|
|
36
|
+
}, []);
|
|
37
|
+
// States
|
|
38
|
+
const [regionState, setRegion] = react_1.default.useState(region);
|
|
39
|
+
const [stateState, setState] = react_1.default.useState(state);
|
|
40
|
+
const [cityState, setCity] = react_1.default.useState(city);
|
|
41
|
+
const [districtState, setDistrict] = react_1.default.useState(district);
|
|
42
|
+
react_1.default.useEffect(() => setRegion(region), [region]);
|
|
43
|
+
react_1.default.useEffect(() => setState(state), [state]);
|
|
44
|
+
react_1.default.useEffect(() => setCity(city), [city]);
|
|
45
|
+
react_1.default.useEffect(() => setDistrict(district), [district]);
|
|
46
|
+
const [states, setStates] = react_1.default.useState([]);
|
|
47
|
+
const [cities, setCities] = react_1.default.useState([]);
|
|
48
|
+
const [districts, setDistricts] = react_1.default.useState([]);
|
|
49
|
+
react_1.default.useEffect(() => {
|
|
50
|
+
if (regionState == null)
|
|
51
|
+
setStates([]);
|
|
52
|
+
else
|
|
53
|
+
api
|
|
54
|
+
.states(regionState, favoredIds == null ? undefined : favoredIds(AddressField.State))
|
|
55
|
+
.then((items) => {
|
|
56
|
+
if (items == null || !isMounted.current)
|
|
57
|
+
return;
|
|
58
|
+
setStates(items);
|
|
59
|
+
});
|
|
60
|
+
}, [regionState]);
|
|
61
|
+
react_1.default.useEffect(() => {
|
|
62
|
+
if (stateState == null)
|
|
63
|
+
setCities([]);
|
|
64
|
+
else
|
|
65
|
+
api
|
|
66
|
+
.cities(stateState, favoredIds == null ? undefined : favoredIds(AddressField.City))
|
|
67
|
+
.then((items) => {
|
|
68
|
+
if (items == null || !isMounted.current)
|
|
69
|
+
return;
|
|
70
|
+
setCities(items);
|
|
71
|
+
});
|
|
72
|
+
}, [stateState]);
|
|
73
|
+
react_1.default.useEffect(() => {
|
|
74
|
+
if (cityState == null)
|
|
75
|
+
setDistricts([]);
|
|
76
|
+
else
|
|
77
|
+
api
|
|
78
|
+
.districts(cityState, favoredIds == null ? undefined : favoredIds(AddressField.District))
|
|
79
|
+
.then((items) => {
|
|
80
|
+
if (items == null || !isMounted.current)
|
|
81
|
+
return;
|
|
82
|
+
setDistricts(items);
|
|
83
|
+
});
|
|
84
|
+
}, [cityState]);
|
|
85
|
+
// Handle field change
|
|
86
|
+
const handleChange = (event) => {
|
|
87
|
+
if (!isMounted.current)
|
|
88
|
+
return;
|
|
89
|
+
if (onChange)
|
|
90
|
+
onChange(event);
|
|
91
|
+
const [field, data] = event;
|
|
92
|
+
if (field === AddressField.Region) {
|
|
93
|
+
if (data == null) {
|
|
94
|
+
setRegion(undefined);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
setRegion(data.id);
|
|
98
|
+
}
|
|
99
|
+
setState(undefined);
|
|
100
|
+
setCity(undefined);
|
|
101
|
+
setDistrict(undefined);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (field === AddressField.State) {
|
|
105
|
+
if (data == null) {
|
|
106
|
+
setState(undefined);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
setState(data.id);
|
|
110
|
+
}
|
|
111
|
+
setCity(undefined);
|
|
112
|
+
setDistrict(undefined);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (field === AddressField.City) {
|
|
116
|
+
if (data == null) {
|
|
117
|
+
setCity(undefined);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
setCity(data.id);
|
|
121
|
+
}
|
|
122
|
+
setDistrict(undefined);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (data == null) {
|
|
126
|
+
setDistrict(undefined);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
setDistrict(data.id);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
// Layout
|
|
133
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [label && ((0, jsx_runtime_1.jsx)(material_1.Grid2, { size: { xs: 12 }, children: (0, jsx_runtime_1.jsx)(material_1.FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption }, children: label }) })), !hideRegion && ((0, jsx_runtime_1.jsx)(material_1.Grid2, { size: breakPoints, children: (0, jsx_runtime_1.jsx)(Tiplist_1.Tiplist, { label: regionLabel, name: AddressField.Region, search: search, fullWidth: true, idValue: regionState, loadData: (keyword, id, items) => api.regions({
|
|
134
|
+
keyword,
|
|
135
|
+
id,
|
|
136
|
+
items,
|
|
137
|
+
favoredIds: favoredIds == null
|
|
138
|
+
? undefined
|
|
139
|
+
: favoredIds(AddressField.Region)
|
|
140
|
+
}), inputRequired: required, inputError: error, inputHelperText: helperText, onChange: (_event, value) => handleChange([AddressField.Region, value]) }) })), (0, jsx_runtime_1.jsx)(material_1.Grid2, { size: breakPoints, children: (0, jsx_runtime_1.jsx)(ComboBox_1.ComboBox, { name: AddressField.State, label: stateLabel, search: search, fullWidth: true, idValue: stateState, options: states, inputRequired: required, inputError: hideRegion ? error : undefined, inputHelperText: hideRegion ? helperText : undefined, onChange: (_event, value) => handleChange([AddressField.State, value]) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid2, { size: breakPoints, children: (0, jsx_runtime_1.jsx)(ComboBox_1.ComboBox, { name: AddressField.City, label: cityLabel, search: search, fullWidth: true, idValue: cityState, options: cities, onChange: (_event, value) => handleChange([AddressField.City, value]) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid2, { size: breakPoints, children: (0, jsx_runtime_1.jsx)(ComboBox_1.ComboBox, { name: AddressField.District, label: districtLabel, search: search, fullWidth: true, idValue: districtState, options: districts, onChange: (_event, value) => handleChange([AddressField.District, value]) }) })] }));
|
|
141
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
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.AuditDisplay = AuditDisplay;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const shared_1 = require("@etsoo/shared");
|
|
9
|
+
const material_1 = require("@mui/material");
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
const ReactApp_1 = require("./app/ReactApp");
|
|
12
|
+
const ListMoreDisplay_1 = require("./ListMoreDisplay");
|
|
13
|
+
const ShowDataComparison_1 = require("./ShowDataComparison");
|
|
14
|
+
// Get label
|
|
15
|
+
const getLabel = (key) => {
|
|
16
|
+
return ReactApp_1.globalApp?.get(shared_1.Utils.formatInitial(key)) ?? key;
|
|
17
|
+
};
|
|
18
|
+
// Format date
|
|
19
|
+
const formatDate = (date) => {
|
|
20
|
+
if (ReactApp_1.globalApp)
|
|
21
|
+
return ReactApp_1.globalApp.formatDate(date, "ds");
|
|
22
|
+
return date.toUTCString();
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Audit display
|
|
26
|
+
* @param props Props
|
|
27
|
+
* @returns Component
|
|
28
|
+
*/
|
|
29
|
+
function AuditDisplay(props) {
|
|
30
|
+
// Theme
|
|
31
|
+
const theme = (0, material_1.useTheme)();
|
|
32
|
+
// Title
|
|
33
|
+
var title = getLabel("dataComparison");
|
|
34
|
+
// Destruct
|
|
35
|
+
const { getItemStyle = (index, theme) => ({
|
|
36
|
+
padding: [theme.spacing(1.5), theme.spacing(1)].join(" "),
|
|
37
|
+
background: index % 2 === 0 ? theme.palette.grey[100] : theme.palette.grey[50]
|
|
38
|
+
}), getColumnLabel, equalCheck, itemRenderer = (data) => {
|
|
39
|
+
const { newData, oldData, changes = { newData: newData ?? {}, oldData: oldData ?? {} } } = data;
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [changes != null && ((0, jsx_runtime_1.jsx)(material_1.Button, { variant: "outlined", size: "small", onClick: () => (0, ShowDataComparison_1.ShowDataComparison)(changes, title, getColumnLabel, equalCheck), sx: {
|
|
41
|
+
marginLeft: theme.spacing(1),
|
|
42
|
+
marginTop: theme.spacing(-0.5),
|
|
43
|
+
float: "right"
|
|
44
|
+
}, children: title })), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: formatDate(data.creation) +
|
|
45
|
+
", [" +
|
|
46
|
+
getLabel(data.action) +
|
|
47
|
+
"], " +
|
|
48
|
+
data.user })] }));
|
|
49
|
+
}, headerTitle = ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: getLabel("audits") }), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] })), ...rest } = props;
|
|
50
|
+
// Layout
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)(ListMoreDisplay_1.ListMoreDisplay, { headerTitle: headerTitle, ...rest, children: (data, index) => ((0, jsx_runtime_1.jsx)("div", { style: getItemStyle(index, theme), children: itemRenderer(data, index) }, data.id)) }));
|
|
52
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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.BackButton = BackButton;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const material_1 = require("@mui/material");
|
|
9
|
+
const ArrowBack_1 = __importDefault(require("@mui/icons-material/ArrowBack"));
|
|
10
|
+
const react_router_1 = require("react-router");
|
|
11
|
+
/**
|
|
12
|
+
* BackButton
|
|
13
|
+
* @param props Props
|
|
14
|
+
* @returns Component
|
|
15
|
+
*/
|
|
16
|
+
function BackButton(props) {
|
|
17
|
+
// Destruct
|
|
18
|
+
const { color = "primary", size = "small", onClick, ...rest } = props;
|
|
19
|
+
// Theme
|
|
20
|
+
const theme = (0, material_1.useTheme)();
|
|
21
|
+
// Navigate
|
|
22
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
23
|
+
// Color
|
|
24
|
+
const pColor = color != "inherit" && color != "default" && color in theme.palette
|
|
25
|
+
? theme.palette[color]
|
|
26
|
+
: theme.palette.primary;
|
|
27
|
+
// Click handler
|
|
28
|
+
const onClickLocal = async (event) => {
|
|
29
|
+
if (onClick)
|
|
30
|
+
onClick(event);
|
|
31
|
+
// Navigate
|
|
32
|
+
navigate(-1);
|
|
33
|
+
};
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-label": "Back", color: color, size: size, onClick: onClickLocal, sx: {
|
|
35
|
+
backgroundColor: pColor.contrastText,
|
|
36
|
+
border: `1px solid ${pColor.light}`
|
|
37
|
+
}, ...rest, children: (0, jsx_runtime_1.jsx)(ArrowBack_1.default, {}) }));
|
|
38
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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.BridgeCloseButton = BridgeCloseButton;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const appscript_1 = require("@etsoo/appscript");
|
|
9
|
+
const Close_1 = __importDefault(require("@mui/icons-material/Close"));
|
|
10
|
+
const material_1 = require("@mui/material");
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const ReactApp_1 = require("./app/ReactApp");
|
|
13
|
+
/**
|
|
14
|
+
* Bridge close button
|
|
15
|
+
* @param props Props
|
|
16
|
+
* @returns Component
|
|
17
|
+
*/
|
|
18
|
+
function BridgeCloseButton(props) {
|
|
19
|
+
// Destruct
|
|
20
|
+
const { boxProps, onClick, title = ReactApp_1.globalApp?.get("close") ?? "Close", validate, ...rest } = props;
|
|
21
|
+
// Host
|
|
22
|
+
const host = appscript_1.BridgeUtils.host;
|
|
23
|
+
if (host == null ||
|
|
24
|
+
!host.closable() ||
|
|
25
|
+
(validate && validate(host) === false)) {
|
|
26
|
+
return (0, jsx_runtime_1.jsx)(react_1.default.Fragment, {});
|
|
27
|
+
}
|
|
28
|
+
// Click handler
|
|
29
|
+
const onClickLocal = (event) => {
|
|
30
|
+
if (onClick)
|
|
31
|
+
onClick(event);
|
|
32
|
+
host.exit();
|
|
33
|
+
};
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { ...boxProps, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { "aria-label": "close", onClick: onClickLocal, title: title, ...rest, children: (0, jsx_runtime_1.jsx)(Close_1.default, {}) }) }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ButtonLink = ButtonLink;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_router_1 = require("react-router");
|
|
7
|
+
/**
|
|
8
|
+
* ButtonLink
|
|
9
|
+
* @param props Props
|
|
10
|
+
* @returns Component
|
|
11
|
+
*/
|
|
12
|
+
function ButtonLink(props) {
|
|
13
|
+
// Destruct
|
|
14
|
+
const { href, state, ...rest } = props;
|
|
15
|
+
// Navigate
|
|
16
|
+
const navigate = (0, react_router_1.useNavigate)();
|
|
17
|
+
const onClick = href.includes("://")
|
|
18
|
+
? () => window.open(href, "_blank")
|
|
19
|
+
: () => navigate(href, { state });
|
|
20
|
+
// Layout
|
|
21
|
+
return (0, jsx_runtime_1.jsx)(material_1.Button, { ...rest, onClick: onClick });
|
|
22
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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.ButtonPopover = ButtonPopover;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const material_1 = require("@mui/material");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
/**
|
|
11
|
+
* Button popover component
|
|
12
|
+
* @param props Props
|
|
13
|
+
* @returns Component
|
|
14
|
+
*/
|
|
15
|
+
function ButtonPopover(props) {
|
|
16
|
+
// Destruct
|
|
17
|
+
const { button, children, loadData } = props;
|
|
18
|
+
// States
|
|
19
|
+
const [anchorEl, setAnchorEl] = react_1.default.useState(null);
|
|
20
|
+
const [data, setData] = react_1.default.useState(null);
|
|
21
|
+
const isLoadded = react_1.default.useRef(false);
|
|
22
|
+
const open = Boolean(anchorEl);
|
|
23
|
+
// Load data
|
|
24
|
+
react_1.default.useEffect(() => {
|
|
25
|
+
if (loadData && (!isLoadded.current || open)) {
|
|
26
|
+
// First time or when open
|
|
27
|
+
loadData().then((d) => {
|
|
28
|
+
if (d == null)
|
|
29
|
+
return;
|
|
30
|
+
setData(d);
|
|
31
|
+
isLoadded.current = true;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}, [loadData, open]);
|
|
35
|
+
// Children
|
|
36
|
+
const currentChildren = react_1.default.useMemo(() => children(data), [children, data]);
|
|
37
|
+
const handleClose = () => {
|
|
38
|
+
setAnchorEl(null);
|
|
39
|
+
};
|
|
40
|
+
// Layout
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [button((handler) => setAnchorEl(handler)), (0, jsx_runtime_1.jsx)(material_1.Popover, { anchorEl: anchorEl, open: open, onClose: handleClose, onClick: handleClose, transformOrigin: { horizontal: "right", vertical: "top" }, anchorOrigin: { horizontal: "right", vertical: "bottom" }, slotProps: {
|
|
42
|
+
paper: {
|
|
43
|
+
elevation: 0,
|
|
44
|
+
sx: {
|
|
45
|
+
overflow: "visible",
|
|
46
|
+
filter: "drop-shadow(0px 2px 8px rgba(0,0,0,0.32))",
|
|
47
|
+
mt: 1,
|
|
48
|
+
"&::before": {
|
|
49
|
+
content: '""',
|
|
50
|
+
display: "block",
|
|
51
|
+
position: "absolute",
|
|
52
|
+
top: 0,
|
|
53
|
+
right: 14,
|
|
54
|
+
width: 10,
|
|
55
|
+
height: 10,
|
|
56
|
+
bgcolor: "background.paper",
|
|
57
|
+
transform: "translateY(-50%) rotate(45deg)",
|
|
58
|
+
zIndex: 0
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, children: currentChildren })] }));
|
|
63
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
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.ComboBox = ComboBox;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const shared_1 = require("@etsoo/shared");
|
|
9
|
+
const material_1 = require("@mui/material");
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
const shared_2 = require("@etsoo/shared");
|
|
12
|
+
const react_2 = require("@etsoo/react");
|
|
13
|
+
const Add_1 = __importDefault(require("@mui/icons-material/Add"));
|
|
14
|
+
const SearchField_1 = require("./SearchField");
|
|
15
|
+
const InputField_1 = require("./InputField");
|
|
16
|
+
const ReactApp_1 = require("./app/ReactApp");
|
|
17
|
+
/**
|
|
18
|
+
* ComboBox
|
|
19
|
+
* @param props Props
|
|
20
|
+
* @returns Component
|
|
21
|
+
*/
|
|
22
|
+
function ComboBox(props) {
|
|
23
|
+
// Labels
|
|
24
|
+
const labels = ReactApp_1.globalApp?.getLabels("noOptions", "loading", "open", "add");
|
|
25
|
+
// Destruct
|
|
26
|
+
const { search = false, autoAddBlankItem = search, idField = "id", idValue, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, openText = labels?.open, addLabel = labels?.add, onAdd, getOptionKey = (option) => `${option[idField]}`, ...rest } = props;
|
|
27
|
+
// Value input ref
|
|
28
|
+
const inputRef = react_1.default.createRef();
|
|
29
|
+
// Options state
|
|
30
|
+
const [localOptions, setOptions] = react_1.default.useState(options ?? []);
|
|
31
|
+
const isMounted = react_1.default.useRef(true);
|
|
32
|
+
// When options change
|
|
33
|
+
// [options] will cause infinite loop
|
|
34
|
+
const propertyWay = loadData == null;
|
|
35
|
+
react_1.default.useEffect(() => {
|
|
36
|
+
if (propertyWay && options != null) {
|
|
37
|
+
setOptions(options);
|
|
38
|
+
if (stateValue != null &&
|
|
39
|
+
!options.some((option) => option[idField] === stateValue[idField])) {
|
|
40
|
+
setStateValue(null);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, [options, propertyWay]);
|
|
44
|
+
// Local default value
|
|
45
|
+
const localValue = idValue != null
|
|
46
|
+
? localOptions.find((o) => o[idField] === idValue)
|
|
47
|
+
: defaultValue ?? value;
|
|
48
|
+
// State
|
|
49
|
+
// null for controlled
|
|
50
|
+
const [stateValue, setStateValue] = react_1.default.useState(null);
|
|
51
|
+
react_1.default.useEffect(() => {
|
|
52
|
+
if (localValue != null && localValue != stateValue) {
|
|
53
|
+
setStateValue(localValue);
|
|
54
|
+
if (onValueChange)
|
|
55
|
+
onValueChange(localValue);
|
|
56
|
+
}
|
|
57
|
+
}, [localValue]);
|
|
58
|
+
// Add readOnly
|
|
59
|
+
// Before AutocompleteRenderInputParams changed, impossible to remove "InputLabelProps" and "InputProps"
|
|
60
|
+
const addReadOnly = (params) => {
|
|
61
|
+
if (readOnly != null) {
|
|
62
|
+
Object.assign(params, { readOnly });
|
|
63
|
+
}
|
|
64
|
+
Object.assign(params.inputProps, { "data-reset": inputReset });
|
|
65
|
+
if (dataReadonly) {
|
|
66
|
+
params.inputProps.onKeyDown = (event) => {
|
|
67
|
+
if (shared_1.Keyboard.isTypingContent(event.key)) {
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
|
|
73
|
+
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html
|
|
74
|
+
Object.assign(params.inputProps, { autoComplete: inputAutoComplete });
|
|
75
|
+
return params;
|
|
76
|
+
};
|
|
77
|
+
const getValue = (value) => {
|
|
78
|
+
if (value == null)
|
|
79
|
+
return "";
|
|
80
|
+
if (Array.isArray(value))
|
|
81
|
+
return value.map((item) => item[idField]).join(",");
|
|
82
|
+
return `${value[idField]}`;
|
|
83
|
+
};
|
|
84
|
+
const setInputValue = (value) => {
|
|
85
|
+
// Set state
|
|
86
|
+
setStateValue(value);
|
|
87
|
+
// Input value
|
|
88
|
+
const input = inputRef.current;
|
|
89
|
+
if (input) {
|
|
90
|
+
// Update value
|
|
91
|
+
const newValue = getValue(value);
|
|
92
|
+
if (newValue !== input.value) {
|
|
93
|
+
// Different value, trigger change event
|
|
94
|
+
react_2.ReactUtils.triggerChange(input, newValue, false);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const doLoadData = react_1.default.useCallback(() => {
|
|
99
|
+
if (loadData == null)
|
|
100
|
+
return;
|
|
101
|
+
loadData().then((result) => {
|
|
102
|
+
if (result == null || !isMounted.current)
|
|
103
|
+
return;
|
|
104
|
+
if (onLoadData)
|
|
105
|
+
onLoadData(result);
|
|
106
|
+
if (autoAddBlankItem) {
|
|
107
|
+
shared_2.Utils.addBlankItem(result, idField, labelField);
|
|
108
|
+
}
|
|
109
|
+
setOptions(result);
|
|
110
|
+
});
|
|
111
|
+
}, [loadData, autoAddBlankItem, idField, labelField]);
|
|
112
|
+
react_1.default.useEffect(() => {
|
|
113
|
+
if (propertyWay)
|
|
114
|
+
return;
|
|
115
|
+
doLoadData();
|
|
116
|
+
}, [propertyWay, doLoadData]);
|
|
117
|
+
react_1.default.useEffect(() => {
|
|
118
|
+
return () => {
|
|
119
|
+
isMounted.current = false;
|
|
120
|
+
};
|
|
121
|
+
}, []);
|
|
122
|
+
// Layout
|
|
123
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }), (0, jsx_runtime_1.jsxs)(material_1.Stack, { gap: 0.5, direction: "row", width: "100%", children: [(0, jsx_runtime_1.jsx)(material_1.Autocomplete, { value: stateValue, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
|
|
124
|
+
// Set value
|
|
125
|
+
setInputValue(value);
|
|
126
|
+
// Custom
|
|
127
|
+
if (onChange != null)
|
|
128
|
+
onChange(event, value, reason, details);
|
|
129
|
+
if (onValueChange)
|
|
130
|
+
onValueChange(value);
|
|
131
|
+
}, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? ((0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })), options: localOptions, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, getOptionKey: getOptionKey, ...rest }), onAdd && ((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "small", onClick: () => {
|
|
132
|
+
onAdd(doLoadData);
|
|
133
|
+
}, title: addLabel, children: (0, jsx_runtime_1.jsx)(Add_1.default, {}) }))] })] }));
|
|
134
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
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.ComboBoxMultiple = ComboBoxMultiple;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const shared_1 = require("@etsoo/shared");
|
|
9
|
+
const material_1 = require("@mui/material");
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
const shared_2 = require("@etsoo/shared");
|
|
12
|
+
const react_2 = require("@etsoo/react");
|
|
13
|
+
const CheckBoxOutlineBlank_1 = __importDefault(require("@mui/icons-material/CheckBoxOutlineBlank"));
|
|
14
|
+
const CheckBox_1 = __importDefault(require("@mui/icons-material/CheckBox"));
|
|
15
|
+
const SearchField_1 = require("./SearchField");
|
|
16
|
+
const InputField_1 = require("./InputField");
|
|
17
|
+
const ReactApp_1 = require("./app/ReactApp");
|
|
18
|
+
const icon = (0, jsx_runtime_1.jsx)(CheckBoxOutlineBlank_1.default, { fontSize: "small" });
|
|
19
|
+
const checkedIcon = (0, jsx_runtime_1.jsx)(CheckBox_1.default, { fontSize: "small" });
|
|
20
|
+
/**
|
|
21
|
+
* ComboBox multiple
|
|
22
|
+
* @param props Props
|
|
23
|
+
* @returns Component
|
|
24
|
+
*/
|
|
25
|
+
function ComboBoxMultiple(props) {
|
|
26
|
+
// Labels
|
|
27
|
+
const labels = ReactApp_1.globalApp?.getLabels("noOptions", "loading");
|
|
28
|
+
// Destruct
|
|
29
|
+
const { search = false, autoAddBlankItem = search, idField = "id", idValue, idValues, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, openOnFocus = true, value, disableCloseOnSelect = true, renderOption = (props, option, { selected }) => ((0, jsx_runtime_1.jsxs)("li", { ...props, children: [(0, jsx_runtime_1.jsx)(material_1.Checkbox, { icon: icon, checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }), `${option[labelField]}`] })), getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px" }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, ...rest } = props;
|
|
30
|
+
// Value input ref
|
|
31
|
+
const inputRef = react_1.default.createRef();
|
|
32
|
+
// Options state
|
|
33
|
+
const [localOptions, setOptions] = react_1.default.useState(options ?? []);
|
|
34
|
+
const isMounted = react_1.default.useRef(true);
|
|
35
|
+
// Local default value
|
|
36
|
+
const localValue = idValue != null
|
|
37
|
+
? localOptions.filter((o) => o[idField] === idValue)
|
|
38
|
+
: idValues != null
|
|
39
|
+
? localOptions.filter((o) => idValues?.includes(o[idField]))
|
|
40
|
+
: defaultValue?.concat() ?? value?.concat();
|
|
41
|
+
// State
|
|
42
|
+
// null for controlled
|
|
43
|
+
const [stateValue, setStateValue] = react_1.default.useState(null);
|
|
44
|
+
react_1.default.useEffect(() => {
|
|
45
|
+
setStateValue(localValue ?? []);
|
|
46
|
+
}, [localValue]);
|
|
47
|
+
// When options change
|
|
48
|
+
// [options] will cause infinite loop
|
|
49
|
+
const propertyWay = loadData == null;
|
|
50
|
+
react_1.default.useEffect(() => {
|
|
51
|
+
if (propertyWay && options != null) {
|
|
52
|
+
setOptions(options);
|
|
53
|
+
if (stateValue != null) {
|
|
54
|
+
if (Array.isArray(stateValue)) {
|
|
55
|
+
const newState = stateValue.filter((item) => options.some((option) => option[idField] === item[idField]));
|
|
56
|
+
setStateValue(newState);
|
|
57
|
+
}
|
|
58
|
+
else if (!options.some((option) => option[idField] === stateValue[idField])) {
|
|
59
|
+
setStateValue(null);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, [options, propertyWay]);
|
|
64
|
+
// Add readOnly
|
|
65
|
+
const addReadOnly = (params) => {
|
|
66
|
+
if (readOnly != null) {
|
|
67
|
+
Object.assign(params, { readOnly });
|
|
68
|
+
}
|
|
69
|
+
Object.assign(params.inputProps, { "data-reset": inputReset });
|
|
70
|
+
if (dataReadonly) {
|
|
71
|
+
params.inputProps.onKeyDown = (event) => {
|
|
72
|
+
if (shared_1.Keyboard.isTypingContent(event.key)) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
|
|
78
|
+
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html
|
|
79
|
+
Object.assign(params.inputProps, { autoComplete: inputAutoComplete });
|
|
80
|
+
return params;
|
|
81
|
+
};
|
|
82
|
+
const getValue = (value) => {
|
|
83
|
+
if (value == null)
|
|
84
|
+
return "";
|
|
85
|
+
return value.map((item) => item[idField]).join(",");
|
|
86
|
+
};
|
|
87
|
+
const setInputValue = (value) => {
|
|
88
|
+
// Set state
|
|
89
|
+
setStateValue(value);
|
|
90
|
+
// Input value
|
|
91
|
+
const input = inputRef.current;
|
|
92
|
+
if (input) {
|
|
93
|
+
// Update value
|
|
94
|
+
const newValue = getValue(value);
|
|
95
|
+
if (newValue !== input.value) {
|
|
96
|
+
// Different value, trigger change event
|
|
97
|
+
react_2.ReactUtils.triggerChange(input, newValue, false);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
react_1.default.useEffect(() => {
|
|
102
|
+
if (propertyWay || loadData == null)
|
|
103
|
+
return;
|
|
104
|
+
loadData().then((result) => {
|
|
105
|
+
if (result == null || !isMounted.current)
|
|
106
|
+
return;
|
|
107
|
+
if (onLoadData)
|
|
108
|
+
onLoadData(result);
|
|
109
|
+
if (autoAddBlankItem) {
|
|
110
|
+
shared_2.Utils.addBlankItem(result, idField, labelField);
|
|
111
|
+
}
|
|
112
|
+
setOptions(result);
|
|
113
|
+
});
|
|
114
|
+
}, [propertyWay, autoAddBlankItem, idField, labelField]);
|
|
115
|
+
react_1.default.useEffect(() => {
|
|
116
|
+
return () => {
|
|
117
|
+
isMounted.current = false;
|
|
118
|
+
};
|
|
119
|
+
}, []);
|
|
120
|
+
// Layout
|
|
121
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }), (0, jsx_runtime_1.jsx)(material_1.Autocomplete, { value: stateValue == null
|
|
122
|
+
? []
|
|
123
|
+
: Array.isArray(stateValue)
|
|
124
|
+
? stateValue
|
|
125
|
+
: [stateValue], disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, multiple: true, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
|
|
126
|
+
// Set value
|
|
127
|
+
setInputValue(value.concat());
|
|
128
|
+
// Custom
|
|
129
|
+
if (onChange != null)
|
|
130
|
+
onChange(event, value, reason, details);
|
|
131
|
+
}, openOnFocus: openOnFocus, sx: sx, renderInput: (params) => search ? ((0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })) : ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { ...addReadOnly(params), label: label, name: name + "Input", margin: inputMargin, variant: inputVariant, required: inputRequired, error: inputError, helperText: inputHelperText })), options: localOptions, renderOption: renderOption, noOptionsText: noOptionsText, loadingText: loadingText, ...rest })] }));
|
|
132
|
+
}
|