xmlui 0.7.21 → 0.7.23

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.
Files changed (267) hide show
  1. package/dist/{apiInterceptorWorker-LRHkKnha.mjs → apiInterceptorWorker-BZ3Gd4mb.mjs} +25 -10
  2. package/dist/{grammar.tmLanguage-DNepe_jP.mjs → grammar.tmLanguage-JAlHWPqw.mjs} +1 -1
  3. package/dist/{index-5NLXyjX0.mjs → index-C9zkAour.mjs} +27520 -25814
  4. package/dist/index.css +1 -1
  5. package/dist/scripts/bin/build-lib.js +10 -4
  6. package/dist/scripts/bin/build.js +1 -4
  7. package/dist/scripts/bin/index.js +7 -7
  8. package/dist/scripts/bin/preview.js +19 -2
  9. package/dist/scripts/bin/start.js +2 -4
  10. package/dist/scripts/bin/viteConfig.js +2 -11
  11. package/dist/scripts/src/abstractions/ComponentDefs.js +2 -1
  12. package/dist/scripts/src/components/APICall/APICall.js +3 -3
  13. package/dist/scripts/src/components/APICall/APICallNative.js +2 -2
  14. package/dist/scripts/src/components/Accordion/Accordion.js +5 -5
  15. package/dist/scripts/src/components/Accordion/AccordionContext.js +1 -1
  16. package/dist/scripts/src/components/Accordion/AccordionItem.js +5 -5
  17. package/dist/scripts/src/components/Accordion/AccordionItemNative.js +3 -3
  18. package/dist/scripts/src/components/Accordion/AccordionNative.js +3 -3
  19. package/dist/scripts/src/components/Alert/Alert.js +4 -4
  20. package/dist/scripts/src/components/App/App.js +5 -5
  21. package/dist/scripts/src/components/App/AppNative.js +33 -34
  22. package/dist/scripts/src/components/App/Sheet.js +4 -4
  23. package/dist/scripts/src/components/AppHeader/AppHeader.js +6 -6
  24. package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +9 -9
  25. package/dist/scripts/src/components/AppState/AppState.js +2 -2
  26. package/dist/scripts/src/components/AppState/AppStateNative.js +2 -2
  27. package/dist/scripts/src/components/AutoComplete/AutoComplete.js +7 -7
  28. package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +29 -31
  29. package/dist/scripts/src/components/Avatar/Avatar.js +4 -4
  30. package/dist/scripts/src/components/Avatar/AvatarNative.js +1 -1
  31. package/dist/scripts/src/components/Backdrop/Backdrop.js +4 -4
  32. package/dist/scripts/src/components/Badge/Badge.js +5 -5
  33. package/dist/scripts/src/components/Badge/BadgeNative.js +5 -5
  34. package/dist/scripts/src/components/Bookmark/Bookmark.js +7 -3
  35. package/dist/scripts/src/components/Bookmark/BookmarkNative.js +6 -5
  36. package/dist/scripts/src/components/Breakout/Breakout.js +2 -2
  37. package/dist/scripts/src/components/Button/Button.js +6 -6
  38. package/dist/scripts/src/components/Button/ButtonNative.js +3 -3
  39. package/dist/scripts/src/components/ButtonGroup/ButtonGroup.js +5 -5
  40. package/dist/scripts/src/components/Card/Card.js +5 -5
  41. package/dist/scripts/src/components/Card/CardNative.js +7 -7
  42. package/dist/scripts/src/components/Carousel/Carousel.js +5 -5
  43. package/dist/scripts/src/components/Carousel/CarouselItem.js +3 -3
  44. package/dist/scripts/src/components/Carousel/CarouselItemNative.js +3 -3
  45. package/dist/scripts/src/components/Carousel/CarouselNative.js +6 -6
  46. package/dist/scripts/src/components/ChangeListener/ChangeListener.js +3 -3
  47. package/dist/scripts/src/components/ChangeListener/ChangeListenerNative.js +1 -1
  48. package/dist/scripts/src/components/Checkbox/Checkbox.js +6 -6
  49. package/dist/scripts/src/components/ColorPicker/ColorPicker.js +46 -0
  50. package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +54 -0
  51. package/dist/scripts/src/components/Column/Column.js +2 -2
  52. package/dist/scripts/src/components/Column/ColumnNative.js +2 -2
  53. package/dist/scripts/src/components/ComponentProvider.js +191 -97
  54. package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +4 -4
  55. package/dist/scripts/src/components/ContentSeparator/ContentSeparatorNative.js +1 -1
  56. package/dist/scripts/src/components/DatePicker/DatePicker.js +4 -4
  57. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +18 -19
  58. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +6 -6
  59. package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +5 -5
  60. package/dist/scripts/src/components/EmojiSelector/EmojiSelector.js +4 -4
  61. package/dist/scripts/src/components/EmojiSelector/EmojiSelectorNative.js +1 -1
  62. package/dist/scripts/src/components/FileInput/FileInput.js +6 -6
  63. package/dist/scripts/src/components/FileInput/FileInputNative.js +6 -6
  64. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +3 -3
  65. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZoneNative.js +6 -7
  66. package/dist/scripts/src/components/FlowLayout/FlowLayout.js +8 -6
  67. package/dist/scripts/src/components/FlowLayout/FlowLayoutNative.js +27 -16
  68. package/dist/scripts/src/components/Footer/Footer.js +4 -4
  69. package/dist/scripts/src/components/Footer/FooterNative.js +2 -2
  70. package/dist/scripts/src/components/Form/Form.js +5 -5
  71. package/dist/scripts/src/components/Form/FormNative.js +29 -29
  72. package/dist/scripts/src/components/FormItem/FormItem.js +4 -4
  73. package/dist/scripts/src/components/FormItem/FormItemNative.js +26 -16
  74. package/dist/scripts/src/components/FormItem/HelperText.js +3 -3
  75. package/dist/scripts/src/components/FormItem/ItemWithLabel.js +5 -6
  76. package/dist/scripts/src/components/FormItem/Validations.js +5 -5
  77. package/dist/scripts/src/components/FormSection/FormSection.js +2 -2
  78. package/dist/scripts/src/components/Heading/Heading.js +17 -4
  79. package/dist/scripts/src/components/Heading/HeadingNative.js +25 -14
  80. package/dist/scripts/src/components/HoverCard/HoverCard.js +3 -3
  81. package/dist/scripts/src/components/HoverCard/HovercardNative.js +1 -1
  82. package/dist/scripts/src/components/HtmlTags/HtmlTags.js +1208 -19
  83. package/dist/scripts/src/components/Icon/Icon.js +3 -3
  84. package/dist/scripts/src/components/Icon/IconNative.js +3 -3
  85. package/dist/scripts/src/components/IconInfoCard/IconInfoCard.js +5 -4
  86. package/dist/scripts/src/components/IconProvider.js +49 -49
  87. package/dist/scripts/src/components/Image/Image.js +4 -4
  88. package/dist/scripts/src/components/Image/ImageNative.js +2 -2
  89. package/dist/scripts/src/components/Input/InputAdornment.js +3 -3
  90. package/dist/scripts/src/components/Items/Items.js +3 -3
  91. package/dist/scripts/src/components/Link/Link.js +6 -6
  92. package/dist/scripts/src/components/Link/LinkNative.js +29 -11
  93. package/dist/scripts/src/components/List/List.js +14 -16
  94. package/dist/scripts/src/components/List/ListNative.js +193 -223
  95. package/dist/scripts/src/components/Logo/Logo.js +2 -2
  96. package/dist/scripts/src/components/Logo/LogoNative.js +2 -2
  97. package/dist/scripts/src/components/Markdown/Markdown.js +3 -3
  98. package/dist/scripts/src/components/Markdown/MarkdownNative.js +4 -4
  99. package/dist/scripts/src/components/ModalDialog/ModalDialog.js +5 -5
  100. package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +8 -8
  101. package/dist/scripts/src/components/NavGroup/NavGroup.js +6 -6
  102. package/dist/scripts/src/components/NavGroup/NavGroupNative.js +8 -8
  103. package/dist/scripts/src/components/NavLink/NavLink.js +5 -5
  104. package/dist/scripts/src/components/NavLink/NavLinkNative.js +6 -6
  105. package/dist/scripts/src/components/NavPanel/NavPanel.js +5 -5
  106. package/dist/scripts/src/components/NavPanel/NavPanelNative.js +6 -6
  107. package/dist/scripts/src/components/NoResult/NoResult.js +4 -4
  108. package/dist/scripts/src/components/NoResult/NoResultNative.js +2 -2
  109. package/dist/scripts/src/components/NumberBox/NumberBox.js +4 -4
  110. package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +7 -7
  111. package/dist/scripts/src/components/OffCanvas/OffCanvas.js +5 -5
  112. package/dist/scripts/src/components/OffCanvas/OffCanvasNative.js +2 -2
  113. package/dist/scripts/src/components/Option/Option.js +4 -4
  114. package/dist/scripts/src/components/PageHeader/PageHeader.js +2 -2
  115. package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.js +2 -2
  116. package/dist/scripts/src/components/Pages/Pages.js +3 -3
  117. package/dist/scripts/src/components/Pages/PagesNative.js +2 -2
  118. package/dist/scripts/src/components/PositionedContainer/PositionedContainer.js +3 -3
  119. package/dist/scripts/src/components/PositionedContainer/PositionedContainerNative.js +1 -1
  120. package/dist/scripts/src/components/ProgressBar/ProgressBar.js +3 -3
  121. package/dist/scripts/src/components/ProgressBar/ProgressBarNative.js +1 -1
  122. package/dist/scripts/src/components/Queue/Queue.js +3 -3
  123. package/dist/scripts/src/components/Queue/QueueNative.js +5 -5
  124. package/dist/scripts/src/components/RadioGroup/RadioGroup.js +4 -4
  125. package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +6 -6
  126. package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapter.js +2 -2
  127. package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapterNative.js +3 -3
  128. package/dist/scripts/src/components/Redirect/Redirect.js +2 -2
  129. package/dist/scripts/src/components/Select/Select.js +7 -7
  130. package/dist/scripts/src/components/Select/SelectNative.js +36 -37
  131. package/dist/scripts/src/components/SelectionStore/SelectionStore.js +2 -2
  132. package/dist/scripts/src/components/SelectionStore/SelectionStoreNative.js +2 -2
  133. package/dist/scripts/src/components/Slider/Slider.js +40 -25
  134. package/dist/scripts/src/components/Slider/SliderNative.js +98 -3
  135. package/dist/scripts/src/components/SlotItem.js +2 -2
  136. package/dist/scripts/src/components/SpaceFiller/SpaceFiller.js +3 -3
  137. package/dist/scripts/src/components/Spinner/Spinner.js +3 -3
  138. package/dist/scripts/src/components/Spinner/SpinnerNative.js +3 -4
  139. package/dist/scripts/src/components/Splitter/Splitter.js +6 -6
  140. package/dist/scripts/src/components/Splitter/SplitterNative.js +3 -3
  141. package/dist/scripts/src/components/Stack/Stack.js +6 -6
  142. package/dist/scripts/src/components/Stack/StackNative.js +3 -3
  143. package/dist/scripts/src/components/StickyBox/StickyBox.js +3 -3
  144. package/dist/scripts/src/components/StickyBox/StickyBoxNative.js +1 -1
  145. package/dist/scripts/src/components/Switch/Switch.js +6 -6
  146. package/dist/scripts/src/components/Table/Table.js +9 -9
  147. package/dist/scripts/src/components/Table/TableNative.js +15 -15
  148. package/dist/scripts/src/components/Table/useRowSelection.js +4 -4
  149. package/dist/scripts/src/components/TableHeader/TableHeader.js +2 -2
  150. package/dist/scripts/src/components/TableOfContents/TableOfContents.js +7 -5
  151. package/dist/scripts/src/components/TableOfContents/TableOfContentsNative.js +29 -24
  152. package/dist/scripts/src/components/Tabs/TabContext.js +1 -1
  153. package/dist/scripts/src/components/Tabs/TabItem.js +3 -3
  154. package/dist/scripts/src/components/Tabs/TabItemNative.js +2 -2
  155. package/dist/scripts/src/components/Tabs/Tabs.js +5 -5
  156. package/dist/scripts/src/components/Tabs/TabsNative.js +2 -2
  157. package/dist/scripts/src/components/Text/Text.js +5 -4
  158. package/dist/scripts/src/components/Text/TextNative.js +6 -7
  159. package/dist/scripts/src/components/TextArea/TextArea.js +4 -4
  160. package/dist/scripts/src/components/TextArea/TextAreaNative.js +6 -6
  161. package/dist/scripts/src/components/TextBox/TextBox.js +4 -4
  162. package/dist/scripts/src/components/TextBox/TextBoxNative.js +5 -5
  163. package/dist/scripts/src/components/Theme/Theme.js +2 -2
  164. package/dist/scripts/src/components/Theme/ThemeNative.js +7 -7
  165. package/dist/scripts/src/components/ThemeChanger/ThemeChanger.js +11 -11
  166. package/dist/scripts/src/components/ThemeChanger/ToneChangerButton.js +5 -5
  167. package/dist/scripts/src/components/Toggle/Toggle.js +4 -4
  168. package/dist/scripts/src/components/Toolbar/Toolbar.js +2 -2
  169. package/dist/scripts/src/components/ToolbarButton/ToolbarButton.js +2 -2
  170. package/dist/scripts/src/components/Tree/TreeComponent.js +4 -4
  171. package/dist/scripts/src/components/Tree/TreeNative.js +2 -2
  172. package/dist/scripts/src/components/TrendLabel/TrendLabel.js +2 -2
  173. package/dist/scripts/src/components/ValidationSummary/ValidationSummary.js +8 -8
  174. package/dist/scripts/src/components/abstractions.js +6 -2
  175. package/dist/scripts/src/components/container-helpers.js +2 -2
  176. package/dist/scripts/src/components-core/CompoundComponent.js +2 -2
  177. package/dist/scripts/src/components-core/Fragment.js +2 -2
  178. package/dist/scripts/src/components-core/InspectorContext.js +5 -5
  179. package/dist/scripts/src/components-core/LoaderComponent.js +6 -3
  180. package/dist/scripts/src/components-core/RestApiProxy.js +4 -4
  181. package/dist/scripts/src/components-core/Slot.js +2 -2
  182. package/dist/scripts/src/components-core/TableOfContentsContext.js +12 -2
  183. package/dist/scripts/src/components-core/XmluiCodeHighlighter.js +2 -2
  184. package/dist/scripts/src/components-core/action/APICall.js +10 -10
  185. package/dist/scripts/src/components-core/action/FileDownloadAction.js +1 -1
  186. package/dist/scripts/src/components-core/action/FileUploadAction.js +3 -3
  187. package/dist/scripts/src/components-core/action/NavigateAction.js +1 -1
  188. package/dist/scripts/src/components-core/action/TimedAction.js +1 -1
  189. package/dist/scripts/src/components-core/component-hooks.js +2 -2
  190. package/dist/scripts/src/components-core/descriptorHelper.js +1 -0
  191. package/dist/scripts/src/components-core/loader/ApiLoader.js +5 -5
  192. package/dist/scripts/src/components-core/loader/DataLoader.js +18 -10
  193. package/dist/scripts/src/components-core/loader/ExternalDataLoader.js +5 -5
  194. package/dist/scripts/src/components-core/loader/Loader.js +3 -3
  195. package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +5 -5
  196. package/dist/scripts/src/components-core/loader/PageableLoader.js +7 -4
  197. package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +21 -15
  198. package/dist/scripts/src/components-core/rendering/ComponentWrapper.js +2 -2
  199. package/dist/scripts/src/components-core/rendering/Container.js +16 -16
  200. package/dist/scripts/src/components-core/rendering/ContainerWrapper.js +1 -1
  201. package/dist/scripts/src/components-core/rendering/InvalidComponent.js +1 -1
  202. package/dist/scripts/src/components-core/rendering/StateContainer.js +15 -15
  203. package/dist/scripts/src/components-core/rendering/reducer.js +1 -1
  204. package/dist/scripts/src/components-core/rendering/renderChild.js +1 -1
  205. package/dist/scripts/src/components-core/rendering/valueExtractor.js +4 -4
  206. package/dist/scripts/src/components-core/script-runner/asyncProxy.js +1 -1
  207. package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +1 -1
  208. package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +1 -1
  209. package/dist/scripts/src/components-core/script-runner/process-statement-async.js +2 -2
  210. package/dist/scripts/src/components-core/script-runner/process-statement-common.js +1 -1
  211. package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +3 -3
  212. package/dist/scripts/src/components-core/script-runner/syncProxy.js +1 -1
  213. package/dist/scripts/src/components-core/script-runner/visitors.js +1 -1
  214. package/dist/scripts/src/components-core/theming/ThemeProvider.js +10 -10
  215. package/dist/scripts/src/components-core/theming/extendThemeUtils.js +1 -1
  216. package/dist/scripts/src/components-core/theming/layout-resolver.js +356 -0
  217. package/dist/scripts/src/components-core/theming/transformThemeVars.js +1 -1
  218. package/dist/scripts/src/components-core/utils/DataLoaderQueryKeyGenerator.js +9 -3
  219. package/dist/scripts/src/components-core/utils/actionUtils.js +3 -3
  220. package/dist/scripts/src/components-core/utils/compound-utils.js +1 -1
  221. package/dist/scripts/src/components-core/utils/css-utils.js +2 -2
  222. package/dist/scripts/src/components-core/utils/extractParam.js +47 -3
  223. package/dist/scripts/src/components-core/utils/hooks.js +3 -3
  224. package/dist/scripts/src/parsers/scripting/modules.js +1 -1
  225. package/dist/scripts/src/parsers/style-parser/style-compiler.js +6 -2
  226. package/dist/scripts/src/parsers/xmlui-parser/transform.js +14 -15
  227. package/dist/scripts/src/syntax/grammar.tmLanguage.json +1 -1
  228. package/dist/scripts/src/syntax/textMate/xmlui.json +27 -93
  229. package/dist/style.css +1 -1
  230. package/dist/xmlui-metadata.mjs +5438 -4508
  231. package/dist/xmlui-metadata.umd.js +23 -18
  232. package/dist/xmlui-standalone.umd.js +204 -193
  233. package/dist/xmlui.d.ts +3 -2
  234. package/dist/xmlui.mjs +1 -1
  235. package/package.json +3 -3
  236. package/dist/scripts/package.json +0 -210
  237. package/dist/scripts/src/components/Chart/Chart.js +0 -24
  238. package/dist/scripts/src/components/Chart/ChartNative.js +0 -165
  239. package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +0 -116
  240. package/dist/scripts/src/components/ModalDialog/Dialog.js +0 -20
  241. package/dist/scripts/src/components/Range/Range.js +0 -56
  242. package/dist/scripts/src/components/Range/RangeNative.js +0 -8
  243. package/dist/scripts/src/components/RawHtml/RawHtml.js +0 -39
  244. package/dist/scripts/src/components/RawHtml/RawHtmlNative.js +0 -13
  245. package/dist/scripts/src/components-core/StandaloneApp.js +0 -589
  246. package/dist/scripts/src/components-core/abstractions/standalone.js +0 -2
  247. package/dist/scripts/src/components-core/appContext/date-functions.js +0 -19
  248. package/dist/scripts/src/components-core/appContext/math-function.js +0 -27
  249. package/dist/scripts/src/components-core/appContext/misc-utils.js +0 -13
  250. package/dist/scripts/src/components-core/interception/ApiInterceptor.js +0 -198
  251. package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +0 -94
  252. package/dist/scripts/src/components-core/interception/Backend.js +0 -129
  253. package/dist/scripts/src/components-core/interception/Errors.js +0 -129
  254. package/dist/scripts/src/components-core/interception/InMemoryDb.js +0 -41
  255. package/dist/scripts/src/components-core/interception/IndexedDb.js +0 -205
  256. package/dist/scripts/src/components-core/interception/ReadonlyCollection.js +0 -145
  257. package/dist/scripts/src/components-core/interception/abstractions.js +0 -2
  258. package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +0 -46
  259. package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +0 -9
  260. package/dist/scripts/src/components-core/markup-check.js +0 -279
  261. package/dist/scripts/src/components-core/rendering/AppContent.js +0 -339
  262. package/dist/scripts/src/components-core/rendering/AppRoot.js +0 -55
  263. package/dist/scripts/src/components-core/rendering/AppWrapper.js +0 -44
  264. package/dist/scripts/src/components-core/utils/classnames.js +0 -58
  265. package/dist/scripts/src/components-core/utils/date-utils.js +0 -78
  266. package/dist/scripts/src/components-core/utils/request-params.js +0 -70
  267. package/dist/scripts/src/index.js +0 -66
