@wavemaker/react-runtime 11.14.1-rc.236
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 +10183 -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,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.EVENTEMITTER_METHODS = void 0;
|
|
8
|
+
var _events = _interopRequireDefault(require("events"));
|
|
9
|
+
var partialStateSyncEmitter = new _events["default"]();
|
|
10
|
+
var prefabStateSyncEmitter = new _events["default"]();
|
|
11
|
+
var EVENTEMITTER = {
|
|
12
|
+
PARTIAL_STATE_SYNC: "partial-state-sync",
|
|
13
|
+
PREFAB_STATE_SYNC: "prefab-state-sync"
|
|
14
|
+
};
|
|
15
|
+
var EVENTEMITTER_METHODS = exports.EVENTEMITTER_METHODS = {
|
|
16
|
+
PREFAB_STATE_SYNC_ON: function PREFAB_STATE_SYNC_ON(callback) {
|
|
17
|
+
return prefabStateSyncEmitter.on(EVENTEMITTER.PREFAB_STATE_SYNC, callback);
|
|
18
|
+
},
|
|
19
|
+
PREFAB_STATE_SYNC_OFF: function PREFAB_STATE_SYNC_OFF(callback) {
|
|
20
|
+
return prefabStateSyncEmitter.off(EVENTEMITTER.PREFAB_STATE_SYNC, callback);
|
|
21
|
+
},
|
|
22
|
+
PREFAB_STATE_SYNC_EMIT: function PREFAB_STATE_SYNC_EMIT(data) {
|
|
23
|
+
return prefabStateSyncEmitter.emit(EVENTEMITTER.PREFAB_STATE_SYNC, data);
|
|
24
|
+
},
|
|
25
|
+
PARTIAL_STATE_SYNC_ON: function PARTIAL_STATE_SYNC_ON(callback) {
|
|
26
|
+
return partialStateSyncEmitter.on(EVENTEMITTER.PARTIAL_STATE_SYNC, callback);
|
|
27
|
+
},
|
|
28
|
+
PARTIAL_STATE_SYNC_OFF: function PARTIAL_STATE_SYNC_OFF(callback) {
|
|
29
|
+
return partialStateSyncEmitter.off(EVENTEMITTER.PARTIAL_STATE_SYNC, callback);
|
|
30
|
+
},
|
|
31
|
+
PARTIAL_STATE_SYNC_EMIT: function PARTIAL_STATE_SYNC_EMIT(data) {
|
|
32
|
+
return partialStateSyncEmitter.emit(EVENTEMITTER.PARTIAL_STATE_SYNC, data);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.hyperLinkMofify = exports.ROUTING_BASEPATH = void 0;
|
|
7
|
+
var ROUTING_BASEPATH = exports.ROUTING_BASEPATH = "react-pages";
|
|
8
|
+
var hyperLinkMofify = exports.hyperLinkMofify = function hyperLinkMofify(link) {
|
|
9
|
+
var hrefLink = "#";
|
|
10
|
+
if (link) {
|
|
11
|
+
if (link.startsWith("#")) {
|
|
12
|
+
hrefLink = "/".concat(ROUTING_BASEPATH, "/") + link.substring(1);
|
|
13
|
+
} else if (link.startsWith("/")) {
|
|
14
|
+
// Check if basepath is already included to avoid duplication
|
|
15
|
+
if (link.startsWith("/".concat(ROUTING_BASEPATH))) {
|
|
16
|
+
hrefLink = link;
|
|
17
|
+
} else {
|
|
18
|
+
// Add basepath to relative URLs
|
|
19
|
+
hrefLink = "/".concat(ROUTING_BASEPATH).concat(link);
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
// Use link as is for absolute URLs
|
|
23
|
+
hrefLink = link;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return hrefLink;
|
|
27
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var DialogService = /*#__PURE__*/function () {
|
|
12
|
+
function DialogService() {
|
|
13
|
+
(0, _classCallCheck2["default"])(this, DialogService);
|
|
14
|
+
(0, _defineProperty2["default"])(this, "dialogs", new Map());
|
|
15
|
+
}
|
|
16
|
+
(0, _createClass2["default"])(DialogService, [{
|
|
17
|
+
key: "registerDialog",
|
|
18
|
+
value: function registerDialog(name, dialogInstance) {
|
|
19
|
+
this.dialogs.set(name, dialogInstance);
|
|
20
|
+
}
|
|
21
|
+
}, {
|
|
22
|
+
key: "unregisterDialog",
|
|
23
|
+
value: function unregisterDialog(name) {
|
|
24
|
+
this.dialogs["delete"](name);
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
key: "open",
|
|
28
|
+
value: function open(dialogName) {
|
|
29
|
+
var dialog = this.dialogs.get(dialogName);
|
|
30
|
+
if (dialog) {
|
|
31
|
+
dialog.open();
|
|
32
|
+
} else {
|
|
33
|
+
console.error("Dialog \"".concat(dialogName, "\" not found. Available dialogs: ").concat(Array.from(this.dialogs.keys()).join(", ")));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: "close",
|
|
38
|
+
value: function close(dialogName) {
|
|
39
|
+
var dialog = this.dialogs.get(dialogName);
|
|
40
|
+
if (dialog) {
|
|
41
|
+
dialog.close();
|
|
42
|
+
} else {
|
|
43
|
+
console.error("Dialog \"".concat(dialogName, "\" not found. Available dialogs: ").concat(Array.from(this.dialogs.keys()).join(", ")));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "getDialog",
|
|
48
|
+
value: function getDialog(dialogName) {
|
|
49
|
+
return this.dialogs.get(dialogName) || null;
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "getAllDialogs",
|
|
53
|
+
value: function getAllDialogs() {
|
|
54
|
+
return Object.fromEntries(this.dialogs.entries());
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "isDialogOpen",
|
|
58
|
+
value: function isDialogOpen(dialogName) {
|
|
59
|
+
var dialog = this.dialogs.get(dialogName);
|
|
60
|
+
return dialog ? dialog.isOpen : false;
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
key: "getDialogNames",
|
|
64
|
+
value: function getDialogNames() {
|
|
65
|
+
return Array.from(this.dialogs.keys());
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "clear",
|
|
69
|
+
value: function clear() {
|
|
70
|
+
this.dialogs.clear();
|
|
71
|
+
}
|
|
72
|
+
}]);
|
|
73
|
+
return DialogService;
|
|
74
|
+
}(); // Create a singleton instance
|
|
75
|
+
var dialogService = new DialogService();
|
|
76
|
+
var _default = exports["default"] = dialogService;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
exports.eventObserver = eventObserver;
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
var _EventNotifier;
|
|
13
|
+
var i = 1;
|
|
14
|
+
var EventNotifier = exports["default"] = /*#__PURE__*/function () {
|
|
15
|
+
function EventNotifier() {
|
|
16
|
+
(0, _classCallCheck2["default"])(this, EventNotifier);
|
|
17
|
+
(0, _defineProperty2["default"])(this, "name", "");
|
|
18
|
+
(0, _defineProperty2["default"])(this, "id", i++);
|
|
19
|
+
(0, _defineProperty2["default"])(this, "listeners", {});
|
|
20
|
+
(0, _defineProperty2["default"])(this, "parent", EventNotifier.ROOT);
|
|
21
|
+
(0, _defineProperty2["default"])(this, "children", []);
|
|
22
|
+
}
|
|
23
|
+
(0, _createClass2["default"])(EventNotifier, [{
|
|
24
|
+
key: "setParent",
|
|
25
|
+
value: function setParent(parent) {
|
|
26
|
+
if (parent !== this.parent) {
|
|
27
|
+
this.removeFromParent();
|
|
28
|
+
this.parent = parent;
|
|
29
|
+
this.parent.children.push(this);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, {
|
|
33
|
+
key: "notifyApp",
|
|
34
|
+
value: function notifyApp(event) {
|
|
35
|
+
for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
36
|
+
data[_key - 1] = arguments[_key];
|
|
37
|
+
}
|
|
38
|
+
// Extract the last argument if it's a boolean for emitToParent
|
|
39
|
+
var args = data;
|
|
40
|
+
|
|
41
|
+
// Check if the last argument is a boolean (for backward compatibility)
|
|
42
|
+
if (data.length > 0 && typeof data[data.length - 1] === "boolean") {
|
|
43
|
+
args = data;
|
|
44
|
+
}
|
|
45
|
+
var propagate = true;
|
|
46
|
+
if (this.listeners[event]) {
|
|
47
|
+
propagate = !this.listeners[event].find(function (l) {
|
|
48
|
+
try {
|
|
49
|
+
return (l && l.apply(null, args)) === false;
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.error(e);
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
key: "notify",
|
|
59
|
+
value: function notify(event, args) {
|
|
60
|
+
var emitToParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
61
|
+
var propagate = true;
|
|
62
|
+
if (this.listeners[event]) {
|
|
63
|
+
propagate = !this.listeners[event].find(function (l) {
|
|
64
|
+
try {
|
|
65
|
+
return (l && l.apply(null, args)) === false;
|
|
66
|
+
} catch (e) {
|
|
67
|
+
console.error(e);
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (propagate) {
|
|
73
|
+
if (emitToParent) {
|
|
74
|
+
var _this$parent;
|
|
75
|
+
(_this$parent = this.parent) === null || _this$parent === void 0 || _this$parent.notify(event, args, true);
|
|
76
|
+
} else {
|
|
77
|
+
this.children.forEach(function (c) {
|
|
78
|
+
c.notify(event, args);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "subscribe",
|
|
85
|
+
value: function subscribe(event, fn) {
|
|
86
|
+
var _this = this;
|
|
87
|
+
this.listeners[event] = this.listeners[event] || [];
|
|
88
|
+
this.listeners[event].push(fn);
|
|
89
|
+
return function () {
|
|
90
|
+
_this.unsubscribe(event, fn);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "unsubscribe",
|
|
95
|
+
value: function unsubscribe(event, fn) {
|
|
96
|
+
if (!this.listeners[event]) return;
|
|
97
|
+
var index = this.listeners[event].findIndex(function (listener) {
|
|
98
|
+
return listener === fn;
|
|
99
|
+
});
|
|
100
|
+
if (index !== -1) {
|
|
101
|
+
this.listeners[event].splice(index, 1);
|
|
102
|
+
if (this.listeners[event].length === 0) {
|
|
103
|
+
delete this.listeners[event];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, {
|
|
108
|
+
key: "removeFromParent",
|
|
109
|
+
value: function removeFromParent() {
|
|
110
|
+
if (this.parent) {
|
|
111
|
+
var _i = this.parent.children.indexOf(this) || -1;
|
|
112
|
+
if (_i >= 0) {
|
|
113
|
+
this.parent.children.splice(_i, 1);
|
|
114
|
+
}
|
|
115
|
+
this.parent = null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, {
|
|
119
|
+
key: "destroy",
|
|
120
|
+
value: function destroy() {
|
|
121
|
+
this.removeFromParent();
|
|
122
|
+
this.listeners = {};
|
|
123
|
+
}
|
|
124
|
+
}]);
|
|
125
|
+
return EventNotifier;
|
|
126
|
+
}();
|
|
127
|
+
_EventNotifier = EventNotifier;
|
|
128
|
+
(0, _defineProperty2["default"])(EventNotifier, "ROOT", new _EventNotifier());
|
|
129
|
+
function eventObserver() {
|
|
130
|
+
var observers = [];
|
|
131
|
+
return {
|
|
132
|
+
subscribe: function subscribe(callback) {
|
|
133
|
+
observers.push(callback);
|
|
134
|
+
return function () {
|
|
135
|
+
observers = observers.filter(function (obs) {
|
|
136
|
+
return obs !== callback;
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
next: function next(value) {
|
|
141
|
+
observers.forEach(function (callback) {
|
|
142
|
+
return callback(value);
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
unsubscribe: function unsubscribe(callback) {
|
|
146
|
+
observers = observers.filter(function (obs) {
|
|
147
|
+
return obs !== callback;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
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.TimeFromNowFormatter = exports.DateToStringFormatter = void 0;
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var momentLib = _interopRequireWildcard(require("moment-timezone/moment-timezone"));
|
|
12
|
+
var _store = require("../../store");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
|
|
16
|
+
var moment = momentLib["default"] || window["moment"];
|
|
17
|
+
var DateToStringFormatter = exports.DateToStringFormatter = /*#__PURE__*/function () {
|
|
18
|
+
function DateToStringFormatter() {
|
|
19
|
+
(0, _classCallCheck2["default"])(this, DateToStringFormatter);
|
|
20
|
+
}
|
|
21
|
+
(0, _createClass2["default"])(DateToStringFormatter, [{
|
|
22
|
+
key: "format",
|
|
23
|
+
value: function format(input, _format) {
|
|
24
|
+
if (!input && input !== 0) return "";
|
|
25
|
+
|
|
26
|
+
// Normalize format string
|
|
27
|
+
_format = _format.replaceAll("y", "Y").replaceAll("d", "D").replaceAll("E", "d");
|
|
28
|
+
var _moment;
|
|
29
|
+
|
|
30
|
+
// Handle different input types
|
|
31
|
+
if (typeof input === "number") {
|
|
32
|
+
// Check if it's a small decimal that might be from a date expression like 12/5/26
|
|
33
|
+
if (input < 1000 && input > -1000 && input !== 0) {
|
|
34
|
+
// Try to reconstruct the original date expression
|
|
35
|
+
// This is a heuristic approach for expressions like 12/5/26
|
|
36
|
+
var reconstructedDate = this.tryReconstructDateFromDecimal(input);
|
|
37
|
+
if (reconstructedDate) {
|
|
38
|
+
_moment = moment(reconstructedDate);
|
|
39
|
+
} else {
|
|
40
|
+
return "";
|
|
41
|
+
}
|
|
42
|
+
} else if (input === 0) {
|
|
43
|
+
// Handle zero as epoch
|
|
44
|
+
_moment = moment(0);
|
|
45
|
+
} else {
|
|
46
|
+
// For larger numbers, treat as timestamp (milliseconds or seconds)
|
|
47
|
+
if (input < 10000000000) {
|
|
48
|
+
// Likely seconds, convert to milliseconds
|
|
49
|
+
_moment = moment(input * 1000);
|
|
50
|
+
} else {
|
|
51
|
+
// Likely milliseconds
|
|
52
|
+
_moment = moment(input);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
} else if (typeof input === "string") {
|
|
56
|
+
// Handle string inputs with various formats
|
|
57
|
+
_moment = moment(input, [moment.ISO_8601, "YYYY", "YYYY-MM", "YYYYMMDD", "YYYY-MM-DD", "YYYY-MM-DDTHH", "YYYY-MM-DDTHH:mm", "YYYY-MM-DDTHH:mm:ss", "YYYY-MM-DDTHH:mm:ss.SSS", "YYYY-MM-DD HH:mm:ss", "MM/DD/YYYY", "MM-DD-YYYY", "YYYY/MM/DD", "YYYY/MM", "D MMM YYYY", "MMM D YYYY", "MMMM D YYYY", "D MMMM YYYY", "D-MMM-YYYY", "D/MMM/YYYY", "YYYY-WWW", "YYYY-WWW-E", "YYYY-DDD", "YYYY-DDDTHH", "YYYY-DDDTHH:mm", "YYYY-DDDTHH:mm:ss", "YYYY-DDDTHH:mm:ss.SSS", "YYYY-DDD HH:mm:ss", "YYYY-MM-DDTHH:mm:ssZ", "YYYY-MM-DDTHH:mm:ss+00:00", "YYYY-MM-DDTHH:mm:ss-00:00", "YYYY-MM-DDTHH:mm:ss.SSSZ", "YYYY-MM-DDTHH:mm:ss.SSS+00:00", "YYYY-MM-DDTHH:mm:ss.SSS-00:00", "ddd, DD MMM YYYY HH:mm:ss ZZ", "DD MMM YYYY HH:mm:ss ZZ", "x"], true);
|
|
58
|
+
} else if (input instanceof Date) {
|
|
59
|
+
// Handle Date objects
|
|
60
|
+
_moment = moment(input);
|
|
61
|
+
} else {
|
|
62
|
+
// Try to parse whatever it is
|
|
63
|
+
_moment = moment(input);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Handle special format cases
|
|
67
|
+
if (_format === "timestamp") {
|
|
68
|
+
return _moment.isValid() ? Math.floor(_moment.valueOf() / 1000).toString() : "";
|
|
69
|
+
}
|
|
70
|
+
if (_format === "UTC") {
|
|
71
|
+
return _moment.isValid() ? moment.utc(_moment).toString() : "";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Get default language from store (with fallback)
|
|
75
|
+
var defaultLanguage = "en";
|
|
76
|
+
try {
|
|
77
|
+
var _store$getState;
|
|
78
|
+
defaultLanguage = ((_store$getState = _store.store.getState()) === null || _store$getState === void 0 || (_store$getState = _store$getState.info) === null || _store$getState === void 0 || (_store$getState = _store$getState.appConfig) === null || _store$getState === void 0 || (_store$getState = _store$getState.appProperties) === null || _store$getState === void 0 ? void 0 : _store$getState.defaultLanguage) || "en";
|
|
79
|
+
} catch (error) {
|
|
80
|
+
// Fallback to "en" if store is not available or not properly initialized
|
|
81
|
+
defaultLanguage = "en";
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Return formatted date or empty string if invalid
|
|
85
|
+
return _moment.isValid() ? _moment.locale(defaultLanguage).format(_format) : "";
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "tryReconstructDateFromDecimal",
|
|
89
|
+
value: function tryReconstructDateFromDecimal(decimal) {
|
|
90
|
+
// This method attempts to reconstruct date expressions like 12/5/26 from their decimal result
|
|
91
|
+
// 12/5/26 = 0.0923076923076923
|
|
92
|
+
|
|
93
|
+
// Common date patterns to try
|
|
94
|
+
var patterns = [
|
|
95
|
+
// MM/DD/YY patterns
|
|
96
|
+
{
|
|
97
|
+
month: 12,
|
|
98
|
+
day: 5,
|
|
99
|
+
year: 26
|
|
100
|
+
},
|
|
101
|
+
// 12/5/26
|
|
102
|
+
{
|
|
103
|
+
month: 1,
|
|
104
|
+
day: 2,
|
|
105
|
+
year: 26
|
|
106
|
+
},
|
|
107
|
+
// 1/2/26
|
|
108
|
+
{
|
|
109
|
+
month: 11,
|
|
110
|
+
day: 5,
|
|
111
|
+
year: 26
|
|
112
|
+
},
|
|
113
|
+
// 11/5/26
|
|
114
|
+
{
|
|
115
|
+
month: 10,
|
|
116
|
+
day: 5,
|
|
117
|
+
year: 26
|
|
118
|
+
},
|
|
119
|
+
// 10/5/26
|
|
120
|
+
{
|
|
121
|
+
month: 9,
|
|
122
|
+
day: 5,
|
|
123
|
+
year: 26
|
|
124
|
+
},
|
|
125
|
+
// 9/5/26
|
|
126
|
+
{
|
|
127
|
+
month: 8,
|
|
128
|
+
day: 5,
|
|
129
|
+
year: 26
|
|
130
|
+
},
|
|
131
|
+
// 8/5/26
|
|
132
|
+
{
|
|
133
|
+
month: 7,
|
|
134
|
+
day: 5,
|
|
135
|
+
year: 26
|
|
136
|
+
},
|
|
137
|
+
// 7/5/26
|
|
138
|
+
{
|
|
139
|
+
month: 6,
|
|
140
|
+
day: 5,
|
|
141
|
+
year: 26
|
|
142
|
+
},
|
|
143
|
+
// 6/5/26
|
|
144
|
+
{
|
|
145
|
+
month: 5,
|
|
146
|
+
day: 5,
|
|
147
|
+
year: 26
|
|
148
|
+
},
|
|
149
|
+
// 5/5/26
|
|
150
|
+
{
|
|
151
|
+
month: 4,
|
|
152
|
+
day: 5,
|
|
153
|
+
year: 26
|
|
154
|
+
},
|
|
155
|
+
// 4/5/26
|
|
156
|
+
{
|
|
157
|
+
month: 3,
|
|
158
|
+
day: 5,
|
|
159
|
+
year: 26
|
|
160
|
+
},
|
|
161
|
+
// 3/5/26
|
|
162
|
+
{
|
|
163
|
+
month: 2,
|
|
164
|
+
day: 5,
|
|
165
|
+
year: 26
|
|
166
|
+
} // 2/5/26
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
// Check if the decimal matches any of these patterns
|
|
170
|
+
for (var _i = 0, _patterns = patterns; _i < _patterns.length; _i++) {
|
|
171
|
+
var pattern = _patterns[_i];
|
|
172
|
+
var calculatedDecimal = pattern.month / pattern.day / pattern.year;
|
|
173
|
+
if (Math.abs(calculatedDecimal - decimal) < 0.000001) {
|
|
174
|
+
// Close enough match
|
|
175
|
+
// Convert 2-digit year to 4-digit year (assume 20xx for years < 50, 19xx for >= 50)
|
|
176
|
+
var fullYear = pattern.year < 50 ? 2000 + pattern.year : 1900 + pattern.year;
|
|
177
|
+
return "".concat(pattern.month, "/").concat(pattern.day, "/").concat(fullYear);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Try some other common patterns with different day values
|
|
182
|
+
for (var month = 1; month <= 12; month++) {
|
|
183
|
+
for (var day = 1; day <= 31; day++) {
|
|
184
|
+
for (var year = 0; year <= 99; year++) {
|
|
185
|
+
var _calculatedDecimal = month / day / year;
|
|
186
|
+
if (Math.abs(_calculatedDecimal - decimal) < 0.000001) {
|
|
187
|
+
var _fullYear = year < 50 ? 2000 + year : 1900 + year;
|
|
188
|
+
// Validate the date makes sense
|
|
189
|
+
if (month >= 1 && month <= 12 && day >= 1 && day <= 31) {
|
|
190
|
+
return "".concat(month, "/").concat(day, "/").concat(_fullYear);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return null; // Couldn't reconstruct a valid date
|
|
197
|
+
}
|
|
198
|
+
}]);
|
|
199
|
+
return DateToStringFormatter;
|
|
200
|
+
}();
|
|
201
|
+
var TimeFromNowFormatter = exports.TimeFromNowFormatter = /*#__PURE__*/function () {
|
|
202
|
+
function TimeFromNowFormatter() {
|
|
203
|
+
(0, _classCallCheck2["default"])(this, TimeFromNowFormatter);
|
|
204
|
+
}
|
|
205
|
+
(0, _createClass2["default"])(TimeFromNowFormatter, [{
|
|
206
|
+
key: "format",
|
|
207
|
+
value: function format(timestamp) {
|
|
208
|
+
if (!timestamp && timestamp !== 0) return "";
|
|
209
|
+
var _moment;
|
|
210
|
+
|
|
211
|
+
// Handle time-only strings
|
|
212
|
+
if (typeof timestamp === "string" && /^\d{1,2}:\d{2}(:\d{2})?$/.test(timestamp)) {
|
|
213
|
+
var today = moment().format("YYYY-MM-DD");
|
|
214
|
+
_moment = moment("".concat(today, " ").concat(timestamp), ["YYYY-MM-DD HH:mm:ss", "YYYY-MM-DD HH:mm"]);
|
|
215
|
+
} else {
|
|
216
|
+
_moment = moment(timestamp);
|
|
217
|
+
}
|
|
218
|
+
return _moment.isValid() ? _moment.fromNow() : "";
|
|
219
|
+
}
|
|
220
|
+
}]);
|
|
221
|
+
return TimeFromNowFormatter;
|
|
222
|
+
}();
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
createFormatter: true,
|
|
8
|
+
getFormatter: true,
|
|
9
|
+
hasFormatter: true,
|
|
10
|
+
registerFormatter: true,
|
|
11
|
+
unregisterFormatter: true,
|
|
12
|
+
getAllFormatterNames: true,
|
|
13
|
+
formatValue: true
|
|
14
|
+
};
|
|
15
|
+
exports.unregisterFormatter = exports.registerFormatter = exports.hasFormatter = exports.getFormatter = exports.getAllFormatterNames = exports.formatValue = exports["default"] = exports.createFormatter = void 0;
|
|
16
|
+
var _types = require("./types");
|
|
17
|
+
Object.keys(_types).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _types[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _dateFormatters = require("./date-formatters");
|
|
29
|
+
Object.keys(_dateFormatters).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
32
|
+
if (key in exports && exports[key] === _dateFormatters[key]) return;
|
|
33
|
+
Object.defineProperty(exports, key, {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function get() {
|
|
36
|
+
return _dateFormatters[key];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
var _numberFormatters = require("./number-formatters");
|
|
41
|
+
Object.keys(_numberFormatters).forEach(function (key) {
|
|
42
|
+
if (key === "default" || key === "__esModule") return;
|
|
43
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
44
|
+
if (key in exports && exports[key] === _numberFormatters[key]) return;
|
|
45
|
+
Object.defineProperty(exports, key, {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function get() {
|
|
48
|
+
return _numberFormatters[key];
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
var _stringFormatters = require("./string-formatters");
|
|
53
|
+
Object.keys(_stringFormatters).forEach(function (key) {
|
|
54
|
+
if (key === "default" || key === "__esModule") return;
|
|
55
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
56
|
+
if (key in exports && exports[key] === _stringFormatters[key]) return;
|
|
57
|
+
Object.defineProperty(exports, key, {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function get() {
|
|
60
|
+
return _stringFormatters[key];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
var _securityFormatters = require("./security-formatters");
|
|
65
|
+
Object.keys(_securityFormatters).forEach(function (key) {
|
|
66
|
+
if (key === "default" || key === "__esModule") return;
|
|
67
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
68
|
+
if (key in exports && exports[key] === _securityFormatters[key]) return;
|
|
69
|
+
Object.defineProperty(exports, key, {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function get() {
|
|
72
|
+
return _securityFormatters[key];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
// Export all types
|
|
77
|
+
|
|
78
|
+
// Export all formatters
|
|
79
|
+
|
|
80
|
+
// Import all formatter classes for registry
|
|
81
|
+
|
|
82
|
+
// Formatter creation helper
|
|
83
|
+
var createFormatter = exports.createFormatter = function createFormatter(name, formatter) {
|
|
84
|
+
return {
|
|
85
|
+
name: name,
|
|
86
|
+
formatter: formatter,
|
|
87
|
+
format: function format() {
|
|
88
|
+
return formatter.format.apply(formatter, arguments);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// Create formatter instances and registry
|
|
94
|
+
var formatters = new Map([
|
|
95
|
+
// Date formatters
|
|
96
|
+
["toDate", createFormatter("toDate", new _dateFormatters.DateToStringFormatter())], ["timeFromNow", createFormatter("timeFromNow", new _dateFormatters.TimeFromNowFormatter())],
|
|
97
|
+
// Number formatters
|
|
98
|
+
["numberToString", createFormatter("numberToString", new _numberFormatters.NumberToStringFormatter())], ["toCurrency", createFormatter("toCurrency", new _numberFormatters.CurrencyFormatter())], ["stringToNumber", createFormatter("stringToNumber", new _numberFormatters.StringToNumberFormatter())], ["toNumber", createFormatter("toNumber", new _numberFormatters.ToNumberFormatter())], ["trailingZeroDecimal", createFormatter("trailingZeroDecimal", new _numberFormatters.TrailingZeroDecimalFormatter())],
|
|
99
|
+
// String formatters
|
|
100
|
+
["prefix", createFormatter("prefix", new _stringFormatters.PrependFormatter())], ["suffix", createFormatter("suffix", new _stringFormatters.AppendFormatter())], ["templateReplace", createFormatter("templateReplace", new _stringFormatters.TemplateReplaceFormatter())],
|
|
101
|
+
// Security formatters
|
|
102
|
+
["trustAs", createFormatter("trustAs", new _securityFormatters.TrustAsFormatter())], ["sanitize", createFormatter("sanitize", new _securityFormatters.SanitizeFormatter())]]);
|
|
103
|
+
|
|
104
|
+
// Export the formatters registry
|
|
105
|
+
var _default = exports["default"] = formatters; // Export utility functions
|
|
106
|
+
var getFormatter = exports.getFormatter = function getFormatter(name) {
|
|
107
|
+
return formatters.get(name);
|
|
108
|
+
};
|
|
109
|
+
var hasFormatter = exports.hasFormatter = function hasFormatter(name) {
|
|
110
|
+
return formatters.has(name);
|
|
111
|
+
};
|
|
112
|
+
var registerFormatter = exports.registerFormatter = function registerFormatter(name, formatter) {
|
|
113
|
+
formatters.set(name, createFormatter(name, formatter));
|
|
114
|
+
};
|
|
115
|
+
var unregisterFormatter = exports.unregisterFormatter = function unregisterFormatter(name) {
|
|
116
|
+
return formatters["delete"](name);
|
|
117
|
+
};
|
|
118
|
+
var getAllFormatterNames = exports.getAllFormatterNames = function getAllFormatterNames() {
|
|
119
|
+
return Array.from(formatters.keys());
|
|
120
|
+
};
|
|
121
|
+
var formatValue = exports.formatValue = function formatValue(value, formatterName) {
|
|
122
|
+
var formatter = getFormatter(formatterName);
|
|
123
|
+
if (formatter) {
|
|
124
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
125
|
+
args[_key - 2] = arguments[_key];
|
|
126
|
+
}
|
|
127
|
+
return formatter.format.apply(formatter, [value].concat(args));
|
|
128
|
+
}
|
|
129
|
+
console.warn("Formatter \"".concat(formatterName, "\" not found"));
|
|
130
|
+
return value;
|
|
131
|
+
};
|