@wavemaker/react-runtime 11.14.3-rc.6401 → 11.14.4-rc.647538
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/actions/navigation-action.js +3 -5
- package/actions/notification-action.js +3 -6
- package/components/basic/anchor/index.js +7 -6
- package/components/basic/label/index.js +2 -2
- package/components/basic/search/index.js +3 -7
- package/components/chart/components/barColumnChart/index.js +4 -2
- package/components/chart/components/pieDonutChart/index.js +1 -3
- package/components/chart/index.js +39 -72
- package/components/chart/utils.js +12 -23
- package/components/container/index.js +7 -6
- package/components/container/panel/components/panel-header/index.js +2 -3
- package/components/container/panel/index.js +9 -13
- package/components/container/tabs/index.js +0 -1
- package/components/container/tabs/tab-pane/index.js +3 -39
- package/components/container/wizard/index.js +57 -187
- package/components/container/wizard/utils.js +1 -1
- package/components/container/wizard/wizard-action/index.js +4 -9
- package/components/container/wizard/wizard-step/index.js +8 -21
- package/components/data/form/base-form/index.js +11 -51
- package/components/data/form/form-controller/withFormController.js +10 -7
- package/components/data/list/components/GroupedListItems.js +1 -5
- package/components/data/list/components/ListItemWithTemplate.js +1 -4
- package/components/data/list/hooks/useListEffects.js +14 -34
- package/components/data/list/hooks/useListEventHandlers.js +2 -18
- package/components/data/list/hooks/useListState.js +2 -15
- package/components/data/list/index.js +0 -1
- package/components/data/list/utils/list-helpers.js +5 -3
- package/components/data/list/utils/list-widget-methods.js +1 -1
- package/components/data/live-filter/index.js +5 -6
- package/components/data/live-form/index.js +14 -24
- package/components/data/table/components/TableBody.js +21 -5
- package/components/data/table/components/TableHeader.js +1 -5
- package/components/data/table/index.js +5 -21
- package/components/data/utils/field-data-utils.js +1 -1
- package/components/dialogs/index.js +16 -14
- package/components/input/currency/index.js +7 -11
- package/components/input/default/checkbox/index.js +3 -2
- package/components/input/default/checkboxset/index.js +22 -2
- package/components/input/default/radioset/index.js +4 -5
- package/components/input/epoch/datetime/index.js +2 -6
- package/components/input/epoch/time/index.js +1 -2
- package/components/input/number/index.js +2 -2
- package/components/input/text/util.js +0 -2
- package/components/input/textarea/index.js +24 -22
- package/components/layout/leftnav/index.js +1 -1
- package/components/navbar/nav/index.js +7 -97
- package/components/navbar/nav-item/index.js +2 -5
- package/components/navigation/menu/index.js +12 -73
- package/components/navigation/popover/index.js +0 -2
- package/components/page/error-boundary/index.js +0 -1
- package/components/prefab/container/index.js +3 -10
- package/context/LocalizationProvider.js +0 -1
- package/context/PrefabContext.js +13 -138
- package/context/WidgetProvider.js +2 -2
- package/core/constants/events.js +6 -12
- package/core/constants/index.js +11 -6
- package/core/formatter/number-formatters.js +1 -1
- package/core/proxy-service.js +36 -72
- package/core/util/utils.js +4 -23
- package/higherOrder/BaseApp.js +18 -60
- package/higherOrder/BasePage.js +77 -99
- package/higherOrder/BasePrefab.js +5 -13
- package/higherOrder/withBaseWrapper.js +3 -3
- package/hooks/useDataSourceSubscription.js +1 -1
- package/hooks/useHttp.js +13 -20
- package/mui-config/theme.js +0 -3
- package/package-lock.json +747 -704
- package/package.json +3 -3
- package/store/index.js +1 -5
- package/variables/service-variable.js +14 -17
- package/components/chart/hooks/useBarYAxisExtras.js +0 -52
- package/components/chart/hooks/useXAxisConfig.js +0 -98
- package/utils/lib-error-skipper.js +0 -196
|
@@ -20,7 +20,6 @@ var _wizardStep = _interopRequireDefault(require("./wizard-step"));
|
|
|
20
20
|
var _WizardStep = require("./components/WizardStep");
|
|
21
21
|
var _form = _interopRequireDefault(require("@wavemaker/react-runtime/components/data/form"));
|
|
22
22
|
var _formUtils = require("@wavemaker/react-runtime/utils/form-utils");
|
|
23
|
-
var _isEqual = _interopRequireDefault(require("lodash-es/isEqual"));
|
|
24
23
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
25
24
|
var __jsx = _react["default"].createElement;
|
|
26
25
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -89,10 +88,6 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
89
88
|
isInitialized = _useState3[0],
|
|
90
89
|
setIsInitialized = _useState3[1];
|
|
91
90
|
var formRefs = (0, _react.useRef)({});
|
|
92
|
-
var navIndexRef = (0, _react.useRef)(-1);
|
|
93
|
-
var _useState4 = (0, _react.useState)(false),
|
|
94
|
-
formReady = _useState4[0],
|
|
95
|
-
setFormReady = _useState4[1];
|
|
96
91
|
|
|
97
92
|
// Create dynamic steps callback
|
|
98
93
|
var createDynamicSteps = (0, _react.useCallback)(function (datasetItems) {
|
|
@@ -137,11 +132,6 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
137
132
|
return step.name === currentStep.name;
|
|
138
133
|
});
|
|
139
134
|
}, [currentStep, visibleSteps]);
|
|
140
|
-
|
|
141
|
-
// Sync navigation ref whenever the visible current index changes
|
|
142
|
-
(0, _react.useEffect)(function () {
|
|
143
|
-
navIndexRef.current = currentStepIndex;
|
|
144
|
-
}, [currentStepIndex]);
|
|
145
135
|
var _hasNextStep = (0, _react.useMemo)(function () {
|
|
146
136
|
return currentStepIndex < visibleSteps.length - 1;
|
|
147
137
|
}, [currentStepIndex, visibleSteps]);
|
|
@@ -151,41 +141,9 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
151
141
|
var showDoneBtn = (0, _react.useMemo)(function () {
|
|
152
142
|
return !_hasNextStep && (currentStep === null || currentStep === void 0 ? void 0 : currentStep.enableDone) !== false;
|
|
153
143
|
}, [_hasNextStep, currentStep]);
|
|
154
|
-
var
|
|
155
|
-
isStepValid =
|
|
156
|
-
setIsStepValid =
|
|
157
|
-
var _useState6 = (0, _react.useState)(""),
|
|
158
|
-
formValiditySignature = _useState6[0],
|
|
159
|
-
setFormValiditySignature = _useState6[1];
|
|
160
|
-
(0, _react.useEffect)(function () {
|
|
161
|
-
var unbind = null;
|
|
162
|
-
var bindEmitEvent = function bindEmitEvent() {
|
|
163
|
-
var _formRefs$current;
|
|
164
|
-
var stepName = currentStep === null || currentStep === void 0 ? void 0 : currentStep.name;
|
|
165
|
-
if (!stepName) return false;
|
|
166
|
-
var formElOrList = (_formRefs$current = formRefs.current) === null || _formRefs$current === void 0 ? void 0 : _formRefs$current[stepName];
|
|
167
|
-
var forms = formElOrList ? Array.isArray(formElOrList) ? formElOrList : [formElOrList] : [];
|
|
168
|
-
if (forms.length === 0) return false;
|
|
169
|
-
var onValidity = function onValidity(e) {
|
|
170
|
-
var detail = e.detail;
|
|
171
|
-
var isValid = (detail === null || detail === void 0 ? void 0 : detail.isValid) !== false;
|
|
172
|
-
setFormValiditySignature(isValid ? "1" : "0");
|
|
173
|
-
};
|
|
174
|
-
forms.forEach(function (f) {
|
|
175
|
-
return f.addEventListener("wm:form-validity", onValidity);
|
|
176
|
-
});
|
|
177
|
-
unbind = function unbind() {
|
|
178
|
-
forms.forEach(function (f) {
|
|
179
|
-
return f.removeEventListener("wm:form-validity", onValidity);
|
|
180
|
-
});
|
|
181
|
-
};
|
|
182
|
-
return true;
|
|
183
|
-
};
|
|
184
|
-
bindEmitEvent();
|
|
185
|
-
return function () {
|
|
186
|
-
if (unbind) unbind();
|
|
187
|
-
};
|
|
188
|
-
}, [currentStep, formReady]);
|
|
144
|
+
var _useState4 = (0, _react.useState)(true),
|
|
145
|
+
isStepValid = _useState4[0],
|
|
146
|
+
setIsStepValid = _useState4[1];
|
|
189
147
|
(0, _react.useEffect)(function () {
|
|
190
148
|
var validateStep = /*#__PURE__*/function () {
|
|
191
149
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
@@ -241,7 +199,7 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
241
199
|
};
|
|
242
200
|
}();
|
|
243
201
|
validateStep();
|
|
244
|
-
}, [currentStep
|
|
202
|
+
}, [currentStep]);
|
|
245
203
|
var enableNext = (0, _react.useMemo)(function () {
|
|
246
204
|
return enablenext || (currentStep === null || currentStep === void 0 ? void 0 : currentStep.enableNext) !== false && (currentStep === null || currentStep === void 0 ? void 0 : currentStep.isValid) !== false && isStepValid;
|
|
247
205
|
}, [enablenext, currentStep, isStepValid]);
|
|
@@ -315,143 +273,108 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
315
273
|
// Navigation functions
|
|
316
274
|
var _next = (0, _react.useCallback)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
317
275
|
var eventName,
|
|
318
|
-
|
|
319
|
-
fromStep,
|
|
320
|
-
nextStep,
|
|
321
|
-
nextIndex,
|
|
322
|
-
_fromStep$onSkip,
|
|
276
|
+
_currentStep$onSkip,
|
|
323
277
|
response,
|
|
324
|
-
|
|
278
|
+
_currentStep$onNext,
|
|
325
279
|
_response,
|
|
326
280
|
_args2 = arguments;
|
|
327
281
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
328
282
|
while (1) switch (_context2.prev = _context2.next) {
|
|
329
283
|
case 0:
|
|
330
284
|
eventName = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : "next";
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
if (fromStep) {
|
|
334
|
-
_context2.next = 5;
|
|
285
|
+
if (currentStep) {
|
|
286
|
+
_context2.next = 3;
|
|
335
287
|
break;
|
|
336
288
|
}
|
|
337
289
|
return _context2.abrupt("return");
|
|
338
|
-
case
|
|
339
|
-
nextStep = (0, _utils.getNextValidStep)(fromIndex + 1, visibleSteps);
|
|
340
|
-
if (nextStep) {
|
|
341
|
-
_context2.next = 8;
|
|
342
|
-
break;
|
|
343
|
-
}
|
|
344
|
-
return _context2.abrupt("return");
|
|
345
|
-
case 8:
|
|
346
|
-
nextIndex = visibleSteps.findIndex(function (s) {
|
|
347
|
-
return s.name === nextStep.name;
|
|
348
|
-
});
|
|
290
|
+
case 3:
|
|
349
291
|
if (!(eventName === "skip")) {
|
|
350
|
-
_context2.next =
|
|
292
|
+
_context2.next = 13;
|
|
351
293
|
break;
|
|
352
294
|
}
|
|
353
|
-
response = (
|
|
295
|
+
response = (_currentStep$onSkip = currentStep.onSkip) === null || _currentStep$onSkip === void 0 ? void 0 : _currentStep$onSkip.call(currentStep, currentStep, currentStep, currentStepIndex);
|
|
354
296
|
if (!(response !== undefined)) {
|
|
355
|
-
_context2.next =
|
|
297
|
+
_context2.next = 10;
|
|
356
298
|
break;
|
|
357
299
|
}
|
|
358
|
-
_context2.next =
|
|
300
|
+
_context2.next = 8;
|
|
359
301
|
return (0, _utils.handleNavigation)(response, function () {
|
|
360
|
-
return (0, _utils.extendNextFn)(
|
|
302
|
+
return (0, _utils.extendNextFn)(currentStep, currentStepIndex, visibleSteps, setSteps);
|
|
361
303
|
});
|
|
362
|
-
case
|
|
363
|
-
_context2.next =
|
|
304
|
+
case 8:
|
|
305
|
+
_context2.next = 11;
|
|
364
306
|
break;
|
|
365
|
-
case
|
|
366
|
-
(0, _utils.extendNextFn)(
|
|
367
|
-
case
|
|
368
|
-
_context2.next =
|
|
307
|
+
case 10:
|
|
308
|
+
(0, _utils.extendNextFn)(currentStep, currentStepIndex, visibleSteps, setSteps);
|
|
309
|
+
case 11:
|
|
310
|
+
_context2.next = 24;
|
|
369
311
|
break;
|
|
370
|
-
case
|
|
371
|
-
if (!(
|
|
372
|
-
_context2.next =
|
|
312
|
+
case 13:
|
|
313
|
+
if (!(currentStep.isValid && eventName === "next")) {
|
|
314
|
+
_context2.next = 23;
|
|
373
315
|
break;
|
|
374
316
|
}
|
|
375
|
-
_response = (
|
|
317
|
+
_response = (_currentStep$onNext = currentStep.onNext) === null || _currentStep$onNext === void 0 ? void 0 : _currentStep$onNext.call(currentStep, currentStep, currentStep, currentStepIndex);
|
|
376
318
|
if (!(_response !== undefined)) {
|
|
377
|
-
_context2.next =
|
|
319
|
+
_context2.next = 20;
|
|
378
320
|
break;
|
|
379
321
|
}
|
|
380
|
-
_context2.next =
|
|
322
|
+
_context2.next = 18;
|
|
381
323
|
return (0, _utils.handleNavigation)(_response, function () {
|
|
382
|
-
return (0, _utils.extendNextFn)(
|
|
324
|
+
return (0, _utils.extendNextFn)(currentStep, currentStepIndex, visibleSteps, setSteps);
|
|
383
325
|
});
|
|
384
|
-
case
|
|
385
|
-
_context2.next =
|
|
326
|
+
case 18:
|
|
327
|
+
_context2.next = 21;
|
|
386
328
|
break;
|
|
387
|
-
case
|
|
388
|
-
(0, _utils.extendNextFn)(
|
|
389
|
-
case
|
|
390
|
-
_context2.next =
|
|
329
|
+
case 20:
|
|
330
|
+
(0, _utils.extendNextFn)(currentStep, currentStepIndex, visibleSteps, setSteps);
|
|
331
|
+
case 21:
|
|
332
|
+
_context2.next = 24;
|
|
391
333
|
break;
|
|
392
|
-
case
|
|
393
|
-
if (enablenext && !
|
|
334
|
+
case 23:
|
|
335
|
+
if (enablenext && !currentStep.isValid) {
|
|
394
336
|
console.warn("Cannot proceed: current step is invalid");
|
|
395
337
|
} else {
|
|
396
|
-
(0, _utils.extendNextFn)(
|
|
338
|
+
(0, _utils.extendNextFn)(currentStep, currentStepIndex, visibleSteps, setSteps);
|
|
397
339
|
}
|
|
398
|
-
case
|
|
399
|
-
// update ref to reflect the logical next position immediately
|
|
400
|
-
navIndexRef.current = nextIndex;
|
|
401
|
-
setFormReady(false);
|
|
402
|
-
case 32:
|
|
340
|
+
case 24:
|
|
403
341
|
case "end":
|
|
404
342
|
return _context2.stop();
|
|
405
343
|
}
|
|
406
344
|
}, _callee2);
|
|
407
|
-
})), [currentStepIndex, visibleSteps, enablenext]);
|
|
345
|
+
})), [currentStep, currentStepIndex, visibleSteps, enablenext]);
|
|
408
346
|
var prev = (0, _react.useCallback)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
409
|
-
var
|
|
410
|
-
var
|
|
347
|
+
var _currentStep$onPrev;
|
|
348
|
+
var response;
|
|
411
349
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
412
350
|
while (1) switch (_context3.prev = _context3.next) {
|
|
413
351
|
case 0:
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
if (fromStep) {
|
|
417
|
-
_context3.next = 4;
|
|
418
|
-
break;
|
|
419
|
-
}
|
|
420
|
-
return _context3.abrupt("return");
|
|
421
|
-
case 4:
|
|
422
|
-
targetStep = (0, _utils.getPrevValidStep)(fromIndex - 1, visibleSteps);
|
|
423
|
-
if (targetStep) {
|
|
424
|
-
_context3.next = 7;
|
|
352
|
+
if (currentStep) {
|
|
353
|
+
_context3.next = 2;
|
|
425
354
|
break;
|
|
426
355
|
}
|
|
427
356
|
return _context3.abrupt("return");
|
|
428
|
-
case
|
|
429
|
-
|
|
430
|
-
return s.name === targetStep.name;
|
|
431
|
-
});
|
|
432
|
-
response = (_fromStep$onPrev = fromStep.onPrev) === null || _fromStep$onPrev === void 0 ? void 0 : _fromStep$onPrev.call(fromStep, fromStep, fromStep, fromIndex);
|
|
357
|
+
case 2:
|
|
358
|
+
response = (_currentStep$onPrev = currentStep.onPrev) === null || _currentStep$onPrev === void 0 ? void 0 : _currentStep$onPrev.call(currentStep, currentStep, currentStep, currentStepIndex);
|
|
433
359
|
if (!(response !== undefined)) {
|
|
434
|
-
_context3.next =
|
|
360
|
+
_context3.next = 8;
|
|
435
361
|
break;
|
|
436
362
|
}
|
|
437
|
-
_context3.next =
|
|
363
|
+
_context3.next = 6;
|
|
438
364
|
return (0, _utils.handleNavigation)(response, function () {
|
|
439
|
-
return (0, _utils.extendPrevFn)(
|
|
365
|
+
return (0, _utils.extendPrevFn)(currentStep, currentStepIndex, visibleSteps, setSteps);
|
|
440
366
|
});
|
|
441
|
-
case
|
|
442
|
-
_context3.next =
|
|
367
|
+
case 6:
|
|
368
|
+
_context3.next = 9;
|
|
443
369
|
break;
|
|
444
|
-
case
|
|
445
|
-
(0, _utils.extendPrevFn)(
|
|
446
|
-
case
|
|
447
|
-
navIndexRef.current = prevIndex;
|
|
448
|
-
setFormReady(false);
|
|
449
|
-
case 17:
|
|
370
|
+
case 8:
|
|
371
|
+
(0, _utils.extendPrevFn)(currentStep, currentStepIndex, visibleSteps, setSteps);
|
|
372
|
+
case 9:
|
|
450
373
|
case "end":
|
|
451
374
|
return _context3.stop();
|
|
452
375
|
}
|
|
453
376
|
}, _callee3);
|
|
454
|
-
})), [currentStepIndex, visibleSteps]);
|
|
377
|
+
})), [currentStep, currentStepIndex, visibleSteps]);
|
|
455
378
|
var registerStep = (0, _react.useCallback)(function (stepData) {
|
|
456
379
|
setSteps(function (prevSteps) {
|
|
457
380
|
var existingIndex = prevSteps.findIndex(function (step) {
|
|
@@ -512,11 +435,6 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
512
435
|
return;
|
|
513
436
|
}
|
|
514
437
|
if ((_targetStep = targetStep) !== null && _targetStep !== void 0 && _targetStep.show) {
|
|
515
|
-
var visIndex = visibleSteps.findIndex(function (s) {
|
|
516
|
-
var _targetStep2;
|
|
517
|
-
return s.name === ((_targetStep2 = targetStep) === null || _targetStep2 === void 0 ? void 0 : _targetStep2.name);
|
|
518
|
-
});
|
|
519
|
-
if (visIndex >= 0) navIndexRef.current = visIndex;
|
|
520
438
|
onStepHeaderClick({}, targetStep);
|
|
521
439
|
} else {
|
|
522
440
|
console.error("The gotoStep function cannot navigate to hidden steps");
|
|
@@ -560,30 +478,6 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
560
478
|
}
|
|
561
479
|
}
|
|
562
480
|
}, [visibleSteps]);
|
|
563
|
-
var showSignature = steps.map(function (s) {
|
|
564
|
-
var _listener$Widgets, _listener$Widgets2;
|
|
565
|
-
return (listener === null || listener === void 0 || (_listener$Widgets = listener.Widgets) === null || _listener$Widgets === void 0 || (_listener$Widgets = _listener$Widgets[s.name]) === null || _listener$Widgets === void 0 ? void 0 : _listener$Widgets.show) === false || (listener === null || listener === void 0 || (_listener$Widgets2 = listener.Widgets) === null || _listener$Widgets2 === void 0 || (_listener$Widgets2 = _listener$Widgets2[s.name]) === null || _listener$Widgets2 === void 0 ? void 0 : _listener$Widgets2.show) === "false" ? "0" : "1";
|
|
566
|
-
}).join("|");
|
|
567
|
-
(0, _react.useEffect)(function () {
|
|
568
|
-
if (!(listener !== null && listener !== void 0 && listener.Widgets)) return;
|
|
569
|
-
steps.forEach(function (step, index) {
|
|
570
|
-
var _listener$Widgets$ste;
|
|
571
|
-
var widgetShow = (_listener$Widgets$ste = listener.Widgets[step.name]) === null || _listener$Widgets$ste === void 0 ? void 0 : _listener$Widgets$ste.show;
|
|
572
|
-
if ((widgetShow === false || widgetShow === "false") && step.show !== false) {
|
|
573
|
-
updateStep(step.name, {
|
|
574
|
-
show: false,
|
|
575
|
-
enableskip: false
|
|
576
|
-
});
|
|
577
|
-
var prevStep = steps[index - 1];
|
|
578
|
-
if (prevStep && step.active) {
|
|
579
|
-
updateStep(prevStep.name, {
|
|
580
|
-
active: true
|
|
581
|
-
});
|
|
582
|
-
navIndexRef.current = index - 1;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
});
|
|
586
|
-
}, [showSignature]);
|
|
587
481
|
var updateListener = _react["default"].useCallback(function () {
|
|
588
482
|
if (listener && typeof listener.onChange === "function") {
|
|
589
483
|
listener.onChange(name, {
|
|
@@ -620,7 +514,6 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
620
514
|
disableDone: function disableDone() {
|
|
621
515
|
return !enableDone;
|
|
622
516
|
},
|
|
623
|
-
prev: prev,
|
|
624
517
|
cancelable: cancelable,
|
|
625
518
|
nextbtnlabel: nextbtnlabel,
|
|
626
519
|
previousbtnlabel: previousbtnlabel,
|
|
@@ -635,12 +528,10 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
635
528
|
return _gotoStep(step);
|
|
636
529
|
},
|
|
637
530
|
isFirstStep: isFirstStep,
|
|
638
|
-
isLastStep: isLastStep
|
|
639
|
-
currentStepIndex: currentStepIndex,
|
|
640
|
-
currentStep: currentStep
|
|
531
|
+
isLastStep: isLastStep
|
|
641
532
|
});
|
|
642
533
|
}
|
|
643
|
-
}, [_hasNextStep, hasPrevStep, showDoneBtn, enableNext, enablePrev, enableDone, cancelable, currentStep === null || currentStep === void 0 ? void 0 : currentStep.enableskip, nextbtnlabel, previousbtnlabel, donebtnlabel, cancelbtnlabel, actionsalignment, currentStepIndex
|
|
534
|
+
}, [_hasNextStep, hasPrevStep, showDoneBtn, enableNext, enablePrev, enableDone, cancelable, currentStep === null || currentStep === void 0 ? void 0 : currentStep.enableskip, nextbtnlabel, previousbtnlabel, donebtnlabel, cancelbtnlabel, actionsalignment, currentStepIndex]);
|
|
644
535
|
(0, _react.useEffect)(function () {
|
|
645
536
|
updateListener();
|
|
646
537
|
}, [updateListener]);
|
|
@@ -749,8 +640,7 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
749
640
|
style: _objectSpread(_objectSpread({}, styles), {}, {
|
|
750
641
|
width: width,
|
|
751
642
|
height: height
|
|
752
|
-
})
|
|
753
|
-
name: name
|
|
643
|
+
})
|
|
754
644
|
}, __jsx(_material.Box, {
|
|
755
645
|
className: "app-wizard-heading"
|
|
756
646
|
}, __jsx(_material.Stepper, {
|
|
@@ -783,9 +673,7 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
783
673
|
}, __jsx(_material.Typography, {
|
|
784
674
|
variant: "body2",
|
|
785
675
|
color: wizardMessage.type === "error" ? "error" : "textSecondary"
|
|
786
|
-
}, wizardMessage.caption)),
|
|
787
|
-
return s.active;
|
|
788
|
-
}) : steps).map(function (step, index) {
|
|
676
|
+
}, wizardMessage.caption)), steps.map(function (step, index) {
|
|
789
677
|
return __jsx("div", {
|
|
790
678
|
key: step.name,
|
|
791
679
|
ref: function ref(el) {
|
|
@@ -793,15 +681,6 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
793
681
|
var formElement = el.querySelector("form");
|
|
794
682
|
if (formElement) {
|
|
795
683
|
formRefs.current[step.name] = formElement;
|
|
796
|
-
if (formElement.classList.contains("app-form")) {
|
|
797
|
-
setFormReady(true);
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
if (step.haveForm === undefined) {
|
|
801
|
-
var hasFormNow = !!formElement;
|
|
802
|
-
updateStep(step.name, {
|
|
803
|
-
haveForm: hasFormNow
|
|
804
|
-
});
|
|
805
684
|
}
|
|
806
685
|
}
|
|
807
686
|
},
|
|
@@ -826,15 +705,6 @@ var WmWizard = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
826
705
|
key: ((_step$props = step.props) === null || _step$props === void 0 ? void 0 : _step$props.name) || index
|
|
827
706
|
});
|
|
828
707
|
})));
|
|
829
|
-
}, function (prev, next) {
|
|
830
|
-
var keys = ["render", "dataset", "className", "styles", "width", "height", "type", "stepstyle", "orientation", "alternativeLabel", "nonLinear", "defaultstep", "defaultstepindex", "message", "cancelable", "enablenext", "nextbtnlabel", "previousbtnlabel", "donebtnlabel", "cancelbtnlabel", "children"];
|
|
831
|
-
return keys.every(function (key) {
|
|
832
|
-
// Never deep-compare children; treat as referential
|
|
833
|
-
if (key === "children") {
|
|
834
|
-
return prev[key] === next[key];
|
|
835
|
-
}
|
|
836
|
-
return (0, _isEqual["default"])(prev[key], next[key]);
|
|
837
|
-
});
|
|
838
708
|
});
|
|
839
709
|
WmWizard.displayName = "WmWizard";
|
|
840
710
|
var _default = exports["default"] = (0, _withBaseWrapper.withBaseWrapper)(WmWizard);
|
|
@@ -36,7 +36,7 @@ var getPrevValidStep = exports.getPrevValidStep = function getPrevValidStep(from
|
|
|
36
36
|
var getStepByName = exports.getStepByName = function getStepByName(stepName, steps) {
|
|
37
37
|
return steps.find(function (step) {
|
|
38
38
|
return step.name === stepName;
|
|
39
|
-
}) ||
|
|
39
|
+
}) || null;
|
|
40
40
|
};
|
|
41
41
|
var getStepByIndex = exports.getStepByIndex = function getStepByIndex(index, visibleSteps) {
|
|
42
42
|
return visibleSteps[index] || null;
|
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _material = require("@mui/material");
|
|
11
10
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
12
|
-
var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
|
|
13
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
14
11
|
var __jsx = _react["default"].createElement;
|
|
15
12
|
var ACTIONS_CLASS = "app-wizard-actions panel-footer";
|
|
16
|
-
var WmWizardAction =
|
|
13
|
+
var WmWizardAction = function WmWizardAction(_ref) {
|
|
17
14
|
var children = _ref.children,
|
|
18
15
|
_ref$actionsalignment = _ref.actionsalignment,
|
|
19
16
|
actionsalignment = _ref$actionsalignment === void 0 ? "right" : _ref$actionsalignment;
|
|
20
17
|
return __jsx(_material.Box, {
|
|
21
18
|
className: (0, _clsx["default"])(ACTIONS_CLASS, actionsalignment)
|
|
22
19
|
}, children);
|
|
23
|
-
}
|
|
24
|
-
return prev.actionsalignment === next.actionsalignment && prev.children === next.children && prev.listener === next.listener;
|
|
25
|
-
});
|
|
20
|
+
};
|
|
26
21
|
WmWizardAction.displayName = "WmWizardAction";
|
|
27
|
-
var _default = exports["default"] =
|
|
22
|
+
var _default = exports["default"] = WmWizardAction;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports["default"] = void 0;
|
|
9
|
-
var _react =
|
|
7
|
+
var _react = require("react");
|
|
10
8
|
var _WizardContext = require("../WizardContext");
|
|
11
|
-
var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
|
|
12
|
-
var _isEqual = _interopRequireDefault(require("lodash-es/isEqual"));
|
|
13
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
14
|
-
var __jsx = _react["default"].createElement;
|
|
15
9
|
var WmWizardstep = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
16
10
|
var name = props.name,
|
|
17
11
|
_props$title = props.title,
|
|
@@ -87,21 +81,14 @@ var WmWizardstep = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
87
81
|
if (isRegistered && name) {
|
|
88
82
|
context.updateStep(name, {
|
|
89
83
|
content: content || children,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
enableskip: enableskip,
|
|
95
|
-
show: show
|
|
84
|
+
onLoad: onLoad,
|
|
85
|
+
onNext: onNext,
|
|
86
|
+
onPrev: onPrev,
|
|
87
|
+
onSkip: onSkip
|
|
96
88
|
});
|
|
97
89
|
}
|
|
98
|
-
}, [name,
|
|
99
|
-
return
|
|
100
|
-
}, function (prev, next) {
|
|
101
|
-
var keys = ["name", "title", "subtitle", "iconclass", "doneiconclass", "show", "enableskip", "disablenext", "disableprevious", "disabledone", "content", "dynamicStepIndex", "isdynamic", "haveForm", "onLoad", "onNext", "onPrev", "onSkip", "render"];
|
|
102
|
-
return keys.every(function (key) {
|
|
103
|
-
return (0, _isEqual["default"])(prev[key], next[key]);
|
|
104
|
-
});
|
|
90
|
+
}, [context, name, content, children, onLoad, onNext, onPrev, onSkip, isRegistered]);
|
|
91
|
+
return null;
|
|
105
92
|
});
|
|
106
93
|
WmWizardstep.displayName = "WmWizardstep";
|
|
107
|
-
var _default = exports["default"] =
|
|
94
|
+
var _default = exports["default"] = WmWizardstep;
|
|
@@ -19,6 +19,7 @@ var _set = _interopRequireDefault(require("lodash-es/set"));
|
|
|
19
19
|
var _props = require("./props");
|
|
20
20
|
var _utils = require("./utils");
|
|
21
21
|
var _formContext = require("../form-context");
|
|
22
|
+
var _utils2 = require("../../utils");
|
|
22
23
|
var _lodashEs = require("lodash-es");
|
|
23
24
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
24
25
|
var __jsx = _react["default"].createElement;
|
|
@@ -27,10 +28,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
27
28
|
var DEFAULT_CLASS = "panel app-panel app-form";
|
|
28
29
|
var BaseForm = function BaseForm(WrappedComponent) {
|
|
29
30
|
var ControlledForm = function ControlledForm(FormProps) {
|
|
30
|
-
var _props$listener4;
|
|
31
31
|
// setting up default props for form
|
|
32
32
|
var props = _objectSpread(_objectSpread({}, _props.defaultProps), FormProps);
|
|
33
33
|
var isInsideWizard = props.isInsideWizard || false;
|
|
34
|
+
var primaryKeyRef = (0, _react.useRef)([]);
|
|
34
35
|
var formRef = (0, _react.useRef)(null);
|
|
35
36
|
var _useState = (0, _react.useState)({}),
|
|
36
37
|
formfields = _useState[0],
|
|
@@ -69,7 +70,6 @@ var BaseForm = function BaseForm(WrappedComponent) {
|
|
|
69
70
|
reset = _useForm.reset,
|
|
70
71
|
watch = _useForm.watch,
|
|
71
72
|
trigger = _useForm.trigger,
|
|
72
|
-
getValues = _useForm.getValues,
|
|
73
73
|
clearErrors = _useForm.clearErrors;
|
|
74
74
|
|
|
75
75
|
// update the form data when the formdata prop changes
|
|
@@ -165,13 +165,14 @@ var BaseForm = function BaseForm(WrappedComponent) {
|
|
|
165
165
|
}, [trigger]);
|
|
166
166
|
var handleFormSubmit = /*#__PURE__*/function () {
|
|
167
167
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(data, e, operation) {
|
|
168
|
-
var isValid, _props$listener2, result, FormData, _props$listener3;
|
|
168
|
+
var isValid, _props$listener2, result, FormData, _props$listener3, operationType;
|
|
169
169
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
170
170
|
while (1) switch (_context.prev = _context.next) {
|
|
171
171
|
case 0:
|
|
172
172
|
if (!e) {
|
|
173
173
|
e = new Event("submit");
|
|
174
174
|
}
|
|
175
|
+
|
|
175
176
|
// check form is valid or not
|
|
176
177
|
_context.next = 3;
|
|
177
178
|
return validateFieldsOnSubmit();
|
|
@@ -215,22 +216,17 @@ var BaseForm = function BaseForm(WrappedComponent) {
|
|
|
215
216
|
}
|
|
216
217
|
|
|
217
218
|
// get the operation type
|
|
219
|
+
operationType = props.widgettype === "live-form" && !operation ? (0, _utils2.findOperationType)(FormData, primaryKeyRef.current) : operation;
|
|
218
220
|
props.formSubmit(FormData, function (data) {
|
|
219
|
-
if (props.widgettype === "live-form" &&
|
|
221
|
+
if (props.widgettype === "live-form" && operationType === "insert") {
|
|
220
222
|
reset(data);
|
|
221
223
|
}
|
|
222
224
|
onResultCb((0, _get["default"])(data, "params"), "success");
|
|
223
|
-
var hasCustomOnSuccess = props.onSuccess !== _props.defaultProps.onSuccess;
|
|
224
|
-
if (!hasCustomOnSuccess && props.widgettype === "live-form") {
|
|
225
|
-
var successMsg = data.operationType === "insert" && props.insertmessage || data.operationType === "update" && props.updatemessage || data.operationType === "delete" && props.deletemessage || props.postmessage;
|
|
226
|
-
toggleMessage(true, successMsg, "success");
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
225
|
toggleMessage(true, props.postmessage, "success");
|
|
230
226
|
}, function (error) {
|
|
231
227
|
toggleMessage(true, props.errormessage || error || error.message, "error");
|
|
232
228
|
onResultCb(error, "");
|
|
233
|
-
});
|
|
229
|
+
}, operationType);
|
|
234
230
|
}
|
|
235
231
|
if (props !== null && props !== void 0 && props.onSubmit) {
|
|
236
232
|
props.onSubmit(e, props, FormData);
|
|
@@ -379,10 +375,7 @@ var BaseForm = function BaseForm(WrappedComponent) {
|
|
|
379
375
|
cancel: cancel,
|
|
380
376
|
"new": create,
|
|
381
377
|
edit: edit,
|
|
382
|
-
setShowViewMode: setShowViewMode
|
|
383
|
-
dataoutput: getValues(),
|
|
384
|
-
save: submit,
|
|
385
|
-
reset: reset
|
|
378
|
+
setShowViewMode: setShowViewMode
|
|
386
379
|
});
|
|
387
380
|
var conditionalProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props.target && {
|
|
388
381
|
target: props.target
|
|
@@ -426,23 +419,13 @@ var BaseForm = function BaseForm(WrappedComponent) {
|
|
|
426
419
|
function cancel() {
|
|
427
420
|
setShowViewMode(true);
|
|
428
421
|
}
|
|
429
|
-
var fields = (0, _get["default"])((_props$listener4 = props.listener) === null || _props$listener4 === void 0 ? void 0 : _props$listener4.Widgets[props.name], "formfields", {});
|
|
430
|
-
var FormFields = (0, _react.useMemo)(function () {
|
|
431
|
-
var newFields = [];
|
|
432
|
-
Object.keys(fields).forEach(function (key) {
|
|
433
|
-
if (!key.includes("formWidget") && fields[key]) {
|
|
434
|
-
newFields.push(fields[key]);
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
return newFields;
|
|
438
|
-
}, [fields]);
|
|
439
422
|
|
|
440
423
|
// Call onDataSourceChange when formfields change
|
|
441
424
|
(0, _react.useEffect)(function () {
|
|
442
|
-
if (props.onDataSourceChange &&
|
|
443
|
-
props.onDataSourceChange(
|
|
425
|
+
if (props.onDataSourceChange && Object.keys(formfields).length > 0) {
|
|
426
|
+
props.onDataSourceChange(formfields);
|
|
444
427
|
}
|
|
445
|
-
}, [
|
|
428
|
+
}, [formfields, props.onDataSourceChange]);
|
|
446
429
|
|
|
447
430
|
// Determine form classes based on wizard context
|
|
448
431
|
var formClassName = (0, _react.useMemo)(function () {
|
|
@@ -451,29 +434,6 @@ var BaseForm = function BaseForm(WrappedComponent) {
|
|
|
451
434
|
}
|
|
452
435
|
return (0, _clsx["default"])(DEFAULT_CLASS, props.className);
|
|
453
436
|
}, [isInsideWizard, props.className]);
|
|
454
|
-
|
|
455
|
-
// Notify parent containers (wizard) about validity changes
|
|
456
|
-
(0, _react.useEffect)(function () {
|
|
457
|
-
var el = formRef.current;
|
|
458
|
-
if (!el) return;
|
|
459
|
-
var emit = function emit() {
|
|
460
|
-
el.dispatchEvent(new CustomEvent("wm:form-validity", {
|
|
461
|
-
bubbles: true,
|
|
462
|
-
detail: {
|
|
463
|
-
isValid: isValid
|
|
464
|
-
}
|
|
465
|
-
}));
|
|
466
|
-
};
|
|
467
|
-
emit();
|
|
468
|
-
var unsubscribe = watch(function () {
|
|
469
|
-
return emit();
|
|
470
|
-
});
|
|
471
|
-
return function () {
|
|
472
|
-
if (typeof unsubscribe === "function") {
|
|
473
|
-
unsubscribe();
|
|
474
|
-
}
|
|
475
|
-
};
|
|
476
|
-
}, [watch, isValid]);
|
|
477
437
|
return __jsx("form", (0, _extends2["default"])({
|
|
478
438
|
name: props.name,
|
|
479
439
|
defaultmode: props.defaultmode,
|