@wavemaker/react-runtime 11.14.1-16.6404
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 +32 -0
- package/actions/login-action.js +53 -0
- package/actions/logout-action.js +41 -0
- package/actions/navigation-action.js +145 -0
- package/actions/notification-action.js +147 -0
- package/actions/timer-action.js +164 -0
- package/actions/toast-provider.js +111 -0
- package/actions/toast.js +115 -0
- package/actions/toast.service.js +94 -0
- package/actions/types/index.js +11 -0
- package/components/advanced/carousel/index.js +456 -0
- package/components/advanced/carousel/props.js +5 -0
- package/components/advanced/carousel/template.js +72 -0
- package/components/advanced/login/index.js +307 -0
- package/components/advanced/login/props.js +5 -0
- package/components/advanced/marquee/index.js +158 -0
- package/components/advanced/marquee/props.js +5 -0
- package/components/basic/anchor/index.js +239 -0
- package/components/basic/anchor/props.js +5 -0
- package/components/basic/audio/index.js +61 -0
- package/components/basic/html/index.js +158 -0
- package/components/basic/icon/index.js +85 -0
- package/components/basic/iframe/iframe.utils.js +10 -0
- package/components/basic/iframe/index.js +95 -0
- package/components/basic/label/index.js +139 -0
- package/components/basic/message/index.js +120 -0
- package/components/basic/message/props.js +5 -0
- package/components/basic/picture/index.js +117 -0
- package/components/basic/picture/props.js +5 -0
- package/components/basic/progress-bar/index.js +168 -0
- package/components/basic/progress-bar/props.js +18 -0
- package/components/basic/progress-circle/index.js +196 -0
- package/components/basic/progress-circle/props.js +16 -0
- package/components/basic/richtexteditor/index.js +533 -0
- package/components/basic/richtexteditor/props.js +5 -0
- package/components/basic/search/index.js +1023 -0
- package/components/basic/search/props.js +5 -0
- package/components/basic/search/providers.js +350 -0
- package/components/basic/spinner/index.js +202 -0
- package/components/basic/spinner/props.js +12 -0
- package/components/basic/tile/index.js +91 -0
- package/components/basic/tree/Components/TreeNodeComponent.js +142 -0
- package/components/basic/tree/index.js +503 -0
- package/components/basic/tree/props.js +5 -0
- package/components/basic/tree/utils.js +154 -0
- package/components/basic/video/index.js +85 -0
- package/components/basic/video/props.js +5 -0
- package/components/chart/components/barColumnChart/index.js +132 -0
- package/components/chart/components/barColumnChart/props.js +5 -0
- package/components/chart/components/bubbleChart/index.js +176 -0
- package/components/chart/components/bubbleChart/props.js +5 -0
- package/components/chart/components/chartLegend/components/ClassicLegendItem.js +39 -0
- package/components/chart/components/chartLegend/components/FuriousLegendItem.js +81 -0
- package/components/chart/components/chartLegend/index.js +69 -0
- package/components/chart/components/chartLegend/props.js +5 -0
- package/components/chart/components/chartLegend/utils.js +31 -0
- package/components/chart/components/chartTooltip/index.js +53 -0
- package/components/chart/components/chartTooltip/styles.js +37 -0
- package/components/chart/components/chartTooltip/utils.js +23 -0
- package/components/chart/components/cumulativeLineChart/index.js +113 -0
- package/components/chart/components/cumulativeLineChart/props.js +5 -0
- package/components/chart/components/cumulativeLineChart/utils.js +34 -0
- package/components/chart/components/index.js +40 -0
- package/components/chart/components/lineAreaChart/index.js +140 -0
- package/components/chart/components/lineAreaChart/props.js +5 -0
- package/components/chart/components/noDataMessage/index.js +27 -0
- package/components/chart/components/pieDonutChart/index.js +171 -0
- package/components/chart/components/pieDonutChart/props.js +5 -0
- package/components/chart/constant.js +72 -0
- package/components/chart/index.js +930 -0
- package/components/chart/props.js +5 -0
- package/components/chart/utils.js +691 -0
- package/components/common/AppSpinner.js +36 -0
- package/components/common/app-spinner.js +26 -0
- package/components/common/index.js +12 -0
- package/components/constants.js +1208 -0
- package/components/container/accordion/accordion-pane/index.js +108 -0
- package/components/container/accordion/accordion-pane/props.js +11 -0
- package/components/container/accordion/index.js +232 -0
- package/components/container/accordion/props.js +13 -0
- package/components/container/alignment-utils.js +183 -0
- package/components/container/index.js +188 -0
- package/components/container/layout-grid/grid-column/index.js +34 -0
- package/components/container/layout-grid/grid-row/index.js +24 -0
- package/components/container/layout-grid/index.js +33 -0
- package/components/container/linear-layout/index.js +72 -0
- package/components/container/linear-layout/linear-layout-item/index.js +43 -0
- package/components/container/panel/components/panel-header/index.js +144 -0
- package/components/container/panel/components/panel-header/props.js +5 -0
- package/components/container/panel/hooks.js +144 -0
- package/components/container/panel/index.js +286 -0
- package/components/container/panel/props.js +5 -0
- package/components/container/props.js +5 -0
- package/components/container/tabs/index.js +379 -0
- package/components/container/tabs/props.js +20 -0
- package/components/container/tabs/tab-pane/index.js +42 -0
- package/components/container/tabs/tab-pane/props.js +5 -0
- package/components/container/wizard/WizardContext.js +16 -0
- package/components/container/wizard/components/StepComponents.js +100 -0
- package/components/container/wizard/components/WizardStep.js +89 -0
- package/components/container/wizard/index.js +710 -0
- package/components/container/wizard/props.js +5 -0
- package/components/container/wizard/utils.js +133 -0
- package/components/container/wizard/wizard-action/index.js +22 -0
- package/components/container/wizard/wizard-step/index.js +94 -0
- package/components/data/card/card-actions/index.js +24 -0
- package/components/data/card/card-content/index.js +38 -0
- package/components/data/card/card-footer/index.js +24 -0
- package/components/data/card/index.js +246 -0
- package/components/data/card/props.js +5 -0
- package/components/data/form/base-form/constant.js +39 -0
- package/components/data/form/base-form/index.js +460 -0
- package/components/data/form/base-form/props.js +29 -0
- package/components/data/form/base-form/utils.js +42 -0
- package/components/data/form/dynamic-fields/index.js +196 -0
- package/components/data/form/dynamic-fields/props.js +5 -0
- package/components/data/form/dynamic-fields/utils.js +237 -0
- package/components/data/form/form-action/index.js +71 -0
- package/components/data/form/form-body/index.js +26 -0
- package/components/data/form/form-context.js +34 -0
- package/components/data/form/form-controller/props.js +19 -0
- package/components/data/form/form-controller/validation-contrustor.js +313 -0
- package/components/data/form/form-controller/withFormController.js +320 -0
- package/components/data/form/form-field/base-field.js +138 -0
- package/components/data/form/form-field/index.js +36 -0
- package/components/data/form/form-field/props.js +5 -0
- package/components/data/form/form-footer/index.js +26 -0
- package/components/data/form/form-header/index.js +56 -0
- package/components/data/form/index.js +39 -0
- package/components/data/form/props.js +5 -0
- package/components/data/list/components/GroupHeader.js +35 -0
- package/components/data/list/components/GroupedListItems.js +98 -0
- package/components/data/list/components/ListContainer.js +27 -0
- package/components/data/list/components/ListDND.js +241 -0
- package/components/data/list/components/ListHeader.js +59 -0
- package/components/data/list/components/ListItem.js +148 -0
- package/components/data/list/components/ListItemWithTemplate.js +59 -0
- package/components/data/list/components/ListItems.js +231 -0
- package/components/data/list/components/ListPagination.js +165 -0
- package/components/data/list/components/LoadMoreButton.js +39 -0
- package/components/data/list/components/NoDataMessage.js +22 -0
- package/components/data/list/components/StandardListItems.js +84 -0
- package/components/data/list/components/index.js +119 -0
- package/components/data/list/components/props.js +5 -0
- package/components/data/list/hooks/index.js +75 -0
- package/components/data/list/hooks/props.js +5 -0
- package/components/data/list/hooks/useCurrentPageItems.js +48 -0
- package/components/data/list/hooks/useGroupedData.js +37 -0
- package/components/data/list/hooks/useListData.js +60 -0
- package/components/data/list/hooks/useListEffects.js +285 -0
- package/components/data/list/hooks/useListEventHandlers.js +291 -0
- package/components/data/list/hooks/useListPagination.js +168 -0
- package/components/data/list/hooks/useListState.js +98 -0
- package/components/data/list/hooks/useListStateManager.js +195 -0
- package/components/data/list/hooks/usePaginatedGroupedData.js +121 -0
- package/components/data/list/index.js +611 -0
- package/components/data/list/props.js +5 -0
- package/components/data/list/templates/media-template.js +53 -0
- package/components/data/list/utils/constants.js +81 -0
- package/components/data/list/utils/list-helpers.js +173 -0
- package/components/data/list/utils/list-widget-methods.js +114 -0
- package/components/data/live-filter/index.js +279 -0
- package/components/data/live-filter/props.js +12 -0
- package/components/data/live-form/index.js +93 -0
- package/components/data/live-form/props.js +16 -0
- package/components/data/pagination/components/BasicPagination.js +77 -0
- package/components/data/pagination/components/ClassicPagination.js +191 -0
- package/components/data/pagination/components/InlinePagination.js +99 -0
- package/components/data/pagination/components/LoadingComponent.js +31 -0
- package/components/data/pagination/components/PageSizeSelector.js +175 -0
- package/components/data/pagination/components/PagerNavigation.js +105 -0
- package/components/data/pagination/components/TotalRecords.js +52 -0
- package/components/data/pagination/components/index.js +47 -0
- package/components/data/pagination/components/props.js +5 -0
- package/components/data/pagination/hooks/index.js +19 -0
- package/components/data/pagination/hooks/props.js +5 -0
- package/components/data/pagination/hooks/useNavigationSize.js +44 -0
- package/components/data/pagination/hooks/usePagination.js +796 -0
- package/components/data/pagination/index.js +322 -0
- package/components/data/table/components/AddNewRow.js +190 -0
- package/components/data/table/components/EditableCell.js +91 -0
- package/components/data/table/components/FieldValidationError.js +24 -0
- package/components/data/table/components/RowExpansionButton.js +74 -0
- package/components/data/table/components/TableBody.js +279 -0
- package/components/data/table/components/TableFilters.js +325 -0
- package/components/data/table/components/TableFooterActions.js +48 -0
- package/components/data/table/components/TableHeader.js +174 -0
- package/components/data/table/components/TablePanelHeading.js +68 -0
- package/components/data/table/components/index.js +74 -0
- package/components/data/table/hooks/index.js +219 -0
- package/components/data/table/hooks/useCellState.js +117 -0
- package/components/data/table/hooks/useDynamicColumns.js +85 -0
- package/components/data/table/hooks/useEditingState.js +47 -0
- package/components/data/table/hooks/useFormWidget.js +184 -0
- package/components/data/table/hooks/usePaginationState.js +60 -0
- package/components/data/table/hooks/usePanelStructure.js +40 -0
- package/components/data/table/hooks/useResponsiveColumns.js +34 -0
- package/components/data/table/hooks/useRowExpansion.js +110 -0
- package/components/data/table/hooks/useRowHandlers.js +38 -0
- package/components/data/table/hooks/useRowSelection.js +213 -0
- package/components/data/table/hooks/useServerSideSorting.js +165 -0
- package/components/data/table/hooks/useTableColumns.js +263 -0
- package/components/data/table/hooks/useTableData.js +154 -0
- package/components/data/table/hooks/useTableEdit.js +467 -0
- package/components/data/table/hooks/useTableEffects.js +139 -0
- package/components/data/table/hooks/useTableFilter.js +389 -0
- package/components/data/table/hooks/useTableInitialization.js +103 -0
- package/components/data/table/hooks/useTableState.js +69 -0
- package/components/data/table/hooks/useTableStateManager.js +558 -0
- package/components/data/table/index.js +1295 -0
- package/components/data/table/live-table/index.js +232 -0
- package/components/data/table/props.js +5 -0
- package/components/data/table/table-action/index.js +78 -0
- package/components/data/table/table-column/index.js +35 -0
- package/components/data/table/table-row/index.js +49 -0
- package/components/data/table/table-row-action/index.js +74 -0
- package/components/data/table/utils/buildSelectionColumns.js +173 -0
- package/components/data/table/utils/columnBuilder.js +209 -0
- package/components/data/table/utils/columnProxy.js +48 -0
- package/components/data/table/utils/columnWidthDistribution.js +98 -0
- package/components/data/table/utils/constants.js +80 -0
- package/components/data/table/utils/crud-handlers.js +518 -0
- package/components/data/table/utils/dynamic-columns.js +118 -0
- package/components/data/table/utils/index.js +607 -0
- package/components/data/table/utils/renderDisplayCell.js +183 -0
- package/components/data/table/utils/selectionUtils.js +166 -0
- package/components/data/table/utils/table-helpers.js +100 -0
- package/components/data/table/utils/validation.js +124 -0
- package/components/data/types.js +113 -0
- package/components/data/utils/field-data-utils.js +66 -0
- package/components/data/utils/filter-field-util.js +81 -0
- package/components/data/utils/index.js +216 -0
- package/components/dialogs/alert-dialog/index.js +80 -0
- package/components/dialogs/confirm-dialog/index.js +105 -0
- package/components/dialogs/dialog/index.js +56 -0
- package/components/dialogs/dialog-actions/index.js +18 -0
- package/components/dialogs/dialog-body/index.js +21 -0
- package/components/dialogs/dialog-content/index.js +30 -0
- package/components/dialogs/dialog-header/index.js +93 -0
- package/components/dialogs/iframe-dialog/index.js +114 -0
- package/components/dialogs/index.js +129 -0
- package/components/dialogs/login-dialog/index.js +369 -0
- package/components/dialogs/login-dialog/props.js +5 -0
- package/components/dialogs/page-dialog/index.js +96 -0
- package/components/dialogs/withDialogWrapper.js +108 -0
- package/components/form/button/index.js +216 -0
- package/components/form/button-group/index.js +60 -0
- package/components/input/calendar/index.js +546 -0
- package/components/input/calendar/props.js +5 -0
- package/components/input/calendar/utils.js +340 -0
- package/components/input/chips/SortableChip/index.js +115 -0
- package/components/input/chips/SortableChip/props.js +5 -0
- package/components/input/chips/index.js +488 -0
- package/components/input/chips/props.js +5 -0
- package/components/input/chips/utils.js +259 -0
- package/components/input/color-picker/index.js +678 -0
- package/components/input/color-picker/props.js +5 -0
- package/components/input/composite/index.js +137 -0
- package/components/input/currency/index.js +263 -0
- package/components/input/currency/props.js +5 -0
- package/components/input/default/checkbox/index.js +230 -0
- package/components/input/default/checkbox/props.js +5 -0
- package/components/input/default/checkboxset/index.js +476 -0
- package/components/input/default/checkboxset/props.js +5 -0
- package/components/input/default/radioset/index.js +379 -0
- package/components/input/default/radioset/props.js +5 -0
- package/components/input/default/switch/index.js +490 -0
- package/components/input/default/switch/prop.js +5 -0
- package/components/input/epoch/date/components/DatePickerPopover.js +220 -0
- package/components/input/epoch/date/index.js +520 -0
- package/components/input/epoch/date/props.js +5 -0
- package/components/input/epoch/date/styled.js +70 -0
- package/components/input/epoch/date/utils.js +108 -0
- package/components/input/epoch/datetime/index.js +656 -0
- package/components/input/epoch/datetime/props.js +5 -0
- package/components/input/epoch/datetime/styled.js +90 -0
- package/components/input/epoch/datetime/utils.js +244 -0
- package/components/input/epoch/time/index.js +412 -0
- package/components/input/epoch/time/props.js +5 -0
- package/components/input/epoch/time/utils.js +209 -0
- package/components/input/fileupload/Utils.js +134 -0
- package/components/input/fileupload/components/ListItems.js +140 -0
- package/components/input/fileupload/components/MultiUpload.js +85 -0
- package/components/input/fileupload/components/SingleUpload.js +65 -0
- package/components/input/fileupload/index.js +170 -0
- package/components/input/fileupload/props.js +5 -0
- package/components/input/fileupload/useFileUpload.js +400 -0
- package/components/input/number/index.js +295 -0
- package/components/input/number/props.js +5 -0
- package/components/input/rating/index.js +368 -0
- package/components/input/rating/props.js +5 -0
- package/components/input/select/index.js +344 -0
- package/components/input/select/props.js +5 -0
- package/components/input/slider/index.js +167 -0
- package/components/input/slider/props.js +5 -0
- package/components/input/text/index.js +434 -0
- package/components/input/text/props.js +5 -0
- package/components/input/text/util.js +179 -0
- package/components/input/textarea/index.js +347 -0
- package/components/input/textarea/props.js +5 -0
- package/components/layout/footer/index.js +30 -0
- package/components/layout/header/index.js +30 -0
- package/components/layout/leftnav/index.js +44 -0
- package/components/layout/rightnav/index.js +32 -0
- package/components/layout/topnav/index.js +34 -0
- package/components/navbar/index.js +41 -0
- package/components/navbar/nav/index.js +102 -0
- package/components/navbar/nav/props.js +5 -0
- package/components/navbar/nav-item/index.js +44 -0
- package/components/navigation/breadcrumb/index.js +56 -0
- package/components/navigation/breadcrumb/props.js +5 -0
- package/components/navigation/menu/components/ListItems.js +66 -0
- package/components/navigation/menu/constants.js +101 -0
- package/components/navigation/menu/index.js +807 -0
- package/components/navigation/menu/props.js +5 -0
- package/components/navigation/popover/index.js +209 -0
- package/components/navigation/popover/props.js +15 -0
- package/components/page/content/index.js +28 -0
- package/components/page/error-boundary/index.js +108 -0
- package/components/page/index.js +137 -0
- package/components/page/page-content/index.js +23 -0
- package/components/page/partial/index.js +36 -0
- package/components/page/partial-container/index.js +48 -0
- package/components/page/props.js +5 -0
- package/components/page/toast-container/index.js +33 -0
- package/components/prefab/container/index.js +46 -0
- package/components/prefab/index.js +67 -0
- package/context/AppContext.js +25 -0
- package/context/AppSpinnerProvider.js +43 -0
- package/context/LocalizationProvider.js +79 -0
- package/context/PrefabContext.js +66 -0
- package/context/WidgetProvider.js +187 -0
- package/core/app-config.js +1 -0
- package/core/app.service.js +357 -0
- package/core/appVariablesStore.js +20 -0
- package/core/appstore.js +88 -0
- package/core/constants/currency-constant.js +1071 -0
- package/core/constants/events.js +34 -0
- package/core/constants/index.js +27 -0
- package/core/dialog.service.js +76 -0
- package/core/event-notifier.js +151 -0
- package/core/formatter/date-formatters.js +222 -0
- package/core/formatter/index.js +131 -0
- package/core/formatter/number-formatters.js +142 -0
- package/core/formatter/security-formatters.js +323 -0
- package/core/formatter/string-formatters.js +52 -0
- package/core/formatter/types.js +18 -0
- package/core/formatters.js +24 -0
- package/core/proxy-service.js +412 -0
- package/core/script-registry.js +63 -0
- package/core/security.service.js +11 -0
- package/core/util/common.js +33 -0
- package/core/util/dom.js +107 -0
- package/core/util/index.js +136 -0
- package/core/util/security.js +184 -0
- package/core/util/utils.js +189 -0
- package/core/widget-observer.js +98 -0
- package/higherOrder/BaseApp.js +430 -0
- package/higherOrder/BaseAppProps.js +5 -0
- package/higherOrder/BaseDateTime.js +251 -0
- package/higherOrder/BasePage.js +715 -0
- package/higherOrder/BasePartial.js +124 -0
- package/higherOrder/BasePrefab.js +145 -0
- package/higherOrder/DataNav.js +377 -0
- package/higherOrder/helper.js +43 -0
- package/higherOrder/props.js +5 -0
- package/higherOrder/withBaseWrapper.js +183 -0
- package/hooks/useAccess.js +308 -0
- package/hooks/useAppConfig.js +42 -0
- package/hooks/useAuth.js +562 -0
- package/hooks/useDataSourceSubscription.js +125 -0
- package/hooks/useDebounce.js +76 -0
- package/hooks/useDeviceVisibility.js +49 -0
- package/hooks/useHttp.js +338 -0
- package/libs/index.js +20 -0
- package/mui-config/theme-provider.js +17 -0
- package/mui-config/theme.js +371 -0
- package/package-lock.json +10177 -0
- package/package.json +95 -0
- package/store/index.js +33 -0
- package/store/middleware/navigationMiddleware.js +48 -0
- package/store/slices/appConfigSlice.js +103 -0
- package/store/slices/authSlice.js +508 -0
- package/store/slices/i18nSlice.js +206 -0
- package/types/index.js +15 -0
- package/utils/dataset-util.js +174 -0
- package/utils/eval-expression.js +32 -0
- package/utils/form-state.util.js +140 -0
- package/utils/form-utils.js +187 -0
- package/utils/format-util.js +260 -0
- package/utils/page-params-util.js +24 -0
- package/utils/resource-url.js +27 -0
- package/utils/state-persistance.js +343 -0
- package/utils/style-utils.js +73 -0
- package/utils/transformedDataset-utils.js +633 -0
- package/utils/widget-cleanup-util.js +84 -0
- package/utils/widgets.js +99 -0
- package/variables/base-variable.js +173 -0
- package/variables/constants.js +27 -0
- package/variables/live-variable.js +166 -0
- package/variables/model-variable.js +77 -0
- package/variables/service-variable.js +307 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.setWidgetState = exports.getWidgetState = exports.clearWidgetState = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
|
+
var _lodashEs = require("lodash-es");
|
|
11
|
+
// Storage keys
|
|
12
|
+
var WM_STATE_KEY = "wm_state";
|
|
13
|
+
var WM_STATE_URL_PARAM = "wm_state";
|
|
14
|
+
// Default workspace name
|
|
15
|
+
var DEFAULT_WORKSPACE = "ws";
|
|
16
|
+
|
|
17
|
+
// Generate storage key for localStorage/sessionStorage (page-specific)
|
|
18
|
+
var getStorageKey = function getStorageKey() {
|
|
19
|
+
if (typeof window === "undefined") return WM_STATE_KEY;
|
|
20
|
+
return window.location.pathname.replace(/\//g, "").replace("react-pages/", "") + "_" + WM_STATE_KEY;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Get current page name from pathname
|
|
24
|
+
var getCurrentPageName = function getCurrentPageName() {
|
|
25
|
+
if (typeof window === "undefined") return "";
|
|
26
|
+
var segments = window.location.pathname.split("/").filter(Boolean);
|
|
27
|
+
return segments[segments.length - 1] || "Main";
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Convert JSON to URL-friendly encoded format (no quotes needed)
|
|
31
|
+
var jsonToUri = function jsonToUri(jsonObj) {
|
|
32
|
+
// Custom stringify that doesn't use quotes
|
|
33
|
+
var customStringify = function customStringify(obj) {
|
|
34
|
+
if (obj === null) return "null";
|
|
35
|
+
if (obj === undefined) return "undefined";
|
|
36
|
+
if (typeof obj === "string") return obj;
|
|
37
|
+
if (typeof obj === "number" || typeof obj === "boolean") return String(obj);
|
|
38
|
+
if (Array.isArray(obj)) {
|
|
39
|
+
if (obj.length === 0) return "!*";
|
|
40
|
+
return "!" + obj.map(customStringify).join("_") + "*";
|
|
41
|
+
}
|
|
42
|
+
if ((0, _typeof2["default"])(obj) === "object") {
|
|
43
|
+
var pairs = [];
|
|
44
|
+
for (var _i = 0, _Object$entries = Object.entries(obj); _i < _Object$entries.length; _i++) {
|
|
45
|
+
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
|
|
46
|
+
key = _Object$entries$_i[0],
|
|
47
|
+
value = _Object$entries$_i[1];
|
|
48
|
+
pairs.push(key + "~" + customStringify(value));
|
|
49
|
+
}
|
|
50
|
+
if (pairs.length === 0) return "()";
|
|
51
|
+
return "(" + pairs.join("_") + ")";
|
|
52
|
+
}
|
|
53
|
+
return String(obj);
|
|
54
|
+
};
|
|
55
|
+
return customStringify(jsonObj);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Decode URL-encoded format back to object
|
|
59
|
+
var uriToJson = function uriToJson(encodedObj) {
|
|
60
|
+
try {
|
|
61
|
+
// First decode any URL encoding
|
|
62
|
+
var decoded = decodeURIComponent(encodedObj);
|
|
63
|
+
|
|
64
|
+
// Custom parser for our format
|
|
65
|
+
var parse = function parse(str) {
|
|
66
|
+
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
67
|
+
if (str[startIndex] === "(") {
|
|
68
|
+
// Parse object
|
|
69
|
+
var obj = {};
|
|
70
|
+
var i = startIndex + 1;
|
|
71
|
+
while (i < str.length && str[i] !== ")") {
|
|
72
|
+
// Check for empty object
|
|
73
|
+
if (str[i] === ")") break;
|
|
74
|
+
|
|
75
|
+
// Parse key
|
|
76
|
+
var key = "";
|
|
77
|
+
while (i < str.length && str[i] !== "~") {
|
|
78
|
+
key += str[i];
|
|
79
|
+
i++;
|
|
80
|
+
}
|
|
81
|
+
i++; // skip '~'
|
|
82
|
+
|
|
83
|
+
// Parse value
|
|
84
|
+
var _parse = parse(str, i),
|
|
85
|
+
_value = _parse.value,
|
|
86
|
+
endIndex = _parse.endIndex;
|
|
87
|
+
obj[key] = _value;
|
|
88
|
+
i = endIndex;
|
|
89
|
+
if (str[i] === "_") {
|
|
90
|
+
i++; // skip '_' separator
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
value: obj,
|
|
95
|
+
endIndex: i + 1
|
|
96
|
+
}; // skip ')'
|
|
97
|
+
} else if (str[startIndex] === "!") {
|
|
98
|
+
// Parse array
|
|
99
|
+
var arr = [];
|
|
100
|
+
var _i2 = startIndex + 1;
|
|
101
|
+
while (_i2 < str.length && str[_i2] !== "*") {
|
|
102
|
+
var _parse2 = parse(str, _i2),
|
|
103
|
+
_value2 = _parse2.value,
|
|
104
|
+
_endIndex = _parse2.endIndex;
|
|
105
|
+
arr.push(_value2);
|
|
106
|
+
_i2 = _endIndex;
|
|
107
|
+
if (str[_i2] === "_") {
|
|
108
|
+
_i2++; // skip '_' separator
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
value: arr,
|
|
113
|
+
endIndex: _i2 + 1
|
|
114
|
+
}; // skip '*'
|
|
115
|
+
} else {
|
|
116
|
+
// Parse primitive
|
|
117
|
+
var _value3 = "";
|
|
118
|
+
var _i3 = startIndex;
|
|
119
|
+
while (_i3 < str.length && str[_i3] !== "_" && str[_i3] !== ")" && str[_i3] !== "*") {
|
|
120
|
+
_value3 += str[_i3];
|
|
121
|
+
_i3++;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Convert to appropriate type
|
|
125
|
+
if (_value3 === "null") return {
|
|
126
|
+
value: null,
|
|
127
|
+
endIndex: _i3
|
|
128
|
+
};
|
|
129
|
+
if (_value3 === "undefined") return {
|
|
130
|
+
value: undefined,
|
|
131
|
+
endIndex: _i3
|
|
132
|
+
};
|
|
133
|
+
if (_value3 === "true") return {
|
|
134
|
+
value: true,
|
|
135
|
+
endIndex: _i3
|
|
136
|
+
};
|
|
137
|
+
if (_value3 === "false") return {
|
|
138
|
+
value: false,
|
|
139
|
+
endIndex: _i3
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Check if it's a number
|
|
143
|
+
var num = Number(_value3);
|
|
144
|
+
if (!isNaN(num) && _value3 !== "") {
|
|
145
|
+
return {
|
|
146
|
+
value: num,
|
|
147
|
+
endIndex: _i3
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
value: _value3,
|
|
152
|
+
endIndex: _i3
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
var _parse3 = parse(decoded),
|
|
157
|
+
value = _parse3.value;
|
|
158
|
+
return value;
|
|
159
|
+
} catch (e) {
|
|
160
|
+
console.warn("Failed to parse state from URL:", e);
|
|
161
|
+
return {};
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// Get all widget states from storage
|
|
166
|
+
var getAllStates = function getAllStates(storage) {
|
|
167
|
+
switch (storage) {
|
|
168
|
+
case "localStorage":
|
|
169
|
+
var localData = localStorage.getItem(getStorageKey());
|
|
170
|
+
try {
|
|
171
|
+
return localData ? JSON.parse(localData) : {};
|
|
172
|
+
} catch (_unused) {
|
|
173
|
+
return {};
|
|
174
|
+
}
|
|
175
|
+
case "sessionStorage":
|
|
176
|
+
var sessionData = sessionStorage.getItem(getStorageKey());
|
|
177
|
+
try {
|
|
178
|
+
return sessionData ? JSON.parse(sessionData) : {};
|
|
179
|
+
} catch (_unused2) {
|
|
180
|
+
return {};
|
|
181
|
+
}
|
|
182
|
+
case "URL":
|
|
183
|
+
// Get the raw URL parameter value
|
|
184
|
+
var searchParams = window.location.search;
|
|
185
|
+
var match = searchParams.match(new RegExp("[?&]".concat(WM_STATE_URL_PARAM, "=([^&]+)")));
|
|
186
|
+
if (!match || !match[1]) return {};
|
|
187
|
+
|
|
188
|
+
// Use Angular's decoding approach
|
|
189
|
+
return uriToJson(match[1]);
|
|
190
|
+
default:
|
|
191
|
+
return {};
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// Set all widget states to storage
|
|
196
|
+
var setAllStates = function setAllStates(storage, states) {
|
|
197
|
+
switch (storage) {
|
|
198
|
+
case "localStorage":
|
|
199
|
+
localStorage.setItem(getStorageKey(), JSON.stringify(states));
|
|
200
|
+
break;
|
|
201
|
+
case "sessionStorage":
|
|
202
|
+
sessionStorage.setItem(getStorageKey(), JSON.stringify(states));
|
|
203
|
+
break;
|
|
204
|
+
case "URL":
|
|
205
|
+
var url = new URL(window.location.href);
|
|
206
|
+
var urlParams = new URLSearchParams(url.search);
|
|
207
|
+
if ((0, _lodashEs.keys)(states).length > 0) {
|
|
208
|
+
// Use Angular's encoding approach
|
|
209
|
+
var encodedState = jsonToUri(states);
|
|
210
|
+
|
|
211
|
+
// Remove existing wm_state param
|
|
212
|
+
urlParams["delete"](WM_STATE_URL_PARAM);
|
|
213
|
+
|
|
214
|
+
// Build URL manually to avoid double encoding
|
|
215
|
+
var newSearch = urlParams.toString();
|
|
216
|
+
if (newSearch) {
|
|
217
|
+
newSearch += "&";
|
|
218
|
+
}
|
|
219
|
+
newSearch += "".concat(WM_STATE_URL_PARAM, "=").concat(encodedState);
|
|
220
|
+
url.search = newSearch ? "?" + newSearch : "";
|
|
221
|
+
} else {
|
|
222
|
+
urlParams["delete"](WM_STATE_URL_PARAM);
|
|
223
|
+
url.search = urlParams.toString();
|
|
224
|
+
}
|
|
225
|
+
window.history.replaceState({
|
|
226
|
+
path: url.toString()
|
|
227
|
+
}, "", url.toString());
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
var getWidgetState = exports.getWidgetState = function getWidgetState(config) {
|
|
232
|
+
var name = config.name,
|
|
233
|
+
type = config.type,
|
|
234
|
+
storage = config.storage;
|
|
235
|
+
var allStates = getAllStates(storage);
|
|
236
|
+
|
|
237
|
+
// For URL storage, use flat structure (Angular style)
|
|
238
|
+
// For localStorage/sessionStorage, use page-specific structure
|
|
239
|
+
if (storage === "URL") {
|
|
240
|
+
var _allStates$DEFAULT_WO;
|
|
241
|
+
var widgetData = (_allStates$DEFAULT_WO = allStates[DEFAULT_WORKSPACE]) === null || _allStates$DEFAULT_WO === void 0 ? void 0 : _allStates$DEFAULT_WO[name];
|
|
242
|
+
return widgetData || null;
|
|
243
|
+
} else {
|
|
244
|
+
var _allStates$currentPag;
|
|
245
|
+
var currentPageName = getCurrentPageName();
|
|
246
|
+
var _widgetData = (_allStates$currentPag = allStates[currentPageName]) === null || _allStates$currentPag === void 0 || (_allStates$currentPag = _allStates$currentPag[DEFAULT_WORKSPACE]) === null || _allStates$currentPag === void 0 ? void 0 : _allStates$currentPag[name];
|
|
247
|
+
return _widgetData || null;
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
var setWidgetState = exports.setWidgetState = function setWidgetState(config, value) {
|
|
251
|
+
var name = config.name,
|
|
252
|
+
type = config.type,
|
|
253
|
+
storage = config.storage;
|
|
254
|
+
if (storage === "none") {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
var allStates = getAllStates(storage);
|
|
258
|
+
|
|
259
|
+
// For URL storage, use flat structure (Angular style)
|
|
260
|
+
if (storage === "URL") {
|
|
261
|
+
// Ensure the workspace exists
|
|
262
|
+
if (!allStates[DEFAULT_WORKSPACE]) {
|
|
263
|
+
allStates[DEFAULT_WORKSPACE] = {};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Update the specific widget state
|
|
267
|
+
if ((0, _lodashEs.isObject)(value) && !(0, _lodashEs.isArray)(value) && allStates[DEFAULT_WORKSPACE][name]) {
|
|
268
|
+
var existingValue = allStates[DEFAULT_WORKSPACE][name];
|
|
269
|
+
if ((0, _lodashEs.isObject)(existingValue) && !(0, _lodashEs.isArray)(existingValue)) {
|
|
270
|
+
(0, _lodashEs.merge)(existingValue, value);
|
|
271
|
+
} else {
|
|
272
|
+
allStates[DEFAULT_WORKSPACE][name] = value;
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
allStates[DEFAULT_WORKSPACE][name] = value;
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
// For localStorage/sessionStorage, use page-specific structure
|
|
279
|
+
var currentPageName = getCurrentPageName();
|
|
280
|
+
|
|
281
|
+
// Ensure the hierarchy exists: Page -> workspace -> widget
|
|
282
|
+
if (!allStates[currentPageName]) {
|
|
283
|
+
allStates[currentPageName] = {};
|
|
284
|
+
}
|
|
285
|
+
if (!allStates[currentPageName][DEFAULT_WORKSPACE]) {
|
|
286
|
+
allStates[currentPageName][DEFAULT_WORKSPACE] = {};
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Update the specific widget state
|
|
290
|
+
if ((0, _lodashEs.isObject)(value) && !(0, _lodashEs.isArray)(value) && allStates[currentPageName][DEFAULT_WORKSPACE][name]) {
|
|
291
|
+
var _existingValue = allStates[currentPageName][DEFAULT_WORKSPACE][name];
|
|
292
|
+
if ((0, _lodashEs.isObject)(_existingValue) && !(0, _lodashEs.isArray)(_existingValue)) {
|
|
293
|
+
(0, _lodashEs.merge)(_existingValue, value);
|
|
294
|
+
} else {
|
|
295
|
+
allStates[currentPageName][DEFAULT_WORKSPACE][name] = value;
|
|
296
|
+
}
|
|
297
|
+
} else {
|
|
298
|
+
allStates[currentPageName][DEFAULT_WORKSPACE][name] = value;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Save the updated state hierarchy
|
|
303
|
+
setAllStates(storage, allStates);
|
|
304
|
+
};
|
|
305
|
+
var clearWidgetState = exports.clearWidgetState = function clearWidgetState(config) {
|
|
306
|
+
var name = config.name,
|
|
307
|
+
type = config.type,
|
|
308
|
+
storage = config.storage;
|
|
309
|
+
if (storage === "none") {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
var allStates = getAllStates(storage);
|
|
313
|
+
|
|
314
|
+
// For URL storage, use flat structure
|
|
315
|
+
if (storage === "URL") {
|
|
316
|
+
if (allStates[DEFAULT_WORKSPACE]) {
|
|
317
|
+
delete allStates[DEFAULT_WORKSPACE][name];
|
|
318
|
+
|
|
319
|
+
// Clean up empty workspace
|
|
320
|
+
if ((0, _lodashEs.keys)(allStates[DEFAULT_WORKSPACE]).length === 0) {
|
|
321
|
+
delete allStates[DEFAULT_WORKSPACE];
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
var _allStates$currentPag2;
|
|
326
|
+
// For localStorage/sessionStorage, use page-specific structure
|
|
327
|
+
var currentPageName = getCurrentPageName();
|
|
328
|
+
if ((_allStates$currentPag2 = allStates[currentPageName]) !== null && _allStates$currentPag2 !== void 0 && _allStates$currentPag2[DEFAULT_WORKSPACE]) {
|
|
329
|
+
delete allStates[currentPageName][DEFAULT_WORKSPACE][name];
|
|
330
|
+
|
|
331
|
+
// Clean up empty objects
|
|
332
|
+
if ((0, _lodashEs.keys)(allStates[currentPageName][DEFAULT_WORKSPACE]).length === 0) {
|
|
333
|
+
delete allStates[currentPageName][DEFAULT_WORKSPACE];
|
|
334
|
+
}
|
|
335
|
+
if ((0, _lodashEs.keys)(allStates[currentPageName]).length === 0) {
|
|
336
|
+
delete allStates[currentPageName];
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Save the updated state hierarchy
|
|
342
|
+
setAllStates(storage, allStates);
|
|
343
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.sanitizeStyleObject = exports.mergeStyleObjects = exports.isValidStyleObject = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
/**
|
|
12
|
+
* Utility functions for CSS style handling and validation
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Validates and sanitizes a style object to ensure it contains only valid CSS properties
|
|
17
|
+
* @param styleObj - The style object to sanitize
|
|
18
|
+
* @returns A sanitized style object with only valid CSS properties
|
|
19
|
+
*/
|
|
20
|
+
var sanitizeStyleObject = exports.sanitizeStyleObject = function sanitizeStyleObject(styleObj) {
|
|
21
|
+
if (!styleObj || (0, _typeof2["default"])(styleObj) !== "object") {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Filter out invalid CSS properties and values
|
|
26
|
+
var validStyles = {};
|
|
27
|
+
Object.entries(styleObj).forEach(function (_ref) {
|
|
28
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
29
|
+
key = _ref2[0],
|
|
30
|
+
value = _ref2[1];
|
|
31
|
+
// Skip if key is not a string or value is null/undefined
|
|
32
|
+
if (typeof key === "string" && value != null) {
|
|
33
|
+
// Convert camelCase to kebab-case for CSS properties if needed
|
|
34
|
+
// and ensure the value is a valid CSS value
|
|
35
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
36
|
+
validStyles[key] = value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return validStyles;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Merges multiple style objects safely, sanitizing each one
|
|
45
|
+
* @param styleObjects - Array of style objects to merge
|
|
46
|
+
* @returns A merged and sanitized style object
|
|
47
|
+
*/
|
|
48
|
+
var mergeStyleObjects = exports.mergeStyleObjects = function mergeStyleObjects() {
|
|
49
|
+
for (var _len = arguments.length, styleObjects = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50
|
+
styleObjects[_key] = arguments[_key];
|
|
51
|
+
}
|
|
52
|
+
var sanitizedStyles = styleObjects.map(sanitizeStyleObject);
|
|
53
|
+
return Object.assign.apply(Object, [{}].concat((0, _toConsumableArray2["default"])(sanitizedStyles)));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Validates if a value is a valid CSS style object
|
|
58
|
+
* @param value - The value to check
|
|
59
|
+
* @returns True if the value is a valid style object
|
|
60
|
+
*/
|
|
61
|
+
var isValidStyleObject = exports.isValidStyleObject = function isValidStyleObject(value) {
|
|
62
|
+
if (!value || (0, _typeof2["default"])(value) !== "object" || Array.isArray(value)) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Check if all keys are strings and values are valid CSS values
|
|
67
|
+
return Object.entries(value).every(function (_ref3) {
|
|
68
|
+
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
|
|
69
|
+
key = _ref4[0],
|
|
70
|
+
val = _ref4[1];
|
|
71
|
+
return typeof key === "string" && val != null && (typeof val === "string" || typeof val === "number");
|
|
72
|
+
});
|
|
73
|
+
};
|