@wavemaker-ai/react-runtime 1.0.0-rc.647684 → 12.0.0-rc.335
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/components/advanced/carousel/index.d.ts +1 -0
- package/components/advanced/carousel/template.d.ts +1 -0
- package/components/advanced/login/index.d.ts +1 -0
- package/components/advanced/marquee/index.d.ts +1 -0
- package/components/basic/anchor/index.d.ts +1 -0
- package/components/basic/anchor/index.js +3 -5
- package/components/basic/audio/index.d.ts +1 -0
- package/components/basic/html/index.d.ts +1 -0
- package/components/basic/icon/index.d.ts +1 -0
- package/components/basic/iframe/index.d.ts +1 -0
- package/components/basic/label/index.d.ts +1 -0
- package/components/basic/picture/index.d.ts +1 -0
- package/components/basic/progress-bar/index.d.ts +1 -0
- package/components/basic/progress-circle/index.d.ts +1 -0
- package/components/basic/richtexteditor/index.d.ts +3 -0
- package/components/basic/search/index.js +5 -4
- package/components/basic/search/utils.d.ts +1 -0
- package/components/basic/search/utils.js +9 -0
- package/components/basic/spinner/index.d.ts +1 -0
- package/components/basic/tile/index.d.ts +1 -0
- package/components/basic/tree/index.d.ts +1 -0
- package/components/basic/video/index.d.ts +1 -0
- package/components/chart/index.d.ts +1 -0
- package/components/common/index.d.ts +2 -0
- package/components/common/index.js +2 -0
- package/components/common/partial-content-wrapper.d.ts +15 -0
- package/components/common/partial-content-wrapper.js +11 -0
- package/components/container/accordion/accordion-pane/index.d.ts +1 -0
- package/components/container/accordion/index.d.ts +1 -0
- package/components/container/index.d.ts +4 -0
- package/components/container/index.js +38 -11
- package/components/container/layout-grid/grid-column/index.d.ts +1 -0
- package/components/container/layout-grid/grid-row/index.d.ts +1 -0
- package/components/container/layout-grid/index.d.ts +1 -0
- package/components/container/layout-grid/index.js +1 -1
- package/components/container/linear-layout/index.d.ts +1 -0
- package/components/container/linear-layout/linear-layout-item/index.d.ts +1 -0
- package/components/container/panel/index.d.ts +1 -0
- package/components/container/props.d.ts +1 -0
- package/components/container/repeat-template/index.d.ts +1 -0
- package/components/container/repeat-template/index.js +1 -1
- package/components/container/tabs/index.d.ts +1 -0
- package/components/container/tabs/index.js +12 -8
- package/components/container/tabs/tab-pane/index.d.ts +1 -0
- package/components/container/tabs/tab-pane/index.js +2 -2
- package/components/container/wizard/index.d.ts +2 -0
- package/components/container/wizard/index.js +92 -43
- package/components/container/wizard/props.d.ts +2 -2
- package/components/container/wizard/wizard-step/index.d.ts +1 -0
- package/components/data/card/card-actions/index.d.ts +1 -0
- package/components/data/card/card-content/index.d.ts +1 -0
- package/components/data/card/card-footer/index.d.ts +1 -0
- package/components/data/card/index.d.ts +1 -0
- package/components/data/form/base-form/hooks/useFormOperations.d.ts +1 -1
- package/components/data/form/base-form/hooks/useFormOperations.js +5 -2
- package/components/data/form/base-form/index.js +10 -14
- package/components/data/form/base-form/props.d.ts +1 -0
- package/components/data/form/dynamic-fields/WmxDynamicFormField.js +9 -23
- package/components/data/form/form-action/index.d.ts +2 -0
- package/components/data/form/form-controller/props.d.ts +2 -0
- package/components/data/form/form-controller/utils.js +3 -2
- package/components/data/form/form-controller/validation-contrustor.js +112 -1
- package/components/data/form/form-controller/withFormController.js +16 -3
- package/components/data/form/form-field/index.js +38 -11
- package/components/data/form/form-field/props.d.ts +8 -2
- package/components/data/list/components/ListItemWithTemplate.js +1 -1
- package/components/data/list/index.d.ts +2 -0
- package/components/data/list/index.js +5 -10
- package/components/data/pagination/hooks/usePagination.js +6 -6
- package/components/data/table/components/EditableCell.js +47 -24
- package/components/data/table/components/FieldValidationError.js +1 -1
- package/components/data/table/components/RowExpansionButton.js +5 -1
- package/components/data/table/components/TableBody.js +2 -0
- package/components/data/table/components/TableHeader.js +12 -4
- package/components/data/table/hooks/useFormWidget.js +13 -2
- package/components/data/table/hooks/usePanelStructure.js +6 -1
- package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
- package/components/data/table/hooks/useRowHandlers.js +1 -1
- package/components/data/table/hooks/useRowSelection.js +65 -4
- package/components/data/table/hooks/useTableData.js +10 -2
- package/components/data/table/hooks/useTableEdit.d.ts +1 -1
- package/components/data/table/hooks/useTableEdit.js +115 -75
- package/components/data/table/hooks/useTableEditForms.d.ts +25 -0
- package/components/data/table/hooks/useTableEditForms.js +30 -0
- package/components/data/table/index.d.ts +2 -0
- package/components/data/table/index.js +82 -45
- package/components/data/table/live-table/index.d.ts +1 -0
- package/components/data/table/props.d.ts +43 -23
- package/components/data/table/table-action/index.d.ts +1 -0
- package/components/data/table/table-column/index.d.ts +1 -0
- package/components/data/table/table-row/index.d.ts +1 -0
- package/components/data/table/table-row-action/index.d.ts +1 -0
- package/components/data/table/utils/buildSelectionColumns.js +19 -24
- package/components/data/table/utils/columnProxy.d.ts +7 -1
- package/components/data/table/utils/columnProxy.js +21 -1
- package/components/data/table/utils/columnValidation.d.ts +19 -0
- package/components/data/table/utils/columnValidation.js +76 -0
- package/components/data/table/utils/constants.d.ts +2 -0
- package/components/data/table/utils/constants.js +2 -0
- package/components/data/table/utils/crud-handlers.js +3 -1
- package/components/data/table/utils/expansionColumn.js +1 -1
- package/components/data/table/utils/index.d.ts +14 -15
- package/components/data/table/utils/index.js +18 -85
- package/components/data/table/utils/selectionUtils.d.ts +12 -0
- package/components/data/table/utils/selectionUtils.js +23 -5
- package/components/dialogs/alert-dialog/index.d.ts +2 -0
- package/components/dialogs/confirm-dialog/index.d.ts +2 -0
- package/components/dialogs/dialog/index.d.ts +2 -0
- package/components/dialogs/dialog-actions/index.d.ts +1 -0
- package/components/dialogs/dialog-body/index.d.ts +1 -0
- package/components/dialogs/dialog-content/index.d.ts +1 -0
- package/components/dialogs/dialog-header/index.d.ts +1 -0
- package/components/dialogs/iframe-dialog/index.d.ts +2 -0
- package/components/dialogs/login-dialog/index.d.ts +2 -0
- package/components/dialogs/page-dialog/index.d.ts +2 -0
- package/components/dialogs/withDialogWrapper.js +12 -2
- package/components/form/button/index.d.ts +1 -0
- package/components/form/button-group/index.d.ts +1 -0
- package/components/input/calendar/index.d.ts +2 -0
- package/components/input/chips/index.d.ts +3 -0
- package/components/input/color-picker/index.d.ts +3 -0
- package/components/input/composite/index.d.ts +1 -0
- package/components/input/composite/index.js +32 -6
- package/components/input/currency/index.d.ts +1 -0
- package/components/input/default/checkbox/index.d.ts +3 -0
- package/components/input/default/checkboxset/index.d.ts +3 -0
- package/components/input/default/radioset/index.d.ts +3 -0
- package/components/input/default/switch/index.d.ts +3 -0
- package/components/input/epoch/date/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.js +13 -3
- package/components/input/epoch/time/index.d.ts +1 -0
- package/components/input/fileupload/index.d.ts +1 -0
- package/components/input/fileupload/index.js +2 -1
- package/components/input/number/index.d.ts +3 -0
- package/components/input/rating/index.d.ts +3 -0
- package/components/input/select/index.d.ts +1 -0
- package/components/input/slider/index.d.ts +3 -0
- package/components/input/text/index.d.ts +3 -0
- package/components/input/text/index.js +9 -2
- package/components/input/textarea/index.d.ts +3 -0
- package/components/input/upload/index.d.ts +3 -0
- package/components/layout/footer/index.js +4 -2
- package/components/layout/footer/props.d.ts +1 -0
- package/components/layout/header/index.js +29 -3
- package/components/layout/header/props.d.ts +1 -0
- package/components/layout/leftnav/index.js +22 -6
- package/components/layout/leftnav/props.d.ts +1 -0
- package/components/layout/leftnav/utils/page-class-util.d.ts +1 -0
- package/components/layout/leftnav/utils/page-class-util.js +4 -3
- package/components/layout/rightnav/index.js +4 -2
- package/components/layout/rightnav/props.d.ts +1 -0
- package/components/layout/topnav/index.js +4 -2
- package/components/layout/topnav/props.d.ts +1 -0
- package/components/navbar/index.d.ts +1 -0
- package/components/navbar/index.js +32 -7
- package/components/navbar/nav-item/index.d.ts +1 -0
- package/components/navigation/breadcrumb/index.d.ts +1 -0
- package/components/navigation/menu/index.d.ts +1 -0
- package/components/navigation/menu/index.js +19 -11
- package/components/navigation/menu/props.d.ts +1 -0
- package/components/navigation/popover/index.d.ts +1 -0
- package/components/navigation/popover/index.js +15 -3
- package/components/page/index.js +60 -19
- package/components/page/page-context.d.ts +4 -0
- package/components/page/partial/index.d.ts +1 -0
- package/context/PopoverContext.d.ts +5 -0
- package/context/PopoverContext.js +5 -0
- package/context/WidgetProvider.js +9 -2
- package/core/proxy-service.d.ts +2 -0
- package/core/proxy-service.js +132 -22
- package/higherOrder/BaseApp.js +3 -2
- package/higherOrder/BasePage.js +4 -10
- package/higherOrder/props.d.ts +1 -0
- package/higherOrder/useActivePageReactivity.js +1 -4
- package/higherOrder/withBaseWrapper.js +12 -3
- package/hooks/useHttp.d.ts +14 -4
- package/hooks/useHttp.js +47 -9
- package/package-lock.json +332 -325
- package/package.json +3 -3
- package/runtime-dynamic/App.js +21 -2
- package/runtime-dynamic/app-initializer.js +8 -1
- package/runtime-dynamic/components/PageWrapper.js +1 -1
- package/runtime-dynamic/components/PrefabPreview.js +1 -1
- package/runtime-dynamic/components/partial-content.js +17 -1
- package/runtime-dynamic/factories/build-base-page-like-component.js +11 -7
- package/runtime-dynamic/factories/dynamic-component.js +5 -10
- package/runtime-dynamic/main.d.ts +1 -0
- package/runtime-dynamic/main.js +9 -1
- package/runtime-dynamic/routes.js +17 -8
- package/runtime-dynamic/services/compile-render.js +7 -0
- package/runtime-dynamic/services/css-scoping.d.ts +1 -1
- package/runtime-dynamic/services/css-scoping.js +2 -2
- package/runtime-dynamic/services/variable-factory.js +2 -1
- package/runtime-dynamic/services/variable-transpiler.js +4 -1
- package/runtime-dynamic/wmx-shared.d.ts +40 -0
- package/runtime-dynamic/wmx-shared.js +33 -0
- package/utils/page-params-util.js +22 -1
- package/utils/partial-host-util.d.ts +40 -0
- package/utils/partial-host-util.js +41 -0
- package/utils/style-utils.js +1 -1
- package/utils/wmx.utils.d.ts +0 -1
- package/utils/wmx.utils.js +0 -25
- package/variables/crud-variable.d.ts +10 -0
- package/variables/crud-variable.js +53 -2
- package/variables/live-variable.d.ts +1 -0
- package/variables/live-variable.js +2 -1
- package/variables/model-variable.d.ts +2 -0
- package/variables/model-variable.js +14 -0
- package/variables/operation-params.d.ts +29 -0
- package/variables/operation-params.js +69 -0
- package/variables/service-variable.d.ts +9 -0
- package/variables/service-variable.js +21 -2
- package/components/data/table/utils/validation.d.ts +0 -13
- package/components/data/table/utils/validation.js +0 -82
package/core/proxy-service.js
CHANGED
|
@@ -27,7 +27,35 @@ import { ServiceVariable } from "../variables/service-variable";
|
|
|
27
27
|
import LiveVariable from "../variables/live-variable";
|
|
28
28
|
import { ModelVariable } from "../variables/model-variable";
|
|
29
29
|
import CrudVariable from "../variables/crud-variable";
|
|
30
|
+
const NON_PROXYABLE_TAGS = /* @__PURE__ */ new Set([
|
|
31
|
+
"[object AbortController]",
|
|
32
|
+
"[object AbortSignal]",
|
|
33
|
+
"[object ArrayBuffer]",
|
|
34
|
+
"[object Blob]",
|
|
35
|
+
"[object Date]",
|
|
36
|
+
"[object Error]",
|
|
37
|
+
"[object File]",
|
|
38
|
+
"[object FileList]",
|
|
39
|
+
"[object FormData]",
|
|
40
|
+
"[object Headers]",
|
|
41
|
+
"[object Map]",
|
|
42
|
+
"[object Promise]",
|
|
43
|
+
"[object RegExp]",
|
|
44
|
+
"[object Request]",
|
|
45
|
+
"[object Response]",
|
|
46
|
+
"[object Set]",
|
|
47
|
+
"[object SharedArrayBuffer]",
|
|
48
|
+
"[object URL]",
|
|
49
|
+
"[object URLSearchParams]",
|
|
50
|
+
"[object WeakMap]",
|
|
51
|
+
"[object WeakRef]",
|
|
52
|
+
"[object WeakSet]"
|
|
53
|
+
]);
|
|
54
|
+
const isNonProxyableBuiltin = (value) => NON_PROXYABLE_TAGS.has(Object.prototype.toString.call(value)) || // Covers every TypedArray flavour plus DataView in one check.
|
|
55
|
+
ArrayBuffer.isView(value);
|
|
30
56
|
const proxyMap = /* @__PURE__ */ new WeakMap();
|
|
57
|
+
const stateProxyMap = /* @__PURE__ */ new WeakMap();
|
|
58
|
+
const isKnownProxy = (value) => proxyMap.has(value) || stateProxyMap.has(value);
|
|
31
59
|
const pageWidgetProxyCaches = /* @__PURE__ */ new WeakMap();
|
|
32
60
|
function clearPageWidgetProxyCache(widgetsProxy) {
|
|
33
61
|
var _a;
|
|
@@ -92,6 +120,7 @@ function queueBatchedWidgetContextUpdate(widgetName, widget, prop, value, setPag
|
|
|
92
120
|
}
|
|
93
121
|
}
|
|
94
122
|
const originalTargets = /* @__PURE__ */ new WeakMap();
|
|
123
|
+
const objectsBeingProxied = /* @__PURE__ */ new WeakSet();
|
|
95
124
|
const MUTATING_ARRAY_METHODS = [
|
|
96
125
|
"push",
|
|
97
126
|
"pop",
|
|
@@ -209,6 +238,7 @@ const createWidgetProxy = (widget, widgetName, setPageContext, overriddenPropsRe
|
|
|
209
238
|
widget.__isProxy = true;
|
|
210
239
|
const proxy = new Proxy(widget, {
|
|
211
240
|
set(target, prop, value, receiver) {
|
|
241
|
+
var _a;
|
|
212
242
|
if (typeof prop === "symbol" || prop === "prototype") {
|
|
213
243
|
return Reflect.set(target, prop, value, receiver);
|
|
214
244
|
}
|
|
@@ -224,10 +254,21 @@ const createWidgetProxy = (widget, widgetName, setPageContext, overriddenPropsRe
|
|
|
224
254
|
}
|
|
225
255
|
Reflect.set(target, prop, value, receiver);
|
|
226
256
|
queueBatchedWidgetContextUpdate(widgetName, widget, prop, value, setPageContext);
|
|
257
|
+
if (prop === "className") {
|
|
258
|
+
Reflect.set(target, "class", value);
|
|
259
|
+
(_a = overriddenPropsRegistry == null ? void 0 : overriddenPropsRegistry.trackOverriddenProps) == null ? void 0 : _a.call(
|
|
260
|
+
overriddenPropsRegistry,
|
|
261
|
+
widgetName,
|
|
262
|
+
"class",
|
|
263
|
+
value,
|
|
264
|
+
widget["data-widget-id"]
|
|
265
|
+
);
|
|
266
|
+
queueBatchedWidgetContextUpdate(widgetName, widget, "class", value, setPageContext);
|
|
267
|
+
}
|
|
227
268
|
return true;
|
|
228
269
|
},
|
|
229
270
|
get(target, prop, receiver) {
|
|
230
|
-
var _a;
|
|
271
|
+
var _a, _b, _c, _d;
|
|
231
272
|
if (typeof prop === "symbol" || prop === "prototype") {
|
|
232
273
|
return Reflect.get(target, prop, receiver);
|
|
233
274
|
}
|
|
@@ -302,6 +343,10 @@ const createWidgetProxy = (widget, widgetName, setPageContext, overriddenPropsRe
|
|
|
302
343
|
);
|
|
303
344
|
return internalValue !== void 0 ? internalValue : widgetOverrides[prop];
|
|
304
345
|
}
|
|
346
|
+
if (prop === "class" || prop === "className") {
|
|
347
|
+
const resolved = (_d = (_c = (_b = widgetOverrides == null ? void 0 : widgetOverrides.class) != null ? _b : Reflect.get(target, "class", receiver)) != null ? _c : widgetOverrides == null ? void 0 : widgetOverrides.className) != null ? _d : Reflect.get(target, "className", receiver);
|
|
348
|
+
return resolved != null ? resolved : "";
|
|
349
|
+
}
|
|
305
350
|
if (isDOMElement(value)) {
|
|
306
351
|
return value;
|
|
307
352
|
}
|
|
@@ -347,7 +392,10 @@ const createPageProxy = (target, setPageContext, overriddenPropsRegistry) => {
|
|
|
347
392
|
}
|
|
348
393
|
return proxy2;
|
|
349
394
|
}
|
|
350
|
-
|
|
395
|
+
if (!widget) {
|
|
396
|
+
return void 0;
|
|
397
|
+
}
|
|
398
|
+
const proxy = createWidgetProxy(widget, widgetName, setPageContext, overriddenPropsRegistry);
|
|
351
399
|
widgetProxies.set(widgetName, proxy);
|
|
352
400
|
return proxy;
|
|
353
401
|
},
|
|
@@ -356,24 +404,23 @@ const createPageProxy = (target, setPageContext, overriddenPropsRegistry) => {
|
|
|
356
404
|
return true;
|
|
357
405
|
}
|
|
358
406
|
widgetsTarget[widgetName] = widgetValue;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
}
|
|
407
|
+
const isObjectValue = !!widgetValue && typeof widgetValue === "object";
|
|
408
|
+
const cachedProxy = widgetProxies.get(widgetName);
|
|
409
|
+
const originalTarget = cachedProxy ? originalTargets.get(cachedProxy) : void 0;
|
|
410
|
+
if (originalTarget && isObjectValue) {
|
|
411
|
+
for (const key in widgetValue) {
|
|
412
|
+
const newVal = widgetValue[key];
|
|
413
|
+
const oldVal = originalTarget[key];
|
|
414
|
+
if (oldVal !== newVal) {
|
|
415
|
+
Reflect.defineProperty(originalTarget, key, {
|
|
416
|
+
value: newVal,
|
|
417
|
+
writable: true,
|
|
418
|
+
configurable: true,
|
|
419
|
+
enumerable: true
|
|
420
|
+
});
|
|
374
421
|
}
|
|
375
422
|
}
|
|
376
|
-
} else if (
|
|
423
|
+
} else if (isObjectValue) {
|
|
377
424
|
const proxy = createWidgetProxy(
|
|
378
425
|
widgetValue,
|
|
379
426
|
widgetName,
|
|
@@ -381,6 +428,8 @@ const createPageProxy = (target, setPageContext, overriddenPropsRegistry) => {
|
|
|
381
428
|
overriddenPropsRegistry
|
|
382
429
|
);
|
|
383
430
|
widgetProxies.set(widgetName, proxy);
|
|
431
|
+
} else {
|
|
432
|
+
widgetProxies.delete(widgetName);
|
|
384
433
|
}
|
|
385
434
|
return true;
|
|
386
435
|
}
|
|
@@ -388,15 +437,68 @@ const createPageProxy = (target, setPageContext, overriddenPropsRegistry) => {
|
|
|
388
437
|
pageWidgetProxyCaches.set(widgetsProxy, widgetProxies);
|
|
389
438
|
return widgetsProxy;
|
|
390
439
|
};
|
|
440
|
+
const dataSetRaw = /* @__PURE__ */ new WeakMap();
|
|
391
441
|
const wrapVariableProxy = (variable, path, varName, setPageContext) => {
|
|
392
442
|
if (proxyMap.has(variable)) {
|
|
393
443
|
return variable;
|
|
394
444
|
}
|
|
395
|
-
const
|
|
445
|
+
const dataSetProxies = /* @__PURE__ */ new WeakMap();
|
|
446
|
+
let varProxy;
|
|
447
|
+
const refreshDataSet = () => {
|
|
448
|
+
const dataSet = variable.dataSet;
|
|
449
|
+
varProxy.dataSet = Array.isArray(dataSet) ? [...dataSet] : __spreadValues({}, dataSet);
|
|
450
|
+
};
|
|
451
|
+
const createDataSetProxy = (value, isRootDataSet = false) => {
|
|
452
|
+
if (typeof value !== "object" || value === null || isNonProxyableBuiltin(value)) {
|
|
453
|
+
return value;
|
|
454
|
+
}
|
|
455
|
+
const cached = dataSetProxies.get(value);
|
|
456
|
+
if (cached) return cached;
|
|
457
|
+
const proxy = new Proxy(value, {
|
|
458
|
+
get(target, prop, receiver) {
|
|
459
|
+
const nestedValue = Reflect.get(target, prop, receiver);
|
|
460
|
+
if (Array.isArray(target) && typeof prop === "string" && MUTATING_ARRAY_METHODS.includes(prop) && typeof nestedValue === "function") {
|
|
461
|
+
return (...args) => {
|
|
462
|
+
const mutationTarget = isRootDataSet ? variable.dataSet : target;
|
|
463
|
+
const result = Reflect.get(mutationTarget, prop).apply(mutationTarget, args);
|
|
464
|
+
refreshDataSet();
|
|
465
|
+
return result;
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
return createDataSetProxy(nestedValue);
|
|
469
|
+
},
|
|
470
|
+
set(target, prop, value2) {
|
|
471
|
+
const mutationTarget = isRootDataSet ? variable.dataSet : target;
|
|
472
|
+
if (Reflect.get(mutationTarget, prop) === value2) {
|
|
473
|
+
return true;
|
|
474
|
+
}
|
|
475
|
+
const result = Reflect.set(mutationTarget, prop, value2);
|
|
476
|
+
refreshDataSet();
|
|
477
|
+
return result;
|
|
478
|
+
},
|
|
479
|
+
deleteProperty(target, prop) {
|
|
480
|
+
const result = Reflect.deleteProperty(isRootDataSet ? variable.dataSet : target, prop);
|
|
481
|
+
refreshDataSet();
|
|
482
|
+
return result;
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
dataSetProxies.set(value, proxy);
|
|
486
|
+
dataSetRaw.set(proxy, value);
|
|
487
|
+
return proxy;
|
|
488
|
+
};
|
|
489
|
+
varProxy = new Proxy(variable, {
|
|
490
|
+
get(target, prop, receiver) {
|
|
491
|
+
const value = Reflect.get(target, prop, receiver);
|
|
492
|
+
return prop === "dataSet" ? createDataSetProxy(value, true) : value;
|
|
493
|
+
},
|
|
396
494
|
set(target, prop, value, receiver) {
|
|
397
495
|
if (typeof prop === "symbol") {
|
|
398
496
|
return Reflect.set(target, prop, value, receiver);
|
|
399
497
|
}
|
|
498
|
+
if (prop === "dataSet" && dataSetRaw.has(value)) {
|
|
499
|
+
const raw = dataSetRaw.get(value);
|
|
500
|
+
value = Array.isArray(raw) ? [...raw] : __spreadValues({}, raw);
|
|
501
|
+
}
|
|
400
502
|
const prevVal = Reflect.get(target, prop, receiver);
|
|
401
503
|
const result = Reflect.set(target, prop, value, receiver);
|
|
402
504
|
if (prevVal !== value) {
|
|
@@ -420,8 +522,12 @@ const wrapVariableProxy = (variable, path, varName, setPageContext) => {
|
|
|
420
522
|
return varProxy;
|
|
421
523
|
};
|
|
422
524
|
const createStateProxy = (obj, path = [], setPageContext, overriddenPropsRegistry) => {
|
|
525
|
+
if (isKnownProxy(obj) || objectsBeingProxied.has(obj)) {
|
|
526
|
+
return obj;
|
|
527
|
+
}
|
|
423
528
|
const nestedProxies = /* @__PURE__ */ new Map();
|
|
424
|
-
|
|
529
|
+
objectsBeingProxied.add(obj);
|
|
530
|
+
const proxy = new Proxy(obj, {
|
|
425
531
|
get(target, prop, receiver) {
|
|
426
532
|
if (prop === "eval") {
|
|
427
533
|
return (fn, failOnError = false) => {
|
|
@@ -487,7 +593,7 @@ const createStateProxy = (obj, path = [], setPageContext, overriddenPropsRegistr
|
|
|
487
593
|
if (isDOMElement(value)) {
|
|
488
594
|
return value;
|
|
489
595
|
}
|
|
490
|
-
if (value
|
|
596
|
+
if (isNonProxyableBuiltin(value)) {
|
|
491
597
|
return value;
|
|
492
598
|
}
|
|
493
599
|
if (Array.isArray(value)) {
|
|
@@ -549,6 +655,9 @@ const createStateProxy = (obj, path = [], setPageContext, overriddenPropsRegistr
|
|
|
549
655
|
return true;
|
|
550
656
|
}
|
|
551
657
|
});
|
|
658
|
+
stateProxyMap.set(proxy, true);
|
|
659
|
+
objectsBeingProxied.delete(obj);
|
|
660
|
+
return proxy;
|
|
552
661
|
};
|
|
553
662
|
const getFormFieldEntries = (formfields) => {
|
|
554
663
|
const canonicalKeyByField = /* @__PURE__ */ new Map();
|
|
@@ -606,5 +715,6 @@ export {
|
|
|
606
715
|
createWidgetProxy,
|
|
607
716
|
defineFieldAlias,
|
|
608
717
|
getFormFieldEntries,
|
|
609
|
-
getFormFieldList
|
|
718
|
+
getFormFieldList,
|
|
719
|
+
isNonProxyableBuiltin
|
|
610
720
|
};
|
package/higherOrder/BaseApp.js
CHANGED
|
@@ -79,7 +79,8 @@ const BaseApp = (WrappedComponent, addAppScript, getAppVariables, appInfo = {})
|
|
|
79
79
|
subscribe,
|
|
80
80
|
targetPlatform: "WEB",
|
|
81
81
|
hasOwnObjectProperty,
|
|
82
|
-
formatters
|
|
82
|
+
formatters,
|
|
83
|
+
i18nService
|
|
83
84
|
}), appInfo), i18nServiceActions), i18nService));
|
|
84
85
|
const appProxyRef = useRef(null);
|
|
85
86
|
const sessionFailureRequestsRef = useRef([]);
|
|
@@ -353,7 +354,7 @@ const BaseApp = (WrappedComponent, addAppScript, getAppVariables, appInfo = {})
|
|
|
353
354
|
showTypeLabel: showTypeLabel != null ? showTypeLabel : false
|
|
354
355
|
});
|
|
355
356
|
notificationAction.config.paramProvider = newParams;
|
|
356
|
-
notificationAction.invoke();
|
|
357
|
+
notificationAction.invoke(__spreadValues({ message }, newParams()));
|
|
357
358
|
} else {
|
|
358
359
|
console.warn(
|
|
359
360
|
`The default Action "appNotification" doesn't exist in the app. App notified following error:
|
package/higherOrder/BasePage.js
CHANGED
|
@@ -154,7 +154,8 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
154
154
|
formatMessage,
|
|
155
155
|
overriddenPropsRegistryRef: overriddenPropsRegistryRef.current,
|
|
156
156
|
layoutReady,
|
|
157
|
-
activePageName: componentInfo == null ? void 0 : componentInfo.componentName
|
|
157
|
+
activePageName: componentInfo == null ? void 0 : componentInfo.componentName,
|
|
158
|
+
pageName: componentInfo == null ? void 0 : componentInfo.componentName
|
|
158
159
|
}));
|
|
159
160
|
useActivePageReactivity({
|
|
160
161
|
componentType: componentInfo == null ? void 0 : componentInfo.componentType,
|
|
@@ -259,10 +260,7 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
259
260
|
pageProxyRef.current.Variables = updatedVariables;
|
|
260
261
|
pageProxyRef.current.Actions = updatedActions;
|
|
261
262
|
return __spreadProps(__spreadValues({}, prev), {
|
|
262
|
-
App:
|
|
263
|
-
Variables: appContext.Variables || {},
|
|
264
|
-
Actions: appContext.Actions || {}
|
|
265
|
-
}),
|
|
263
|
+
App: appProxy != null ? appProxy : prev.App,
|
|
266
264
|
Variables: updatedVariables,
|
|
267
265
|
Actions: updatedActions
|
|
268
266
|
});
|
|
@@ -610,11 +608,7 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
610
608
|
const pageName = (appProxy == null ? void 0 : appProxy.activePageName) || "";
|
|
611
609
|
useEffect(() => {
|
|
612
610
|
if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PARTIAL" && pageName) {
|
|
613
|
-
setPageContext((prev) =>
|
|
614
|
-
App: __spreadProps(__spreadValues({}, prev.App), {
|
|
615
|
-
activePageName: pageName
|
|
616
|
-
})
|
|
617
|
-
}));
|
|
611
|
+
setPageContext((prev) => __spreadValues({}, prev));
|
|
618
612
|
}
|
|
619
613
|
}, [pageName]);
|
|
620
614
|
useEffect(() => {
|
package/higherOrder/props.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
3
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -17,7 +15,6 @@ var __spreadValues = (a, b) => {
|
|
|
17
15
|
}
|
|
18
16
|
return a;
|
|
19
17
|
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
18
|
import { useEffect, useRef } from "react";
|
|
22
19
|
import { EVENTEMITTER_METHODS } from "../core/constants/events";
|
|
23
20
|
const resolvePath = (root, path) => path.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], root);
|
|
@@ -41,7 +38,7 @@ const useActivePageReactivity = ({
|
|
|
41
38
|
const next = readValues();
|
|
42
39
|
if (next.some((value, i) => !Object.is(value, snapshotRef.current[i]))) {
|
|
43
40
|
snapshotRef.current = next;
|
|
44
|
-
setPageContext((prev) =>
|
|
41
|
+
setPageContext((prev) => __spreadValues({}, prev));
|
|
45
42
|
}
|
|
46
43
|
};
|
|
47
44
|
EVENTEMITTER_METHODS.ACTIVE_PAGE_SYNC_ON(onActivePageChange);
|
|
@@ -31,7 +31,7 @@ var __objRest = (source, exclude) => {
|
|
|
31
31
|
return target;
|
|
32
32
|
};
|
|
33
33
|
import { createElement } from "react";
|
|
34
|
-
import React, { useEffect, useMemo, useCallback } from "react";
|
|
34
|
+
import React, { useEffect, useMemo, useCallback, useRef } from "react";
|
|
35
35
|
import isEqual from "lodash-es/isEqual";
|
|
36
36
|
import { useDeviceVisibility } from "../hooks/useDeviceVisibility";
|
|
37
37
|
import { usePageContext } from "../context/WidgetProvider";
|
|
@@ -40,11 +40,19 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
40
40
|
const WithBaseComponent = (props) => {
|
|
41
41
|
var _b, _c, _d;
|
|
42
42
|
const _a = props, { show = true, deferload, standalone = false } = _a, rest = __objRest(_a, ["show", "deferload", "standalone"]);
|
|
43
|
+
const previousDataValueRef = useRef(props.datavalue);
|
|
43
44
|
const name = props["item-id"] || props.name;
|
|
44
45
|
const { pageContext, updateWidgetState, destroy, proxy } = usePageContext(standalone);
|
|
45
46
|
const { isHidden } = useDeviceVisibility(props.showindevice || ["all"]);
|
|
46
47
|
const componentWidgetId = useMemo(() => props == null ? void 0 : props["data-widget-id"], [props == null ? void 0 : props["data-widget-id"]]);
|
|
47
48
|
const widgetFromContext = name ? (_b = pageContext == null ? void 0 : pageContext.Widgets) == null ? void 0 : _b[name] : void 0;
|
|
49
|
+
const previousDataValueHasChanged = useMemo(() => {
|
|
50
|
+
if (previousDataValueRef.current != props.datavalue) {
|
|
51
|
+
previousDataValueRef.current = props.datavalue;
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}, [props.datavalue]);
|
|
48
56
|
useEffect(() => {
|
|
49
57
|
if (name && (props == null ? void 0 : props.iswidget) !== "false" && (pageContext == null ? void 0 : pageContext.Widgets)) {
|
|
50
58
|
const widget = (widgetFromContext == null ? void 0 : widgetFromContext["data-widget-id"]) === componentWidgetId ? widgetFromContext : {};
|
|
@@ -67,7 +75,7 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
67
75
|
let mergedState = __spreadValues({}, props);
|
|
68
76
|
const registry = pageContext == null ? void 0 : pageContext.overriddenPropsRegistry;
|
|
69
77
|
const widgetDatavalue = widget.datavalue;
|
|
70
|
-
const datavalue = widgetDatavalue != null ? widgetDatavalue : props.datavalue;
|
|
78
|
+
const datavalue = props["item-id"] || previousDataValueHasChanged ? props.datavalue : widgetDatavalue != null ? widgetDatavalue : props.datavalue;
|
|
71
79
|
if (shouldMergeFromContext && (registry == null ? void 0 : registry.isWidgetOverridden(name, componentWidgetId || "")) && !props.formfield) {
|
|
72
80
|
const widgetOverrides = registry == null ? void 0 : registry.getWidgetOverrides(name, componentWidgetId || "");
|
|
73
81
|
if (widgetOverrides) {
|
|
@@ -141,10 +149,11 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
141
149
|
const computedClassName = useMemo(() => {
|
|
142
150
|
return [
|
|
143
151
|
props.className,
|
|
152
|
+
mergedProps.class,
|
|
144
153
|
props.conditionalclass,
|
|
145
154
|
props.animation && `animated ${props.animation}`
|
|
146
155
|
].filter(Boolean).join(" ");
|
|
147
|
-
}, [props.className, props.conditionalclass, props.animation]);
|
|
156
|
+
}, [props.className, mergedProps.class, props.conditionalclass, props.animation]);
|
|
148
157
|
if (isHidden) return null;
|
|
149
158
|
const isDeferLoad = deferload === true;
|
|
150
159
|
const showValue = ((_c = mergedProps == null ? void 0 : mergedProps.show) == null ? void 0 : _c.toString()) !== "false";
|
package/hooks/useHttp.d.ts
CHANGED
|
@@ -22,12 +22,21 @@ declare class ModernHttpService implements HttpClientService {
|
|
|
22
22
|
* Get the currently stored context
|
|
23
23
|
* @returns The stored context object
|
|
24
24
|
*/
|
|
25
|
+
/**
|
|
26
|
+
* The axios instance carrying every interceptor setupInterceptors() attaches.
|
|
27
|
+
*
|
|
28
|
+
* For module-scope callers that build their own request config and cannot use the useHttp()
|
|
29
|
+
* hook — the generated service classes in an app's `services/` folder. Without this they had to
|
|
30
|
+
* own a separate instance and re-implement each interceptor, which drifted (the app's
|
|
31
|
+
* onBeforeServiceCall stopped firing). Prefer send()/sendCall() for the normal variable flow.
|
|
32
|
+
*/
|
|
33
|
+
getAxiosInstance(): AxiosInstance;
|
|
25
34
|
getContext(): any;
|
|
26
35
|
getAppManager(): any;
|
|
27
36
|
private handleSessionFailure;
|
|
28
37
|
private setupInterceptors;
|
|
29
|
-
send(options: any, variable: any): Promise<any>;
|
|
30
|
-
sendCall(requestParams: any, variable: any): Promise<any>;
|
|
38
|
+
send(options: any, variable: any, params?: any): Promise<any>;
|
|
39
|
+
sendCall(requestParams: any, variable: any, params?: any): Promise<any>;
|
|
31
40
|
setLocale(locale: string): void;
|
|
32
41
|
getLocale(): any;
|
|
33
42
|
cancel(variable: any): void;
|
|
@@ -46,13 +55,14 @@ export declare const useHttp: () => HttpContextType;
|
|
|
46
55
|
export declare const getHttpService: () => ModernHttpService;
|
|
47
56
|
export declare const httpService: {
|
|
48
57
|
readonly instance: ModernHttpService;
|
|
49
|
-
send: (options: any, variable: any) => Promise<any>;
|
|
50
|
-
sendCall: (requestParams: any, variable: any) => Promise<any>;
|
|
58
|
+
send: (options: any, variable: any, params?: any) => Promise<any>;
|
|
59
|
+
sendCall: (requestParams: any, variable: any, params?: any) => Promise<any>;
|
|
51
60
|
cancel: (variable: any) => void;
|
|
52
61
|
uploadFile: (url: string, data: any, variable: any, options?: any) => Promise<any>;
|
|
53
62
|
setLocale: (locale: string) => void;
|
|
54
63
|
getLocale: () => any;
|
|
55
64
|
setContext: (context: any) => void;
|
|
56
65
|
getContext: () => any;
|
|
66
|
+
getAxiosInstance: () => AxiosInstance;
|
|
57
67
|
};
|
|
58
68
|
export default httpService;
|
package/hooks/useHttp.js
CHANGED
|
@@ -28,12 +28,16 @@ import { createContext, useContext, useRef, useMemo } from "react";
|
|
|
28
28
|
import { WS_CONSTANTS } from "../variables/constants";
|
|
29
29
|
import { store } from "../store";
|
|
30
30
|
import { XSRF_HEADER_NAME } from "../store/slices/authSlice";
|
|
31
|
+
import { getActiveRoutingBasePath, PREVIEW_ROUTING_BASEPATH } from "../core/constants";
|
|
31
32
|
class ModernHttpService {
|
|
32
33
|
constructor(baseURL = "") {
|
|
33
34
|
__publicField(this, "axiosInstance");
|
|
34
35
|
__publicField(this, "_context", null);
|
|
35
36
|
__publicField(this, "localeObject", store.getState().i18n.appLocale);
|
|
36
|
-
this.axiosInstance = axios.create({
|
|
37
|
+
this.axiosInstance = axios.create({
|
|
38
|
+
baseURL,
|
|
39
|
+
formSerializer: { indexes: null }
|
|
40
|
+
});
|
|
37
41
|
this.setupInterceptors();
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
@@ -47,6 +51,17 @@ class ModernHttpService {
|
|
|
47
51
|
* Get the currently stored context
|
|
48
52
|
* @returns The stored context object
|
|
49
53
|
*/
|
|
54
|
+
/**
|
|
55
|
+
* The axios instance carrying every interceptor setupInterceptors() attaches.
|
|
56
|
+
*
|
|
57
|
+
* For module-scope callers that build their own request config and cannot use the useHttp()
|
|
58
|
+
* hook — the generated service classes in an app's `services/` folder. Without this they had to
|
|
59
|
+
* own a separate instance and re-implement each interceptor, which drifted (the app's
|
|
60
|
+
* onBeforeServiceCall stopped firing). Prefer send()/sendCall() for the normal variable flow.
|
|
61
|
+
*/
|
|
62
|
+
getAxiosInstance() {
|
|
63
|
+
return this.axiosInstance;
|
|
64
|
+
}
|
|
50
65
|
getContext() {
|
|
51
66
|
return this._context;
|
|
52
67
|
}
|
|
@@ -156,8 +171,8 @@ class ModernHttpService {
|
|
|
156
171
|
}
|
|
157
172
|
);
|
|
158
173
|
}
|
|
159
|
-
async send(options, variable) {
|
|
160
|
-
var _a, _b, _c, _d;
|
|
174
|
+
async send(options, variable, params) {
|
|
175
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
161
176
|
const serviceInfo = variable.serviceInfo;
|
|
162
177
|
let headers = new AxiosHeaders(options.headers);
|
|
163
178
|
let requestBody = options.data;
|
|
@@ -186,12 +201,19 @@ class ModernHttpService {
|
|
|
186
201
|
if (!options.isDirectCall) {
|
|
187
202
|
headers = headers.set("X-Requested-With", "XMLHttpRequest");
|
|
188
203
|
}
|
|
204
|
+
const plainHeaders = {};
|
|
205
|
+
const rawHeaders = typeof headers.toJSON === "function" ? headers.toJSON() : headers;
|
|
206
|
+
if (rawHeaders && typeof rawHeaders === "object") {
|
|
207
|
+
for (const [k, v] of Object.entries(rawHeaders)) {
|
|
208
|
+
if (v != null && typeof v !== "function") plainHeaders[k] = String(v);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
189
211
|
const methodType = ((serviceInfo == null ? void 0 : serviceInfo.methodType) || options.method || "get").toLowerCase();
|
|
190
212
|
const isNonDataMethod = WS_CONSTANTS.NON_DATA_AXIOS_METHODS.indexOf(methodType.toUpperCase()) > -1;
|
|
191
213
|
const axiosConfig = __spreadProps(__spreadValues({
|
|
192
214
|
url: url.endsWith("/") ? url.slice(0, -1) : url,
|
|
193
215
|
method: methodType,
|
|
194
|
-
headers,
|
|
216
|
+
headers: plainHeaders,
|
|
195
217
|
cancelToken: variable.cancelTokenSource.token,
|
|
196
218
|
withCredentials: (options == null ? void 0 : options.withCredentials) !== false
|
|
197
219
|
}, isNonDataMethod ? {} : { data: requestBody || {} }), {
|
|
@@ -200,7 +222,8 @@ class ModernHttpService {
|
|
|
200
222
|
owner: variable.config._context.name,
|
|
201
223
|
operation: variable.operation
|
|
202
224
|
// Add operation to the context
|
|
203
|
-
}
|
|
225
|
+
},
|
|
226
|
+
__axiosInstance: this.axiosInstance
|
|
204
227
|
});
|
|
205
228
|
if (variable.operation === "getDownloadFile" || (serviceInfo == null ? void 0 : serviceInfo.operationId) === "FileController_getDownloadFile") {
|
|
206
229
|
axiosConfig.responseType = "blob";
|
|
@@ -209,7 +232,21 @@ class ModernHttpService {
|
|
|
209
232
|
axiosConfig.onUploadProgress = options.onUploadProgress;
|
|
210
233
|
}
|
|
211
234
|
try {
|
|
212
|
-
const
|
|
235
|
+
const isPreview = getActiveRoutingBasePath() === PREVIEW_ROUTING_BASEPATH;
|
|
236
|
+
let response;
|
|
237
|
+
if (isPreview || variable.invokeHttp == void 0) {
|
|
238
|
+
response = await this.axiosInstance.request(axiosConfig);
|
|
239
|
+
} else {
|
|
240
|
+
response = await variable.invokeHttp(
|
|
241
|
+
__spreadProps(__spreadValues({}, axiosConfig), { serviceInfo }),
|
|
242
|
+
(_g = (_f = (_e = params != null ? params : variable.resolvedParams) != null ? _e : variable.lastInvokedParams) != null ? _f : variable.inputFields) != null ? _g : variable.params,
|
|
243
|
+
// CrudVariable only: it sets lastInvokedOperation per call. Not `variable.operation`
|
|
244
|
+
// (for a CrudVariable that is the entity name, "Loan") and not axiosConfig.method
|
|
245
|
+
// (that is the HTTP verb, "get") — either hits the generated switch's default and
|
|
246
|
+
// throws. The generated glue defaults an undefined value to its own operationType.
|
|
247
|
+
variable.lastInvokedOperation
|
|
248
|
+
);
|
|
249
|
+
}
|
|
213
250
|
if (variable.operation === "getDownloadFile" || (serviceInfo == null ? void 0 : serviceInfo.operationId) === "FileController_getDownloadFile") {
|
|
214
251
|
return this.handleFileDownload(response, options, variable);
|
|
215
252
|
}
|
|
@@ -218,9 +255,9 @@ class ModernHttpService {
|
|
|
218
255
|
throw error.response || error;
|
|
219
256
|
}
|
|
220
257
|
}
|
|
221
|
-
async sendCall(requestParams, variable) {
|
|
258
|
+
async sendCall(requestParams, variable, params) {
|
|
222
259
|
try {
|
|
223
|
-
const response = await this.send(requestParams, variable);
|
|
260
|
+
const response = await this.send(requestParams, variable, params);
|
|
224
261
|
return response;
|
|
225
262
|
} catch (error) {
|
|
226
263
|
throw error;
|
|
@@ -342,7 +379,8 @@ const httpService = {
|
|
|
342
379
|
setLocale: (...args) => getHttpService().setLocale(...args),
|
|
343
380
|
getLocale: () => getHttpService().getLocale(),
|
|
344
381
|
setContext: (...args) => getHttpService().setContext(...args),
|
|
345
|
-
getContext: () => getHttpService().getContext()
|
|
382
|
+
getContext: () => getHttpService().getContext(),
|
|
383
|
+
getAxiosInstance: () => getHttpService().getAxiosInstance()
|
|
346
384
|
};
|
|
347
385
|
var useHttp_default = httpService;
|
|
348
386
|
export {
|