@egen-civitas/esm-framework 1.0.0
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/README.md +5 -0
- package/dist/declarations.d.js +0 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/internal.d.ts +18 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +17 -0
- package/mock-jest.tsx +169 -0
- package/mock.tsx +170 -0
- package/package.json +123 -0
package/README.md
ADDED
|
File without changes
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from '@egen-civitas/esm-tenant';
|
|
2
|
+
export * from '@egen-civitas/esm-api';
|
|
3
|
+
export * from '@egen-civitas/esm-config';
|
|
4
|
+
export * from '@egen-civitas/esm-context';
|
|
5
|
+
export * from '@egen-civitas/esm-dynamic-loading';
|
|
6
|
+
export * from '@egen-civitas/esm-data-api';
|
|
7
|
+
export * from '@egen-civitas/esm-error-handling';
|
|
8
|
+
export * from '@egen-civitas/esm-expression-evaluator';
|
|
9
|
+
export * from '@egen-civitas/esm-extensions';
|
|
10
|
+
export * from '@egen-civitas/esm-feature-flags';
|
|
11
|
+
export * from '@egen-civitas/esm-globals';
|
|
12
|
+
export * from '@egen-civitas/esm-navigation';
|
|
13
|
+
export * from '@egen-civitas/esm-offline';
|
|
14
|
+
export * from '@egen-civitas/esm-react-utils';
|
|
15
|
+
export * from '@egen-civitas/esm-state';
|
|
16
|
+
export * from '@egen-civitas/esm-styleguide';
|
|
17
|
+
export * from '@egen-civitas/esm-translations';
|
|
18
|
+
export * from '@egen-civitas/esm-utils';
|
|
19
|
+
export * from '@egen-civitas/esm-ai-framework';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from "@egen-civitas/esm-tenant";
|
|
2
|
+
export * from "@egen-civitas/esm-api";
|
|
3
|
+
export * from "@egen-civitas/esm-config";
|
|
4
|
+
export * from "@egen-civitas/esm-context";
|
|
5
|
+
export * from "@egen-civitas/esm-dynamic-loading";
|
|
6
|
+
export * from "@egen-civitas/esm-data-api";
|
|
7
|
+
export * from "@egen-civitas/esm-error-handling";
|
|
8
|
+
export * from "@egen-civitas/esm-expression-evaluator";
|
|
9
|
+
export * from "@egen-civitas/esm-extensions";
|
|
10
|
+
export * from "@egen-civitas/esm-feature-flags";
|
|
11
|
+
export * from "@egen-civitas/esm-globals";
|
|
12
|
+
export * from "@egen-civitas/esm-navigation";
|
|
13
|
+
export * from "@egen-civitas/esm-offline";
|
|
14
|
+
export * from "@egen-civitas/esm-react-utils";
|
|
15
|
+
export * from "@egen-civitas/esm-state";
|
|
16
|
+
export * from "@egen-civitas/esm-styleguide";
|
|
17
|
+
export * from "@egen-civitas/esm-translations";
|
|
18
|
+
export * from "@egen-civitas/esm-utils";
|
|
19
|
+
export * from "@egen-civitas/esm-ai-framework";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from '@egen-civitas/esm-api';
|
|
2
|
+
export * from '@egen-civitas/esm-config';
|
|
3
|
+
export * from '@egen-civitas/esm-dynamic-loading';
|
|
4
|
+
export * from '@egen-civitas/esm-data-api';
|
|
5
|
+
export * from '@egen-civitas/esm-error-handling';
|
|
6
|
+
export * from '@egen-civitas/esm-expression-evaluator';
|
|
7
|
+
export * from '@egen-civitas/esm-extensions';
|
|
8
|
+
export * from '@egen-civitas/esm-feature-flags';
|
|
9
|
+
export * from '@egen-civitas/esm-globals';
|
|
10
|
+
export * from '@egen-civitas/esm-navigation';
|
|
11
|
+
export * from '@egen-civitas/esm-offline';
|
|
12
|
+
export * from '@egen-civitas/esm-react-utils';
|
|
13
|
+
export * from '@egen-civitas/esm-routes';
|
|
14
|
+
export * from '@egen-civitas/esm-state';
|
|
15
|
+
export * from '@egen-civitas/esm-styleguide';
|
|
16
|
+
export * from '@egen-civitas/esm-translations';
|
|
17
|
+
export * from '@egen-civitas/esm-utils';
|
|
18
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC"}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "@egen-civitas/esm-api";
|
|
2
|
+
export * from "@egen-civitas/esm-config";
|
|
3
|
+
export * from "@egen-civitas/esm-dynamic-loading";
|
|
4
|
+
export * from "@egen-civitas/esm-data-api";
|
|
5
|
+
export * from "@egen-civitas/esm-error-handling";
|
|
6
|
+
export * from "@egen-civitas/esm-expression-evaluator";
|
|
7
|
+
export * from "@egen-civitas/esm-extensions";
|
|
8
|
+
export * from "@egen-civitas/esm-feature-flags";
|
|
9
|
+
export * from "@egen-civitas/esm-globals";
|
|
10
|
+
export * from "@egen-civitas/esm-navigation";
|
|
11
|
+
export * from "@egen-civitas/esm-offline";
|
|
12
|
+
export * from "@egen-civitas/esm-react-utils";
|
|
13
|
+
export * from "@egen-civitas/esm-routes";
|
|
14
|
+
export * from "@egen-civitas/esm-state";
|
|
15
|
+
export * from "@egen-civitas/esm-styleguide";
|
|
16
|
+
export * from "@egen-civitas/esm-translations";
|
|
17
|
+
export * from "@egen-civitas/esm-utils";
|
package/mock-jest.tsx
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { NEVER } from 'rxjs';
|
|
3
|
+
import type {} from '@egen-civitas/esm-globals';
|
|
4
|
+
import * as utils from '@egen-civitas/esm-utils/mock';
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
|
|
7
|
+
window.i18next = { ...window.i18next, language: 'en' };
|
|
8
|
+
|
|
9
|
+
export * from '@egen-civitas/esm-api/mock';
|
|
10
|
+
export * from '@egen-civitas/esm-data-api/mock';
|
|
11
|
+
export * from '@egen-civitas/esm-config/mock';
|
|
12
|
+
export * from '@egen-civitas/esm-context';
|
|
13
|
+
export * from '@egen-civitas/esm-expression-evaluator';
|
|
14
|
+
export * from '@egen-civitas/esm-extensions/mock';
|
|
15
|
+
export * from '@egen-civitas/esm-react-utils/mock';
|
|
16
|
+
export * from '@egen-civitas/esm-state/mock';
|
|
17
|
+
export * from '@egen-civitas/esm-styleguide/mock';
|
|
18
|
+
export * from '@egen-civitas/esm-translations/mock';
|
|
19
|
+
|
|
20
|
+
export { parseDate, formatDate, formatDatetime, formatTime, isEgenDateToday, matchLocale } from '@egen-civitas/esm-utils';
|
|
21
|
+
|
|
22
|
+
/* esm-globals */
|
|
23
|
+
|
|
24
|
+
export function setupPaths(config: any) {
|
|
25
|
+
window.egenBase = config.apiUrl;
|
|
26
|
+
window.spaBase = config.spaPath;
|
|
27
|
+
window.spaEnv = config.env || 'production';
|
|
28
|
+
window.spaVersion = process.env.BUILD_VERSION ?? 'local';
|
|
29
|
+
window.getEgenSpaBase = () => `${window.spaBase}/`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* esm-dynamic-loading */
|
|
33
|
+
export const importDynamic = jest.fn();
|
|
34
|
+
|
|
35
|
+
/* esm-error-handling */
|
|
36
|
+
export const createErrorHandler = () => jest.fn().mockReturnValue(NEVER);
|
|
37
|
+
|
|
38
|
+
export const reportError = jest.fn().mockImplementation((error) => {
|
|
39
|
+
throw error;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
/* esm-feature-flags */
|
|
43
|
+
export const registerFeatureFlags = jest.fn();
|
|
44
|
+
export const getFeatureFlag = jest.fn().mockReturnValue(true);
|
|
45
|
+
export const subscribeToFeatureFlag = jest.fn((name: string, callback) => callback(true));
|
|
46
|
+
|
|
47
|
+
/* esm-navigation */
|
|
48
|
+
export { interpolateUrl, interpolateString } from '@egen-civitas/esm-navigation';
|
|
49
|
+
export const navigate = jest.fn();
|
|
50
|
+
export const getHistory = jest.fn(() => ['https://egen.alpha.vercel.com/home']);
|
|
51
|
+
export const clearHistory = jest.fn();
|
|
52
|
+
export const goBackInHistory = jest.fn();
|
|
53
|
+
|
|
54
|
+
/* esm-offline */
|
|
55
|
+
export const useConnectivity = jest.fn().mockReturnValue(true);
|
|
56
|
+
export const subscribeConnectivity = jest.fn();
|
|
57
|
+
|
|
58
|
+
/* esm-styleguide */
|
|
59
|
+
export const showNotification = jest.fn();
|
|
60
|
+
export const showActionableNotification = jest.fn();
|
|
61
|
+
export const showToast = jest.fn();
|
|
62
|
+
export const showSnackbar = jest.fn();
|
|
63
|
+
export const showModal = jest.fn();
|
|
64
|
+
|
|
65
|
+
export const LeftNavMenu = jest.fn(() => <div>Left Nav Menu</div>);
|
|
66
|
+
export const setLeftNav = jest.fn();
|
|
67
|
+
export const unsetLeftNav = jest.fn();
|
|
68
|
+
export const ResponsiveWrapper = jest.fn(({ children }) => <>{children}</>);
|
|
69
|
+
export const ErrorState = jest.fn(() => <div>Error State</div>);
|
|
70
|
+
|
|
71
|
+
export const CustomOverflowMenu = jest.fn(({ menuTitle, children }) => (
|
|
72
|
+
<div>
|
|
73
|
+
<button>{menuTitle}</button>
|
|
74
|
+
{children}
|
|
75
|
+
</div>
|
|
76
|
+
));
|
|
77
|
+
export const CustomOverflowMenuItem = jest.fn(({ itemText, ...props }) => (
|
|
78
|
+
<button role="menuitem" {...props}>
|
|
79
|
+
{itemText}
|
|
80
|
+
</button>
|
|
81
|
+
));
|
|
82
|
+
export const EntityBannerActionsMenu = jest.fn(() => <div>Entity Banner Actions Menu</div>);
|
|
83
|
+
export const EntityBannerContactDetails = jest.fn(() => <div>Entity Banner Contact Details</div>);
|
|
84
|
+
export const EntityBannerEntityInfo = jest.fn(() => <div>Entity Banner Entity Info</div>);
|
|
85
|
+
export const EntityBannerEntityIdentifiers = jest.fn(() => <div>Entity Banner Entity Identifier</div>);
|
|
86
|
+
export const EntityBannerToggleContactDetailsButton = jest.fn(() => (
|
|
87
|
+
<div>Entity Banner Toggle Contact Details Button</div>
|
|
88
|
+
));
|
|
89
|
+
export const EntityPhoto = jest.fn(() => <div>Entity Photo</div>);
|
|
90
|
+
export const useEntityPhoto = jest.fn(() => ({
|
|
91
|
+
isLoading: true,
|
|
92
|
+
data: null,
|
|
93
|
+
error: null,
|
|
94
|
+
}));
|
|
95
|
+
|
|
96
|
+
export const ActionMenuButton = jest.fn(({ handler }) => <button onClick={handler}>Action Menu Button</button>);
|
|
97
|
+
export const ActionMenuButton2 = jest.fn(({ label, tagContent, icon }) => (
|
|
98
|
+
<button>
|
|
99
|
+
{icon} {tagContent} {label}
|
|
100
|
+
</button>
|
|
101
|
+
));
|
|
102
|
+
export const ActionMenu = jest.fn(() => <div>Action Menu</div>);
|
|
103
|
+
export const WorkspaceContainer = jest.fn(() => <div>Workspace Container</div>);
|
|
104
|
+
export const closeWorkspace = jest.fn();
|
|
105
|
+
export const launchWorkspace = jest.fn();
|
|
106
|
+
export const launchWorkspace2 = jest.fn();
|
|
107
|
+
export const launchWorkspaceGroup = jest.fn();
|
|
108
|
+
export const launchWorkspaceGroup2 = jest.fn();
|
|
109
|
+
export const closeWorkspaceGroup2 = jest.fn();
|
|
110
|
+
export const navigateAndLaunchWorkspace = jest.fn();
|
|
111
|
+
export const useWorkspaces = jest.fn();
|
|
112
|
+
export const useWorkspace2Context = jest.fn();
|
|
113
|
+
|
|
114
|
+
export const EgenDatePicker = jest.fn(({ id, labelText, value, onChange, isInvalid, invalidText }) => (
|
|
115
|
+
<>
|
|
116
|
+
<label htmlFor={id}>{labelText}</label>
|
|
117
|
+
<input
|
|
118
|
+
id={id}
|
|
119
|
+
type="text"
|
|
120
|
+
value={value ? dayjs(value).format('DD/MM/YYYY') : ''}
|
|
121
|
+
onChange={(evt) => onChange?.(dayjs(evt.target.value).toDate())}
|
|
122
|
+
/>
|
|
123
|
+
{isInvalid && <span>{invalidText}</span>}
|
|
124
|
+
</>
|
|
125
|
+
));
|
|
126
|
+
|
|
127
|
+
export const EgenDateRangePicker = jest.fn(({ id, labelText, value = [], onChange, isInvalid, invalidText }) => {
|
|
128
|
+
const [inputValue, setInputValue] = useState(() => {
|
|
129
|
+
const [start, end] = value;
|
|
130
|
+
const formattedStart = start ? dayjs(start).format('DD/MM/YYYY') : 'dd/mm/yyyy';
|
|
131
|
+
const formattedEnd = end ? dayjs(end).format('DD/MM/YYYY') : 'dd/mm/yyyy';
|
|
132
|
+
return `${formattedStart}–${formattedEnd}`;
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const handleChange = (e) => {
|
|
136
|
+
const raw = e.target.value;
|
|
137
|
+
setInputValue(raw);
|
|
138
|
+
|
|
139
|
+
const [startStr, endStr] = raw.split('–');
|
|
140
|
+
const start = dayjs(startStr, 'DD/MM/YYYY', true);
|
|
141
|
+
const end = dayjs(endStr, 'DD/MM/YYYY', true);
|
|
142
|
+
|
|
143
|
+
if (start.isValid() && end.isValid()) {
|
|
144
|
+
onChange?.([start.toDate(), end.toDate()]);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<div>
|
|
150
|
+
<label htmlFor={id}>{labelText}</label>
|
|
151
|
+
<input id={id} type="text" value={inputValue} onChange={handleChange} />
|
|
152
|
+
{isInvalid && <span>{invalidText}</span>}
|
|
153
|
+
</div>
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
/* esm-utils */
|
|
158
|
+
export {
|
|
159
|
+
getDefaultsFromConfigSchema,
|
|
160
|
+
getEntityName,
|
|
161
|
+
formatEntityName,
|
|
162
|
+
selectPreferredName,
|
|
163
|
+
} from '@egen-civitas/esm-utils';
|
|
164
|
+
|
|
165
|
+
export const age = jest.fn((arg) => utils.age(arg));
|
|
166
|
+
|
|
167
|
+
export function isVersionSatisfied() {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
package/mock.tsx
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import { NEVER } from 'rxjs';
|
|
4
|
+
import { vi } from 'vitest';
|
|
5
|
+
import type {} from '@egen-civitas/esm-globals';
|
|
6
|
+
import * as utils from '@egen-civitas/esm-utils/mock';
|
|
7
|
+
|
|
8
|
+
window.i18next = { ...window.i18next, language: 'en' };
|
|
9
|
+
|
|
10
|
+
export * from '@egen-civitas/esm-api/mock';
|
|
11
|
+
export * from '@egen-civitas/esm-data-api/mock';
|
|
12
|
+
export * from '@egen-civitas/esm-config/mock';
|
|
13
|
+
export * from '@egen-civitas/esm-context';
|
|
14
|
+
export * from '@egen-civitas/esm-expression-evaluator';
|
|
15
|
+
export * from '@egen-civitas/esm-extensions/mock';
|
|
16
|
+
export * from '@egen-civitas/esm-react-utils/mock';
|
|
17
|
+
export * from '@egen-civitas/esm-state/mock';
|
|
18
|
+
export * from '@egen-civitas/esm-styleguide/mock';
|
|
19
|
+
export * from '@egen-civitas/esm-translations/mock';
|
|
20
|
+
|
|
21
|
+
export { parseDate, formatDate, formatDatetime, formatTime, isEgenDateToday, matchLocale } from '@egen-civitas/esm-utils';
|
|
22
|
+
|
|
23
|
+
/* esm-globals */
|
|
24
|
+
|
|
25
|
+
export function setupPaths(config: any) {
|
|
26
|
+
window.egenBase = config.apiUrl;
|
|
27
|
+
window.spaBase = config.spaPath;
|
|
28
|
+
window.spaEnv = config.env || 'production';
|
|
29
|
+
window.spaVersion = process.env.BUILD_VERSION ?? 'local';
|
|
30
|
+
window.getEgenSpaBase = () => `${window.spaBase}/`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* esm-dynamic-loading */
|
|
34
|
+
export const importDynamic = vi.fn();
|
|
35
|
+
|
|
36
|
+
/* esm-error-handling */
|
|
37
|
+
export const createErrorHandler = () => vi.fn().mockReturnValue(NEVER);
|
|
38
|
+
|
|
39
|
+
export const reportError = vi.fn().mockImplementation((error) => {
|
|
40
|
+
throw error;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
/* esm-feature-flags */
|
|
44
|
+
export const registerFeatureFlags = vi.fn();
|
|
45
|
+
export const getFeatureFlag = vi.fn().mockReturnValue(true);
|
|
46
|
+
export const subscribeToFeatureFlag = vi.fn((name: string, callback) => callback(true));
|
|
47
|
+
|
|
48
|
+
/* esm-navigation */
|
|
49
|
+
export { interpolateUrl, interpolateString } from '@egen-civitas/esm-navigation';
|
|
50
|
+
export const navigate = vi.fn();
|
|
51
|
+
export const getHistory = vi.fn(() => ['https://egen.alpha.vercel.com/home']);
|
|
52
|
+
export const clearHistory = vi.fn();
|
|
53
|
+
export const goBackInHistory = vi.fn();
|
|
54
|
+
|
|
55
|
+
/* esm-offline */
|
|
56
|
+
export const useConnectivity = vi.fn().mockReturnValue(true);
|
|
57
|
+
export const subscribeConnectivity = vi.fn();
|
|
58
|
+
|
|
59
|
+
/* esm-styleguide */
|
|
60
|
+
export const showNotification = vi.fn();
|
|
61
|
+
export const showActionableNotification = vi.fn();
|
|
62
|
+
export const showToast = vi.fn();
|
|
63
|
+
export const showSnackbar = vi.fn();
|
|
64
|
+
export const showModal = vi.fn();
|
|
65
|
+
|
|
66
|
+
export const LeftNavMenu = vi.fn(() => <div>Left Nav Menu</div>);
|
|
67
|
+
export const setLeftNav = vi.fn();
|
|
68
|
+
export const unsetLeftNav = vi.fn();
|
|
69
|
+
export const ResponsiveWrapper = vi.fn(({ children }) => <>{children}</>);
|
|
70
|
+
export const ErrorState = vi.fn(() => <div>Error State</div>);
|
|
71
|
+
|
|
72
|
+
export const CustomOverflowMenu = vi.fn(({ menuTitle, children }) => (
|
|
73
|
+
<div>
|
|
74
|
+
<button>{menuTitle}</button>
|
|
75
|
+
{children}
|
|
76
|
+
</div>
|
|
77
|
+
));
|
|
78
|
+
export const CustomOverflowMenuItem = vi.fn(({ itemText, ...props }) => (
|
|
79
|
+
<button role="menuitem" {...props}>
|
|
80
|
+
{itemText}
|
|
81
|
+
</button>
|
|
82
|
+
));
|
|
83
|
+
export const EntityBannerActionsMenu = vi.fn(() => <div>Entity Banner Actions Menu</div>);
|
|
84
|
+
export const EntityBannerContactDetails = vi.fn(() => <div>Entity Banner Contact Details</div>);
|
|
85
|
+
export const EntityBannerEntityInfo = vi.fn(() => <div>Entity Banner Entity Info</div>);
|
|
86
|
+
export const EntityBannerEntityIdentifiers = vi.fn(() => <div>Entity Banner Entity Identifier</div>);
|
|
87
|
+
export const EntityBannerToggleContactDetailsButton = vi.fn(() => (
|
|
88
|
+
<div>Entity Banner Toggle Contact Details Button</div>
|
|
89
|
+
));
|
|
90
|
+
export const EntityPhoto = vi.fn(() => <div>Entity Photo</div>);
|
|
91
|
+
export const useEntityPhoto = vi.fn(() => ({
|
|
92
|
+
isLoading: true,
|
|
93
|
+
data: null,
|
|
94
|
+
error: null,
|
|
95
|
+
}));
|
|
96
|
+
|
|
97
|
+
export const ActionMenuButton = vi.fn(({ handler }) => <button onClick={handler}>Action Menu Button</button>);
|
|
98
|
+
export const ActionMenuButton2 = vi.fn(({ label, tagContent, icon }) => (
|
|
99
|
+
<button>
|
|
100
|
+
{icon} {tagContent} {label}
|
|
101
|
+
</button>
|
|
102
|
+
));
|
|
103
|
+
export const ActionMenu = vi.fn(() => <div>Action Menu</div>);
|
|
104
|
+
export const WorkspaceContainer = vi.fn(() => <div>Workspace Container</div>);
|
|
105
|
+
export const closeWorkspace = vi.fn();
|
|
106
|
+
export const launchWorkspace = vi.fn();
|
|
107
|
+
export const launchWorkspace2 = vi.fn();
|
|
108
|
+
export const launchWorkspaceGroup = vi.fn();
|
|
109
|
+
export const launchWorkspaceGroup2 = vi.fn();
|
|
110
|
+
export const closeWorkspaceGroup2 = vi.fn();
|
|
111
|
+
export const navigateAndLaunchWorkspace = vi.fn();
|
|
112
|
+
export const useWorkspaces = vi.fn();
|
|
113
|
+
export const useWorkspace2Context = vi.fn();
|
|
114
|
+
|
|
115
|
+
export const EgenDatePicker = vi.fn(({ id, labelText, value, onChange, isInvalid, invalidText }) => (
|
|
116
|
+
<>
|
|
117
|
+
<label htmlFor={id}>{labelText}</label>
|
|
118
|
+
<input
|
|
119
|
+
id={id}
|
|
120
|
+
type="text"
|
|
121
|
+
value={value ? dayjs(value).format('DD/MM/YYYY') : ''}
|
|
122
|
+
onChange={(evt) => onChange?.(dayjs(evt.target.value).toDate())}
|
|
123
|
+
/>
|
|
124
|
+
{isInvalid && <span>{invalidText}</span>}
|
|
125
|
+
</>
|
|
126
|
+
));
|
|
127
|
+
|
|
128
|
+
export const EgenDateRangePicker = vi.fn(({ id, labelText, value = [], onChange, isInvalid, invalidText }) => {
|
|
129
|
+
const [inputValue, setInputValue] = useState(() => {
|
|
130
|
+
const [start, end] = value;
|
|
131
|
+
const formattedStart = start ? dayjs(start).format('DD/MM/YYYY') : 'dd/mm/yyyy';
|
|
132
|
+
const formattedEnd = end ? dayjs(end).format('DD/MM/YYYY') : 'dd/mm/yyyy';
|
|
133
|
+
return `${formattedStart}–${formattedEnd}`;
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const handleChange = (e) => {
|
|
137
|
+
const raw = e.target.value;
|
|
138
|
+
setInputValue(raw);
|
|
139
|
+
|
|
140
|
+
const [startStr, endStr] = raw.split('–');
|
|
141
|
+
const start = dayjs(startStr, 'DD/MM/YYYY', true);
|
|
142
|
+
const end = dayjs(endStr, 'DD/MM/YYYY', true);
|
|
143
|
+
|
|
144
|
+
if (start.isValid() && end.isValid()) {
|
|
145
|
+
onChange?.([start.toDate(), end.toDate()]);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<div>
|
|
151
|
+
<label htmlFor={id}>{labelText}</label>
|
|
152
|
+
<input id={id} type="text" value={inputValue} onChange={handleChange} />
|
|
153
|
+
{isInvalid && <span>{invalidText}</span>}
|
|
154
|
+
</div>
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
/* esm-utils */
|
|
159
|
+
export {
|
|
160
|
+
getDefaultsFromConfigSchema,
|
|
161
|
+
getEntityName,
|
|
162
|
+
formatEntityName,
|
|
163
|
+
selectPreferredName,
|
|
164
|
+
} from '@egen-civitas/esm-utils';
|
|
165
|
+
|
|
166
|
+
export const age = vi.fn((arg) => utils.age(arg));
|
|
167
|
+
|
|
168
|
+
export function isVersionSatisfied() {
|
|
169
|
+
return true;
|
|
170
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@egen-civitas/esm-framework",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MPL-2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"mock.tsx",
|
|
10
|
+
"mock-jest.tsx"
|
|
11
|
+
],
|
|
12
|
+
"module": "dist/index.js",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./src/internal": {
|
|
20
|
+
"types": "./dist/internal.d.ts",
|
|
21
|
+
"default": "./dist/internal.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": {
|
|
24
|
+
"default": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"./mock": {
|
|
27
|
+
"import": "./mock.tsx",
|
|
28
|
+
"require": "./mock-jest.tsx"
|
|
29
|
+
},
|
|
30
|
+
"./mock.tsx": {
|
|
31
|
+
"import": "./mock.tsx",
|
|
32
|
+
"require": "./mock-jest.tsx"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"source": true,
|
|
36
|
+
"scripts": {
|
|
37
|
+
"document": "../../../tools/document.sh",
|
|
38
|
+
"test": "cross-env TZ=UTC vitest run --passWithNoTests",
|
|
39
|
+
"test:watch": "cross-env TZ=UTC vitest watch",
|
|
40
|
+
"coverage": "cross-env TZ=UTC vitest run --coverage --passWithNoTests",
|
|
41
|
+
"build": "rimraf dist && concurrently \"swc --strip-leading-paths src -d dist\" \"tsc --project tsconfig.build.json\"",
|
|
42
|
+
"build:development": "rimraf dist && concurrently \"swc --strip-leading-paths src -d dist\" \"tsc --project tsconfig.build.json\"",
|
|
43
|
+
"typescript": "tsc --project tsconfig.build.json",
|
|
44
|
+
"lint": "eslint src --ext ts,tsx"
|
|
45
|
+
},
|
|
46
|
+
"keywords": [
|
|
47
|
+
"egen",
|
|
48
|
+
"framework",
|
|
49
|
+
"frontend",
|
|
50
|
+
"ui",
|
|
51
|
+
"microfrontends"
|
|
52
|
+
],
|
|
53
|
+
"browserslist": [
|
|
54
|
+
"extends browserslist-config-egen"
|
|
55
|
+
],
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "git+https://github.com/amourgit/Frontend-esm-framework.git",
|
|
59
|
+
"directory": "packages/framework/esm-framework"
|
|
60
|
+
},
|
|
61
|
+
"bugs": {
|
|
62
|
+
"url": "https://github.com/amourgit/Frontend-esm-framework/issues"
|
|
63
|
+
},
|
|
64
|
+
"homepage": "https://github.com/amourgit/Frontend-esm-framework/tree/main/packages/framework/esm-framework#readme",
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public"
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"@egen-civitas/esm-ai-framework": "^1.0.0",
|
|
70
|
+
"@egen-civitas/esm-api": "^1.0.0",
|
|
71
|
+
"@egen-civitas/esm-config": "^1.0.0",
|
|
72
|
+
"@egen-civitas/esm-context": "^1.0.0",
|
|
73
|
+
"@egen-civitas/esm-data-api": "^1.0.0",
|
|
74
|
+
"@egen-civitas/esm-dynamic-loading": "^1.0.0",
|
|
75
|
+
"@egen-civitas/esm-error-handling": "^1.0.0",
|
|
76
|
+
"@egen-civitas/esm-expression-evaluator": "^1.0.0",
|
|
77
|
+
"@egen-civitas/esm-extensions": "^1.0.0",
|
|
78
|
+
"@egen-civitas/esm-feature-flags": "^1.0.0",
|
|
79
|
+
"@egen-civitas/esm-globals": "^1.0.0",
|
|
80
|
+
"@egen-civitas/esm-navigation": "^1.0.0",
|
|
81
|
+
"@egen-civitas/esm-offline": "^1.0.0",
|
|
82
|
+
"@egen-civitas/esm-react-utils": "^1.0.0",
|
|
83
|
+
"@egen-civitas/esm-routes": "^1.0.0",
|
|
84
|
+
"@egen-civitas/esm-state": "^1.0.0",
|
|
85
|
+
"@egen-civitas/esm-styleguide": "^1.0.0",
|
|
86
|
+
"@egen-civitas/esm-tenant": "^1.0.0",
|
|
87
|
+
"@egen-civitas/esm-translations": "^1.0.0",
|
|
88
|
+
"@egen-civitas/esm-utils": "^1.0.0"
|
|
89
|
+
},
|
|
90
|
+
"peerDependencies": {
|
|
91
|
+
"dayjs": "1.x",
|
|
92
|
+
"i18next": "25.x",
|
|
93
|
+
"react": "18.x",
|
|
94
|
+
"react-dom": "18.x",
|
|
95
|
+
"react-i18next": "16.x",
|
|
96
|
+
"rxjs": "6.x",
|
|
97
|
+
"single-spa": "6.x",
|
|
98
|
+
"swr": "2.x"
|
|
99
|
+
},
|
|
100
|
+
"devDependencies": {
|
|
101
|
+
"@egen-civitas/typedoc-plugin-file-categories": "^1.0.0",
|
|
102
|
+
"@swc/cli": "0.8.1",
|
|
103
|
+
"@swc/core": "1.15.21",
|
|
104
|
+
"@vitest/coverage-v8": "^4.1.2",
|
|
105
|
+
"concurrently": "^9.2.1",
|
|
106
|
+
"cross-env": "^10.1.0",
|
|
107
|
+
"dayjs": "^1.11.13",
|
|
108
|
+
"happy-dom": "^20.6.0",
|
|
109
|
+
"i18next": "^25.5.3",
|
|
110
|
+
"react": "^18.3.1",
|
|
111
|
+
"react-dom": "^18.3.1",
|
|
112
|
+
"react-i18next": "^16.0.0",
|
|
113
|
+
"react-is": "^17.0.2",
|
|
114
|
+
"rimraf": "^6.1.3",
|
|
115
|
+
"sass": "^1.98.0",
|
|
116
|
+
"single-spa": "^6.0.3",
|
|
117
|
+
"typedoc": "^0.28.5",
|
|
118
|
+
"typedoc-plugin-markdown": "^4.6.3",
|
|
119
|
+
"typedoc-plugin-no-inherit": "^1.6.1",
|
|
120
|
+
"typescript": "^5.8.3",
|
|
121
|
+
"vitest": "^4.1.2"
|
|
122
|
+
}
|
|
123
|
+
}
|