@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,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
13
|
+
var _AccordionDetails = _interopRequireDefault(require("@mui/material/AccordionDetails"));
|
|
14
|
+
var _AccordionSummary = _interopRequireDefault(require("@mui/material/AccordionSummary"));
|
|
15
|
+
var _accordion = require("@base-ui-components/react/accordion");
|
|
16
|
+
var _withBaseWrapper = _interopRequireDefault(require("@wavemaker/react-runtime/higherOrder/withBaseWrapper"));
|
|
17
|
+
var _props = require("./props");
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
19
|
+
var __jsx = _react["default"].createElement;
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
var DEFAULT_CLASS = "app-accordion-panel panel";
|
|
23
|
+
var WmAccordionPane = /*#__PURE__*/(0, _react.memo)(function (Props) {
|
|
24
|
+
var props = _objectSpread(_objectSpread({}, _props.DEFAULT_PANE_PROPS), Props);
|
|
25
|
+
var contentRef = (0, _react.useRef)(null);
|
|
26
|
+
var loadedRef = (0, _react.useRef)(false);
|
|
27
|
+
|
|
28
|
+
// Handle expand/collapse
|
|
29
|
+
var handleToggle = (0, _react.useCallback)(function (event) {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
props.toggle(event.nativeEvent, props.name);
|
|
32
|
+
if (!props.active) {
|
|
33
|
+
props.onExpand && props.onExpand(event.nativeEvent, props);
|
|
34
|
+
} else {
|
|
35
|
+
props.onCollapse && props.onCollapse(event.nativeEvent, props);
|
|
36
|
+
}
|
|
37
|
+
}, [props.toggle, props.onExpand, props.onCollapse]);
|
|
38
|
+
|
|
39
|
+
// Handle keyboard navigation
|
|
40
|
+
var handleKeyDown = (0, _react.useCallback)(function (event) {
|
|
41
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
handleToggle(event);
|
|
44
|
+
}
|
|
45
|
+
}, [handleToggle]);
|
|
46
|
+
(0, _react.useEffect)(function () {
|
|
47
|
+
if (!loadedRef.current) {
|
|
48
|
+
props.onLoad && props.onLoad(props, props.onLoad);
|
|
49
|
+
loadedRef.current = true;
|
|
50
|
+
}
|
|
51
|
+
}, [props.onLoad]);
|
|
52
|
+
return __jsx(_accordion.Accordion.Root, {
|
|
53
|
+
tabIndex: props.tabindex,
|
|
54
|
+
className: (0, _clsx["default"])(DEFAULT_CLASS, props.className, {
|
|
55
|
+
active: props.active
|
|
56
|
+
})
|
|
57
|
+
}, __jsx(_AccordionSummary["default"], {
|
|
58
|
+
className: "panel-heading clearfix",
|
|
59
|
+
onClick: handleToggle,
|
|
60
|
+
onKeyDown: handleKeyDown,
|
|
61
|
+
tabIndex: props.tabindex,
|
|
62
|
+
"aria-expanded": props.active,
|
|
63
|
+
component: "div",
|
|
64
|
+
classes: {
|
|
65
|
+
content: "panel-title"
|
|
66
|
+
}
|
|
67
|
+
}, __jsx("div", {
|
|
68
|
+
className: "panel-title"
|
|
69
|
+
}, props.iconclass && __jsx("div", {
|
|
70
|
+
className: "pull-left"
|
|
71
|
+
}, __jsx("i", {
|
|
72
|
+
className: (0, _clsx["default"])("app-icon panel-icon", props.iconclass)
|
|
73
|
+
})), __jsx("div", {
|
|
74
|
+
className: "pull-left",
|
|
75
|
+
style: {
|
|
76
|
+
flex: 1
|
|
77
|
+
}
|
|
78
|
+
}, __jsx(_Typography["default"], {
|
|
79
|
+
className: "heading",
|
|
80
|
+
variant: "h3",
|
|
81
|
+
component: "h3"
|
|
82
|
+
}, props.title), props.subheading && __jsx(_Typography["default"], {
|
|
83
|
+
className: "description",
|
|
84
|
+
variant: "body2",
|
|
85
|
+
component: "div"
|
|
86
|
+
}, props.subheading)), __jsx("div", {
|
|
87
|
+
className: "panel-actions pull-right"
|
|
88
|
+
}, props.badgevalue && __jsx(_Typography["default"], {
|
|
89
|
+
variant: "body2",
|
|
90
|
+
component: "span",
|
|
91
|
+
className: "label label-".concat(props.badgetype || "default")
|
|
92
|
+
}, props.badgevalue), __jsx(_Typography["default"], {
|
|
93
|
+
component: "span",
|
|
94
|
+
variant: "body2",
|
|
95
|
+
className: "app-icon panel-action wi"
|
|
96
|
+
}, __jsx("i", {
|
|
97
|
+
className: (0, _clsx["default"])("app-icon wi", props.active ? "wi-minus" : "wi-plus")
|
|
98
|
+
}))))), __jsx(_AccordionDetails["default"], {
|
|
99
|
+
className: (0, _clsx["default"])("panel-collapse collapse", {
|
|
100
|
+
"in": props.active
|
|
101
|
+
})
|
|
102
|
+
}, __jsx("div", {
|
|
103
|
+
ref: contentRef,
|
|
104
|
+
className: "panel-body"
|
|
105
|
+
}, props.render && props.active ? props.render(props, props.onLoad) : props.children)));
|
|
106
|
+
});
|
|
107
|
+
WmAccordionPane.displayName = "WmAccordionPane";
|
|
108
|
+
var _default = exports["default"] = (0, _withBaseWrapper["default"])(WmAccordionPane);
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
12
|
+
var _isArray = _interopRequireDefault(require("lodash-es/isArray"));
|
|
13
|
+
var _withBaseWrapper = _interopRequireDefault(require("@wavemaker/react-runtime/higherOrder/withBaseWrapper"));
|
|
14
|
+
var _accordionPane = _interopRequireDefault(require("./accordion-pane"));
|
|
15
|
+
var _props = require("./props");
|
|
16
|
+
var _statePersistance = require("@wavemaker/react-runtime/utils/state-persistance");
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
18
|
+
var __jsx = _react["default"].createElement;
|
|
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
|
+
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-accordion panel-group";
|
|
22
|
+
var WmAccordion = /*#__PURE__*/(0, _react.memo)(function (Props) {
|
|
23
|
+
var props = _objectSpread(_objectSpread({}, _props.DEFAULT_PROPS), Props);
|
|
24
|
+
var isMounted = (0, _react.useRef)(false);
|
|
25
|
+
var _useState = (0, _react.useState)(props.defaultpaneindex || 0),
|
|
26
|
+
activePaneIndex = _useState[0],
|
|
27
|
+
setActivePaneIndex = _useState[1];
|
|
28
|
+
var _useState2 = (0, _react.useState)(new Set()),
|
|
29
|
+
activePanes = _useState2[0],
|
|
30
|
+
setActivePanes = _useState2[1];
|
|
31
|
+
var prevActivePaneIndex = (0, _react.useRef)(null);
|
|
32
|
+
|
|
33
|
+
// Initialize active panes based on default pane index
|
|
34
|
+
(0, _react.useEffect)(function () {
|
|
35
|
+
var initialIndex = props.defaultpaneindex || 0;
|
|
36
|
+
setActivePaneIndex(initialIndex);
|
|
37
|
+
setActivePanes(new Set([initialIndex]));
|
|
38
|
+
}, [props.defaultpaneindex]);
|
|
39
|
+
|
|
40
|
+
// State persistence functions
|
|
41
|
+
var getStateFromStorage = (0, _react.useCallback)(function () {
|
|
42
|
+
if (!props.statehandler || props.statehandler === "none") return null;
|
|
43
|
+
try {
|
|
44
|
+
return (0, _statePersistance.getWidgetState)({
|
|
45
|
+
name: props.name,
|
|
46
|
+
type: "accordion",
|
|
47
|
+
storage: props.statehandler
|
|
48
|
+
});
|
|
49
|
+
} catch (error) {
|
|
50
|
+
console.warn("Error reading accordion state:", error);
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}, [props.statehandler, props.name]);
|
|
54
|
+
var saveStateToStorage = (0, _react.useCallback)(function (currentActiveIndex) {
|
|
55
|
+
if (!props.statehandler || props.statehandler === "none") return;
|
|
56
|
+
try {
|
|
57
|
+
// Save the current active pane index
|
|
58
|
+
(0, _statePersistance.setWidgetState)({
|
|
59
|
+
name: props.name,
|
|
60
|
+
type: "accordion",
|
|
61
|
+
storage: props.statehandler
|
|
62
|
+
}, String(currentActiveIndex));
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.warn("Error saving accordion state:", error);
|
|
65
|
+
}
|
|
66
|
+
}, [props.statehandler, props.name]);
|
|
67
|
+
function updateActivePane(index, name) {
|
|
68
|
+
var _props$listener;
|
|
69
|
+
if (props !== null && props !== void 0 && (_props$listener = props.listener) !== null && _props$listener !== void 0 && _props$listener.onChange) {
|
|
70
|
+
props.listener.onChange(props.name, {
|
|
71
|
+
activePane: {
|
|
72
|
+
name: name,
|
|
73
|
+
index: index
|
|
74
|
+
},
|
|
75
|
+
activePaneIndex: index,
|
|
76
|
+
activePaneName: name
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Handle pane expand/collapse
|
|
82
|
+
var handlePaneToggle = (0, _react.useCallback)(function (paneIndex, isExpanding, event, name) {
|
|
83
|
+
var newActivePanes = new Set(activePanes);
|
|
84
|
+
if (isExpanding) {
|
|
85
|
+
if (props.closeothers) {
|
|
86
|
+
// Close all other panes
|
|
87
|
+
newActivePanes.clear();
|
|
88
|
+
newActivePanes.add(paneIndex);
|
|
89
|
+
} else {
|
|
90
|
+
// Add this pane to active panes
|
|
91
|
+
newActivePanes.add(paneIndex);
|
|
92
|
+
}
|
|
93
|
+
updateActivePane(paneIndex, name);
|
|
94
|
+
prevActivePaneIndex.current = activePaneIndex;
|
|
95
|
+
setActivePaneIndex(paneIndex);
|
|
96
|
+
|
|
97
|
+
// Trigger onChange callback
|
|
98
|
+
if (event && props.onChange) {
|
|
99
|
+
props.onChange({
|
|
100
|
+
newPaneIndex: paneIndex,
|
|
101
|
+
oldPaneIndex: prevActivePaneIndex.current || 0
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
// Remove this pane from active panes
|
|
106
|
+
newActivePanes["delete"](paneIndex);
|
|
107
|
+
|
|
108
|
+
// Update active pane index when collapsing
|
|
109
|
+
if (newActivePanes.size > 0) {
|
|
110
|
+
var firstActivePaneIndex = Array.from(newActivePanes)[0];
|
|
111
|
+
setActivePaneIndex(firstActivePaneIndex);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
setActivePanes(newActivePanes);
|
|
115
|
+
|
|
116
|
+
// Save state
|
|
117
|
+
if (event) {
|
|
118
|
+
if (isExpanding) {
|
|
119
|
+
// Save the newly activated pane index
|
|
120
|
+
saveStateToStorage(paneIndex);
|
|
121
|
+
} else {
|
|
122
|
+
// When collapsing, save the first remaining active pane or the current one
|
|
123
|
+
var remainingActivePanes = Array.from(newActivePanes);
|
|
124
|
+
var indexToSave = remainingActivePanes.length > 0 ? remainingActivePanes[0] : paneIndex;
|
|
125
|
+
saveStateToStorage(indexToSave);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, [activePanes, activePaneIndex, props.closeothers, saveStateToStorage]);
|
|
129
|
+
|
|
130
|
+
// Restore state on mount
|
|
131
|
+
(0, _react.useEffect)(function () {
|
|
132
|
+
var savedState = getStateFromStorage();
|
|
133
|
+
if (savedState !== null && typeof savedState === "number") {
|
|
134
|
+
setActivePaneIndex(savedState);
|
|
135
|
+
setActivePanes(new Set([savedState]));
|
|
136
|
+
}
|
|
137
|
+
}, [getStateFromStorage]);
|
|
138
|
+
|
|
139
|
+
// Accordion methods exposed via listener
|
|
140
|
+
|
|
141
|
+
var expand = function expand() {
|
|
142
|
+
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
143
|
+
handlePaneToggle(index, true);
|
|
144
|
+
};
|
|
145
|
+
var collapse = function collapse() {
|
|
146
|
+
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
147
|
+
handlePaneToggle(index, false);
|
|
148
|
+
};
|
|
149
|
+
var toggle = function toggle() {
|
|
150
|
+
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
151
|
+
var isActive = activePanes.has(index);
|
|
152
|
+
handlePaneToggle(index, !isActive);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// register the methods
|
|
156
|
+
(0, _react.useEffect)(function () {
|
|
157
|
+
var _props$listener2;
|
|
158
|
+
if (props !== null && props !== void 0 && (_props$listener2 = props.listener) !== null && _props$listener2 !== void 0 && _props$listener2.onChange && !isMounted.current) {
|
|
159
|
+
var _React$Children$toArr;
|
|
160
|
+
var activePaneName = (_React$Children$toArr = _react["default"].Children.toArray(props.children)[activePaneIndex]) === null || _React$Children$toArr === void 0 || (_React$Children$toArr = _React$Children$toArr.props) === null || _React$Children$toArr === void 0 ? void 0 : _React$Children$toArr.name;
|
|
161
|
+
props.listener.onChange(props.name, {
|
|
162
|
+
expand: expand,
|
|
163
|
+
collapse: collapse,
|
|
164
|
+
toggle: toggle,
|
|
165
|
+
activePane: {
|
|
166
|
+
name: activePaneName
|
|
167
|
+
},
|
|
168
|
+
activePaneIndex: activePaneIndex,
|
|
169
|
+
activePaneName: activePaneName
|
|
170
|
+
});
|
|
171
|
+
isMounted.current = true;
|
|
172
|
+
}
|
|
173
|
+
}, [activePaneIndex, expand, collapse, toggle, props.name, props.children]);
|
|
174
|
+
|
|
175
|
+
// Render static panes from children
|
|
176
|
+
var renderPanes = function renderPanes() {
|
|
177
|
+
if (props.type === "dynamic") {
|
|
178
|
+
var _props$dataset;
|
|
179
|
+
if (!(props !== null && props !== void 0 && props.dataset) || (props === null || props === void 0 ? void 0 : props.dataset.length) === 0 || !(0, _isArray["default"])(props === null || props === void 0 ? void 0 : props.dataset)) {
|
|
180
|
+
return __jsx("div", null, props.nodatamessage);
|
|
181
|
+
}
|
|
182
|
+
return props === null || props === void 0 || (_props$dataset = props.dataset) === null || _props$dataset === void 0 ? void 0 : _props$dataset.map(function (item, index) {
|
|
183
|
+
return __jsx("div", {
|
|
184
|
+
className: "app-repeat-item",
|
|
185
|
+
key: "repeat-template-".concat(index, "-").concat((item === null || item === void 0 ? void 0 : item.name) || (item === null || item === void 0 ? void 0 : item.id))
|
|
186
|
+
}, props.render && props.render(_objectSpread(_objectSpread({}, item), {}, {
|
|
187
|
+
active: activePanes.has(index),
|
|
188
|
+
toggle: function toggle(event, name) {
|
|
189
|
+
return handlePaneToggle(index, !activePanes.has(index), event, name);
|
|
190
|
+
},
|
|
191
|
+
collapse: function collapse(event, name) {
|
|
192
|
+
return handlePaneToggle(index, false, event, name);
|
|
193
|
+
},
|
|
194
|
+
expand: function expand(event, name) {
|
|
195
|
+
return handlePaneToggle(index, true, event, name);
|
|
196
|
+
}
|
|
197
|
+
}), index, props === null || props === void 0 ? void 0 : props.dataset));
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return props.type === "static" ? _react["default"].Children.map(props.children, function (child, index) {
|
|
201
|
+
if (/*#__PURE__*/_react["default"].isValidElement(child) && child.type === _accordionPane["default"]) {
|
|
202
|
+
return /*#__PURE__*/_react["default"].cloneElement(child, {
|
|
203
|
+
active: activePanes.has(index),
|
|
204
|
+
toggle: function toggle(event, name) {
|
|
205
|
+
return handlePaneToggle(index, !activePanes.has(index), event, name);
|
|
206
|
+
},
|
|
207
|
+
collapse: function collapse(event, name) {
|
|
208
|
+
return handlePaneToggle(index, false, event, name);
|
|
209
|
+
},
|
|
210
|
+
expand: function expand(event, name) {
|
|
211
|
+
return handlePaneToggle(index, true, event, name);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
return child;
|
|
216
|
+
}) : null;
|
|
217
|
+
};
|
|
218
|
+
return __jsx("div", {
|
|
219
|
+
className: (0, _clsx["default"])(DEFAULT_CLASS, props.className),
|
|
220
|
+
style: props.styles,
|
|
221
|
+
id: (props === null || props === void 0 ? void 0 : props.id) || (props === null || props === void 0 ? void 0 : props.name),
|
|
222
|
+
"data-type": "accordion",
|
|
223
|
+
"data-statehandler": props.statehandler
|
|
224
|
+
}, renderPanes());
|
|
225
|
+
}, function (prevProps, nextProps) {
|
|
226
|
+
var keys = ["dataset", "defaultpaneindex", "closeothers", "children"];
|
|
227
|
+
return keys.every(function (key) {
|
|
228
|
+
return prevProps[key] === nextProps[key];
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
WmAccordion.displayName = "WmAccordion";
|
|
232
|
+
var _default = exports["default"] = (0, _withBaseWrapper["default"])(WmAccordion);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DEFAULT_PROPS = void 0;
|
|
7
|
+
var DEFAULT_PROPS = exports.DEFAULT_PROPS = {
|
|
8
|
+
closeothers: true,
|
|
9
|
+
defaultpaneindex: 0,
|
|
10
|
+
statehandler: "none",
|
|
11
|
+
nodatamessage: "No Data Found",
|
|
12
|
+
type: "static"
|
|
13
|
+
};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.normalizeGapValue = exports.isAutoValue = exports.getDirectionalAlignment = exports.getBaseAlignment = exports.formatPixelValue = exports.createBaseFlexStyles = exports.calculateWrapSpacing = exports.calculateSpacingStyles = exports.calculateNoWrapSpacing = exports.calculateAlignmentStyles = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
/**
|
|
12
|
+
* Utility functions for container alignment and spacing calculations
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// Types for better type safety
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Gets base alignment properties from alignment matrix
|
|
19
|
+
*/
|
|
20
|
+
var getBaseAlignment = exports.getBaseAlignment = function getBaseAlignment(alignmentMatrix, alignmentKey) {
|
|
21
|
+
var base = alignmentMatrix === null || alignmentMatrix === void 0 ? void 0 : alignmentMatrix[alignmentKey];
|
|
22
|
+
return base || {
|
|
23
|
+
justifyContent: "flex-start",
|
|
24
|
+
alignItems: "stretch"
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Swaps justify/align properties based on flex direction
|
|
30
|
+
*/
|
|
31
|
+
var getDirectionalAlignment = exports.getDirectionalAlignment = function getDirectionalAlignment(base, isRow) {
|
|
32
|
+
return {
|
|
33
|
+
justifyContent: isRow ? base.justifyContent : base.alignItems,
|
|
34
|
+
alignItems: isRow ? base.alignItems : base.justifyContent
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Formats numeric values to pixel strings
|
|
40
|
+
*/
|
|
41
|
+
var formatPixelValue = exports.formatPixelValue = function formatPixelValue(value) {
|
|
42
|
+
if (!value || value === "auto") return undefined;
|
|
43
|
+
return "".concat(value, "px");
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a value is 'auto'
|
|
48
|
+
*/
|
|
49
|
+
var isAutoValue = exports.isAutoValue = function isAutoValue(value) {
|
|
50
|
+
return value === "auto";
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Normalizes gap values, filtering out auto and invalid values
|
|
55
|
+
*/
|
|
56
|
+
var normalizeGapValue = exports.normalizeGapValue = function normalizeGapValue(value) {
|
|
57
|
+
return value && !isAutoValue(value) ? value : null;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Creates base flex styles for alignment
|
|
62
|
+
*/
|
|
63
|
+
var createBaseFlexStyles = exports.createBaseFlexStyles = function createBaseFlexStyles(direction, hasWrap, justifyContent, alignItems) {
|
|
64
|
+
return {
|
|
65
|
+
display: "flex",
|
|
66
|
+
flexDirection: direction,
|
|
67
|
+
flexWrap: hasWrap ? "wrap" : "nowrap",
|
|
68
|
+
justifyContent: justifyContent,
|
|
69
|
+
alignItems: alignItems
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Handles spacing logic when flex-wrap is disabled
|
|
75
|
+
*/
|
|
76
|
+
var calculateNoWrapSpacing = exports.calculateNoWrapSpacing = function calculateNoWrapSpacing(gap, normalizedGap, base, justifyContent, alignItems) {
|
|
77
|
+
if (isAutoValue(gap)) {
|
|
78
|
+
return {
|
|
79
|
+
justifyContent: base.justifyContent,
|
|
80
|
+
alignItems: base.alignItems
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
justifyContent: justifyContent,
|
|
85
|
+
alignItems: alignItems,
|
|
86
|
+
gap: formatPixelValue(normalizedGap)
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Handles spacing logic when flex-wrap is enabled
|
|
92
|
+
*/
|
|
93
|
+
var calculateWrapSpacing = exports.calculateWrapSpacing = function calculateWrapSpacing(gap, columngap, normalizedGap, normalizedColumnGap, normalizedRowGap, justifyContent, alignItems) {
|
|
94
|
+
var gapIsAuto = isAutoValue(gap);
|
|
95
|
+
var columnGapIsAuto = isAutoValue(columngap);
|
|
96
|
+
|
|
97
|
+
// Both gaps are auto
|
|
98
|
+
if (columnGapIsAuto && gapIsAuto) {
|
|
99
|
+
return {
|
|
100
|
+
justifyContent: justifyContent,
|
|
101
|
+
alignContent: justifyContent
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Column gap is auto, row gap is fixed
|
|
106
|
+
if (columnGapIsAuto && !gapIsAuto) {
|
|
107
|
+
return {
|
|
108
|
+
justifyContent: justifyContent,
|
|
109
|
+
alignContent: alignItems,
|
|
110
|
+
rowGap: formatPixelValue(normalizedRowGap)
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Row gap is auto, column gap is fixed
|
|
115
|
+
if (gapIsAuto && !columnGapIsAuto) {
|
|
116
|
+
return {
|
|
117
|
+
alignContent: "space-between",
|
|
118
|
+
columnGap: formatPixelValue(normalizedColumnGap)
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Both gaps have fixed values
|
|
123
|
+
return calculateFixedGapSpacing(normalizedColumnGap, normalizedRowGap, justifyContent, alignItems);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Calculates spacing when both gaps have fixed numeric values
|
|
128
|
+
*/
|
|
129
|
+
var calculateFixedGapSpacing = function calculateFixedGapSpacing(normalizedColumnGap, normalizedRowGap, justifyContent, alignItems) {
|
|
130
|
+
if (!normalizedColumnGap || !normalizedRowGap) {
|
|
131
|
+
return {};
|
|
132
|
+
}
|
|
133
|
+
var baseStyles = {
|
|
134
|
+
alignContent: alignItems,
|
|
135
|
+
justifyContent: justifyContent
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// If both gaps are equal, use shorthand
|
|
139
|
+
if (normalizedColumnGap === normalizedRowGap) {
|
|
140
|
+
return _objectSpread(_objectSpread({}, baseStyles), {}, {
|
|
141
|
+
gap: formatPixelValue(normalizedColumnGap)
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Different values, use longhand
|
|
146
|
+
return _objectSpread(_objectSpread({}, baseStyles), {}, {
|
|
147
|
+
gap: "".concat(normalizedRowGap, "px ").concat(normalizedColumnGap, "px")
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Main function to calculate alignment styles
|
|
153
|
+
*/
|
|
154
|
+
var calculateAlignmentStyles = exports.calculateAlignmentStyles = function calculateAlignmentStyles(alignmentMatrix, alignmentKey, direction, hasWrap) {
|
|
155
|
+
var base = getBaseAlignment(alignmentMatrix, alignmentKey);
|
|
156
|
+
var isRow = direction === "row";
|
|
157
|
+
var _getDirectionalAlignm = getDirectionalAlignment(base, isRow),
|
|
158
|
+
justifyContent = _getDirectionalAlignm.justifyContent,
|
|
159
|
+
alignItems = _getDirectionalAlignm.alignItems;
|
|
160
|
+
return createBaseFlexStyles(direction, hasWrap, justifyContent, alignItems);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Main function to calculate spacing styles
|
|
165
|
+
*/
|
|
166
|
+
var calculateSpacingStyles = exports.calculateSpacingStyles = function calculateSpacingStyles(alignmentMatrix, gap, columngap, alignment, direction, hasWrap) {
|
|
167
|
+
var isRow = direction === "row";
|
|
168
|
+
var base = getBaseAlignment(alignmentMatrix, alignment);
|
|
169
|
+
var _getDirectionalAlignm2 = getDirectionalAlignment(base, isRow),
|
|
170
|
+
justifyContent = _getDirectionalAlignm2.justifyContent,
|
|
171
|
+
alignItems = _getDirectionalAlignm2.alignItems;
|
|
172
|
+
|
|
173
|
+
// Normalize all gap values
|
|
174
|
+
var normalizedGap = normalizeGapValue(gap);
|
|
175
|
+
var normalizedColumnGap = normalizeGapValue(columngap);
|
|
176
|
+
var normalizedRowGap = hasWrap ? normalizedGap : null;
|
|
177
|
+
|
|
178
|
+
// Choose appropriate spacing calculation based on wrap setting
|
|
179
|
+
if (!hasWrap) {
|
|
180
|
+
return calculateNoWrapSpacing(gap, normalizedGap, base, justifyContent, alignItems);
|
|
181
|
+
}
|
|
182
|
+
return calculateWrapSpacing(gap, columngap, normalizedGap, normalizedColumnGap, normalizedRowGap, justifyContent, alignItems);
|
|
183
|
+
};
|