@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,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TrailingZeroDecimalFormatter = exports.ToNumberFormatter = exports.StringToNumberFormatter = exports.NumberToStringFormatter = exports.CurrencyFormatter = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _parseInt = _interopRequireDefault(require("lodash-es/parseInt"));
|
|
11
|
+
var _currencyConstant = _interopRequireDefault(require("../constants/currency-constant"));
|
|
12
|
+
var _appstore = _interopRequireDefault(require("../appstore"));
|
|
13
|
+
var NumberToStringFormatter = exports.NumberToStringFormatter = /*#__PURE__*/function () {
|
|
14
|
+
function NumberToStringFormatter() {
|
|
15
|
+
(0, _classCallCheck2["default"])(this, NumberToStringFormatter);
|
|
16
|
+
}
|
|
17
|
+
(0, _createClass2["default"])(NumberToStringFormatter, [{
|
|
18
|
+
key: "format",
|
|
19
|
+
value: function format(input, fractionSize) {
|
|
20
|
+
var i18nService = _appstore["default"].I18nService.get();
|
|
21
|
+
var selectedLocale = i18nService.getSelectedLocale();
|
|
22
|
+
var formatCurrency = new Intl.NumberFormat(selectedLocale, {
|
|
23
|
+
minimumFractionDigits: fractionSize,
|
|
24
|
+
maximumFractionDigits: fractionSize
|
|
25
|
+
});
|
|
26
|
+
return isNaN(input) ? "" : formatCurrency.format(input);
|
|
27
|
+
}
|
|
28
|
+
}]);
|
|
29
|
+
return NumberToStringFormatter;
|
|
30
|
+
}();
|
|
31
|
+
var CurrencyFormatter = exports.CurrencyFormatter = /*#__PURE__*/function () {
|
|
32
|
+
function CurrencyFormatter() {
|
|
33
|
+
(0, _classCallCheck2["default"])(this, CurrencyFormatter);
|
|
34
|
+
}
|
|
35
|
+
(0, _createClass2["default"])(CurrencyFormatter, [{
|
|
36
|
+
key: "format",
|
|
37
|
+
value: function format(data, currencySymbol, fracSize) {
|
|
38
|
+
var _currencySymbol = (_currencyConstant["default"][currencySymbol] || {}).symbol || currencySymbol || "";
|
|
39
|
+
var _val = new NumberToStringFormatter().format(data, fracSize);
|
|
40
|
+
var isNegativeNumber = _val.startsWith("-");
|
|
41
|
+
if (isNegativeNumber) {
|
|
42
|
+
_val = _val.replace("-", "");
|
|
43
|
+
}
|
|
44
|
+
return _val ? isNegativeNumber ? "-" + _currencySymbol + _val : _currencySymbol + _val : "";
|
|
45
|
+
}
|
|
46
|
+
}]);
|
|
47
|
+
return CurrencyFormatter;
|
|
48
|
+
}();
|
|
49
|
+
var StringToNumberFormatter = exports.StringToNumberFormatter = /*#__PURE__*/function () {
|
|
50
|
+
function StringToNumberFormatter() {
|
|
51
|
+
(0, _classCallCheck2["default"])(this, StringToNumberFormatter);
|
|
52
|
+
}
|
|
53
|
+
(0, _createClass2["default"])(StringToNumberFormatter, [{
|
|
54
|
+
key: "format",
|
|
55
|
+
value: function format(input) {
|
|
56
|
+
return (0, _parseInt["default"])(input);
|
|
57
|
+
}
|
|
58
|
+
}]);
|
|
59
|
+
return StringToNumberFormatter;
|
|
60
|
+
}();
|
|
61
|
+
var ToNumberFormatter = exports.ToNumberFormatter = /*#__PURE__*/function () {
|
|
62
|
+
function ToNumberFormatter() {
|
|
63
|
+
(0, _classCallCheck2["default"])(this, ToNumberFormatter);
|
|
64
|
+
}
|
|
65
|
+
(0, _createClass2["default"])(ToNumberFormatter, [{
|
|
66
|
+
key: "format",
|
|
67
|
+
value: function format(data, fracSize) {
|
|
68
|
+
if (isNaN(+data)) {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
var fractionFormat = fracSize;
|
|
72
|
+
|
|
73
|
+
// Handle fraction size format conversion
|
|
74
|
+
if (fracSize && !String(fracSize).match(/^(\d+)?\.((\d+)(-(\d+))?)?$/)) {
|
|
75
|
+
fractionFormat = "1." + fracSize + "-" + fracSize;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
// Parse fraction format if it's a string like "1.2-4"
|
|
79
|
+
var minimumFractionDigits = 0;
|
|
80
|
+
var maximumFractionDigits = 3;
|
|
81
|
+
if (typeof fractionFormat === "string" && fractionFormat.includes(".")) {
|
|
82
|
+
var parts = fractionFormat.split(".");
|
|
83
|
+
if (parts[1]) {
|
|
84
|
+
var fractionParts = parts[1].split("-");
|
|
85
|
+
minimumFractionDigits = (0, _parseInt["default"])(fractionParts[0]) || 0;
|
|
86
|
+
maximumFractionDigits = (0, _parseInt["default"])(fractionParts[1]) || minimumFractionDigits;
|
|
87
|
+
}
|
|
88
|
+
} else if (typeof fractionFormat === "number") {
|
|
89
|
+
minimumFractionDigits = maximumFractionDigits = fractionFormat;
|
|
90
|
+
}
|
|
91
|
+
var i18nService = _appstore["default"].I18nService.get();
|
|
92
|
+
var selectedLocale = i18nService.getSelectedLocale();
|
|
93
|
+
return new Intl.NumberFormat(selectedLocale, {
|
|
94
|
+
minimumFractionDigits: minimumFractionDigits,
|
|
95
|
+
maximumFractionDigits: maximumFractionDigits
|
|
96
|
+
}).format(+data);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
// Fallback to simple number formatting
|
|
99
|
+
var num = +data;
|
|
100
|
+
if (typeof fracSize === "number") {
|
|
101
|
+
return num.toFixed(fracSize);
|
|
102
|
+
}
|
|
103
|
+
return num.toString();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}]);
|
|
107
|
+
return ToNumberFormatter;
|
|
108
|
+
}();
|
|
109
|
+
var TrailingZeroDecimalFormatter = exports.TrailingZeroDecimalFormatter = /*#__PURE__*/function () {
|
|
110
|
+
function TrailingZeroDecimalFormatter() {
|
|
111
|
+
(0, _classCallCheck2["default"])(this, TrailingZeroDecimalFormatter);
|
|
112
|
+
}
|
|
113
|
+
(0, _createClass2["default"])(TrailingZeroDecimalFormatter, [{
|
|
114
|
+
key: "format",
|
|
115
|
+
value: function format(value, selectedLocale, numberFilter, localeFilter, trailingZero, decimalValue, skipTrailingZeroCheck, formattedLocale) {
|
|
116
|
+
var finalNumberFilter = trailingZero && !skipTrailingZeroCheck ? "1.".concat((decimalValue === null || decimalValue === void 0 ? void 0 : decimalValue.length) || 0, "-16") : numberFilter;
|
|
117
|
+
var locale = formattedLocale ? formattedLocale["number"] : undefined;
|
|
118
|
+
var finalLocale = localeFilter || locale || selectedLocale || "en";
|
|
119
|
+
try {
|
|
120
|
+
// Parse the number filter format
|
|
121
|
+
var minimumFractionDigits = 0;
|
|
122
|
+
var maximumFractionDigits = 3;
|
|
123
|
+
if (finalNumberFilter && typeof finalNumberFilter === "string" && finalNumberFilter.includes(".")) {
|
|
124
|
+
var parts = finalNumberFilter.split(".");
|
|
125
|
+
if (parts[1]) {
|
|
126
|
+
var fractionParts = parts[1].split("-");
|
|
127
|
+
minimumFractionDigits = (0, _parseInt["default"])(fractionParts[0]) || 0;
|
|
128
|
+
maximumFractionDigits = (0, _parseInt["default"])(fractionParts[1]) || minimumFractionDigits;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return new Intl.NumberFormat(finalLocale, {
|
|
132
|
+
minimumFractionDigits: minimumFractionDigits,
|
|
133
|
+
maximumFractionDigits: maximumFractionDigits
|
|
134
|
+
}).format(value);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
// Fallback formatting
|
|
137
|
+
return value.toString();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}]);
|
|
141
|
+
return TrailingZeroDecimalFormatter;
|
|
142
|
+
}();
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.TrustedContent = exports.TrustAsFormatter = exports.SanitizeFormatter = void 0;
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
13
|
+
var React = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _types = require("./types");
|
|
15
|
+
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" != _typeof3(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); }
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
var TrustAsFormatter = exports.TrustAsFormatter = /*#__PURE__*/function () {
|
|
18
|
+
function TrustAsFormatter() {
|
|
19
|
+
(0, _classCallCheck2["default"])(this, TrustAsFormatter);
|
|
20
|
+
}
|
|
21
|
+
(0, _createClass2["default"])(TrustAsFormatter, [{
|
|
22
|
+
key: "format",
|
|
23
|
+
value: function format(content) {
|
|
24
|
+
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "html";
|
|
25
|
+
if (content === null || content === undefined) {
|
|
26
|
+
return "";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Convert context to string if it's a SecurityContext enum
|
|
30
|
+
var contextStr;
|
|
31
|
+
switch (context) {
|
|
32
|
+
case "html":
|
|
33
|
+
case _types.SecurityContext.HTML:
|
|
34
|
+
contextStr = "html";
|
|
35
|
+
break;
|
|
36
|
+
case "style":
|
|
37
|
+
case _types.SecurityContext.STYLE:
|
|
38
|
+
contextStr = "style";
|
|
39
|
+
break;
|
|
40
|
+
case "script":
|
|
41
|
+
case _types.SecurityContext.SCRIPT:
|
|
42
|
+
contextStr = "script";
|
|
43
|
+
break;
|
|
44
|
+
case "url":
|
|
45
|
+
case _types.SecurityContext.URL:
|
|
46
|
+
contextStr = "url";
|
|
47
|
+
break;
|
|
48
|
+
case "resource":
|
|
49
|
+
case "resourceUrl":
|
|
50
|
+
case _types.SecurityContext.RESOURCE_URL:
|
|
51
|
+
contextStr = "resource";
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
contextStr = "html";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Return trusted value directly based on context
|
|
58
|
+
switch (contextStr) {
|
|
59
|
+
case "html":
|
|
60
|
+
return this.bypassSecurityTrustHtml(content);
|
|
61
|
+
case "style":
|
|
62
|
+
return this.bypassSecurityTrustStyle(content);
|
|
63
|
+
case "script":
|
|
64
|
+
return this.bypassSecurityTrustScript(content);
|
|
65
|
+
case "url":
|
|
66
|
+
return this.bypassSecurityTrustUrl(content);
|
|
67
|
+
case "resource":
|
|
68
|
+
return this.bypassSecurityTrustResourceUrl(content);
|
|
69
|
+
default:
|
|
70
|
+
return content;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "bypassSecurityTrustHtml",
|
|
75
|
+
value: function bypassSecurityTrustHtml(value) {
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
key: "bypassSecurityTrustStyle",
|
|
80
|
+
value: function bypassSecurityTrustStyle(value) {
|
|
81
|
+
return value;
|
|
82
|
+
}
|
|
83
|
+
}, {
|
|
84
|
+
key: "bypassSecurityTrustScript",
|
|
85
|
+
value: function bypassSecurityTrustScript(value) {
|
|
86
|
+
console.warn("Bypassing script security. Make sure you trust the content.");
|
|
87
|
+
return value;
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "bypassSecurityTrustUrl",
|
|
91
|
+
value: function bypassSecurityTrustUrl(value) {
|
|
92
|
+
// Basic URL validation
|
|
93
|
+
try {
|
|
94
|
+
new URL(value, typeof window !== "undefined" ? window.location.origin : "http://localhost");
|
|
95
|
+
return value;
|
|
96
|
+
} catch (_unused) {
|
|
97
|
+
console.warn("Invalid URL provided to trustAs formatter:", value);
|
|
98
|
+
return "";
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "bypassSecurityTrustResourceUrl",
|
|
103
|
+
value: function bypassSecurityTrustResourceUrl(value) {
|
|
104
|
+
// Basic URL validation for resource URLs
|
|
105
|
+
try {
|
|
106
|
+
new URL(value, typeof window !== "undefined" ? window.location.origin : "http://localhost");
|
|
107
|
+
return value;
|
|
108
|
+
} catch (_unused2) {
|
|
109
|
+
console.warn("Invalid resource URL provided to trustAs formatter:", value);
|
|
110
|
+
return "";
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Helper method to check if a value is trusted
|
|
115
|
+
}], [{
|
|
116
|
+
key: "isTrustedValue",
|
|
117
|
+
value: function isTrustedValue(value) {
|
|
118
|
+
return value && (0, _typeof2["default"])(value) === "object" && "__trustAs" in value && "__trustedValue" in value;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Helper method to extract trusted value
|
|
122
|
+
}, {
|
|
123
|
+
key: "getTrustedValue",
|
|
124
|
+
value: function getTrustedValue(value) {
|
|
125
|
+
if (this.isTrustedValue(value)) {
|
|
126
|
+
return value.__trustedValue;
|
|
127
|
+
}
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Helper method to get trust type
|
|
132
|
+
}, {
|
|
133
|
+
key: "getTrustType",
|
|
134
|
+
value: function getTrustType(value) {
|
|
135
|
+
if (this.isTrustedValue(value)) {
|
|
136
|
+
return value.__trustAs;
|
|
137
|
+
}
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
}]);
|
|
141
|
+
return TrustAsFormatter;
|
|
142
|
+
}();
|
|
143
|
+
var SanitizeFormatter = exports.SanitizeFormatter = /*#__PURE__*/function () {
|
|
144
|
+
function SanitizeFormatter() {
|
|
145
|
+
(0, _classCallCheck2["default"])(this, SanitizeFormatter);
|
|
146
|
+
}
|
|
147
|
+
(0, _createClass2["default"])(SanitizeFormatter, [{
|
|
148
|
+
key: "format",
|
|
149
|
+
value: function format(input) {
|
|
150
|
+
var sanitizeType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "html";
|
|
151
|
+
if (!input) return input;
|
|
152
|
+
|
|
153
|
+
// Check if input is already trusted - if so, return the trusted value
|
|
154
|
+
if (TrustAsFormatter.isTrustedValue(input)) {
|
|
155
|
+
return TrustAsFormatter.getTrustedValue(input);
|
|
156
|
+
}
|
|
157
|
+
switch (sanitizeType) {
|
|
158
|
+
case "html":
|
|
159
|
+
return this.sanitizeHtml(input);
|
|
160
|
+
case "script":
|
|
161
|
+
// Scripts should be completely removed for security
|
|
162
|
+
return "";
|
|
163
|
+
case "style":
|
|
164
|
+
return this.sanitizeStyle(input);
|
|
165
|
+
case "url":
|
|
166
|
+
case "resourceUrl":
|
|
167
|
+
return this.sanitizeUrl(input);
|
|
168
|
+
default:
|
|
169
|
+
return this.sanitizeHtml(input);
|
|
170
|
+
// Default to HTML sanitization
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}, {
|
|
174
|
+
key: "sanitizeHtml",
|
|
175
|
+
value: function sanitizeHtml(html) {
|
|
176
|
+
try {
|
|
177
|
+
// Check if we're in a browser environment and DOMPurify is available
|
|
178
|
+
if (typeof window !== "undefined" && _dompurify["default"] && typeof _dompurify["default"].sanitize === "function") {
|
|
179
|
+
// Use DOMPurify for robust HTML sanitization
|
|
180
|
+
// Configure DOMPurify to allow common safe tags and attributes
|
|
181
|
+
var cleanHtml = _dompurify["default"].sanitize(html, {
|
|
182
|
+
ALLOWED_TAGS: ["p", "div", "span", "a", "strong", "em", "u", "b", "i", "ul", "ol", "li", "br", "h1", "h2", "h3", "h4", "h5", "h6", "blockquote", "pre", "code", "table", "thead", "tbody", "tr", "td", "th", "img", "video", "audio", "source"],
|
|
183
|
+
ALLOWED_ATTR: ["href", "title", "alt", "src", "width", "height", "class", "id", "style", "target", "rel", "data-*"],
|
|
184
|
+
ALLOW_DATA_ATTR: true,
|
|
185
|
+
ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
186
|
+
});
|
|
187
|
+
return cleanHtml;
|
|
188
|
+
} else {
|
|
189
|
+
// Fallback to basic sanitization if DOMPurify is not available (e.g., in Node.js)
|
|
190
|
+
return this.basicHtmlSanitization(html);
|
|
191
|
+
}
|
|
192
|
+
} catch (error) {
|
|
193
|
+
console.error("HTML sanitization failed:", error);
|
|
194
|
+
// Fallback to basic sanitization if DOMPurify fails
|
|
195
|
+
return this.basicHtmlSanitization(html);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
key: "basicHtmlSanitization",
|
|
200
|
+
value: function basicHtmlSanitization(html) {
|
|
201
|
+
// Fallback basic HTML sanitization
|
|
202
|
+
return html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/\s*on\w+\s*=\s*["'][^"']*["']/gi, "") // Remove event handlers
|
|
203
|
+
.replace(/\s*javascript:\s*[^"'\s>]*/gi, "") // Remove javascript: URLs
|
|
204
|
+
.replace(/<iframe\b[^>]*>/gi, "") // Remove iframes
|
|
205
|
+
.replace(/<object\b[^>]*>/gi, "") // Remove objects
|
|
206
|
+
.replace(/<embed\b[^>]*>/gi, ""); // Remove embeds
|
|
207
|
+
}
|
|
208
|
+
}, {
|
|
209
|
+
key: "sanitizeStyle",
|
|
210
|
+
value: function sanitizeStyle(style) {
|
|
211
|
+
try {
|
|
212
|
+
// Check if we're in a browser environment and DOMPurify is available
|
|
213
|
+
if (typeof window !== "undefined" && _dompurify["default"] && typeof _dompurify["default"].sanitize === "function") {
|
|
214
|
+
// Use DOMPurify for CSS sanitization
|
|
215
|
+
var cleanStyle = _dompurify["default"].sanitize("<div style=\"".concat(style, "\"></div>"), {
|
|
216
|
+
ALLOWED_TAGS: ["div"],
|
|
217
|
+
ALLOWED_ATTR: ["style"]
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// Extract the style attribute value
|
|
221
|
+
var match = cleanStyle.match(/style="([^"]*)"/);
|
|
222
|
+
return match ? match[1] : "";
|
|
223
|
+
} else {
|
|
224
|
+
// Fallback to basic style sanitization
|
|
225
|
+
return style.replace(/expression\s*\(/gi, "").replace(/javascript:/gi, "").replace(/url\s*\(\s*["']?\s*javascript:/gi, "");
|
|
226
|
+
}
|
|
227
|
+
} catch (error) {
|
|
228
|
+
console.error("Style sanitization failed:", error);
|
|
229
|
+
// Fallback to basic style sanitization
|
|
230
|
+
return style.replace(/expression\s*\(/gi, "").replace(/javascript:/gi, "").replace(/url\s*\(\s*["']?\s*javascript:/gi, "");
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}, {
|
|
234
|
+
key: "sanitizeUrl",
|
|
235
|
+
value: function sanitizeUrl(url) {
|
|
236
|
+
try {
|
|
237
|
+
// Check if we're in a browser environment and DOMPurify is available
|
|
238
|
+
if (typeof window !== "undefined" && _dompurify["default"] && typeof _dompurify["default"].sanitize === "function") {
|
|
239
|
+
// Use DOMPurify for URL sanitization
|
|
240
|
+
var cleanUrl = _dompurify["default"].sanitize("<a href=\"".concat(url, "\"></a>"), {
|
|
241
|
+
ALLOWED_TAGS: ["a"],
|
|
242
|
+
ALLOWED_ATTR: ["href"]
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
// Extract the href attribute value
|
|
246
|
+
var match = cleanUrl.match(/href="([^"]*)"/);
|
|
247
|
+
var sanitizedUrl = match ? match[1] : "";
|
|
248
|
+
|
|
249
|
+
// Additional validation
|
|
250
|
+
if (sanitizedUrl && this.isValidUrl(sanitizedUrl)) {
|
|
251
|
+
return sanitizedUrl;
|
|
252
|
+
}
|
|
253
|
+
return "";
|
|
254
|
+
} else {
|
|
255
|
+
// Fallback to basic URL validation
|
|
256
|
+
return this.basicUrlSanitization(url);
|
|
257
|
+
}
|
|
258
|
+
} catch (error) {
|
|
259
|
+
console.error("URL sanitization failed:", error);
|
|
260
|
+
// Fallback to basic URL validation
|
|
261
|
+
return this.basicUrlSanitization(url);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}, {
|
|
265
|
+
key: "basicUrlSanitization",
|
|
266
|
+
value: function basicUrlSanitization(url) {
|
|
267
|
+
// Allow only safe URL schemes
|
|
268
|
+
var safeSchemes = /^(https?|ftp|mailto|tel):/i;
|
|
269
|
+
var dataScheme = /^data:[^;]+;base64,/i;
|
|
270
|
+
if (safeSchemes.test(url) || dataScheme.test(url) || url.startsWith("/") || url.startsWith("./") || url.startsWith("../")) {
|
|
271
|
+
return url;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// If URL doesn't match safe patterns, return empty string
|
|
275
|
+
return "";
|
|
276
|
+
}
|
|
277
|
+
}, {
|
|
278
|
+
key: "isValidUrl",
|
|
279
|
+
value: function isValidUrl(url) {
|
|
280
|
+
try {
|
|
281
|
+
var urlObj = new URL(url, typeof window !== "undefined" ? window.location.origin : "http://localhost");
|
|
282
|
+
var allowedProtocols = ["http:", "https:", "mailto:", "tel:", "ftp:"];
|
|
283
|
+
return allowedProtocols.includes(urlObj.protocol);
|
|
284
|
+
} catch (_unused3) {
|
|
285
|
+
// Check for relative URLs
|
|
286
|
+
return url.startsWith("/") || url.startsWith("./") || url.startsWith("../");
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}]);
|
|
290
|
+
return SanitizeFormatter;
|
|
291
|
+
}(); // React utility component to safely render trusted content
|
|
292
|
+
var TrustedContent = exports.TrustedContent = function TrustedContent(_ref) {
|
|
293
|
+
var value = _ref.value,
|
|
294
|
+
_ref$fallback = _ref.fallback,
|
|
295
|
+
fallback = _ref$fallback === void 0 ? "" : _ref$fallback;
|
|
296
|
+
if (TrustAsFormatter.isTrustedValue(value)) {
|
|
297
|
+
var trustType = TrustAsFormatter.getTrustType(value);
|
|
298
|
+
var trustedValue = TrustAsFormatter.getTrustedValue(value);
|
|
299
|
+
switch (trustType) {
|
|
300
|
+
case "html":
|
|
301
|
+
// For HTML content, use dangerouslySetInnerHTML
|
|
302
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
303
|
+
dangerouslySetInnerHTML: {
|
|
304
|
+
__html: trustedValue
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
case "style":
|
|
308
|
+
// For style content, return as style attribute
|
|
309
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
310
|
+
style: trustedValue
|
|
311
|
+
});
|
|
312
|
+
case "url":
|
|
313
|
+
case "resource":
|
|
314
|
+
// For URLs, return as href or src depending on usage
|
|
315
|
+
return trustedValue;
|
|
316
|
+
default:
|
|
317
|
+
return trustedValue || fallback;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// For non-trusted content, return as plain text or fallback
|
|
322
|
+
return value || fallback;
|
|
323
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TemplateReplaceFormatter = exports.PrependFormatter = exports.AppendFormatter = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _util = require("../util");
|
|
11
|
+
var PrependFormatter = exports.PrependFormatter = /*#__PURE__*/function () {
|
|
12
|
+
function PrependFormatter() {
|
|
13
|
+
(0, _classCallCheck2["default"])(this, PrependFormatter);
|
|
14
|
+
}
|
|
15
|
+
(0, _createClass2["default"])(PrependFormatter, [{
|
|
16
|
+
key: "format",
|
|
17
|
+
value: function format(input, prefix) {
|
|
18
|
+
return (prefix || "") + (input !== null || input != undefined ? input : "");
|
|
19
|
+
}
|
|
20
|
+
}]);
|
|
21
|
+
return PrependFormatter;
|
|
22
|
+
}();
|
|
23
|
+
var AppendFormatter = exports.AppendFormatter = /*#__PURE__*/function () {
|
|
24
|
+
function AppendFormatter() {
|
|
25
|
+
(0, _classCallCheck2["default"])(this, AppendFormatter);
|
|
26
|
+
}
|
|
27
|
+
(0, _createClass2["default"])(AppendFormatter, [{
|
|
28
|
+
key: "format",
|
|
29
|
+
value: function format(input, suffix) {
|
|
30
|
+
return (input !== null || input != undefined ? input : "") + (suffix || "");
|
|
31
|
+
}
|
|
32
|
+
}]);
|
|
33
|
+
return AppendFormatter;
|
|
34
|
+
}();
|
|
35
|
+
var TemplateReplaceFormatter = exports.TemplateReplaceFormatter = /*#__PURE__*/function () {
|
|
36
|
+
function TemplateReplaceFormatter() {
|
|
37
|
+
(0, _classCallCheck2["default"])(this, TemplateReplaceFormatter);
|
|
38
|
+
}
|
|
39
|
+
(0, _createClass2["default"])(TemplateReplaceFormatter, [{
|
|
40
|
+
key: "format",
|
|
41
|
+
value: function format(template, replacements) {
|
|
42
|
+
if (!template) return template;
|
|
43
|
+
try {
|
|
44
|
+
return (0, _util.replace)(template, replacements) || "";
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error("Template replacement failed:", error);
|
|
47
|
+
return template; // Return original template if replacement fails
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}]);
|
|
51
|
+
return TemplateReplaceFormatter;
|
|
52
|
+
}();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SecurityContext = void 0;
|
|
7
|
+
// Base formatter interface
|
|
8
|
+
// Trust marker interfaces to match Angular's DomSanitizer behavior
|
|
9
|
+
// Security Context enum to match Angular's SecurityContext
|
|
10
|
+
var SecurityContext = exports.SecurityContext = /*#__PURE__*/function (SecurityContext) {
|
|
11
|
+
SecurityContext[SecurityContext["NONE"] = 0] = "NONE";
|
|
12
|
+
SecurityContext[SecurityContext["HTML"] = 1] = "HTML";
|
|
13
|
+
SecurityContext[SecurityContext["STYLE"] = 2] = "STYLE";
|
|
14
|
+
SecurityContext[SecurityContext["SCRIPT"] = 3] = "SCRIPT";
|
|
15
|
+
SecurityContext[SecurityContext["URL"] = 4] = "URL";
|
|
16
|
+
SecurityContext[SecurityContext["RESOURCE_URL"] = 5] = "RESOURCE_URL";
|
|
17
|
+
return SecurityContext;
|
|
18
|
+
}({}); // Date formatter interface
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
var _exportNames = {};
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _formatter = _interopRequireWildcard(require("./formatter"));
|
|
10
|
+
Object.keys(_formatter).forEach(function (key) {
|
|
11
|
+
if (key === "default" || key === "__esModule") return;
|
|
12
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
13
|
+
if (key in exports && exports[key] === _formatter[key]) return;
|
|
14
|
+
Object.defineProperty(exports, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _formatter[key];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
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); }
|
|
22
|
+
// Re-export everything from the formatter directory
|
|
23
|
+
// Import and export the default formatters registry
|
|
24
|
+
var _default = exports["default"] = _formatter["default"];
|