@wavemaker-ai/react-runtime 1.0.0-rc.647712 → 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/basic/richtexteditor/index.d.ts +1 -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/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/index.js +5 -2
- package/components/container/tabs/index.js +5 -3
- package/components/container/wizard/index.js +36 -3
- package/components/container/wizard/props.d.ts +2 -2
- package/components/data/form/dynamic-fields/WmxDynamicFormField.js +9 -23
- 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 +1 -1
- package/components/data/form/form-field/index.js +6 -3
- package/components/data/form/form-field/props.d.ts +1 -0
- package/components/data/list/components/ListItemWithTemplate.js +1 -1
- package/components/data/list/index.js +1 -1
- package/components/data/table/components/EditableCell.js +47 -24
- package/components/data/table/components/FieldValidationError.js +1 -1
- package/components/data/table/components/TableHeader.js +9 -3
- package/components/data/table/hooks/useFormWidget.js +11 -0
- package/components/data/table/hooks/useRowSelection.js +58 -1
- 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.js +68 -32
- package/components/data/table/props.d.ts +42 -23
- package/components/data/table/utils/buildSelectionColumns.js +3 -3
- 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/index.d.ts +4 -12
- package/components/data/table/utils/index.js +13 -77
- package/components/data/table/utils/selectionUtils.js +13 -5
- package/components/input/chips/index.d.ts +1 -0
- package/components/input/color-picker/index.d.ts +1 -0
- package/components/input/currency/index.d.ts +1 -0
- package/components/input/default/checkbox/index.d.ts +1 -0
- package/components/input/default/checkboxset/index.d.ts +1 -0
- package/components/input/default/radioset/index.d.ts +1 -0
- package/components/input/default/switch/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.js +10 -2
- package/components/input/number/index.d.ts +1 -0
- package/components/input/rating/index.d.ts +1 -0
- package/components/input/select/index.d.ts +1 -0
- package/components/input/slider/index.d.ts +1 -0
- package/components/input/text/index.d.ts +1 -0
- package/components/input/textarea/index.d.ts +1 -0
- package/components/input/upload/index.d.ts +1 -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.js +32 -7
- package/components/navigation/menu/index.js +6 -2
- package/components/page/index.js +60 -19
- package/components/page/page-context.d.ts +4 -0
- package/core/proxy-service.js +86 -19
- package/higherOrder/BaseApp.js +1 -1
- package/higherOrder/BasePage.js +2 -1
- package/higherOrder/withBaseWrapper.js +10 -2
- package/hooks/useHttp.d.ts +14 -4
- package/hooks/useHttp.js +47 -9
- package/package-lock.json +314 -308
- package/package.json +3 -3
- package/runtime-dynamic/App.js +21 -2
- package/runtime-dynamic/app-initializer.js +8 -1
- package/runtime-dynamic/factories/dynamic-component.js +4 -3
- package/runtime-dynamic/main.d.ts +1 -0
- package/runtime-dynamic/main.js +9 -1
- 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/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/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
|
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { VariableEvents, isStaticParamVariable } from "./base-variable";
|
|
5
|
+
import { resolveOperationParams } from "./operation-params";
|
|
5
6
|
import { forEach, isEmpty, isEqual, isNumber, isObject, isString, merge } from "lodash-es";
|
|
6
7
|
import { deepCopy } from "../core/util";
|
|
7
8
|
import { ServiceVariable as _ServiceVariable } from "@wavemaker-ai/variables";
|
|
@@ -73,7 +74,8 @@ class ServiceVariable extends _ServiceVariable {
|
|
|
73
74
|
},
|
|
74
75
|
onBeforeDatasetReady: (context, args) => {
|
|
75
76
|
return config.onBeforeDatasetReady && config.onBeforeDatasetReady(args.variable, args.data, args.options);
|
|
76
|
-
}
|
|
77
|
+
},
|
|
78
|
+
invokeHttp: (config == null ? void 0 : config.invokeHttp) || void 0
|
|
77
79
|
};
|
|
78
80
|
super(variableConfig);
|
|
79
81
|
this.config = config;
|
|
@@ -82,6 +84,14 @@ class ServiceVariable extends _ServiceVariable {
|
|
|
82
84
|
__publicField(this, "initialized", false);
|
|
83
85
|
__publicField(this, "params");
|
|
84
86
|
__publicField(this, "lastInvokedParams");
|
|
87
|
+
/**
|
|
88
|
+
* The by-name params a generated invokeHttp receives — resolved from the operation's declared
|
|
89
|
+
* parameters, so the pagination defaults the manager applies internally are present. Kept
|
|
90
|
+
* separate from lastInvokedParams, which invokeOnParamChange() compares against the RAW provider
|
|
91
|
+
* values: adding `page`/`size` to that snapshot would make every comparison unequal and
|
|
92
|
+
* re-invoke in a loop.
|
|
93
|
+
*/
|
|
94
|
+
__publicField(this, "resolvedParams");
|
|
85
95
|
__publicField(this, "dateFormatter");
|
|
86
96
|
__publicField(this, "lastParams");
|
|
87
97
|
__publicField(this, "lastParamProviderValues");
|
|
@@ -182,7 +192,7 @@ class ServiceVariable extends _ServiceVariable {
|
|
|
182
192
|
console.log("called in onDataUpdated");
|
|
183
193
|
}
|
|
184
194
|
invoke(options, onSuccess, onError) {
|
|
185
|
-
var _a;
|
|
195
|
+
var _a, _b, _c;
|
|
186
196
|
let inputFields = merge({}, this.config.paramProvider(), this.dataBinding, this.params);
|
|
187
197
|
if (options) {
|
|
188
198
|
const overrides = (_a = options.inputFields) != null ? _a : options;
|
|
@@ -204,6 +214,15 @@ class ServiceVariable extends _ServiceVariable {
|
|
|
204
214
|
if (!this.serviceInfo) {
|
|
205
215
|
console.error(`Service Info is missing for (${this.name}) variable.`);
|
|
206
216
|
}
|
|
217
|
+
this.resolvedParams = resolveOperationParams({
|
|
218
|
+
parameters: (_b = this.serviceInfo) == null ? void 0 : _b.parameters,
|
|
219
|
+
inputFields,
|
|
220
|
+
options,
|
|
221
|
+
config: this.config,
|
|
222
|
+
// ServiceVariableUtils' isBodyTypeQueryOrProcedure
|
|
223
|
+
isBodyTypeQueryOrProcedure: ["QueryExecution", "ProcedureExecution"].includes(this.config.controller) && ["put", "post"].includes(this.config.operationType),
|
|
224
|
+
definitions: (_c = this.serviceInfo) == null ? void 0 : _c.definitions
|
|
225
|
+
});
|
|
207
226
|
return super.invoke(options, onSuccess, onError);
|
|
208
227
|
}
|
|
209
228
|
setInput(key, val, options) {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { WmTableColumnProps, FieldValidationState } from "../props";
|
|
2
|
-
/**
|
|
3
|
-
* Validates a single field and updates validation state
|
|
4
|
-
*/
|
|
5
|
-
export declare const validateField: (rowId: string, fieldName: string, value: any, column: WmTableColumnProps | undefined, validationState: FieldValidationState) => boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Resets validation state for specific context
|
|
8
|
-
*/
|
|
9
|
-
export declare const resetValidationState: (context: "editing" | "new-row" | "all" | undefined, editingRowId: string | null, validationState: FieldValidationState) => void;
|
|
10
|
-
/**
|
|
11
|
-
* Updates validation errors for fields based on validation results
|
|
12
|
-
*/
|
|
13
|
-
export declare const updateValidationErrors: (validationResult: any, relevantFieldRefs: Record<string, HTMLElement | null>, validationState: FieldValidationState) => void;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { forEach, entries, keys } from "lodash-es";
|
|
2
|
-
const validateField = (rowId, fieldName, value, column, validationState) => {
|
|
3
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4
|
-
const fieldKey = `${rowId}_${fieldName}`;
|
|
5
|
-
const { fieldRefs, fieldValidationErrors, cellUpdateCallbacks } = validationState;
|
|
6
|
-
if (!(column == null ? void 0 : column.required)) return true;
|
|
7
|
-
if ((column == null ? void 0 : column.required) && (value === void 0 || value === null || value === "")) {
|
|
8
|
-
fieldValidationErrors.current[fieldKey] = true;
|
|
9
|
-
(_b = (_a = cellUpdateCallbacks.current)[fieldKey]) == null ? void 0 : _b.call(_a);
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
const fieldElement = fieldRefs.current[fieldKey];
|
|
13
|
-
if (fieldElement) {
|
|
14
|
-
const input = fieldElement.querySelector("input, textarea, select");
|
|
15
|
-
if (input && !input.validity.valid) {
|
|
16
|
-
fieldValidationErrors.current[fieldKey] = true;
|
|
17
|
-
(_d = (_c = cellUpdateCallbacks.current)[fieldKey]) == null ? void 0 : _d.call(_c);
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
fieldValidationErrors.current[fieldKey] = false;
|
|
22
|
-
(_f = (_e = cellUpdateCallbacks.current)[fieldKey]) == null ? void 0 : _f.call(_e);
|
|
23
|
-
return true;
|
|
24
|
-
};
|
|
25
|
-
const resetValidationState = (context, editingRowId, validationState) => {
|
|
26
|
-
const { fieldRefs, fieldValidationErrors, cellUpdateCallbacks } = validationState;
|
|
27
|
-
if (context === "editing" && editingRowId) {
|
|
28
|
-
forEach(keys(fieldRefs.current), (key) => {
|
|
29
|
-
if (key.startsWith(`${editingRowId}_`)) {
|
|
30
|
-
delete fieldRefs.current[key];
|
|
31
|
-
delete fieldValidationErrors.current[key];
|
|
32
|
-
delete cellUpdateCallbacks.current[key];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
} else if (context === "new-row") {
|
|
36
|
-
forEach(keys(fieldRefs.current), (key) => {
|
|
37
|
-
if (key.startsWith("new-row_")) {
|
|
38
|
-
delete fieldRefs.current[key];
|
|
39
|
-
delete fieldValidationErrors.current[key];
|
|
40
|
-
delete cellUpdateCallbacks.current[key];
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
} else {
|
|
44
|
-
forEach(keys(fieldRefs.current), (key) => {
|
|
45
|
-
delete fieldRefs.current[key];
|
|
46
|
-
});
|
|
47
|
-
fieldValidationErrors.current = {};
|
|
48
|
-
cellUpdateCallbacks.current = {};
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const updateValidationErrors = (validationResult, relevantFieldRefs, validationState) => {
|
|
52
|
-
const { fieldValidationErrors, cellUpdateCallbacks } = validationState;
|
|
53
|
-
const errors = {};
|
|
54
|
-
forEach(keys(relevantFieldRefs), (fieldKey) => {
|
|
55
|
-
errors[fieldKey] = false;
|
|
56
|
-
});
|
|
57
|
-
if (validationResult.invalidFieldKeys && validationResult.invalidFieldKeys.length > 0) {
|
|
58
|
-
forEach(validationResult.invalidFieldKeys, (fieldKey) => {
|
|
59
|
-
errors[fieldKey] = true;
|
|
60
|
-
});
|
|
61
|
-
} else {
|
|
62
|
-
validationResult.invalidElements.forEach((invalidElement) => {
|
|
63
|
-
forEach(entries(relevantFieldRefs), ([fieldKey, fieldElement]) => {
|
|
64
|
-
if (fieldElement === invalidElement || (fieldElement == null ? void 0 : fieldElement.contains(invalidElement))) {
|
|
65
|
-
errors[fieldKey] = true;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
forEach(entries(errors), ([fieldKey, hasError]) => {
|
|
71
|
-
var _a, _b;
|
|
72
|
-
if (fieldValidationErrors.current[fieldKey] !== hasError) {
|
|
73
|
-
fieldValidationErrors.current[fieldKey] = hasError;
|
|
74
|
-
(_b = (_a = cellUpdateCallbacks.current)[fieldKey]) == null ? void 0 : _b.call(_a);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
export {
|
|
79
|
-
resetValidationState,
|
|
80
|
-
updateValidationErrors,
|
|
81
|
-
validateField
|
|
82
|
-
};
|