@ryuzaki13/react-foundation-ui 1.0.1 → 1.0.2
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/dist/advanced-search/index.d.ts +3 -0
- package/dist/advanced-search/index.d.ts.map +1 -0
- package/dist/advanced-search/index.js +361 -0
- package/dist/advanced-search/index.js.map +1 -0
- package/dist/advanced-search/lib/index.d.ts +2 -0
- package/dist/advanced-search/lib/index.d.ts.map +1 -0
- package/dist/advanced-search/lib/searchParts.d.ts +3 -0
- package/dist/advanced-search/lib/searchParts.d.ts.map +1 -0
- package/dist/advanced-search/model/index.d.ts +5 -0
- package/dist/advanced-search/model/index.d.ts.map +1 -0
- package/dist/advanced-search/model/types.d.ts +55 -0
- package/dist/advanced-search/model/types.d.ts.map +1 -0
- package/dist/advanced-search/model/useAdvancedSearch.d.ts +11 -0
- package/dist/advanced-search/model/useAdvancedSearch.d.ts.map +1 -0
- package/dist/advanced-search/model/useAdvancedSearchInitialSelected.d.ts +6 -0
- package/dist/advanced-search/model/useAdvancedSearchInitialSelected.d.ts.map +1 -0
- package/dist/advanced-search/model/useAdvancedSearchSelection.d.ts +13 -0
- package/dist/advanced-search/model/useAdvancedSearchSelection.d.ts.map +1 -0
- package/dist/advanced-search/ui/AdvancedSearchModal.d.ts +13 -0
- package/dist/advanced-search/ui/AdvancedSearchModal.d.ts.map +1 -0
- package/dist/advanced-search/ui/AdvancedSearchSelect.d.ts +8 -0
- package/dist/advanced-search/ui/AdvancedSearchSelect.d.ts.map +1 -0
- package/dist/advanced-search/ui/AdvancedSearchSelectUI.d.ts +9 -0
- package/dist/advanced-search/ui/AdvancedSearchSelectUI.d.ts.map +1 -0
- package/dist/advanced-search/ui/index.d.ts +2 -0
- package/dist/advanced-search/ui/index.d.ts.map +1 -0
- package/dist/badge/index.js +1 -1
- package/dist/badge/stories/Badge.stories.js +22 -22
- package/dist/base-table/index.js +2 -2
- package/dist/button/index.js +7 -7
- package/dist/button/stories/Button.stories.js +1 -1
- package/dist/check-box/index.js +1 -1
- package/dist/check-box/stories/CheckBox.stories.js +25 -25
- package/dist/chunks/{BadgeList-6qL9oNAp.js → BadgeList-DYgun2rf.js} +16 -16
- package/dist/chunks/{BadgeList-6qL9oNAp.js.map → BadgeList-DYgun2rf.js.map} +1 -1
- package/dist/chunks/{Button-BZ_b-Kin.js → Button-CCWuggdA.js} +16 -16
- package/dist/chunks/{Button-BZ_b-Kin.js.map → Button-CCWuggdA.js.map} +1 -1
- package/dist/chunks/CalendarView-DjeTJkTT.js +435 -0
- package/dist/chunks/{CalendarView-DjShdvRD.js.map → CalendarView-DjeTJkTT.js.map} +1 -1
- package/dist/chunks/CheckBox-BowNqqd3.js +48 -0
- package/dist/chunks/{CheckBox-CulnjNvJ.js.map → CheckBox-BowNqqd3.js.map} +1 -1
- package/dist/chunks/{DateInput-LSSvObtg.js → DateInput--tfofQ2x.js} +68 -68
- package/dist/chunks/{DateInput-LSSvObtg.js.map → DateInput--tfofQ2x.js.map} +1 -1
- package/dist/chunks/{DateRangePresetSelect-CyzGMvVp.js → DateRangePresetSelect-UgsfaOeM.js} +22 -22
- package/dist/chunks/{DateRangePresetSelect-CyzGMvVp.js.map → DateRangePresetSelect-UgsfaOeM.js.map} +1 -1
- package/dist/chunks/Detail-DHDMsg8q.js +80 -0
- package/dist/chunks/{Detail-DKolHye4.js.map → Detail-DHDMsg8q.js.map} +1 -1
- package/dist/chunks/{Dialog-BPS4BeWZ.js → Dialog-CFIvGxER.js} +8 -8
- package/dist/chunks/{Dialog-BPS4BeWZ.js.map → Dialog-CFIvGxER.js.map} +1 -1
- package/dist/chunks/DisclosureGroup-CfRTkl6Z.js +49 -0
- package/dist/chunks/{DisclosureGroup-Plk2M_Vl.js.map → DisclosureGroup-CfRTkl6Z.js.map} +1 -1
- package/dist/chunks/{DropZone-DPGTpHI6.js → DropZone-kJfbZU5g.js} +22 -22
- package/dist/chunks/{DropZone-DPGTpHI6.js.map → DropZone-kJfbZU5g.js.map} +1 -1
- package/dist/chunks/{DropdownMenu-Ds-trH4M.js → DropdownMenu-DQeR3y7M.js} +138 -138
- package/dist/chunks/{DropdownMenu-Ds-trH4M.js.map → DropdownMenu-DQeR3y7M.js.map} +1 -1
- package/dist/chunks/{Flex-DbBdq336.js → Flex-DUYSL5TE.js} +16 -16
- package/dist/chunks/{Flex-DbBdq336.js.map → Flex-DUYSL5TE.js.map} +1 -1
- package/dist/chunks/Input-BmjlpA09.js +227 -0
- package/dist/chunks/{Input-Wrew1puH.js.map → Input-BmjlpA09.js.map} +1 -1
- package/dist/chunks/{InputDateTime-2PCX8an8.js → InputDateTime-CxfAFe2L.js} +56 -56
- package/dist/chunks/{InputDateTime-2PCX8an8.js.map → InputDateTime-CxfAFe2L.js.map} +1 -1
- package/dist/chunks/{InputFile-Ca-bRo93.js → InputFile-CyZu__B_.js} +17 -17
- package/dist/chunks/{InputFile-Ca-bRo93.js.map → InputFile-CyZu__B_.js.map} +1 -1
- package/dist/chunks/{InputFiles-pI9rQXOI.js → InputFiles-CrTJV27R.js} +31 -31
- package/dist/chunks/{InputFiles-pI9rQXOI.js.map → InputFiles-CrTJV27R.js.map} +1 -1
- package/dist/chunks/{InputImage-B522AQzl.js → InputImage-Cw8rPYQu.js} +18 -18
- package/dist/chunks/{InputImage-B522AQzl.js.map → InputImage-Cw8rPYQu.js.map} +1 -1
- package/dist/chunks/{LabeledExpandableActionPanel-CWmOSWeS.js → LabeledExpandableActionPanel-D3kUvmFH.js} +26 -26
- package/dist/chunks/{LabeledExpandableActionPanel-CWmOSWeS.js.map → LabeledExpandableActionPanel-D3kUvmFH.js.map} +1 -1
- package/dist/chunks/Listbox-BZlp5qHz.js +81 -0
- package/dist/chunks/{Listbox-B6F_IKQv.js.map → Listbox-BZlp5qHz.js.map} +1 -1
- package/dist/chunks/{MultiSelect-CUXA8gx-.js → MultiSelect-D1XYuwH1.js} +113 -113
- package/dist/chunks/{MultiSelect-CUXA8gx-.js.map → MultiSelect-D1XYuwH1.js.map} +1 -1
- package/dist/chunks/{NotificationsHost-Bnq7xFKO.js → NotificationsHost-_icJx4xR.js} +44 -44
- package/dist/chunks/{NotificationsHost-Bnq7xFKO.js.map → NotificationsHost-_icJx4xR.js.map} +1 -1
- package/dist/chunks/{PresetRangeDateInput-B_8jsilZ.js → PresetRangeDateInput-CapirptQ.js} +11 -11
- package/dist/chunks/{PresetRangeDateInput-B_8jsilZ.js.map → PresetRangeDateInput-CapirptQ.js.map} +1 -1
- package/dist/chunks/RadioButton-D0uA0rX_.js +48 -0
- package/dist/chunks/{RadioButton-D5vPW4Yr.js.map → RadioButton-D0uA0rX_.js.map} +1 -1
- package/dist/chunks/RadioGroup-B9XjkcOy.js +121 -0
- package/dist/chunks/{RadioGroup-BAhN1d1X.js.map → RadioGroup-B9XjkcOy.js.map} +1 -1
- package/dist/chunks/{Select-CoAYWNOn.js → Select-CXeVjVKA.js} +11 -11
- package/dist/chunks/{Select-CoAYWNOn.js.map → Select-CXeVjVKA.js.map} +1 -1
- package/dist/chunks/{SerializableSelect-awBOWKTj.js → SerializableSelect-DkYeJtAO.js} +2 -2
- package/dist/chunks/{SerializableSelect-awBOWKTj.js.map → SerializableSelect-DkYeJtAO.js.map} +1 -1
- package/dist/chunks/{SingleDateTimeInput-o44Vlwdk.js → SingleDateTimeInput-BmeuVGQT.js} +78 -78
- package/dist/chunks/{SingleDateTimeInput-o44Vlwdk.js.map → SingleDateTimeInput-BmeuVGQT.js.map} +1 -1
- package/dist/chunks/{Splitter-NjNFuEq4.js → Splitter-BFkVGVRb.js} +32 -32
- package/dist/chunks/{Splitter-NjNFuEq4.js.map → Splitter-BFkVGVRb.js.map} +1 -1
- package/dist/chunks/StateSelect-1jH3uLz9.js +78 -0
- package/dist/chunks/{StateSelect-abZq176J.js.map → StateSelect-1jH3uLz9.js.map} +1 -1
- package/dist/chunks/{Switch-DHMnZVmN.js → Switch-B57Qmy1z.js} +19 -19
- package/dist/chunks/{Switch-DHMnZVmN.js.map → Switch-B57Qmy1z.js.map} +1 -1
- package/dist/chunks/{TextEditorLexicalClient-Dt4eaPA3.js → TextEditorLexicalClient-DRhAswpP.js} +204 -204
- package/dist/chunks/{TextEditorLexicalClient-Dt4eaPA3.js.map → TextEditorLexicalClient-DRhAswpP.js.map} +1 -1
- package/dist/chunks/{Textarea-DOVrPH4I.js → Textarea-C9UdUueF.js} +2 -2
- package/dist/chunks/{Textarea-DOVrPH4I.js.map → Textarea-C9UdUueF.js.map} +1 -1
- package/dist/chunks/{TimePanel-_kF2RtHk.js → TimePanel-b4saqoUY.js} +27 -27
- package/dist/chunks/{TimePanel-_kF2RtHk.js.map → TimePanel-b4saqoUY.js.map} +1 -1
- package/dist/chunks/{Toggle-C_fE-bkM.js → Toggle-DVqOQXmt.js} +18 -18
- package/dist/chunks/{Toggle-C_fE-bkM.js.map → Toggle-DVqOQXmt.js.map} +1 -1
- package/dist/chunks/{TreeMultiSelect-C76RYavo.js → TreeMultiSelect-CfQhlfnC.js} +6 -6
- package/dist/chunks/{TreeMultiSelect-C76RYavo.js.map → TreeMultiSelect-CfQhlfnC.js.map} +1 -1
- package/dist/chunks/{TreePickerBase-qNHIWbYL.js → TreePickerBase-BBUOWsSu.js} +49 -49
- package/dist/chunks/{TreePickerBase-qNHIWbYL.js.map → TreePickerBase-BBUOWsSu.js.map} +1 -1
- package/dist/chunks/{TreeSelect-LEhNdPCX.js → TreeSelect-2wUXs90E.js} +6 -6
- package/dist/chunks/{TreeSelect-LEhNdPCX.js.map → TreeSelect-2wUXs90E.js.map} +1 -1
- package/dist/chunks/base-table-CoQlKABk.js +514 -0
- package/dist/chunks/{base-table-ij2guVMB.js.map → base-table-CoQlKABk.js.map} +1 -1
- package/dist/chunks/{floating-arrow-CdRV69sg.js → floating-arrow-BE-z4QkE.js} +7 -7
- package/dist/chunks/{floating-arrow-CdRV69sg.js.map → floating-arrow-BE-z4QkE.js.map} +1 -1
- package/dist/chunks/input-search-Dw4rnJBq.js +30 -0
- package/dist/chunks/input-search-Dw4rnJBq.js.map +1 -0
- package/dist/chunks/{layout-picker-CzZ8Xzkk.js → layout-picker-MWaImn3L.js} +34 -34
- package/dist/chunks/{layout-picker-CzZ8Xzkk.js.map → layout-picker-MWaImn3L.js.map} +1 -1
- package/dist/chunks/{misc-Bj0y3ERC.js → misc-DoqZBMof.js} +110 -110
- package/dist/chunks/{misc-Bj0y3ERC.js.map → misc-DoqZBMof.js.map} +1 -1
- package/dist/chunks/{modal-B4ivQb2h.js → modal-B3HY3laL.js} +40 -40
- package/dist/chunks/{modal-B4ivQb2h.js.map → modal-B3HY3laL.js.map} +1 -1
- package/dist/chunks/multi-select-BzYIviCU.js +1305 -0
- package/dist/chunks/multi-select-BzYIviCU.js.map +1 -0
- package/dist/chunks/{picker-gIUs0nE_.js → picker-Dg55Ss-B.js} +74 -74
- package/dist/chunks/{picker-gIUs0nE_.js.map → picker-Dg55Ss-B.js.map} +1 -1
- package/dist/chunks/{popover-C79P5bm2.js → popover-xJJqy1v6.js} +52 -52
- package/dist/chunks/{popover-C79P5bm2.js.map → popover-xJJqy1v6.js.map} +1 -1
- package/dist/chunks/{separator-CIqnk2z9.js → separator-B72Aq-6a.js} +2 -2
- package/dist/chunks/{separator-CIqnk2z9.js.map → separator-B72Aq-6a.js.map} +1 -1
- package/dist/chunks/{slider-CigVo4Ju.js → slider-CFKsfxFp.js} +83 -83
- package/dist/chunks/{slider-CigVo4Ju.js.map → slider-CFKsfxFp.js.map} +1 -1
- package/dist/chunks/sortable-DcTIAbjD.js +185 -0
- package/dist/chunks/{sortable-BZqnZ_LA.js.map → sortable-DcTIAbjD.js.map} +1 -1
- package/dist/chunks/{table-CK-CM2zD.js → table-Dc3AqMzP.js} +21 -21
- package/dist/chunks/{table-CK-CM2zD.js.map → table-Dc3AqMzP.js.map} +1 -1
- package/dist/chunks/{table-column-interactions-DPyJDD7P.js → table-column-interactions-6RGjmiI5.js} +24 -24
- package/dist/chunks/{table-column-interactions-DPyJDD7P.js.map → table-column-interactions-6RGjmiI5.js.map} +1 -1
- package/dist/chunks/{tabs-D5ikIIng.js → tabs-DlnVVMJl.js} +96 -96
- package/dist/chunks/{tabs-D5ikIIng.js.map → tabs-DlnVVMJl.js.map} +1 -1
- package/dist/chunks/{toolbar-C-Ziw_Uh.js → toolbar-BCZNdRXM.js} +2 -2
- package/dist/chunks/{toolbar-C-Ziw_Uh.js.map → toolbar-BCZNdRXM.js.map} +1 -1
- package/dist/chunks/{wheel-picker-DUHGy7wE.js → wheel-picker-FS58cRsQ.js} +23 -23
- package/dist/chunks/{wheel-picker-DUHGy7wE.js.map → wheel-picker-FS58cRsQ.js.map} +1 -1
- package/dist/context-menu/index.js +1 -1
- package/dist/context-menu/stories/ContextMenu.stories.js +45 -45
- package/dist/date-input/index.js +2 -2
- package/dist/date-input/stories/DateInput.stories.js +2 -2
- package/dist/date-range-preset-select/index.js +1 -1
- package/dist/date-range-preset-select/stories/DateRangePresetSelect.stories.js +8 -8
- package/dist/date-time-input/index.js +1 -1
- package/dist/date-time-input/stories/SingleDateTimeInput.stories.js +38 -38
- package/dist/date-time-input/stories/TimePanel.stories.js +9 -9
- package/dist/detail/index.js +1 -1
- package/dist/detail/stories/Detail.stories.js +1 -1
- package/dist/dialog/index.js +1 -1
- package/dist/dialog/stories/Dialog.stories.js +16 -16
- package/dist/disclosure/index.js +1 -1
- package/dist/disclosure/stories/Disclosure.stories.js +1 -1
- package/dist/drop-zone/index.js +1 -1
- package/dist/drop-zone/stories/DropZone.stories.js +14 -14
- package/dist/errors/index.js +47 -47
- package/dist/expandable-action-panel/index.js +1 -1
- package/dist/expandable-action-panel/stories/ExpandableActionPanel.stories.js +28 -28
- package/dist/flex/index.js +2 -2
- package/dist/flex/stories/Flex.stories.js +2 -2
- package/dist/floating-arrow/index.js +1 -1
- package/dist/fullscreen-portal/index.js +6 -6
- package/dist/grid/stories/Grid.stories.js +1 -1
- package/dist/image/index.js +123 -123
- package/dist/input/index.js +1 -1
- package/dist/input/stories/Input.stories.js +11 -11
- package/dist/input-date-time/index.js +1 -1
- package/dist/input-date-time/stories/InputDateTime.stories.js +11 -11
- package/dist/input-file/index.js +1 -1
- package/dist/input-file/stories/InputFile.stories.js +9 -9
- package/dist/input-files/index.js +1 -1
- package/dist/input-files/stories/InputFiles.stories.js +9 -9
- package/dist/input-image/index.js +1 -1
- package/dist/input-image/stories/InputImage.stories.js +15 -15
- package/dist/input-search/index.js +2 -30
- package/dist/layout-picker/index.js +1 -1
- package/dist/layout-picker/stories/LayoutPicker.stories.js +52 -52
- package/dist/list/index.js +27 -27
- package/dist/listbox/index.js +1 -1
- package/dist/listbox/stories/Listbox.stories.js +19 -19
- package/dist/misc/index.js +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/modal/stories/Modal.stories.js +55 -55
- package/dist/multi-select/index.js +3 -1141
- package/dist/multi-select/ui/stories/MultiSelect.stories.js +17 -17
- package/dist/notifications/index.js +1 -1
- package/dist/notifications/ui/stories/NotificationsHost.stories.js +59 -59
- package/dist/period-select/index.js +20 -20
- package/dist/period-select/stories/PeriodSelect.stories.js +17 -17
- package/dist/picker/index.js +1 -1
- package/dist/popover/index.js +1 -1
- package/dist/popover/stories/Popover.stories.js +16 -16
- package/dist/preset-range-date-input/index.js +1 -1
- package/dist/preset-range-date-input/ui/stories/PresetRangeDateInput.stories.js +9 -9
- package/dist/preset-select/index.js +1 -1
- package/dist/radio-button/index.js +1 -1
- package/dist/radio-button/stories/RadioButton.stories.js +11 -11
- package/dist/radio-group/index.js +1 -1
- package/dist/radio-group/stories/RadioGroup.stories.js +21 -21
- package/dist/select/index.js +2 -2
- package/dist/select/stories/Select.stories.js +23 -23
- package/dist/select/stories/SerializableSelect.stories.js +22 -22
- package/dist/separator/index.js +1 -1
- package/dist/simple-table/index.js +5 -5
- package/dist/slider/index.js +1 -1
- package/dist/slider/stories/Slider.stories.js +32 -32
- package/dist/slider/stories/SliderInput.stories.js +39 -39
- package/dist/sortable/index.js +1 -1
- package/dist/sortable/stories/Sortable.stories.js +23 -23
- package/dist/splitter/index.js +1 -1
- package/dist/splitter/stories/Splitter.stories.js +1 -1
- package/dist/state-select/index.js +1 -1
- package/dist/state-select/stories/StateSelect.stories.js +23 -23
- package/dist/styles.css +1 -1
- package/dist/switch/index.js +1 -1
- package/dist/switch/stories/Switch.stories.js +11 -11
- package/dist/table/index.js +1 -1
- package/dist/table-column-interactions/index.js +1 -1
- package/dist/table-sorting/index.js +1 -1
- package/dist/tabs/index.js +1 -1
- package/dist/tabs/stories/Tabs.stories.js +39 -39
- package/dist/text/index.js +20 -20
- package/dist/text-editor/index.js +3 -3
- package/dist/text-editor/toolbar/index.js +1 -1
- package/dist/textarea/index.js +1 -1
- package/dist/textarea/stories/Textarea.stories.js +8 -8
- package/dist/three-scene/index.js +7 -7
- package/dist/toggle/index.js +1 -1
- package/dist/toggle/stories/Toggle.stories.js +7 -7
- package/dist/toolbar/index.js +16 -16
- package/dist/tree/index.js +24 -24
- package/dist/tree-select/index.js +2 -2
- package/dist/tree-select/stories/TreeMultiSelect.stories.js +9 -9
- package/dist/tree-select/stories/TreeSelect.stories.js +9 -9
- package/dist/tree-table/index.js +32 -32
- package/dist/wheel-picker/index.js +1 -1
- package/package.json +11 -1
- package/dist/chunks/CalendarView-DjShdvRD.js +0 -435
- package/dist/chunks/CheckBox-CulnjNvJ.js +0 -48
- package/dist/chunks/Detail-DKolHye4.js +0 -80
- package/dist/chunks/DisclosureGroup-Plk2M_Vl.js +0 -49
- package/dist/chunks/Input-Wrew1puH.js +0 -227
- package/dist/chunks/Listbox-B6F_IKQv.js +0 -81
- package/dist/chunks/RadioButton-D5vPW4Yr.js +0 -48
- package/dist/chunks/RadioGroup-BAhN1d1X.js +0 -121
- package/dist/chunks/StateSelect-abZq176J.js +0 -78
- package/dist/chunks/base-table-ij2guVMB.js +0 -514
- package/dist/chunks/sortable-BZqnZ_LA.js +0 -185
- package/dist/input-search/index.js.map +0 -1
- package/dist/multi-select/index.js.map +0 -1
|
@@ -0,0 +1,1305 @@
|
|
|
1
|
+
import { t as e } from "./MultiSelect-D1XYuwH1.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
3
|
+
import { logError as o } from "@ryuzaki13/react-foundation-lib/utils";
|
|
4
|
+
import { asRecord as s, isRecord as c, isSafe as l } from "@ryuzaki13/react-foundation-lib/validators";
|
|
5
|
+
import { reportTransportError as u } from "@ryuzaki13/react-foundation-lib/error-report";
|
|
6
|
+
import { formatDateAsODataDatetime as d, parseDate as f, startsWithIgnoringZeros as p, truncateText as m } from "@ryuzaki13/react-foundation-lib/formatters";
|
|
7
|
+
import { queryOptions as h, useQuery as g, useQueryClient as _ } from "@tanstack/react-query";
|
|
8
|
+
import { persistedQueryMeta as v } from "@ryuzaki13/react-foundation-lib/query-client";
|
|
9
|
+
import { buildEntityOperationPath as y, buildEntityPath as b, buildFunctionImportPath as x, buildODataFilter as S, buildODataOrder as C, odataParseValueByMetadata as w, parseServiceMetadata as T } from "@ryuzaki13/react-foundation-lib/odata-service";
|
|
10
|
+
import "@ryuzaki13/react-foundation-lib/string-comparison";
|
|
11
|
+
import { buildSeparatedArrays as E, useODataCollectionStore as D } from "@ryuzaki13/react-foundation-lib/odata";
|
|
12
|
+
import { createTableColumnVisibilityFromODataMetadata as O, createTableColumnsFromODataMetadata as k, enrichTableColumnsWithODataFormatting as A, resolveStableColumnId as ee } from "@ryuzaki13/react-foundation-lib/table";
|
|
13
|
+
import "@ryuzaki13/react-foundation-lib/notifications";
|
|
14
|
+
import { jsx as j } from "react/jsx-runtime";
|
|
15
|
+
//#region node_modules/@ryuzaki13/react-foundation-api/dist/chunks/fetch-CPEFkAcU.js
|
|
16
|
+
var M = {};
|
|
17
|
+
function N() {
|
|
18
|
+
return M;
|
|
19
|
+
}
|
|
20
|
+
function te(e) {
|
|
21
|
+
return e.split(";")[0] ?? e;
|
|
22
|
+
}
|
|
23
|
+
function P(e, t) {
|
|
24
|
+
let n = M.devDp0Service;
|
|
25
|
+
return (__DEV__ || __PREVIEW__) && n && te(e) === te(n) ? "odataDp0" : t ?? "odata";
|
|
26
|
+
}
|
|
27
|
+
function ne() {
|
|
28
|
+
return M.resolveSapClient?.() ?? null;
|
|
29
|
+
}
|
|
30
|
+
var re = "/sap/opu/odata/sap", ie = __DEV__ || __PREVIEW__ ? "/sap-dp0/opu/odata/sap" : "/sap/opu/odata/sap", ae = __DEV__ || __PREVIEW__ ? "/sap-dp0/opu/odata/UI2" : "/sap/opu/odata/UI2", oe = __BASE_APP_CONFIG_URL__, F = Object.freeze({
|
|
31
|
+
"": "",
|
|
32
|
+
odata: re,
|
|
33
|
+
odataDp0: ie,
|
|
34
|
+
odataUi2: ae,
|
|
35
|
+
config: oe
|
|
36
|
+
});
|
|
37
|
+
function I(e) {
|
|
38
|
+
return typeof e == "string" ? e : typeof Request < "u" && e instanceof Request ? e.url : e.toString();
|
|
39
|
+
}
|
|
40
|
+
function L(e) {
|
|
41
|
+
let t = e.split("?")[0]?.split("#")[0] ?? "";
|
|
42
|
+
return t ? t.startsWith("/") ? t : `/${t}` : "/";
|
|
43
|
+
}
|
|
44
|
+
var se = 40, ce = 1e3;
|
|
45
|
+
function le(e) {
|
|
46
|
+
try {
|
|
47
|
+
let t = typeof window < "u" ? window.location.origin : "http://localhost", n = new URL(e, t);
|
|
48
|
+
return `${n.origin === t ? "" : n.origin}${n.pathname}`;
|
|
49
|
+
} catch {
|
|
50
|
+
return L(e);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function ue(e) {
|
|
54
|
+
if (!(typeof DOMParser > "u")) try {
|
|
55
|
+
return new DOMParser().parseFromString(e, "text/html");
|
|
56
|
+
} catch {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function de(e, t) {
|
|
61
|
+
return t?.querySelector("title")?.textContent || /<title[^>]*>([\s\S]*?)<\/title>/i.exec(e)?.[1];
|
|
62
|
+
}
|
|
63
|
+
function fe(e, t) {
|
|
64
|
+
let n = t?.querySelectorAll("form").length;
|
|
65
|
+
return n === void 0 ? Array.from(e.matchAll(/<form\b/gi)).length : n;
|
|
66
|
+
}
|
|
67
|
+
function pe(e, t) {
|
|
68
|
+
let n = t ? Array.from(t.querySelectorAll("input[name],textarea[name],select[name]")).map((e) => e.name).filter(Boolean) : Array.from(e.matchAll(/\bname\s*=\s*["']([^"']+)["']/gi)).map((e) => e[1]).filter((e) => !!e);
|
|
69
|
+
return Array.from(new Set(n)).slice(0, se);
|
|
70
|
+
}
|
|
71
|
+
function me(e, t) {
|
|
72
|
+
return m(t?.body?.textContent ?? e.replace(/<script\b[\s\S]*?<\/script>/gi, " ").replace(/<style\b[\s\S]*?<\/style>/gi, " ").replace(/<[^>]+>/g, " "), ce);
|
|
73
|
+
}
|
|
74
|
+
function he(e) {
|
|
75
|
+
let t = ue(e);
|
|
76
|
+
return {
|
|
77
|
+
length: e.length,
|
|
78
|
+
title: m(de(e, t), 200),
|
|
79
|
+
formCount: fe(e, t),
|
|
80
|
+
inputNames: pe(e, t),
|
|
81
|
+
textPreview: me(e, t)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function ge(e, t, n, r, i) {
|
|
85
|
+
let a = i ? I(i.input) : void 0, o = a?.startsWith("http") ? a : a ? `${F[i?.baseUrlType ?? ""]}${a}` : void 0;
|
|
86
|
+
u(e, {
|
|
87
|
+
source: t,
|
|
88
|
+
requestUrl: o ? le(o) : void 0,
|
|
89
|
+
responseUrl: n.url ? le(n.url) : void 0,
|
|
90
|
+
method: i?.init.method?.toUpperCase() ?? "GET",
|
|
91
|
+
baseUrlType: i?.baseUrlType,
|
|
92
|
+
sapClient: i?.sapClient,
|
|
93
|
+
status: n.status,
|
|
94
|
+
statusText: n.statusText,
|
|
95
|
+
contentType: n.headers.get("Content-Type") || void 0,
|
|
96
|
+
redirected: n.redirected,
|
|
97
|
+
responseType: n.type,
|
|
98
|
+
html: he(r)
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
var R = null, _e = 0;
|
|
102
|
+
function ve(e) {
|
|
103
|
+
if (typeof window > "u") return e;
|
|
104
|
+
try {
|
|
105
|
+
let t = new RegExp(__ORIGIN_REG_EXP__, "i"), n = new URL(e, window.location.origin), r = t.test(n.origin), i = n.origin === __SSO_ORIGIN__;
|
|
106
|
+
return r || i || n.origin === window.location.origin ? `${n.pathname}${n.search}${n.hash}` : n.toString();
|
|
107
|
+
} catch {
|
|
108
|
+
return e;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function z(e) {
|
|
112
|
+
return e ? typeof e.inputs.SAMLRequest == "string" || typeof e.inputs.SAMLResponse == "string" : !1;
|
|
113
|
+
}
|
|
114
|
+
function ye() {
|
|
115
|
+
let e = `${__APP_ID__}-sso-iframe-${++_e}`, t = document.createElement("iframe");
|
|
116
|
+
return t.name = e, t.style.display = "none", t;
|
|
117
|
+
}
|
|
118
|
+
function be(e, t) {
|
|
119
|
+
return new Promise((n) => {
|
|
120
|
+
let r = null, i = () => {
|
|
121
|
+
r !== null && window.clearTimeout(r), r = window.setTimeout(() => {
|
|
122
|
+
t(), n(!0);
|
|
123
|
+
}, 400);
|
|
124
|
+
};
|
|
125
|
+
e.addEventListener("load", i), e.addEventListener("error", i);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function xe(e, t) {
|
|
129
|
+
let n = document.createElement("form");
|
|
130
|
+
n.method = e.method === "GET" ? "GET" : "POST", n.action = ve(e.action), n.target = t, n.style.display = "none";
|
|
131
|
+
for (let [t, r] of Object.entries(e.inputs)) {
|
|
132
|
+
let e = document.createElement("input");
|
|
133
|
+
e.type = "hidden", e.name = t, e.value = r, n.appendChild(e);
|
|
134
|
+
}
|
|
135
|
+
return n;
|
|
136
|
+
}
|
|
137
|
+
function Se() {
|
|
138
|
+
return typeof document > "u" ? null : document.body ?? document.documentElement;
|
|
139
|
+
}
|
|
140
|
+
function Ce(e) {
|
|
141
|
+
let t = Se();
|
|
142
|
+
if (!t) return Promise.resolve(!1);
|
|
143
|
+
let n = ye(), r = xe(e, n.name), i = be(n, () => {
|
|
144
|
+
n.remove(), r.remove();
|
|
145
|
+
});
|
|
146
|
+
return t.appendChild(n), t.appendChild(r), r.submit(), i;
|
|
147
|
+
}
|
|
148
|
+
function we(e) {
|
|
149
|
+
let t = Se();
|
|
150
|
+
if (!t) return Promise.resolve(!1);
|
|
151
|
+
let n = ye(), r = be(n, () => {
|
|
152
|
+
n.remove();
|
|
153
|
+
});
|
|
154
|
+
return t.appendChild(n), n.src = ve(e), r;
|
|
155
|
+
}
|
|
156
|
+
function Te({ form: e, recoveryUrl: t } = {}) {
|
|
157
|
+
return R || (typeof window > "u" ? !1 : (R = (async () => z(e) ? Ce(e) : t ? we(t) : !1)().finally(() => {
|
|
158
|
+
R = null;
|
|
159
|
+
}), R));
|
|
160
|
+
}
|
|
161
|
+
var B = class e extends Error {
|
|
162
|
+
form;
|
|
163
|
+
recoveryUrl;
|
|
164
|
+
recoverable;
|
|
165
|
+
constructor(t, n, r, i = {}) {
|
|
166
|
+
super(t), this.form = n, this.recoveryUrl = r, this.recoverable = i.recoverable ?? !0, Object.setPrototypeOf(this, e.prototype);
|
|
167
|
+
}
|
|
168
|
+
}, V = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), U = null, W = null;
|
|
169
|
+
function G(e, t) {
|
|
170
|
+
if (t !== "") return !0;
|
|
171
|
+
let n = L(I(e));
|
|
172
|
+
return n.startsWith("/sap/") || n.startsWith("/sap-dp0/");
|
|
173
|
+
}
|
|
174
|
+
function K(e, t) {
|
|
175
|
+
return __DEV__ || __PREVIEW__ ? G(e, t) ? t === "odataDp0" || t === "" && L(I(e)).startsWith("/sap-dp0/") ? "300" : `${__SAP_CLIENT__}` : null : ne();
|
|
176
|
+
}
|
|
177
|
+
function Ee(e) {
|
|
178
|
+
return new B("Не удалось автоматически восстановить SSO-сессию. Перезагрузите страницу и выполните вход заново.", e.form, e.recoveryUrl, { recoverable: !1 });
|
|
179
|
+
}
|
|
180
|
+
function De(e) {
|
|
181
|
+
let t = Ee(e);
|
|
182
|
+
return typeof window < "u" && (W = t), t;
|
|
183
|
+
}
|
|
184
|
+
async function Oe() {
|
|
185
|
+
let e = U;
|
|
186
|
+
if (e && await e.catch(() => {}), W) throw W;
|
|
187
|
+
}
|
|
188
|
+
async function ke(e, t) {
|
|
189
|
+
if (W) throw W;
|
|
190
|
+
let n;
|
|
191
|
+
if (!U) {
|
|
192
|
+
if (U = (async () => {
|
|
193
|
+
if (!await Promise.resolve(Te({
|
|
194
|
+
form: e.form,
|
|
195
|
+
recoveryUrl: e.recoveryUrl
|
|
196
|
+
})).catch(() => !1)) throw De(e);
|
|
197
|
+
try {
|
|
198
|
+
n = { value: await t() }, W = null;
|
|
199
|
+
} catch (e) {
|
|
200
|
+
throw e instanceof B ? De(e) : e;
|
|
201
|
+
}
|
|
202
|
+
})().finally(() => {
|
|
203
|
+
U = null;
|
|
204
|
+
}), await U, !n) throw W ?? Ee(e);
|
|
205
|
+
return n.value;
|
|
206
|
+
}
|
|
207
|
+
await Oe();
|
|
208
|
+
try {
|
|
209
|
+
return await t();
|
|
210
|
+
} catch (e) {
|
|
211
|
+
throw e instanceof B ? De(e) : e;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function Ae(e, t, n) {
|
|
215
|
+
if (t === "config") return {
|
|
216
|
+
cacheKey: `${__APP_ID__}:${n ?? ""}`,
|
|
217
|
+
fetchUrl: "/Statistics"
|
|
218
|
+
};
|
|
219
|
+
let [r] = L(I(e)).split("/").filter(Boolean);
|
|
220
|
+
if (!r) throw Error("Не удалось определить сервис для получения CSRF-токена");
|
|
221
|
+
return {
|
|
222
|
+
cacheKey: `${t}:${n ?? ""}:${r}`,
|
|
223
|
+
fetchUrl: `/${r}/`
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
async function je(e, t, n) {
|
|
227
|
+
let r = Ae(e, t, n), i = V.get(r.cacheKey);
|
|
228
|
+
if (i) return i;
|
|
229
|
+
let a = H.get(r.cacheKey);
|
|
230
|
+
if (a) return a;
|
|
231
|
+
let o = new Headers({ "x-csrf-token": "Fetch" });
|
|
232
|
+
o.set("sap-language", "ru"), o.set("sap-contextid-accept", "header"), o.set("Accept-Language", "ru"), n && o.set("sap-client", n);
|
|
233
|
+
let s = (t && F[t]) ?? "", c = fetch(s + r.fetchUrl, {
|
|
234
|
+
method: "GET",
|
|
235
|
+
headers: o,
|
|
236
|
+
credentials: "include",
|
|
237
|
+
redirect: "manual"
|
|
238
|
+
}).then(async (e) => {
|
|
239
|
+
if (He(e)) throw new B("Требуется повторная аутентификация", void 0, s + r.fetchUrl);
|
|
240
|
+
if (!e.ok) throw Error("Не удалось получить CSRF-токен");
|
|
241
|
+
let t = e.headers.get("x-csrf-token");
|
|
242
|
+
if (!t) {
|
|
243
|
+
let t = (e.headers.get("Content-Type") || "").toLowerCase(), n = await e.text();
|
|
244
|
+
if (Ne(t, n)) {
|
|
245
|
+
let e = Me(n);
|
|
246
|
+
if (z(e)) throw new B("Требуется повторная аутентификация", e, s + r.fetchUrl);
|
|
247
|
+
}
|
|
248
|
+
throw Error("CSRF-токен отсутствует в ответе");
|
|
249
|
+
}
|
|
250
|
+
return V.set(r.cacheKey, t), H.delete(r.cacheKey), t;
|
|
251
|
+
}).catch((e) => {
|
|
252
|
+
throw H.delete(r.cacheKey), e;
|
|
253
|
+
});
|
|
254
|
+
return H.set(r.cacheKey, c), c;
|
|
255
|
+
}
|
|
256
|
+
function q(e, t) {
|
|
257
|
+
let n = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
258
|
+
return RegExp(`${n}\\s*=\\s*["']([^"']*)["']`, "i").exec(e)?.[1];
|
|
259
|
+
}
|
|
260
|
+
function Me(e) {
|
|
261
|
+
try {
|
|
262
|
+
if (typeof DOMParser < "u") {
|
|
263
|
+
let t = new DOMParser().parseFromString(e, "text/html").querySelector("form");
|
|
264
|
+
if (t) {
|
|
265
|
+
let e = t.getAttribute("action") || (typeof window < "u" ? window.location.href : ""), n = (t.getAttribute("method") || "GET").toUpperCase(), r = {};
|
|
266
|
+
return t.querySelectorAll("input[name]").forEach((e) => {
|
|
267
|
+
r[e.name] = e.value ?? "";
|
|
268
|
+
}), {
|
|
269
|
+
action: e,
|
|
270
|
+
method: n,
|
|
271
|
+
inputs: r
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
} catch {}
|
|
276
|
+
let t = /<form\b([^>]*)>([\s\S]*?)<\/form>/i.exec(e);
|
|
277
|
+
if (!t) return;
|
|
278
|
+
let [, n = "", r = ""] = t, i = q(n, "action") || (typeof window < "u" ? window.location.href : ""), a = (q(n, "method") || "GET").toUpperCase(), o = {};
|
|
279
|
+
for (let e of r.matchAll(/<input\b([^>]*)>/gi)) {
|
|
280
|
+
let t = e[1] ?? "", n = q(t, "name");
|
|
281
|
+
n && (o[n] = q(t, "value") ?? "");
|
|
282
|
+
}
|
|
283
|
+
return {
|
|
284
|
+
action: i,
|
|
285
|
+
method: a,
|
|
286
|
+
inputs: o
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function Ne(e, t) {
|
|
290
|
+
return e.includes("text/html") || /<html/i.test(t) || /<form/i.test(t);
|
|
291
|
+
}
|
|
292
|
+
function Pe(e) {
|
|
293
|
+
if (!c(e)) return e;
|
|
294
|
+
let t = { ...e };
|
|
295
|
+
return delete t.__metadata, t;
|
|
296
|
+
}
|
|
297
|
+
function Fe(e) {
|
|
298
|
+
if (c(e) && c(e.d) && Array.isArray(e.d.results)) {
|
|
299
|
+
let t;
|
|
300
|
+
return e.d.__count && (t = Number(e.d.__count)), {
|
|
301
|
+
data: e.d.results.map(Pe),
|
|
302
|
+
totalCount: t
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
return c(e) && e.d !== void 0 ? { data: Pe(e.d) } : { data: e };
|
|
306
|
+
}
|
|
307
|
+
var Ie = Object.freeze({ __noContent: !0 });
|
|
308
|
+
function Le(e) {
|
|
309
|
+
return !!e && typeof e == "object" && "__noContent" in e;
|
|
310
|
+
}
|
|
311
|
+
async function Re(e, t) {
|
|
312
|
+
if (e.status === 204 || e.status === 205) return { data: Ie };
|
|
313
|
+
let n = (e.headers.get("Content-Type") || "").toLowerCase();
|
|
314
|
+
if (n.includes("application/json") || n.includes("application/odata+json")) return Fe(await e.json());
|
|
315
|
+
let r = await e.text();
|
|
316
|
+
if (Ne(n, r)) {
|
|
317
|
+
let n = Me(r);
|
|
318
|
+
if (z(n)) throw new B("Требуется повторная аутентификация", n);
|
|
319
|
+
let i = /* @__PURE__ */ Error("Unexpected HTML response from OData endpoint");
|
|
320
|
+
throw ge(i, "fetch.parseResponse", e, r, t), i;
|
|
321
|
+
}
|
|
322
|
+
try {
|
|
323
|
+
return Fe(JSON.parse(r));
|
|
324
|
+
} catch (e) {
|
|
325
|
+
throw o(e), Error("Unsupported response content type and body is not JSON");
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function ze(e) {
|
|
329
|
+
if (typeof e != "string") return null;
|
|
330
|
+
let t = e.trim();
|
|
331
|
+
return t.length ? t : null;
|
|
332
|
+
}
|
|
333
|
+
function J(e, t) {
|
|
334
|
+
let n = ze(t);
|
|
335
|
+
!n || e.includes(n) || e.push(n);
|
|
336
|
+
}
|
|
337
|
+
function Be(e) {
|
|
338
|
+
let t = [], n = e.error;
|
|
339
|
+
typeof n == "string" && J(t, n);
|
|
340
|
+
let r = s(n);
|
|
341
|
+
return r && (J(t, r.code), J(t, s(r.message)?.value ?? r.message)), J(t, e.details), J(t, e.message), t;
|
|
342
|
+
}
|
|
343
|
+
async function Ve(e, t) {
|
|
344
|
+
let n = (e.headers.get("Content-Type") || "").toLowerCase();
|
|
345
|
+
try {
|
|
346
|
+
if (n.includes("application/json") || n.includes("application/odata+json")) {
|
|
347
|
+
let t = Be(await e.json());
|
|
348
|
+
if (t.length) return Error(t.join(" | "));
|
|
349
|
+
} else {
|
|
350
|
+
let r = ze(await e.text());
|
|
351
|
+
if (r) {
|
|
352
|
+
if (Ne(n, r)) {
|
|
353
|
+
let n = Me(r);
|
|
354
|
+
if (z(n)) return new B("Требуется повторная аутентификация", n);
|
|
355
|
+
let i = /* @__PURE__ */ Error("Unexpected HTML response from OData endpoint");
|
|
356
|
+
return ge(i, "fetch.buildHttpError", e, r, t), i;
|
|
357
|
+
}
|
|
358
|
+
return Error(r);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
} catch {}
|
|
362
|
+
return /* @__PURE__ */ Error(`HTTP error: ${e.status} ${e.statusText}`);
|
|
363
|
+
}
|
|
364
|
+
function He(e) {
|
|
365
|
+
return e.type === "opaqueredirect";
|
|
366
|
+
}
|
|
367
|
+
async function Ue(e, t = {}, n = "odata") {
|
|
368
|
+
let r = t.method?.toUpperCase() || "GET", i = new Headers(t.headers), a = !["GET", "HEAD"].includes(r), o = l(t.body), s = G(e, n), c = K(e, n);
|
|
369
|
+
if (i.set("sap-language", "ru"), s && (i.set("sap-language", "ru"), i.set("sap-contextid-accept", "header")), c && i.set("sap-client", c), a && s) {
|
|
370
|
+
let t = await je(e, n, c);
|
|
371
|
+
i.set("x-csrf-token", t);
|
|
372
|
+
}
|
|
373
|
+
i.has("Accept") || i.set("Accept", "application/json"), o && a && !i.has("Content-Type") && i.set("Content-Type", "application/json");
|
|
374
|
+
let u = (n && F[n]) ?? "", d = typeof e == "string" ? e : e.toString(), f = await fetch(u + d, {
|
|
375
|
+
...t,
|
|
376
|
+
headers: i,
|
|
377
|
+
credentials: "include",
|
|
378
|
+
redirect: s ? "manual" : t.redirect
|
|
379
|
+
});
|
|
380
|
+
if (s && He(f)) throw new B("Требуется повторная аутентификация", void 0, u + d);
|
|
381
|
+
if ((f.status === 401 || f.status === 403) && a && s && !t.retried) {
|
|
382
|
+
let r = Ae(e, n, c);
|
|
383
|
+
V.delete(r.cacheKey), H.delete(r.cacheKey);
|
|
384
|
+
let a = await je(e, n, c), o = new Headers(i);
|
|
385
|
+
if (o.set("x-csrf-token", a), f = await fetch(u + d, {
|
|
386
|
+
...t,
|
|
387
|
+
headers: o,
|
|
388
|
+
credentials: "include",
|
|
389
|
+
redirect: "manual",
|
|
390
|
+
retried: !0
|
|
391
|
+
}), He(f)) throw new B("Требуется повторная аутентификация", void 0, u + d);
|
|
392
|
+
}
|
|
393
|
+
return f;
|
|
394
|
+
}
|
|
395
|
+
async function We(e, t, n, r, i) {
|
|
396
|
+
if (!e.ok) throw e.status === 0 ? Error("Ошибка сети или CORS. Проверьте подключение и настройки сервера.") : await Ve(e, {
|
|
397
|
+
input: t,
|
|
398
|
+
init: n,
|
|
399
|
+
baseUrlType: r,
|
|
400
|
+
sapClient: i
|
|
401
|
+
});
|
|
402
|
+
return e;
|
|
403
|
+
}
|
|
404
|
+
async function Ge(e, t = {}, n = "odata") {
|
|
405
|
+
let r = K(e, n);
|
|
406
|
+
return We(await Ue(e, t, n), e, t, n, r);
|
|
407
|
+
}
|
|
408
|
+
async function Ke(e, t = {}, n = "odata") {
|
|
409
|
+
let r = G(e, n), i = K(e, n), a = () => Ge(e, {
|
|
410
|
+
...t,
|
|
411
|
+
ssoRetried: !0
|
|
412
|
+
}, n);
|
|
413
|
+
r && await Oe();
|
|
414
|
+
let o;
|
|
415
|
+
try {
|
|
416
|
+
o = await Ue(e, t, n);
|
|
417
|
+
} catch (e) {
|
|
418
|
+
if (r && e instanceof B && e.recoverable && !t.ssoRetried) o = await ke(e, a);
|
|
419
|
+
else throw e;
|
|
420
|
+
}
|
|
421
|
+
try {
|
|
422
|
+
return await We(o, e, t, n, i);
|
|
423
|
+
} catch (o) {
|
|
424
|
+
if (r && o instanceof B && o.recoverable && !t.ssoRetried) return We(await ke(o, a), e, t, n, i);
|
|
425
|
+
throw o;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
async function qe(e, t = {}, n = "odata") {
|
|
429
|
+
let r = new Headers(t.headers);
|
|
430
|
+
r.set("DataServiceVersion", "2.0"), r.set("MaxDataServiceVersion", "2.0");
|
|
431
|
+
let i = {
|
|
432
|
+
...t,
|
|
433
|
+
headers: r
|
|
434
|
+
}, a = {
|
|
435
|
+
input: e,
|
|
436
|
+
init: t,
|
|
437
|
+
baseUrlType: n,
|
|
438
|
+
sapClient: K(e, n)
|
|
439
|
+
};
|
|
440
|
+
try {
|
|
441
|
+
return await Re(await Ke(e, i, n), a);
|
|
442
|
+
} catch (r) {
|
|
443
|
+
if (G(e, n) && r instanceof B && r.recoverable && !t.ssoRetried) return ke(r, async () => {
|
|
444
|
+
let t = {
|
|
445
|
+
...i,
|
|
446
|
+
ssoRetried: !0
|
|
447
|
+
};
|
|
448
|
+
return Re(await Ge(e, t, n), {
|
|
449
|
+
input: e,
|
|
450
|
+
init: t,
|
|
451
|
+
baseUrlType: n,
|
|
452
|
+
sapClient: K(e, n)
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
throw r;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
function Je(e, t) {
|
|
459
|
+
let n = t.init || {}, r = t.baseUrl, i = t.transform;
|
|
460
|
+
if (t.swCache) {
|
|
461
|
+
let e = new Headers(n.headers);
|
|
462
|
+
e.set("x-sw-cache", t.swCache), n.headers = e;
|
|
463
|
+
}
|
|
464
|
+
return async (t) => {
|
|
465
|
+
!n.signal && t?.signal && (n.signal = t.signal);
|
|
466
|
+
let a = await Ke(e, n, r);
|
|
467
|
+
if (typeof i != "function") throw Error("fetchQueryFn requires a transformation function!");
|
|
468
|
+
return await i(a);
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
//#endregion
|
|
472
|
+
//#region node_modules/@ryuzaki13/react-foundation-api/dist/chunks/odataFetchFn-D8PGKDZM.js
|
|
473
|
+
var Y = ["odata"];
|
|
474
|
+
function Ye(e, t, n) {
|
|
475
|
+
n === void 0 || n === "" || e.set(t, String(n));
|
|
476
|
+
}
|
|
477
|
+
function Xe(e, t = {}, n = {}) {
|
|
478
|
+
let [r, i = ""] = e.split("?"), a = new URLSearchParams(i);
|
|
479
|
+
if (t.expression) {
|
|
480
|
+
let e = S(t.expression);
|
|
481
|
+
e && a.set("$filter", e);
|
|
482
|
+
}
|
|
483
|
+
t.sorts && a.set("$orderby", C(t.sorts)), t.select && a.set("$select", t.select.join(",")), t.expand && a.set("$expand", t.expand.join(",")), Ye(a, "$top", t.top), Ye(a, "$skip", t.skip), Ye(a, "$inlinecount", t.inlinecount);
|
|
484
|
+
let o = r.replace(/\/+$/, ""), s = a.toString(), c = s ? `${o}?${s}` : o, l = n;
|
|
485
|
+
if (t.swCache) {
|
|
486
|
+
let e = new Headers(n.headers);
|
|
487
|
+
e.set("x-sw-cache", t.swCache), l = {
|
|
488
|
+
...n,
|
|
489
|
+
headers: e
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
return {
|
|
493
|
+
path: c,
|
|
494
|
+
fullUrl: `${F[t.baseUrl ?? "odata"]}${c}`,
|
|
495
|
+
baseUrl: t.baseUrl,
|
|
496
|
+
init: l,
|
|
497
|
+
queryString: s
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
async function X(e, t = {}, n = {}) {
|
|
501
|
+
let r = Xe(e, t, n);
|
|
502
|
+
return qe(r.path, r.init, t.baseUrl);
|
|
503
|
+
}
|
|
504
|
+
var Ze = __APP_BUILD_ID__, Qe = 1e3 * 60 * 60 * 24;
|
|
505
|
+
function $e(e) {
|
|
506
|
+
if (e) return Array.isArray(e) ? e[0] : e;
|
|
507
|
+
}
|
|
508
|
+
var et = ({ service: e }) => [
|
|
509
|
+
...Y,
|
|
510
|
+
"metadata-version",
|
|
511
|
+
{
|
|
512
|
+
service: e,
|
|
513
|
+
buildId: Ze
|
|
514
|
+
}
|
|
515
|
+
];
|
|
516
|
+
function tt(e) {
|
|
517
|
+
return {
|
|
518
|
+
service: e,
|
|
519
|
+
changedAt: null,
|
|
520
|
+
version: null
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
function nt(e) {
|
|
524
|
+
return async ({ signal: t }) => {
|
|
525
|
+
let n = N().metadataVersion;
|
|
526
|
+
if (!n) return tt(e.service);
|
|
527
|
+
let r = f($e((await X(`/${n.service}/${n.target}('${te(e.service)}')`, { baseUrl: P(n.service, n.baseUrl) }, { signal: t })).data)?.lastChanged);
|
|
528
|
+
return {
|
|
529
|
+
service: e.service,
|
|
530
|
+
changedAt: r,
|
|
531
|
+
version: r ? d(r) : null
|
|
532
|
+
};
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
var rt = (e) => h({
|
|
536
|
+
queryKey: et(e),
|
|
537
|
+
queryFn: nt(e),
|
|
538
|
+
meta: v,
|
|
539
|
+
enabled: !!(e.service && N().metadataVersion),
|
|
540
|
+
staleTime: e.staleTime ?? Qe,
|
|
541
|
+
gcTime: Infinity
|
|
542
|
+
});
|
|
543
|
+
function it(e, t) {
|
|
544
|
+
return e.invalidateQueries({ predicate: (e) => {
|
|
545
|
+
let [n, r, i] = e.queryKey;
|
|
546
|
+
return n !== Y[0] || r !== "metadata" || !i || typeof i != "object" ? !1 : "service" in i && i.service === t;
|
|
547
|
+
} });
|
|
548
|
+
}
|
|
549
|
+
function at(e, t) {
|
|
550
|
+
return e?.data === void 0 || !t.changedAt ? !1 : t.changedAt.getTime() > e.dataUpdatedAt;
|
|
551
|
+
}
|
|
552
|
+
function ot(e) {
|
|
553
|
+
return Je(`/${e.service}/$metadata`, {
|
|
554
|
+
baseUrl: P(e.service, e.baseUrl),
|
|
555
|
+
init: { headers: {
|
|
556
|
+
Accept: "*/*",
|
|
557
|
+
"Content-Type": "application/xml"
|
|
558
|
+
} },
|
|
559
|
+
transform: async (t) => {
|
|
560
|
+
try {
|
|
561
|
+
return T(await t.text());
|
|
562
|
+
} catch (t) {
|
|
563
|
+
throw Error(`Сервис ${e.service} содержит необработанную ошибку: ${String(t)}`);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
var Z = (e) => h({
|
|
569
|
+
queryKey: [
|
|
570
|
+
...Y,
|
|
571
|
+
"metadata",
|
|
572
|
+
e
|
|
573
|
+
],
|
|
574
|
+
queryFn: ot(e),
|
|
575
|
+
meta: v,
|
|
576
|
+
enabled: !!e.service,
|
|
577
|
+
staleTime: Infinity,
|
|
578
|
+
gcTime: Infinity
|
|
579
|
+
});
|
|
580
|
+
async function st(e, t, n) {
|
|
581
|
+
if (!t.service) return;
|
|
582
|
+
let r = Z(t).queryKey;
|
|
583
|
+
at(e.getQueryState(r), n) && await it(e, t.service);
|
|
584
|
+
}
|
|
585
|
+
function ct(e) {
|
|
586
|
+
let t = _(), i = r(() => ({
|
|
587
|
+
service: e.service,
|
|
588
|
+
baseUrl: e.baseUrl
|
|
589
|
+
}), [e.baseUrl, e.service]), a = g(rt(r(() => ({ service: e.service }), [e.service]))), o = g(Z(i));
|
|
590
|
+
return n(() => {
|
|
591
|
+
!e.service || !a.isSuccess || st(t, i, a.data);
|
|
592
|
+
}, [
|
|
593
|
+
i,
|
|
594
|
+
o.dataUpdatedAt,
|
|
595
|
+
e.service,
|
|
596
|
+
t,
|
|
597
|
+
a.data,
|
|
598
|
+
a.isSuccess
|
|
599
|
+
]), o;
|
|
600
|
+
}
|
|
601
|
+
async function lt(e, t) {
|
|
602
|
+
let n = { service: e.service };
|
|
603
|
+
try {
|
|
604
|
+
await st(t, e, await t.fetchQuery(rt(n)));
|
|
605
|
+
} catch {}
|
|
606
|
+
}
|
|
607
|
+
async function ut(e, t) {
|
|
608
|
+
if (e.service) return await t.fetchQuery(Z(e)), await lt(e, t), t.fetchQuery(Z(e));
|
|
609
|
+
}
|
|
610
|
+
function Q(e) {
|
|
611
|
+
return "returnType" in e;
|
|
612
|
+
}
|
|
613
|
+
function dt(e, t) {
|
|
614
|
+
let n = e?.entities[t], r = e?.functionImports[t];
|
|
615
|
+
if (n && r) throw Error(`Найден конфликт metadata: '${t}' существует и как Entity, и как FunctionImport`);
|
|
616
|
+
if (n) return n;
|
|
617
|
+
if (r) return r;
|
|
618
|
+
throw Error(`OData target '${t}' не был загружен`);
|
|
619
|
+
}
|
|
620
|
+
function ft(e, t, n) {
|
|
621
|
+
if (Q(e)) {
|
|
622
|
+
if (t !== "fi") throw Error(`OData operation '${t}' несовместима с FunctionImport '${e.name}'. Для FunctionImport используйте method: 'fi'.`);
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
if (t === "fi") throw Error(`OData operation 'fi' несовместима с Entity '${n.target}'. Для Entity используйте один из методов: 'create', 'update', 'delete', 'read', 'query', 'fm'.`);
|
|
626
|
+
if (t === "read" && e.result) throw Error(`OData operation '${t}' несовместима с parameterized query entity '${n.target}'. Для target с result='${e.result}' используйте method: 'query'.`);
|
|
627
|
+
}
|
|
628
|
+
function pt(e, t) {
|
|
629
|
+
if (t === "create") return "POST";
|
|
630
|
+
if (t === "update") return "PUT";
|
|
631
|
+
if (t === "delete") return "DELETE";
|
|
632
|
+
if (t === "read" || t === "query") return "GET";
|
|
633
|
+
if (Q(e)) {
|
|
634
|
+
if (!e.httpMethod) throw Error(`FunctionImport '${e.name}' не содержит httpMethod в metadata, поэтому operation 'fi' выполнить нельзя.`);
|
|
635
|
+
return e.httpMethod;
|
|
636
|
+
}
|
|
637
|
+
throw Error(`OData operation '${t}' не поддерживается для target '${"title" in e ? e.title : "unknown"}'.`);
|
|
638
|
+
}
|
|
639
|
+
function mt(e, t) {
|
|
640
|
+
if (e && (t === "create" || t === "update")) return JSON.stringify(e);
|
|
641
|
+
}
|
|
642
|
+
function ht(e, t, n, r) {
|
|
643
|
+
if (Q(e)) return x(e, t, n);
|
|
644
|
+
if (r === "fi") throw Error(`OData operation 'fi' несовместима с Entity '${t.target}'.`);
|
|
645
|
+
return y(e, t, n, r);
|
|
646
|
+
}
|
|
647
|
+
function gt(e, t) {
|
|
648
|
+
if (!Q(e)) return e.columns;
|
|
649
|
+
if (e.resultEntity) return t.entities[e.resultEntity]?.columns;
|
|
650
|
+
}
|
|
651
|
+
function _t(e) {
|
|
652
|
+
let t = [];
|
|
653
|
+
for (let n = 0; n < e.length; n += 1) {
|
|
654
|
+
let r = e[n];
|
|
655
|
+
t.push({
|
|
656
|
+
id: r.id,
|
|
657
|
+
type: r.type,
|
|
658
|
+
abapBooleanLike: r.abapBooleanLike
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
return t;
|
|
662
|
+
}
|
|
663
|
+
function vt(e, t) {
|
|
664
|
+
let n;
|
|
665
|
+
for (let r = 0; r < t.length; r += 1) {
|
|
666
|
+
let i = t[r];
|
|
667
|
+
if (!Object.prototype.hasOwnProperty.call(e, i.id)) continue;
|
|
668
|
+
let a = e[i.id], o = w(i, a);
|
|
669
|
+
o !== a && (n ||= { ...e }, n[i.id] = o);
|
|
670
|
+
}
|
|
671
|
+
return n ?? e;
|
|
672
|
+
}
|
|
673
|
+
function yt(e, t, n) {
|
|
674
|
+
let r = gt(t, n);
|
|
675
|
+
if (!r?.length) return e;
|
|
676
|
+
let i = _t(r);
|
|
677
|
+
if (Array.isArray(e)) {
|
|
678
|
+
let t;
|
|
679
|
+
for (let n = 0; n < e.length; n += 1) {
|
|
680
|
+
let r = e[n];
|
|
681
|
+
if (!c(r)) continue;
|
|
682
|
+
let a = vt(r, i);
|
|
683
|
+
a !== r && (t ||= e.slice(), t[n] = a);
|
|
684
|
+
}
|
|
685
|
+
return t ?? e;
|
|
686
|
+
}
|
|
687
|
+
return c(e) ? vt(e, i) : e;
|
|
688
|
+
}
|
|
689
|
+
function bt(...e) {
|
|
690
|
+
let [t, n] = e, { odata: r, options: i = {}, init: a = {}, autoParse: o, swCache: s } = n, c = "params" in n ? n.params ?? {} : {};
|
|
691
|
+
return async ({ client: e, signal: l }) => {
|
|
692
|
+
let u = P(r.service, i.baseUrl), d = await ut({
|
|
693
|
+
service: r.service,
|
|
694
|
+
baseUrl: u
|
|
695
|
+
}, e);
|
|
696
|
+
if (!d) throw Error(`Не удалось загрузить metadata OData-сервиса '${r.service}'`);
|
|
697
|
+
let f = dt(d, r.target);
|
|
698
|
+
ft(f, t, r);
|
|
699
|
+
let p = "body" in n ? mt(n.body, t) : void 0, m = pt(f, t);
|
|
700
|
+
__DEV__ && t === "query" && !("result" in f) && Object.keys(c).length > 0 && console.warn(`OData query для plain entity "${r.service}/${r.target}" получил params, но они будут проигнорированы. Для чтения сущности по ключу используйте odataReadFn.`);
|
|
701
|
+
let h = ht(f, r, c, t), g = s ? {
|
|
702
|
+
...i,
|
|
703
|
+
baseUrl: u,
|
|
704
|
+
swCache: s
|
|
705
|
+
} : {
|
|
706
|
+
...i,
|
|
707
|
+
baseUrl: u
|
|
708
|
+
}, _ = {
|
|
709
|
+
...a,
|
|
710
|
+
method: m,
|
|
711
|
+
body: p,
|
|
712
|
+
signal: l
|
|
713
|
+
};
|
|
714
|
+
if (t === "query") {
|
|
715
|
+
let e = await X(h, g, _);
|
|
716
|
+
if (Le(e)) throw Error("OData query не должен возвращать 204 No Content");
|
|
717
|
+
let t = o ? yt(e.data, f, d) : e.data;
|
|
718
|
+
return {
|
|
719
|
+
data: n.transform ? n.transform(t, f) : t,
|
|
720
|
+
totalCount: e.totalCount
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
let v = await X(h, g, _);
|
|
724
|
+
if (Le(v)) return { data: v.data };
|
|
725
|
+
let y = o ? yt(v.data, f, d) : v.data;
|
|
726
|
+
return {
|
|
727
|
+
data: n.transform ? n.transform(y, f) : y,
|
|
728
|
+
totalCount: v.totalCount
|
|
729
|
+
};
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
function xt(e) {
|
|
733
|
+
return bt("query", e);
|
|
734
|
+
}
|
|
735
|
+
//#endregion
|
|
736
|
+
//#region node_modules/@ryuzaki13/react-foundation-api/dist/odata/index.js
|
|
737
|
+
var St = () => [...Y, "collection"], Ct = ({ service: e, target: t, limitedKeys: n, serverFilter: r }) => [...St(), {
|
|
738
|
+
service: e,
|
|
739
|
+
target: t,
|
|
740
|
+
limitedKeys: n,
|
|
741
|
+
serverFilter: r
|
|
742
|
+
}];
|
|
743
|
+
function wt(e) {
|
|
744
|
+
let t = [];
|
|
745
|
+
for (let [n, r] of e.entries()) {
|
|
746
|
+
let e = `${r.odata.service}.${r.odata.target}`;
|
|
747
|
+
for (let [i, [a, o]] of Object.entries(r.segments).entries()) t.push({
|
|
748
|
+
id: a,
|
|
749
|
+
serviceKey: e,
|
|
750
|
+
serviceIndex: n,
|
|
751
|
+
segmentIndex: i,
|
|
752
|
+
odata: r.odata,
|
|
753
|
+
segment: o,
|
|
754
|
+
model: {
|
|
755
|
+
...r.model,
|
|
756
|
+
codeKey: a
|
|
757
|
+
},
|
|
758
|
+
panelVisibility: o.panelVisibility ?? "user"
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
return t;
|
|
762
|
+
}
|
|
763
|
+
async function Tt(e) {
|
|
764
|
+
let { url: t, query: n, signal: r } = e;
|
|
765
|
+
try {
|
|
766
|
+
let e = await X(t, n, { signal: r });
|
|
767
|
+
if (Le(e)) throw Error("отсутствует тело ответа");
|
|
768
|
+
return { items: e.data.map(({ ID: e, CNT: t, __metadata: n, __Parameters: r, ...i }) => i) };
|
|
769
|
+
} catch (e) {
|
|
770
|
+
return o("Ошибка загрузки справочника:", e), { items: [] };
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
var Et = __APP_BUILD_ID__, Dt = 1e3 * 60 * 60 * 4, Ot = 1e3 * 60 * 60 * 24 * 7, kt = "ttl=forever;name=ref", At = "bust=forever;name=ref", jt = "ttl=4h;name=ref-updates", Mt = () => [
|
|
774
|
+
...Y,
|
|
775
|
+
"collection-updates",
|
|
776
|
+
{ buildId: Et }
|
|
777
|
+
];
|
|
778
|
+
function Nt(e) {
|
|
779
|
+
return {
|
|
780
|
+
...e,
|
|
781
|
+
lastChangedAt: f(e.lastChanged)
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
function Pt(e, t) {
|
|
785
|
+
let n = e.map(Nt);
|
|
786
|
+
return {
|
|
787
|
+
items: n,
|
|
788
|
+
byEntityName: n.reduce((e, t) => (t.entityName && (e[t.entityName] = t), e), {}),
|
|
789
|
+
fetchedAt: t,
|
|
790
|
+
coverageStartedAt: t - Ot
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
function Ft() {
|
|
794
|
+
return async ({ signal: e }) => {
|
|
795
|
+
let t = Date.now(), n = N().collectionUpdates;
|
|
796
|
+
return n ? Pt((await X(`/${n.service}/${n.target}`, {
|
|
797
|
+
baseUrl: P(n.service, n.baseUrl),
|
|
798
|
+
swCache: jt
|
|
799
|
+
}, { signal: e })).data, Math.max(t, Date.now())) : Pt([], t);
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
var It = (e = {}) => h({
|
|
803
|
+
queryKey: Mt(),
|
|
804
|
+
queryFn: Ft(),
|
|
805
|
+
meta: v,
|
|
806
|
+
enabled: !!N().collectionUpdates,
|
|
807
|
+
staleTime: e.staleTime ?? Dt,
|
|
808
|
+
gcTime: Infinity
|
|
809
|
+
});
|
|
810
|
+
function Lt(e = {}) {
|
|
811
|
+
return g(It(e));
|
|
812
|
+
}
|
|
813
|
+
function Rt(e) {
|
|
814
|
+
let { data: t, dataUpdatedAt: n = 0, isLoading: r, isError: i } = ct({ service: e.service }), a = t?.entities[e.target];
|
|
815
|
+
if (!r && !a && t?.functionImports[e.target]) throw Error(`OData target '${e.target}' является FunctionImport и не может использоваться как сущность`);
|
|
816
|
+
if (i) throw Error(`Ошибка загрузки метаданных сервиса ${e.service}`);
|
|
817
|
+
return {
|
|
818
|
+
metadata: a,
|
|
819
|
+
metadataUpdatedAt: n,
|
|
820
|
+
isLoading: r
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
var $ = "Использование actions недопустимо до окончания загрузки metadata";
|
|
824
|
+
function zt(e) {
|
|
825
|
+
let { metadata: t, metadataUpdatedAt: n, isLoading: i } = Rt(e);
|
|
826
|
+
return {
|
|
827
|
+
config: e,
|
|
828
|
+
metadata: t,
|
|
829
|
+
metadataUpdatedAt: n,
|
|
830
|
+
isLoading: i,
|
|
831
|
+
actions: r(() => ({
|
|
832
|
+
getEntityPath: (n = {}) => {
|
|
833
|
+
if (!t) throw Error($);
|
|
834
|
+
return b(t, e, n);
|
|
835
|
+
},
|
|
836
|
+
getKeys: () => {
|
|
837
|
+
if (!t) throw Error($);
|
|
838
|
+
return t.columns?.map((e) => e.id);
|
|
839
|
+
},
|
|
840
|
+
getKeyPairs: () => {
|
|
841
|
+
if (!t) throw Error($);
|
|
842
|
+
return t.columns?.filter((e) => e.semanticType === "code" && e.linkedColumnId).map((e) => ({
|
|
843
|
+
codeKey: e.id,
|
|
844
|
+
textKey: e.linkedColumnId
|
|
845
|
+
}));
|
|
846
|
+
},
|
|
847
|
+
getKeyPairsMap: () => {
|
|
848
|
+
if (!t) throw Error($);
|
|
849
|
+
let e = {};
|
|
850
|
+
for (let n of t.columns ?? []) n.semanticType === "code" && n.linkedColumnId && (e[n.id] = n.linkedColumnId);
|
|
851
|
+
return e;
|
|
852
|
+
}
|
|
853
|
+
}), [e, t])
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
function Bt(e, t) {
|
|
857
|
+
if (!t) return e;
|
|
858
|
+
let n = e.trim().toLowerCase();
|
|
859
|
+
return n === "off" || n.startsWith("bust=") ? e : n.startsWith("ttl=") ? e.replace(/^\s*ttl=/i, "bust=") : At;
|
|
860
|
+
}
|
|
861
|
+
function Vt(e) {
|
|
862
|
+
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
863
|
+
}
|
|
864
|
+
function Ht(e, t) {
|
|
865
|
+
let n = t?.cacheUpdatedAt ?? 0, r = e.update?.lastChangedAt?.getTime();
|
|
866
|
+
return !!(Vt(r) && (!t || !n || r > n) || Vt(e.metadataUpdatedAt) && (!t || !n || e.metadataUpdatedAt > n) || Vt(e.updatesCoverageStartedAt) && (!t || !n || n < e.updatesCoverageStartedAt));
|
|
867
|
+
}
|
|
868
|
+
function Ut(e) {
|
|
869
|
+
let { service: t, target: i, limitedKeys: a, excludeEmpty: o, sortByCode: s, serverFilter: c, clientFilter: l, swCache: u = kt } = e, d = _(), { actions: f, metadata: p, metadataUpdatedAt: m, isLoading: h } = zt(e), y = Lt(), b = r(() => Ct({
|
|
870
|
+
service: t,
|
|
871
|
+
target: i,
|
|
872
|
+
limitedKeys: a,
|
|
873
|
+
serverFilter: c
|
|
874
|
+
}), [
|
|
875
|
+
t,
|
|
876
|
+
i,
|
|
877
|
+
a,
|
|
878
|
+
c
|
|
879
|
+
]), x = d.getQueryData(b), S = y.data?.byEntityName[i], C = Ht({
|
|
880
|
+
update: S,
|
|
881
|
+
metadataUpdatedAt: m,
|
|
882
|
+
updatesCoverageStartedAt: y.data?.coverageStartedAt
|
|
883
|
+
}, x), w = Bt(u, C), T = y.isError || y.isSuccess && !y.isFetching;
|
|
884
|
+
return n(() => {
|
|
885
|
+
!x || !C || d.invalidateQueries({ queryKey: b });
|
|
886
|
+
}, [
|
|
887
|
+
x,
|
|
888
|
+
d,
|
|
889
|
+
b,
|
|
890
|
+
C
|
|
891
|
+
]), g({
|
|
892
|
+
queryKey: b,
|
|
893
|
+
queryFn: async ({ signal: e }) => {
|
|
894
|
+
let n = Date.now(), r = a ? [...a] : f.getKeys(), u = f.getKeyPairs(), d = f.getKeyPairsMap();
|
|
895
|
+
if (a) for (let e of a) {
|
|
896
|
+
let t = d[e];
|
|
897
|
+
t && !r.includes(t) && r.push(t);
|
|
898
|
+
}
|
|
899
|
+
let { items: p } = await Tt({
|
|
900
|
+
url: `/${t}/${i}`,
|
|
901
|
+
query: {
|
|
902
|
+
select: r,
|
|
903
|
+
expression: c,
|
|
904
|
+
swCache: w
|
|
905
|
+
},
|
|
906
|
+
signal: e
|
|
907
|
+
}), h = p;
|
|
908
|
+
l && (h = p.filter(l));
|
|
909
|
+
let g = E(h, u, o, s), _ = u.map((e) => ({
|
|
910
|
+
codeKey: e.codeKey,
|
|
911
|
+
count: g[e.codeKey].length
|
|
912
|
+
})).sort((e, t) => e.count - t.count);
|
|
913
|
+
return {
|
|
914
|
+
items: h,
|
|
915
|
+
keyPairs: u,
|
|
916
|
+
keyPairsMap: d,
|
|
917
|
+
separated: g,
|
|
918
|
+
chain: _,
|
|
919
|
+
count: h.length,
|
|
920
|
+
cacheUpdatedAt: Math.max(n, Date.now(), S?.lastChangedAt?.getTime() ?? 0, m)
|
|
921
|
+
};
|
|
922
|
+
},
|
|
923
|
+
enabled: !!(!h && p && t && i && T),
|
|
924
|
+
meta: v,
|
|
925
|
+
staleTime: 1e3 * 60 * 60 * 2,
|
|
926
|
+
gcTime: 1e3 * 60 * 60 * 1
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
function Wt({ odata: e, model: n, pageSize: o = 50 }) {
|
|
930
|
+
let { codeKey: s, maxVisibleItems: c } = n, { data: l, isLoading: u, isError: d, refetch: f } = Ut(e), p = l?.keyPairsMap[s] ?? "", m = _(), [h, g] = a(), v = i(/* @__PURE__ */ new Map()), { itemsMap: y, separatedItems: b, orderedKeys: x } = r(() => {
|
|
931
|
+
let e = /* @__PURE__ */ new Map(), t = [], n = [];
|
|
932
|
+
if (l && l.separated[s]) {
|
|
933
|
+
n = l.separated[s];
|
|
934
|
+
for (let r of n) {
|
|
935
|
+
let n = r[s];
|
|
936
|
+
n && (e.set(n, r), t.push(n));
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return {
|
|
940
|
+
itemsMap: e,
|
|
941
|
+
separatedItems: n,
|
|
942
|
+
orderedKeys: t
|
|
943
|
+
};
|
|
944
|
+
}, [l, s]), S = t((e) => {
|
|
945
|
+
let t = l?.separated[s];
|
|
946
|
+
if (!t) return /* @__PURE__ */ new Map();
|
|
947
|
+
let n = /* @__PURE__ */ new Map();
|
|
948
|
+
for (let r of t) {
|
|
949
|
+
let t = r[e]?.toLowerCase();
|
|
950
|
+
if (t) for (let e = 1; e <= Math.min(5, t.length); e++) {
|
|
951
|
+
let i = t.substring(0, e);
|
|
952
|
+
n.has(i) || n.set(i, /* @__PURE__ */ new Set()), n.get(i).add(r[s]);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
return n;
|
|
956
|
+
}, [l, s]), C = t((e) => {
|
|
957
|
+
g(() => {
|
|
958
|
+
if (e?.length) return new Set(e.map((e) => e[s]));
|
|
959
|
+
});
|
|
960
|
+
}, [s]), w = t((e, t) => {
|
|
961
|
+
if (!x.length) return [];
|
|
962
|
+
let n = c, r = /* @__PURE__ */ new Set(), i = [];
|
|
963
|
+
if (t?.length) for (let e = 0; e < t.length; e++) r.add(t[e][s]);
|
|
964
|
+
let a = 0, o = h && h.size > 0;
|
|
965
|
+
for (let t of x) {
|
|
966
|
+
if (a >= n) break;
|
|
967
|
+
let c = y.get(t);
|
|
968
|
+
if (!c || r.size > 0 && r.has(t)) continue;
|
|
969
|
+
let l = c[s];
|
|
970
|
+
o && !h.has(l) || e && !e(l, c[p]) || (i.push(c), a++);
|
|
971
|
+
}
|
|
972
|
+
return i;
|
|
973
|
+
}, [
|
|
974
|
+
x,
|
|
975
|
+
c,
|
|
976
|
+
s,
|
|
977
|
+
y,
|
|
978
|
+
h,
|
|
979
|
+
p
|
|
980
|
+
]), T = t((e) => {
|
|
981
|
+
let t = l?.separated[s] || [], n = e * o, r = n + o;
|
|
982
|
+
return t.slice(n, r);
|
|
983
|
+
}, [
|
|
984
|
+
l,
|
|
985
|
+
o,
|
|
986
|
+
s
|
|
987
|
+
]), E = t((e, t) => {
|
|
988
|
+
if (!l) return [];
|
|
989
|
+
let n = new Set(t);
|
|
990
|
+
return l.items.filter((t) => n.has(t[e]));
|
|
991
|
+
}, [l]), D = t((e, t, n = 200) => {
|
|
992
|
+
v.current.has(e) && clearTimeout(v.current.get(e));
|
|
993
|
+
let r = setTimeout(t, n);
|
|
994
|
+
v.current.set(e, r);
|
|
995
|
+
}, []), O = t(() => {
|
|
996
|
+
for (let e of v.current.values()) clearTimeout(e);
|
|
997
|
+
v.current.clear();
|
|
998
|
+
}, []);
|
|
999
|
+
return r(() => () => {
|
|
1000
|
+
O();
|
|
1001
|
+
}, [O]), {
|
|
1002
|
+
data: l,
|
|
1003
|
+
isLoading: u,
|
|
1004
|
+
isError: d,
|
|
1005
|
+
codeKey: s,
|
|
1006
|
+
textKey: p,
|
|
1007
|
+
getItems: w,
|
|
1008
|
+
findSourceItemsByKeys: E,
|
|
1009
|
+
setFilteredItems: C,
|
|
1010
|
+
getPage: T,
|
|
1011
|
+
buildSearchIndex: S,
|
|
1012
|
+
debounce: D,
|
|
1013
|
+
itemsMap: y,
|
|
1014
|
+
separatedItems: b,
|
|
1015
|
+
orderedKeys: x,
|
|
1016
|
+
refetch: f,
|
|
1017
|
+
invalidate: () => m.invalidateQueries({ queryKey: Ct(e) }),
|
|
1018
|
+
totalCount: l?.separated[s]?.length || 0,
|
|
1019
|
+
pageSize: o
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
function Gt(e) {
|
|
1023
|
+
let [t] = a(() => {
|
|
1024
|
+
let t = D.getState(), { codeKey: n, maxVisibleItems: r = t.defaultMaxVisibleItems, minSearchCodeLength: i = t.defaultMinSearchCodeLength, minSearchTextLength: a = t.defaultMinSearchTextLength, searchDebounceDelay: o = t.defaultSearchDebounceDelay } = e;
|
|
1025
|
+
return {
|
|
1026
|
+
codeKey: n,
|
|
1027
|
+
maxVisibleItems: r,
|
|
1028
|
+
minSearchCodeLength: i,
|
|
1029
|
+
minSearchTextLength: a,
|
|
1030
|
+
searchDebounceDelay: o
|
|
1031
|
+
};
|
|
1032
|
+
});
|
|
1033
|
+
return t;
|
|
1034
|
+
}
|
|
1035
|
+
function Kt(e, t) {
|
|
1036
|
+
let n = {}, r = (e) => {
|
|
1037
|
+
for (let i of e) {
|
|
1038
|
+
if ("columns" in i && Array.isArray(i.columns) && i.columns.length > 0) {
|
|
1039
|
+
r(i.columns);
|
|
1040
|
+
continue;
|
|
1041
|
+
}
|
|
1042
|
+
let e = ee(i);
|
|
1043
|
+
!e || !(e in t) || (n[e] = t[e]);
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
return r(e), n;
|
|
1047
|
+
}
|
|
1048
|
+
function qt(e) {
|
|
1049
|
+
let { metadata: t, isLoading: n } = Rt(e);
|
|
1050
|
+
return {
|
|
1051
|
+
columns: r(() => t ? e.mode === "build" ? k(t.columns, {
|
|
1052
|
+
resolveHeader: e.resolveHeader,
|
|
1053
|
+
resolveFormatting: e.resolveFormatting
|
|
1054
|
+
}) : A(e.columns, t.columns) : e.mode === "build" ? [] : [...e.columns], [e, t]),
|
|
1055
|
+
defaultColumnVisibility: r(() => {
|
|
1056
|
+
if (!t) return;
|
|
1057
|
+
if (e.mode === "build") return O(t.columns, { resolveVisible: e.resolveVisible });
|
|
1058
|
+
let n = O(t.columns);
|
|
1059
|
+
return Kt(e.columns, n);
|
|
1060
|
+
}, [e, t]),
|
|
1061
|
+
metadata: t,
|
|
1062
|
+
isLoading: n
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
//#endregion
|
|
1066
|
+
//#region src/select/model/useODataSelectBase.ts
|
|
1067
|
+
var Jt = "", Yt = "";
|
|
1068
|
+
function Xt(e) {
|
|
1069
|
+
return e?.length ? [...new Set(e)].sort() : [];
|
|
1070
|
+
}
|
|
1071
|
+
function Zt(e, t, n) {
|
|
1072
|
+
let r = [];
|
|
1073
|
+
for (let i of Object.keys(t).sort()) {
|
|
1074
|
+
if (i === e) continue;
|
|
1075
|
+
let t = Xt(n?.[i]);
|
|
1076
|
+
t.length && r.push(`${i}:${t.join(Yt)}`);
|
|
1077
|
+
}
|
|
1078
|
+
return r.join(Jt);
|
|
1079
|
+
}
|
|
1080
|
+
function Qt(e) {
|
|
1081
|
+
let t = /* @__PURE__ */ new Map();
|
|
1082
|
+
if (!e) return t;
|
|
1083
|
+
for (let n of e.split(Jt)) {
|
|
1084
|
+
let e = n.indexOf(":");
|
|
1085
|
+
if (e < 0) continue;
|
|
1086
|
+
let r = n.slice(0, e), i = n.slice(e + 1).split(Yt).filter(Boolean);
|
|
1087
|
+
r && i.length && t.set(r, i);
|
|
1088
|
+
}
|
|
1089
|
+
return t;
|
|
1090
|
+
}
|
|
1091
|
+
function $t({ odata: e, segment: t, model: i, value: o, dependencies: s }) {
|
|
1092
|
+
let [c, l] = a(""), [u, d] = a(""), { codeKey: f, searchDebounceDelay: m, minSearchCodeLength: h, minSearchTextLength: g } = i, { data: _, textKey: v, isLoading: y, isError: b, getItems: x, separatedItems: S, findSourceItemsByKeys: C, setFilteredItems: w, debounce: T } = Wt({
|
|
1093
|
+
odata: e,
|
|
1094
|
+
model: i
|
|
1095
|
+
}), E = S.length, D = t.selectText && v ? v : f, O = r(() => _ ? Zt(f, _.keyPairsMap, s) : "", [
|
|
1096
|
+
_,
|
|
1097
|
+
f,
|
|
1098
|
+
s
|
|
1099
|
+
]);
|
|
1100
|
+
n(() => {
|
|
1101
|
+
if (!_) return;
|
|
1102
|
+
let e = _.chain.findIndex((e) => e.codeKey === f), t = Qt(O), n = (e) => {
|
|
1103
|
+
let n = _.chain[e].codeKey, r = t.get(n);
|
|
1104
|
+
if (r?.length) return C(n, r);
|
|
1105
|
+
};
|
|
1106
|
+
for (let t = _.chain.length - 1; t > e; t--) {
|
|
1107
|
+
let e = n(t);
|
|
1108
|
+
if (e) {
|
|
1109
|
+
w(e);
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
for (let t = 0; t < e; t++) {
|
|
1114
|
+
let e = n(t);
|
|
1115
|
+
if (e) {
|
|
1116
|
+
w(e);
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
w(void 0);
|
|
1121
|
+
}, [
|
|
1122
|
+
_,
|
|
1123
|
+
O,
|
|
1124
|
+
f,
|
|
1125
|
+
C,
|
|
1126
|
+
w
|
|
1127
|
+
]), n(() => {
|
|
1128
|
+
T("search", () => {
|
|
1129
|
+
d(c.trim().toLowerCase());
|
|
1130
|
+
}, m);
|
|
1131
|
+
}, [
|
|
1132
|
+
T,
|
|
1133
|
+
c,
|
|
1134
|
+
m
|
|
1135
|
+
]);
|
|
1136
|
+
let k = r(() => {
|
|
1137
|
+
if (!o?.length || !D) return [];
|
|
1138
|
+
let e = new Set(o);
|
|
1139
|
+
return S.filter((t) => e.has(t[D]));
|
|
1140
|
+
}, [
|
|
1141
|
+
S,
|
|
1142
|
+
D,
|
|
1143
|
+
o
|
|
1144
|
+
]), A = r(() => {
|
|
1145
|
+
if (!_) return [];
|
|
1146
|
+
if (!(u.length >= g)) return x(void 0, k);
|
|
1147
|
+
let e = u.length >= g, n = !t.hideCode && u.length >= h && !Number.isNaN(Number(u));
|
|
1148
|
+
return x((t, r) => !!(t && r && (n && p(t, u) || e && r.toLowerCase().includes(u))), k);
|
|
1149
|
+
}, [
|
|
1150
|
+
u,
|
|
1151
|
+
x,
|
|
1152
|
+
h,
|
|
1153
|
+
g,
|
|
1154
|
+
_,
|
|
1155
|
+
t.hideCode,
|
|
1156
|
+
k
|
|
1157
|
+
]);
|
|
1158
|
+
return {
|
|
1159
|
+
query: c,
|
|
1160
|
+
setQuery: l,
|
|
1161
|
+
debouncedQuery: u,
|
|
1162
|
+
selectedItems: k,
|
|
1163
|
+
filteredItems: A,
|
|
1164
|
+
itemsCount: E,
|
|
1165
|
+
isLoading: y,
|
|
1166
|
+
isError: b,
|
|
1167
|
+
codeKey: f,
|
|
1168
|
+
textKey: v,
|
|
1169
|
+
selectionKey: D,
|
|
1170
|
+
placeholder: r(() => {
|
|
1171
|
+
let e = A.length;
|
|
1172
|
+
return E ? e < E ? `${t.placeholder} <${e}+>` : `${t.placeholder} <${E > i.maxVisibleItems ? `${i.maxVisibleItems}+` : E}>` : `${t.placeholder} <пусто>`;
|
|
1173
|
+
}, [
|
|
1174
|
+
A.length,
|
|
1175
|
+
E,
|
|
1176
|
+
i.maxVisibleItems,
|
|
1177
|
+
t.placeholder
|
|
1178
|
+
])
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
function en(e, t) {
|
|
1182
|
+
return e.map((e) => e[t]);
|
|
1183
|
+
}
|
|
1184
|
+
//#endregion
|
|
1185
|
+
//#region src/multi-select/model/useODataMultiSelect.ts
|
|
1186
|
+
function tn({ odata: e, segment: t, model: n, value: r, dependencies: i, onChange: a }) {
|
|
1187
|
+
let o = $t({
|
|
1188
|
+
odata: e,
|
|
1189
|
+
segment: t,
|
|
1190
|
+
model: n,
|
|
1191
|
+
value: r,
|
|
1192
|
+
dependencies: i
|
|
1193
|
+
}), s = (e) => {
|
|
1194
|
+
a(en(e, o.selectionKey));
|
|
1195
|
+
};
|
|
1196
|
+
return {
|
|
1197
|
+
...o,
|
|
1198
|
+
handleChange: s
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
//#endregion
|
|
1202
|
+
//#region src/multi-select/ui/ODataMultiSelect.tsx
|
|
1203
|
+
var nn = ({ odata: t, segment: n, model: r, label: i, description: a, disabled: o, value: s, dependencies: c, onChange: l, size: u }) => {
|
|
1204
|
+
let d = tn({
|
|
1205
|
+
odata: t,
|
|
1206
|
+
segment: n,
|
|
1207
|
+
model: Gt(r),
|
|
1208
|
+
value: s,
|
|
1209
|
+
dependencies: c,
|
|
1210
|
+
onChange: l
|
|
1211
|
+
});
|
|
1212
|
+
return /* @__PURE__ */ j(e, {
|
|
1213
|
+
label: i,
|
|
1214
|
+
description: a,
|
|
1215
|
+
size: u,
|
|
1216
|
+
codeKey: d.codeKey,
|
|
1217
|
+
textKey: d.textKey,
|
|
1218
|
+
hideCode: n.hideCode ?? t.hideCode,
|
|
1219
|
+
items: d.filteredItems,
|
|
1220
|
+
value: d.selectedItems,
|
|
1221
|
+
onChange: d.handleChange,
|
|
1222
|
+
onQuery: d.setQuery,
|
|
1223
|
+
query: d.query,
|
|
1224
|
+
defaultFilter: !1,
|
|
1225
|
+
highlightQuery: d.debouncedQuery,
|
|
1226
|
+
disabled: o || d.isLoading,
|
|
1227
|
+
placeholder: d.placeholder,
|
|
1228
|
+
error: d.isError ? "Ошибка загрузки" : void 0
|
|
1229
|
+
});
|
|
1230
|
+
}, rn = ({ item: e, values: n, onChange: r, width: i = 15 }) => {
|
|
1231
|
+
let [o, s] = a({}), c = n ?? o, l = `calc(${i}em + var(--width-add))`, u = t((t) => {
|
|
1232
|
+
let i = {
|
|
1233
|
+
...c,
|
|
1234
|
+
[e.id]: t
|
|
1235
|
+
};
|
|
1236
|
+
n || s(i), r?.(i);
|
|
1237
|
+
}, [
|
|
1238
|
+
e.id,
|
|
1239
|
+
r,
|
|
1240
|
+
c,
|
|
1241
|
+
n
|
|
1242
|
+
]);
|
|
1243
|
+
return /* @__PURE__ */ j("div", {
|
|
1244
|
+
style: {
|
|
1245
|
+
maxWidth: l,
|
|
1246
|
+
minWidth: l
|
|
1247
|
+
},
|
|
1248
|
+
children: /* @__PURE__ */ j(nn, {
|
|
1249
|
+
odata: e.odata,
|
|
1250
|
+
segment: e.segment,
|
|
1251
|
+
model: e.model,
|
|
1252
|
+
dependencies: c,
|
|
1253
|
+
value: c[e.id],
|
|
1254
|
+
onChange: u
|
|
1255
|
+
})
|
|
1256
|
+
});
|
|
1257
|
+
}, an = ({ width: e = 15, odata: t, segments: n, model: r, values: i, onChange: o }) => {
|
|
1258
|
+
let [s, c] = a({}), l = i ?? s;
|
|
1259
|
+
return wt([{
|
|
1260
|
+
odata: t,
|
|
1261
|
+
segments: n,
|
|
1262
|
+
model: r
|
|
1263
|
+
}]).map((t) => /* @__PURE__ */ j(rn, {
|
|
1264
|
+
item: t,
|
|
1265
|
+
values: l,
|
|
1266
|
+
onChange: (e) => {
|
|
1267
|
+
i || c(e), o?.(e);
|
|
1268
|
+
},
|
|
1269
|
+
width: e
|
|
1270
|
+
}, t.id));
|
|
1271
|
+
};
|
|
1272
|
+
//#endregion
|
|
1273
|
+
//#region src/multi-select/ui/SerializableMultiSelect.tsx
|
|
1274
|
+
function on(e, t) {
|
|
1275
|
+
return e[t];
|
|
1276
|
+
}
|
|
1277
|
+
function sn(e, t, n) {
|
|
1278
|
+
let r = e[t];
|
|
1279
|
+
if (typeof r == "string") return r;
|
|
1280
|
+
let i = on(e, n);
|
|
1281
|
+
return typeof i == "string" ? i : String(i);
|
|
1282
|
+
}
|
|
1283
|
+
function cn({ label: t, description: n, disabled: r, placeholder: i, size: a, options: o, value: s, onChange: c, optionKey: l, optionLabel: u, renderCode: d }) {
|
|
1284
|
+
let f = o.map((e) => ({
|
|
1285
|
+
key: String(on(e, l)),
|
|
1286
|
+
text: sn(e, u, l)
|
|
1287
|
+
})), p = new Set((s ?? []).map((e) => String(e))), m = f.filter((e) => p.has(e.key));
|
|
1288
|
+
return /* @__PURE__ */ j(e, {
|
|
1289
|
+
label: t,
|
|
1290
|
+
description: n,
|
|
1291
|
+
disabled: r,
|
|
1292
|
+
placeholder: i,
|
|
1293
|
+
size: a,
|
|
1294
|
+
items: f,
|
|
1295
|
+
codeKey: "key",
|
|
1296
|
+
textKey: "text",
|
|
1297
|
+
hideCode: d ? void 0 : !0,
|
|
1298
|
+
value: m,
|
|
1299
|
+
onChange: (e) => c(e.map((e) => e.key))
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
//#endregion
|
|
1303
|
+
export { qt as a, nn as i, an as n, xt as o, rn as r, cn as t };
|
|
1304
|
+
|
|
1305
|
+
//# sourceMappingURL=multi-select-BzYIviCU.js.map
|