@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260324082757 → 0.8.1-dev.20260324093446
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/index.d.mts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +8 -30
- package/dist/index.mjs +7 -27
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
|
|
3
|
-
type WidgetRegistryType = Record<string, ComponentType<any> | ((props: any) => any)>;
|
|
4
|
-
declare const registerWidgets: (widgets: WidgetRegistryType) => void;
|
|
5
|
-
declare const getWidget: (code: string) => ComponentType<any> | undefined;
|
|
6
|
-
|
|
7
3
|
interface ViewControlProps {
|
|
8
4
|
value?: unknown;
|
|
9
5
|
controlType?: string;
|
|
@@ -209,7 +205,10 @@ interface PageBodyRendererProps {
|
|
|
209
205
|
donotApplyContainerLargeClass?: boolean;
|
|
210
206
|
serviceClient?: ServiceClientInterface;
|
|
211
207
|
assetBaseUrl?: string;
|
|
208
|
+
widgetRegistry?: Record<string, React.ComponentType<unknown>>;
|
|
212
209
|
}
|
|
213
210
|
declare const PageBodyRenderer: React.FC<PageBodyRendererProps>;
|
|
214
211
|
|
|
215
|
-
|
|
212
|
+
type WidgetRegistryType = Record<string, ComponentType<unknown>>;
|
|
213
|
+
|
|
214
|
+
export { type ActionResponse, DataList, InputControl, type InputControlProps, InputControlType, PageBodyRenderer, ViewControl, type ViewControlProps, ViewControlTypes, type WidgetRegistryType };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
|
|
3
|
-
type WidgetRegistryType = Record<string, ComponentType<any> | ((props: any) => any)>;
|
|
4
|
-
declare const registerWidgets: (widgets: WidgetRegistryType) => void;
|
|
5
|
-
declare const getWidget: (code: string) => ComponentType<any> | undefined;
|
|
6
|
-
|
|
7
3
|
interface ViewControlProps {
|
|
8
4
|
value?: unknown;
|
|
9
5
|
controlType?: string;
|
|
@@ -209,7 +205,10 @@ interface PageBodyRendererProps {
|
|
|
209
205
|
donotApplyContainerLargeClass?: boolean;
|
|
210
206
|
serviceClient?: ServiceClientInterface;
|
|
211
207
|
assetBaseUrl?: string;
|
|
208
|
+
widgetRegistry?: Record<string, React.ComponentType<unknown>>;
|
|
212
209
|
}
|
|
213
210
|
declare const PageBodyRenderer: React.FC<PageBodyRendererProps>;
|
|
214
211
|
|
|
215
|
-
|
|
212
|
+
type WidgetRegistryType = Record<string, ComponentType<unknown>>;
|
|
213
|
+
|
|
214
|
+
export { type ActionResponse, DataList, InputControl, type InputControlProps, InputControlType, PageBodyRenderer, ViewControl, type ViewControlProps, ViewControlTypes, type WidgetRegistryType };
|
package/dist/index.js
CHANGED
|
@@ -37,30 +37,10 @@ __export(index_exports, {
|
|
|
37
37
|
InputControlType: () => InputControlType_default,
|
|
38
38
|
PageBodyRenderer: () => PageBodyRenderer_default,
|
|
39
39
|
ViewControl: () => ViewControl_default,
|
|
40
|
-
ViewControlTypes: () => ViewControlTypes_default
|
|
41
|
-
getWidget: () => getWidget,
|
|
42
|
-
registerWidgets: () => registerWidgets
|
|
40
|
+
ViewControlTypes: () => ViewControlTypes_default
|
|
43
41
|
});
|
|
44
42
|
module.exports = __toCommonJS(index_exports);
|
|
45
43
|
|
|
46
|
-
// src/components/pageRenderingEngine/nodes/WidgetRegistry.tsx
|
|
47
|
-
var GLOBAL_KEY = "__DIGITALSTORE_WIDGET_REGISTRY__";
|
|
48
|
-
var getRegistry = () => {
|
|
49
|
-
const globalAny = globalThis;
|
|
50
|
-
if (!globalAny[GLOBAL_KEY]) {
|
|
51
|
-
globalAny[GLOBAL_KEY] = {};
|
|
52
|
-
}
|
|
53
|
-
return globalAny[GLOBAL_KEY];
|
|
54
|
-
};
|
|
55
|
-
var registerWidgets = (widgets) => {
|
|
56
|
-
const registry = getRegistry();
|
|
57
|
-
Object.assign(registry, widgets);
|
|
58
|
-
};
|
|
59
|
-
var getWidget = (code) => {
|
|
60
|
-
const registry = getRegistry();
|
|
61
|
-
return registry[code];
|
|
62
|
-
};
|
|
63
|
-
|
|
64
44
|
// src/components/controls/view/ViewControl.tsx
|
|
65
45
|
var import_react11 = __toESM(require("react"));
|
|
66
46
|
|
|
@@ -3111,9 +3091,6 @@ var ImageNode_default = ImageNode;
|
|
|
3111
3091
|
// src/components/pageRenderingEngine/nodes/WidgetNode.tsx
|
|
3112
3092
|
var import_react43 = __toESM(require("react"));
|
|
3113
3093
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3114
|
-
function resolveWidget(code) {
|
|
3115
|
-
return getWidget(code);
|
|
3116
|
-
}
|
|
3117
3094
|
var WidgetNode = (props) => {
|
|
3118
3095
|
const getWidgetParameters = () => {
|
|
3119
3096
|
const widgetInputParameters = {
|
|
@@ -3169,7 +3146,7 @@ var WidgetNode = (props) => {
|
|
|
3169
3146
|
return widgetInputParameters;
|
|
3170
3147
|
};
|
|
3171
3148
|
const widgetCode = props.node.widgetCode;
|
|
3172
|
-
const SelectedWidget =
|
|
3149
|
+
const SelectedWidget = props.widgetRegistry?.[widgetCode];
|
|
3173
3150
|
if (!SelectedWidget) {
|
|
3174
3151
|
console.warn("Widget not found:", widgetCode);
|
|
3175
3152
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
@@ -3178,6 +3155,7 @@ var WidgetNode = (props) => {
|
|
|
3178
3155
|
] });
|
|
3179
3156
|
}
|
|
3180
3157
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react43.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "container mt-2", children: "..." }), children: import_react43.default.createElement(SelectedWidget, {
|
|
3158
|
+
// @ts-expect-error custom code
|
|
3181
3159
|
params: getWidgetParameters(),
|
|
3182
3160
|
query: props.query,
|
|
3183
3161
|
session: props.session,
|
|
@@ -4657,7 +4635,8 @@ var PageBodyRenderer = (props) => {
|
|
|
4657
4635
|
path: props.path,
|
|
4658
4636
|
apiBaseUrl: props.apiBaseUrl,
|
|
4659
4637
|
serviceClient: props.serviceClient,
|
|
4660
|
-
assetBaseUrl: props.assetBaseUrl
|
|
4638
|
+
assetBaseUrl: props.assetBaseUrl,
|
|
4639
|
+
widgetRegistry: props.widgetRegistry
|
|
4661
4640
|
}
|
|
4662
4641
|
) }) : /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react51.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
4663
4642
|
SelectedNode,
|
|
@@ -4670,7 +4649,8 @@ var PageBodyRenderer = (props) => {
|
|
|
4670
4649
|
path: props.path,
|
|
4671
4650
|
apiBaseUrl: props.apiBaseUrl,
|
|
4672
4651
|
serviceClient: props.serviceClient,
|
|
4673
|
-
assetBaseUrl: props.assetBaseUrl
|
|
4652
|
+
assetBaseUrl: props.assetBaseUrl,
|
|
4653
|
+
widgetRegistry: props.widgetRegistry
|
|
4674
4654
|
}
|
|
4675
4655
|
) }) }) }, index);
|
|
4676
4656
|
}) });
|
|
@@ -4683,7 +4663,5 @@ var PageBodyRenderer_default = PageBodyRenderer;
|
|
|
4683
4663
|
InputControlType,
|
|
4684
4664
|
PageBodyRenderer,
|
|
4685
4665
|
ViewControl,
|
|
4686
|
-
ViewControlTypes
|
|
4687
|
-
getWidget,
|
|
4688
|
-
registerWidgets
|
|
4666
|
+
ViewControlTypes
|
|
4689
4667
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
// src/components/pageRenderingEngine/nodes/WidgetRegistry.tsx
|
|
5
|
-
var GLOBAL_KEY = "__DIGITALSTORE_WIDGET_REGISTRY__";
|
|
6
|
-
var getRegistry = () => {
|
|
7
|
-
const globalAny = globalThis;
|
|
8
|
-
if (!globalAny[GLOBAL_KEY]) {
|
|
9
|
-
globalAny[GLOBAL_KEY] = {};
|
|
10
|
-
}
|
|
11
|
-
return globalAny[GLOBAL_KEY];
|
|
12
|
-
};
|
|
13
|
-
var registerWidgets = (widgets) => {
|
|
14
|
-
const registry = getRegistry();
|
|
15
|
-
Object.assign(registry, widgets);
|
|
16
|
-
};
|
|
17
|
-
var getWidget = (code) => {
|
|
18
|
-
const registry = getRegistry();
|
|
19
|
-
return registry[code];
|
|
20
|
-
};
|
|
21
|
-
|
|
22
4
|
// src/components/controls/view/ViewControl.tsx
|
|
23
5
|
import React11 from "react";
|
|
24
6
|
|
|
@@ -3077,9 +3059,6 @@ var ImageNode_default = ImageNode;
|
|
|
3077
3059
|
// src/components/pageRenderingEngine/nodes/WidgetNode.tsx
|
|
3078
3060
|
import React42, { Suspense } from "react";
|
|
3079
3061
|
import { Fragment as Fragment7, jsx as jsx56, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3080
|
-
function resolveWidget(code) {
|
|
3081
|
-
return getWidget(code);
|
|
3082
|
-
}
|
|
3083
3062
|
var WidgetNode = (props) => {
|
|
3084
3063
|
const getWidgetParameters = () => {
|
|
3085
3064
|
const widgetInputParameters = {
|
|
@@ -3135,7 +3114,7 @@ var WidgetNode = (props) => {
|
|
|
3135
3114
|
return widgetInputParameters;
|
|
3136
3115
|
};
|
|
3137
3116
|
const widgetCode = props.node.widgetCode;
|
|
3138
|
-
const SelectedWidget =
|
|
3117
|
+
const SelectedWidget = props.widgetRegistry?.[widgetCode];
|
|
3139
3118
|
if (!SelectedWidget) {
|
|
3140
3119
|
console.warn("Widget not found:", widgetCode);
|
|
3141
3120
|
return /* @__PURE__ */ jsxs27(Fragment7, { children: [
|
|
@@ -3144,6 +3123,7 @@ var WidgetNode = (props) => {
|
|
|
3144
3123
|
] });
|
|
3145
3124
|
}
|
|
3146
3125
|
return /* @__PURE__ */ jsx56(Suspense, { fallback: /* @__PURE__ */ jsx56("div", { className: "container mt-2", children: "..." }), children: React42.createElement(SelectedWidget, {
|
|
3126
|
+
// @ts-expect-error custom code
|
|
3147
3127
|
params: getWidgetParameters(),
|
|
3148
3128
|
query: props.query,
|
|
3149
3129
|
session: props.session,
|
|
@@ -4623,7 +4603,8 @@ var PageBodyRenderer = (props) => {
|
|
|
4623
4603
|
path: props.path,
|
|
4624
4604
|
apiBaseUrl: props.apiBaseUrl,
|
|
4625
4605
|
serviceClient: props.serviceClient,
|
|
4626
|
-
assetBaseUrl: props.assetBaseUrl
|
|
4606
|
+
assetBaseUrl: props.assetBaseUrl,
|
|
4607
|
+
widgetRegistry: props.widgetRegistry
|
|
4627
4608
|
}
|
|
4628
4609
|
) }) : /* @__PURE__ */ jsx67(React50.Fragment, { children: /* @__PURE__ */ jsx67(
|
|
4629
4610
|
SelectedNode,
|
|
@@ -4636,7 +4617,8 @@ var PageBodyRenderer = (props) => {
|
|
|
4636
4617
|
path: props.path,
|
|
4637
4618
|
apiBaseUrl: props.apiBaseUrl,
|
|
4638
4619
|
serviceClient: props.serviceClient,
|
|
4639
|
-
assetBaseUrl: props.assetBaseUrl
|
|
4620
|
+
assetBaseUrl: props.assetBaseUrl,
|
|
4621
|
+
widgetRegistry: props.widgetRegistry
|
|
4640
4622
|
}
|
|
4641
4623
|
) }) }) }, index);
|
|
4642
4624
|
}) });
|
|
@@ -4648,7 +4630,5 @@ export {
|
|
|
4648
4630
|
InputControlType_default as InputControlType,
|
|
4649
4631
|
PageBodyRenderer_default as PageBodyRenderer,
|
|
4650
4632
|
ViewControl_default as ViewControl,
|
|
4651
|
-
ViewControlTypes_default as ViewControlTypes
|
|
4652
|
-
getWidget,
|
|
4653
|
-
registerWidgets
|
|
4633
|
+
ViewControlTypes_default as ViewControlTypes
|
|
4654
4634
|
};
|
package/package.json
CHANGED