@wavemaker-ai/react-runtime 1.0.0-rc.647712 → 12.0.0-rc.647733
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 +316 -310
- 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
|
@@ -18,15 +18,12 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import {
|
|
21
|
-
forEach,
|
|
22
|
-
entries,
|
|
23
21
|
size,
|
|
24
22
|
isEmpty,
|
|
25
23
|
isArray,
|
|
26
24
|
map,
|
|
27
25
|
get,
|
|
28
26
|
trim,
|
|
29
|
-
startsWith,
|
|
30
27
|
findIndex,
|
|
31
28
|
assign,
|
|
32
29
|
floor,
|
|
@@ -409,74 +406,6 @@ const getActionButtonClass = (action) => {
|
|
|
409
406
|
const getTableActionButtonClass = (action) => {
|
|
410
407
|
return `btn ${get(action, "className", "btn-primary")} ${isAddNewAction(get(action, "key")) ? "add-action" : ""}`;
|
|
411
408
|
};
|
|
412
|
-
const validateEditingFields = (fieldRefs, editingRowId) => {
|
|
413
|
-
const invalidElements = [];
|
|
414
|
-
const invalidFieldKeys = [];
|
|
415
|
-
const shouldValidateField = (fieldKey) => {
|
|
416
|
-
if (!editingRowId) return true;
|
|
417
|
-
return startsWith(fieldKey, `${editingRowId}_`);
|
|
418
|
-
};
|
|
419
|
-
forEach(entries(fieldRefs), ([fieldKey, fieldElement]) => {
|
|
420
|
-
if (!shouldValidateField(fieldKey) || !fieldElement) {
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
let isInvalid = false;
|
|
424
|
-
const inputs = fieldElement.querySelectorAll("input, select, textarea");
|
|
425
|
-
forEach(inputs, (input) => {
|
|
426
|
-
if (input && !input.validity.valid && input.hasAttribute("required")) {
|
|
427
|
-
invalidElements.push(input);
|
|
428
|
-
isInvalid = true;
|
|
429
|
-
}
|
|
430
|
-
if (input && input.classList.contains("ng-invalid")) {
|
|
431
|
-
invalidElements.push(input);
|
|
432
|
-
isInvalid = true;
|
|
433
|
-
}
|
|
434
|
-
if (input && input.hasAttribute("required") && !trim(input.value)) {
|
|
435
|
-
invalidElements.push(input);
|
|
436
|
-
isInvalid = true;
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
if (fieldElement.hasAttribute("required")) {
|
|
440
|
-
const inputEl = fieldElement.querySelector("input, textarea, select");
|
|
441
|
-
if (inputEl && !trim(inputEl.value)) {
|
|
442
|
-
invalidElements.push(inputEl);
|
|
443
|
-
isInvalid = true;
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
if (isInvalid) {
|
|
447
|
-
invalidFieldKeys.push(fieldKey);
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
if (size(invalidElements) > 0) {
|
|
451
|
-
const logPrefix = editingRowId ? `[${editingRowId}]` : "[Validation]";
|
|
452
|
-
console.log(`${logPrefix} Validation failed: Found ${size(invalidElements)} invalid elements`);
|
|
453
|
-
const firstInvalidElement = get(invalidElements, "[0]");
|
|
454
|
-
if (firstInvalidElement) {
|
|
455
|
-
const cell = firstInvalidElement.closest("td, .app-datagrid-cell, .form-field");
|
|
456
|
-
if (cell) {
|
|
457
|
-
const focusTarget = cell.querySelector(
|
|
458
|
-
"[focus-target], input, textarea, select"
|
|
459
|
-
);
|
|
460
|
-
if (focusTarget) {
|
|
461
|
-
setTimeout(() => {
|
|
462
|
-
focusTarget.focus();
|
|
463
|
-
console.log(`${logPrefix} Focused first invalid field:`, focusTarget);
|
|
464
|
-
}, 0);
|
|
465
|
-
}
|
|
466
|
-
} else {
|
|
467
|
-
setTimeout(() => {
|
|
468
|
-
firstInvalidElement.focus();
|
|
469
|
-
}, 0);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
return {
|
|
474
|
-
isValid: isEmpty(invalidElements),
|
|
475
|
-
invalidElements,
|
|
476
|
-
invalidFieldKeys,
|
|
477
|
-
firstInvalidElement: size(invalidElements) > 0 ? get(invalidElements, "[0]") : void 0
|
|
478
|
-
};
|
|
479
|
-
};
|
|
480
409
|
const getButtonClasses = (action, spacing = "normal", isGridEditMode = false, isLoading = false) => {
|
|
481
410
|
const baseClass = `btn ${get(action, "className", "btn-primary")} ${isAddNewAction(get(action, "key")) ? "add-action" : ""}`;
|
|
482
411
|
const spacingClass = spacing === "condensed" ? "btn-sm" : "";
|
|
@@ -659,11 +588,17 @@ import {
|
|
|
659
588
|
INTERACTIVE_ROLES,
|
|
660
589
|
INTERACTIVE_DATA_ROLES,
|
|
661
590
|
INTERACTIVE_TAG_NAMES,
|
|
591
|
+
SELECTION_COLUMN_DATA_ROLES,
|
|
662
592
|
UNSUPPORTED_STATE_PERSISTENCE_TYPES
|
|
663
593
|
} from "./constants";
|
|
664
594
|
import { renderDisplayCell } from "./renderDisplayCell";
|
|
665
595
|
import { buildSelectionColumns } from "./buildSelectionColumns";
|
|
666
|
-
import {
|
|
596
|
+
import {
|
|
597
|
+
cloneValidators,
|
|
598
|
+
collectNativeValidityErrors,
|
|
599
|
+
focusFirstInvalidCell,
|
|
600
|
+
isColumnValidatable
|
|
601
|
+
} from "./columnValidation";
|
|
667
602
|
import {
|
|
668
603
|
hasInteractiveClass,
|
|
669
604
|
hasInteractiveAttributes,
|
|
@@ -694,6 +629,7 @@ export {
|
|
|
694
629
|
INTERACTIVE_ROLES,
|
|
695
630
|
INTERACTIVE_TAG_NAMES,
|
|
696
631
|
INTERNAL_PROPERTIES,
|
|
632
|
+
SELECTION_COLUMN_DATA_ROLES,
|
|
697
633
|
TABLE_CSS_CLASSES2 as TABLE_CSS_CLASSES,
|
|
698
634
|
TABLE_DATA_STATES,
|
|
699
635
|
TABLE_MESSAGES,
|
|
@@ -702,6 +638,8 @@ export {
|
|
|
702
638
|
buildSelectionColumns,
|
|
703
639
|
cleanRowData,
|
|
704
640
|
clearTableState,
|
|
641
|
+
cloneValidators,
|
|
642
|
+
collectNativeValidityErrors,
|
|
705
643
|
convertFilterArrayToObject,
|
|
706
644
|
convertFilterObjectToArray,
|
|
707
645
|
createDataColumn,
|
|
@@ -712,6 +650,7 @@ export {
|
|
|
712
650
|
distributeColumnWidths,
|
|
713
651
|
extractDataArray,
|
|
714
652
|
flattenTableStructure,
|
|
653
|
+
focusFirstInvalidCell,
|
|
715
654
|
getActionButtonClass,
|
|
716
655
|
getActionColumnSize,
|
|
717
656
|
getAggregateFunctions,
|
|
@@ -733,6 +672,7 @@ export {
|
|
|
733
672
|
hasInteractiveClass,
|
|
734
673
|
isAddNewAction,
|
|
735
674
|
isColumnDomHidden,
|
|
675
|
+
isColumnValidatable,
|
|
736
676
|
isColumnVisibleForViewport,
|
|
737
677
|
isDataColumn,
|
|
738
678
|
isDeleteAction,
|
|
@@ -746,13 +686,9 @@ export {
|
|
|
746
686
|
parseTableStructureWithGroups,
|
|
747
687
|
parseWidth,
|
|
748
688
|
renderDisplayCell,
|
|
749
|
-
resetValidationState,
|
|
750
689
|
rowExistsInDataset,
|
|
751
690
|
saveTableState,
|
|
752
691
|
selectionStateHelpers,
|
|
753
692
|
shouldShowPagination,
|
|
754
|
-
shouldShowPanelHeading
|
|
755
|
-
updateValidationErrors,
|
|
756
|
-
validateEditingFields,
|
|
757
|
-
validateField
|
|
693
|
+
shouldShowPanelHeading
|
|
758
694
|
};
|
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
INTERACTIVE_CLASSES,
|
|
4
4
|
INTERACTIVE_ROLES,
|
|
5
5
|
INTERACTIVE_DATA_ROLES,
|
|
6
|
-
INTERACTIVE_TAG_NAMES
|
|
6
|
+
INTERACTIVE_TAG_NAMES,
|
|
7
|
+
SELECTION_COLUMN_DATA_ROLES
|
|
7
8
|
} from "./constants";
|
|
8
9
|
const hasInteractiveClass = (element) => {
|
|
9
10
|
if (!element.className || typeof element.className !== "string") return false;
|
|
@@ -24,9 +25,12 @@ const hasInteractiveAttributes = (element) => {
|
|
|
24
25
|
return true;
|
|
25
26
|
}
|
|
26
27
|
const dataRole = element.getAttribute("data-role");
|
|
28
|
+
if (dataRole && SELECTION_COLUMN_DATA_ROLES.includes(dataRole)) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
27
31
|
if (dataRole) {
|
|
28
32
|
for (const interactiveRole of INTERACTIVE_DATA_ROLES) {
|
|
29
|
-
if (dataRole
|
|
33
|
+
if (dataRole === interactiveRole) {
|
|
30
34
|
return true;
|
|
31
35
|
}
|
|
32
36
|
}
|
|
@@ -41,14 +45,18 @@ const isSelectionCheckboxRenamed = (event) => {
|
|
|
41
45
|
const checkbox = (_b = row == null ? void 0 : row.querySelector) == null ? void 0 : _b.call(row, 'input[type="checkbox"]');
|
|
42
46
|
return !!checkbox && checkbox.getAttribute("name") !== MULTI_SELECT_INPUT_NAME;
|
|
43
47
|
};
|
|
48
|
+
const isSelectionColumnTarget = (target) => {
|
|
49
|
+
if (!(target == null ? void 0 : target.closest)) return false;
|
|
50
|
+
return SELECTION_COLUMN_DATA_ROLES.some((role) => target.closest(`[data-role="${role}"]`));
|
|
51
|
+
};
|
|
44
52
|
const isInteractiveElement = (event) => {
|
|
45
53
|
const target = event.target;
|
|
46
|
-
if (
|
|
47
|
-
return
|
|
54
|
+
if (isSelectionColumnTarget(target)) {
|
|
55
|
+
return false;
|
|
48
56
|
}
|
|
49
57
|
let element = target;
|
|
50
58
|
while (element) {
|
|
51
|
-
if (hasInteractiveClass(element) || hasInteractiveAttributes(element)) {
|
|
59
|
+
if (INTERACTIVE_TAG_NAMES.includes(element.tagName) || hasInteractiveClass(element) || hasInteractiveAttributes(element)) {
|
|
52
60
|
return true;
|
|
53
61
|
}
|
|
54
62
|
element = element.parentElement;
|
|
@@ -122,9 +122,11 @@ const WmDateTime = memo(
|
|
|
122
122
|
const [datePickerView, setDatePickerView] = useState("day");
|
|
123
123
|
const [isCurrentMonth, setIsCurrentMonth] = useState(true);
|
|
124
124
|
const [validationFailureMessage, setValidationFailureMessage] = useState("");
|
|
125
|
+
const [isDirty, setIsDirty] = useState(false);
|
|
125
126
|
const inputRef = useRef(null);
|
|
126
127
|
const onBeforeloadExecutedRef = useRef(false);
|
|
127
128
|
const anchorRef = useRef(null);
|
|
129
|
+
const showValidationError = isDirty && Boolean(validationFailureMessage || invalidFormat || dateNotInRange);
|
|
128
130
|
const isReadOnly = useMemo(
|
|
129
131
|
() => readonly || isCurrentDate || dataentrymode !== "undefined" && dataentrymode !== "default",
|
|
130
132
|
[readonly, dataentrymode, isCurrentDate]
|
|
@@ -241,6 +243,7 @@ const WmDateTime = memo(
|
|
|
241
243
|
);
|
|
242
244
|
const handleDateSelection = useCallback(
|
|
243
245
|
(date) => {
|
|
246
|
+
setIsDirty(true);
|
|
244
247
|
if (!date) {
|
|
245
248
|
handleFinalDateChange(null);
|
|
246
249
|
setIsDateOpen(false);
|
|
@@ -300,6 +303,7 @@ const WmDateTime = memo(
|
|
|
300
303
|
}, []);
|
|
301
304
|
const handleTimeSelection = useCallback(
|
|
302
305
|
(time) => {
|
|
306
|
+
setIsDirty(true);
|
|
303
307
|
if (!time || !tempDateValue) return;
|
|
304
308
|
const combinedDateTime = moment(tempDateValue).hour(moment(time).hour()).minute(moment(time).minute()).second(moment(time).second()).toDate();
|
|
305
309
|
setLocalDateValue(combinedDateTime);
|
|
@@ -328,6 +332,7 @@ const WmDateTime = memo(
|
|
|
328
332
|
(event) => {
|
|
329
333
|
var _a2, _b2;
|
|
330
334
|
if (dataentrymode === "picker") return;
|
|
335
|
+
setIsDirty(true);
|
|
331
336
|
const value = event.target.value;
|
|
332
337
|
setDisplayValue(value);
|
|
333
338
|
if (!value) {
|
|
@@ -433,11 +438,13 @@ const WmDateTime = memo(
|
|
|
433
438
|
[excludedDaysArray, excludedDatesArray]
|
|
434
439
|
);
|
|
435
440
|
const handleToday = useCallback(() => {
|
|
441
|
+
setIsDirty(true);
|
|
436
442
|
const today = moment().toDate();
|
|
437
443
|
handleFinalDateChange(today);
|
|
438
444
|
setIsTimeOpen(true);
|
|
439
445
|
}, [handleFinalDateChange]);
|
|
440
446
|
const handleClear = useCallback(() => {
|
|
447
|
+
setIsDirty(true);
|
|
441
448
|
handleFinalDateChange(null);
|
|
442
449
|
}, [handleFinalDateChange]);
|
|
443
450
|
useEffect(() => {
|
|
@@ -565,6 +572,7 @@ const WmDateTime = memo(
|
|
|
565
572
|
onBlur: (event) => {
|
|
566
573
|
var _a2;
|
|
567
574
|
if (readonly) return;
|
|
575
|
+
setIsDirty(true);
|
|
568
576
|
onBlur && name && onBlur(event, (_a2 = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a2[name]);
|
|
569
577
|
},
|
|
570
578
|
onChange: handleInputChange,
|
|
@@ -578,8 +586,8 @@ const WmDateTime = memo(
|
|
|
578
586
|
},
|
|
579
587
|
autoFocus: autofocus,
|
|
580
588
|
required,
|
|
581
|
-
error:
|
|
582
|
-
helperText: validationFailureMessage || (invalidFormat ? validationmessage || "Invalid date format" : dateNotInRange ? validationmessage || "Date not in valid range" : ""),
|
|
589
|
+
error: showValidationError,
|
|
590
|
+
helperText: showValidationError ? validationFailureMessage || (invalidFormat ? validationmessage || "Invalid date format" : dateNotInRange ? validationmessage || "Date not in valid range" : "") : "",
|
|
583
591
|
InputProps: {
|
|
584
592
|
readOnly: isReadOnly,
|
|
585
593
|
placeholder: floatinglabel ? void 0 : placeholder
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { Box } from "@mui/material";
|
|
4
|
+
import { PartialContentWrapper } from "../../common";
|
|
4
5
|
const DEFAULT_CLASS = "app-footer clearfix";
|
|
5
6
|
const WmFooter = (props) => {
|
|
6
|
-
const { styles, children, render, className, id } = props;
|
|
7
|
-
|
|
7
|
+
const { styles, children, render, className, id, content } = props;
|
|
8
|
+
const rendered = render ? render(props) : children;
|
|
9
|
+
return /* @__PURE__ */ jsx(Box, { component: "div", sx: styles, className: clsx(DEFAULT_CLASS, className), id, children: /* @__PURE__ */ jsx(PartialContentWrapper, { content, children: rendered }) });
|
|
8
10
|
};
|
|
9
11
|
WmFooter.displayName = "WmFooter";
|
|
10
12
|
var footer_default = WmFooter;
|
|
@@ -1,10 +1,36 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
2
3
|
import clsx from "clsx";
|
|
3
4
|
import Box from "@mui/material/Box";
|
|
5
|
+
import IconButton from "@mui/material/IconButton";
|
|
6
|
+
import { PartialContentWrapper } from "../../common";
|
|
7
|
+
import { PageLayoutContext } from "../../page/page-context";
|
|
4
8
|
const DEFAULT_CLASS = "app-header clearfix app-header-shrink";
|
|
5
9
|
const WmHeader = (props) => {
|
|
6
|
-
const { styles, children, render, className, id } = props;
|
|
7
|
-
|
|
10
|
+
const { styles, children, render, className, id, content } = props;
|
|
11
|
+
const {
|
|
12
|
+
hasLeftPanel,
|
|
13
|
+
leftPanelExpanded = false,
|
|
14
|
+
toggleLeftPanel
|
|
15
|
+
} = useContext(PageLayoutContext);
|
|
16
|
+
const rendered = render ? render(props) : children;
|
|
17
|
+
const handleLeftNavToggle = (event) => {
|
|
18
|
+
event.stopPropagation();
|
|
19
|
+
toggleLeftPanel == null ? void 0 : toggleLeftPanel();
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ jsxs(Box, { component: "header", className: clsx(DEFAULT_CLASS, className), id, sx: styles, children: [
|
|
22
|
+
hasLeftPanel && /* @__PURE__ */ jsx(Box, { component: "div", className: "app-header-menu", "data-role": "page-left-panel-icon", children: /* @__PURE__ */ jsx(
|
|
23
|
+
IconButton,
|
|
24
|
+
{
|
|
25
|
+
className: "app-header-action btn-text",
|
|
26
|
+
"aria-expanded": leftPanelExpanded,
|
|
27
|
+
"aria-label": "Expand Left navigation",
|
|
28
|
+
onClick: handleLeftNavToggle,
|
|
29
|
+
children: /* @__PURE__ */ jsx("i", { className: "wi wi-menu", "aria-hidden": "true" })
|
|
30
|
+
}
|
|
31
|
+
) }),
|
|
32
|
+
/* @__PURE__ */ jsx(Box, { component: "div", className: "app-header-container", children: /* @__PURE__ */ jsx(PartialContentWrapper, { content, children: rendered }) })
|
|
33
|
+
] });
|
|
8
34
|
};
|
|
9
35
|
WmHeader.displayName = "WmHeader";
|
|
10
36
|
var header_default = WmHeader;
|
|
@@ -2,12 +2,17 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useContext, useEffect } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import Box from "@mui/material/Box";
|
|
5
|
+
import { PartialContentWrapper } from "../../common";
|
|
5
6
|
import { PageLayoutContext } from "../../page/page-context";
|
|
6
7
|
import { getLeftPanelPageClasses } from "./utils/page-class-util";
|
|
7
|
-
const DEFAULT_CLASS = "app-nav-drawer app-left-panel
|
|
8
|
+
const DEFAULT_CLASS = "app-nav-drawer app-left-panel";
|
|
8
9
|
const SLIDE_IN = "slide-in";
|
|
9
10
|
const WmLeftPanel = (props) => {
|
|
10
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
onLeftPanelPageClassesChange,
|
|
13
|
+
onLeftPanelPresenceChange,
|
|
14
|
+
leftPanelExpanded = false
|
|
15
|
+
} = useContext(PageLayoutContext);
|
|
11
16
|
const {
|
|
12
17
|
styles,
|
|
13
18
|
children,
|
|
@@ -19,7 +24,8 @@ const WmLeftPanel = (props) => {
|
|
|
19
24
|
navtype,
|
|
20
25
|
navheight,
|
|
21
26
|
animation = SLIDE_IN,
|
|
22
|
-
onNavHeightChange
|
|
27
|
+
onNavHeightChange,
|
|
28
|
+
content
|
|
23
29
|
} = props;
|
|
24
30
|
useEffect(() => {
|
|
25
31
|
if (onNavHeightChange) {
|
|
@@ -31,18 +37,27 @@ const WmLeftPanel = (props) => {
|
|
|
31
37
|
}
|
|
32
38
|
};
|
|
33
39
|
}, [navheight, onNavHeightChange]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
onLeftPanelPresenceChange == null ? void 0 : onLeftPanelPresenceChange(true);
|
|
42
|
+
return () => {
|
|
43
|
+
onLeftPanelPresenceChange == null ? void 0 : onLeftPanelPresenceChange(false);
|
|
44
|
+
};
|
|
45
|
+
}, [onLeftPanelPresenceChange]);
|
|
34
46
|
useEffect(() => {
|
|
35
47
|
onLeftPanelPageClassesChange == null ? void 0 : onLeftPanelPageClassesChange(
|
|
36
48
|
getLeftPanelPageClasses({
|
|
37
49
|
animation,
|
|
38
50
|
columnwidth,
|
|
39
|
-
xscolumnwidth
|
|
51
|
+
xscolumnwidth,
|
|
52
|
+
expanded: leftPanelExpanded
|
|
40
53
|
})
|
|
41
54
|
);
|
|
55
|
+
}, [animation, columnwidth, xscolumnwidth, leftPanelExpanded, onLeftPanelPageClassesChange]);
|
|
56
|
+
useEffect(() => {
|
|
42
57
|
return () => {
|
|
43
58
|
onLeftPanelPageClassesChange == null ? void 0 : onLeftPanelPageClassesChange(void 0);
|
|
44
59
|
};
|
|
45
|
-
}, [
|
|
60
|
+
}, [onLeftPanelPageClassesChange]);
|
|
46
61
|
return /* @__PURE__ */ jsx(
|
|
47
62
|
Box,
|
|
48
63
|
{
|
|
@@ -51,11 +66,12 @@ const WmLeftPanel = (props) => {
|
|
|
51
66
|
sx: styles,
|
|
52
67
|
className: clsx(
|
|
53
68
|
DEFAULT_CLASS,
|
|
69
|
+
leftPanelExpanded ? "left-panel-expanded" : "left-panel-collapsed",
|
|
54
70
|
className,
|
|
55
71
|
animation,
|
|
56
72
|
`col-md-${columnwidth} col-sm-${columnwidth} col-xs-${xscolumnwidth} ${navtype ? `app-nav-${navtype}` : ""} ${navheight ? `app-nav-${navheight}` : ""}`
|
|
57
73
|
),
|
|
58
|
-
children: render ? render(props) : children
|
|
74
|
+
children: /* @__PURE__ */ jsx(PartialContentWrapper, { content, children: render ? render(props) : children })
|
|
59
75
|
}
|
|
60
76
|
);
|
|
61
77
|
};
|
|
@@ -9,9 +9,10 @@ const getPageWidthClass = (device, panelWidth) => {
|
|
|
9
9
|
return `left-panel-container-${device}-${12 - width}`;
|
|
10
10
|
};
|
|
11
11
|
const getLeftPanelPageClasses = (layout) => {
|
|
12
|
+
const containerClass = layout.expanded ? "left-panel-expanded-container" : "left-panel-collapsed-container";
|
|
12
13
|
if (layout.animation === SLIDE_IN) {
|
|
13
14
|
return clsx(
|
|
14
|
-
|
|
15
|
+
containerClass,
|
|
15
16
|
"slide-in-left-panel-container",
|
|
16
17
|
getPageWidthClass("md", layout.columnwidth),
|
|
17
18
|
getPageWidthClass("sm", layout.columnwidth),
|
|
@@ -19,9 +20,9 @@ const getLeftPanelPageClasses = (layout) => {
|
|
|
19
20
|
);
|
|
20
21
|
}
|
|
21
22
|
if (layout.animation === SLIDE_OVER) {
|
|
22
|
-
return clsx(
|
|
23
|
+
return clsx(containerClass, "slide-over-left-panel-container");
|
|
23
24
|
}
|
|
24
|
-
return
|
|
25
|
+
return containerClass;
|
|
25
26
|
};
|
|
26
27
|
export {
|
|
27
28
|
getLeftPanelPageClasses
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import Box from "@mui/material/Box";
|
|
4
|
+
import { PartialContentWrapper } from "../../common";
|
|
4
5
|
const DEFAULT_CLASS = "app-right-panel";
|
|
5
6
|
const WmRightPanel = (props) => {
|
|
6
|
-
const { styles, children, render, className, columnwidth = 2, id } = props;
|
|
7
|
-
|
|
7
|
+
const { styles, children, render, className, columnwidth = 2, id, content } = props;
|
|
8
|
+
const rendered = render ? render(props) : children;
|
|
9
|
+
return /* @__PURE__ */ jsx(Box, { id, sx: styles, className: clsx(DEFAULT_CLASS, className, `col-sm-${columnwidth}`), children: /* @__PURE__ */ jsx(PartialContentWrapper, { content, children: rendered }) });
|
|
8
10
|
};
|
|
9
11
|
WmRightPanel.displayName = "WmRightPanel";
|
|
10
12
|
var rightnav_default = WmRightPanel;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import Box from "@mui/material/Box";
|
|
4
|
+
import { PartialContentWrapper } from "../../common";
|
|
4
5
|
const DEFAULT_CLASS = "app-top-nav";
|
|
5
6
|
const WmTopNav = (props) => {
|
|
6
|
-
const { styles, children, render, className, id } = props;
|
|
7
|
+
const { styles, children, render, className, id, content } = props;
|
|
8
|
+
const rendered = render ? render(props) : children;
|
|
7
9
|
return /* @__PURE__ */ jsx(
|
|
8
10
|
Box,
|
|
9
11
|
{
|
|
@@ -14,7 +16,7 @@ const WmTopNav = (props) => {
|
|
|
14
16
|
role: "navigation",
|
|
15
17
|
"aria-label": "Second level navigation",
|
|
16
18
|
"data-role": "page-topnav",
|
|
17
|
-
children:
|
|
19
|
+
children: /* @__PURE__ */ jsx(PartialContentWrapper, { content, children: rendered })
|
|
18
20
|
}
|
|
19
21
|
);
|
|
20
22
|
};
|