@@ -1,205 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.IndexedDb = void 0;
16
- const dexie_1 = __importDefault(require("dexie"));
17
- const ReadonlyCollection_1 = require("@components-core/interception/ReadonlyCollection");
18
- class IndexedDb {
19
- constructor(tables, initialData = {}, config) {
20
- this.tables = tables;
21
- this.initialData = initialData;
22
- this.config = config;
23
- // private repository: Record<string, Array<any>>;
24
- // private maxIdsByCollections: Record<string, number> = {};
25
- this.db = null;
26
- this.getItems = (resourceId) => this.getDb().table(resourceId).toArray();
27
- this.findItems = (resourceId, predicate) => __awaiter(this, void 0, void 0, function* () {
28
- const ret = yield this.getItems(resourceId);
29
- const results = yield Promise.all(ret.map(predicate));
30
- return ret.filter((_v, index) => results[index]);
31
- });
32
- this.getItem = (resourceId, predicate) => __awaiter(this, void 0, void 0, function* () {
33
- const ret = yield this.getItems(resourceId);
34
- const results = yield Promise.all(ret.map(predicate));
35
- return ret.find((_v, index) => results[index]);
36
- });
37
- this.getItemById = (resourceId, id) => __awaiter(this, void 0, void 0, function* () {
38
- return yield this.getItem(resourceId, (item) => __awaiter(this, void 0, void 0, function* () {
39
- return item.id + "" === id + "";
40
- }));
41
- });
42
- this.deleteItems = (resourceId, predicate) => __awaiter(this, void 0, void 0, function* () {
43
- // this.repository[resourceId] = this.repository[resourceId]?.filter((item) => !predicate(item));
44
- });
45
- this.insertItem = (resourceId, item) => __awaiter(this, void 0, void 0, function* () {
46
- const id = yield this.getDb().table(resourceId).add(item);
47
- return this.getItemById(resourceId, id);
48
- });
49
- this.updateItem = (resourceId, item) => __awaiter(this, void 0, void 0, function* () {
50
- yield this.getDb().table(resourceId).update(item.id, item);
51
- return yield this.getItemById(resourceId, item.id);
52
- });
53
- }
54
- getDb() {
55
- if (this.db === null) {
56
- throw new Error("Db is not initialized yet");
57
- }
58
- return this.db;
59
- }
60
- initialize() {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- var _a, _b, _c;
63
- const resolvedInitialData = typeof this.initialData === "function" ? yield this.initialData() : this.initialData;
64
- const schema = {};
65
- const tableNames = new Set();
66
- if (this.tables) {
67
- this.tables.forEach((tableDescriptor) => {
68
- const schemaArray = [];
69
- if (tableDescriptor.pk.length === 1) {
70
- schemaArray.push(tableDescriptor.pk[0]);
71
- }
72
- else {
73
- schemaArray.push(`[${tableDescriptor.pk.join("+")}]`); //indexeddb compound index looks like this: [field+anotherfield]
74
- }
75
- if (tableDescriptor.indexes) {
76
- schemaArray.push(...tableDescriptor.indexes);
77
- }
78
- schema[tableDescriptor.name] = schemaArray.join(", ");
79
- tableNames.add(tableDescriptor.name);
80
- });
81
- }
82
- else {
83
- Object.entries(resolvedInitialData).forEach(([key]) => {
84
- schema[key] = "++id";
85
- tableNames.add(key);
86
- });
87
- }
88
- const targetVersion = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.version) !== undefined && typeof ((_b = this.config) === null || _b === void 0 ? void 0 : _b.version) === "number" ? (_c = this.config) === null || _c === void 0 ? void 0 : _c.version : 1;
89
- const shouldInitializeData = yield this.dropDbOnVersionChange(targetVersion);
90
- this.db = this.createDbInstance();
91
- this.db.version(targetVersion).stores(schema);
92
- if (shouldInitializeData) {
93
- yield Promise.all(Object.entries(resolvedInitialData).map((_a) => __awaiter(this, [_a], void 0, function* ([key, value]) {
94
- try {
95
- yield this.getDb().table(key).bulkAdd(value);
96
- }
97
- catch (ignored) {
98
- console.error(ignored);
99
- }
100
- })));
101
- }
102
- tableNames.forEach((key) => {
103
- this[`$${key}`] = createTableWrapper(this.getDb().table(key));
104
- });
105
- });
106
- }
107
- createDbInstance() {
108
- var _a, _b;
109
- return new dexie_1.default((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.database) !== null && _b !== void 0 ? _b : "defaultIndexDb");
110
- }
111
- dropDbOnVersionChange(targetVersion) {
112
- return __awaiter(this, void 0, void 0, function* () {
113
- const tempDb = this.createDbInstance();
114
- if (!(yield dexie_1.default.exists(tempDb.name))) {
115
- return true;
116
- }
117
- yield tempDb.open();
118
- if (tempDb.verno !== targetVersion) {
119
- yield tempDb.delete();
120
- return true;
121
- }
122
- else {
123
- tempDb.close();
124
- return false;
125
- }
126
- });
127
- }
128
- // --- This method signifies that a section of operations is executed in a transaction
129
- transaction(actions) {
130
- return __awaiter(this, void 0, void 0, function* () {
131
- if (!this.db)
132
- return;
133
- const tables = this.db.tables;
134
- yield this.db.transaction("rw", tables, actions);
135
- });
136
- }
137
- }
138
- exports.IndexedDb = IndexedDb;
139
- // Wraps an indexDb Table into an object that provides helpful methods
140
- function createTableWrapper(table) {
141
- return __awaiter(this, void 0, void 0, function* () {
142
- // --- Function to retrieve the current table data
143
- const getDataFn = () => table.db.table(table.name);
144
- // --- Helper method to filter the table data
145
- const filteredData = (predicate) => __awaiter(this, void 0, void 0, function* () {
146
- const dataSnapshot = yield table.toArray();
147
- const results = yield Promise.all(dataSnapshot.map(predicate !== null && predicate !== void 0 ? predicate : (() => __awaiter(this, void 0, void 0, function* () { return true; }))));
148
- return dataSnapshot.filter((_v, index) => results[index]);
149
- });
150
- return {
151
- native: getDataFn,
152
- insert: (item) => __awaiter(this, void 0, void 0, function* () {
153
- const id = yield table.add(item);
154
- return getDataFn().get(id);
155
- }),
156
- update: (item) => __awaiter(this, void 0, void 0, function* () {
157
- yield table.update(item.id, item);
158
- return getDataFn().get(item.id);
159
- }),
160
- save: (item) => __awaiter(this, void 0, void 0, function* () {
161
- const key = yield table.put(item);
162
- return table.get(key);
163
- }),
164
- deleteById: (id) => __awaiter(this, void 0, void 0, function* () {
165
- yield table.delete(id);
166
- }),
167
- byId: (id) => __awaiter(this, void 0, void 0, function* () {
168
- if (id === undefined || id === null) {
169
- return null;
170
- }
171
- let safeId = id;
172
- if (table.schema.primKey.src === "++id") {
173
- //it's an auto incremented id, must be a number
174
- safeId = Number(id);
175
- }
176
- return table.get(safeId);
177
- }),
178
- toArray: () => __awaiter(this, void 0, void 0, function* () { return yield table.toArray(); }),
179
- single: (predicate) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).single(predicate); }),
180
- singleOrDefault: (predicate, defValue) => __awaiter(this, void 0, void 0, function* () {
181
- return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).singleOrDefault(predicate, defValue);
182
- }),
183
- where: (predicate) => __awaiter(this, void 0, void 0, function* () { return new ReadonlyCollection_1.ReadOnlyCollection(yield filteredData(predicate)); }),
184
- whereAsArray: (predicate) => __awaiter(this, void 0, void 0, function* () { return yield filteredData(predicate); }),
185
- orderBy: (...mappers) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).orderBy(...mappers); }),
186
- orderByAsArray: (...mappers) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).orderByAsArray(...mappers); }),
187
- groupBy: (groupKey) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).groupBy(groupKey); }),
188
- groupByAsArray: (groupKey) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).groupByAsArray(groupKey); }),
189
- distinct: (distinctValue) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).distinct(distinctValue); }),
190
- distinctAsArray: (distinctValue) => __awaiter(this, void 0, void 0, function* () { return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).distinctAsArray(distinctValue); }),
191
- maxValue: (...args_1) => __awaiter(this, [...args_1], void 0, function* (fieldName = "id", predicate) {
192
- return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).maxValue(fieldName, predicate);
193
- }),
194
- skip: (count) => __awaiter(this, void 0, void 0, function* () {
195
- return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).skip(count);
196
- }),
197
- take: (count) => __awaiter(this, void 0, void 0, function* () {
198
- return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).take(count);
199
- }),
200
- skipTake: (skip, take) => __awaiter(this, void 0, void 0, function* () {
201
- return yield new ReadonlyCollection_1.ReadOnlyCollection(yield table.toArray()).skipTake(skip, take);
202
- }),
203
- };
204
- });
205
- }
@@ -1,145 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ReadOnlyCollection = void 0;
13
- const misc_1 = require("@components-core/utils/misc");
14
- class ReadOnlyCollection {
15
- constructor(items) {
16
- this.list = [];
17
- for (const item of items) {
18
- this.list.push(item);
19
- }
20
- }
21
- get length() {
22
- return this.list.length;
23
- }
24
- toArray() {
25
- return this.list.slice(0);
26
- }
27
- at(index) {
28
- if (index < 0 || index > this.list.length - 1) {
29
- throw new Error(`Index (${index}) is out of range [0..${Math.max(this.list.length - 1, 0)}]`);
30
- }
31
- return this.list[index];
32
- }
33
- all() {
34
- return new ReadOnlyCollection(this.list);
35
- }
36
- single(predicate) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- const filtered = yield this.where(predicate);
39
- if (filtered.length === 0) {
40
- throw new Error("No items found with the specified predicate");
41
- }
42
- else if (filtered.length > 1) {
43
- throw new Error("Multiple items found with the specified predicate");
44
- }
45
- return filtered.at(0);
46
- });
47
- }
48
- singleOrDefault(predicate, defValue) {
49
- return __awaiter(this, void 0, void 0, function* () {
50
- const filtered = yield this.where(predicate);
51
- if (filtered.length === 0) {
52
- return defValue;
53
- }
54
- else if (filtered.length > 1) {
55
- throw new Error("Multiple items found with the specified predicate");
56
- }
57
- return filtered.at(0);
58
- });
59
- }
60
- where(predicate) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- return new ReadOnlyCollection(yield this.whereAsArray(predicate));
63
- });
64
- }
65
- whereAsArray(predicate) {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- const results = yield Promise.all(this.list.map(predicate !== null && predicate !== void 0 ? predicate : (() => __awaiter(this, void 0, void 0, function* () { return true; }))));
68
- return this.list.filter((_v, index) => results[index]);
69
- });
70
- }
71
- orderBy(...mappers) {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- return new ReadOnlyCollection(yield (0, misc_1.orderBy)(this.list, ...mappers));
74
- });
75
- }
76
- orderByAsArray(...mappers) {
77
- return __awaiter(this, void 0, void 0, function* () {
78
- return yield (0, misc_1.orderBy)(this.list, ...mappers);
79
- });
80
- }
81
- groupBy(groupKey) {
82
- return __awaiter(this, void 0, void 0, function* () {
83
- return new ReadOnlyCollection(yield this.groupByAsArray(groupKey));
84
- });
85
- }
86
- groupByAsArray(groupKey) {
87
- return __awaiter(this, void 0, void 0, function* () {
88
- const grouped = new Map();
89
- for (const item of this.list) {
90
- const key = yield groupKey(item);
91
- const matchingList = grouped.get(key);
92
- if (matchingList === undefined) {
93
- grouped.set(key, [item]);
94
- }
95
- else {
96
- matchingList.push(item);
97
- }
98
- }
99
- const groupedItems = [];
100
- for (const [key, items] of grouped.entries()) {
101
- groupedItems.push({ key, items });
102
- }
103
- return groupedItems;
104
- });
105
- }
106
- distinct(distinctValue) {
107
- return __awaiter(this, void 0, void 0, function* () {
108
- distinctValue !== null && distinctValue !== void 0 ? distinctValue : (distinctValue = (x) => __awaiter(this, void 0, void 0, function* () { return x; }));
109
- const values = new Set();
110
- for (const item of this.list) {
111
- values.add(yield distinctValue(item));
112
- }
113
- return new ReadOnlyCollection(values.values());
114
- });
115
- }
116
- distinctAsArray(distinctValue) {
117
- return __awaiter(this, void 0, void 0, function* () {
118
- return (yield this.distinct(distinctValue)).toArray();
119
- });
120
- }
121
- maxValue() {
122
- return __awaiter(this, arguments, void 0, function* (fieldName = "id", predicate) {
123
- let values = predicate ? (yield new ReadOnlyCollection(this.list)
124
- .where(predicate)).toArray() : this.list;
125
- values = yield (0, misc_1.orderBy)(values, (item) => item[fieldName], true);
126
- return values.length === 0 ? undefined : values[0][fieldName];
127
- });
128
- }
129
- skip(count) {
130
- return __awaiter(this, void 0, void 0, function* () {
131
- return new ReadOnlyCollection(this.list.slice(count));
132
- });
133
- }
134
- take(count) {
135
- return __awaiter(this, void 0, void 0, function* () {
136
- return new ReadOnlyCollection(this.list.slice(0, count));
137
- });
138
- }
139
- skipTake(skip, take) {
140
- return __awaiter(this, void 0, void 0, function* () {
141
- return new ReadOnlyCollection(this.list.slice(skip, take + skip));
142
- });
143
- }
144
- }
145
- exports.ReadOnlyCollection = ReadOnlyCollection;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createApiInterceptorWorker = void 0;
13
- const browser_1 = require("msw/browser");
14
- const lodash_es_1 = require("lodash-es");
15
- const msw_1 = require("msw");
16
- const ApiInterceptor_1 = require("@components-core/interception/ApiInterceptor");
17
- // Create handlers for the specified API interceptor
18
- function createHandlers(api) {
19
- const operations = api.getOperations();
20
- let handlers = [];
21
- Object.entries(operations).forEach(([operationId, operation]) => {
22
- let urls = [operation.url];
23
- if ((0, lodash_es_1.isArray)(operation.url)) {
24
- urls = operation.url;
25
- }
26
- urls.forEach((operationUrl) => {
27
- handlers.push(msw_1.http[operation.method](`${api.getApiUrl()}${operationUrl}`, (_a) => __awaiter(this, [_a], void 0, function* ({ request, cookies, params }) {
28
- return yield api.executeOperation(operationId, request, cookies, params);
29
- })));
30
- });
31
- });
32
- return handlers;
33
- }
34
- // Create the worker for the ApiInterceptorProvider
35
- const createApiInterceptorWorker = (apiInterceptorDefinition, apiWorker) => __awaiter(void 0, void 0, void 0, function* () {
36
- const apiInstance = new ApiInterceptor_1.ApiInterceptor(apiInterceptorDefinition);
37
- yield apiInstance.initialize();
38
- const handlers = createHandlers(apiInstance);
39
- let worker = apiWorker;
40
- if (!worker) {
41
- worker = (0, browser_1.setupWorker)();
42
- }
43
- worker.use(...handlers);
44
- return worker;
45
- });
46
- exports.createApiInterceptorWorker = createApiInterceptorWorker;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiInterceptorContext = void 0;
4
- exports.useApiInterceptorContext = useApiInterceptorContext;
5
- const react_1 = require("react");
6
- exports.ApiInterceptorContext = (0, react_1.createContext)(null);
7
- function useApiInterceptorContext() {
8
- return (0, react_1.useContext)(exports.ApiInterceptorContext);
9
- }