@wavemaker/react-runtime 11.14.2-rc.6311 → 12.0.0-next.28533
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/base-action.js +5 -7
- package/actions/login-action.js +7 -8
- package/actions/logout-action.js +5 -7
- package/actions/navigation-action.js +32 -10
- package/actions/notification-action.js +22 -8
- package/actions/timer-action.js +13 -15
- package/actions/toast.js +4 -2
- package/actions/toast.service.js +1 -2
- package/components/advanced/carousel/index.js +1 -1
- package/components/advanced/carousel/template.js +1 -1
- package/components/basic/anchor/index.js +26 -9
- package/components/basic/html/index.js +115 -24
- package/components/basic/icon/index.js +2 -1
- package/components/basic/iframe/index.js +2 -1
- package/components/basic/label/index.js +12 -9
- package/components/basic/message/index.js +12 -3
- package/components/basic/picture/index.js +11 -4
- package/components/basic/progress-bar/index.js +1 -1
- package/components/basic/progress-circle/index.js +34 -28
- package/components/basic/progress-circle/props.js +10 -2
- package/components/basic/richtexteditor/index.js +95 -94
- package/components/basic/search/index.js +401 -156
- package/components/basic/search/providers.js +126 -61
- package/components/basic/spinner/index.js +2 -1
- package/components/basic/tree/index.js +34 -34
- package/components/basic/tree/utils.js +10 -4
- package/components/chart/components/barColumnChart/index.js +36 -33
- package/components/chart/components/bubbleChart/index.js +35 -25
- package/components/chart/components/chartLegend/utils.js +2 -1
- package/components/chart/components/cumulativeLineChart/index.js +30 -26
- package/components/chart/components/lineAreaChart/index.js +50 -32
- package/components/chart/components/pieDonutChart/index.js +13 -4
- package/components/chart/hooks/useXAxisConfig.js +15 -8
- package/components/chart/index.js +223 -53
- package/components/chart/utils.js +12 -1
- package/components/constants.js +5 -2
- package/components/container/accordion/accordion-pane/index.js +17 -12
- package/components/container/accordion/index.js +9 -4
- package/components/container/alignment-utils.js +56 -1
- package/components/container/index.js +49 -20
- package/components/container/panel/components/panel-header/index.js +3 -4
- package/components/container/panel/index.js +15 -10
- package/components/container/tabs/index.js +92 -14
- package/components/container/tabs/tab-pane/index.js +15 -8
- package/components/container/tabs/utils.js +51 -0
- package/components/container/wizard/components/StepComponents.js +2 -1
- package/components/container/wizard/components/WizardStep.js +2 -1
- package/components/container/wizard/index.js +64 -35
- package/components/container/wizard/utils.js +46 -1
- package/components/container/wizard/wizard-step/index.js +11 -1
- package/components/data/card/card-content/index.js +1 -1
- package/components/data/form/base-form/index.js +991 -180
- package/components/data/form/base-form/props.js +3 -1
- package/components/data/form/base-form/utils.js +159 -1
- package/components/data/form/dynamic-fields/constant.js +53 -0
- package/components/data/form/dynamic-fields/index.js +10 -45
- package/components/data/form/dynamic-fields/utils.js +37 -2
- package/components/data/form/form-action/index.js +5 -4
- package/components/data/form/form-context.js +5 -1
- package/components/data/form/form-controller/utils.js +84 -0
- package/components/data/form/form-controller/validation-contrustor.js +402 -189
- package/components/data/form/form-controller/withFormController.js +191 -52
- package/components/data/form/form-field/base-field.js +54 -33
- package/components/data/form/form-field/index.js +28 -5
- package/components/data/form/form-header/index.js +3 -4
- package/components/data/form/index.js +20 -1
- package/components/data/list/components/ListDND.js +2 -1
- package/components/data/list/components/ListItem.js +6 -2
- package/components/data/list/components/ListItemWithTemplate.js +46 -2
- package/components/data/list/components/ListItems.js +17 -26
- package/components/data/list/components/ListPagination.js +3 -3
- package/components/data/list/components/StandardListItems.js +3 -4
- package/components/data/list/hooks/useListEffects.js +55 -14
- package/components/data/list/hooks/useListEventHandlers.js +3 -1
- package/components/data/list/hooks/useListState.js +3 -1
- package/components/data/list/hooks/usePaginatedGroupedData.js +18 -5
- package/components/data/list/index.js +74 -55
- package/components/data/list/utils/list-helpers.js +73 -35
- package/components/data/list/utils/list-widget-methods.js +138 -95
- package/components/data/live-filter/index.js +26 -15
- package/components/data/live-form/index.js +23 -7
- package/components/data/live-form/props.js +1 -1
- package/components/data/pagination/components/BasicPagination.js +71 -16
- package/components/data/pagination/components/PageSizeSelector.js +8 -3
- package/components/data/pagination/components/TotalRecords.js +1 -5
- package/components/data/pagination/hooks/usePagination.js +349 -66
- package/components/data/pagination/index.js +137 -19
- package/components/data/table/components/AddNewRow.js +5 -1
- package/components/data/table/components/EditableCell.js +2 -2
- package/components/data/table/components/RowCells.js +64 -0
- package/components/data/table/components/RowExpansionButton.js +2 -2
- package/components/data/table/components/SummaryCell.js +111 -0
- package/components/data/table/components/SummaryRow.js +54 -0
- package/components/data/table/components/SummaryRowFooter.js +46 -0
- package/components/data/table/components/TableBody.js +61 -59
- package/components/data/table/components/TableDataRow.js +109 -0
- package/components/data/table/components/TableFilters.js +225 -121
- package/components/data/table/components/TableHeader.js +291 -23
- package/components/data/table/components/TablePanelHeading.js +139 -8
- package/components/data/table/components/index.js +22 -1
- package/components/data/table/hooks/use-edited-rows.js +141 -0
- package/components/data/table/hooks/useCellState.js +5 -12
- package/components/data/table/hooks/useFormWidget.js +58 -51
- package/components/data/table/hooks/usePaginationState.js +45 -24
- package/components/data/table/hooks/usePanelStructure.js +4 -4
- package/components/data/table/hooks/useRowHandlers.js +39 -5
- package/components/data/table/hooks/useRowSelection.js +244 -50
- package/components/data/table/hooks/useServerSideSorting.js +81 -37
- package/components/data/table/hooks/useTableColumns.js +211 -118
- package/components/data/table/hooks/useTableData.js +54 -9
- package/components/data/table/hooks/useTableEdit.js +272 -97
- package/components/data/table/hooks/useTableEffects.js +31 -13
- package/components/data/table/hooks/useTableFilter.js +1 -1
- package/components/data/table/hooks/useTableInitialization.js +23 -22
- package/components/data/table/hooks/useTableState.js +11 -5
- package/components/data/table/hooks/useTableStateManager.js +140 -65
- package/components/data/table/index.js +637 -274
- package/components/data/table/live-table/index.js +54 -22
- package/components/data/table/table-action/index.js +1 -1
- package/components/data/table/table-group/index.js +26 -0
- package/components/data/table/table-row-action/index.js +32 -18
- package/components/data/table/utils/buildSelectionColumns.js +12 -21
- package/components/data/table/utils/columnBuilder.js +29 -14
- package/components/data/table/utils/columnProxy.js +68 -1
- package/components/data/table/utils/constants.js +6 -2
- package/components/data/table/utils/crud-handlers.js +68 -63
- package/components/data/table/utils/groupHeaderUtils.js +102 -0
- package/components/data/table/utils/index.js +210 -21
- package/components/data/table/utils/renderDisplayCell.js +6 -6
- package/components/data/table/utils/selectionUtils.js +25 -26
- package/components/data/table/utils/validation.js +1 -0
- package/components/data/utils/filter-field-util.js +3 -3
- package/components/dialogs/alert-dialog/index.js +1 -1
- package/components/dialogs/confirm-dialog/index.js +1 -1
- package/components/dialogs/dialog/index.js +4 -1
- package/components/dialogs/dialog-content/index.js +3 -1
- package/components/dialogs/dialog-header/index.js +2 -2
- package/components/dialogs/iframe-dialog/index.js +11 -5
- package/components/dialogs/index.js +1 -1
- package/components/dialogs/login-dialog/index.js +1 -1
- package/components/dialogs/page-dialog/index.js +1 -1
- package/components/form/button/index.js +33 -7
- package/components/input/calendar/index.js +18 -6
- package/components/input/chips/index.js +99 -28
- package/components/input/chips/utils.js +34 -4
- package/components/input/color-picker/index.js +74 -25
- package/components/input/composite/index.js +3 -3
- package/components/input/currency/index.js +35 -49
- package/components/input/default/checkbox/index.js +23 -28
- package/components/input/default/checkboxset/index.js +38 -18
- package/components/input/default/checkboxset/utils.js +30 -0
- package/components/input/default/radioset/index.js +36 -39
- package/components/input/default/switch/index.js +30 -13
- package/components/input/epoch/date/index.js +130 -69
- package/components/input/epoch/date/utils.js +94 -1
- package/components/input/epoch/datetime/index.js +72 -22
- package/components/input/epoch/datetime/utils.js +49 -10
- package/components/input/epoch/time/index.js +68 -19
- package/components/input/epoch/time/utils.js +62 -14
- package/components/input/fileupload/Utils.js +12 -7
- package/components/input/fileupload/components/MultiUpload.js +2 -6
- package/components/input/fileupload/components/SingleUpload.js +3 -7
- package/components/input/fileupload/index.js +6 -10
- package/components/input/fileupload/useFileUpload.js +16 -5
- package/components/input/number/index.js +158 -43
- package/components/input/rating/index.js +90 -7
- package/components/input/select/index.js +147 -70
- package/components/input/slider/index.js +84 -26
- package/components/input/text/index.js +38 -18
- package/components/input/text/util.js +283 -130
- package/components/input/textarea/index.js +13 -10
- package/components/input/upload/index.js +124 -0
- package/components/input/upload/props.js +5 -0
- package/components/input/util/index.js +11 -0
- package/components/navbar/index.js +51 -3
- package/components/navbar/nav/index.js +46 -16
- package/components/navbar/nav-item/index.js +11 -5
- package/components/navigation/menu/components/ListItems.js +3 -0
- package/components/navigation/menu/constants.js +2 -1
- package/components/navigation/menu/hooks/useHoverState.hook.js +48 -0
- package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +37 -0
- package/components/navigation/menu/hooks/useTransformedDataset.hook.js +15 -0
- package/components/navigation/menu/index.js +326 -188
- package/components/navigation/menu/utils/action-task.js +14 -0
- package/components/navigation/menu/utils/role-filter.js +76 -0
- package/components/navigation/popover/index.js +99 -26
- package/components/page/partial-container/index.js +34 -5
- package/components/prefab/index.js +2 -4
- package/context/PrefabContext.js +10 -6
- package/context/WidgetProvider.js +30 -31
- package/core/app.service.js +1 -1
- package/core/constants/events.js +57 -1
- package/core/dialog.service.js +1 -2
- package/core/event-notifier.js +1 -2
- package/core/formatter/array-formatters.js +33 -0
- package/core/formatter/date-formatters.js +2 -4
- package/core/formatter/index.js +2 -1
- package/core/formatter/number-formatters.js +5 -10
- package/core/formatter/security-formatters.js +2 -4
- package/core/formatter/string-formatters.js +3 -6
- package/core/proxy-service.js +84 -13
- package/core/script-registry.js +108 -48
- package/core/util/common.js +4 -4
- package/core/util/compare.js +30 -0
- package/core/util/dom.js +8 -8
- package/core/util/index.js +16 -6
- package/core/util/safe-is-equal.js +156 -0
- package/core/util/security.js +1 -2
- package/core/util/utils.js +16 -7
- package/higherOrder/BaseApp.js +108 -65
- package/higherOrder/BaseDateTime.js +31 -13
- package/higherOrder/BasePage.js +268 -144
- package/higherOrder/BasePartial.js +1 -1
- package/higherOrder/BasePrefab.js +33 -15
- package/higherOrder/DataNav.js +99 -16
- package/higherOrder/helper.js +5 -0
- package/higherOrder/withBaseWrapper.js +41 -28
- package/hooks/useAuth.js +11 -5
- package/hooks/useHttp.js +280 -94
- package/mui-config/theme-provider.js +1 -1
- package/mui-config/theme.js +1 -1
- package/package-lock.json +824 -724
- package/package.json +8 -8
- package/store/bindActions/i18nActions.js +18 -0
- package/store/index.js +3 -1
- package/store/slices/appConfigSlice.js +2 -2
- package/store/slices/authSlice.js +31 -28
- package/store/slices/i18nSlice.js +2 -2
- package/store/slices/navigationSlice.js +35 -0
- package/store/viewport.service.js +255 -0
- package/utils/attr.js +35 -0
- package/utils/dataset-util.js +1 -2
- package/utils/form-state.util.js +43 -12
- package/utils/form-utils.js +47 -2
- package/utils/format-util.js +28 -13
- package/utils/page-params-util.js +33 -1
- package/utils/state-persistance.js +72 -13
- package/utils/transformedDataset-utils.js +35 -24
- package/variables/base-variable.js +12 -14
- package/variables/crud-variable.js +225 -0
- package/variables/live-variable.js +56 -20
- package/variables/metadata.service.js +123 -0
- package/variables/model-variable.js +21 -15
- package/variables/service-variable.js +88 -83
package/actions/base-action.js
CHANGED
|
@@ -7,26 +7,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.BaseAction = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
13
|
var _baseVariable = require("@wavemaker/react-runtime/variables/base-variable");
|
|
14
14
|
var _lodashEs = require("lodash-es");
|
|
15
|
-
function
|
|
15
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
16
16
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
17
|
var BaseAction = exports.BaseAction = /*#__PURE__*/function (_BaseVariable) {
|
|
18
|
-
(0, _inherits2["default"])(BaseAction, _BaseVariable);
|
|
19
|
-
var _super = _createSuper(BaseAction);
|
|
20
18
|
function BaseAction(config) {
|
|
21
19
|
(0, _classCallCheck2["default"])(this, BaseAction);
|
|
22
|
-
return
|
|
20
|
+
return _callSuper(this, BaseAction, [config]);
|
|
23
21
|
}
|
|
24
|
-
(0,
|
|
22
|
+
(0, _inherits2["default"])(BaseAction, _BaseVariable);
|
|
23
|
+
return (0, _createClass2["default"])(BaseAction, [{
|
|
25
24
|
key: "setData",
|
|
26
25
|
value: function setData(dataSet) {
|
|
27
26
|
// @ts-ignore
|
|
28
27
|
this.dataSet = (0, _lodashEs.merge)(this.config.paramProvider(), dataSet);
|
|
29
28
|
}
|
|
30
29
|
}]);
|
|
31
|
-
return BaseAction;
|
|
32
30
|
}(_baseVariable.BaseVariable);
|
package/actions/login-action.js
CHANGED
|
@@ -7,28 +7,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.LoginAction = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
13
|
var _baseAction = require("./base-action");
|
|
14
14
|
var _baseVariable = require("../variables/base-variable");
|
|
15
15
|
var _get = _interopRequireDefault(require("lodash-es/get"));
|
|
16
|
-
|
|
16
|
+
var _merge = _interopRequireDefault(require("lodash-es/merge"));
|
|
17
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
17
18
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
19
|
var LoginAction = exports.LoginAction = /*#__PURE__*/function (_BaseAction) {
|
|
19
|
-
(0, _inherits2["default"])(LoginAction, _BaseAction);
|
|
20
|
-
var _super = _createSuper(LoginAction);
|
|
21
20
|
function LoginAction(config) {
|
|
22
21
|
(0, _classCallCheck2["default"])(this, LoginAction);
|
|
23
|
-
return
|
|
22
|
+
return _callSuper(this, LoginAction, [config]);
|
|
24
23
|
}
|
|
25
|
-
(0,
|
|
24
|
+
(0, _inherits2["default"])(LoginAction, _BaseAction);
|
|
25
|
+
return (0, _createClass2["default"])(LoginAction, [{
|
|
26
26
|
key: "invoke",
|
|
27
27
|
value: function invoke(options, successcb, errorcb) {
|
|
28
28
|
var _this = this;
|
|
29
29
|
var params;
|
|
30
30
|
if (!(0, _get["default"])(options, "formData")) {
|
|
31
|
-
params = this.config.paramProvider();
|
|
31
|
+
params = (0, _merge["default"])(this.config.paramProvider(), this.dataBinding);
|
|
32
32
|
}
|
|
33
33
|
this.notify(_baseVariable.VariableEvents.BEFORE_INVOKE, [this, params]);
|
|
34
34
|
return this.config.securityService().login({
|
|
@@ -49,5 +49,4 @@ var LoginAction = exports.LoginAction = /*#__PURE__*/function (_BaseAction) {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
}]);
|
|
52
|
-
return LoginAction;
|
|
53
52
|
}(_baseAction.BaseAction);
|
package/actions/logout-action.js
CHANGED
|
@@ -7,21 +7,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.LogoutAction = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
13
|
var _baseAction = require("./base-action");
|
|
14
14
|
var _baseVariable = require("../variables/base-variable");
|
|
15
|
-
function
|
|
15
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
16
16
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
17
|
var LogoutAction = exports.LogoutAction = /*#__PURE__*/function (_BaseAction) {
|
|
18
|
-
(0, _inherits2["default"])(LogoutAction, _BaseAction);
|
|
19
|
-
var _super = _createSuper(LogoutAction);
|
|
20
18
|
function LogoutAction(config) {
|
|
21
19
|
(0, _classCallCheck2["default"])(this, LogoutAction);
|
|
22
|
-
return
|
|
20
|
+
return _callSuper(this, LogoutAction, [config]);
|
|
23
21
|
}
|
|
24
|
-
(0,
|
|
22
|
+
(0, _inherits2["default"])(LogoutAction, _BaseAction);
|
|
23
|
+
return (0, _createClass2["default"])(LogoutAction, [{
|
|
25
24
|
key: "invoke",
|
|
26
25
|
value: function invoke(options, successcb, errorcb) {
|
|
27
26
|
var _this = this;
|
|
@@ -37,5 +36,4 @@ var LogoutAction = exports.LogoutAction = /*#__PURE__*/function (_BaseAction) {
|
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
38
|
}]);
|
|
40
|
-
return LogoutAction;
|
|
41
39
|
}(_baseAction.BaseAction);
|
|
@@ -8,34 +8,45 @@ exports.NavigationAction = void 0;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
15
|
var _baseVariable = require("@wavemaker/react-runtime/variables/base-variable");
|
|
16
16
|
var _baseAction = require("./base-action");
|
|
17
17
|
var _lodashEs = require("lodash-es");
|
|
18
18
|
var _navigationMiddleware = require("@wavemaker/react-runtime/store/middleware/navigationMiddleware");
|
|
19
19
|
var _constants = require("../core/constants");
|
|
20
|
-
|
|
20
|
+
var _store = require("@wavemaker/react-runtime/store");
|
|
21
|
+
var _navigationSlice = require("@wavemaker/react-runtime/store/slices/navigationSlice");
|
|
22
|
+
var _statePersistance = require("@wavemaker/react-runtime/utils/state-persistance");
|
|
23
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
21
24
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
25
|
+
function _superPropGet(t, o, e, r) { var p = (0, _get2["default"])((0, _getPrototypeOf2["default"])(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
22
26
|
var NavigationAction = exports.NavigationAction = /*#__PURE__*/function (_BaseAction) {
|
|
23
|
-
(0, _inherits2["default"])(NavigationAction, _BaseAction);
|
|
24
|
-
var _super = _createSuper(NavigationAction);
|
|
25
27
|
function NavigationAction(config) {
|
|
26
28
|
(0, _classCallCheck2["default"])(this, NavigationAction);
|
|
27
|
-
return
|
|
29
|
+
return _callSuper(this, NavigationAction, [config]);
|
|
28
30
|
}
|
|
29
|
-
(0,
|
|
31
|
+
(0, _inherits2["default"])(NavigationAction, _BaseAction);
|
|
32
|
+
return (0, _createClass2["default"])(NavigationAction, [{
|
|
30
33
|
key: "invoke",
|
|
31
34
|
value: function invoke(params, onSuccess, onError) {
|
|
32
35
|
var _params,
|
|
33
36
|
_this = this;
|
|
34
37
|
var config = this.config;
|
|
38
|
+
|
|
39
|
+
// Mark page navigation as pending SYNCHRONOUSLY before any async operations.
|
|
40
|
+
// This prevents URL state persistence (router.replace) from overwriting the navigation (router.push)
|
|
41
|
+
// when click events bubble up to parent widgets (like List) that persist state.
|
|
42
|
+
if (config.operation === "gotoPage" || config.operation === "goToPreviousPage") {
|
|
43
|
+
(0, _statePersistance.markPageNavigationPending)();
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
// @ts-ignore
|
|
36
47
|
params = (_params = params) !== null && _params !== void 0 && _params.data ? (0, _lodashEs.merge)(this.config.paramProvider(), params.data) : (0, _lodashEs.merge)(this.config.paramProvider(), this.dataSet);
|
|
37
48
|
this.notify(_baseVariable.VariableEvents.BEFORE_INVOKE, [this, this.dataSet]);
|
|
38
|
-
return (
|
|
49
|
+
return _superPropGet(NavigationAction, "invoke", this, 3)([params, onSuccess, onError]).then(function () {
|
|
39
50
|
switch (config.operation) {
|
|
40
51
|
case "goToPreviousPage":
|
|
41
52
|
_this.handleGoToPreviousPage();
|
|
@@ -55,6 +66,8 @@ var NavigationAction = exports.NavigationAction = /*#__PURE__*/function (_BaseAc
|
|
|
55
66
|
}, function () {
|
|
56
67
|
config.onError && config.onError(_this, null);
|
|
57
68
|
_this.notify(_baseVariable.VariableEvents.ERROR, [_this, _this.dataSet]);
|
|
69
|
+
// Clear the flag on error so future state persistence works
|
|
70
|
+
(0, _statePersistance.clearPageNavigationPending)();
|
|
58
71
|
}).then(function () {
|
|
59
72
|
_this.notify(_baseVariable.VariableEvents.AFTER_INVOKE, [_this, _this.dataSet]);
|
|
60
73
|
return _this;
|
|
@@ -104,8 +117,18 @@ var NavigationAction = exports.NavigationAction = /*#__PURE__*/function (_BaseAc
|
|
|
104
117
|
value: function handleGotoAccordion(params) {
|
|
105
118
|
var _this$config$_context2;
|
|
106
119
|
var accordionName = params === null || params === void 0 ? void 0 : params.accordionName;
|
|
120
|
+
var pageName = params === null || params === void 0 ? void 0 : params.pageName;
|
|
121
|
+
|
|
122
|
+
// If on the same page, expand the accordion directly
|
|
107
123
|
if (accordionName && (_this$config$_context2 = this.config._context) !== null && _this$config$_context2 !== void 0 && (_this$config$_context2 = _this$config$_context2.Widgets[accordionName]) !== null && _this$config$_context2 !== void 0 && _this$config$_context2.expand) {
|
|
108
|
-
|
|
124
|
+
var _this$config$_context3;
|
|
125
|
+
(_this$config$_context3 = this.config._context) === null || _this$config$_context3 === void 0 || (_this$config$_context3 = _this$config$_context3.Widgets[accordionName]) === null || _this$config$_context3 === void 0 || _this$config$_context3.expand();
|
|
126
|
+
} else if (pageName && accordionName) {
|
|
127
|
+
// If navigating to a different page, store accordion name in Redux and navigate
|
|
128
|
+
// Store the accordion expansion intent in Redux to be executed after page load
|
|
129
|
+
_store.store.dispatch((0, _navigationSlice.setPendingAccordionExpansion)(accordionName));
|
|
130
|
+
// Navigate to the page
|
|
131
|
+
this.handleGotoPage(params);
|
|
109
132
|
} else {
|
|
110
133
|
console.warn("Unable to expand accordion: ".concat(accordionName));
|
|
111
134
|
}
|
|
@@ -143,5 +166,4 @@ var NavigationAction = exports.NavigationAction = /*#__PURE__*/function (_BaseAc
|
|
|
143
166
|
}
|
|
144
167
|
}
|
|
145
168
|
}]);
|
|
146
|
-
return NavigationAction;
|
|
147
169
|
}(_baseAction.BaseAction);
|
|
@@ -8,17 +8,19 @@ exports.NotificationAction = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
15
|
var _baseAction = require("./base-action");
|
|
15
16
|
var _baseVariable = require("@wavemaker/react-runtime/variables/base-variable");
|
|
16
17
|
var _lodashEs = require("lodash-es");
|
|
17
18
|
var _toast = require("./toast.service");
|
|
18
19
|
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; }
|
|
19
20
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
-
function
|
|
21
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
21
22
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
23
|
+
function _superPropGet(t, o, e, r) { var p = (0, _get2["default"])((0, _getPrototypeOf2["default"])(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
22
24
|
var DEFAULT_DURATION = 3000;
|
|
23
25
|
var NOTIFICATION_TYPE = {
|
|
24
26
|
success: "success",
|
|
@@ -28,18 +30,30 @@ var NOTIFICATION_TYPE = {
|
|
|
28
30
|
info: "info"
|
|
29
31
|
};
|
|
30
32
|
var NotificationAction = exports.NotificationAction = /*#__PURE__*/function (_BaseAction) {
|
|
31
|
-
(0, _inherits2["default"])(NotificationAction, _BaseAction);
|
|
32
|
-
var _super = _createSuper(NotificationAction);
|
|
33
33
|
function NotificationAction(config) {
|
|
34
34
|
(0, _classCallCheck2["default"])(this, NotificationAction);
|
|
35
|
-
return
|
|
35
|
+
return _callSuper(this, NotificationAction, [config]);
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
// Backward-compatible API: used `notify()`. Support both shapes.
|
|
39
|
+
(0, _inherits2["default"])(NotificationAction, _BaseAction);
|
|
40
|
+
return (0, _createClass2["default"])(NotificationAction, [{
|
|
41
|
+
key: "notify",
|
|
42
|
+
value: function notify(arg1, arg2, arg3) {
|
|
43
|
+
if (typeof arg1 === "string") {
|
|
44
|
+
// Delegate to BaseAction event notifier
|
|
45
|
+
return _superPropGet(NotificationAction, "notify", this, 3)([arg1, Array.isArray(arg2) ? arg2 : [], typeof arg3 === "boolean" ? arg3 : false]);
|
|
46
|
+
}
|
|
47
|
+
// Backward-compat path for notify()
|
|
48
|
+
return this.invoke(arg1, arg2, arg3);
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
38
51
|
key: "prepareToastOptions",
|
|
39
52
|
value: function prepareToastOptions() {
|
|
40
53
|
var _String$toLowerCase,
|
|
41
54
|
_String,
|
|
42
55
|
_mergedParams$toaster,
|
|
56
|
+
_mergedParams$showTyp,
|
|
43
57
|
_this = this;
|
|
44
58
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
45
59
|
var configParams = this.config.paramProvider();
|
|
@@ -48,7 +62,7 @@ var NotificationAction = exports.NotificationAction = /*#__PURE__*/function (_Ba
|
|
|
48
62
|
var type = NOTIFICATION_TYPE[alertClass] || "info";
|
|
49
63
|
|
|
50
64
|
// get toast position
|
|
51
|
-
var position = (_mergedParams$toaster = mergedParams.toasterPosition) !== null && _mergedParams$toaster !== void 0 ? _mergedParams$toaster : "
|
|
65
|
+
var position = (_mergedParams$toaster = mergedParams.toasterPosition) !== null && _mergedParams$toaster !== void 0 ? _mergedParams$toaster : "bottom right";
|
|
52
66
|
|
|
53
67
|
// Determine duration (0 means stay until dismissed)
|
|
54
68
|
var duration = parseInt(String(mergedParams.duration));
|
|
@@ -66,6 +80,7 @@ var NotificationAction = exports.NotificationAction = /*#__PURE__*/function (_Ba
|
|
|
66
80
|
name: this.name,
|
|
67
81
|
styles: mergedParams.styles || {},
|
|
68
82
|
hideOnClick: mergedParams.hideOnClick !== false,
|
|
83
|
+
showTypeLabel: (_mergedParams$showTyp = mergedParams.showTypeLabel) !== null && _mergedParams$showTyp !== void 0 ? _mergedParams$showTyp : false,
|
|
69
84
|
onClose: function onClose() {
|
|
70
85
|
if (_this.config.onClose) {
|
|
71
86
|
_this.config.onClose(_this, null);
|
|
@@ -146,5 +161,4 @@ var NotificationAction = exports.NotificationAction = /*#__PURE__*/function (_Ba
|
|
|
146
161
|
key: "getMessage",
|
|
147
162
|
value: function getMessage() {}
|
|
148
163
|
}]);
|
|
149
|
-
return NotificationAction;
|
|
150
164
|
}(_baseAction.BaseAction);
|
package/actions/timer-action.js
CHANGED
|
@@ -7,31 +7,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.TimerAction = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
13
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
15
|
var _baseAction = require("./base-action");
|
|
17
16
|
var _baseVariable = require("@wavemaker/react-runtime/variables/base-variable");
|
|
18
17
|
var _lodashEs = require("lodash-es");
|
|
19
|
-
function
|
|
18
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
20
19
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
|
+
function _superPropGet(t, o, e, r) { var p = (0, _get2["default"])((0, _getPrototypeOf2["default"])(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
21
21
|
var TimerAction = exports.TimerAction = /*#__PURE__*/function (_BaseAction) {
|
|
22
|
-
(0, _inherits2["default"])(TimerAction, _BaseAction);
|
|
23
|
-
var _super = _createSuper(TimerAction);
|
|
24
22
|
function TimerAction(config) {
|
|
25
23
|
var _this;
|
|
26
24
|
(0, _classCallCheck2["default"])(this, TimerAction);
|
|
27
|
-
_this =
|
|
28
|
-
(0, _defineProperty2["default"])(
|
|
29
|
-
(0, _defineProperty2["default"])(
|
|
30
|
-
(0, _defineProperty2["default"])(
|
|
31
|
-
(0, _defineProperty2["default"])(
|
|
25
|
+
_this = _callSuper(this, TimerAction, [config]);
|
|
26
|
+
(0, _defineProperty2["default"])(_this, "_timerId", -1);
|
|
27
|
+
(0, _defineProperty2["default"])(_this, "_isActive", false);
|
|
28
|
+
(0, _defineProperty2["default"])(_this, "_onSuccess", void 0);
|
|
29
|
+
(0, _defineProperty2["default"])(_this, "_onError", void 0);
|
|
32
30
|
return _this;
|
|
33
31
|
}
|
|
34
|
-
(0,
|
|
32
|
+
(0, _inherits2["default"])(TimerAction, _BaseAction);
|
|
33
|
+
return (0, _createClass2["default"])(TimerAction, [{
|
|
35
34
|
key: "invoke",
|
|
36
35
|
value: function invoke(params, onSuccess, onError) {
|
|
37
36
|
var _params,
|
|
@@ -40,7 +39,7 @@ var TimerAction = exports.TimerAction = /*#__PURE__*/function (_BaseAction) {
|
|
|
40
39
|
|
|
41
40
|
// Notify that we're about to invoke
|
|
42
41
|
this.notify(_baseVariable.VariableEvents.BEFORE_INVOKE, [this, this.dataSet]);
|
|
43
|
-
return (
|
|
42
|
+
return _superPropGet(TimerAction, "invoke", this, 3)([params, onSuccess, onError]).then(function () {
|
|
44
43
|
// Start the timer
|
|
45
44
|
_this2.startTimer();
|
|
46
45
|
|
|
@@ -157,8 +156,7 @@ var TimerAction = exports.TimerAction = /*#__PURE__*/function (_BaseAction) {
|
|
|
157
156
|
key: "destroy",
|
|
158
157
|
value: function destroy() {
|
|
159
158
|
this.cancel();
|
|
160
|
-
(
|
|
159
|
+
_superPropGet(TimerAction, "destroy", this, 3)([]);
|
|
161
160
|
}
|
|
162
161
|
}]);
|
|
163
|
-
return TimerAction;
|
|
164
162
|
}(_baseAction.BaseAction);
|
package/actions/toast.js
CHANGED
|
@@ -34,7 +34,9 @@ var CustomToast = function CustomToast(_ref) {
|
|
|
34
34
|
type = _toast$type === void 0 ? "info" : _toast$type,
|
|
35
35
|
_toast$position = toast.position,
|
|
36
36
|
position = _toast$position === void 0 ? toast.placement || _types.TOAST_CONFIG.DEFAULT_POSITION : _toast$position,
|
|
37
|
-
onClick = toast.onClick
|
|
37
|
+
onClick = toast.onClick,
|
|
38
|
+
_toast$showTypeLabel = toast.showTypeLabel,
|
|
39
|
+
showTypeLabel = _toast$showTypeLabel === void 0 ? false : _toast$showTypeLabel;
|
|
38
40
|
var ispage = toast.content && (0, _typeof2["default"])(toast.content) === "object";
|
|
39
41
|
var handleClick = function handleClick(e) {
|
|
40
42
|
if (onClick) {
|
|
@@ -79,7 +81,7 @@ var CustomToast = function CustomToast(_ref) {
|
|
|
79
81
|
disableWindowBlurListener: true,
|
|
80
82
|
message: __jsx("div", {
|
|
81
83
|
className: "toast-title"
|
|
82
|
-
}, type.toUpperCase(), __jsx("div", {
|
|
84
|
+
}, showTypeLabel && type.toUpperCase(), __jsx("div", {
|
|
83
85
|
className: "toast-message"
|
|
84
86
|
}, text)),
|
|
85
87
|
TransitionProps: {
|
package/actions/toast.service.js
CHANGED
|
@@ -28,7 +28,7 @@ var ToastService = /*#__PURE__*/function () {
|
|
|
28
28
|
this.setContext = this.setContext.bind(this);
|
|
29
29
|
ToastService.instance = this;
|
|
30
30
|
}
|
|
31
|
-
(0, _createClass2["default"])(ToastService, [{
|
|
31
|
+
return (0, _createClass2["default"])(ToastService, [{
|
|
32
32
|
key: "setContext",
|
|
33
33
|
value: function setContext(context) {
|
|
34
34
|
this.context = context;
|
|
@@ -75,7 +75,6 @@ var ToastService = /*#__PURE__*/function () {
|
|
|
75
75
|
this.context.hideAllToasts();
|
|
76
76
|
}
|
|
77
77
|
}]);
|
|
78
|
-
return ToastService;
|
|
79
78
|
}(); // Create singleton instance
|
|
80
79
|
_ToastService = ToastService;
|
|
81
80
|
(0, _defineProperty2["default"])(ToastService, "instance", void 0);
|
|
@@ -188,7 +188,7 @@ var WmCarousel = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
188
188
|
return newIndex;
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
-
}, animationinterval *
|
|
191
|
+
}, animationinterval * 500);
|
|
192
192
|
}
|
|
193
193
|
}, [animation, animationinterval, itemCount, isPaused]);
|
|
194
194
|
var stopAutoPlay = (0, _react.useCallback)(function () {
|
|
@@ -18,7 +18,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
18
18
|
var __jsx = _react["default"].createElement;
|
|
19
19
|
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; }
|
|
20
20
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
-
var DEFAULT_CLASS = "app-carousel-item";
|
|
21
|
+
var DEFAULT_CLASS = "app-carousel-item item";
|
|
22
22
|
var WmCarouselTemplate = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
23
23
|
var name = props.name,
|
|
24
24
|
_props$horizontalalig = props.horizontalalign,
|
|
@@ -24,14 +24,14 @@ var __jsx = _react["default"].createElement;
|
|
|
24
24
|
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; }
|
|
25
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
26
26
|
// Define regex outside component to avoid recreation on each render
|
|
27
|
-
var GO_TO_PAGE_REGEX = /(?:\w+\?\.)?Actions(?:\?\.)?goToPage_(\w+)(?:\?\.)?invoke
|
|
27
|
+
var GO_TO_PAGE_REGEX = /(?:\w+\?\.)?Actions(?:\?\.)?goToPage_(\w+)(?:\?\.)?invoke(?:\?\.)?\(\)/;
|
|
28
28
|
var DEFAULT_CLASS = "app-anchor";
|
|
29
29
|
var getCurrentPageName = function getCurrentPageName(pathname) {
|
|
30
30
|
var segments = pathname.split("/").filter(Boolean);
|
|
31
31
|
return segments[segments.length - 1];
|
|
32
32
|
};
|
|
33
33
|
var WmAnchor = exports.WmAnchor = function WmAnchor(props) {
|
|
34
|
-
var
|
|
34
|
+
var _listener$appLocale;
|
|
35
35
|
var _props$caption = props.caption,
|
|
36
36
|
caption = _props$caption === void 0 ? "Link" : _props$caption,
|
|
37
37
|
iconclass = props.iconclass,
|
|
@@ -57,6 +57,7 @@ var WmAnchor = exports.WmAnchor = function WmAnchor(props) {
|
|
|
57
57
|
var _useState = (0, _react.useState)(false),
|
|
58
58
|
isActive = _useState[0],
|
|
59
59
|
setIsActive = _useState[1];
|
|
60
|
+
var linkRef = (0, _react.useRef)(null);
|
|
60
61
|
|
|
61
62
|
// Extract navigation info from onClick
|
|
62
63
|
var navigationInfo = (0, _react.useMemo)(function () {
|
|
@@ -118,6 +119,16 @@ var WmAnchor = exports.WmAnchor = function WmAnchor(props) {
|
|
|
118
119
|
var activeByNavigationExpr = navigationInfo.isCurrentPage;
|
|
119
120
|
setIsActive(activeByHyperlink || activeByNavigationExpr);
|
|
120
121
|
}, [caption, path, doesHyperlinkMatchCurrentPath, navigationInfo.isCurrentPage, itemLink]);
|
|
122
|
+
(0, _react.useEffect)(function () {
|
|
123
|
+
if (!linkRef.current) return;
|
|
124
|
+
if (!hyperlink) {
|
|
125
|
+
// Same as Angular: if no hyperlink, set javascript:void(0)
|
|
126
|
+
linkRef.current.setAttribute("href", "javascript:void(0)");
|
|
127
|
+
} else {
|
|
128
|
+
// If there is a hyperlink, set the processed link
|
|
129
|
+
linkRef.current.setAttribute("href", processedHyperlink);
|
|
130
|
+
}
|
|
131
|
+
}, [hyperlink, processedHyperlink]);
|
|
121
132
|
|
|
122
133
|
// Calculate icon position styles
|
|
123
134
|
var iconPositionStyles = (0, _react.useMemo)(function () {
|
|
@@ -136,7 +147,7 @@ var WmAnchor = exports.WmAnchor = function WmAnchor(props) {
|
|
|
136
147
|
e.preventDefault();
|
|
137
148
|
}
|
|
138
149
|
if (onClick) {
|
|
139
|
-
onClick(e);
|
|
150
|
+
onClick(e, props);
|
|
140
151
|
}
|
|
141
152
|
};
|
|
142
153
|
function handleMouseEnter(event) {
|
|
@@ -180,17 +191,21 @@ var WmAnchor = exports.WmAnchor = function WmAnchor(props) {
|
|
|
180
191
|
onClick: handleClick
|
|
181
192
|
});
|
|
182
193
|
var iconstyles = {
|
|
183
|
-
height: iconheight
|
|
184
|
-
width: iconwidth
|
|
194
|
+
height: iconheight,
|
|
195
|
+
width: iconwidth,
|
|
185
196
|
margin: iconmargin || "0 4"
|
|
186
197
|
};
|
|
187
|
-
return __jsx(_Link["default"], (0, _extends2["default"])({
|
|
198
|
+
return __jsx(_Link["default"], (0, _extends2["default"])({
|
|
199
|
+
ref: linkRef
|
|
200
|
+
}, domEvents, {
|
|
188
201
|
style: _objectSpread(_objectSpread({}, iconPositionStyles), styles),
|
|
202
|
+
sx: {
|
|
203
|
+
padding: 0
|
|
204
|
+
},
|
|
189
205
|
caption: caption,
|
|
190
206
|
role: "link",
|
|
191
207
|
tabIndex: props.tabindex,
|
|
192
|
-
className: (0, _clsx2["default"])((
|
|
193
|
-
href: processedHyperlink,
|
|
208
|
+
className: (0, _clsx2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, DEFAULT_CLASS, true), className || "", Boolean(className)), "active", isActive)),
|
|
194
209
|
onContextMenu: handleContextMenu,
|
|
195
210
|
accessKey: shortcutkey,
|
|
196
211
|
"aria-label": arialabel || (badgevalue && caption ? "".concat(caption, " ").concat(badgevalue) : caption) || null,
|
|
@@ -198,7 +213,9 @@ var WmAnchor = exports.WmAnchor = function WmAnchor(props) {
|
|
|
198
213
|
target: target,
|
|
199
214
|
title: props.hint,
|
|
200
215
|
"data-identifier": "anchor"
|
|
201
|
-
}, restProps
|
|
216
|
+
}, restProps, {
|
|
217
|
+
name: props.name
|
|
218
|
+
}), iconurl && __jsx(_image["default"], {
|
|
202
219
|
alt: "Image",
|
|
203
220
|
src: iconurl,
|
|
204
221
|
className: (0, _clsx2["default"])("anchor-image-icon", iconclass),
|