@ebertjendustries/cstestwrapper 1.0.1 → 1.0.3
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/dist/index.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__commonJS,
|
|
3
|
-
__export,
|
|
4
3
|
__publicField,
|
|
5
4
|
__require,
|
|
6
5
|
__toESM
|
|
7
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OQRDRRQA.mjs";
|
|
8
7
|
|
|
9
8
|
// node_modules/strip-literal/node_modules/js-tokens/index.js
|
|
10
9
|
var require_js_tokens = __commonJS({
|
|
@@ -51,7 +50,7 @@ var require_js_tokens = __commonJS({
|
|
|
51
50
|
KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
|
|
52
51
|
KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
|
|
53
52
|
Newline = RegExp(LineTerminatorSequence.source);
|
|
54
|
-
module.exports = jsTokens2 = function* (input, { jsx:
|
|
53
|
+
module.exports = jsTokens2 = function* (input, { jsx: jsx2 = false } = {}) {
|
|
55
54
|
var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
|
|
56
55
|
({ length } = input);
|
|
57
56
|
lastIndex = 0;
|
|
@@ -171,7 +170,7 @@ var require_js_tokens = __commonJS({
|
|
|
171
170
|
nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
|
|
172
171
|
break;
|
|
173
172
|
case "<":
|
|
174
|
-
if (
|
|
173
|
+
if (jsx2 && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
175
174
|
stack.push({ tag: "JSXTag" });
|
|
176
175
|
lastIndex += 1;
|
|
177
176
|
lastSignificantToken = "<";
|
|
@@ -1382,7 +1381,7 @@ function requireReactIs_development() {
|
|
|
1382
1381
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
1383
1382
|
var Element2 = REACT_ELEMENT_TYPE;
|
|
1384
1383
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
1385
|
-
var
|
|
1384
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
1386
1385
|
var Lazy = REACT_LAZY_TYPE;
|
|
1387
1386
|
var Memo = REACT_MEMO_TYPE;
|
|
1388
1387
|
var Portal = REACT_PORTAL_TYPE;
|
|
@@ -1450,7 +1449,7 @@ function requireReactIs_development() {
|
|
|
1450
1449
|
reactIs_development.ContextProvider = ContextProvider;
|
|
1451
1450
|
reactIs_development.Element = Element2;
|
|
1452
1451
|
reactIs_development.ForwardRef = ForwardRef;
|
|
1453
|
-
reactIs_development.Fragment =
|
|
1452
|
+
reactIs_development.Fragment = Fragment;
|
|
1454
1453
|
reactIs_development.Lazy = Lazy;
|
|
1455
1454
|
reactIs_development.Memo = Memo;
|
|
1456
1455
|
reactIs_development.Portal = Portal;
|
|
@@ -2770,7 +2769,7 @@ function requireJsTokens() {
|
|
|
2770
2769
|
KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
|
|
2771
2770
|
KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
|
|
2772
2771
|
Newline = RegExp(LineTerminatorSequence.source);
|
|
2773
|
-
jsTokens_1 = function* (input, { jsx:
|
|
2772
|
+
jsTokens_1 = function* (input, { jsx: jsx2 = false } = {}) {
|
|
2774
2773
|
var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
|
|
2775
2774
|
({ length } = input);
|
|
2776
2775
|
lastIndex = 0;
|
|
@@ -2883,7 +2882,7 @@ function requireJsTokens() {
|
|
|
2883
2882
|
nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
|
|
2884
2883
|
break;
|
|
2885
2884
|
case "<":
|
|
2886
|
-
if (
|
|
2885
|
+
if (jsx2 && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
2887
2886
|
stack.push({ tag: "JSXTag" });
|
|
2888
2887
|
lastIndex += 1;
|
|
2889
2888
|
lastSignificantToken = "<";
|
|
@@ -5309,7 +5308,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
5309
5308
|
var __commonJS2 = (cb, mod) => function __require2() {
|
|
5310
5309
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5311
5310
|
};
|
|
5312
|
-
var
|
|
5311
|
+
var __export = (target, all) => {
|
|
5313
5312
|
for (var name in all)
|
|
5314
5313
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5315
5314
|
};
|
|
@@ -5318,7 +5317,7 @@ var require_util = __commonJS2({
|
|
|
5318
5317
|
}
|
|
5319
5318
|
});
|
|
5320
5319
|
var utils_exports = {};
|
|
5321
|
-
|
|
5320
|
+
__export(utils_exports, {
|
|
5322
5321
|
addChainableMethod: () => addChainableMethod,
|
|
5323
5322
|
addLengthGuard: () => addLengthGuard,
|
|
5324
5323
|
addMethod: () => addMethod,
|
|
@@ -5351,7 +5350,7 @@ __export2(utils_exports, {
|
|
|
5351
5350
|
type: () => type
|
|
5352
5351
|
});
|
|
5353
5352
|
var check_error_exports = {};
|
|
5354
|
-
|
|
5353
|
+
__export(check_error_exports, {
|
|
5355
5354
|
compatibleConstructor: () => compatibleConstructor,
|
|
5356
5355
|
compatibleInstance: () => compatibleInstance,
|
|
5357
5356
|
compatibleMessage: () => compatibleMessage,
|
|
@@ -8424,7 +8423,7 @@ expect.fail = function(actual, expected, message, operator) {
|
|
|
8424
8423
|
);
|
|
8425
8424
|
};
|
|
8426
8425
|
var should_exports = {};
|
|
8427
|
-
|
|
8426
|
+
__export(should_exports, {
|
|
8428
8427
|
Should: () => Should,
|
|
8429
8428
|
should: () => should
|
|
8430
8429
|
});
|
|
@@ -12122,7 +12121,7 @@ function getTestName(task, separator = " > ") {
|
|
|
12122
12121
|
}
|
|
12123
12122
|
var now$1 = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
12124
12123
|
var unixNow = Date.now;
|
|
12125
|
-
var { clearTimeout, setTimeout
|
|
12124
|
+
var { clearTimeout, setTimeout } = getSafeTimers();
|
|
12126
12125
|
var packs = /* @__PURE__ */ new Map();
|
|
12127
12126
|
var eventsPacks = [];
|
|
12128
12127
|
var pendingTasksUpdates = [];
|
|
@@ -12161,7 +12160,7 @@ function throttle(fn2, ms) {
|
|
|
12161
12160
|
pendingCall = void 0;
|
|
12162
12161
|
return fn2.apply(this, args);
|
|
12163
12162
|
}
|
|
12164
|
-
pendingCall != null ? pendingCall : pendingCall =
|
|
12163
|
+
pendingCall != null ? pendingCall : pendingCall = setTimeout(() => call2.bind(this)(...args), ms);
|
|
12165
12164
|
};
|
|
12166
12165
|
}
|
|
12167
12166
|
var sendTasksUpdateThrottled = throttle(sendTasksUpdate, 100);
|
|
@@ -12184,7 +12183,7 @@ function withTimeout(fn2, timeout, isHook = false, stackTraceError, onTimeout) {
|
|
|
12184
12183
|
if (timeout <= 0 || timeout === Number.POSITIVE_INFINITY) {
|
|
12185
12184
|
return fn2;
|
|
12186
12185
|
}
|
|
12187
|
-
const { setTimeout:
|
|
12186
|
+
const { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = getSafeTimers();
|
|
12188
12187
|
return function runWithTimeout(...args) {
|
|
12189
12188
|
const startTime = now();
|
|
12190
12189
|
const runner2 = getRunner();
|
|
@@ -12192,7 +12191,7 @@ function withTimeout(fn2, timeout, isHook = false, stackTraceError, onTimeout) {
|
|
|
12192
12191
|
runner2._currentTaskTimeout = timeout;
|
|
12193
12192
|
return new Promise((resolve_, reject_) => {
|
|
12194
12193
|
var _timer$unref;
|
|
12195
|
-
const timer =
|
|
12194
|
+
const timer = setTimeout2(() => {
|
|
12196
12195
|
clearTimeout2(timer);
|
|
12197
12196
|
rejectTimeoutError();
|
|
12198
12197
|
}, timeout);
|
|
@@ -12451,8 +12450,8 @@ function resetModules(modules, resetMocks = false) {
|
|
|
12451
12450
|
});
|
|
12452
12451
|
}
|
|
12453
12452
|
function waitNextTick() {
|
|
12454
|
-
const { setTimeout:
|
|
12455
|
-
return new Promise((resolve4) =>
|
|
12453
|
+
const { setTimeout: setTimeout2 } = getSafeTimers();
|
|
12454
|
+
return new Promise((resolve4) => setTimeout2(resolve4, 0));
|
|
12456
12455
|
}
|
|
12457
12456
|
async function waitForImportsToResolve() {
|
|
12458
12457
|
await waitNextTick();
|
|
@@ -13202,7 +13201,7 @@ function requireJsTokens2() {
|
|
|
13202
13201
|
KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/;
|
|
13203
13202
|
KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/;
|
|
13204
13203
|
Newline = RegExp(LineTerminatorSequence.source);
|
|
13205
|
-
jsTokens_12 = function* (input, { jsx:
|
|
13204
|
+
jsTokens_12 = function* (input, { jsx: jsx2 = false } = {}) {
|
|
13206
13205
|
var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack;
|
|
13207
13206
|
({ length } = input);
|
|
13208
13207
|
lastIndex = 0;
|
|
@@ -13315,7 +13314,7 @@ function requireJsTokens2() {
|
|
|
13315
13314
|
nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec";
|
|
13316
13315
|
break;
|
|
13317
13316
|
case "<":
|
|
13318
|
-
if (
|
|
13317
|
+
if (jsx2 && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) {
|
|
13319
13318
|
stack.push({ tag: "JSXTag" });
|
|
13320
13319
|
lastIndex += 1;
|
|
13321
13320
|
lastSignificantToken = "<";
|
|
@@ -13732,7 +13731,7 @@ function offsetToLineNumber(source, offset) {
|
|
|
13732
13731
|
return line + 1;
|
|
13733
13732
|
}
|
|
13734
13733
|
async function saveInlineSnapshots(environment, snapshots) {
|
|
13735
|
-
const MagicString = (await import("./magic-string.es-
|
|
13734
|
+
const MagicString = (await import("./magic-string.es-BXRVNYGN.mjs")).default;
|
|
13736
13735
|
const files = new Set(snapshots.map((i) => i.file));
|
|
13737
13736
|
await Promise.all(Array.from(files).map(async (file) => {
|
|
13738
13737
|
const snaps = snapshots.filter((i) => i.file === file);
|
|
@@ -14594,7 +14593,7 @@ function createExpectPoll(expect2) {
|
|
|
14594
14593
|
let intervalId;
|
|
14595
14594
|
let timeoutId;
|
|
14596
14595
|
let lastError;
|
|
14597
|
-
const { setTimeout:
|
|
14596
|
+
const { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = getSafeTimers();
|
|
14598
14597
|
const check = async () => {
|
|
14599
14598
|
try {
|
|
14600
14599
|
utils_exports.flag(assertion, "_name", key);
|
|
@@ -14605,10 +14604,10 @@ function createExpectPoll(expect2) {
|
|
|
14605
14604
|
clearTimeout2(timeoutId);
|
|
14606
14605
|
} catch (err) {
|
|
14607
14606
|
lastError = err;
|
|
14608
|
-
if (!utils_exports.flag(assertion, "_isLastPollAttempt")) intervalId =
|
|
14607
|
+
if (!utils_exports.flag(assertion, "_isLastPollAttempt")) intervalId = setTimeout2(check, interval);
|
|
14609
14608
|
}
|
|
14610
14609
|
};
|
|
14611
|
-
timeoutId =
|
|
14610
|
+
timeoutId = setTimeout2(() => {
|
|
14612
14611
|
clearTimeout2(intervalId);
|
|
14613
14612
|
utils_exports.flag(assertion, "_isLastPollAttempt", true);
|
|
14614
14613
|
const rejectWithCause = (cause) => {
|
|
@@ -16126,7 +16125,7 @@ To automatically clean-up native timers, use \`shouldClearNativeTimers\`.`
|
|
|
16126
16125
|
clock.cancelIdleCallback = function cancelIdleCallback(timerId) {
|
|
16127
16126
|
return clearTimer(clock, timerId, "IdleCallback");
|
|
16128
16127
|
};
|
|
16129
|
-
clock.setTimeout = function
|
|
16128
|
+
clock.setTimeout = function setTimeout2(func, timeout) {
|
|
16130
16129
|
return addTimer(clock, {
|
|
16131
16130
|
func,
|
|
16132
16131
|
args: Array.prototype.slice.call(arguments, 2),
|
|
@@ -16947,7 +16946,7 @@ function copyStackTrace(target, source) {
|
|
|
16947
16946
|
return target;
|
|
16948
16947
|
}
|
|
16949
16948
|
function waitFor(callback, options = {}) {
|
|
16950
|
-
const { setTimeout:
|
|
16949
|
+
const { setTimeout: setTimeout2, setInterval, clearTimeout: clearTimeout2, clearInterval } = getSafeTimers();
|
|
16951
16950
|
const { interval = 50, timeout = 1e3 } = typeof options === "number" ? { timeout: options } : options;
|
|
16952
16951
|
const STACK_TRACE_ERROR = new Error("STACK_TRACE_ERROR");
|
|
16953
16952
|
return new Promise((resolve4, reject) => {
|
|
@@ -16990,12 +16989,12 @@ function waitFor(callback, options = {}) {
|
|
|
16990
16989
|
}
|
|
16991
16990
|
};
|
|
16992
16991
|
if (checkCallback() === true) return;
|
|
16993
|
-
timeoutId =
|
|
16992
|
+
timeoutId = setTimeout2(handleTimeout, timeout);
|
|
16994
16993
|
intervalId = setInterval(checkCallback, interval);
|
|
16995
16994
|
});
|
|
16996
16995
|
}
|
|
16997
16996
|
function waitUntil(callback, options = {}) {
|
|
16998
|
-
const { setTimeout:
|
|
16997
|
+
const { setTimeout: setTimeout2, setInterval, clearTimeout: clearTimeout2, clearInterval } = getSafeTimers();
|
|
16999
16998
|
const { interval = 50, timeout = 1e3 } = typeof options === "number" ? { timeout: options } : options;
|
|
17000
16999
|
const STACK_TRACE_ERROR = new Error("STACK_TRACE_ERROR");
|
|
17001
17000
|
return new Promise((resolve4, reject) => {
|
|
@@ -17035,7 +17034,7 @@ function waitUntil(callback, options = {}) {
|
|
|
17035
17034
|
}
|
|
17036
17035
|
};
|
|
17037
17036
|
if (checkCallback() === true) return;
|
|
17038
|
-
timeoutId =
|
|
17037
|
+
timeoutId = setTimeout2(onReject, timeout);
|
|
17039
17038
|
intervalId = setInterval(checkCallback, interval);
|
|
17040
17039
|
});
|
|
17041
17040
|
}
|
|
@@ -17255,1957 +17254,8 @@ function getImporter(name) {
|
|
|
17255
17254
|
// node_modules/vitest/dist/index.js
|
|
17256
17255
|
var import_expect_type = __toESM(require_dist(), 1);
|
|
17257
17256
|
|
|
17258
|
-
// node_modules/@ebertjendustries/cswrapper/dist/index.mjs
|
|
17259
|
-
var dist_exports2 = {};
|
|
17260
|
-
__export(dist_exports2, {
|
|
17261
|
-
CSAlert: () => CSAlert,
|
|
17262
|
-
CSBox: () => CSBox,
|
|
17263
|
-
CSButton: () => CSButton,
|
|
17264
|
-
CSCheckbox: () => CSCheckbox,
|
|
17265
|
-
CSCopyToClipboard: () => CSCopyToClipboard,
|
|
17266
|
-
CSDatePicker: () => CSDatePicker,
|
|
17267
|
-
CSEnumMultiselect: () => CSEnumMultiselect,
|
|
17268
|
-
CSEnumSegmentedControl: () => CSEnumSegmentedControl,
|
|
17269
|
-
CSEnumSelect: () => CSEnumSelect,
|
|
17270
|
-
CSEnumTiles: () => CSEnumTiles,
|
|
17271
|
-
CSExternalLink: () => CSExternalLink,
|
|
17272
|
-
CSFormField: () => CSFormField,
|
|
17273
|
-
CSHeader: () => CSHeader,
|
|
17274
|
-
CSInput: () => CSInput,
|
|
17275
|
-
CSLink: () => CSLink,
|
|
17276
|
-
CSMultiselect: () => CSMultiselect,
|
|
17277
|
-
CSNumericInput: () => CSNumericInput,
|
|
17278
|
-
CSSegmentedControl: () => CSSegmentedControl,
|
|
17279
|
-
CSSelect: () => CSSelect,
|
|
17280
|
-
CSStatusIndicator: () => CSStatusIndicator,
|
|
17281
|
-
CSTextContent: () => CSTextContent,
|
|
17282
|
-
CSTextarea: () => CSTextarea,
|
|
17283
|
-
CSTimeInput: () => CSTimeInput,
|
|
17284
|
-
CSToggle: () => CSToggle,
|
|
17285
|
-
CSVEnumRatingView: () => CSVEnumRatingView,
|
|
17286
|
-
CSVNoItemsView: () => CSVNoItemsView,
|
|
17287
|
-
CSVPriceInputView: () => CSVPriceInputView,
|
|
17288
|
-
CSVSearchFilterView: () => CSVSearchFilterView,
|
|
17289
|
-
CSVTextPromptModalView: () => CSVTextPromptModalView,
|
|
17290
|
-
CSV_ENUM_RATING_VIEW_SPEC: () => CSV_ENUM_RATING_VIEW_SPEC,
|
|
17291
|
-
CSV_NO_ITEMS_VIEW_SPEC: () => CSV_NO_ITEMS_VIEW_SPEC,
|
|
17292
|
-
CSV_PRICE_INPUT_VIEW_SPEC: () => CSV_PRICE_INPUT_VIEW_SPEC,
|
|
17293
|
-
CSV_SEARCH_FILTER_VIEW_SPEC: () => CSV_SEARCH_FILTER_VIEW_SPEC,
|
|
17294
|
-
CSV_TEXT_PROMPT_MODAL_VIEW_SPEC: () => CSV_TEXT_PROMPT_MODAL_VIEW_SPEC,
|
|
17295
|
-
ChildUtils: () => ChildUtils,
|
|
17296
|
-
ControllerState: () => ControllerState,
|
|
17297
|
-
DateUtils: () => DateUtils,
|
|
17298
|
-
ELEMENT_VALIDITY_LEVEL_FACTORY: () => ELEMENT_VALIDITY_LEVEL_FACTORY,
|
|
17299
|
-
ElementValidityLevel: () => ElementValidityLevel,
|
|
17300
|
-
EnumFactory: () => EnumFactory,
|
|
17301
|
-
FORM_FIELD_ID_SUFFIX: () => FORM_FIELD_ID_SUFFIX,
|
|
17302
|
-
FieldProperties: () => FieldProperties,
|
|
17303
|
-
FieldSpec: () => FieldSpec,
|
|
17304
|
-
FixedWidth: () => FixedWidth,
|
|
17305
|
-
FromPropsHelper: () => FromPropsHelper,
|
|
17306
|
-
LocalStorageService: () => LocalStorageService,
|
|
17307
|
-
LocalisationNamespace: () => LocalisationNamespace,
|
|
17308
|
-
Localiser: () => Localiser,
|
|
17309
|
-
Log: () => Log,
|
|
17310
|
-
MESSAGE_SEVERITY_FACTORY: () => MESSAGE_SEVERITY_FACTORY,
|
|
17311
|
-
MessageCTO: () => MessageCTO,
|
|
17312
|
-
MessageCodeTO: () => MessageCodeTO,
|
|
17313
|
-
MessageService: () => MessageService,
|
|
17314
|
-
MessageSeverity: () => MessageSeverity,
|
|
17315
|
-
NO_HTTP_CODE: () => NO_HTTP_CODE,
|
|
17316
|
-
NSK_CONTENT: () => NSK_CONTENT,
|
|
17317
|
-
ObjectWithId: () => ObjectWithId,
|
|
17318
|
-
PriceUtils: () => PriceUtils,
|
|
17319
|
-
QUERY_SEP: () => QUERY_SEP,
|
|
17320
|
-
QUERY_START: () => QUERY_START,
|
|
17321
|
-
QueryParamHelper: () => QueryParamHelper,
|
|
17322
|
-
REST_CLIENT_LOGGER: () => REST_CLIENT_LOGGER,
|
|
17323
|
-
RestClient: () => RestClient,
|
|
17324
|
-
RunFunctionResult: () => RunFunctionResult,
|
|
17325
|
-
SelectHelper: () => SelectHelper,
|
|
17326
|
-
TECHNICAL_CONTROLLER_ID: () => TECHNICAL_CONTROLLER_ID,
|
|
17327
|
-
ViewSpec: () => ViewSpec,
|
|
17328
|
-
createRestClient: () => createRestClient,
|
|
17329
|
-
fatalRunErrorFunction: () => fatalRunErrorFunction,
|
|
17330
|
-
filterArrayByIndices: () => filterArrayByIndices,
|
|
17331
|
-
getEnumRatingLabel: () => getEnumRatingLabel,
|
|
17332
|
-
getEnumRatingValues: () => getEnumRatingValues,
|
|
17333
|
-
indexRangeArray: () => indexRangeArray,
|
|
17334
|
-
isContentWithMessages: () => isContentWithMessages,
|
|
17335
|
-
openInNewTab: () => openInNewTab,
|
|
17336
|
-
singleChangeHandlerToMulti: () => singleChangeHandlerToMulti,
|
|
17337
|
-
sleep: () => sleep,
|
|
17338
|
-
sortArrayByIndices: () => sortArrayByIndices,
|
|
17339
|
-
useAWSUIRef: () => useAWSUIRef,
|
|
17340
|
-
useControllerDisplayState: () => useControllerDisplayState,
|
|
17341
|
-
useHotkey: () => useHotkey,
|
|
17342
|
-
useMessages: () => useMessages,
|
|
17343
|
-
useTOArrayChangeHandler: () => useTOArrayChangeHandler,
|
|
17344
|
-
useTOChangeHandler: () => useTOChangeHandler,
|
|
17345
|
-
warnWhenTabIsClosed: () => warnWhenTabIsClosed
|
|
17346
|
-
});
|
|
17347
|
-
import { Alert } from "@cloudscape-design/components";
|
|
17348
|
-
import { FormField } from "@cloudscape-design/components";
|
|
17349
|
-
import { jsx } from "react/jsx-runtime";
|
|
17350
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
17351
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
17352
|
-
import { Box } from "@cloudscape-design/components";
|
|
17353
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
17354
|
-
import { Button } from "@cloudscape-design/components";
|
|
17355
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
17356
|
-
import { Checkbox } from "@cloudscape-design/components";
|
|
17357
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
17358
|
-
import { DatePicker } from "@cloudscape-design/components";
|
|
17359
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
17360
|
-
import { Multiselect } from "@cloudscape-design/components";
|
|
17361
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
17362
|
-
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
17363
|
-
import { SegmentedControl } from "@cloudscape-design/components";
|
|
17364
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
17365
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
17366
|
-
import { Select } from "@cloudscape-design/components";
|
|
17367
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
17368
|
-
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
17369
|
-
import { Tiles } from "@cloudscape-design/components";
|
|
17370
|
-
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
17371
|
-
import { Link } from "@cloudscape-design/components";
|
|
17372
|
-
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
17373
|
-
import { Header } from "@cloudscape-design/components";
|
|
17374
|
-
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
17375
|
-
import { Input } from "@cloudscape-design/components";
|
|
17376
|
-
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
17377
|
-
import { Input as Input2 } from "@cloudscape-design/components";
|
|
17378
|
-
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
17379
|
-
import { StatusIndicator } from "@cloudscape-design/components";
|
|
17380
|
-
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
17381
|
-
import { TextContent } from "@cloudscape-design/components";
|
|
17382
|
-
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
17383
|
-
import { Textarea } from "@cloudscape-design/components";
|
|
17384
|
-
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
17385
|
-
import { TimeInput } from "@cloudscape-design/components";
|
|
17386
|
-
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
17387
|
-
import { Toggle } from "@cloudscape-design/components";
|
|
17388
|
-
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
17389
|
-
import { CopyToClipboard } from "@cloudscape-design/components";
|
|
17390
|
-
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
17391
|
-
import { Rating } from "@smastrom/react-rating";
|
|
17392
|
-
import { useEffect, useState } from "react";
|
|
17393
|
-
import { jsx as jsx25, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
17394
|
-
import { Box as Box2, SpaceBetween } from "@cloudscape-design/components";
|
|
17395
|
-
import { jsx as jsx26, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
17396
|
-
import { Grid } from "@cloudscape-design/components";
|
|
17397
|
-
import { jsx as jsx27, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
17398
|
-
import { SpaceBetween as SpaceBetween2 } from "@cloudscape-design/components";
|
|
17399
|
-
import { jsx as jsx28, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
17400
|
-
import { Box as Box3, Modal, SpaceBetween as SpaceBetween3 } from "@cloudscape-design/components";
|
|
17401
|
-
import { Fragment, jsx as jsx29, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
17402
|
-
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
17403
|
-
import { useCallback, useState as useState2 } from "react";
|
|
17404
|
-
import { useCallback as useCallback2 } from "react";
|
|
17405
|
-
import { useCallback as useCallback3, useRef } from "react";
|
|
17406
|
-
import { useCallback as useCallback4, useEffect as useEffect2, useLayoutEffect, useRef as useRef2 } from "react";
|
|
17407
|
-
import { useCallback as useCallback5, useState as useState3 } from "react";
|
|
17408
|
-
var FromPropsHelper = class {
|
|
17409
|
-
};
|
|
17410
|
-
FromPropsHelper.getBasicProps = (props) => {
|
|
17411
|
-
const localisationObject = props.localiser.localiseField(props.fieldSpec.getLocalisationKey(), props.localisationVariables, props.alternateNs);
|
|
17412
|
-
const uniqueId = props.fieldSpec.getDataTestId();
|
|
17413
|
-
return { localisationObject, uniqueId };
|
|
17414
|
-
};
|
|
17415
|
-
FromPropsHelper.usesFormField = (props) => {
|
|
17416
|
-
const localisation = props.localiser.localiseField(props.fieldSpec.getLocalisationKey(), props.localisationVariables, props.alternateNs);
|
|
17417
|
-
return props.formField !== void 0 || (localisation == null ? void 0 : localisation.formField) !== void 0 || props.secondaryControl !== void 0;
|
|
17418
|
-
};
|
|
17419
|
-
FromPropsHelper.getLocalisedErrorText = (props, value, localiseValidity) => {
|
|
17420
|
-
var _a2, _b;
|
|
17421
|
-
if (((_a2 = props.formField) == null ? void 0 : _a2.errorText) !== void 0) {
|
|
17422
|
-
return (_b = props.formField) == null ? void 0 : _b.errorText;
|
|
17423
|
-
}
|
|
17424
|
-
const validityLevel = props.fieldSpec.getValueValidityLevel(value);
|
|
17425
|
-
return localiseValidity(props.fieldSpec, validityLevel);
|
|
17426
|
-
};
|
|
17427
|
-
FromPropsHelper.sanitizeValueToString = (value) => {
|
|
17428
|
-
if (value === null || value === void 0) {
|
|
17429
|
-
return "";
|
|
17430
|
-
}
|
|
17431
|
-
return value;
|
|
17432
|
-
};
|
|
17433
|
-
var FORM_FIELD_ID_SUFFIX = "_FORM_FIELD";
|
|
17434
|
-
function CSFormField(props) {
|
|
17435
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17436
|
-
const formFieldId = uniqueId + FORM_FIELD_ID_SUFFIX;
|
|
17437
|
-
if (!FromPropsHelper.usesFormField(props)) {
|
|
17438
|
-
return props.children;
|
|
17439
|
-
}
|
|
17440
|
-
return (
|
|
17441
|
-
// IMPORTANT: Order of props determines which one "wins". You can override Elements that are present in the
|
|
17442
|
-
// localisation texts via the additional props. For instance, you can pass in
|
|
17443
|
-
// non-static localisations that require variable values dynamically.
|
|
17444
|
-
/* @__PURE__ */ jsx(
|
|
17445
|
-
FormField,
|
|
17446
|
-
{
|
|
17447
|
-
"data-testid": formFieldId,
|
|
17448
|
-
...localisationObject == null ? void 0 : localisationObject.formField,
|
|
17449
|
-
...props.formField,
|
|
17450
|
-
secondaryControl: props.secondaryControl,
|
|
17451
|
-
children: props.children
|
|
17452
|
-
}
|
|
17453
|
-
)
|
|
17454
|
-
);
|
|
17455
|
-
}
|
|
17456
|
-
var ChildUtils = class {
|
|
17457
|
-
};
|
|
17458
|
-
ChildUtils.getChildren = (props, localisationObject) => {
|
|
17459
|
-
var _a2, _b;
|
|
17460
|
-
const childrenRaw = (_a2 = props.children) != null ? _a2 : localisationObject == null ? void 0 : localisationObject.children;
|
|
17461
|
-
const children = props.childrenWrapper ? props.childrenWrapper(childrenRaw) : childrenRaw;
|
|
17462
|
-
let finalChildren = props.preventOverflow ? /* @__PURE__ */ jsx2("div", { style: {
|
|
17463
|
-
whiteSpace: "nowrap",
|
|
17464
|
-
overflow: "hidden",
|
|
17465
|
-
textOverflow: "ellipsis"
|
|
17466
|
-
}, children }) : children;
|
|
17467
|
-
let formFieldProps = (_b = props.formField) != null ? _b : localisationObject == null ? void 0 : localisationObject.formField;
|
|
17468
|
-
if (props.inlineLabel && FromPropsHelper.usesFormField(props)) {
|
|
17469
|
-
finalChildren = /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexWrap: "nowrap" }, children: [
|
|
17470
|
-
/* @__PURE__ */ jsx2("div", { style: {
|
|
17471
|
-
flex: "none",
|
|
17472
|
-
fontWeight: "bold",
|
|
17473
|
-
paddingRight: "5px"
|
|
17474
|
-
}, children: formFieldProps.label + ":" }),
|
|
17475
|
-
finalChildren
|
|
17476
|
-
] });
|
|
17477
|
-
formFieldProps = { ...formFieldProps, label: void 0 };
|
|
17478
|
-
}
|
|
17479
|
-
return { children: finalChildren, formProps: { ...props, formField: formFieldProps } };
|
|
17480
|
-
};
|
|
17481
|
-
function CSAlert(props) {
|
|
17482
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17483
|
-
const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17484
|
-
return /* @__PURE__ */ jsx3(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx3(
|
|
17485
|
-
Alert,
|
|
17486
|
-
{
|
|
17487
|
-
"data-testid": uniqueId,
|
|
17488
|
-
...props,
|
|
17489
|
-
...localisationObject,
|
|
17490
|
-
children
|
|
17491
|
-
}
|
|
17492
|
-
) });
|
|
17493
|
-
}
|
|
17494
|
-
function CSBox(props) {
|
|
17495
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17496
|
-
const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17497
|
-
return /* @__PURE__ */ jsx4(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx4(
|
|
17498
|
-
Box,
|
|
17499
|
-
{
|
|
17500
|
-
"data-testid": uniqueId,
|
|
17501
|
-
...props,
|
|
17502
|
-
...localisationObject,
|
|
17503
|
-
children
|
|
17504
|
-
}
|
|
17505
|
-
) });
|
|
17506
|
-
}
|
|
17507
|
-
function CSButton(props) {
|
|
17508
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17509
|
-
const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17510
|
-
return /* @__PURE__ */ jsx5(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx5(
|
|
17511
|
-
Button,
|
|
17512
|
-
{
|
|
17513
|
-
"data-testid": uniqueId,
|
|
17514
|
-
...props,
|
|
17515
|
-
...localisationObject,
|
|
17516
|
-
children
|
|
17517
|
-
}
|
|
17518
|
-
) });
|
|
17519
|
-
}
|
|
17520
|
-
function CSCheckbox(props) {
|
|
17521
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17522
|
-
const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17523
|
-
return /* @__PURE__ */ jsx6(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx6(
|
|
17524
|
-
Checkbox,
|
|
17525
|
-
{
|
|
17526
|
-
"data-testid": uniqueId,
|
|
17527
|
-
name: uniqueId,
|
|
17528
|
-
controlId: uniqueId,
|
|
17529
|
-
onChange: props.onChange ? props.onChange : ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.checked),
|
|
17530
|
-
...props,
|
|
17531
|
-
...localisationObject,
|
|
17532
|
-
children
|
|
17533
|
-
}
|
|
17534
|
-
) });
|
|
17535
|
-
}
|
|
17536
|
-
function CSDatePicker(props) {
|
|
17537
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17538
|
-
const sanitizeValue = () => {
|
|
17539
|
-
return new Date(FromPropsHelper.sanitizeValueToString(props.value)).toISOString().split("T")[0];
|
|
17540
|
-
};
|
|
17541
|
-
return /* @__PURE__ */ jsx7(CSFormField, { ...props, children: /* @__PURE__ */ jsx7(
|
|
17542
|
-
DatePicker,
|
|
17543
|
-
{
|
|
17544
|
-
"data-testid": uniqueId,
|
|
17545
|
-
controlId: uniqueId,
|
|
17546
|
-
onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.value),
|
|
17547
|
-
...props,
|
|
17548
|
-
...localisationObject,
|
|
17549
|
-
value: sanitizeValue()
|
|
17550
|
-
}
|
|
17551
|
-
) });
|
|
17552
|
-
}
|
|
17553
|
-
function CSMultiselect(props) {
|
|
17554
|
-
var _a2, _b;
|
|
17555
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17556
|
-
const { formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17557
|
-
const adaptedOnChange = ({ detail }) => {
|
|
17558
|
-
if (props.enableSelectAll || props.enforceSelection) {
|
|
17559
|
-
if (detail.selectedOptions.length === 0) {
|
|
17560
|
-
props.onChangeValue(props.fieldSpec.key, [props.selectedOptions[0].value]);
|
|
17561
|
-
} else {
|
|
17562
|
-
props.onChangeValue(props.fieldSpec.key, detail.selectedOptions.map((sel) => sel.value));
|
|
17563
|
-
}
|
|
17564
|
-
} else {
|
|
17565
|
-
props.onChangeValue(props.fieldSpec.key, detail.selectedOptions.map((sel) => sel.value));
|
|
17566
|
-
}
|
|
17567
|
-
};
|
|
17568
|
-
const hideTokens = (_a2 = props.hideTokens) != null ? _a2 : props.tokenLimit !== void 0 && props.tokenLimit === 0;
|
|
17569
|
-
return /* @__PURE__ */ jsx8(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx8(
|
|
17570
|
-
Multiselect,
|
|
17571
|
-
{
|
|
17572
|
-
"data-testid": uniqueId,
|
|
17573
|
-
controlId: uniqueId,
|
|
17574
|
-
filteringType: (_b = props.filteringType) != null ? _b : "auto",
|
|
17575
|
-
onChange: adaptedOnChange,
|
|
17576
|
-
enableSelectAll: true,
|
|
17577
|
-
...props,
|
|
17578
|
-
...localisationObject,
|
|
17579
|
-
hideTokens,
|
|
17580
|
-
options: props.options
|
|
17581
|
-
}
|
|
17582
|
-
) });
|
|
17583
|
-
}
|
|
17584
|
-
var ObjectWithId = class {
|
|
17585
|
-
};
|
|
17586
|
-
ObjectWithId.idToString = (objectWithId) => {
|
|
17587
|
-
return objectWithId.id ? objectWithId.id.toString() : "<N/A>";
|
|
17588
|
-
};
|
|
17589
|
-
ObjectWithId.toObjectWithId = (array2, idExtractor) => {
|
|
17590
|
-
return array2.map((object2) => ({
|
|
17591
|
-
...object2,
|
|
17592
|
-
id: idExtractor(object2)
|
|
17593
|
-
}));
|
|
17594
|
-
};
|
|
17595
|
-
var _SelectHelper = class _SelectHelper2 {
|
|
17596
|
-
};
|
|
17597
|
-
_SelectHelper.singleSelectOptionWithId = (objects, selectedObjectId, toOptionDefinition) => {
|
|
17598
|
-
return _SelectHelper.singleSelectOption(objects, objects.find((importObject) => ObjectWithId.idToString(importObject) === (selectedObjectId == null ? void 0 : selectedObjectId.toString())), toOptionDefinition);
|
|
17599
|
-
};
|
|
17600
|
-
_SelectHelper.singleSelectOption = (objects, selectedObject, toOptionDefinition) => {
|
|
17601
|
-
const options = objects.map((object2) => ({
|
|
17602
|
-
value: ObjectWithId.idToString(object2),
|
|
17603
|
-
...toOptionDefinition(object2)
|
|
17604
|
-
}));
|
|
17605
|
-
const selectedOption = selectedObject === void 0 ? null : _SelectHelper.getSelectedOptions(options, [selectedObject.id])[0];
|
|
17606
|
-
return {
|
|
17607
|
-
options,
|
|
17608
|
-
selectedOption
|
|
17609
|
-
};
|
|
17610
|
-
};
|
|
17611
|
-
_SelectHelper.singleSelectEnum = (enumFactory, selectedEnum, localiser, exclude) => {
|
|
17612
|
-
const options = enumFactory.values.filter((enumInstance) => exclude === void 0 || !exclude.includes(enumInstance)).map((enumInstance) => {
|
|
17613
|
-
const enumTranslation = localiser.getEnumLocalisation(enumFactory, enumInstance);
|
|
17614
|
-
return {
|
|
17615
|
-
value: enumInstance.toString(),
|
|
17616
|
-
label: enumTranslation.label,
|
|
17617
|
-
description: enumTranslation.description
|
|
17618
|
-
};
|
|
17619
|
-
});
|
|
17620
|
-
const selectedOption = selectedEnum === void 0 ? null : _SelectHelper.getSelectedEnumOptions(options, [selectedEnum.toString()])[0];
|
|
17621
|
-
return {
|
|
17622
|
-
options,
|
|
17623
|
-
selectedOption
|
|
17624
|
-
};
|
|
17625
|
-
};
|
|
17626
|
-
_SelectHelper.multiSelectOptions = (objects, selectedObjects, toOptionDefinition) => {
|
|
17627
|
-
const options = objects.map((object2) => ({
|
|
17628
|
-
value: ObjectWithId.idToString(object2),
|
|
17629
|
-
...toOptionDefinition(object2)
|
|
17630
|
-
}));
|
|
17631
|
-
const selectedOptions = _SelectHelper.getSelectedOptions(options, selectedObjects.map((s2) => s2.id));
|
|
17632
|
-
return {
|
|
17633
|
-
options,
|
|
17634
|
-
selectedOptions
|
|
17635
|
-
};
|
|
17636
|
-
};
|
|
17637
|
-
_SelectHelper.multiSelectEnums = (enumFactory, selectedEnums, localiser) => {
|
|
17638
|
-
const options = enumFactory.values.map((enumInstance) => {
|
|
17639
|
-
const enumTranslation = localiser.getEnumLocalisation(enumFactory, enumInstance);
|
|
17640
|
-
return {
|
|
17641
|
-
value: enumInstance.toString(),
|
|
17642
|
-
label: enumTranslation.label,
|
|
17643
|
-
description: enumTranslation.description
|
|
17644
|
-
};
|
|
17645
|
-
});
|
|
17646
|
-
const selectedOptions = _SelectHelper.getSelectedEnumOptions(options, selectedEnums);
|
|
17647
|
-
return {
|
|
17648
|
-
options,
|
|
17649
|
-
selectedOptions
|
|
17650
|
-
};
|
|
17651
|
-
};
|
|
17652
|
-
_SelectHelper.getSelectedOptions = (options, selectedIds) => {
|
|
17653
|
-
const selectedIdsSet = {};
|
|
17654
|
-
selectedIds.forEach((selId) => selId !== void 0 ? selectedIdsSet[selId] = true : null);
|
|
17655
|
-
return options.filter((option) => option.value && selectedIdsSet[parseInt(option.value)]);
|
|
17656
|
-
};
|
|
17657
|
-
_SelectHelper.getSelectedEnumOptions = (options, selectedEnums) => {
|
|
17658
|
-
const selectedIdsSet = {};
|
|
17659
|
-
selectedEnums.forEach((selId) => selId !== void 0 ? selectedIdsSet[selId.toString()] = true : null);
|
|
17660
|
-
return options.filter((option) => option.value && selectedIdsSet[option.value]);
|
|
17661
|
-
};
|
|
17662
|
-
var SelectHelper = _SelectHelper;
|
|
17663
|
-
function CSEnumMultiselect(props) {
|
|
17664
|
-
return /* @__PURE__ */ jsx9(
|
|
17665
|
-
CSMultiselect,
|
|
17666
|
-
{
|
|
17667
|
-
...SelectHelper.multiSelectEnums(props.factory, props.selectedEnums, props.localiser),
|
|
17668
|
-
...props
|
|
17669
|
-
}
|
|
17670
|
-
);
|
|
17671
|
-
}
|
|
17672
|
-
function CSSegmentedControl(props) {
|
|
17673
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17674
|
-
const { formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17675
|
-
return /* @__PURE__ */ jsx10(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx10(
|
|
17676
|
-
SegmentedControl,
|
|
17677
|
-
{
|
|
17678
|
-
"data-testid": uniqueId,
|
|
17679
|
-
onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.selectedId),
|
|
17680
|
-
...props,
|
|
17681
|
-
...localisationObject
|
|
17682
|
-
}
|
|
17683
|
-
) });
|
|
17684
|
-
}
|
|
17685
|
-
function CSEnumSegmentedControl(props) {
|
|
17686
|
-
const options = props.factory.values.filter((e) => props.exclude === void 0 || !props.exclude.includes(e)).map((e) => ({
|
|
17687
|
-
text: props.localiser.getEnumLabel(props.factory, e),
|
|
17688
|
-
id: e.toString()
|
|
17689
|
-
}));
|
|
17690
|
-
return /* @__PURE__ */ jsx11(
|
|
17691
|
-
CSSegmentedControl,
|
|
17692
|
-
{
|
|
17693
|
-
selectedId: props.selectedEnum === void 0 ? null : props.selectedEnum.toString(),
|
|
17694
|
-
options,
|
|
17695
|
-
label: props.formField ? props.formField.label : void 0,
|
|
17696
|
-
...props
|
|
17697
|
-
}
|
|
17698
|
-
);
|
|
17699
|
-
}
|
|
17700
|
-
function CSSelect(props) {
|
|
17701
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17702
|
-
const { formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17703
|
-
return /* @__PURE__ */ jsx12(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx12(
|
|
17704
|
-
Select,
|
|
17705
|
-
{
|
|
17706
|
-
"data-testid": uniqueId,
|
|
17707
|
-
controlId: uniqueId,
|
|
17708
|
-
onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.selectedOption.value),
|
|
17709
|
-
...props,
|
|
17710
|
-
...localisationObject
|
|
17711
|
-
}
|
|
17712
|
-
) });
|
|
17713
|
-
}
|
|
17714
|
-
function CSEnumSelect(props) {
|
|
17715
|
-
return /* @__PURE__ */ jsx13(
|
|
17716
|
-
CSSelect,
|
|
17717
|
-
{
|
|
17718
|
-
...SelectHelper.singleSelectEnum(props.factory, props.selectedEnum, props.localiser, props.exclude),
|
|
17719
|
-
...props
|
|
17720
|
-
}
|
|
17721
|
-
);
|
|
17722
|
-
}
|
|
17723
|
-
function CSEnumTiles(props) {
|
|
17724
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17725
|
-
const items = props.factory.values.filter((enumInstance) => props.exclude === void 0 || !props.exclude.includes(enumInstance)).map((enumInstance) => {
|
|
17726
|
-
const enumTranslation = props.localiser.getEnumLocalisation(props.factory, enumInstance);
|
|
17727
|
-
return {
|
|
17728
|
-
value: enumInstance.toString(),
|
|
17729
|
-
label: enumTranslation.label,
|
|
17730
|
-
description: enumTranslation.description
|
|
17731
|
-
};
|
|
17732
|
-
});
|
|
17733
|
-
return /* @__PURE__ */ jsx14(
|
|
17734
|
-
Tiles,
|
|
17735
|
-
{
|
|
17736
|
-
"data-testid": uniqueId,
|
|
17737
|
-
controlId: uniqueId,
|
|
17738
|
-
name: uniqueId,
|
|
17739
|
-
onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.value),
|
|
17740
|
-
value: props.selectedEnum ? props.selectedEnum.toString() : null,
|
|
17741
|
-
items,
|
|
17742
|
-
...props,
|
|
17743
|
-
...localisationObject
|
|
17744
|
-
}
|
|
17745
|
-
);
|
|
17746
|
-
}
|
|
17747
|
-
var openInNewTab = (link) => {
|
|
17748
|
-
const newWindow = window.open(link, "_blank", "noopener,noreferrer");
|
|
17749
|
-
if (newWindow) newWindow.opener = null;
|
|
17750
|
-
};
|
|
17751
|
-
var warnWhenTabIsClosed = (isDirty) => {
|
|
17752
|
-
const handleTabClose = (event) => {
|
|
17753
|
-
if (isDirty !== void 0 && !isDirty()) {
|
|
17754
|
-
return void 0;
|
|
17755
|
-
}
|
|
17756
|
-
event.preventDefault();
|
|
17757
|
-
return event.returnValue = "Are you sure you want to exit?";
|
|
17758
|
-
};
|
|
17759
|
-
window.addEventListener("beforeunload", handleTabClose);
|
|
17760
|
-
return () => {
|
|
17761
|
-
window.removeEventListener("beforeunload", handleTabClose);
|
|
17762
|
-
};
|
|
17763
|
-
};
|
|
17764
|
-
function CSLink(props) {
|
|
17765
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17766
|
-
const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17767
|
-
return /* @__PURE__ */ jsx15(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx15(
|
|
17768
|
-
Link,
|
|
17769
|
-
{
|
|
17770
|
-
"data-testid": uniqueId,
|
|
17771
|
-
...props,
|
|
17772
|
-
...localisationObject,
|
|
17773
|
-
children
|
|
17774
|
-
}
|
|
17775
|
-
) });
|
|
17776
|
-
}
|
|
17777
|
-
function CSExternalLink(props) {
|
|
17778
|
-
return /* @__PURE__ */ jsx15(CSLink, { ...props, external: true, onFollow: (detail) => detail.preventDefault(), children: /* @__PURE__ */ jsx15("span", { onClick: () => openInNewTab(props.link), children: props.children }) });
|
|
17779
|
-
}
|
|
17780
|
-
function CSHeader(props) {
|
|
17781
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17782
|
-
const { children } = ChildUtils.getChildren(props, localisationObject);
|
|
17783
|
-
return /* @__PURE__ */ jsx16(
|
|
17784
|
-
Header,
|
|
17785
|
-
{
|
|
17786
|
-
"data-testid": uniqueId,
|
|
17787
|
-
...props,
|
|
17788
|
-
...localisationObject,
|
|
17789
|
-
children
|
|
17790
|
-
}
|
|
17791
|
-
);
|
|
17792
|
-
}
|
|
17793
|
-
function CSInput(props) {
|
|
17794
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17795
|
-
const { formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17796
|
-
const sanitizedValue = FromPropsHelper.sanitizeValueToString(props.value);
|
|
17797
|
-
const errorText = FromPropsHelper.getLocalisedErrorText(props, sanitizedValue, props.localiser.getFieldValidityLocalisationFunction());
|
|
17798
|
-
return /* @__PURE__ */ jsx17(CSFormField, { ...props, formField: { ...formProps, errorText }, children: /* @__PURE__ */ jsx17(
|
|
17799
|
-
Input,
|
|
17800
|
-
{
|
|
17801
|
-
"data-testid": uniqueId,
|
|
17802
|
-
controlId: uniqueId,
|
|
17803
|
-
onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.value),
|
|
17804
|
-
...props,
|
|
17805
|
-
...localisationObject,
|
|
17806
|
-
value: sanitizedValue
|
|
17807
|
-
}
|
|
17808
|
-
) });
|
|
17809
|
-
}
|
|
17810
|
-
function CSNumericInput(props) {
|
|
17811
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17812
|
-
const { formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17813
|
-
const sanitizeValue = () => {
|
|
17814
|
-
if (props.value === void 0 || props.value === null || isNaN(props.value)) {
|
|
17815
|
-
return "";
|
|
17816
|
-
}
|
|
17817
|
-
return FromPropsHelper.sanitizeValueToString(props.value);
|
|
17818
|
-
};
|
|
17819
|
-
const sanitizedValue = sanitizeValue();
|
|
17820
|
-
const errorText = FromPropsHelper.getLocalisedErrorText(props, sanitizedValue, props.localiser.getFieldValidityLocalisationFunction());
|
|
17821
|
-
return /* @__PURE__ */ jsx18(CSFormField, { ...formProps, formField: { ...props.formField, errorText }, children: /* @__PURE__ */ jsx18(
|
|
17822
|
-
Input2,
|
|
17823
|
-
{
|
|
17824
|
-
"data-testid": uniqueId,
|
|
17825
|
-
controlId: uniqueId,
|
|
17826
|
-
onChange: ({ detail }) => {
|
|
17827
|
-
props.onChangeValue(props.fieldSpec.key, props.step && props.step !== "any" && props.step % 1 === 0 ? parseInt(detail.value) : parseFloat(detail.value));
|
|
17828
|
-
},
|
|
17829
|
-
...props,
|
|
17830
|
-
...localisationObject,
|
|
17831
|
-
value: sanitizedValue,
|
|
17832
|
-
type: "number",
|
|
17833
|
-
inputMode: "numeric"
|
|
17834
|
-
}
|
|
17835
|
-
) });
|
|
17836
|
-
}
|
|
17837
|
-
function CSStatusIndicator(props) {
|
|
17838
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17839
|
-
const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17840
|
-
return /* @__PURE__ */ jsx19(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx19(
|
|
17841
|
-
StatusIndicator,
|
|
17842
|
-
{
|
|
17843
|
-
"data-testid": uniqueId,
|
|
17844
|
-
...props,
|
|
17845
|
-
...localisationObject,
|
|
17846
|
-
children
|
|
17847
|
-
}
|
|
17848
|
-
) });
|
|
17849
|
-
}
|
|
17850
|
-
function CSTextContent(props) {
|
|
17851
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17852
|
-
const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17853
|
-
return /* @__PURE__ */ jsx20(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx20(
|
|
17854
|
-
TextContent,
|
|
17855
|
-
{
|
|
17856
|
-
"data-testid": uniqueId,
|
|
17857
|
-
...props,
|
|
17858
|
-
...localisationObject,
|
|
17859
|
-
children
|
|
17860
|
-
}
|
|
17861
|
-
) });
|
|
17862
|
-
}
|
|
17863
|
-
function CSTextarea(props) {
|
|
17864
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17865
|
-
const { formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17866
|
-
const sanitizedValue = FromPropsHelper.sanitizeValueToString(props.value);
|
|
17867
|
-
const errorText = FromPropsHelper.getLocalisedErrorText(props, sanitizedValue, props.localiser.getFieldValidityLocalisationFunction());
|
|
17868
|
-
return /* @__PURE__ */ jsx21(CSFormField, { ...props, formField: { ...formProps, errorText }, children: /* @__PURE__ */ jsx21(
|
|
17869
|
-
Textarea,
|
|
17870
|
-
{
|
|
17871
|
-
"data-testid": uniqueId,
|
|
17872
|
-
controlId: uniqueId,
|
|
17873
|
-
onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.value),
|
|
17874
|
-
...localisationObject,
|
|
17875
|
-
...props,
|
|
17876
|
-
value: sanitizedValue
|
|
17877
|
-
}
|
|
17878
|
-
) });
|
|
17879
|
-
}
|
|
17880
|
-
function CSTimeInput(props) {
|
|
17881
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17882
|
-
const { formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17883
|
-
const defaultFormat = "hh:mm";
|
|
17884
|
-
return /* @__PURE__ */ jsx22(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx22(
|
|
17885
|
-
TimeInput,
|
|
17886
|
-
{
|
|
17887
|
-
"data-testid": uniqueId,
|
|
17888
|
-
autoFocus: props.autoFocus,
|
|
17889
|
-
onChange: ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.value),
|
|
17890
|
-
format: props.format ? props.format : defaultFormat,
|
|
17891
|
-
placeholder: props.placeholder ? props.placeholder : defaultFormat,
|
|
17892
|
-
...props,
|
|
17893
|
-
...localisationObject
|
|
17894
|
-
}
|
|
17895
|
-
) });
|
|
17896
|
-
}
|
|
17897
|
-
function CSToggle(props) {
|
|
17898
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17899
|
-
const { children, formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17900
|
-
return /* @__PURE__ */ jsx23(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx23(
|
|
17901
|
-
Toggle,
|
|
17902
|
-
{
|
|
17903
|
-
"data-testid": uniqueId,
|
|
17904
|
-
name: uniqueId,
|
|
17905
|
-
controlId: uniqueId,
|
|
17906
|
-
onChange: props.onChange ? props.onChange : ({ detail }) => props.onChangeValue(props.fieldSpec.key, detail.checked),
|
|
17907
|
-
...props,
|
|
17908
|
-
...localisationObject,
|
|
17909
|
-
children
|
|
17910
|
-
}
|
|
17911
|
-
) });
|
|
17912
|
-
}
|
|
17913
|
-
function CSCopyToClipboard(props) {
|
|
17914
|
-
var _a2, _b;
|
|
17915
|
-
const { localisationObject, uniqueId } = FromPropsHelper.getBasicProps(props);
|
|
17916
|
-
const { formProps } = ChildUtils.getChildren(props, localisationObject);
|
|
17917
|
-
return /* @__PURE__ */ jsx24(CSFormField, { ...formProps, children: /* @__PURE__ */ jsx24(
|
|
17918
|
-
CopyToClipboard,
|
|
17919
|
-
{
|
|
17920
|
-
"data-testid": uniqueId,
|
|
17921
|
-
...props,
|
|
17922
|
-
copySuccessText: (_a2 = props.copySuccessText) != null ? _a2 : "",
|
|
17923
|
-
copyErrorText: (_b = props.copyErrorText) != null ? _b : "",
|
|
17924
|
-
...localisationObject
|
|
17925
|
-
}
|
|
17926
|
-
) });
|
|
17927
|
-
}
|
|
17928
|
-
var EnumFactory = class {
|
|
17929
|
-
constructor(enumName, values) {
|
|
17930
|
-
this.enumName = enumName;
|
|
17931
|
-
this.values = values;
|
|
17932
|
-
if (this.values.length === 0) {
|
|
17933
|
-
throw new Error("Empty localized enum array is not allowed here");
|
|
17934
|
-
}
|
|
17935
|
-
}
|
|
17936
|
-
getEnumIndex(instance) {
|
|
17937
|
-
return this.values.indexOf(instance);
|
|
17938
|
-
}
|
|
17939
|
-
};
|
|
17940
|
-
var ElementValidityLevel = /* @__PURE__ */ ((ElementValidityLevel2) => {
|
|
17941
|
-
ElementValidityLevel2["VALID"] = "VALID";
|
|
17942
|
-
ElementValidityLevel2["REQUIRED_VALUE_IS_NOT_PRESENT"] = "REQUIRED_VALUE_IS_NOT_PRESENT";
|
|
17943
|
-
ElementValidityLevel2["MAX_LENGTH_EXCEEDED"] = "MAX_LENGTH_EXCEEDED";
|
|
17944
|
-
ElementValidityLevel2["LOWER_BOUND_ONLY_TOO_SMALL"] = "LOWER_BOUND_ONLY_TOO_SMALL";
|
|
17945
|
-
ElementValidityLevel2["UPPER_BOUND_ONLY_TOO_BIG"] = "UPPER_BOUND_ONLY_TOO_BIG";
|
|
17946
|
-
ElementValidityLevel2["BOTH_BOUNDS_OUT_OF_BOUNDS"] = "BOTH_BOUNDS_OUT_OF_BOUNDS";
|
|
17947
|
-
return ElementValidityLevel2;
|
|
17948
|
-
})(ElementValidityLevel || {});
|
|
17949
|
-
var ELEMENT_VALIDITY_LEVEL_FACTORY = new EnumFactory("ElementValidityLevel", Object.values(ElementValidityLevel));
|
|
17950
|
-
var DISABLE_LOGGING = false;
|
|
17951
|
-
var Log = class _Log {
|
|
17952
|
-
constructor(prefix) {
|
|
17953
|
-
this.prefix = prefix ? "[" + prefix + "] " : "";
|
|
17954
|
-
this.debugLogging = true;
|
|
17955
|
-
}
|
|
17956
|
-
static toReadableObjectString(object2) {
|
|
17957
|
-
return this.toObjectStr(object2, (object22) => JSON.stringify(object22, null, 2));
|
|
17958
|
-
}
|
|
17959
|
-
static toCompactReadableObjectString(object2, dependencyCharLimit) {
|
|
17960
|
-
const str = this.toObjectStr(object2, (object22) => JSON.stringify(object22));
|
|
17961
|
-
const maxLen = Math.min(str.length, dependencyCharLimit);
|
|
17962
|
-
if (maxLen < str.length) {
|
|
17963
|
-
return str.substring(0, maxLen) + " ( ... continued)";
|
|
17964
|
-
}
|
|
17965
|
-
return str;
|
|
17966
|
-
}
|
|
17967
|
-
static toObjectStr(object2, stringify2) {
|
|
17968
|
-
if (object2 === null) {
|
|
17969
|
-
return "null";
|
|
17970
|
-
}
|
|
17971
|
-
if (object2 === void 0) {
|
|
17972
|
-
return "undefined";
|
|
17973
|
-
}
|
|
17974
|
-
let s2 = stringify2(object2);
|
|
17975
|
-
if (s2 === void 0) {
|
|
17976
|
-
return "function";
|
|
17977
|
-
}
|
|
17978
|
-
return s2.replaceAll("\\", "");
|
|
17979
|
-
}
|
|
17980
|
-
/**
|
|
17981
|
-
* log at debugging level
|
|
17982
|
-
*/
|
|
17983
|
-
debug(msg, ...supportingDetails) {
|
|
17984
|
-
this.emitLogMessage("debug", msg, supportingDetails);
|
|
17985
|
-
}
|
|
17986
|
-
/**
|
|
17987
|
-
* log at information level
|
|
17988
|
-
*/
|
|
17989
|
-
info(msg, ...supportingDetails) {
|
|
17990
|
-
this.emitLogMessage("info", msg, supportingDetails);
|
|
17991
|
-
}
|
|
17992
|
-
/**
|
|
17993
|
-
* log at warning level
|
|
17994
|
-
*/
|
|
17995
|
-
warn(msg, ...supportingDetails) {
|
|
17996
|
-
this.emitLogMessage("warn", msg, supportingDetails);
|
|
17997
|
-
}
|
|
17998
|
-
/**
|
|
17999
|
-
* log at error level
|
|
18000
|
-
*/
|
|
18001
|
-
error(msg, ...supportingDetails) {
|
|
18002
|
-
this.emitLogMessage("error", msg, supportingDetails);
|
|
18003
|
-
}
|
|
18004
|
-
object(prefixMsg, object2) {
|
|
18005
|
-
this.debug(prefixMsg + " " + _Log.toReadableObjectString(object2));
|
|
18006
|
-
}
|
|
18007
|
-
effectStart(effectName, msg, dependencies, dependencyCharLimit) {
|
|
18008
|
-
let dependenciesSuffix = "";
|
|
18009
|
-
if (dependencies) {
|
|
18010
|
-
let dependenciesStr = "";
|
|
18011
|
-
for (let i = 0; i < dependencies.length; i++) {
|
|
18012
|
-
const dependency = dependencies[i];
|
|
18013
|
-
dependenciesStr = `${dependenciesStr} Dep[${i}]=<${_Log.toCompactReadableObjectString(dependency, dependencyCharLimit || 60)}>`;
|
|
18014
|
-
}
|
|
18015
|
-
dependenciesSuffix = (msg.length > 0 ? ", " : "") + "DEPS:" + dependenciesStr;
|
|
18016
|
-
}
|
|
18017
|
-
this.effect(`start - ${effectName}`, `${msg}${dependenciesSuffix}`);
|
|
18018
|
-
}
|
|
18019
|
-
effectEnd(effectName) {
|
|
18020
|
-
this.debug(`EFFECT(end - ${effectName})`);
|
|
18021
|
-
}
|
|
18022
|
-
effect(effectName, msg) {
|
|
18023
|
-
this.debug(`EFFECT(${effectName}): ${msg}`);
|
|
18024
|
-
}
|
|
18025
|
-
/**
|
|
18026
|
-
* creates a log message with some detailed information
|
|
18027
|
-
* @param msgType type of message (debug, info, warn, error)
|
|
18028
|
-
* @param msg the message as string
|
|
18029
|
-
* @param supportingDetails details that should be logged
|
|
18030
|
-
*/
|
|
18031
|
-
emitLogMessage(msgType, msg, supportingDetails) {
|
|
18032
|
-
if (DISABLE_LOGGING) {
|
|
18033
|
-
return;
|
|
18034
|
-
}
|
|
18035
|
-
const logTS = (/* @__PURE__ */ new Date()).toISOString();
|
|
18036
|
-
if (!this.debugLogging && msgType === "debug") {
|
|
18037
|
-
return;
|
|
18038
|
-
}
|
|
18039
|
-
if (supportingDetails.length > 0) {
|
|
18040
|
-
console[msgType](`${logTS} ${this.prefix}${msg}${supportingDetails}`);
|
|
18041
|
-
} else {
|
|
18042
|
-
console[msgType](`${logTS} ${this.prefix}${msg}`);
|
|
18043
|
-
}
|
|
18044
|
-
}
|
|
18045
|
-
};
|
|
18046
|
-
var LOGGER = new Log("ViewSpec");
|
|
18047
|
-
var ViewElementSpec = class {
|
|
18048
|
-
constructor(key, instanceId) {
|
|
18049
|
-
this.key = key;
|
|
18050
|
-
this.instanceId = instanceId;
|
|
18051
|
-
}
|
|
18052
|
-
getDataTestId() {
|
|
18053
|
-
if (this.dataTestId === void 0) {
|
|
18054
|
-
const parentDataTestId = this.parent ? this.parent.getDataTestId() : "";
|
|
18055
|
-
this.dataTestId = this.instanceId ? `${parentDataTestId}${this.key}${this.instanceId}END` : `${parentDataTestId}${this.key}END`;
|
|
18056
|
-
}
|
|
18057
|
-
return this.dataTestId;
|
|
18058
|
-
}
|
|
18059
|
-
getLocalisationKey() {
|
|
18060
|
-
if (this.localisationKey === void 0) {
|
|
18061
|
-
const keys2 = this.getKeyHierarchy();
|
|
18062
|
-
this.localisationKey = this.ns.createKey(...keys2);
|
|
18063
|
-
}
|
|
18064
|
-
return this.localisationKey;
|
|
18065
|
-
}
|
|
18066
|
-
getKeyHierarchy() {
|
|
18067
|
-
if (this.keyHierarchy === void 0) {
|
|
18068
|
-
const parentHierarchy = this.parent ? this.parent.getKeyHierarchy() : [];
|
|
18069
|
-
this.keyHierarchy = [...parentHierarchy, this.key];
|
|
18070
|
-
}
|
|
18071
|
-
return this.keyHierarchy;
|
|
18072
|
-
}
|
|
18073
|
-
log(prefix) {
|
|
18074
|
-
LOGGER.info(`${prefix === void 0 ? "" : prefix}<${this.getDataTestId()}> = ${this.getLocalisationKey()}`);
|
|
18075
|
-
}
|
|
18076
|
-
};
|
|
18077
|
-
var FieldSpec = class _FieldSpec extends ViewElementSpec {
|
|
18078
|
-
constructor(key, required, maxLength, minValue, maxValue, customFieldValidator, instanceId) {
|
|
18079
|
-
super(key, instanceId);
|
|
18080
|
-
this.required = required;
|
|
18081
|
-
this.maxLength = maxLength;
|
|
18082
|
-
this.minValue = minValue;
|
|
18083
|
-
this.maxValue = maxValue;
|
|
18084
|
-
this.customFieldValidator = customFieldValidator;
|
|
18085
|
-
}
|
|
18086
|
-
static getTOValidityLevel(transportObject, elements) {
|
|
18087
|
-
if (elements.length === 0) {
|
|
18088
|
-
throw Error("At least one field property must be given");
|
|
18089
|
-
}
|
|
18090
|
-
for (let index2 = 0; index2 < elements.length; index2++) {
|
|
18091
|
-
const field = elements[index2];
|
|
18092
|
-
const fieldValidity = field.getValueValidityLevel(transportObject[field.key]);
|
|
18093
|
-
if (fieldValidity !== "VALID") {
|
|
18094
|
-
return fieldValidity;
|
|
18095
|
-
}
|
|
18096
|
-
}
|
|
18097
|
-
return "VALID";
|
|
18098
|
-
}
|
|
18099
|
-
static isTOValid(transportObject, Elements) {
|
|
18100
|
-
return this.getTOValidityLevel(transportObject, Elements) === "VALID";
|
|
18101
|
-
}
|
|
18102
|
-
static debugLogElementValidityArray(elements, Elements) {
|
|
18103
|
-
for (let index2 = 0; index2 < elements.length; index2++) {
|
|
18104
|
-
const element = elements[index2];
|
|
18105
|
-
_FieldSpec.debugLogElementValidity(element, "idx=" + index2.toString(), Elements);
|
|
18106
|
-
}
|
|
18107
|
-
}
|
|
18108
|
-
static debugLogElementValidity(element, elementId, Elements) {
|
|
18109
|
-
for (const field of Elements) {
|
|
18110
|
-
const fieldValidity = _FieldSpec.getTOValidityLevel(element, [field]);
|
|
18111
|
-
LOGGER.info(`Field validity level, element id = <${elementId}>, field name = <${field.getDataTestId()}>, validity level = <${fieldValidity.toString()}>.`);
|
|
18112
|
-
}
|
|
18113
|
-
}
|
|
18114
|
-
getValueValidityLevel(value) {
|
|
18115
|
-
if (this.customFieldValidator) {
|
|
18116
|
-
return this.customFieldValidator(this, value);
|
|
18117
|
-
}
|
|
18118
|
-
const isString = value !== void 0 && value !== null && (typeof value === "string" || value instanceof String);
|
|
18119
|
-
const isNumber = value !== void 0 && value !== null && typeof value === "number";
|
|
18120
|
-
if (this.required && (value === void 0 || value === null || isString && value.trim().length === 0 || isNumber && isNaN(value))) {
|
|
18121
|
-
return "REQUIRED_VALUE_IS_NOT_PRESENT";
|
|
18122
|
-
}
|
|
18123
|
-
if (isString && this.maxLength !== void 0 && value.length > this.getMaxLength()) {
|
|
18124
|
-
return "MAX_LENGTH_EXCEEDED";
|
|
18125
|
-
}
|
|
18126
|
-
if (isNumber) {
|
|
18127
|
-
if (this.minValue !== void 0 && this.maxValue === void 0 && this.minValue > value) {
|
|
18128
|
-
return "LOWER_BOUND_ONLY_TOO_SMALL";
|
|
18129
|
-
}
|
|
18130
|
-
if (this.maxValue !== void 0 && this.minValue === void 0 && this.maxValue < value) {
|
|
18131
|
-
return "UPPER_BOUND_ONLY_TOO_BIG";
|
|
18132
|
-
}
|
|
18133
|
-
if (this.minValue !== void 0 && this.maxValue !== void 0 && (this.minValue > value || this.maxValue < value)) {
|
|
18134
|
-
return "BOTH_BOUNDS_OUT_OF_BOUNDS";
|
|
18135
|
-
}
|
|
18136
|
-
}
|
|
18137
|
-
return "VALID";
|
|
18138
|
-
}
|
|
18139
|
-
getMaxLength() {
|
|
18140
|
-
return this.maxLength ? this.maxLength : Number.MAX_SAFE_INTEGER;
|
|
18141
|
-
}
|
|
18142
|
-
};
|
|
18143
|
-
var ViewSpec = class _ViewSpec extends ViewElementSpec {
|
|
18144
|
-
constructor(key, ns, instanceId, customViewValidator) {
|
|
18145
|
-
super(key, instanceId);
|
|
18146
|
-
this.ns = ns;
|
|
18147
|
-
if (!customViewValidator) {
|
|
18148
|
-
this.viewValidator = () => "VALID";
|
|
18149
|
-
} else {
|
|
18150
|
-
this.viewValidator = customViewValidator;
|
|
18151
|
-
}
|
|
18152
|
-
}
|
|
18153
|
-
static create(key, ns, elementDefinition, instanceId, parent, customViewValidator) {
|
|
18154
|
-
const viewSpec = new _ViewSpec(key, ns, instanceId, customViewValidator);
|
|
18155
|
-
viewSpec.parent = parent;
|
|
18156
|
-
viewSpec.elements = elementDefinition(viewSpec);
|
|
18157
|
-
return viewSpec;
|
|
18158
|
-
}
|
|
18159
|
-
addField(fieldSpec) {
|
|
18160
|
-
fieldSpec.parent = this;
|
|
18161
|
-
fieldSpec.ns = this.ns;
|
|
18162
|
-
return fieldSpec;
|
|
18163
|
-
}
|
|
18164
|
-
addFieldFromProps(fieldProps, customFieldValidator, instanceId) {
|
|
18165
|
-
const fieldSpec = new FieldSpec(fieldProps.key, fieldProps.required, fieldProps.maxLength, fieldProps.minValue, fieldProps.maxValue, customFieldValidator, instanceId);
|
|
18166
|
-
fieldSpec.parent = this;
|
|
18167
|
-
fieldSpec.ns = this.ns;
|
|
18168
|
-
return fieldSpec;
|
|
18169
|
-
}
|
|
18170
|
-
addView(viewSpecProvider, key, instanceId) {
|
|
18171
|
-
const viewSpec = viewSpecProvider(this, key, instanceId);
|
|
18172
|
-
viewSpec.ns = this.ns;
|
|
18173
|
-
return viewSpec;
|
|
18174
|
-
}
|
|
18175
|
-
getAllElements() {
|
|
18176
|
-
return Object.values(this.elements);
|
|
18177
|
-
}
|
|
18178
|
-
getValueValidityLevel(value) {
|
|
18179
|
-
return this.viewValidator(this, value);
|
|
18180
|
-
}
|
|
18181
|
-
logViewSpec() {
|
|
18182
|
-
this.log("VIEW :::: ");
|
|
18183
|
-
for (const element of Object.values(this.elements)) {
|
|
18184
|
-
if (element instanceof ViewElementSpec) {
|
|
18185
|
-
element.log(" FIELD :::: ");
|
|
18186
|
-
}
|
|
18187
|
-
}
|
|
18188
|
-
}
|
|
18189
|
-
};
|
|
18190
|
-
var CSV_ENUM_RATING_VIEW_SPEC = (parent, key, instanceId) => ViewSpec.create(key, parent.ns, (spec) => ({
|
|
18191
|
-
rating: spec.addField(new FieldSpec("rating")),
|
|
18192
|
-
boxRatingName: spec.addField(new FieldSpec("boxRatingName"))
|
|
18193
|
-
}), instanceId, parent);
|
|
18194
|
-
function getEnumRatingValues(factory, toOrderNumber) {
|
|
18195
|
-
return toOrderNumber ? factory.values.sort((e1, e2) => toOrderNumber(e1) - toOrderNumber(e2)) : factory.values;
|
|
18196
|
-
}
|
|
18197
|
-
function getEnumRatingLabel(enumInstance, instanceId) {
|
|
18198
|
-
return `${instanceId}_${enumInstance.toString()}`;
|
|
18199
|
-
}
|
|
18200
|
-
function CSVEnumRatingView(props) {
|
|
18201
|
-
const spec = props.viewSpec;
|
|
18202
|
-
const { elements } = spec;
|
|
18203
|
-
const [hoveredValue, setHoveredValue] = useState(props.selectedEnum);
|
|
18204
|
-
const valuesInOrder = getEnumRatingValues(props.factory, props.toOrderNumber);
|
|
18205
|
-
const onHover = (hoveredIndex) => {
|
|
18206
|
-
if (hoveredIndex === 0) {
|
|
18207
|
-
setHoveredValue(props.selectedEnum);
|
|
18208
|
-
} else {
|
|
18209
|
-
setHoveredValue(valuesInOrder[hoveredIndex]);
|
|
18210
|
-
}
|
|
18211
|
-
};
|
|
18212
|
-
const itemCount = Math.max(1, Math.min(valuesInOrder.length - 1, 10));
|
|
18213
|
-
useEffect(() => {
|
|
18214
|
-
setHoveredValue(props.selectedEnum);
|
|
18215
|
-
}, [props.selectedEnum]);
|
|
18216
|
-
return /* @__PURE__ */ jsxs2(CSFormField, { fieldSpec: elements.rating, localiser: props.localiser, children: [
|
|
18217
|
-
/* @__PURE__ */ jsx25(
|
|
18218
|
-
Rating,
|
|
18219
|
-
{
|
|
18220
|
-
"data-testid": elements.rating.getDataTestId(),
|
|
18221
|
-
isDisabled: props.disabled,
|
|
18222
|
-
style: { maxWidth: 100 },
|
|
18223
|
-
items: itemCount,
|
|
18224
|
-
value: !props.disabled ? valuesInOrder.indexOf(props.selectedEnum) : 0,
|
|
18225
|
-
onHoverChange: onHover,
|
|
18226
|
-
onChange: (selectedIndex) => props.onChangeValue(spec.key, valuesInOrder[selectedIndex]),
|
|
18227
|
-
invisibleItemLabels: valuesInOrder.slice(1).map((e) => getEnumRatingLabel(e, spec.instanceId))
|
|
18228
|
-
}
|
|
18229
|
-
),
|
|
18230
|
-
/* @__PURE__ */ jsx25("div", { style: { textAlign: "left", paddingLeft: "5px" }, children: /* @__PURE__ */ jsx25(
|
|
18231
|
-
CSBox,
|
|
18232
|
-
{
|
|
18233
|
-
fieldSpec: elements.boxRatingName,
|
|
18234
|
-
localiser: props.localiser,
|
|
18235
|
-
variant: !props.disabled ? "div" : "small",
|
|
18236
|
-
children: hoveredValue !== void 0 ? props.localiser.getEnumLabel(props.factory, hoveredValue) : void 0
|
|
18237
|
-
}
|
|
18238
|
-
) })
|
|
18239
|
-
] });
|
|
18240
|
-
}
|
|
18241
|
-
var CSV_NO_ITEMS_VIEW_SPEC = (ns) => ViewSpec.create("CSVNoItemsView", ns, (spec) => ({
|
|
18242
|
-
boxHeading: spec.addField(new FieldSpec("boxHeading")),
|
|
18243
|
-
boxBody: spec.addField(new FieldSpec("boxBody"))
|
|
18244
|
-
}));
|
|
18245
|
-
function CSVNoItemsView(props) {
|
|
18246
|
-
const spec = props.viewSpec;
|
|
18247
|
-
const { elements } = spec;
|
|
18248
|
-
return /* @__PURE__ */ jsx26("div", { "data-testid": spec.getDataTestId(), children: /* @__PURE__ */ jsx26(Box2, { textAlign: "center", color: "inherit", children: /* @__PURE__ */ jsxs3(SpaceBetween, { size: "xxs", direction: "vertical", children: [
|
|
18249
|
-
/* @__PURE__ */ jsx26(
|
|
18250
|
-
CSBox,
|
|
18251
|
-
{
|
|
18252
|
-
fieldSpec: elements.boxHeading,
|
|
18253
|
-
localiser: props.localiser,
|
|
18254
|
-
alternateNs: spec.ns,
|
|
18255
|
-
variant: "strong",
|
|
18256
|
-
color: "inherit",
|
|
18257
|
-
children: props.headingText
|
|
18258
|
-
}
|
|
18259
|
-
),
|
|
18260
|
-
/* @__PURE__ */ jsx26(
|
|
18261
|
-
CSBox,
|
|
18262
|
-
{
|
|
18263
|
-
fieldSpec: elements.boxBody,
|
|
18264
|
-
localiser: props.localiser,
|
|
18265
|
-
alternateNs: spec.ns,
|
|
18266
|
-
localisationVariables: { itemType: props.localiser.getEnumLabel(props.factory, props.itemType) },
|
|
18267
|
-
variant: "p",
|
|
18268
|
-
color: "inherit",
|
|
18269
|
-
children: props.bodyText
|
|
18270
|
-
}
|
|
18271
|
-
),
|
|
18272
|
-
props.bodyNode
|
|
18273
|
-
] }) }) });
|
|
18274
|
-
}
|
|
18275
|
-
var LOGGER2 = new Log("PriceUtils");
|
|
18276
|
-
var _PriceUtils = class _PriceUtils2 {
|
|
18277
|
-
};
|
|
18278
|
-
_PriceUtils.getFormattedPrice = (locale, price) => {
|
|
18279
|
-
if (isNaN(price.priceInCents)) {
|
|
18280
|
-
return "-";
|
|
18281
|
-
}
|
|
18282
|
-
return new Intl.NumberFormat(locale, {
|
|
18283
|
-
style: "currency",
|
|
18284
|
-
currency: price.currency.toString()
|
|
18285
|
-
}).format(price.priceInCents / 100);
|
|
18286
|
-
};
|
|
18287
|
-
_PriceUtils.sumPrices = (prices, defaultCurrency) => {
|
|
18288
|
-
if (prices.length === 0) {
|
|
18289
|
-
return { priceInCents: 0, currency: defaultCurrency };
|
|
18290
|
-
}
|
|
18291
|
-
const currencySet = _PriceUtils.getCurrenciesFromPrices(prices);
|
|
18292
|
-
if (currencySet.size > 1) {
|
|
18293
|
-
LOGGER2.warn("Different currencies found in price array to be summed - the final price is incorrect!", currencySet);
|
|
18294
|
-
}
|
|
18295
|
-
const summedPrice = prices.map((pr) => pr.priceInCents).reduce((sum, current) => sum + current);
|
|
18296
|
-
return { priceInCents: summedPrice, currency: prices[0].currency };
|
|
18297
|
-
};
|
|
18298
|
-
_PriceUtils.getCurrenciesFromPrices = (prices) => {
|
|
18299
|
-
const currencySet = /* @__PURE__ */ new Set();
|
|
18300
|
-
prices.forEach((pr) => currencySet.add(pr.currency));
|
|
18301
|
-
return currencySet;
|
|
18302
|
-
};
|
|
18303
|
-
_PriceUtils.getPriceValidityLevel = (spec, value) => {
|
|
18304
|
-
const centsValidity = spec.elements.inputPrice.getValueValidityLevel(value.priceInCents);
|
|
18305
|
-
if (centsValidity !== "VALID") {
|
|
18306
|
-
return centsValidity;
|
|
18307
|
-
}
|
|
18308
|
-
return spec.elements.selectCurrency.getValueValidityLevel(value.currency);
|
|
18309
|
-
};
|
|
18310
|
-
_PriceUtils.parseFormattedPrice = (locale, formattedPrice, currency) => {
|
|
18311
|
-
const thousandSeparator = Intl.NumberFormat(locale).format(11111).replace(/\p{Number}/gu, "");
|
|
18312
|
-
const decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/\p{Number}/gu, "");
|
|
18313
|
-
const sanitizedPrice = formattedPrice.replace(new RegExp("\\" + thousandSeparator, "g"), "").replace(new RegExp("\\" + decimalSeparator), ".").replace(new RegExp("[^0-9.]", "g"), "").trim();
|
|
18314
|
-
const parsedPriceCents = Math.round(100 * parseFloat(sanitizedPrice));
|
|
18315
|
-
return { priceInCents: parsedPriceCents, currency };
|
|
18316
|
-
};
|
|
18317
|
-
_PriceUtils.parseFormattedPriceWithCurrency = (locale, formattedPrice, currencySymbolMapping) => {
|
|
18318
|
-
const thousandSeparator = Intl.NumberFormat(locale).format(11111).replace(/\p{Number}/gu, "");
|
|
18319
|
-
const decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/\p{Number}/gu, "");
|
|
18320
|
-
const sanitizedPrice = formattedPrice.replace(new RegExp("\\" + thousandSeparator, "g"), "").replace(new RegExp("\\" + decimalSeparator), ".").replace(new RegExp("[^0-9.]", "g"), "").trim();
|
|
18321
|
-
const parsedPriceCents = Math.round(100 * parseFloat(sanitizedPrice));
|
|
18322
|
-
const supportedCurrencies = Object.keys(currencySymbolMapping);
|
|
18323
|
-
const currencySymbolsFound = supportedCurrencies.filter((symbol) => formattedPrice.includes(symbol));
|
|
18324
|
-
if (currencySymbolsFound.length > 1) {
|
|
18325
|
-
throw new Error(`Multiple currency symbols found in formatter price string ${formattedPrice}, here are the supported currencies: ${supportedCurrencies}`);
|
|
18326
|
-
}
|
|
18327
|
-
return {
|
|
18328
|
-
priceInCents: parsedPriceCents,
|
|
18329
|
-
currency: currencySymbolMapping[currencySymbolsFound[0]]
|
|
18330
|
-
};
|
|
18331
|
-
};
|
|
18332
|
-
var PriceUtils = _PriceUtils;
|
|
18333
|
-
var CSV_PRICE_INPUT_VIEW_SPEC = (parent, key) => ViewSpec.create(key, parent.ns, (spec) => ({
|
|
18334
|
-
inputPrice: spec.addField(new FieldSpec("inputPrice", true, void 0, 0)),
|
|
18335
|
-
selectCurrency: spec.addField(new FieldSpec("currency", true)),
|
|
18336
|
-
boxPriceDisplay: spec.addField(new FieldSpec("boxPriceDisplay"))
|
|
18337
|
-
}), key, parent, PriceUtils.getPriceValidityLevel);
|
|
18338
|
-
function CSVPriceInputView(props) {
|
|
18339
|
-
const spec = props.viewSpec;
|
|
18340
|
-
const { elements } = spec;
|
|
18341
|
-
const priceInCents = props.value ? props.value.priceInCents : 0;
|
|
18342
|
-
const currency = props.value ? props.value.currency : props.defaultCurrency;
|
|
18343
|
-
return /* @__PURE__ */ jsxs4(
|
|
18344
|
-
Grid,
|
|
18345
|
-
{
|
|
18346
|
-
gridDefinition: [{ colspan: 4 }, { colspan: { default: 4, xxs: 3 } }, { colspan: { default: 4, xxs: 5 } }],
|
|
18347
|
-
disableGutters: true,
|
|
18348
|
-
children: [
|
|
18349
|
-
/* @__PURE__ */ jsx27(
|
|
18350
|
-
CSNumericInput,
|
|
18351
|
-
{
|
|
18352
|
-
fieldSpec: elements.inputPrice,
|
|
18353
|
-
value: priceInCents / 100,
|
|
18354
|
-
step: 0.01,
|
|
18355
|
-
disabled: props.disabled,
|
|
18356
|
-
localiser: props.localiser,
|
|
18357
|
-
onChangeValue: (propertyName, changedValue) => props.onChange(props.viewSpec.key, {
|
|
18358
|
-
priceInCents: parseFloat(changedValue) * 100,
|
|
18359
|
-
currency
|
|
18360
|
-
})
|
|
18361
|
-
}
|
|
18362
|
-
),
|
|
18363
|
-
/* @__PURE__ */ jsx27("div", { style: { paddingLeft: "8px" }, children: /* @__PURE__ */ jsx27(
|
|
18364
|
-
CSEnumSelect,
|
|
18365
|
-
{
|
|
18366
|
-
fieldSpec: elements.selectCurrency,
|
|
18367
|
-
localiser: props.localiser,
|
|
18368
|
-
factory: props.currencyFactory,
|
|
18369
|
-
selectedEnum: currency,
|
|
18370
|
-
disabled: props.disabled,
|
|
18371
|
-
onChangeValue: (propertyName, changedValue) => props.onChange(props.viewSpec.key, {
|
|
18372
|
-
priceInCents,
|
|
18373
|
-
currency: changedValue
|
|
18374
|
-
}),
|
|
18375
|
-
expandToViewport: props.expandToViewport
|
|
18376
|
-
}
|
|
18377
|
-
) }),
|
|
18378
|
-
/* @__PURE__ */ jsx27("div", { style: { paddingTop: "30px", paddingLeft: "8px" }, children: /* @__PURE__ */ jsx27(
|
|
18379
|
-
CSBox,
|
|
18380
|
-
{
|
|
18381
|
-
fieldSpec: elements.boxPriceDisplay,
|
|
18382
|
-
localiser: props.localiser,
|
|
18383
|
-
fontSize: "heading-s",
|
|
18384
|
-
fontWeight: "heavy",
|
|
18385
|
-
variant: "awsui-key-label",
|
|
18386
|
-
children: PriceUtils.getFormattedPrice(props.localiser.language(), { priceInCents, currency })
|
|
18387
|
-
}
|
|
18388
|
-
) })
|
|
18389
|
-
]
|
|
18390
|
-
}
|
|
18391
|
-
);
|
|
18392
|
-
}
|
|
18393
|
-
var CSV_SEARCH_FILTER_VIEW_SPEC = (parent, key) => ViewSpec.create(key, parent.ns, (spec) => ({
|
|
18394
|
-
inputSearch: spec.addField(new FieldSpec("inputSearch")),
|
|
18395
|
-
buttonSearch: spec.addField(new FieldSpec("buttonSearch"))
|
|
18396
|
-
}), void 0, parent);
|
|
18397
|
-
function CSVSearchFilterView(props) {
|
|
18398
|
-
const spec = props.viewSpec;
|
|
18399
|
-
const { elements } = spec;
|
|
18400
|
-
return /* @__PURE__ */ jsxs5(SpaceBetween2, { size: "s", direction: "horizontal", children: [
|
|
18401
|
-
/* @__PURE__ */ jsx28("div", { style: { minWidth: "320px" }, children: props.inputSearch === void 0 || typeof props.inputSearch === "string" ? /* @__PURE__ */ jsx28(
|
|
18402
|
-
CSInput,
|
|
18403
|
-
{
|
|
18404
|
-
fieldSpec: elements.inputSearch,
|
|
18405
|
-
localiser: props.localiser,
|
|
18406
|
-
autoFocus: true,
|
|
18407
|
-
placeholder: props.inputSearch,
|
|
18408
|
-
onChangeValue: props.onChangeValue,
|
|
18409
|
-
value: props.searchString,
|
|
18410
|
-
type: "search"
|
|
18411
|
-
}
|
|
18412
|
-
) : props.inputSearch }),
|
|
18413
|
-
props.buttonSearch === void 0 || typeof props.buttonSearch === "string" ? /* @__PURE__ */ jsx28(
|
|
18414
|
-
CSButton,
|
|
18415
|
-
{
|
|
18416
|
-
fieldSpec: elements.buttonSearch,
|
|
18417
|
-
localiser: props.localiser,
|
|
18418
|
-
variant: "primary",
|
|
18419
|
-
iconName: "search",
|
|
18420
|
-
onClick: props.onConfirmSearch,
|
|
18421
|
-
formAction: "submit",
|
|
18422
|
-
loading: props.loading,
|
|
18423
|
-
disabled: props.searchDisabled,
|
|
18424
|
-
children: props.buttonSearch
|
|
18425
|
-
}
|
|
18426
|
-
) : props.buttonSearch
|
|
18427
|
-
] });
|
|
18428
|
-
}
|
|
18429
|
-
var CSV_TEXT_PROMPT_MODAL_VIEW_SPEC = (parent, key) => ViewSpec.create(key, parent.ns, (spec) => ({
|
|
18430
|
-
headerHeading: spec.addField(new FieldSpec("headerHeading")),
|
|
18431
|
-
boxBodyText: spec.addField(new FieldSpec("boxBodyText")),
|
|
18432
|
-
buttonPrimary: spec.addField(new FieldSpec("buttonPrimary")),
|
|
18433
|
-
buttonSecondary: spec.addField(new FieldSpec("buttonSecondary"))
|
|
18434
|
-
}), void 0, parent);
|
|
18435
|
-
function CSVTextPromptModalView(props) {
|
|
18436
|
-
const spec = props.viewSpec;
|
|
18437
|
-
const { elements } = spec;
|
|
18438
|
-
const secondaryAction = props.onSecondaryAction ? props.buttonSecondary === void 0 || typeof props.buttonSecondary === "string" ? /* @__PURE__ */ jsx29(
|
|
18439
|
-
CSButton,
|
|
18440
|
-
{
|
|
18441
|
-
fieldSpec: elements.buttonSecondary,
|
|
18442
|
-
localiser: props.localiser,
|
|
18443
|
-
variant: "normal",
|
|
18444
|
-
onClick: props.onSecondaryAction,
|
|
18445
|
-
children: props.buttonSecondary
|
|
18446
|
-
}
|
|
18447
|
-
) : props.buttonSecondary : /* @__PURE__ */ jsx29(Fragment, {});
|
|
18448
|
-
return /* @__PURE__ */ jsx29(
|
|
18449
|
-
Modal,
|
|
18450
|
-
{
|
|
18451
|
-
"data-testid": props.viewSpec.getDataTestId(),
|
|
18452
|
-
onDismiss: props.onDismiss,
|
|
18453
|
-
visible: props.visible,
|
|
18454
|
-
header: props.headerHeading === void 0 || typeof props.headerHeading === "string" ? /* @__PURE__ */ jsx29(
|
|
18455
|
-
CSHeader,
|
|
18456
|
-
{
|
|
18457
|
-
fieldSpec: elements.headerHeading,
|
|
18458
|
-
localiser: props.localiser,
|
|
18459
|
-
children: props.headerHeading
|
|
18460
|
-
}
|
|
18461
|
-
) : props.headerHeading,
|
|
18462
|
-
footer: /* @__PURE__ */ jsx29(Box3, { float: "right", children: /* @__PURE__ */ jsxs6(SpaceBetween3, { direction: "horizontal", size: "l", children: [
|
|
18463
|
-
props.buttonPrimary === void 0 || typeof props.buttonPrimary === "string" ? /* @__PURE__ */ jsx29(
|
|
18464
|
-
CSButton,
|
|
18465
|
-
{
|
|
18466
|
-
fieldSpec: elements.buttonPrimary,
|
|
18467
|
-
localiser: props.localiser,
|
|
18468
|
-
variant: "primary",
|
|
18469
|
-
onClick: props.onPrimaryAction,
|
|
18470
|
-
children: props.buttonPrimary
|
|
18471
|
-
}
|
|
18472
|
-
) : props.buttonPrimary,
|
|
18473
|
-
secondaryAction
|
|
18474
|
-
] }) }),
|
|
18475
|
-
children: props.boxBodyText === void 0 || typeof props.boxBodyText === "string" ? /* @__PURE__ */ jsx29(CSBox, { fieldSpec: elements.boxBodyText, localiser: props.localiser, children: props.boxBodyText }) : props.boxBodyText
|
|
18476
|
-
}
|
|
18477
|
-
);
|
|
18478
|
-
}
|
|
18479
|
-
var ControllerState = /* @__PURE__ */ ((ControllerState2) => {
|
|
18480
|
-
ControllerState2[ControllerState2["UNMOUNTED"] = 0] = "UNMOUNTED";
|
|
18481
|
-
ControllerState2[ControllerState2["INITIALIZING"] = 1] = "INITIALIZING";
|
|
18482
|
-
ControllerState2[ControllerState2["NORMAL"] = 2] = "NORMAL";
|
|
18483
|
-
ControllerState2[ControllerState2["FATAL_ERROR"] = 3] = "FATAL_ERROR";
|
|
18484
|
-
return ControllerState2;
|
|
18485
|
-
})(ControllerState || {});
|
|
18486
|
-
var DateUtils = class _DateUtils {
|
|
18487
|
-
static dateAsString(date) {
|
|
18488
|
-
const dd = String(date.getDate()).padStart(2, "0");
|
|
18489
|
-
const mm = String(date.getMonth() + 1).padStart(2, "0");
|
|
18490
|
-
const yyyy = date.getFullYear();
|
|
18491
|
-
return yyyy + "-" + mm + "-" + dd;
|
|
18492
|
-
}
|
|
18493
|
-
static dateAsDateTimeString(date, language) {
|
|
18494
|
-
return date.toLocaleDateString(language) + " " + date.toLocaleTimeString(language);
|
|
18495
|
-
}
|
|
18496
|
-
static nextSundayAt(hour, minute, second) {
|
|
18497
|
-
const today = /* @__PURE__ */ new Date();
|
|
18498
|
-
const addDays = 7 - today.getDay();
|
|
18499
|
-
const nextSunday = new Date(today.getTime() + addDays * 24 * 60 * 60 * 1e3);
|
|
18500
|
-
nextSunday.setHours(hour, minute, second, 0);
|
|
18501
|
-
return nextSunday;
|
|
18502
|
-
}
|
|
18503
|
-
static getCurrentUserTimezone() {
|
|
18504
|
-
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
18505
|
-
}
|
|
18506
|
-
static dateTimeAsUTCISO8601String(date) {
|
|
18507
|
-
const hh = String(date.getHours()).padStart(2, "0");
|
|
18508
|
-
const MM = String(date.getMinutes()).padStart(2, "0");
|
|
18509
|
-
const ss = String(date.getSeconds()).padStart(2, "0");
|
|
18510
|
-
return _DateUtils.dateAsString(date) + "T" + hh + ":" + MM + ":" + ss + "Z";
|
|
18511
|
-
}
|
|
18512
|
-
static currentDateTimeAsUTCISO8601String() {
|
|
18513
|
-
const now3 = /* @__PURE__ */ new Date();
|
|
18514
|
-
return _DateUtils.dateTimeAsUTCISO8601String(now3);
|
|
18515
|
-
}
|
|
18516
|
-
static currentDateAsISO8601String() {
|
|
18517
|
-
const now3 = /* @__PURE__ */ new Date();
|
|
18518
|
-
return _DateUtils.dateAsString(now3);
|
|
18519
|
-
}
|
|
18520
|
-
static toFormattedLocalizedDate(locale, inputInUTCISO8601, timezone) {
|
|
18521
|
-
if (inputInUTCISO8601 === void 0 || inputInUTCISO8601 === null) {
|
|
18522
|
-
return "";
|
|
18523
|
-
}
|
|
18524
|
-
return new Intl.DateTimeFormat(locale, {
|
|
18525
|
-
year: "numeric",
|
|
18526
|
-
month: "2-digit",
|
|
18527
|
-
day: "2-digit",
|
|
18528
|
-
hour: "2-digit",
|
|
18529
|
-
minute: "2-digit",
|
|
18530
|
-
second: "2-digit",
|
|
18531
|
-
hour12: false,
|
|
18532
|
-
timeZone: timezone
|
|
18533
|
-
}).format(new Date(inputInUTCISO8601));
|
|
18534
|
-
}
|
|
18535
|
-
};
|
|
18536
|
-
var FieldProperties = class {
|
|
18537
|
-
constructor(key, required, maxLength, minValue, maxValue) {
|
|
18538
|
-
this.key = key;
|
|
18539
|
-
this.required = required;
|
|
18540
|
-
this.maxLength = maxLength;
|
|
18541
|
-
this.minValue = minValue;
|
|
18542
|
-
this.maxValue = maxValue;
|
|
18543
|
-
}
|
|
18544
|
-
};
|
|
18545
|
-
function FixedWidth(props) {
|
|
18546
|
-
return /* @__PURE__ */ jsx30("div", { style: { minWidth: props.minWidth, maxWidth: props.maxWidth }, children: props.children });
|
|
18547
|
-
}
|
|
18548
|
-
var ITEM_SEP = ",";
|
|
18549
|
-
var LocalStorageService = class {
|
|
18550
|
-
static getItemStringArrayWithDefault(key, defaultValue) {
|
|
18551
|
-
const result = this.safeGetItem(key);
|
|
18552
|
-
if (result === null) {
|
|
18553
|
-
return defaultValue;
|
|
18554
|
-
}
|
|
18555
|
-
return result.split(ITEM_SEP);
|
|
18556
|
-
}
|
|
18557
|
-
static getItemEnumArrayWithDefault(enumClass, key, defaultValue) {
|
|
18558
|
-
const enumConstantsAsStrings = this.getItemStringArrayWithDefault(key, defaultValue.map((s2) => s2.toString()));
|
|
18559
|
-
const keys2 = Object.keys(enumClass);
|
|
18560
|
-
const values = Object.values(enumClass);
|
|
18561
|
-
const dict = {};
|
|
18562
|
-
for (let index2 = 0; index2 < keys2.length; index2++) {
|
|
18563
|
-
dict[values[index2]] = keys2[index2];
|
|
18564
|
-
}
|
|
18565
|
-
return enumConstantsAsStrings.map((val) => dict[val]);
|
|
18566
|
-
}
|
|
18567
|
-
static setItemEnumArray(key, value) {
|
|
18568
|
-
this.setItemStringArray(key, value.map((e) => e.toString()));
|
|
18569
|
-
}
|
|
18570
|
-
static setItemStringArray(key, value) {
|
|
18571
|
-
this.safeSetItem(key, value.join(","));
|
|
18572
|
-
}
|
|
18573
|
-
static getItemWithDefault(key, defaultValue) {
|
|
18574
|
-
const result = this.safeGetItem(key);
|
|
18575
|
-
if (result === null) {
|
|
18576
|
-
return defaultValue;
|
|
18577
|
-
}
|
|
18578
|
-
return result;
|
|
18579
|
-
}
|
|
18580
|
-
static setItem(key, value) {
|
|
18581
|
-
return this.safeSetItem(key, value);
|
|
18582
|
-
}
|
|
18583
|
-
static clear() {
|
|
18584
|
-
window.localStorage.clear();
|
|
18585
|
-
}
|
|
18586
|
-
static setObject(key, value) {
|
|
18587
|
-
return this.safeSetItem(key, JSON.stringify(value));
|
|
18588
|
-
}
|
|
18589
|
-
static getObjectWithDefault(key, defaultValue) {
|
|
18590
|
-
const result = this.safeGetItem(key);
|
|
18591
|
-
if (result === null) {
|
|
18592
|
-
return defaultValue;
|
|
18593
|
-
}
|
|
18594
|
-
return JSON.parse(result);
|
|
18595
|
-
}
|
|
18596
|
-
static safeGetItem(key) {
|
|
18597
|
-
try {
|
|
18598
|
-
return localStorage.getItem(key);
|
|
18599
|
-
} catch (error) {
|
|
18600
|
-
console.log(`WARNING: could not get item with key ${key} from local storage due to exception: ${error}`);
|
|
18601
|
-
return null;
|
|
18602
|
-
}
|
|
18603
|
-
}
|
|
18604
|
-
static safeSetItem(key, value) {
|
|
18605
|
-
try {
|
|
18606
|
-
return localStorage.setItem(key, value);
|
|
18607
|
-
} catch (error) {
|
|
18608
|
-
console.log(`WARNING: could not set item with key ${key} and value ${value} in local storage due to exception: ${error}`);
|
|
18609
|
-
return null;
|
|
18610
|
-
}
|
|
18611
|
-
}
|
|
18612
|
-
};
|
|
18613
|
-
var LocalisationNamespace = class {
|
|
18614
|
-
constructor(name) {
|
|
18615
|
-
this.name = name;
|
|
18616
|
-
}
|
|
18617
|
-
/**
|
|
18618
|
-
*
|
|
18619
|
-
* @param parts The parts. Call this with comma-separated args, e.g. createKey(arg1, arg2, arg3) or with array using following syntax:
|
|
18620
|
-
* createKey(...[arg1, arg2, arg3]). DO NOT call it directly with an array!
|
|
18621
|
-
* This is WRONG: createKey([arg1, arg2, arg3]). It will treat the array as single arg and call toString() on it.
|
|
18622
|
-
*/
|
|
18623
|
-
createKey(...parts) {
|
|
18624
|
-
return this.name + "." + parts.join(".");
|
|
18625
|
-
}
|
|
18626
|
-
};
|
|
18627
|
-
var NSK_CONTENT = "content";
|
|
18628
|
-
var Localiser = class {
|
|
18629
|
-
constructor(translate, ns) {
|
|
18630
|
-
this.translate = translate;
|
|
18631
|
-
this.ns = ns;
|
|
18632
|
-
}
|
|
18633
|
-
getEnumLabel(factory, instance) {
|
|
18634
|
-
return this.getEnumLocalisation(factory, instance).label;
|
|
18635
|
-
}
|
|
18636
|
-
getAllEnumLabels(factory) {
|
|
18637
|
-
return factory.values.map((instance) => this.getEnumLabel(factory, instance));
|
|
18638
|
-
}
|
|
18639
|
-
};
|
|
18640
|
-
var MessageSeverity = /* @__PURE__ */ ((MessageSeverity2) => {
|
|
18641
|
-
MessageSeverity2["INFO"] = "INFO";
|
|
18642
|
-
MessageSeverity2["WARN"] = "WARN";
|
|
18643
|
-
MessageSeverity2["ERR"] = "ERR";
|
|
18644
|
-
MessageSeverity2["SUCCESS"] = "SUCCESS";
|
|
18645
|
-
return MessageSeverity2;
|
|
18646
|
-
})(MessageSeverity || {});
|
|
18647
|
-
var MESSAGE_SEVERITY_FACTORY = new EnumFactory("MessageSeverity", Object.values(MessageSeverity));
|
|
18648
|
-
var MessageCTO = class {
|
|
18649
|
-
};
|
|
18650
|
-
MessageCTO.TIMESTAMP_PROPS = new FieldProperties("timestamp", true);
|
|
18651
|
-
MessageCTO.DETAIL_MESSAGE_PROPS = new FieldProperties("detailMessage", true);
|
|
18652
|
-
MessageCTO.CORRELATION_ID_PROPS = new FieldProperties("correlationId", true);
|
|
18653
|
-
MessageCTO.OPERATION_PROPS = new FieldProperties("operation", true);
|
|
18654
|
-
var MessageCodeTO = class {
|
|
18655
|
-
};
|
|
18656
|
-
MessageCodeTO.CONTROLLER_ID_PROPS = new FieldProperties("componentId", true);
|
|
18657
|
-
MessageCodeTO.HTTP_STATUS_CODE_PROPS = new FieldProperties("httpStatusCode", true);
|
|
18658
|
-
MessageCodeTO.LOCAL_CODE_PROPS = new FieldProperties("localCode", true);
|
|
18659
|
-
MessageCodeTO.MESSAGE_SEVERITY_PROPS = new FieldProperties("messageSeverity", true);
|
|
18660
|
-
MessageCodeTO.UNIQUE_CODE_PROPS = new FieldProperties("uniqueCode", true);
|
|
18661
|
-
var TECHNICAL_CONTROLLER_ID = "T";
|
|
18662
|
-
var NO_HTTP_CODE = 0;
|
|
18663
|
-
var _MessageService = class _MessageService2 {
|
|
18664
|
-
static getResponseTOWithMessagesFromUnknownResponse(json, op, status) {
|
|
18665
|
-
const response = json !== void 0 && json !== null && json.hasOwnProperty("messages") ? json : _MessageService2.createGenericErrorMessageTO(status, op);
|
|
18666
|
-
response.messages.forEach((m2) => m2.operation = op);
|
|
18667
|
-
return response;
|
|
18668
|
-
}
|
|
18669
|
-
static getSuccessContentWithMessagesCTO(json, op) {
|
|
18670
|
-
let result = { content: void 0, messages: [] };
|
|
18671
|
-
if (json.hasOwnProperty("content")) {
|
|
18672
|
-
result.content = json.content;
|
|
18673
|
-
}
|
|
18674
|
-
if (json.hasOwnProperty("messages")) {
|
|
18675
|
-
result.messages = json.messages;
|
|
18676
|
-
}
|
|
18677
|
-
result.messages.forEach((m2) => m2.operation = op);
|
|
18678
|
-
return result;
|
|
18679
|
-
}
|
|
18680
|
-
static createContentWithMessage(message) {
|
|
18681
|
-
return {
|
|
18682
|
-
messages: [message],
|
|
18683
|
-
content: void 0
|
|
18684
|
-
};
|
|
18685
|
-
}
|
|
18686
|
-
};
|
|
18687
|
-
_MessageService.createContentWithSuccessMessage = (operation, message) => {
|
|
18688
|
-
return _MessageService.createContentWithMessage(_MessageService.createMessageTO(
|
|
18689
|
-
TECHNICAL_CONTROLLER_ID,
|
|
18690
|
-
NO_HTTP_CODE.toString(),
|
|
18691
|
-
0,
|
|
18692
|
-
message,
|
|
18693
|
-
operation,
|
|
18694
|
-
"SUCCESS"
|
|
18695
|
-
/* SUCCESS */
|
|
18696
|
-
));
|
|
18697
|
-
};
|
|
18698
|
-
_MessageService.createContentWithoutMessages = (content) => {
|
|
18699
|
-
return {
|
|
18700
|
-
messages: [],
|
|
18701
|
-
content
|
|
18702
|
-
};
|
|
18703
|
-
};
|
|
18704
|
-
_MessageService.createContentWithInfoMessage = (operation, message) => {
|
|
18705
|
-
return _MessageService.createContentWithMessage(_MessageService.createMessageTO(
|
|
18706
|
-
TECHNICAL_CONTROLLER_ID,
|
|
18707
|
-
NO_HTTP_CODE.toString(),
|
|
18708
|
-
0,
|
|
18709
|
-
message,
|
|
18710
|
-
operation,
|
|
18711
|
-
"INFO"
|
|
18712
|
-
/* INFO */
|
|
18713
|
-
));
|
|
18714
|
-
};
|
|
18715
|
-
_MessageService.createGenericErrorMessageTO = (httpStatusCode, operation) => {
|
|
18716
|
-
if (_MessageService.isAPIClientCallError(httpStatusCode)) {
|
|
18717
|
-
return _MessageService.createContentWithMessage(_MessageService.createMessageTO(TECHNICAL_CONTROLLER_ID, "998", httpStatusCode, "Generic API call client error", operation));
|
|
18718
|
-
} else if (_MessageService.isBackendError(httpStatusCode)) {
|
|
18719
|
-
return _MessageService.createContentWithMessage(_MessageService.createMessageTO(TECHNICAL_CONTROLLER_ID, "999", httpStatusCode, "Generic backend error", operation));
|
|
18720
|
-
} else {
|
|
18721
|
-
throw new Error("Calling this methods with any http status code outside 400-599 is not allowed.");
|
|
18722
|
-
}
|
|
18723
|
-
};
|
|
18724
|
-
_MessageService.createCriticalErrorFrontendProcessingMessageTO = (operation, message) => {
|
|
18725
|
-
return _MessageService.createMessageTO(TECHNICAL_CONTROLLER_ID, "997", -1, message, operation);
|
|
18726
|
-
};
|
|
18727
|
-
_MessageService.isAPIClientCallError = (httpStatusCode) => {
|
|
18728
|
-
return httpStatusCode >= 400 && httpStatusCode <= 499;
|
|
18729
|
-
};
|
|
18730
|
-
_MessageService.isBackendError = (httpStatusCode) => {
|
|
18731
|
-
return httpStatusCode >= 500 && httpStatusCode <= 599;
|
|
18732
|
-
};
|
|
18733
|
-
_MessageService.createMessageTO = (componentId, localCode, httpStatusCode, detailMessage, operation, severity) => {
|
|
18734
|
-
const message = new MessageCTO();
|
|
18735
|
-
message.code = new MessageCodeTO();
|
|
18736
|
-
message.code.httpStatusCode = httpStatusCode;
|
|
18737
|
-
message.code.componentId = componentId;
|
|
18738
|
-
message.code.localCode = localCode;
|
|
18739
|
-
message.code.uniqueCode = componentId + localCode;
|
|
18740
|
-
message.code.messageSeverity = severity ? severity : "ERR";
|
|
18741
|
-
message.operation = operation;
|
|
18742
|
-
message.correlationId = "N/A";
|
|
18743
|
-
message.timestamp = DateUtils.currentDateTimeAsUTCISO8601String();
|
|
18744
|
-
message.detailMessage = detailMessage;
|
|
18745
|
-
return message;
|
|
18746
|
-
};
|
|
18747
|
-
var MessageService = _MessageService;
|
|
18748
|
-
var QUERY_START = "?";
|
|
18749
|
-
var QUERY_SEP = "&";
|
|
18750
|
-
var QueryParamHelper = class {
|
|
18751
|
-
static appendQueryParam(query, key, value) {
|
|
18752
|
-
let result = query;
|
|
18753
|
-
if (!query.includes(QUERY_START)) {
|
|
18754
|
-
result = result + QUERY_START;
|
|
18755
|
-
}
|
|
18756
|
-
if (result[result.length - 1] !== QUERY_START) {
|
|
18757
|
-
result = result + QUERY_SEP;
|
|
18758
|
-
}
|
|
18759
|
-
return result + encodeURIComponent(key) + "=" + encodeURIComponent(value);
|
|
18760
|
-
}
|
|
18761
|
-
static getQueryParams(queryString) {
|
|
18762
|
-
const returnedParams = {};
|
|
18763
|
-
if (queryString === void 0 || queryString.length === 0 || !queryString.startsWith(QUERY_START)) {
|
|
18764
|
-
return returnedParams;
|
|
18765
|
-
}
|
|
18766
|
-
queryString = queryString.substring(1);
|
|
18767
|
-
const params = queryString.split(QUERY_SEP);
|
|
18768
|
-
if (params.length === 0 || params.length === 1 && params[0] === "") {
|
|
18769
|
-
return returnedParams;
|
|
18770
|
-
}
|
|
18771
|
-
params.forEach((param) => {
|
|
18772
|
-
const paramRegex = /^(?<key>.*?)=(?<value>.*?)$/;
|
|
18773
|
-
const matchArray = param.match(paramRegex);
|
|
18774
|
-
if (matchArray !== null && matchArray.groups) {
|
|
18775
|
-
const key = decodeURIComponent(matchArray.groups["key"]);
|
|
18776
|
-
returnedParams[key] = decodeURIComponent(matchArray.groups["value"]);
|
|
18777
|
-
}
|
|
18778
|
-
});
|
|
18779
|
-
return returnedParams;
|
|
18780
|
-
}
|
|
18781
|
-
};
|
|
18782
|
-
var REST_CLIENT_LOGGER = new Log("RestClient");
|
|
18783
|
-
function logStart(logMsg, url) {
|
|
18784
|
-
REST_CLIENT_LOGGER.debug("START " + logMsg + " using URL <" + url + "> ...");
|
|
18785
|
-
}
|
|
18786
|
-
function logDone(logMsg, url) {
|
|
18787
|
-
REST_CLIENT_LOGGER.debug("DONE " + logMsg + " using URL <" + url + "> .");
|
|
18788
|
-
}
|
|
18789
|
-
function logError(logMsg, url) {
|
|
18790
|
-
REST_CLIENT_LOGGER.debug("ERROR: ", logMsg, ", using URL <" + url + "> .");
|
|
18791
|
-
}
|
|
18792
|
-
function createRestClient() {
|
|
18793
|
-
return new RestClient("");
|
|
18794
|
-
}
|
|
18795
|
-
var RestClient = class {
|
|
18796
|
-
/**
|
|
18797
|
-
* Creates a new REST client.
|
|
18798
|
-
* @param baseUrl base URL, so client can be called with relative URLs.
|
|
18799
|
-
*/
|
|
18800
|
-
constructor(baseUrl) {
|
|
18801
|
-
this.baseUrl = "";
|
|
18802
|
-
if (baseUrl != null) {
|
|
18803
|
-
this.baseUrl = baseUrl;
|
|
18804
|
-
}
|
|
18805
|
-
}
|
|
18806
|
-
prepareFetchConfig(method, payload, header = {}) {
|
|
18807
|
-
let headers = {
|
|
18808
|
-
Accept: "application/json",
|
|
18809
|
-
"Content-Type": "application/json",
|
|
18810
|
-
...header
|
|
18811
|
-
};
|
|
18812
|
-
let config2;
|
|
18813
|
-
if (payload) {
|
|
18814
|
-
config2 = {
|
|
18815
|
-
method,
|
|
18816
|
-
headers,
|
|
18817
|
-
body: JSON.stringify(payload)
|
|
18818
|
-
};
|
|
18819
|
-
} else {
|
|
18820
|
-
config2 = {
|
|
18821
|
-
method,
|
|
18822
|
-
headers
|
|
18823
|
-
};
|
|
18824
|
-
}
|
|
18825
|
-
return config2;
|
|
18826
|
-
}
|
|
18827
|
-
/**
|
|
18828
|
-
* Make a GET request on the specified endpoint
|
|
18829
|
-
*
|
|
18830
|
-
* @param {string} endpoint the endpoint relative to the baseUrl with a preceeding slash. e.g. '/users'.
|
|
18831
|
-
* @param {string} operation the operation name for logging.
|
|
18832
|
-
* @param {string} headers the HTTP headers to pass.
|
|
18833
|
-
*/
|
|
18834
|
-
get(endpoint, operation, headers) {
|
|
18835
|
-
return this.callApi("get", endpoint, null, operation, headers);
|
|
18836
|
-
}
|
|
18837
|
-
/**
|
|
18838
|
-
* Make a PUT request on the specified endpoint
|
|
18839
|
-
*
|
|
18840
|
-
* @param {string} endpoint the endpoint relative to the baseUrl with a preceeding slash. e.g. '/users'.
|
|
18841
|
-
* @param {object} payload the request payload as object.
|
|
18842
|
-
* @param {string} operation the operation name for logging.
|
|
18843
|
-
*/
|
|
18844
|
-
put(endpoint, payload, operation) {
|
|
18845
|
-
return this.callApi("put", endpoint, payload, operation);
|
|
18846
|
-
}
|
|
18847
|
-
/**
|
|
18848
|
-
* Make a POST request on the specified endpoint
|
|
18849
|
-
*
|
|
18850
|
-
* @param {string} endpoint the endpoint relative to the baseUrl with a preceeding slash. e.g. '/users'.
|
|
18851
|
-
* @param {object} payload the request payload as object.
|
|
18852
|
-
* @param {string} operation the operation name for logging.
|
|
18853
|
-
*/
|
|
18854
|
-
post(endpoint, payload, operation) {
|
|
18855
|
-
return this.callApi("post", endpoint, payload, operation);
|
|
18856
|
-
}
|
|
18857
|
-
/**
|
|
18858
|
-
* Make a DELETE request on the specified endpoint
|
|
18859
|
-
*
|
|
18860
|
-
* @param {string} endpoint the endpoint relative to the baseUrl with a preceeding slash. e.g. '/users'.
|
|
18861
|
-
* @param {object} payload the request payload as object.
|
|
18862
|
-
* @param {string} operation the operation name for logging.
|
|
18863
|
-
*/
|
|
18864
|
-
del(endpoint, payload, operation) {
|
|
18865
|
-
return this.callApi("delete", endpoint, payload, operation);
|
|
18866
|
-
}
|
|
18867
|
-
callApi(method, endpoint = "", payload = null, operation, header) {
|
|
18868
|
-
const url = `${this.baseUrl}${endpoint}`;
|
|
18869
|
-
const config2 = this.prepareFetchConfig(method, payload, header);
|
|
18870
|
-
const op = operation ? operation : "Unknown operation";
|
|
18871
|
-
logStart(op, url);
|
|
18872
|
-
REST_CLIENT_LOGGER.debug("Calling API - " + method + "," + url);
|
|
18873
|
-
REST_CLIENT_LOGGER.object("Payload", payload);
|
|
18874
|
-
return new Promise((resolve4, reject) => {
|
|
18875
|
-
fetch(url, config2).then((response) => {
|
|
18876
|
-
const contentType = response.headers.get("content-type");
|
|
18877
|
-
if (contentType && contentType.indexOf("application/json") !== -1) {
|
|
18878
|
-
return response.json().then((json) => ({
|
|
18879
|
-
status: response.status,
|
|
18880
|
-
json
|
|
18881
|
-
}));
|
|
18882
|
-
} else {
|
|
18883
|
-
return response.text().then(() => ({
|
|
18884
|
-
status: response.status,
|
|
18885
|
-
json: {}
|
|
18886
|
-
}));
|
|
18887
|
-
}
|
|
18888
|
-
}).then((result) => {
|
|
18889
|
-
const { status, json } = result;
|
|
18890
|
-
if (status >= 400) {
|
|
18891
|
-
logError(op, url);
|
|
18892
|
-
REST_CLIENT_LOGGER.error("Api call failed with response code " + status + ", response body=" + Log.toReadableObjectString(json));
|
|
18893
|
-
const responseWithMessages = MessageService.getResponseTOWithMessagesFromUnknownResponse(json, op, status);
|
|
18894
|
-
return reject(responseWithMessages);
|
|
18895
|
-
} else {
|
|
18896
|
-
logDone(op, url);
|
|
18897
|
-
REST_CLIENT_LOGGER.debug("Api call successful " + status + ", response body=" + Log.toReadableObjectString(json));
|
|
18898
|
-
if (json === null || json === void 0) {
|
|
18899
|
-
const msg = "Invalid response body - must never be null or undefined";
|
|
18900
|
-
REST_CLIENT_LOGGER.error(msg);
|
|
18901
|
-
const responseWithMessages2 = {
|
|
18902
|
-
content: void 0,
|
|
18903
|
-
messages: [MessageService.createCriticalErrorFrontendProcessingMessageTO(op, msg)]
|
|
18904
|
-
};
|
|
18905
|
-
return reject(responseWithMessages2);
|
|
18906
|
-
}
|
|
18907
|
-
const responseWithMessages = MessageService.getSuccessContentWithMessagesCTO(json, op);
|
|
18908
|
-
return resolve4(responseWithMessages);
|
|
18909
|
-
}
|
|
18910
|
-
}).catch((error) => {
|
|
18911
|
-
const msg = "Api call failed with unknown/network error during promise processing " + error;
|
|
18912
|
-
REST_CLIENT_LOGGER.error(msg);
|
|
18913
|
-
const responseWithMessages = {
|
|
18914
|
-
content: void 0,
|
|
18915
|
-
messages: [MessageService.createCriticalErrorFrontendProcessingMessageTO(op, msg)]
|
|
18916
|
-
};
|
|
18917
|
-
return reject(responseWithMessages);
|
|
18918
|
-
});
|
|
18919
|
-
});
|
|
18920
|
-
}
|
|
18921
|
-
};
|
|
18922
|
-
var RunFunctionResult = class {
|
|
18923
|
-
constructor(success, messages, result, resultHistory) {
|
|
18924
|
-
this.success = success;
|
|
18925
|
-
this.messages = messages;
|
|
18926
|
-
this.result = result;
|
|
18927
|
-
this.resultHistory = resultHistory;
|
|
18928
|
-
}
|
|
18929
|
-
};
|
|
18930
|
-
var fatalRunErrorFunction = (reason) => {
|
|
18931
|
-
throw new Error(`Fatal error - could not handle run failure - reason: ${reason}`);
|
|
18932
|
-
};
|
|
18933
|
-
function useControllerDisplayState(initialDisplayMode, messages, logger) {
|
|
18934
|
-
const [state, setState2] = useState2(
|
|
18935
|
-
0
|
|
18936
|
-
/* UNMOUNTED */
|
|
18937
|
-
);
|
|
18938
|
-
const [loadingIndication, setLoadingIndication] = useState2({});
|
|
18939
|
-
const [modified, setModified] = useState2(false);
|
|
18940
|
-
const [displayMode, setDisplayMode] = useState2(initialDisplayMode);
|
|
18941
|
-
const [modalState, setModalState] = useState2({
|
|
18942
|
-
show: (modalId, confirmFunction) => showModal(modalId, true, confirmFunction),
|
|
18943
|
-
hide: (modalId) => showModal(modalId, false)
|
|
18944
|
-
});
|
|
18945
|
-
const { addMessages } = messages;
|
|
18946
|
-
const isLoading = useCallback((service) => {
|
|
18947
|
-
return loadingIndication.hasOwnProperty(service.name) && loadingIndication[service.name] === true;
|
|
18948
|
-
}, [loadingIndication]);
|
|
18949
|
-
const load = useCallback((service) => {
|
|
18950
|
-
setLoadingIndication((oldIndication) => ({ ...oldIndication, [service.name]: true }));
|
|
18951
|
-
}, []);
|
|
18952
|
-
const doneLoading = useCallback((service) => {
|
|
18953
|
-
setLoadingIndication((oldIndication) => {
|
|
18954
|
-
return { ...oldIndication, [service.name]: false };
|
|
18955
|
-
});
|
|
18956
|
-
}, []);
|
|
18957
|
-
const enterDisplayMode = useCallback((mode) => {
|
|
18958
|
-
setDisplayMode((previousMode) => {
|
|
18959
|
-
if (mode !== displayMode) {
|
|
18960
|
-
logger.info("Entering display mode: ", mode);
|
|
18961
|
-
return mode;
|
|
18962
|
-
}
|
|
18963
|
-
return previousMode;
|
|
18964
|
-
});
|
|
18965
|
-
}, [displayMode, logger]);
|
|
18966
|
-
const showModal = useCallback((modalId, show, confirmFunction) => {
|
|
18967
|
-
if (show) {
|
|
18968
|
-
setModalState((originalModalState) => {
|
|
18969
|
-
if (originalModalState.modalId !== void 0) {
|
|
18970
|
-
throw Error("Cannot show multiple modals at the same time");
|
|
18971
|
-
}
|
|
18972
|
-
return { ...originalModalState, modalId, confirmFunction };
|
|
18973
|
-
});
|
|
18974
|
-
} else {
|
|
18975
|
-
setModalState((originalModalState) => {
|
|
18976
|
-
if (originalModalState.modalId === void 0 || originalModalState.modalId !== modalId) {
|
|
18977
|
-
throw Error("Cannot hide modal that isn't currently shown");
|
|
18978
|
-
}
|
|
18979
|
-
return { ...originalModalState, modalId: void 0, confirmFunction: void 0 };
|
|
18980
|
-
});
|
|
18981
|
-
}
|
|
18982
|
-
}, []);
|
|
18983
|
-
const run = useCallback(function(service, execute, failureIsFatal, resultHistory) {
|
|
18984
|
-
load(service);
|
|
18985
|
-
return execute().then((result) => {
|
|
18986
|
-
addMessages(result);
|
|
18987
|
-
return Promise.resolve(new RunFunctionResult(
|
|
18988
|
-
true,
|
|
18989
|
-
result.messages,
|
|
18990
|
-
result.content,
|
|
18991
|
-
resultHistory
|
|
18992
|
-
));
|
|
18993
|
-
}).catch((error) => {
|
|
18994
|
-
if (failureIsFatal) {
|
|
18995
|
-
setState2(
|
|
18996
|
-
3
|
|
18997
|
-
/* FATAL_ERROR */
|
|
18998
|
-
);
|
|
18999
|
-
}
|
|
19000
|
-
addMessages(error);
|
|
19001
|
-
return Promise.resolve(new RunFunctionResult(false, error.messages, void 0, resultHistory));
|
|
19002
|
-
}).finally(() => doneLoading(service));
|
|
19003
|
-
}, [addMessages, doneLoading, load]);
|
|
19004
|
-
return {
|
|
19005
|
-
state,
|
|
19006
|
-
setState: setState2,
|
|
19007
|
-
setDirty: useCallback(setModified, [setModified]),
|
|
19008
|
-
isDirty: () => modified,
|
|
19009
|
-
isLoading,
|
|
19010
|
-
displayMode,
|
|
19011
|
-
enterDisplayMode,
|
|
19012
|
-
modalState,
|
|
19013
|
-
run
|
|
19014
|
-
};
|
|
19015
|
-
}
|
|
19016
|
-
var indexRangeArray = (length) => {
|
|
19017
|
-
return Array.from({ length }, (x, i) => i);
|
|
19018
|
-
};
|
|
19019
|
-
function filterArrayByIndices(items, indices) {
|
|
19020
|
-
return items.filter((value, index2) => indices.includes(index2));
|
|
19021
|
-
}
|
|
19022
|
-
function sortArrayByIndices(items, indices) {
|
|
19023
|
-
return items.filter((value, index2) => indices.includes(index2)).sort((left, right) => indices.indexOf(items.indexOf(left)) - indices.indexOf(items.indexOf(right)));
|
|
19024
|
-
}
|
|
19025
|
-
var sleep = (delaySeconds) => new Promise((resolve4) => setTimeout(resolve4, delaySeconds));
|
|
19026
|
-
function isContentWithMessages(object2) {
|
|
19027
|
-
return object2.hasOwnProperty("messages");
|
|
19028
|
-
}
|
|
19029
|
-
var ArrayStateHandler = class {
|
|
19030
|
-
static updateFieldsOfArrayElement(elementToUpdate, currentArrayContent, properties, onChangedArrayElement) {
|
|
19031
|
-
const newArrayValue = [...currentArrayContent];
|
|
19032
|
-
const affectedElementIndex = newArrayValue.indexOf(elementToUpdate);
|
|
19033
|
-
newArrayValue[affectedElementIndex] = { ...elementToUpdate, ...properties };
|
|
19034
|
-
if (onChangedArrayElement) {
|
|
19035
|
-
onChangedArrayElement([newArrayValue[affectedElementIndex]], newArrayValue);
|
|
19036
|
-
}
|
|
19037
|
-
return newArrayValue;
|
|
19038
|
-
}
|
|
19039
|
-
static removeArrayElements(elementsToRemove, currentArrayContent, onRemovedArrayElement) {
|
|
19040
|
-
const newArrayValue = [...currentArrayContent.filter((element) => elementsToRemove.indexOf(element) === -1)];
|
|
19041
|
-
if (onRemovedArrayElement) {
|
|
19042
|
-
onRemovedArrayElement(elementsToRemove, newArrayValue);
|
|
19043
|
-
}
|
|
19044
|
-
return newArrayValue;
|
|
19045
|
-
}
|
|
19046
|
-
static addArrayElements(elementsToAdd, currentArrayContent, onAddedArrayElements) {
|
|
19047
|
-
const newArrayValue = [...currentArrayContent, ...elementsToAdd];
|
|
19048
|
-
if (onAddedArrayElements) {
|
|
19049
|
-
onAddedArrayElements(elementsToAdd, newArrayValue);
|
|
19050
|
-
}
|
|
19051
|
-
return newArrayValue;
|
|
19052
|
-
}
|
|
19053
|
-
};
|
|
19054
|
-
function useTOChangeHandler(logger, toName, setTOState, notifications, setDirty) {
|
|
19055
|
-
const onPropertyChangeMulti = useCallback2((properties, automaticChange) => {
|
|
19056
|
-
logger.debug(`Changing state of the ${toName} Elements ${Object.keys(properties)} for affected element, using change object:`, JSON.stringify(properties));
|
|
19057
|
-
setTOState((previousValue) => {
|
|
19058
|
-
const newValue = { ...previousValue, ...properties };
|
|
19059
|
-
if (notifications && notifications.onChange) {
|
|
19060
|
-
for (const propertyName of Object.keys(properties)) {
|
|
19061
|
-
const changedValue = properties[propertyName];
|
|
19062
|
-
notifications.onChange(newValue, propertyName, changedValue);
|
|
19063
|
-
}
|
|
19064
|
-
}
|
|
19065
|
-
if (previousValue !== void 0 && setDirty !== void 0 && !automaticChange) {
|
|
19066
|
-
setDirty(true);
|
|
19067
|
-
}
|
|
19068
|
-
return newValue;
|
|
19069
|
-
});
|
|
19070
|
-
}, [logger, notifications, setDirty, setTOState, toName]);
|
|
19071
|
-
const onPropertyChange = useCallback2((propertyName, changedValue, automaticChange) => {
|
|
19072
|
-
onPropertyChangeMulti({ [propertyName]: changedValue }, automaticChange);
|
|
19073
|
-
}, [onPropertyChangeMulti]);
|
|
19074
|
-
return { onPropertyChange, onPropertyChangeMulti };
|
|
19075
|
-
}
|
|
19076
|
-
var singleChangeHandlerToMulti = (onPropertyChangeMulti) => {
|
|
19077
|
-
return (propertyName, changedValue) => onPropertyChangeMulti({ [propertyName]: changedValue });
|
|
19078
|
-
};
|
|
19079
|
-
function useTOArrayChangeHandler(logger, toName, setArrayState, handlers, setDirty) {
|
|
19080
|
-
const onChangeElement = useCallback2((element, properties) => {
|
|
19081
|
-
if (element !== void 0) {
|
|
19082
|
-
logger.debug(`Changing state of the ${toName} Elements ${Object.keys(properties)} for affected element, using change object:`, JSON.stringify(properties));
|
|
19083
|
-
setArrayState((previousValue) => ArrayStateHandler.updateFieldsOfArrayElement(
|
|
19084
|
-
element,
|
|
19085
|
-
previousValue,
|
|
19086
|
-
properties,
|
|
19087
|
-
handlers.onChange
|
|
19088
|
-
));
|
|
19089
|
-
if (setDirty !== void 0) {
|
|
19090
|
-
setDirty(true);
|
|
19091
|
-
}
|
|
19092
|
-
}
|
|
19093
|
-
}, [logger, toName, setArrayState, setDirty, handlers.onChange]);
|
|
19094
|
-
const onRemoveElements = useCallback2((removedElements) => {
|
|
19095
|
-
if (removedElements.length > 0) {
|
|
19096
|
-
logger.debug(`Removing ${removedElements.length} elements from array`);
|
|
19097
|
-
setArrayState((previousValue) => ArrayStateHandler.removeArrayElements(
|
|
19098
|
-
removedElements,
|
|
19099
|
-
previousValue,
|
|
19100
|
-
handlers.onRemove
|
|
19101
|
-
));
|
|
19102
|
-
if (setDirty !== void 0) {
|
|
19103
|
-
setDirty(true);
|
|
19104
|
-
}
|
|
19105
|
-
}
|
|
19106
|
-
}, [logger, setArrayState, setDirty, handlers.onRemove]);
|
|
19107
|
-
const onAddElements = useCallback2((newElements) => {
|
|
19108
|
-
if (newElements.length === 0) {
|
|
19109
|
-
logger.debug(`Adding no new elements to array`);
|
|
19110
|
-
} else {
|
|
19111
|
-
logger.debug(`Adding ${newElements.length} elements to array`);
|
|
19112
|
-
setArrayState((previousValue) => ArrayStateHandler.addArrayElements(
|
|
19113
|
-
newElements,
|
|
19114
|
-
previousValue,
|
|
19115
|
-
handlers.onAdd
|
|
19116
|
-
));
|
|
19117
|
-
if (setDirty !== void 0) {
|
|
19118
|
-
setDirty(true);
|
|
19119
|
-
}
|
|
19120
|
-
}
|
|
19121
|
-
}, [logger, setArrayState, setDirty, handlers.onAdd]);
|
|
19122
|
-
return { onChangeElement, onRemoveElements, onAddElements };
|
|
19123
|
-
}
|
|
19124
|
-
function useAWSUIRef() {
|
|
19125
|
-
const customRef = useRef(null);
|
|
19126
|
-
const isValidRef = () => {
|
|
19127
|
-
return customRef !== void 0 && customRef !== null && customRef.current !== void 0 && customRef.current !== null;
|
|
19128
|
-
};
|
|
19129
|
-
const focus = useCallback3(() => {
|
|
19130
|
-
if (isValidRef() && customRef.current.focus) {
|
|
19131
|
-
customRef.current.focus();
|
|
19132
|
-
}
|
|
19133
|
-
}, [customRef]);
|
|
19134
|
-
const scrollToView = useCallback3(() => {
|
|
19135
|
-
if (isValidRef() && customRef.current.scrollIntoView) {
|
|
19136
|
-
customRef.current.scrollIntoView(true);
|
|
19137
|
-
}
|
|
19138
|
-
}, [customRef]);
|
|
19139
|
-
const scrollToViewRef = useCallback3((element) => {
|
|
19140
|
-
if (element !== void 0 && element !== null && element.scrollIntoView) {
|
|
19141
|
-
element.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
19142
|
-
}
|
|
19143
|
-
}, []);
|
|
19144
|
-
return {
|
|
19145
|
-
customRef,
|
|
19146
|
-
focus,
|
|
19147
|
-
scrollToView,
|
|
19148
|
-
scrollToViewRef
|
|
19149
|
-
};
|
|
19150
|
-
}
|
|
19151
|
-
var useHotkey = (key, shift, ctrl, alt, callback, node = null) => {
|
|
19152
|
-
const callbackRef = useRef2(callback);
|
|
19153
|
-
useLayoutEffect(() => {
|
|
19154
|
-
callbackRef.current = callback;
|
|
19155
|
-
});
|
|
19156
|
-
const handleKeyPress = useCallback4(
|
|
19157
|
-
(event) => {
|
|
19158
|
-
if (event.key === key && (!shift || event.shiftKey) && (!ctrl || event.ctrlKey) && (!alt || event.altKey)) {
|
|
19159
|
-
callbackRef.current(event);
|
|
19160
|
-
}
|
|
19161
|
-
},
|
|
19162
|
-
[alt, ctrl, key, shift]
|
|
19163
|
-
);
|
|
19164
|
-
useEffect2(() => {
|
|
19165
|
-
const targetNode = node != null ? node : document;
|
|
19166
|
-
targetNode && targetNode.addEventListener("keydown", handleKeyPress);
|
|
19167
|
-
return () => targetNode && targetNode.removeEventListener("keydown", handleKeyPress);
|
|
19168
|
-
}, [handleKeyPress, node]);
|
|
19169
|
-
};
|
|
19170
|
-
function useMessages(LOGGER32) {
|
|
19171
|
-
const [messages, setMessages] = useState3([]);
|
|
19172
|
-
const onDismissMessage = useCallback5((message) => {
|
|
19173
|
-
const newMessages = messages.filter((existingMsg) => message !== existingMsg);
|
|
19174
|
-
setMessages(newMessages);
|
|
19175
|
-
}, [messages]);
|
|
19176
|
-
const onToggleMessageDetail = useCallback5((message) => {
|
|
19177
|
-
const idx = messages.indexOf(message);
|
|
19178
|
-
const newMessages = [...messages];
|
|
19179
|
-
newMessages[idx].showDetails = !newMessages[idx].showDetails;
|
|
19180
|
-
setMessages(newMessages);
|
|
19181
|
-
}, [messages]);
|
|
19182
|
-
const addMessages = useCallback5((newMessages) => {
|
|
19183
|
-
if (!newMessages.hasOwnProperty("messages")) {
|
|
19184
|
-
LOGGER32.error("Given response data structure does not contain messages - probably another runtime error occurred: ", newMessages);
|
|
19185
|
-
if (newMessages.hasOwnProperty("stack")) {
|
|
19186
|
-
LOGGER32.error("Stack trace: ", newMessages.stack);
|
|
19187
|
-
}
|
|
19188
|
-
} else {
|
|
19189
|
-
const addedMessages = newMessages.messages.map((msg) => {
|
|
19190
|
-
return { ...msg, showDetails: false };
|
|
19191
|
-
});
|
|
19192
|
-
addedMessages.forEach((msg) => LOGGER32.info(`New message = <${msg.detailMessage}`));
|
|
19193
|
-
setMessages((oldMessages) => [...oldMessages, ...addedMessages]);
|
|
19194
|
-
}
|
|
19195
|
-
}, [LOGGER32]);
|
|
19196
|
-
const clearMessages = useCallback5(() => {
|
|
19197
|
-
setMessages([]);
|
|
19198
|
-
}, []);
|
|
19199
|
-
return {
|
|
19200
|
-
messages,
|
|
19201
|
-
addMessages,
|
|
19202
|
-
onDismissMessage,
|
|
19203
|
-
onToggleMessageDetail,
|
|
19204
|
-
clearMessages
|
|
19205
|
-
};
|
|
19206
|
-
}
|
|
19207
|
-
|
|
19208
17257
|
// src/components/AbstractComponentTesting.ts
|
|
17258
|
+
import { FORM_FIELD_ID_SUFFIX } from "@ebertjendustries/cswrapper";
|
|
19209
17259
|
var AbstractComponentTesting = class _AbstractComponentTesting {
|
|
19210
17260
|
constructor(elementSpec, view, findFunction) {
|
|
19211
17261
|
this.elementSpec = elementSpec;
|
|
@@ -19326,6 +17376,8 @@ var AbstractComponentTesting = class _AbstractComponentTesting {
|
|
|
19326
17376
|
|
|
19327
17377
|
// src/components/AbstractInputTesting.ts
|
|
19328
17378
|
import { waitFor as waitFor2 } from "@testing-library/react";
|
|
17379
|
+
import { ElementValidityLevel } from "@ebertjendustries/cswrapper";
|
|
17380
|
+
import { FieldSpec } from "@ebertjendustries/cswrapper";
|
|
19329
17381
|
var AbstractInputTesting = class extends AbstractComponentTesting {
|
|
19330
17382
|
clear() {
|
|
19331
17383
|
this.setStringValue("");
|
|
@@ -19493,6 +17545,9 @@ var AbstractSelectTesting = class extends AbstractComponentTesting {
|
|
|
19493
17545
|
}
|
|
19494
17546
|
};
|
|
19495
17547
|
|
|
17548
|
+
// src/views/AbstractViewTesting.tsx
|
|
17549
|
+
import { ViewSpec } from "@ebertjendustries/cswrapper";
|
|
17550
|
+
|
|
19496
17551
|
// src/components/MultiselectTesting.ts
|
|
19497
17552
|
import wrapper2 from "@cloudscape-design/components/test-utils/dom";
|
|
19498
17553
|
var MultiselectTesting = class extends AbstractSelectTesting {
|
|
@@ -19520,6 +17575,7 @@ var SelectTesting = class extends AbstractSelectTesting {
|
|
|
19520
17575
|
// src/components/InputTesting.ts
|
|
19521
17576
|
import wrapper4 from "@cloudscape-design/components/test-utils/dom";
|
|
19522
17577
|
import { act as act3 } from "react";
|
|
17578
|
+
import { ElementValidityLevel as ElementValidityLevel2 } from "@ebertjendustries/cswrapper";
|
|
19523
17579
|
var StringInputTesting = class extends AbstractInputTesting {
|
|
19524
17580
|
constructor(fieldSpec, view) {
|
|
19525
17581
|
super(fieldSpec, view, (selector) => wrapper4().findInput(selector));
|
|
@@ -19556,7 +17612,7 @@ var NumberInputTesting = class extends AbstractInputTesting {
|
|
|
19556
17612
|
this.setStringValue(inputValue.toString());
|
|
19557
17613
|
const localiser = this.view.getLocaliser();
|
|
19558
17614
|
const fieldValidityFunction = localiser.getFieldValidityLocalisationFunction();
|
|
19559
|
-
await this.expectErrorMessage(fieldValidityFunction(this.elementSpec,
|
|
17615
|
+
await this.expectErrorMessage(fieldValidityFunction(this.elementSpec, ElementValidityLevel2.LOWER_BOUND_ONLY_TOO_SMALL));
|
|
19560
17616
|
}
|
|
19561
17617
|
expectValue(value) {
|
|
19562
17618
|
globalExpect(this.getNativeHTMLInput()).toHaveValue(value === void 0 ? null : value);
|
|
@@ -19808,6 +17864,7 @@ var ModalTesting = class extends AbstractComponentTesting {
|
|
|
19808
17864
|
import { ElementWrapper as ElementWrapper4 } from "@cloudscape-design/test-utils-core/dom";
|
|
19809
17865
|
import { screen as screen2 } from "@testing-library/react";
|
|
19810
17866
|
import { act as act8 } from "react";
|
|
17867
|
+
import { getEnumRatingLabel, getEnumRatingValues } from "@ebertjendustries/cswrapper";
|
|
19811
17868
|
var RatingTesting = class extends AbstractComponentTesting {
|
|
19812
17869
|
constructor(viewSpec, view, factory, toOrderNumber) {
|
|
19813
17870
|
super(viewSpec, view, () => {
|
|
@@ -20501,6 +18558,7 @@ var AbstractViewTesting = class {
|
|
|
20501
18558
|
};
|
|
20502
18559
|
|
|
20503
18560
|
// src/views/CSVNoItemsViewTesting.tsx
|
|
18561
|
+
import { CSV_NO_ITEMS_VIEW_SPEC } from "@ebertjendustries/cswrapper";
|
|
20504
18562
|
var CSVNoItemsViewTesting = class extends AbstractViewTesting {
|
|
20505
18563
|
constructor(namespace, viewSpec, entityTypeFactory, testLocalisation) {
|
|
20506
18564
|
super(namespace, viewSpec, testLocalisation);
|
|
@@ -20529,6 +18587,8 @@ var CSVNoItemsViewTesting = class extends AbstractViewTesting {
|
|
|
20529
18587
|
};
|
|
20530
18588
|
|
|
20531
18589
|
// src/views/CSVPriceInputViewTesting.tsx
|
|
18590
|
+
import { CSV_PRICE_INPUT_VIEW_SPEC } from "@ebertjendustries/cswrapper";
|
|
18591
|
+
import { PriceUtils } from "@ebertjendustries/cswrapper";
|
|
20532
18592
|
var CSVPriceInputViewTesting = class extends AbstractViewTesting {
|
|
20533
18593
|
constructor(namespace, viewSpec, testLocalisation, currencyFactory, expandToViewport) {
|
|
20534
18594
|
super(namespace, viewSpec, testLocalisation);
|
|
@@ -20564,6 +18624,7 @@ var CSVPriceInputViewTesting = class extends AbstractViewTesting {
|
|
|
20564
18624
|
};
|
|
20565
18625
|
|
|
20566
18626
|
// src/views/CSVSearchFilterViewTesting.tsx
|
|
18627
|
+
import { CSV_SEARCH_FILTER_VIEW_SPEC } from "@ebertjendustries/cswrapper";
|
|
20567
18628
|
var CSVSearchFilterViewTesting = class extends AbstractViewTesting {
|
|
20568
18629
|
constructor(namespace, viewSpec, testLocalisation) {
|
|
20569
18630
|
super(namespace, viewSpec, testLocalisation);
|
|
@@ -20602,6 +18663,9 @@ var CSVSearchFilterViewTesting = class extends AbstractViewTesting {
|
|
|
20602
18663
|
};
|
|
20603
18664
|
|
|
20604
18665
|
// src/views/CSVTextPromptModalViewTesting.tsx
|
|
18666
|
+
import {
|
|
18667
|
+
CSV_TEXT_PROMPT_MODAL_VIEW_SPEC
|
|
18668
|
+
} from "@ebertjendustries/cswrapper";
|
|
20605
18669
|
var CSVTextPromptModalViewTesting = class extends AbstractViewTesting {
|
|
20606
18670
|
constructor(namespace, viewSpec, testLocalisation) {
|
|
20607
18671
|
super(namespace, viewSpec, testLocalisation);
|
|
@@ -20679,7 +18743,11 @@ var MockBrowserAPIs = class {
|
|
|
20679
18743
|
|
|
20680
18744
|
// src/mocks/MockRestClient.ts
|
|
20681
18745
|
import { assert as assert4 } from "console";
|
|
20682
|
-
|
|
18746
|
+
import { Log } from "@ebertjendustries/cswrapper";
|
|
18747
|
+
import { sleep } from "@ebertjendustries/cswrapper";
|
|
18748
|
+
import * as RealRestClient from "@ebertjendustries/cswrapper";
|
|
18749
|
+
import { isContentWithMessages } from "@ebertjendustries/cswrapper";
|
|
18750
|
+
var LOGGER = new Log("RestClientMock");
|
|
20683
18751
|
var MockResponseStore = class {
|
|
20684
18752
|
constructor(parentUUID) {
|
|
20685
18753
|
this.parentUUID = parentUUID;
|
|
@@ -20724,8 +18792,8 @@ var MockResponseStore = class {
|
|
|
20724
18792
|
};
|
|
20725
18793
|
function setupRestClientMock(controllerSpec) {
|
|
20726
18794
|
const mockRestClient = new MockRestClient(controllerSpec.key);
|
|
20727
|
-
const mock = vi.spyOn(
|
|
20728
|
-
|
|
18795
|
+
const mock = vi.spyOn(RealRestClient, "createRestClient");
|
|
18796
|
+
LOGGER.info(`Setting up mock rest client with key ${controllerSpec.key}.`);
|
|
20729
18797
|
mock.mockImplementation(() => {
|
|
20730
18798
|
return mockRestClient;
|
|
20731
18799
|
});
|
|
@@ -20738,7 +18806,7 @@ var MockRestClient = class {
|
|
|
20738
18806
|
this.post = vi.fn();
|
|
20739
18807
|
this.del = vi.fn();
|
|
20740
18808
|
this.uuid = "<" + crypto.randomUUID().split("-")[4] + ">";
|
|
20741
|
-
|
|
18809
|
+
LOGGER.info(`Instantiating mock rest client with name ${name} and UUID ${this.uuid}.`);
|
|
20742
18810
|
this.getResponseValues = new MockResponseStore(this.uuid);
|
|
20743
18811
|
this.putResponseValues = new MockResponseStore(this.uuid);
|
|
20744
18812
|
this.postResponseValues = new MockResponseStore(this.uuid);
|
|
@@ -20755,19 +18823,19 @@ var MockRestClient = class {
|
|
|
20755
18823
|
this.deleteResponseValues.expectAllCalled(hard);
|
|
20756
18824
|
}
|
|
20757
18825
|
addGetResponse(url, response, delayInMilliseconds) {
|
|
20758
|
-
|
|
18826
|
+
LOGGER.info(`${this.uuid} Configuring GET ${url} ${this.getDelayForLogging(delayInMilliseconds)}.`);
|
|
20759
18827
|
this.getResponseValues.addResponse(url, response, delayInMilliseconds);
|
|
20760
18828
|
}
|
|
20761
18829
|
addPutResponse(url, response, delayInMilliseconds) {
|
|
20762
|
-
|
|
18830
|
+
LOGGER.info(`${this.uuid} Configuring PUT ${url} ${this.getDelayForLogging(delayInMilliseconds)}.`);
|
|
20763
18831
|
this.putResponseValues.addResponse(url, response, delayInMilliseconds);
|
|
20764
18832
|
}
|
|
20765
18833
|
addPostResponse(url, response, delayInMilliseconds) {
|
|
20766
|
-
|
|
18834
|
+
LOGGER.info(`${this.uuid} Configuring POST ${url} ${this.getDelayForLogging(delayInMilliseconds)}.`);
|
|
20767
18835
|
this.postResponseValues.addResponse(url, response, delayInMilliseconds);
|
|
20768
18836
|
}
|
|
20769
18837
|
addDeleteResponse(url, response, delayInMilliseconds) {
|
|
20770
|
-
|
|
18838
|
+
LOGGER.info(`${this.uuid} Configuring DELETE ${url} ${this.getDelayForLogging(delayInMilliseconds)}.`);
|
|
20771
18839
|
this.deleteResponseValues.addResponse(url, response, delayInMilliseconds);
|
|
20772
18840
|
}
|
|
20773
18841
|
getDelayForLogging(delayInMilliseconds) {
|
|
@@ -20802,10 +18870,10 @@ var MockRestClient = class {
|
|
|
20802
18870
|
);
|
|
20803
18871
|
}
|
|
20804
18872
|
mockImpl(returnValue, endpoint, payload, operation, header) {
|
|
20805
|
-
|
|
20806
|
-
|
|
18873
|
+
LOGGER.debug(`${this.uuid} -----------> Mock REST API call <---------------`);
|
|
18874
|
+
LOGGER.debug(`${this.uuid} Calling REST API endpoint ${endpoint} with operation ${operation} and header <${header}>`);
|
|
20807
18875
|
const returnPromise = Promise.resolve({ content: returnValue, messages: [] });
|
|
20808
|
-
|
|
18876
|
+
LOGGER.debug(`${this.uuid} DONE calling REST API endpoint ${endpoint} with operation ${operation} and header ${header}`);
|
|
20809
18877
|
return returnPromise;
|
|
20810
18878
|
}
|
|
20811
18879
|
};
|
|
@@ -20945,11 +19013,11 @@ var MockServerBuilder = class _MockServerBuilder {
|
|
|
20945
19013
|
};
|
|
20946
19014
|
|
|
20947
19015
|
// src/utils/ViewTestWrapper.tsx
|
|
20948
|
-
import { useState
|
|
20949
|
-
import { jsx
|
|
19016
|
+
import { useState } from "react";
|
|
19017
|
+
import { jsx } from "react/jsx-runtime";
|
|
20950
19018
|
function ViewTestWrapper(props) {
|
|
20951
|
-
const [value, setValue] =
|
|
20952
|
-
return /* @__PURE__ */
|
|
19019
|
+
const [value, setValue] = useState(props.initialValue);
|
|
19020
|
+
return /* @__PURE__ */ jsx("div", { children: props.view(value, (propertyName, changedValue) => setValue(changedValue)) });
|
|
20953
19021
|
}
|
|
20954
19022
|
export {
|
|
20955
19023
|
AbstractComponentTesting,
|