• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jumpinjackie / mapguide-react-layout / 15160437878

21 May 2025 11:00AM UTC coverage: 21.631% (-42.6%) from 64.24%
15160437878

Pull #1552

github

web-flow
Merge 8b7153d9e into 236e2ea07
Pull Request #1552: Feature/package updates 2505

839 of 1165 branches covered (72.02%)

11 of 151 new or added lines in 25 files covered. (7.28%)

1332 existing lines in 50 files now uncovered.

4794 of 22163 relevant lines covered (21.63%)

6.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

68.89
/src/api/registry/component.tsx
1
import * as React from "react";
1✔
2
import { Error } from "../../components/error";
1✔
3
import { tr } from "../i18n";
1✔
4

5
/**
6
 * The default set of component names
7
 *
8
 * @export
9
 * @class DefaultComponentNames
10
 */
11
export enum DefaultComponentNames {
1✔
12
    Legend = "Legend",
1✔
13
    SelectionPanel = "SelectionPanel",
1✔
14
    Map = "Map",
1✔
15
    Navigator = "Navigator",
1✔
16
    MouseCoordinates = "MouseCoordinates",
1✔
17
    ScaleDisplay = "ScaleDisplay",
1✔
18
    SelectedFeatureCount = "SelectedFeatureCount",
1✔
19
    PoweredByMapGuide = "PoweredByMapGuide",
1✔
20
    TaskPane = "TaskPane",
1✔
21
    About = "About",
1✔
22
    SessionExpired = "SessionExpired",
1✔
23
    Measure = "Measure",
1✔
24
    ViewerOptions = "ViewerOptions",
1✔
25
    QuickPlot = "QuickPlot",
1✔
26
    BaseMapSwitcher = "BaseMapSwitcher",
1✔
27
    MapMenu = "MapMenu",
1✔
28
    ViewSize = "ViewSize",
1✔
29
    CoordinateTracker = "CoordinateTracker",
1✔
30
    AddManageLayers = "AddManageLayers",
1✔
31
    ShareLinkToView = "ShareLinkToView"
1✔
32
}
33

34
/**
35
 * A react component factory function signature
36
 */
37
export type ComponentFactory = (props: any) => JSX.Element;
38

39
const components: { [id: string]: ComponentFactory } = {};
1✔
40

41
/**
42
 * Registers a react component factory function for the given component id
43
 *
44
 * @export
45
 * @param {string} id
46
 * @param {ComponentFactory} factory
47
 */
48
export function registerComponentFactory(id: string, factory: ComponentFactory): void {
1✔
49
    components[id] = factory;
×
UNCOV
50
}
×
51

52
/**
53
 * Gets the registered component factory function for the given component id
54
 *
55
 * @export
56
 * @param {string} id
57
 * @returns {ComponentFactory}
58
 */
59
export function getComponentFactory(id: string): ComponentFactory | undefined {
1✔
60
    return components[id];
×
UNCOV
61
}
×
62

63
/**
64
 * Placeholder component properties
65
 *
66
 * @export
67
 * @interface IPlaceholderComponentProps
68
 */
69
export interface IPlaceholderComponentProps {
70
    /**
71
     * The id of the component this placeholder is for
72
     *
73
     * @type {string}
74
     * @memberOf IPlaceholderComponentProps
75
     */
76
    id: string;
77
    /**
78
     * The locale
79
     *
80
     * @type {string}
81
     * @memberOf IPlaceholderComponentProps
82
     */
83
    locale?: string;
84
    /**
85
     * The props of the underlying component
86
     *
87
     * @type {*}
88
     * @memberOf IPlaceholderComponentProps
89
     */
90
    componentProps?: any;
91
}
92

93
/**
94
 * A component placeholder
95
 *
96
 * @export
97
 * @class PlaceholderComponent
98
 * @extends {React.Component<IPlaceholderComponentProps, any>}
99
 */
100
export class PlaceholderComponent extends React.Component<IPlaceholderComponentProps, any> {
1✔
101
    constructor(props: IPlaceholderComponentProps) {
1✔
102
        super(props);
×
UNCOV
103
    }
×
104
    render(): JSX.Element {
1✔
105
        const { id, componentProps } = this.props;
×
106
        const factory = getComponentFactory(id);
×
107
        if (factory) {
×
108
            return factory(componentProps);
×
UNCOV
109
        } else {
×
110
            return <Error error={tr("ERR_UNREGISTERED_COMPONENT", this.props.locale, { componentId: id })} />;
×
UNCOV
111
        }
×
UNCOV
112
    }
×
113
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc