@j2inn/fin5-ui-utils 8.2.0 → 9.0.0-beta.0
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/fantomProps/createFin5Props/index.d.ts +12 -12
- package/dist/fantomProps/createFin5Props/index.js +146 -146
- package/dist/fantomProps/createFin5Props/index.js.map +1 -1
- package/dist/fantomProps/createFin5Props/runCreateFin5Props.d.ts +2 -2
- package/dist/fantomProps/createFin5Props/runCreateFin5Props.js +20 -20
- package/dist/fantomProps/createFin5Props/runCreateFin5Props.js.map +1 -1
- package/dist/fantomProps/fantomPropsToObject.d.ts +8 -8
- package/dist/fantomProps/fantomPropsToObject.js +182 -183
- package/dist/fantomProps/fantomPropsToObject.js.map +1 -1
- package/dist/fantomProps/generateJsonFromFantomPropsFile.d.ts +4 -4
- package/dist/fantomProps/generateJsonFromFantomPropsFile.js +51 -41
- package/dist/fantomProps/generateJsonFromFantomPropsFile.js.map +1 -1
- package/dist/fantomProps/localePropsToJson.d.ts +1 -1
- package/dist/fantomProps/localePropsToJson.js +60 -50
- package/dist/fantomProps/localePropsToJson.js.map +1 -1
- package/dist/fantomProps/readFantomPropsFile.d.ts +5 -5
- package/dist/fantomProps/readFantomPropsFile.js +74 -65
- package/dist/fantomProps/readFantomPropsFile.js.map +1 -1
- package/dist/fin5Top/fin5FileUpload.d.ts +24 -24
- package/dist/fin5Top/fin5FileUpload.js +51 -51
- package/dist/fin5Top/fin5FileUpload.js.map +1 -1
- package/dist/fin5Top/fin5Top.d.ts +188 -188
- package/dist/fin5Top/fin5Top.js +86 -86
- package/dist/fin5Top/fin5Top.js.map +1 -1
- package/dist/fin5Top/finEdge2Cloud.d.ts +6 -6
- package/dist/fin5Top/finEdge2Cloud.js +15 -15
- package/dist/fin5Top/getFin5BinUrl.d.ts +2 -2
- package/dist/fin5Top/getFin5BinUrl.js +9 -9
- package/dist/fin5Top/openFin5Alarm.d.ts +22 -22
- package/dist/fin5Top/openFin5Alarm.js +23 -23
- package/dist/fin5Top/openFin5Alarm.js.map +1 -1
- package/dist/fin5Top/openFin5Historian.d.ts +3 -3
- package/dist/fin5Top/openFin5Historian.js +19 -19
- package/dist/fin5Top/openFin5Historian.js.map +1 -1
- package/dist/fin5Top/useFin5AppURLHashParameter.d.ts +18 -18
- package/dist/fin5Top/useFin5AppURLHashParameter.js +133 -133
- package/dist/fin5Top/useFin5AppURLHashParameter.js.map +1 -1
- package/dist/index.d.ts +35 -35
- package/dist/index.js +69 -69
- package/dist/jobs/jobUtils.d.ts +14 -14
- package/dist/jobs/jobUtils.js +15 -15
- package/dist/jobs/jobUtils.js.map +1 -1
- package/dist/react/app/Fin5AppContainer.d.ts +36 -36
- package/dist/react/app/Fin5AppContainer.js +171 -161
- package/dist/react/app/Fin5AppContainer.js.map +1 -1
- package/dist/react/app/Fin5AppRootStore.d.ts +42 -42
- package/dist/react/app/Fin5AppRootStore.js +114 -114
- package/dist/react/app/Fin5AppRootStore.js.map +1 -1
- package/dist/react/components/ErrorBoundary.d.ts +57 -57
- package/dist/react/components/ErrorBoundary.js +160 -150
- package/dist/react/components/ErrorBoundary.js.map +1 -1
- package/dist/react/components/ErrorDisplayer.d.ts +19 -19
- package/dist/react/components/ErrorDisplayer.js +36 -36
- package/dist/react/components/ErrorDisplayer.js.map +1 -1
- package/dist/react/components/Loader.d.ts +9 -9
- package/dist/react/components/Loader.js +17 -17
- package/dist/react/components/LoadingSpinner.d.ts +2 -2
- package/dist/react/components/LoadingSpinner.js +27 -27
- package/dist/react/components/RecordImage.d.ts +20 -20
- package/dist/react/components/RecordImage.js +61 -51
- package/dist/react/components/RecordImage.js.map +1 -1
- package/dist/react/components/charts/QRCode.d.ts +25 -25
- package/dist/react/components/charts/QRCode.js +92 -82
- package/dist/react/components/charts/QRCode.js.map +1 -1
- package/dist/react/components/charts/line-bar/Chart.d.ts +166 -166
- package/dist/react/components/charts/line-bar/Chart.js +452 -442
- package/dist/react/components/charts/line-bar/Chart.js.map +1 -1
- package/dist/react/components/charts/line-bar/HGridChart.d.ts +58 -58
- package/dist/react/components/charts/line-bar/HGridChart.js +295 -285
- package/dist/react/components/charts/line-bar/HGridChart.js.map +1 -1
- package/dist/react/components/charts/pie/PieChart.d.ts +94 -94
- package/dist/react/components/charts/pie/PieChart.js +214 -204
- package/dist/react/components/charts/pie/PieChart.js.map +1 -1
- package/dist/react/components/charts/pie/SimplePieChart.d.ts +21 -21
- package/dist/react/components/charts/pie/SimplePieChart.js +65 -55
- package/dist/react/components/charts/pie/SimplePieChart.js.map +1 -1
- package/dist/react/components/graphics/GraphicViewer.d.ts +10 -10
- package/dist/react/components/graphics/GraphicViewer.js +29 -29
- package/dist/react/components/graphics/GraphicsTabViewer.d.ts +17 -17
- package/dist/react/components/graphics/GraphicsTabViewer.js +100 -90
- package/dist/react/components/graphics/GraphicsTabViewer.js.map +1 -1
- package/dist/react/components/makeCustomElement.d.ts +16 -16
- package/dist/react/components/makeCustomElement.js +150 -150
- package/dist/react/components/makeCustomElement.js.map +1 -1
- package/dist/react/components/navigation/BasicLayout.d.ts +41 -41
- package/dist/react/components/navigation/BasicLayout.js +165 -155
- package/dist/react/components/navigation/BasicLayout.js.map +1 -1
- package/dist/react/components/navigation/HeaderSiderLayout.d.ts +13 -13
- package/dist/react/components/navigation/HeaderSiderLayout.js +119 -110
- package/dist/react/components/navigation/HeaderSiderLayout.js.map +1 -1
- package/dist/react/components/navigation/MenuPage.d.ts +37 -37
- package/dist/react/components/navigation/MenuPage.js +35 -36
- package/dist/react/components/navigation/MenuPage.js.map +1 -1
- package/dist/react/components/navigation/MenuTrigger.d.ts +9 -9
- package/dist/react/components/navigation/MenuTrigger.js +33 -33
- package/dist/react/components/navigation/ReactRouterHeaderSiderLayout.d.ts +11 -11
- package/dist/react/components/navigation/ReactRouterHeaderSiderLayout.js +25 -25
- package/dist/react/components/navigation/ReactRouterHeaderSiderLayout.js.map +1 -1
- package/dist/react/components/navigation/ReactRouterLayout.d.ts +45 -46
- package/dist/react/components/navigation/ReactRouterLayout.js +142 -132
- package/dist/react/components/navigation/ReactRouterLayout.js.map +1 -1
- package/dist/react/components/navigation/customRouting/Router.d.ts +12 -12
- package/dist/react/components/navigation/customRouting/Router.js +54 -45
- package/dist/react/components/navigation/customRouting/Router.js.map +1 -1
- package/dist/react/components/navigation/customRouting/RouterLayout.d.ts +11 -11
- package/dist/react/components/navigation/customRouting/RouterLayout.js +71 -61
- package/dist/react/components/navigation/customRouting/RouterLayout.js.map +1 -1
- package/dist/react/components/resolvable/configurationForm/ConfigurationForm.d.ts +26 -27
- package/dist/react/components/resolvable/configurationForm/ConfigurationForm.js +105 -95
- package/dist/react/components/resolvable/configurationForm/ConfigurationForm.js.map +1 -1
- package/dist/react/components/resolvable/configurationForm/ConfigurationFormEntry.d.ts +15 -16
- package/dist/react/components/resolvable/configurationForm/ConfigurationFormEntry.js +98 -88
- package/dist/react/components/resolvable/configurationForm/ConfigurationFormEntry.js.map +1 -1
- package/dist/react/components/resolvable/configurationForm/getSectionDefault.d.ts +16 -16
- package/dist/react/components/resolvable/configurationForm/getSectionDefault.js +99 -99
- package/dist/react/components/resolvable/configurationForm/getSectionDefault.js.map +1 -1
- package/dist/react/hooks/useFin5BinUrl.d.ts +6 -6
- package/dist/react/hooks/useFin5BinUrl.js +15 -15
- package/dist/react/hooks/useFin5ColorScheme.d.ts +2 -2
- package/dist/react/hooks/useFin5ColorScheme.js +55 -56
- package/dist/react/hooks/useFin5ColorScheme.js.map +1 -1
- package/dist/react/hooks/useScreenSize.d.ts +7 -7
- package/dist/react/hooks/useScreenSize.js +31 -31
- package/dist_es/fantomProps/createFin5Props/index.d.ts +12 -12
- package/dist_es/fantomProps/createFin5Props/index.js +140 -140
- package/dist_es/fantomProps/createFin5Props/index.js.map +1 -1
- package/dist_es/fantomProps/createFin5Props/runCreateFin5Props.d.ts +2 -2
- package/dist_es/fantomProps/createFin5Props/runCreateFin5Props.js +15 -15
- package/dist_es/fantomProps/createFin5Props/runCreateFin5Props.js.map +1 -1
- package/dist_es/fantomProps/fantomPropsToObject.d.ts +8 -8
- package/dist_es/fantomProps/fantomPropsToObject.js +178 -178
- package/dist_es/fantomProps/fantomPropsToObject.js.map +1 -1
- package/dist_es/fantomProps/generateJsonFromFantomPropsFile.d.ts +4 -4
- package/dist_es/fantomProps/generateJsonFromFantomPropsFile.js +12 -12
- package/dist_es/fantomProps/localePropsToJson.d.ts +1 -1
- package/dist_es/fantomProps/localePropsToJson.js +21 -21
- package/dist_es/fantomProps/localePropsToJson.js.map +1 -1
- package/dist_es/fantomProps/readFantomPropsFile.d.ts +5 -5
- package/dist_es/fantomProps/readFantomPropsFile.js +38 -39
- package/dist_es/fantomProps/readFantomPropsFile.js.map +1 -1
- package/dist_es/fin5Top/fin5FileUpload.d.ts +24 -24
- package/dist_es/fin5Top/fin5FileUpload.js +47 -47
- package/dist_es/fin5Top/fin5FileUpload.js.map +1 -1
- package/dist_es/fin5Top/fin5Top.d.ts +188 -188
- package/dist_es/fin5Top/fin5Top.js +81 -81
- package/dist_es/fin5Top/fin5Top.js.map +1 -1
- package/dist_es/fin5Top/finEdge2Cloud.d.ts +6 -6
- package/dist_es/fin5Top/finEdge2Cloud.js +11 -11
- package/dist_es/fin5Top/getFin5BinUrl.d.ts +2 -2
- package/dist_es/fin5Top/getFin5BinUrl.js +5 -5
- package/dist_es/fin5Top/openFin5Alarm.d.ts +22 -22
- package/dist_es/fin5Top/openFin5Alarm.js +19 -19
- package/dist_es/fin5Top/openFin5Alarm.js.map +1 -1
- package/dist_es/fin5Top/openFin5Historian.d.ts +3 -3
- package/dist_es/fin5Top/openFin5Historian.js +15 -15
- package/dist_es/fin5Top/openFin5Historian.js.map +1 -1
- package/dist_es/fin5Top/useFin5AppURLHashParameter.d.ts +18 -18
- package/dist_es/fin5Top/useFin5AppURLHashParameter.js +124 -124
- package/dist_es/fin5Top/useFin5AppURLHashParameter.js.map +1 -1
- package/dist_es/index.d.ts +35 -35
- package/dist_es/index.js +53 -53
- package/dist_es/jobs/jobUtils.d.ts +14 -14
- package/dist_es/jobs/jobUtils.js +9 -9
- package/dist_es/react/app/Fin5AppContainer.d.ts +36 -36
- package/dist_es/react/app/Fin5AppContainer.js +132 -132
- package/dist_es/react/app/Fin5AppContainer.js.map +1 -1
- package/dist_es/react/app/Fin5AppRootStore.d.ts +42 -42
- package/dist_es/react/app/Fin5AppRootStore.js +110 -110
- package/dist_es/react/app/Fin5AppRootStore.js.map +1 -1
- package/dist_es/react/components/ErrorBoundary.d.ts +57 -57
- package/dist_es/react/components/ErrorBoundary.js +123 -123
- package/dist_es/react/components/ErrorDisplayer.d.ts +19 -19
- package/dist_es/react/components/ErrorDisplayer.js +28 -28
- package/dist_es/react/components/ErrorDisplayer.js.map +1 -1
- package/dist_es/react/components/Loader.d.ts +9 -9
- package/dist_es/react/components/Loader.js +12 -12
- package/dist_es/react/components/LoadingSpinner.d.ts +2 -2
- package/dist_es/react/components/LoadingSpinner.js +20 -20
- package/dist_es/react/components/RecordImage.d.ts +20 -20
- package/dist_es/react/components/RecordImage.js +24 -24
- package/dist_es/react/components/RecordImage.js.map +1 -1
- package/dist_es/react/components/charts/QRCode.d.ts +25 -25
- package/dist_es/react/components/charts/QRCode.js +52 -52
- package/dist_es/react/components/charts/QRCode.js.map +1 -1
- package/dist_es/react/components/charts/line-bar/Chart.d.ts +166 -166
- package/dist_es/react/components/charts/line-bar/Chart.js +415 -415
- package/dist_es/react/components/charts/line-bar/Chart.js.map +1 -1
- package/dist_es/react/components/charts/line-bar/HGridChart.d.ts +58 -58
- package/dist_es/react/components/charts/line-bar/HGridChart.js +250 -250
- package/dist_es/react/components/charts/line-bar/HGridChart.js.map +1 -1
- package/dist_es/react/components/charts/pie/PieChart.d.ts +94 -94
- package/dist_es/react/components/charts/pie/PieChart.js +177 -177
- package/dist_es/react/components/charts/pie/PieChart.js.map +1 -1
- package/dist_es/react/components/charts/pie/SimplePieChart.d.ts +21 -21
- package/dist_es/react/components/charts/pie/SimplePieChart.js +25 -25
- package/dist_es/react/components/graphics/GraphicViewer.d.ts +10 -10
- package/dist_es/react/components/graphics/GraphicViewer.js +22 -22
- package/dist_es/react/components/graphics/GraphicsTabViewer.d.ts +17 -17
- package/dist_es/react/components/graphics/GraphicsTabViewer.js +60 -60
- package/dist_es/react/components/graphics/GraphicsTabViewer.js.map +1 -1
- package/dist_es/react/components/makeCustomElement.d.ts +16 -16
- package/dist_es/react/components/makeCustomElement.js +142 -142
- package/dist_es/react/components/makeCustomElement.js.map +1 -1
- package/dist_es/react/components/navigation/BasicLayout.d.ts +41 -41
- package/dist_es/react/components/navigation/BasicLayout.js +124 -124
- package/dist_es/react/components/navigation/BasicLayout.js.map +1 -1
- package/dist_es/react/components/navigation/HeaderSiderLayout.d.ts +13 -13
- package/dist_es/react/components/navigation/HeaderSiderLayout.js +80 -80
- package/dist_es/react/components/navigation/HeaderSiderLayout.js.map +1 -1
- package/dist_es/react/components/navigation/MenuPage.d.ts +37 -37
- package/dist_es/react/components/navigation/MenuPage.js +30 -30
- package/dist_es/react/components/navigation/MenuPage.js.map +1 -1
- package/dist_es/react/components/navigation/MenuTrigger.d.ts +9 -9
- package/dist_es/react/components/navigation/MenuTrigger.js +28 -28
- package/dist_es/react/components/navigation/ReactRouterHeaderSiderLayout.d.ts +11 -11
- package/dist_es/react/components/navigation/ReactRouterHeaderSiderLayout.js +18 -18
- package/dist_es/react/components/navigation/ReactRouterHeaderSiderLayout.js.map +1 -1
- package/dist_es/react/components/navigation/ReactRouterLayout.d.ts +45 -46
- package/dist_es/react/components/navigation/ReactRouterLayout.js +99 -99
- package/dist_es/react/components/navigation/ReactRouterLayout.js.map +1 -1
- package/dist_es/react/components/navigation/customRouting/Router.d.ts +12 -12
- package/dist_es/react/components/navigation/customRouting/Router.js +18 -18
- package/dist_es/react/components/navigation/customRouting/Router.js.map +1 -1
- package/dist_es/react/components/navigation/customRouting/RouterLayout.d.ts +11 -11
- package/dist_es/react/components/navigation/customRouting/RouterLayout.js +34 -34
- package/dist_es/react/components/navigation/customRouting/RouterLayout.js.map +1 -1
- package/dist_es/react/components/resolvable/configurationForm/ConfigurationForm.d.ts +26 -27
- package/dist_es/react/components/resolvable/configurationForm/ConfigurationForm.js +64 -64
- package/dist_es/react/components/resolvable/configurationForm/ConfigurationForm.js.map +1 -1
- package/dist_es/react/components/resolvable/configurationForm/ConfigurationFormEntry.d.ts +15 -16
- package/dist_es/react/components/resolvable/configurationForm/ConfigurationFormEntry.js +58 -58
- package/dist_es/react/components/resolvable/configurationForm/ConfigurationFormEntry.js.map +1 -1
- package/dist_es/react/components/resolvable/configurationForm/getSectionDefault.d.ts +16 -16
- package/dist_es/react/components/resolvable/configurationForm/getSectionDefault.js +94 -94
- package/dist_es/react/components/resolvable/configurationForm/getSectionDefault.js.map +1 -1
- package/dist_es/react/hooks/useFin5BinUrl.d.ts +6 -6
- package/dist_es/react/hooks/useFin5BinUrl.js +11 -11
- package/dist_es/react/hooks/useFin5ColorScheme.d.ts +2 -2
- package/dist_es/react/hooks/useFin5ColorScheme.js +52 -52
- package/dist_es/react/hooks/useFin5ColorScheme.js.map +1 -1
- package/dist_es/react/hooks/useScreenSize.d.ts +7 -7
- package/dist_es/react/hooks/useScreenSize.js +27 -27
- package/package.json +26 -49
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
export
|
|
27
|
-
export {};
|
|
1
|
+
import { ParametersOfSection, UiElementData } from '@j2inn/resolvable-ui-elements';
|
|
2
|
+
import { HDict } from 'haystack-core';
|
|
3
|
+
type Layout = 'horizontal' | 'vertical';
|
|
4
|
+
interface ConfigurationFormProps<T extends UiElementData> {
|
|
5
|
+
section: T;
|
|
6
|
+
params: ParametersOfSection<T>;
|
|
7
|
+
readOnlySection?: UiElementData;
|
|
8
|
+
onSave: (config: HDict) => void | Promise<unknown>;
|
|
9
|
+
saveText?: string;
|
|
10
|
+
formatKey?: (key: string) => string;
|
|
11
|
+
options?: HDict;
|
|
12
|
+
layout?: Layout;
|
|
13
|
+
className?: string;
|
|
14
|
+
entryClassName?: string;
|
|
15
|
+
saveBtnClassName?: string;
|
|
16
|
+
animateSaveButton?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const ConfigurationForm: <T extends UiElementData>({ section, params, readOnlySection, onSave, formatKey, saveText, options, layout, className, entryClassName, saveBtnClassName, animateSaveButton, }: ConfigurationFormProps<T>) => JSX.Element;
|
|
19
|
+
interface ConfigurationFormReadOnlyEntriesProps<T extends UiElementData> {
|
|
20
|
+
params: ParametersOfSection<T>;
|
|
21
|
+
readOnlySection: T;
|
|
22
|
+
formatKey?: (key: string) => string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const ConfigurationFormReadOnlyEntries: <T extends UiElementData>({ readOnlySection, params, formatKey, className, }: ConfigurationFormReadOnlyEntriesProps<T>) => JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -1,96 +1,106 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2023, J2 Innovations. All Rights Reserved
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023, J2 Innovations. All Rights Reserved
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.ConfigurationFormReadOnlyEntries = exports.ConfigurationForm = void 0;
|
|
43
|
+
const resolvable_ui_elements_1 = require("@j2inn/resolvable-ui-elements");
|
|
44
|
+
const ui_1 = require("@j2inn/ui");
|
|
45
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
46
|
+
const haystack_core_1 = require("haystack-core");
|
|
47
|
+
const react_1 = __importStar(require("react"));
|
|
48
|
+
const react_jss_1 = require("react-jss");
|
|
49
|
+
const ConfigurationFormEntry_1 = require("./ConfigurationFormEntry");
|
|
50
|
+
const getSectionDefault_1 = require("./getSectionDefault");
|
|
51
|
+
const useStyles = (0, react_jss_1.createUseStyles)({
|
|
52
|
+
formGrid: ({ layout }) => ({
|
|
53
|
+
display: 'grid',
|
|
54
|
+
gridTemplateColumns: layout === 'horizontal' ? '1fr 1fr' : '1fr',
|
|
55
|
+
gap: '0.5em 2em',
|
|
56
|
+
}),
|
|
57
|
+
saveButtonRow: ({ layout }) => ({
|
|
58
|
+
gridColumn: layout === 'horizontal' ? 'span 2' : 'span 1',
|
|
59
|
+
transition: 'transform 0.75s, max-height 0.75s, opacity 0.75s',
|
|
60
|
+
maxHeight: 200, // Necessary to make animation work correctly
|
|
61
|
+
transform: 'scaleY(1)',
|
|
62
|
+
marginTop: '1em',
|
|
63
|
+
}),
|
|
64
|
+
saveButtonRowNotVisible: {
|
|
65
|
+
transform: 'scaleY(0)',
|
|
66
|
+
maxHeight: 0,
|
|
67
|
+
opacity: 0,
|
|
68
|
+
},
|
|
69
|
+
saveButton: {
|
|
70
|
+
transition: 'all 0.75s',
|
|
71
|
+
width: 120,
|
|
72
|
+
float: 'right',
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
const ConfigurationForm = ({ section, params, readOnlySection, onSave, formatKey, saveText, options, layout = 'horizontal', className, entryClassName, saveBtnClassName, animateSaveButton = true, }) => {
|
|
76
|
+
const classes = useStyles({ layout });
|
|
77
|
+
const [resolvedSection] = (0, resolvable_ui_elements_1.useResolveSection)(section, params);
|
|
78
|
+
const entries = (0, react_1.useMemo)(() => (0, getSectionDefault_1.getSectionDefault)(section), [section]);
|
|
79
|
+
const [changes, setChanges] = (0, react_1.useState)();
|
|
80
|
+
const [canSave, setCanSave] = (0, react_1.useState)(false);
|
|
81
|
+
const [isSaving, setIsSaving] = (0, react_1.useState)(false);
|
|
82
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)(classes.formGrid, className) },
|
|
83
|
+
Object.entries(entries).map(([key, defaultValue]) => (react_1.default.createElement(ConfigurationFormEntry_1.ConfigurationFormEntry, { key: key, options: options?.get(key), name: formatKey ? formatKey(key) : key, value: resolvedSection[key] ?? defaultValue, onChange: (val) => {
|
|
84
|
+
setChanges({ ...changes, [key]: val });
|
|
85
|
+
setCanSave(true);
|
|
86
|
+
}, className: entryClassName }))),
|
|
87
|
+
readOnlySection && (react_1.default.createElement(exports.ConfigurationFormReadOnlyEntries, { readOnlySection: readOnlySection, formatKey: formatKey, params: params, className: entryClassName })),
|
|
88
|
+
react_1.default.createElement("div", { className: (0, classnames_1.default)(classes.saveButtonRow, {
|
|
89
|
+
[classes.saveButtonRowNotVisible]: animateSaveButton && !canSave,
|
|
90
|
+
}) },
|
|
91
|
+
react_1.default.createElement(ui_1.Button, { disabled: !canSave, className: (0, classnames_1.default)(classes.saveButton, saveBtnClassName), type: 'primary', loading: isSaving, onClick: async () => {
|
|
92
|
+
setIsSaving(true);
|
|
93
|
+
await onSave(haystack_core_1.HDict.make(changes));
|
|
94
|
+
setChanges(undefined); // Reset changes dict
|
|
95
|
+
setIsSaving(false);
|
|
96
|
+
setCanSave(false);
|
|
97
|
+
} }, saveText ?? 'Save'))));
|
|
98
|
+
};
|
|
99
|
+
exports.ConfigurationForm = ConfigurationForm;
|
|
100
|
+
const ConfigurationFormReadOnlyEntries = ({ readOnlySection, params, formatKey, className, }) => {
|
|
101
|
+
const [resolvedReadOnlySection] = (0, resolvable_ui_elements_1.useResolveSection)(readOnlySection, params);
|
|
102
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, resolvedReadOnlySection &&
|
|
103
|
+
Object.entries(resolvedReadOnlySection).map(([key, value]) => (react_1.default.createElement(ConfigurationFormEntry_1.ConfigurationFormEntry, { key: key, name: formatKey ? formatKey(key) : key, disabled: true, value: value, className: className })))));
|
|
104
|
+
};
|
|
105
|
+
exports.ConfigurationFormReadOnlyEntries = ConfigurationFormReadOnlyEntries;
|
|
96
106
|
//# sourceMappingURL=ConfigurationForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurationForm.js","sourceRoot":"","sources":["../../../../../src/react/components/resolvable/configurationForm/ConfigurationForm.tsx"],"names":[],"mappings":";AAAA;;GAEG
|
|
1
|
+
{"version":3,"file":"ConfigurationForm.js","sourceRoot":"","sources":["../../../../../src/react/components/resolvable/configurationForm/ConfigurationForm.tsx"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,0EAIsC;AACtC,kCAAkC;AAClC,4DAA2B;AAC3B,iDAAkD;AAClD,+CAAgD;AAChD,yCAA2C;AAC3C,qEAGiC;AACjC,2DAAuD;AAQvD,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC;IACjC,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAkB,EAAE,EAAE,CAAC,CAAC;QAC1C,OAAO,EAAE,MAAM;QACf,mBAAmB,EAAE,MAAM,KAAK,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;QAChE,GAAG,EAAE,WAAW;KAChB,CAAC;IACF,aAAa,EAAE,CAAC,EAAE,MAAM,EAAkB,EAAE,EAAE,CAAC,CAAC;QAC/C,UAAU,EAAE,MAAM,KAAK,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;QACzD,UAAU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UAAU,CAAC,KAAK,CAAC,CAAA;gBAClB,CAAC,IACA,QAAQ,IAAI,MAAM,CACX,CACJ,CACD,CACN,CAAA;AACF,CAAC,CAAA;AApEY,QAAA,iBAAiB,qBAoE7B;AASM,MAAM,gCAAgC,GAAG,CAA0B,EACzE,eAAe,EACf,MAAM,EACN,SAAS,EACT,SAAS,GACiC,EAAE,EAAE;IAC9C,MAAM,CAAC,uBAAuB,CAAC,GAAG,IAAA,0CAAiB,EAAC,eAAe,EAAE,MAAM,CAAC,CAAA;IAE5E,OAAO,CACN,8DACE,uBAAuB;QACvB,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAC7D,8BAAC,+CAAsB,IACtB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EACtC,QAAQ,QACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,GACnB,CACF,CAAC,CACD,CACH,CAAA;AACF,CAAC,CAAA;AAtBY,QAAA,gCAAgC,oCAsB5C"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
export
|
|
16
|
-
export {};
|
|
1
|
+
import { HDict, HGrid, HNum, HRef, HStr, HVal } from 'haystack-core';
|
|
2
|
+
export interface ConfigurationFormEntryOption extends HDict {
|
|
3
|
+
value: HStr | HNum | HRef;
|
|
4
|
+
label: HStr;
|
|
5
|
+
}
|
|
6
|
+
interface ConfigurationFormEntryProps {
|
|
7
|
+
name: string;
|
|
8
|
+
value: HVal | unknown;
|
|
9
|
+
onChange?: (val: HVal) => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
options?: HGrid<ConfigurationFormEntryOption>;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const ConfigurationFormEntry: ({ name, value, onChange, disabled, options, className, }: ConfigurationFormEntryProps) => JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -1,89 +1,99 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2023, J2 Innovations. All Rights Reserved
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2023, J2 Innovations. All Rights Reserved
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.ConfigurationFormEntry = void 0;
|
|
43
|
+
const ui_1 = require("@j2inn/ui");
|
|
44
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
45
|
+
const haystack_core_1 = require("haystack-core");
|
|
46
|
+
const react_1 = __importStar(require("react"));
|
|
47
|
+
const react_jss_1 = require("react-jss");
|
|
48
|
+
const useStyles = (0, react_jss_1.createUseStyles)((theme) => ({
|
|
49
|
+
formEntry: {
|
|
50
|
+
[`& .${ui_1.ant_prefix}-input`]: {
|
|
51
|
+
height: 32,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
entryTitle: {
|
|
55
|
+
fontWeight: 600,
|
|
56
|
+
fontSize: '1em',
|
|
57
|
+
color: theme.textColorSecondary,
|
|
58
|
+
},
|
|
59
|
+
select: {
|
|
60
|
+
width: '100%',
|
|
61
|
+
},
|
|
62
|
+
}));
|
|
63
|
+
const getHValFromSelectValue = (selectValue, initialHVal) => {
|
|
64
|
+
if ((0, haystack_core_1.valueIsKind)(initialHVal, haystack_core_1.Kind.Number)) {
|
|
65
|
+
return haystack_core_1.HNum.make(selectValue, initialHVal.unit);
|
|
66
|
+
}
|
|
67
|
+
else if ((0, haystack_core_1.valueIsKind)(initialHVal, haystack_core_1.Kind.Ref)) {
|
|
68
|
+
return haystack_core_1.HRef.make(selectValue);
|
|
69
|
+
}
|
|
70
|
+
return haystack_core_1.HStr.make(selectValue);
|
|
71
|
+
};
|
|
72
|
+
const ConfigurationFormEntry = ({ name, value, onChange, disabled, options, className, }) => {
|
|
73
|
+
const classes = useStyles();
|
|
74
|
+
if (!(0, haystack_core_1.isHVal)(value)) {
|
|
75
|
+
return react_1.default.createElement(react_1.default.Fragment, null, `${name} = ${value}`);
|
|
76
|
+
}
|
|
77
|
+
const [showedVal, setShowedVal] = (0, react_1.useState)(value);
|
|
78
|
+
(0, react_1.useEffect)(() => {
|
|
79
|
+
setShowedVal(value);
|
|
80
|
+
}, [value]);
|
|
81
|
+
const selectOptions = (0, react_1.useMemo)(() => options?.getRows().map((cfeOpt) => ({
|
|
82
|
+
value: cfeOpt.value.value,
|
|
83
|
+
label: cfeOpt.label.value,
|
|
84
|
+
})), [options]);
|
|
85
|
+
const onInputChange = (0, react_1.useCallback)((val) => {
|
|
86
|
+
setShowedVal(val);
|
|
87
|
+
onChange?.(val);
|
|
88
|
+
}, [onChange]);
|
|
89
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)(classes.formEntry, className) },
|
|
90
|
+
react_1.default.createElement("div", { className: classes.entryTitle }, name),
|
|
91
|
+
selectOptions ? (react_1.default.createElement(ui_1.Select, { showSearch: true, className: classes.select, value: showedVal.value, options: selectOptions, disabled: disabled, onChange: (val) => {
|
|
92
|
+
if (val != null) {
|
|
93
|
+
const newVal = getHValFromSelectValue(val, value);
|
|
94
|
+
onInputChange(newVal);
|
|
95
|
+
}
|
|
96
|
+
} })) : !disabled ? (react_1.default.createElement(ui_1.HInput, { value: showedVal, editable: true, onChange: onInputChange })) : (react_1.default.createElement(ui_1.Input, { disabled: true, value: showedVal.toString() }))));
|
|
97
|
+
};
|
|
98
|
+
exports.ConfigurationFormEntry = ConfigurationFormEntry;
|
|
89
99
|
//# sourceMappingURL=ConfigurationFormEntry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurationFormEntry.js","sourceRoot":"","sources":["../../../../../src/react/components/resolvable/configurationForm/ConfigurationFormEntry.tsx"],"names":[],"mappings":";AAAA;;GAEG
|
|
1
|
+
{"version":3,"file":"ConfigurationFormEntry.js","sourceRoot":"","sources":["../../../../../src/react/components/resolvable/configurationForm/ConfigurationFormEntry.tsx"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kCAAuE;AACvE,4DAA2B;AAC3B,iDAUsB;AACtB,+CAAwE;AACxE,yCAA2C;AAE3C,MAAM,SAAS,GAAG,IAAA,2BAAe,EAAC,CAAC,KAAe,EAAE,EAAE,CAAC,CAAC;IACvD,SAAS,EAAE;QACV,CAAC,MAAM,eAAU,QAAQ,CAAC,EAAE;YAC3B,MAAM,EAAE,EAAE;SACV;KACD;IACD,UAAU,EAAE;QACX,UAAU,EAAE,GAAG;QACf,QAAQ,EAAE,KAAK;QACf,KAAK,EAAE,KAAK,CAAC,kBAAkB;KAC/B;IACD,MAAM,EAAE;QACP,KAAK,EAAE,MAAM;KACb;CACD,CAAC,CAAC,CAAA;AAgBH,MAAM,sBAAsB,GAAG,CAAC,WAAoB,EAAE,WAAiB,EAAE,EAAE;IAC1E,IAAI,IAAA,2BAAW,EAAC,WAAW,EAAE,oBAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3C,OAAO,oBAAI,CAAC,IAAI,CAAC,WAAqB,EAAG,WAAoB,CAAC,IAAI,CAAC,CAAA;IACpE,CAAC;SAAM,IAAI,IAAA,2BAAW,EAAC,WAAW,EAAE,oBAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,OAAO,oBA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O,CAAC,UAAU,IAAG,IAAI,CAAO;QAC/C,aAAa,CAAC,CAAC,CAAC,CAChB,8BAAC,WAAM,IACN,UAAU,QACV,SAAS,EAAE,OAAO,CAAC,MAAM,EACzB,KAAK,EAAG,SAAgC,CAAC,KAAK,EAC9C,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;gBACjB,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;oBACjB,MAAM,MAAM,GAAG,sBAAsB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;oBACjD,aAAa,CAAC,MAAM,CAAC,CAAA;gBACtB,CAAC;YACF,CAAC,GACA,CACF,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACf,8BAAC,WAAM,IAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,QAAC,QAAQ,EAAE,aAAa,GAAI,CAC9D,CAAC,CAAC,CAAC,CACH,8BAAC,UAAK,IAAC,QAAQ,QAAC,KAAK,EAAE,SAAS,CAAC,QAAQ,EAAE,GAAI,CAC/C,CACI,CACN,CAAA;AACF,CAAC,CAAA;AA7DY,QAAA,sBAAsB,0BA6DlC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { UiElementData } from '@j2inn/resolvable-ui-elements';
|
|
2
|
-
import { HVal } from 'haystack-core';
|
|
3
|
-
/**
|
|
4
|
-
* Get default values for all elements that should resolve into an HVal.
|
|
5
|
-
* @param section a section element
|
|
6
|
-
* @returns an object containing as key the section element name and as value the default HVal.
|
|
7
|
-
*/
|
|
8
|
-
export declare const getSectionDefault: (section: UiElementData) => {
|
|
9
|
-
[key: string]: HVal;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Get a default for a specific kind of HVal.
|
|
13
|
-
* @param kind can be expressed as new or old Hayson, or alternatively the haystack-core type name
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
export declare const getDefaultHVal: (kind?: string) => HVal | undefined;
|
|
1
|
+
import { UiElementData } from '@j2inn/resolvable-ui-elements';
|
|
2
|
+
import { HVal } from 'haystack-core';
|
|
3
|
+
/**
|
|
4
|
+
* Get default values for all elements that should resolve into an HVal.
|
|
5
|
+
* @param section a section element
|
|
6
|
+
* @returns an object containing as key the section element name and as value the default HVal.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getSectionDefault: (section: UiElementData) => {
|
|
9
|
+
[key: string]: HVal;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Get a default for a specific kind of HVal.
|
|
13
|
+
* @param kind can be expressed as new or old Hayson, or alternatively the haystack-core type name
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare const getDefaultHVal: (kind?: string) => HVal | undefined;
|