@qualtrics/plugin-ui-react 1.4.0-alpha.7 → 1.4.0-alpha.8
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/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @license @qualtrics/plugin-ui-react 1.4.0-alpha.
|
|
1
|
+
/*! @license @qualtrics/plugin-ui-react 1.4.0-alpha.8
|
|
2
2
|
Qualtrics Software License Agreement
|
|
3
3
|
|
|
4
4
|
1. General.
|
|
@@ -45,3551 +45,6 @@ Qualtrics Software License Agreement
|
|
|
45
45
|
|
|
46
46
|
Last updated August 28, 2019
|
|
47
47
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
52
|
-
|
|
53
|
-
require('core-js/modules/es.object.to-string.js');
|
|
54
|
-
require('core-js/modules/es.promise.js');
|
|
55
|
-
require('core-js/modules/es.object.keys.js');
|
|
56
|
-
require('core-js/modules/es.array.includes.js');
|
|
57
|
-
require('core-js/modules/es.string.includes.js');
|
|
58
|
-
require('core-js/modules/es.array.find-index.js');
|
|
59
|
-
require('core-js/modules/es.array.splice.js');
|
|
60
|
-
require('core-js/modules/es.array.for-each.js');
|
|
61
|
-
require('core-js/modules/web.dom-collections.for-each.js');
|
|
62
|
-
var React = require('react');
|
|
63
|
-
var _get = require('lodash.get');
|
|
64
|
-
var uiReact = require('@qualtrics/ui-react');
|
|
65
|
-
var icons = require('@qualtrics/ui-react/icons');
|
|
66
|
-
require('core-js/modules/es.string.anchor.js');
|
|
67
|
-
var _cloneDeep = require('lodash.clonedeep');
|
|
68
|
-
require('core-js/modules/es.array.concat.js');
|
|
69
|
-
require('core-js/modules/es.array.is-array.js');
|
|
70
|
-
var reactPopper = require('react-popper');
|
|
71
|
-
var ReactDOM = require('react-dom');
|
|
72
|
-
var uuid = require('uuid');
|
|
73
|
-
require('core-js/modules/es.array.map.js');
|
|
74
|
-
require('core-js/modules/es.function.name.js');
|
|
75
|
-
require('core-js/modules/es.array.slice.js');
|
|
76
|
-
require('core-js/modules/es.array.iterator.js');
|
|
77
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
78
|
-
require('core-js/modules/es.array.find.js');
|
|
79
|
-
require('core-js/modules/es.object.assign.js');
|
|
80
|
-
require('core-js/modules/es.array.filter.js');
|
|
81
|
-
var _cloneDeepWith = require('lodash.clonedeepwith');
|
|
82
|
-
require('core-js/modules/es.string.trim.js');
|
|
83
|
-
require('core-js/modules/es.regexp.exec.js');
|
|
84
|
-
require('core-js/modules/es.string.search.js');
|
|
85
|
-
|
|
86
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
87
|
-
|
|
88
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
89
|
-
var _get__default = /*#__PURE__*/_interopDefaultLegacy(_get);
|
|
90
|
-
var _cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(_cloneDeep);
|
|
91
|
-
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
92
|
-
var uuid__default = /*#__PURE__*/_interopDefaultLegacy(uuid);
|
|
93
|
-
var _cloneDeepWith__default = /*#__PURE__*/_interopDefaultLegacy(_cloneDeepWith);
|
|
94
|
-
|
|
95
|
-
function styleInject(css, ref) {
|
|
96
|
-
if ( ref === void 0 ) ref = {};
|
|
97
|
-
var insertAt = ref.insertAt;
|
|
98
|
-
|
|
99
|
-
if (!css || typeof document === 'undefined') { return; }
|
|
100
|
-
|
|
101
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
102
|
-
var style = document.createElement('style');
|
|
103
|
-
style.type = 'text/css';
|
|
104
|
-
|
|
105
|
-
if (insertAt === 'top') {
|
|
106
|
-
if (head.firstChild) {
|
|
107
|
-
head.insertBefore(style, head.firstChild);
|
|
108
|
-
} else {
|
|
109
|
-
head.appendChild(style);
|
|
110
|
-
}
|
|
111
|
-
} else {
|
|
112
|
-
head.appendChild(style);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (style.styleSheet) {
|
|
116
|
-
style.styleSheet.cssText = css;
|
|
117
|
-
} else {
|
|
118
|
-
style.appendChild(document.createTextNode(css));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
var css_248z$m = ".react-app {\n background-color: RGBA(0, 0, 0, 0.1); }\n";
|
|
123
|
-
styleInject(css_248z$m);
|
|
124
|
-
|
|
125
|
-
function ownKeys(object, enumerableOnly) {
|
|
126
|
-
var keys = Object.keys(object);
|
|
127
|
-
|
|
128
|
-
if (Object.getOwnPropertySymbols) {
|
|
129
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
130
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
131
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
132
|
-
})), keys.push.apply(keys, symbols);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return keys;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function _objectSpread2(target) {
|
|
139
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
140
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
141
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
142
|
-
_defineProperty(target, key, source[key]);
|
|
143
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
144
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return target;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function _regeneratorRuntime() {
|
|
152
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
153
|
-
|
|
154
|
-
_regeneratorRuntime = function () {
|
|
155
|
-
return exports;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
var exports = {},
|
|
159
|
-
Op = Object.prototype,
|
|
160
|
-
hasOwn = Op.hasOwnProperty,
|
|
161
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
162
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
163
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
164
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
165
|
-
|
|
166
|
-
function define(obj, key, value) {
|
|
167
|
-
return Object.defineProperty(obj, key, {
|
|
168
|
-
value: value,
|
|
169
|
-
enumerable: !0,
|
|
170
|
-
configurable: !0,
|
|
171
|
-
writable: !0
|
|
172
|
-
}), obj[key];
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
try {
|
|
176
|
-
define({}, "");
|
|
177
|
-
} catch (err) {
|
|
178
|
-
define = function (obj, key, value) {
|
|
179
|
-
return obj[key] = value;
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
184
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
185
|
-
generator = Object.create(protoGenerator.prototype),
|
|
186
|
-
context = new Context(tryLocsList || []);
|
|
187
|
-
return generator._invoke = function (innerFn, self, context) {
|
|
188
|
-
var state = "suspendedStart";
|
|
189
|
-
return function (method, arg) {
|
|
190
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
191
|
-
|
|
192
|
-
if ("completed" === state) {
|
|
193
|
-
if ("throw" === method) throw arg;
|
|
194
|
-
return doneResult();
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
for (context.method = method, context.arg = arg;;) {
|
|
198
|
-
var delegate = context.delegate;
|
|
199
|
-
|
|
200
|
-
if (delegate) {
|
|
201
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
202
|
-
|
|
203
|
-
if (delegateResult) {
|
|
204
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
205
|
-
return delegateResult;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
210
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
211
|
-
context.dispatchException(context.arg);
|
|
212
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
213
|
-
state = "executing";
|
|
214
|
-
var record = tryCatch(innerFn, self, context);
|
|
215
|
-
|
|
216
|
-
if ("normal" === record.type) {
|
|
217
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
218
|
-
return {
|
|
219
|
-
value: record.arg,
|
|
220
|
-
done: context.done
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
}(innerFn, self, context), generator;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function tryCatch(fn, obj, arg) {
|
|
231
|
-
try {
|
|
232
|
-
return {
|
|
233
|
-
type: "normal",
|
|
234
|
-
arg: fn.call(obj, arg)
|
|
235
|
-
};
|
|
236
|
-
} catch (err) {
|
|
237
|
-
return {
|
|
238
|
-
type: "throw",
|
|
239
|
-
arg: err
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
exports.wrap = wrap;
|
|
245
|
-
var ContinueSentinel = {};
|
|
246
|
-
|
|
247
|
-
function Generator() {}
|
|
248
|
-
|
|
249
|
-
function GeneratorFunction() {}
|
|
250
|
-
|
|
251
|
-
function GeneratorFunctionPrototype() {}
|
|
252
|
-
|
|
253
|
-
var IteratorPrototype = {};
|
|
254
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
255
|
-
return this;
|
|
256
|
-
});
|
|
257
|
-
var getProto = Object.getPrototypeOf,
|
|
258
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
259
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
260
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
261
|
-
|
|
262
|
-
function defineIteratorMethods(prototype) {
|
|
263
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
264
|
-
define(prototype, method, function (arg) {
|
|
265
|
-
return this._invoke(method, arg);
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
271
|
-
function invoke(method, arg, resolve, reject) {
|
|
272
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
273
|
-
|
|
274
|
-
if ("throw" !== record.type) {
|
|
275
|
-
var result = record.arg,
|
|
276
|
-
value = result.value;
|
|
277
|
-
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
278
|
-
invoke("next", value, resolve, reject);
|
|
279
|
-
}, function (err) {
|
|
280
|
-
invoke("throw", err, resolve, reject);
|
|
281
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
282
|
-
result.value = unwrapped, resolve(result);
|
|
283
|
-
}, function (error) {
|
|
284
|
-
return invoke("throw", error, resolve, reject);
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
reject(record.arg);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
var previousPromise;
|
|
292
|
-
|
|
293
|
-
this._invoke = function (method, arg) {
|
|
294
|
-
function callInvokeWithMethodAndArg() {
|
|
295
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
296
|
-
invoke(method, arg, resolve, reject);
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
305
|
-
var method = delegate.iterator[context.method];
|
|
306
|
-
|
|
307
|
-
if (undefined === method) {
|
|
308
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
309
|
-
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
310
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
return ContinueSentinel;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
317
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
318
|
-
var info = record.arg;
|
|
319
|
-
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function pushTryEntry(locs) {
|
|
323
|
-
var entry = {
|
|
324
|
-
tryLoc: locs[0]
|
|
325
|
-
};
|
|
326
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
function resetTryEntry(entry) {
|
|
330
|
-
var record = entry.completion || {};
|
|
331
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function Context(tryLocsList) {
|
|
335
|
-
this.tryEntries = [{
|
|
336
|
-
tryLoc: "root"
|
|
337
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
function values(iterable) {
|
|
341
|
-
if (iterable) {
|
|
342
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
343
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
344
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
345
|
-
|
|
346
|
-
if (!isNaN(iterable.length)) {
|
|
347
|
-
var i = -1,
|
|
348
|
-
next = function next() {
|
|
349
|
-
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
350
|
-
|
|
351
|
-
return next.value = undefined, next.done = !0, next;
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
return next.next = next;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
return {
|
|
359
|
-
next: doneResult
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
function doneResult() {
|
|
364
|
-
return {
|
|
365
|
-
value: undefined,
|
|
366
|
-
done: !0
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
371
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
372
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
373
|
-
}, exports.mark = function (genFun) {
|
|
374
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
375
|
-
}, exports.awrap = function (arg) {
|
|
376
|
-
return {
|
|
377
|
-
__await: arg
|
|
378
|
-
};
|
|
379
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
380
|
-
return this;
|
|
381
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
382
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
383
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
384
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
385
|
-
return result.done ? result.value : iter.next();
|
|
386
|
-
});
|
|
387
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
388
|
-
return this;
|
|
389
|
-
}), define(Gp, "toString", function () {
|
|
390
|
-
return "[object Generator]";
|
|
391
|
-
}), exports.keys = function (object) {
|
|
392
|
-
var keys = [];
|
|
393
|
-
|
|
394
|
-
for (var key in object) keys.push(key);
|
|
395
|
-
|
|
396
|
-
return keys.reverse(), function next() {
|
|
397
|
-
for (; keys.length;) {
|
|
398
|
-
var key = keys.pop();
|
|
399
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
return next.done = !0, next;
|
|
403
|
-
};
|
|
404
|
-
}, exports.values = values, Context.prototype = {
|
|
405
|
-
constructor: Context,
|
|
406
|
-
reset: function (skipTempReset) {
|
|
407
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
408
|
-
},
|
|
409
|
-
stop: function () {
|
|
410
|
-
this.done = !0;
|
|
411
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
412
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
413
|
-
return this.rval;
|
|
414
|
-
},
|
|
415
|
-
dispatchException: function (exception) {
|
|
416
|
-
if (this.done) throw exception;
|
|
417
|
-
var context = this;
|
|
418
|
-
|
|
419
|
-
function handle(loc, caught) {
|
|
420
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
424
|
-
var entry = this.tryEntries[i],
|
|
425
|
-
record = entry.completion;
|
|
426
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
427
|
-
|
|
428
|
-
if (entry.tryLoc <= this.prev) {
|
|
429
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
430
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
431
|
-
|
|
432
|
-
if (hasCatch && hasFinally) {
|
|
433
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
434
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
435
|
-
} else if (hasCatch) {
|
|
436
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
437
|
-
} else {
|
|
438
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
439
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
},
|
|
444
|
-
abrupt: function (type, arg) {
|
|
445
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
446
|
-
var entry = this.tryEntries[i];
|
|
447
|
-
|
|
448
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
449
|
-
var finallyEntry = entry;
|
|
450
|
-
break;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
455
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
456
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
457
|
-
},
|
|
458
|
-
complete: function (record, afterLoc) {
|
|
459
|
-
if ("throw" === record.type) throw record.arg;
|
|
460
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
461
|
-
},
|
|
462
|
-
finish: function (finallyLoc) {
|
|
463
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
464
|
-
var entry = this.tryEntries[i];
|
|
465
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
466
|
-
}
|
|
467
|
-
},
|
|
468
|
-
catch: function (tryLoc) {
|
|
469
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
470
|
-
var entry = this.tryEntries[i];
|
|
471
|
-
|
|
472
|
-
if (entry.tryLoc === tryLoc) {
|
|
473
|
-
var record = entry.completion;
|
|
474
|
-
|
|
475
|
-
if ("throw" === record.type) {
|
|
476
|
-
var thrown = record.arg;
|
|
477
|
-
resetTryEntry(entry);
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
return thrown;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
throw new Error("illegal catch attempt");
|
|
485
|
-
},
|
|
486
|
-
delegateYield: function (iterable, resultName, nextLoc) {
|
|
487
|
-
return this.delegate = {
|
|
488
|
-
iterator: values(iterable),
|
|
489
|
-
resultName: resultName,
|
|
490
|
-
nextLoc: nextLoc
|
|
491
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
492
|
-
}
|
|
493
|
-
}, exports;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
function _typeof(obj) {
|
|
497
|
-
"@babel/helpers - typeof";
|
|
498
|
-
|
|
499
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
500
|
-
return typeof obj;
|
|
501
|
-
} : function (obj) {
|
|
502
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
503
|
-
}, _typeof(obj);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
507
|
-
try {
|
|
508
|
-
var info = gen[key](arg);
|
|
509
|
-
var value = info.value;
|
|
510
|
-
} catch (error) {
|
|
511
|
-
reject(error);
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
if (info.done) {
|
|
516
|
-
resolve(value);
|
|
517
|
-
} else {
|
|
518
|
-
Promise.resolve(value).then(_next, _throw);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
function _asyncToGenerator(fn) {
|
|
523
|
-
return function () {
|
|
524
|
-
var self = this,
|
|
525
|
-
args = arguments;
|
|
526
|
-
return new Promise(function (resolve, reject) {
|
|
527
|
-
var gen = fn.apply(self, args);
|
|
528
|
-
|
|
529
|
-
function _next(value) {
|
|
530
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
function _throw(err) {
|
|
534
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
_next(undefined);
|
|
538
|
-
});
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
function _classCallCheck(instance, Constructor) {
|
|
543
|
-
if (!(instance instanceof Constructor)) {
|
|
544
|
-
throw new TypeError("Cannot call a class as a function");
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
function _defineProperties(target, props) {
|
|
549
|
-
for (var i = 0; i < props.length; i++) {
|
|
550
|
-
var descriptor = props[i];
|
|
551
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
552
|
-
descriptor.configurable = true;
|
|
553
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
554
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
559
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
560
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
561
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
562
|
-
writable: false
|
|
563
|
-
});
|
|
564
|
-
return Constructor;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
function _defineProperty(obj, key, value) {
|
|
568
|
-
if (key in obj) {
|
|
569
|
-
Object.defineProperty(obj, key, {
|
|
570
|
-
value: value,
|
|
571
|
-
enumerable: true,
|
|
572
|
-
configurable: true,
|
|
573
|
-
writable: true
|
|
574
|
-
});
|
|
575
|
-
} else {
|
|
576
|
-
obj[key] = value;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
return obj;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
function _inherits(subClass, superClass) {
|
|
583
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
584
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
588
|
-
constructor: {
|
|
589
|
-
value: subClass,
|
|
590
|
-
writable: true,
|
|
591
|
-
configurable: true
|
|
592
|
-
}
|
|
593
|
-
});
|
|
594
|
-
Object.defineProperty(subClass, "prototype", {
|
|
595
|
-
writable: false
|
|
596
|
-
});
|
|
597
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
function _getPrototypeOf(o) {
|
|
601
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
602
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
603
|
-
};
|
|
604
|
-
return _getPrototypeOf(o);
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
function _setPrototypeOf(o, p) {
|
|
608
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
609
|
-
o.__proto__ = p;
|
|
610
|
-
return o;
|
|
611
|
-
};
|
|
612
|
-
return _setPrototypeOf(o, p);
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
function _isNativeReflectConstruct() {
|
|
616
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
617
|
-
if (Reflect.construct.sham) return false;
|
|
618
|
-
if (typeof Proxy === "function") return true;
|
|
619
|
-
|
|
620
|
-
try {
|
|
621
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
622
|
-
return true;
|
|
623
|
-
} catch (e) {
|
|
624
|
-
return false;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
function _assertThisInitialized(self) {
|
|
629
|
-
if (self === void 0) {
|
|
630
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
return self;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
function _possibleConstructorReturn(self, call) {
|
|
637
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
638
|
-
return call;
|
|
639
|
-
} else if (call !== void 0) {
|
|
640
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
return _assertThisInitialized(self);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
function _createSuper(Derived) {
|
|
647
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
648
|
-
|
|
649
|
-
return function _createSuperInternal() {
|
|
650
|
-
var Super = _getPrototypeOf(Derived),
|
|
651
|
-
result;
|
|
652
|
-
|
|
653
|
-
if (hasNativeReflectConstruct) {
|
|
654
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
655
|
-
|
|
656
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
657
|
-
} else {
|
|
658
|
-
result = Super.apply(this, arguments);
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
return _possibleConstructorReturn(this, result);
|
|
662
|
-
};
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
function _slicedToArray(arr, i) {
|
|
666
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
function _toConsumableArray(arr) {
|
|
670
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
function _arrayWithoutHoles(arr) {
|
|
674
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
function _arrayWithHoles(arr) {
|
|
678
|
-
if (Array.isArray(arr)) return arr;
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
function _iterableToArray(iter) {
|
|
682
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
function _iterableToArrayLimit(arr, i) {
|
|
686
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
687
|
-
|
|
688
|
-
if (_i == null) return;
|
|
689
|
-
var _arr = [];
|
|
690
|
-
var _n = true;
|
|
691
|
-
var _d = false;
|
|
692
|
-
|
|
693
|
-
var _s, _e;
|
|
694
|
-
|
|
695
|
-
try {
|
|
696
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
697
|
-
_arr.push(_s.value);
|
|
698
|
-
|
|
699
|
-
if (i && _arr.length === i) break;
|
|
700
|
-
}
|
|
701
|
-
} catch (err) {
|
|
702
|
-
_d = true;
|
|
703
|
-
_e = err;
|
|
704
|
-
} finally {
|
|
705
|
-
try {
|
|
706
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
707
|
-
} finally {
|
|
708
|
-
if (_d) throw _e;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
return _arr;
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
716
|
-
if (!o) return;
|
|
717
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
718
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
719
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
720
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
721
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
function _arrayLikeToArray(arr, len) {
|
|
725
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
726
|
-
|
|
727
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
728
|
-
|
|
729
|
-
return arr2;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
function _nonIterableSpread() {
|
|
733
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
function _nonIterableRest() {
|
|
737
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
var uniqueIdCounter = 0;
|
|
741
|
-
var EventRegistry = function () {
|
|
742
|
-
function EventRegistry(isSingletonHandler) {
|
|
743
|
-
var _this = this;
|
|
744
|
-
|
|
745
|
-
_classCallCheck(this, EventRegistry);
|
|
746
|
-
|
|
747
|
-
_defineProperty(this, "register", function (callback) {
|
|
748
|
-
var id;
|
|
749
|
-
|
|
750
|
-
if (_this.isSingletonHandler) {
|
|
751
|
-
_this.handler = callback;
|
|
752
|
-
return function () {
|
|
753
|
-
return _this.handler = undefined;
|
|
754
|
-
};
|
|
755
|
-
} else {
|
|
756
|
-
id = uniqueIdCounter++;
|
|
757
|
-
|
|
758
|
-
_this.handlers.push({
|
|
759
|
-
callback: callback,
|
|
760
|
-
id: id
|
|
761
|
-
});
|
|
762
|
-
|
|
763
|
-
return function () {
|
|
764
|
-
_this.unregister(id);
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
|
|
769
|
-
this.isSingletonHandler = !!isSingletonHandler;
|
|
770
|
-
this.handlers = [];
|
|
771
|
-
|
|
772
|
-
this.handler = function () {};
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
_createClass(EventRegistry, [{
|
|
776
|
-
key: "unregister",
|
|
777
|
-
value: function unregister(id) {
|
|
778
|
-
var foundIdx;
|
|
779
|
-
|
|
780
|
-
if (this.isSingletonHandler) {
|
|
781
|
-
return;
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
foundIdx = this.handlers.findIndex(function (handler) {
|
|
785
|
-
return handler.id === id;
|
|
786
|
-
});
|
|
787
|
-
|
|
788
|
-
if (foundIdx !== -1) {
|
|
789
|
-
this.handlers.splice(foundIdx, 1);
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
}, {
|
|
793
|
-
key: "trigger",
|
|
794
|
-
value: function trigger(data) {
|
|
795
|
-
if (this.isSingletonHandler) {
|
|
796
|
-
return this.handler(data);
|
|
797
|
-
} else {
|
|
798
|
-
this.handlers.forEach(function (handler) {
|
|
799
|
-
handler.callback(data);
|
|
800
|
-
});
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}]);
|
|
804
|
-
|
|
805
|
-
return EventRegistry;
|
|
806
|
-
}();
|
|
807
|
-
|
|
808
|
-
var globalObj = (typeof global === "undefined" ? "undefined" : _typeof(global)) !== undefined ? global : (typeof self === "undefined" ? "undefined" : _typeof(self)) !== undefined ? self : (typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined ? window : {};
|
|
809
|
-
var pluginSdkClient;
|
|
810
|
-
var events = {
|
|
811
|
-
'actions_task': {
|
|
812
|
-
save: new EventRegistry(true)
|
|
813
|
-
}
|
|
814
|
-
};
|
|
815
|
-
var pluginTypeHandlers = {
|
|
816
|
-
'actions_task': {
|
|
817
|
-
save: function save(data) {
|
|
818
|
-
return events['actions_task'].save.trigger(data);
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
};
|
|
822
|
-
var PluginSdkService = {
|
|
823
|
-
getPluginSdkClient: getPluginSdkClient
|
|
824
|
-
};
|
|
825
|
-
|
|
826
|
-
function getPluginSdkClient(handlers) {
|
|
827
|
-
var isAlpha = !globalObj.PluginClient;
|
|
828
|
-
|
|
829
|
-
if (pluginSdkClient !== undefined) {
|
|
830
|
-
if (isAlpha) {
|
|
831
|
-
return pluginSdkClient;
|
|
832
|
-
} else {
|
|
833
|
-
return new Promise(function (resolve) {
|
|
834
|
-
return resolve(pluginSdkClient);
|
|
835
|
-
});
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
if (isAlpha) {
|
|
840
|
-
return initializeLegacyPluginClient(globalObj.PluginSDKClient);
|
|
841
|
-
} else if (!isAlpha && globalObj.PluginClient !== undefined) {
|
|
842
|
-
return initializePluginClient(globalObj.PluginClient, handlers);
|
|
843
|
-
} else {
|
|
844
|
-
throw new Error('No PluginClient or PluginSDKClient found on global object');
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
function initializePluginClient(client, handlerConfig) {
|
|
849
|
-
var registerHandler;
|
|
850
|
-
|
|
851
|
-
var _getDefaultHandlersFo = getDefaultHandlersForPluginType(handlerConfig),
|
|
852
|
-
pluginType = _getDefaultHandlersFo.pluginType,
|
|
853
|
-
eventHandlers = _getDefaultHandlersFo.eventHandlers;
|
|
854
|
-
|
|
855
|
-
registerHandler = function registerHandler(eventType, callback) {
|
|
856
|
-
var availableHandlers;
|
|
857
|
-
availableHandlers = Object.keys(eventHandlers);
|
|
858
|
-
|
|
859
|
-
if (availableHandlers.includes(eventType)) {
|
|
860
|
-
return events[pluginType][eventType].register(callback);
|
|
861
|
-
} else {
|
|
862
|
-
return function () {};
|
|
863
|
-
}
|
|
864
|
-
};
|
|
865
|
-
|
|
866
|
-
return client.initialize(eventHandlers).then(function (initializedClient) {
|
|
867
|
-
if (typeof initializedClient.registerHandler !== 'function') {
|
|
868
|
-
initializedClient.registerHandler = registerHandler;
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
pluginSdkClient = initializedClient;
|
|
872
|
-
return pluginSdkClient;
|
|
873
|
-
});
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
function getDefaultHandlersForPluginType(handlerConfig) {
|
|
877
|
-
var pluginType, eventHandlers;
|
|
878
|
-
pluginType = undefined;
|
|
879
|
-
eventHandlers = {};
|
|
880
|
-
|
|
881
|
-
if (_typeof(handlerConfig) === 'object') {
|
|
882
|
-
eventHandlers = handlerConfig;
|
|
883
|
-
} else if (typeof handlerConfig === 'string') {
|
|
884
|
-
pluginType = handlerConfig;
|
|
885
|
-
eventHandlers = pluginTypeHandlers[handlerConfig] || {};
|
|
886
|
-
} else {
|
|
887
|
-
eventHandlers = handlerConfig;
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
return {
|
|
891
|
-
pluginType: pluginType,
|
|
892
|
-
eventHandlers: eventHandlers
|
|
893
|
-
};
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
function initializeLegacyPluginClient(client) {
|
|
897
|
-
console.error('Warning - Initializing outdated version of PluginSDKClient. Please upgrade to PluginClient v1.0.0');
|
|
898
|
-
pluginSdkClient = client.initialize();
|
|
899
|
-
return pluginSdkClient;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
var languageCodeMapping = {
|
|
903
|
-
DA: 'da',
|
|
904
|
-
DE: 'de',
|
|
905
|
-
EN: 'en',
|
|
906
|
-
'EN-GB': 'en-GB',
|
|
907
|
-
ES: 'es',
|
|
908
|
-
'ES-ES': 'es-419',
|
|
909
|
-
FI: 'fi',
|
|
910
|
-
FR: 'fr',
|
|
911
|
-
'FR-CA': 'fr-CA',
|
|
912
|
-
ID: 'id',
|
|
913
|
-
IT: 'it',
|
|
914
|
-
JA: 'ja',
|
|
915
|
-
KO: 'ko',
|
|
916
|
-
MS: 'ms',
|
|
917
|
-
NL: 'nl',
|
|
918
|
-
PB: 'pb',
|
|
919
|
-
PT: 'pt',
|
|
920
|
-
'PT-BR': 'pt-BR',
|
|
921
|
-
'RI-GI': 'ri-GI',
|
|
922
|
-
RU: 'ru',
|
|
923
|
-
SV: 'sv',
|
|
924
|
-
TH: 'th',
|
|
925
|
-
'ZH-S': 'zh-Hans',
|
|
926
|
-
'ZH-T': 'zh-Hant'
|
|
927
|
-
};
|
|
928
|
-
function languageCodeAdapter(languageCode) {
|
|
929
|
-
var adaptedCode;
|
|
930
|
-
adaptedCode = languageCodeMapping[languageCode];
|
|
931
|
-
|
|
932
|
-
if (adaptedCode === undefined) {
|
|
933
|
-
throw new Error("No language code mapping found for supplied code: '".concat(languageCode, "'"));
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
return adaptedCode;
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
/******************************************************************************
|
|
940
|
-
Copyright (c) Microsoft Corporation.
|
|
941
|
-
|
|
942
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
943
|
-
purpose with or without fee is hereby granted.
|
|
944
|
-
|
|
945
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
946
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
947
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
948
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
949
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
950
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
951
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
952
|
-
***************************************************************************** */
|
|
953
|
-
|
|
954
|
-
var __assign = function() {
|
|
955
|
-
__assign = Object.assign || function __assign(t) {
|
|
956
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
957
|
-
s = arguments[i];
|
|
958
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
959
|
-
}
|
|
960
|
-
return t;
|
|
961
|
-
};
|
|
962
|
-
return __assign.apply(this, arguments);
|
|
963
|
-
};
|
|
964
|
-
|
|
965
|
-
function __rest(s, e) {
|
|
966
|
-
var t = {};
|
|
967
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
968
|
-
t[p] = s[p];
|
|
969
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
970
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
971
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
972
|
-
t[p[i]] = s[p[i]];
|
|
973
|
-
}
|
|
974
|
-
return t;
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
978
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
979
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
980
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
981
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
982
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
983
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
function __generator(thisArg, body) {
|
|
988
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
989
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
990
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
991
|
-
function step(op) {
|
|
992
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
993
|
-
while (_) try {
|
|
994
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
995
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
996
|
-
switch (op[0]) {
|
|
997
|
-
case 0: case 1: t = op; break;
|
|
998
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
999
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
1000
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
1001
|
-
default:
|
|
1002
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
1003
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
1004
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
1005
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
1006
|
-
if (t[2]) _.ops.pop();
|
|
1007
|
-
_.trys.pop(); continue;
|
|
1008
|
-
}
|
|
1009
|
-
op = body.call(thisArg, _);
|
|
1010
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
1011
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
function __spreadArray(to, from, pack) {
|
|
1016
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1017
|
-
if (ar || !(i in from)) {
|
|
1018
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
1019
|
-
ar[i] = from[i];
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
var Portal = function (_Component) {
|
|
1026
|
-
_inherits(Portal, _Component);
|
|
1027
|
-
|
|
1028
|
-
var _super = _createSuper(Portal);
|
|
1029
|
-
|
|
1030
|
-
function Portal() {
|
|
1031
|
-
var _this;
|
|
1032
|
-
|
|
1033
|
-
_classCallCheck(this, Portal);
|
|
1034
|
-
|
|
1035
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1036
|
-
args[_key] = arguments[_key];
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
1040
|
-
|
|
1041
|
-
_defineProperty(_assertThisInitialized(_this), "rootSelector", document.body);
|
|
1042
|
-
|
|
1043
|
-
_defineProperty(_assertThisInitialized(_this), "container", document.createElement('div'));
|
|
1044
|
-
|
|
1045
|
-
return _this;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
_createClass(Portal, [{
|
|
1049
|
-
key: "componentDidMount",
|
|
1050
|
-
value: function componentDidMount() {
|
|
1051
|
-
this.rootSelector.appendChild(this.container);
|
|
1052
|
-
}
|
|
1053
|
-
}, {
|
|
1054
|
-
key: "componentWillUnmount",
|
|
1055
|
-
value: function componentWillUnmount() {
|
|
1056
|
-
this.rootSelector.removeChild(this.container);
|
|
1057
|
-
}
|
|
1058
|
-
}, {
|
|
1059
|
-
key: "render",
|
|
1060
|
-
value: function render() {
|
|
1061
|
-
return ReactDOM__default["default"].createPortal(this.props.children, this.container);
|
|
1062
|
-
}
|
|
1063
|
-
}]);
|
|
1064
|
-
|
|
1065
|
-
return Portal;
|
|
1066
|
-
}(React.Component);
|
|
1067
|
-
|
|
1068
|
-
var css_248z$l = ".q-popover {\n position: absolute;\n z-index: 1000;\n padding: 4px 0;\n font-size: 14px;\n line-height: 20px;\n color: #32363A;\n fill: #333;\n list-style: none;\n min-width: 160px;\n max-width: 500px;\n min-height: 10px;\n max-height: 99%;\n background: #fff;\n border-radius: 4px;\n box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 0px 10px 1px rgba(0, 0, 0, 0.14), 0 0px 10px 2px rgba(0, 0, 0, 0.12);\n z-index: 9000; }\n\nbody .q-popover {\n max-height: 50vh;\n overflow-y: scroll;\n max-width: 30vw; }\n";
|
|
1069
|
-
styleInject(css_248z$l);
|
|
1070
|
-
|
|
1071
|
-
var globalClickRegistry = new EventRegistry();
|
|
1072
|
-
var DEFAULT_PLACEMENT = 'bottom-start';
|
|
1073
|
-
var DEFAULT_ANCHOR = React__default["default"].createElement(uiReact.Button, null, " anchor ");
|
|
1074
|
-
var defaultModifiers = [];
|
|
1075
|
-
initGlobalListener();
|
|
1076
|
-
function Popover(props) {
|
|
1077
|
-
var _useState = React.useState(false),
|
|
1078
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1079
|
-
isOpen = _useState2[0],
|
|
1080
|
-
setIsOpen = _useState2[1];
|
|
1081
|
-
|
|
1082
|
-
var modifiers = [].concat(defaultModifiers, _toConsumableArray(props.modifiers || []));
|
|
1083
|
-
|
|
1084
|
-
var closePopover = function closePopover() {
|
|
1085
|
-
setIsOpen(false);
|
|
1086
|
-
props.onClose && props.onClose();
|
|
1087
|
-
};
|
|
1088
|
-
|
|
1089
|
-
var anchorEl = function anchorEl(_ref) {
|
|
1090
|
-
var ref = _ref.ref;
|
|
1091
|
-
var anchor;
|
|
1092
|
-
|
|
1093
|
-
if (typeof props.anchor === 'function') {
|
|
1094
|
-
anchor = props.anchor(ref);
|
|
1095
|
-
} else {
|
|
1096
|
-
anchor = props.anchor;
|
|
1097
|
-
anchor = React__default["default"].createElement("div", {
|
|
1098
|
-
ref: ref,
|
|
1099
|
-
className: "popover-anchor-container"
|
|
1100
|
-
}, props.anchor || DEFAULT_ANCHOR);
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
return anchor;
|
|
1104
|
-
};
|
|
1105
|
-
|
|
1106
|
-
React.useEffect(function () {
|
|
1107
|
-
var unregisterFn, ignoreClickSelector;
|
|
1108
|
-
ignoreClickSelector = props.ignoreClickSelector;
|
|
1109
|
-
unregisterFn = globalClickRegistry.register(function (clickEvent) {
|
|
1110
|
-
var ignoreClickEl;
|
|
1111
|
-
|
|
1112
|
-
if (ignoreClickSelector) {
|
|
1113
|
-
ignoreClickEl = clickEvent.target.closest(ignoreClickSelector);
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
if (!ignoreClickEl) {
|
|
1117
|
-
closePopover();
|
|
1118
|
-
}
|
|
1119
|
-
});
|
|
1120
|
-
return function () {
|
|
1121
|
-
unregisterFn();
|
|
1122
|
-
};
|
|
1123
|
-
}, []);
|
|
1124
|
-
React.useEffect(function () {
|
|
1125
|
-
if (!props.show) {
|
|
1126
|
-
closePopover();
|
|
1127
|
-
} else {
|
|
1128
|
-
setIsOpen(props.show);
|
|
1129
|
-
}
|
|
1130
|
-
}, [props.show]);
|
|
1131
|
-
return React__default["default"].createElement(reactPopper.Manager, null, React__default["default"].createElement(reactPopper.Reference, null, anchorEl), React__default["default"].createElement(Portal, null, isOpen && React__default["default"].createElement(reactPopper.Popper, {
|
|
1132
|
-
placement: props.placement || DEFAULT_PLACEMENT,
|
|
1133
|
-
modifiers: modifiers
|
|
1134
|
-
}, function (_ref2) {
|
|
1135
|
-
var ref = _ref2.ref,
|
|
1136
|
-
style = _ref2.style,
|
|
1137
|
-
placement = _ref2.placement,
|
|
1138
|
-
arrowProps = _ref2.arrowProps,
|
|
1139
|
-
scheduleUpdate = _ref2.update;
|
|
1140
|
-
var children;
|
|
1141
|
-
children = [];
|
|
1142
|
-
|
|
1143
|
-
if (Array.isArray(props.children)) {
|
|
1144
|
-
children = props.children;
|
|
1145
|
-
} else if (props.children !== undefined) {
|
|
1146
|
-
children = [props.children];
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
children.forEach(function (child) {
|
|
1150
|
-
var optionsRef;
|
|
1151
|
-
|
|
1152
|
-
if (child.props.optionsRef) {
|
|
1153
|
-
optionsRef = child.props.optionsRef;
|
|
1154
|
-
optionsRef.current.scheduleUpdate = scheduleUpdate;
|
|
1155
|
-
}
|
|
1156
|
-
});
|
|
1157
|
-
return React__default["default"].createElement("div", {
|
|
1158
|
-
ref: ref,
|
|
1159
|
-
"data-placement": placement,
|
|
1160
|
-
style: _objectSpread2({}, style),
|
|
1161
|
-
className: "q-popover"
|
|
1162
|
-
}, props.children, React__default["default"].createElement("div", {
|
|
1163
|
-
ref: arrowProps.ref,
|
|
1164
|
-
style: arrowProps.style
|
|
1165
|
-
}));
|
|
1166
|
-
})));
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
function initGlobalListener() {
|
|
1170
|
-
window.addEventListener('click', function (evt) {
|
|
1171
|
-
var popoverEl;
|
|
1172
|
-
popoverEl = evt.target.closest('.q-popover');
|
|
1173
|
-
|
|
1174
|
-
if (popoverEl === null) {
|
|
1175
|
-
globalClickRegistry.trigger(evt);
|
|
1176
|
-
} else {
|
|
1177
|
-
evt.stopPropagation();
|
|
1178
|
-
evt.stopImmediatePropagation();
|
|
1179
|
-
}
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
var css_248z$k = ".piped-text-menu-list .piped-text-popover-menu > * {\n min-height: 32px; }\n";
|
|
1184
|
-
styleInject(css_248z$k);
|
|
1185
|
-
|
|
1186
|
-
/**
|
|
1187
|
-
* Copied from: https://gitlab-app.eng.qops.net/cfe/ui/-/blob/master/packages/ui-react/src/hooks/useId/useId.js
|
|
1188
|
-
* Returns an ID that is stable across renders.
|
|
1189
|
-
* @param {string=} defaultExternalId - ID to be used instead of a randomly generated ID. This ID is only considered on mount, so changes to this ID are ignored.
|
|
1190
|
-
* @returns {String} If an external ID is passed in, the external ID. Otherwise, a randomly generated ID.
|
|
1191
|
-
*/
|
|
1192
|
-
function useId(defaultExternalId) {
|
|
1193
|
-
var currentId = React.useState(function () {
|
|
1194
|
-
return defaultExternalId !== null && defaultExternalId !== void 0 ? defaultExternalId : uuid.v4();
|
|
1195
|
-
})[0];
|
|
1196
|
-
return currentId;
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
var css_248z$j = "";
|
|
1200
|
-
styleInject(css_248z$j);
|
|
1201
|
-
|
|
1202
|
-
function PipedTextMenuLoadError(props) {
|
|
1203
|
-
return (React__default["default"].createElement("div", { className: "piped-text-popover-container" },
|
|
1204
|
-
React__default["default"].createElement("div", { className: "piped-text-error-container" },
|
|
1205
|
-
React__default["default"].createElement("div", { className: "piped-text-error-icon" },
|
|
1206
|
-
React__default["default"].createElement(icons.ErrorIcon, { size: "medium" })),
|
|
1207
|
-
props.errorText && (React__default["default"].createElement("div", { className: "piped-text-error-text" }, props.errorText)))));
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
var EMBEDDED_DATA_LOCATOR = 'embeddedData';
|
|
1211
|
-
function checkEmbeddedDataMenuItem(menuItem) {
|
|
1212
|
-
return menuItem.value === EMBEDDED_DATA_LOCATOR;
|
|
1213
|
-
}
|
|
1214
|
-
function checkDecoratedMenuItem(menuItem) {
|
|
1215
|
-
return (menuItem.header === true)
|
|
1216
|
-
|| (menuItem.disabled === true);
|
|
1217
|
-
}
|
|
1218
|
-
function checkSubmenuMenuItemItem(menuItem) {
|
|
1219
|
-
return !!menuItem.hasSubmenu;
|
|
1220
|
-
}
|
|
1221
|
-
function checkMenuItemFocusable(menuItem) {
|
|
1222
|
-
var isEmbeddedData, isSubmenu, isDefaultMenuItem;
|
|
1223
|
-
isEmbeddedData = checkEmbeddedDataMenuItem(menuItem);
|
|
1224
|
-
isSubmenu = checkSubmenuMenuItemItem(menuItem);
|
|
1225
|
-
isDefaultMenuItem = checkDefaultMenuItem(menuItem);
|
|
1226
|
-
return (isEmbeddedData
|
|
1227
|
-
|| isSubmenu
|
|
1228
|
-
|| isDefaultMenuItem);
|
|
1229
|
-
}
|
|
1230
|
-
function checkDefaultMenuItem(menuItem) {
|
|
1231
|
-
return !(checkEmbeddedDataMenuItem(menuItem)
|
|
1232
|
-
|| checkDecoratedMenuItem(menuItem)
|
|
1233
|
-
|| checkSubmenuMenuItemItem(menuItem));
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
var css_248z$i = "div[role=\"menu\"] .piped-text-search-input-container {\n padding: 5px 10px; }\n\n.piped-text-search-input {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .piped-text-search-input input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n\n.piped-text-menu-empty-anchor {\n /* the margin-right hack was not in harmony with tao.\n now, the empty-anchor is truly empty */ }\n\n.piped-text-submenu-item-container {\n position: relative; }\n .piped-text-submenu-item-container .piped-text-menu .piped-text-submenu-anchor {\n position: absolute;\n z-index: -1;\n bottom: 0;\n top: 0;\n left: 0;\n right: 0;\n min-width: 100%; }\n\n.piped-text-submenu-item {\n padding-right: 24px; }\n\n.piped-text-information-message {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n color: #74777A;\n text-align: center;\n white-space: pre-line; }\n\n.piped-text-loading-spinner {\n width: fit-content;\n margin: 0 auto; }\n\n.piped-text-error-container {\n color: #BB0000; }\n .piped-text-error-container .piped-text-error-icon {\n padding: 8px 0; }\n .piped-text-error-container .piped-text-error-icon svg {\n fill: #BB0000;\n display: block;\n margin: 0 auto; }\n .piped-text-error-container .piped-text-error-text {\n text-align: center;\n white-space: pre-line;\n padding: 0 12px 8px; }\n\n.piped-text-menu-item-container.highlighted-menu-item {\n background: RGBA(50, 54, 58, 0.08); }\n\n.piped-text-menu-item-container .piped-text-menu-item, .piped-text-menu-item-container .piped-text-submenu-item {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis; }\n .piped-text-menu-item-container .piped-text-menu-item:not(.piped-text-header):not(.piped-text-disabled):hover, .piped-text-menu-item-container .piped-text-submenu-item:not(.piped-text-header):not(.piped-text-disabled):hover {\n cursor: pointer; }\n .piped-text-menu-item-container .piped-text-menu-item.piped-text-header, .piped-text-menu-item-container .piped-text-submenu-item.piped-text-header {\n font-size: 12px;\n line-height: 16px;\n font-weight: 700;\n padding: 12px; }\n .piped-text-menu-item-container .piped-text-menu-item.piped-text-disabled:not(.piped-text-header), .piped-text-menu-item-container .piped-text-submenu-item.piped-text-disabled:not(.piped-text-header) {\n color: RGB(116, 119, 122); }\n";
|
|
1237
|
-
styleInject(css_248z$i);
|
|
1238
|
-
|
|
1239
|
-
var css_248z$h = "";
|
|
1240
|
-
styleInject(css_248z$h);
|
|
1241
|
-
|
|
1242
|
-
// const WrappedPipedTextMenu = PipedTextMenu as PipedTextMenuType;
|
|
1243
|
-
var PipedTextSubmenuItem = React__default["default"].forwardRef(function PipedTextSubmenuItem(props, ref) {
|
|
1244
|
-
var submenuAnchorRef = React.useRef(null);
|
|
1245
|
-
var submenuAnchorId = useId();
|
|
1246
|
-
var menuItem = props.menuItem;
|
|
1247
|
-
return (React__default["default"].createElement("div", { "data-testid": "piped-text-submenu", className: "piped-text-submenu-item-container", role: 'presentation' },
|
|
1248
|
-
menuItem.show && (React__default["default"].createElement(PipedTextMenu, { "aria-labelledby": submenuAnchorId,
|
|
1249
|
-
//@ts-ignore
|
|
1250
|
-
items: menuItem.submenu.items, show: menuItem.show, placement: "right-start", onClose: function () {
|
|
1251
|
-
menuItem.show = false;
|
|
1252
|
-
}, allowCustom: menuItem.submenu.allowCustom, customScheme: menuItem.submenu.customScheme, customInputMessage: menuItem.submenu.customInputMessage, searchPlaceholder: menuItem.submenu.searchPlaceholder, errorText: menuItem.submenu.errorText, onSelected: menuItemClicked, anchor: function (ref) { return (React__default["default"].createElement("div", { ref: ref, className: "piped-text-submenu-anchor" })); }, anchorRef: submenuAnchorRef, keyboardCtrl: props.keyboardCtrl, pipedTextMenuId: props.pipedTextMenuId })),
|
|
1253
|
-
React__default["default"].createElement("div", { id: submenuAnchorId, className: "piped-text-submenu-item", ref: submenuAnchorRef },
|
|
1254
|
-
React__default["default"].createElement("div", { className: "label-text" }, menuItem.label),
|
|
1255
|
-
React__default["default"].createElement("div", { className: "piped-text-icon" },
|
|
1256
|
-
React__default["default"].createElement(uiReact.Icon, { type: uiReact.IconTypes.ChevronRight, size: "medium" })))));
|
|
1257
|
-
function menuItemClicked(menuItem) {
|
|
1258
|
-
props.onMenuItemClick(menuItem);
|
|
1259
|
-
}
|
|
1260
|
-
});
|
|
1261
|
-
|
|
1262
|
-
var css_248z$g = "div[role=\"menu\"] .piped-text-search-input-container {\n padding: 5px 10px; }\n\n.piped-text-search-input {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .piped-text-search-input input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n\n.piped-text-menu-empty-anchor {\n /* the margin-right hack was not in harmony with tao.\n now, the empty-anchor is truly empty */ }\n\n.piped-text-submenu-item-container {\n position: relative; }\n .piped-text-submenu-item-container .piped-text-menu .piped-text-submenu-anchor {\n position: absolute;\n z-index: -1;\n bottom: 0;\n top: 0;\n left: 0;\n right: 0;\n min-width: 100%; }\n\n.piped-text-submenu-item {\n padding-right: 24px; }\n\n.piped-text-information-message {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n color: #74777A;\n text-align: center;\n white-space: pre-line; }\n\n.piped-text-loading-spinner {\n width: fit-content;\n margin: 0 auto; }\n\n.piped-text-error-container {\n color: #BB0000; }\n .piped-text-error-container .piped-text-error-icon {\n padding: 8px 0; }\n .piped-text-error-container .piped-text-error-icon svg {\n fill: #BB0000;\n display: block;\n margin: 0 auto; }\n .piped-text-error-container .piped-text-error-text {\n text-align: center;\n white-space: pre-line;\n padding: 0 12px 8px; }\n\n.embedded-data-menu {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .embedded-data-menu input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n";
|
|
1263
|
-
styleInject(css_248z$g);
|
|
1264
|
-
|
|
1265
|
-
var css_248z$f = "";
|
|
1266
|
-
styleInject(css_248z$f);
|
|
1267
|
-
|
|
1268
|
-
var TEXT_INPUT_KEYS_TO_ALLOW = [
|
|
1269
|
-
'ArrowDown',
|
|
1270
|
-
'Escape',
|
|
1271
|
-
'Tab',
|
|
1272
|
-
'PageUp',
|
|
1273
|
-
'Home',
|
|
1274
|
-
'PageDown',
|
|
1275
|
-
'End',
|
|
1276
|
-
'Enter',
|
|
1277
|
-
];
|
|
1278
|
-
var PipedTextMenuFocusItem = /** @class */ (function () {
|
|
1279
|
-
function PipedTextMenuFocusItem(currentContainer, menuItems) {
|
|
1280
|
-
this.currentContainer = currentContainer;
|
|
1281
|
-
this.menuItems = menuItems;
|
|
1282
|
-
this.highlightedIdx = -1;
|
|
1283
|
-
}
|
|
1284
|
-
PipedTextMenuFocusItem.prototype.setMenuItems = function (menuItems) {
|
|
1285
|
-
this.menuItems = menuItems;
|
|
1286
|
-
};
|
|
1287
|
-
PipedTextMenuFocusItem.prototype.findMenuItemIdx = function (menuItemRef) {
|
|
1288
|
-
return this.menuItems.findIndex(function (menuItem) {
|
|
1289
|
-
return menuItem.current === menuItemRef.current;
|
|
1290
|
-
});
|
|
1291
|
-
};
|
|
1292
|
-
return PipedTextMenuFocusItem;
|
|
1293
|
-
}());
|
|
1294
|
-
var PipedTextMenuKeyboardCtrl = /** @class */ (function () {
|
|
1295
|
-
function PipedTextMenuKeyboardCtrl() {
|
|
1296
|
-
this.menuFocusItems = [];
|
|
1297
|
-
this.currFocusItemIdx = -1;
|
|
1298
|
-
}
|
|
1299
|
-
PipedTextMenuKeyboardCtrl.prototype.getFocusMenu = function (containerRef) {
|
|
1300
|
-
var foundMenuFocusItemIdx;
|
|
1301
|
-
foundMenuFocusItemIdx = this.menuFocusItems.findIndex(function (focusItem) {
|
|
1302
|
-
return focusItem.currentContainer.current === containerRef.current;
|
|
1303
|
-
});
|
|
1304
|
-
if (foundMenuFocusItemIdx === -1) {
|
|
1305
|
-
return undefined;
|
|
1306
|
-
}
|
|
1307
|
-
return this.menuFocusItems[foundMenuFocusItemIdx];
|
|
1308
|
-
};
|
|
1309
|
-
PipedTextMenuKeyboardCtrl.prototype.getCurrentFocusMenu = function () {
|
|
1310
|
-
return this.menuFocusItems[this.currFocusItemIdx];
|
|
1311
|
-
};
|
|
1312
|
-
PipedTextMenuKeyboardCtrl.prototype.addMenu = function (containerRef, menuItemRefs) {
|
|
1313
|
-
var menuToSet, foundMenuFocusItemIdx;
|
|
1314
|
-
foundMenuFocusItemIdx = this.menuFocusItems.findIndex(function (menuFocusItem) {
|
|
1315
|
-
return menuFocusItem.currentContainer.current === containerRef.current;
|
|
1316
|
-
});
|
|
1317
|
-
if ((this.menuFocusItems.length === 0)
|
|
1318
|
-
|| (foundMenuFocusItemIdx === -1)) {
|
|
1319
|
-
menuToSet = new PipedTextMenuFocusItem(containerRef, menuItemRefs);
|
|
1320
|
-
this.menuFocusItems.push(menuToSet);
|
|
1321
|
-
}
|
|
1322
|
-
else {
|
|
1323
|
-
menuToSet = this.menuFocusItems[foundMenuFocusItemIdx];
|
|
1324
|
-
menuToSet.setMenuItems(menuItemRefs);
|
|
1325
|
-
}
|
|
1326
|
-
};
|
|
1327
|
-
PipedTextMenuKeyboardCtrl.prototype.removeMenu = function (containerRef) {
|
|
1328
|
-
var foundMenuFocusItemIdx;
|
|
1329
|
-
foundMenuFocusItemIdx = this.menuFocusItems.findIndex(function (menuFocusItem) {
|
|
1330
|
-
return menuFocusItem.currentContainer.current === containerRef.current;
|
|
1331
|
-
});
|
|
1332
|
-
if (foundMenuFocusItemIdx === -1) {
|
|
1333
|
-
console.error(this);
|
|
1334
|
-
console.error(containerRef);
|
|
1335
|
-
throw new Error('Could not find a matching PipedTextMenu');
|
|
1336
|
-
}
|
|
1337
|
-
this.menuFocusItems.splice(foundMenuFocusItemIdx, 1);
|
|
1338
|
-
};
|
|
1339
|
-
PipedTextMenuKeyboardCtrl.prototype.handleKeyEvent = function ($e) {
|
|
1340
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1341
|
-
var key;
|
|
1342
|
-
var currFocusMenu, nextFocusMenu, nextFocusElemRef;
|
|
1343
|
-
var highlightedItem;
|
|
1344
|
-
key = $e.key;
|
|
1345
|
-
currFocusMenu = this.getCurrentFocusMenu();
|
|
1346
|
-
if (currFocusMenu === undefined) {
|
|
1347
|
-
// technically an error case...
|
|
1348
|
-
return;
|
|
1349
|
-
}
|
|
1350
|
-
switch (key) {
|
|
1351
|
-
case 'ArrowDown':
|
|
1352
|
-
/*
|
|
1353
|
-
In the current focused submenu, advance to the next available menu item
|
|
1354
|
-
and set it to highlighted, and trigger a focus on the menu item element
|
|
1355
|
-
*/
|
|
1356
|
-
if (currFocusMenu.highlightedIdx < (currFocusMenu.menuItems.length - 1)) {
|
|
1357
|
-
nextFocusElemRef = currFocusMenu.menuItems[currFocusMenu.highlightedIdx + 1];
|
|
1358
|
-
this.setFocusMenuHighlightedIdx(currFocusMenu.currentContainer, nextFocusElemRef);
|
|
1359
|
-
(_a = nextFocusElemRef === null || nextFocusElemRef === void 0 ? void 0 : nextFocusElemRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1360
|
-
}
|
|
1361
|
-
break;
|
|
1362
|
-
case 'ArrowUp':
|
|
1363
|
-
/*
|
|
1364
|
-
In the current focused submenu, advance to the previous available menu item
|
|
1365
|
-
and set it to highlighted, and trigger a focus on the menu item element
|
|
1366
|
-
*/
|
|
1367
|
-
if (currFocusMenu.highlightedIdx > 0) {
|
|
1368
|
-
nextFocusElemRef = currFocusMenu.menuItems[currFocusMenu.highlightedIdx - 1];
|
|
1369
|
-
this.setFocusMenuHighlightedIdx(currFocusMenu.currentContainer, nextFocusElemRef);
|
|
1370
|
-
(_b = nextFocusElemRef === null || nextFocusElemRef === void 0 ? void 0 : nextFocusElemRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
1371
|
-
}
|
|
1372
|
-
break;
|
|
1373
|
-
case 'ArrowRight':
|
|
1374
|
-
this.focusNextSubmenu();
|
|
1375
|
-
break;
|
|
1376
|
-
case 'ArrowLeft':
|
|
1377
|
-
case 'Escape':
|
|
1378
|
-
/*
|
|
1379
|
-
Set the previous (parent) submenu as the current focused menu.
|
|
1380
|
-
If it has a child menuitem to highlight, focus the highlighted menu item.
|
|
1381
|
-
If no menuitem is highlighted in the target submenu, call focus() on the
|
|
1382
|
-
container element; the container element focus event handler is expected to
|
|
1383
|
-
respond to the event and set it's own highlighted element and index.
|
|
1384
|
-
*/
|
|
1385
|
-
if (this.currFocusItemIdx > 0) {
|
|
1386
|
-
$e.stopPropagation();
|
|
1387
|
-
nextFocusMenu = this.menuFocusItems[this.currFocusItemIdx - 1];
|
|
1388
|
-
if (nextFocusMenu !== undefined) {
|
|
1389
|
-
highlightedItem = nextFocusMenu.menuItems[nextFocusMenu.highlightedIdx];
|
|
1390
|
-
if (highlightedItem === undefined) {
|
|
1391
|
-
(_d = (_c = nextFocusMenu.currentContainer) === null || _c === void 0 ? void 0 : _c.current) === null || _d === void 0 ? void 0 : _d.focus();
|
|
1392
|
-
}
|
|
1393
|
-
else {
|
|
1394
|
-
(_e = highlightedItem === null || highlightedItem === void 0 ? void 0 : highlightedItem.current) === null || _e === void 0 ? void 0 : _e.focus();
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
}
|
|
1398
|
-
break;
|
|
1399
|
-
case 'PageUp':
|
|
1400
|
-
case 'Home':
|
|
1401
|
-
/*
|
|
1402
|
-
Focus the first menuitem in the current focus menu
|
|
1403
|
-
*/
|
|
1404
|
-
nextFocusElemRef = currFocusMenu.menuItems[0];
|
|
1405
|
-
if (nextFocusElemRef) {
|
|
1406
|
-
this.setFocusMenuHighlightedIdx(currFocusMenu.currentContainer, nextFocusElemRef);
|
|
1407
|
-
(_f = nextFocusElemRef === null || nextFocusElemRef === void 0 ? void 0 : nextFocusElemRef.current) === null || _f === void 0 ? void 0 : _f.focus();
|
|
1408
|
-
}
|
|
1409
|
-
break;
|
|
1410
|
-
case 'PageDown':
|
|
1411
|
-
case 'End':
|
|
1412
|
-
/*
|
|
1413
|
-
Focus the last menuitem in the current focus menu
|
|
1414
|
-
*/
|
|
1415
|
-
nextFocusElemRef = currFocusMenu.menuItems[currFocusMenu.menuItems.length - 1];
|
|
1416
|
-
if (nextFocusElemRef) {
|
|
1417
|
-
this.setFocusMenuHighlightedIdx(currFocusMenu.currentContainer, nextFocusElemRef);
|
|
1418
|
-
(_g = nextFocusElemRef === null || nextFocusElemRef === void 0 ? void 0 : nextFocusElemRef.current) === null || _g === void 0 ? void 0 : _g.focus();
|
|
1419
|
-
}
|
|
1420
|
-
break;
|
|
1421
|
-
}
|
|
1422
|
-
};
|
|
1423
|
-
PipedTextMenuKeyboardCtrl.prototype.focusNextSubmenu = function () {
|
|
1424
|
-
var _a, _b, _c;
|
|
1425
|
-
var currFocusMenu, nextFocusMenu, highlightedItem;
|
|
1426
|
-
currFocusMenu = this.getCurrentFocusMenu();
|
|
1427
|
-
if (currFocusMenu === undefined) {
|
|
1428
|
-
// technically an error case...
|
|
1429
|
-
return;
|
|
1430
|
-
}
|
|
1431
|
-
nextFocusMenu = this.menuFocusItems[this.currFocusItemIdx + 1];
|
|
1432
|
-
if (nextFocusMenu !== undefined) {
|
|
1433
|
-
highlightedItem = nextFocusMenu.menuItems[nextFocusMenu.highlightedIdx];
|
|
1434
|
-
if (highlightedItem === undefined) {
|
|
1435
|
-
(_b = (_a = nextFocusMenu.currentContainer) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
1436
|
-
}
|
|
1437
|
-
else {
|
|
1438
|
-
(_c = highlightedItem === null || highlightedItem === void 0 ? void 0 : highlightedItem.current) === null || _c === void 0 ? void 0 : _c.focus();
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
};
|
|
1442
|
-
PipedTextMenuKeyboardCtrl.prototype.getCurrentFocusMenuRef = function () {
|
|
1443
|
-
var _a;
|
|
1444
|
-
return (_a = this.getCurrentFocusMenu()) === null || _a === void 0 ? void 0 : _a.currentContainer;
|
|
1445
|
-
};
|
|
1446
|
-
PipedTextMenuKeyboardCtrl.prototype.isMenuItemInCurrentFocusMenu = function (menuItemRef) {
|
|
1447
|
-
var currentFocusMenu, foundFocusMenuItemRef;
|
|
1448
|
-
currentFocusMenu = this.getCurrentFocusMenu();
|
|
1449
|
-
foundFocusMenuItemRef = currentFocusMenu.menuItems.find(function (menuItem) {
|
|
1450
|
-
return menuItem.current === menuItemRef.current;
|
|
1451
|
-
});
|
|
1452
|
-
return foundFocusMenuItemRef !== undefined;
|
|
1453
|
-
};
|
|
1454
|
-
PipedTextMenuKeyboardCtrl.prototype.setFocus = function (focusedEl) {
|
|
1455
|
-
var foundMenuFocusItemIdx;
|
|
1456
|
-
foundMenuFocusItemIdx = this.menuFocusItems.findIndex(function (menuFocusItem) {
|
|
1457
|
-
return menuFocusItem.currentContainer.current === focusedEl;
|
|
1458
|
-
});
|
|
1459
|
-
if (foundMenuFocusItemIdx === -1) {
|
|
1460
|
-
console.error(this);
|
|
1461
|
-
console.error(focusedEl);
|
|
1462
|
-
throw new Error('Could not find a matching PipedTextMenu');
|
|
1463
|
-
}
|
|
1464
|
-
this.currFocusItemIdx = foundMenuFocusItemIdx;
|
|
1465
|
-
};
|
|
1466
|
-
PipedTextMenuKeyboardCtrl.prototype.getFocusMenuHighlightedIdx = function (containerRef) {
|
|
1467
|
-
var focusMenu;
|
|
1468
|
-
focusMenu = this.getFocusMenu(containerRef);
|
|
1469
|
-
if (focusMenu === undefined) {
|
|
1470
|
-
return -1;
|
|
1471
|
-
}
|
|
1472
|
-
return focusMenu.highlightedIdx;
|
|
1473
|
-
};
|
|
1474
|
-
PipedTextMenuKeyboardCtrl.prototype.setFocusMenuHighlightedIdx = function (containerRef, highlightedItemRef) {
|
|
1475
|
-
var foundMenuFocusItem, foundHighlightedItemIdx;
|
|
1476
|
-
foundMenuFocusItem = this.getFocusMenu(containerRef);
|
|
1477
|
-
if (foundMenuFocusItem === undefined) {
|
|
1478
|
-
return;
|
|
1479
|
-
}
|
|
1480
|
-
foundHighlightedItemIdx = foundMenuFocusItem.findMenuItemIdx(highlightedItemRef);
|
|
1481
|
-
if (foundHighlightedItemIdx === -1) {
|
|
1482
|
-
return;
|
|
1483
|
-
}
|
|
1484
|
-
foundMenuFocusItem.highlightedIdx = foundHighlightedItemIdx;
|
|
1485
|
-
};
|
|
1486
|
-
return PipedTextMenuKeyboardCtrl;
|
|
1487
|
-
}());
|
|
1488
|
-
|
|
1489
|
-
function EmbeddedDataInput(props) {
|
|
1490
|
-
var _a = React.useState(''), inputValue = _a[0], setInputValue = _a[1];
|
|
1491
|
-
var _b = React.useState(false), isInputInvalid = _b[0], setIsInputInvalid = _b[1];
|
|
1492
|
-
var containerRef = React.useRef();
|
|
1493
|
-
var inputRef = React.useRef();
|
|
1494
|
-
React.useEffect(function () {
|
|
1495
|
-
props.keyboardCtrl.addMenu(containerRef, [
|
|
1496
|
-
inputRef,
|
|
1497
|
-
]);
|
|
1498
|
-
}, [
|
|
1499
|
-
containerRef
|
|
1500
|
-
]);
|
|
1501
|
-
React.useEffect(function () {
|
|
1502
|
-
var $destroy = function () {
|
|
1503
|
-
props.keyboardCtrl.removeMenu(containerRef);
|
|
1504
|
-
};
|
|
1505
|
-
return $destroy;
|
|
1506
|
-
}, []);
|
|
1507
|
-
return (React__default["default"].createElement("div", { className: 'embedded-data-input', tabIndex: -1, "aria-labelledby": props.ariaLabelledById, ref: containerRef, onFocus: handleContainerFocus, onKeyDown: handleContainerKeyDown },
|
|
1508
|
-
React__default["default"].createElement(uiReact.InputGroup, null,
|
|
1509
|
-
React__default["default"].createElement(uiReact.Input, { onChange: function ($e) {
|
|
1510
|
-
handleInputChange($e);
|
|
1511
|
-
}, invalid: isInputInvalid, onKeyDown: handleInputKeyDown, className: 'q-plugin-popover-input', ref: inputRef }),
|
|
1512
|
-
React__default["default"].createElement(uiReact.Button, { kind: 'primary', onClick: handleAddButtonClick, onKeyDown: handleAddButtonKeyDown, onFocus: function ($e) {
|
|
1513
|
-
$e.stopPropagation();
|
|
1514
|
-
} },
|
|
1515
|
-
React__default["default"].createElement(uiReact.Icon, { type: uiReact.IconTypes.Add })))));
|
|
1516
|
-
function handleContainerFocus($e) {
|
|
1517
|
-
var _a;
|
|
1518
|
-
if ($e.currentTarget === containerRef.current) {
|
|
1519
|
-
props.keyboardCtrl.setFocus(containerRef.current);
|
|
1520
|
-
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1521
|
-
props.keyboardCtrl.setFocusMenuHighlightedIdx(containerRef, inputRef);
|
|
1522
|
-
$e.stopPropagation();
|
|
1523
|
-
$e.preventDefault();
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
function handleContainerKeyDown($e) {
|
|
1527
|
-
switch ($e.key) {
|
|
1528
|
-
case 'ArrowDown':
|
|
1529
|
-
case 'ArrowUp':
|
|
1530
|
-
case 'ArrowRight':
|
|
1531
|
-
case 'ArrowLeft':
|
|
1532
|
-
case 'Escape':
|
|
1533
|
-
props.keyboardCtrl.handleKeyEvent($e);
|
|
1534
|
-
$e.preventDefault(); // prevent scroll
|
|
1535
|
-
break;
|
|
1536
|
-
case 'Enter':
|
|
1537
|
-
handleAddButtonClick();
|
|
1538
|
-
/*
|
|
1539
|
-
We don't want Enter key events to bubble, because when the
|
|
1540
|
-
menu closes after enter the focus will return to the
|
|
1541
|
-
piped-text anchor button, and Enter would reopen the base menu
|
|
1542
|
-
*/
|
|
1543
|
-
$e.stopPropagation();
|
|
1544
|
-
$e.preventDefault();
|
|
1545
|
-
break;
|
|
1546
|
-
case 'PageUp':
|
|
1547
|
-
case 'Home':
|
|
1548
|
-
case 'PageDown':
|
|
1549
|
-
case 'End':
|
|
1550
|
-
$e.stopPropagation();
|
|
1551
|
-
$e.preventDefault();
|
|
1552
|
-
break;
|
|
1553
|
-
}
|
|
1554
|
-
}
|
|
1555
|
-
function handleInputKeyDown($e) {
|
|
1556
|
-
var key = $e.key;
|
|
1557
|
-
if (!TEXT_INPUT_KEYS_TO_ALLOW.includes($e.key)) {
|
|
1558
|
-
$e.stopPropagation();
|
|
1559
|
-
}
|
|
1560
|
-
if (!$e.shiftKey && (key === 'Tab')) {
|
|
1561
|
-
/*
|
|
1562
|
-
User can tab forward to focus add Button element
|
|
1563
|
-
without closing the popover menu
|
|
1564
|
-
*/
|
|
1565
|
-
$e.stopPropagation();
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
function handleAddButtonKeyDown($e) {
|
|
1569
|
-
if ($e.shiftKey && ($e.key === 'Tab')) {
|
|
1570
|
-
/*
|
|
1571
|
-
User can shift+tab back to focus Text Input element
|
|
1572
|
-
without closing the popover menu
|
|
1573
|
-
*/
|
|
1574
|
-
$e.stopPropagation();
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
|
-
function handleAddButtonClick() {
|
|
1578
|
-
var locatorString;
|
|
1579
|
-
// Indicate a validation error if the inputValue is empty.
|
|
1580
|
-
// We do not need to provide an error message, via UX guidelines
|
|
1581
|
-
// input validation errors indicate "Required" implicitly by default.
|
|
1582
|
-
if ((inputValue || '').trim().length < 1) {
|
|
1583
|
-
setIsInputInvalid(true);
|
|
1584
|
-
return;
|
|
1585
|
-
}
|
|
1586
|
-
locatorString = "${e://Field/".concat(inputValue, "}");
|
|
1587
|
-
props.onSelect(locatorString);
|
|
1588
|
-
}
|
|
1589
|
-
function handleInputChange($e) {
|
|
1590
|
-
var nextInputValue = ($e.target.value || '').trim();
|
|
1591
|
-
var uriEncodedValue = encodeURIComponent(nextInputValue);
|
|
1592
|
-
setInputValue(uriEncodedValue);
|
|
1593
|
-
if ((uriEncodedValue.length > 0) && isInputInvalid) {
|
|
1594
|
-
setIsInputInvalid(false);
|
|
1595
|
-
}
|
|
1596
|
-
}
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
var EmbeddedDataMenu = React__default["default"].forwardRef(function EmbeddedDataMenu(props, ref) {
|
|
1600
|
-
var anchor = props.anchor;
|
|
1601
|
-
var onClose = props.onClose || (function () { return undefined; });
|
|
1602
|
-
var popoverClassName = 'embedded-data-menu-content';
|
|
1603
|
-
var ignoreClickSelector = popoverClassName;
|
|
1604
|
-
var onSelect = props.onSelect || (function () { return undefined; });
|
|
1605
|
-
return (React__default["default"].createElement(Popover, { show: props.show, anchor: anchor, onClose: onClose, ignoreClickSelector: ignoreClickSelector, placement: props.placement || 'right-start' },
|
|
1606
|
-
React__default["default"].createElement("div", { className: "embedded-data-menu", ref: ref },
|
|
1607
|
-
React__default["default"].createElement(EmbeddedDataInput, { onSelect: onSelect, keyboardCtrl: props.keyboardCtrl, ariaLabelledById: props.ariaLabelledById }))));
|
|
1608
|
-
});
|
|
1609
|
-
|
|
1610
|
-
/*
|
|
1611
|
-
Combines refs for using ForwardRef to manage a localRef in the component, while
|
|
1612
|
-
still allowing the passed ref to function
|
|
1613
|
-
|
|
1614
|
-
See following reference implementations:
|
|
1615
|
-
https://gitlab-app.eng.qops.net/cfe/ui/-/blob/master/packages/ui-react/src/utils/mergeRefs/mergeRefs.ts
|
|
1616
|
-
https://github.com/gregberge/react-merge-refs/blob/main/src/index.tsx
|
|
1617
|
-
*/
|
|
1618
|
-
function mergeRefs(refs) {
|
|
1619
|
-
return function (value) {
|
|
1620
|
-
refs.forEach(function (ref) {
|
|
1621
|
-
if ((typeof ref) === 'function') {
|
|
1622
|
-
ref(value);
|
|
1623
|
-
}
|
|
1624
|
-
else if (ref !== null) {
|
|
1625
|
-
ref.current = value;
|
|
1626
|
-
}
|
|
1627
|
-
});
|
|
1628
|
-
};
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
// export const EMBEDDED_DATA_LOCATOR = 'embeddedData';
|
|
1632
|
-
var PipedTextMenuItem = React__default["default"].forwardRef(function PipedTextMenuItem(props, ref) {
|
|
1633
|
-
var _a = React.useState(), ariaHaspopup = _a[0], setAriaHaspopup = _a[1];
|
|
1634
|
-
var _b = React.useState(), tabIndex = _b[0], setTabIndex = _b[1];
|
|
1635
|
-
var _c = React.useState(), role = _c[0], setRole = _c[1];
|
|
1636
|
-
var _d = React.useState(), _isSubmenu = _d[0], setIsSubmenu = _d[1];
|
|
1637
|
-
var _e = React.useState(), _isDecorated = _e[0], setIsDecorated = _e[1];
|
|
1638
|
-
var _f = React.useState(), _isFocusable = _f[0], setIsFocusable = _f[1];
|
|
1639
|
-
var _g = React.useState(), _isEmbeddedDataMenu = _g[0], setIsEmbeddedDataMenu = _g[1];
|
|
1640
|
-
var localRef = React.useRef();
|
|
1641
|
-
var submenuItemId = useId();
|
|
1642
|
-
var pipedTextMenuId = useId();
|
|
1643
|
-
React.useEffect(function () {
|
|
1644
|
-
var nextIsFocusable, nextIsDecorated, nextIsSubmenu, nextIsEmbeddedDataMenu;
|
|
1645
|
-
var nextTabIndex, nextAriaHaspopup, nextRole;
|
|
1646
|
-
if (props.menuItem === undefined) {
|
|
1647
|
-
return;
|
|
1648
|
-
}
|
|
1649
|
-
nextIsFocusable = checkMenuItemFocusable(props.menuItem);
|
|
1650
|
-
nextIsSubmenu = checkSubmenuMenuItemItem(props.menuItem);
|
|
1651
|
-
nextIsEmbeddedDataMenu = checkEmbeddedDataMenuItem(props.menuItem);
|
|
1652
|
-
nextIsDecorated = checkDecoratedMenuItem(props.menuItem);
|
|
1653
|
-
if (nextIsFocusable) {
|
|
1654
|
-
nextTabIndex = -1;
|
|
1655
|
-
nextRole = 'menuitem';
|
|
1656
|
-
}
|
|
1657
|
-
if (nextIsSubmenu || nextIsEmbeddedDataMenu) {
|
|
1658
|
-
nextAriaHaspopup = 'menu';
|
|
1659
|
-
}
|
|
1660
|
-
setAriaHaspopup(nextAriaHaspopup);
|
|
1661
|
-
setTabIndex(nextTabIndex);
|
|
1662
|
-
setRole(nextRole);
|
|
1663
|
-
setIsSubmenu(nextIsSubmenu);
|
|
1664
|
-
setIsDecorated(nextIsDecorated);
|
|
1665
|
-
setIsFocusable(nextIsFocusable);
|
|
1666
|
-
setIsEmbeddedDataMenu(nextIsEmbeddedDataMenu);
|
|
1667
|
-
}, [
|
|
1668
|
-
props.menuItem,
|
|
1669
|
-
]);
|
|
1670
|
-
return (React__default["default"].createElement("div", { className: 'piped-text-menu-item-container ' + ((props.isHighlighted)
|
|
1671
|
-
? 'highlighted-menu-item'
|
|
1672
|
-
: ''), ref: mergeRefs([
|
|
1673
|
-
ref,
|
|
1674
|
-
localRef,
|
|
1675
|
-
]), "aria-haspopup": ariaHaspopup, tabIndex: tabIndex, role: role, id: ariaHaspopup ? submenuItemId : undefined, "aria-controls": ariaHaspopup ? pipedTextMenuId : undefined, "aria-expanded": props.menuItem.show, onFocus: function ($e) {
|
|
1676
|
-
handleMenuItemFocused(props.menuItem);
|
|
1677
|
-
}, onKeyDown: function ($e) {
|
|
1678
|
-
handleKeyDown($e);
|
|
1679
|
-
}, onMouseEnter: handleMouseEnter, onClick: handleClick }, getMenuItemContent(props.menuItem)));
|
|
1680
|
-
function getMenuItemContent(menuItem) {
|
|
1681
|
-
var innerContent, menuItemEl;
|
|
1682
|
-
var menuItemHeaderClass, menuItemDisabledClass, menuItemClassName;
|
|
1683
|
-
if (_isSubmenu) {
|
|
1684
|
-
innerContent = (React__default["default"].createElement(PipedTextSubmenuItem, { key: menuItem.key, menuItem: menuItem, onMenuItemClick: handleMenuItemClick, keyboardCtrl: props.keyboardCtrl, pipedTextMenuId: pipedTextMenuId }));
|
|
1685
|
-
}
|
|
1686
|
-
else if (_isDecorated) {
|
|
1687
|
-
menuItemHeaderClass = (menuItem.header === true)
|
|
1688
|
-
? 'piped-text-header'
|
|
1689
|
-
: '';
|
|
1690
|
-
menuItemDisabledClass = (menuItem.disabled === true)
|
|
1691
|
-
? 'piped-text-disabled'
|
|
1692
|
-
: '';
|
|
1693
|
-
menuItemClassName = "piped-text-menu-item ".concat(menuItemHeaderClass, " ").concat(menuItemDisabledClass);
|
|
1694
|
-
innerContent = (React__default["default"].createElement("div", { className: menuItemClassName }, menuItem.label));
|
|
1695
|
-
}
|
|
1696
|
-
else if (_isEmbeddedDataMenu) {
|
|
1697
|
-
innerContent = (React__default["default"].createElement("div", { role: 'presentation' },
|
|
1698
|
-
React__default["default"].createElement(EmbeddedDataMenu, { show: menuItem.show, onSelect: handleEmbeddedDataSelect, anchor: function (_ref) { return (React__default["default"].createElement("div", { ref: _ref, className: "embedded-data-menu-anchor", "aria-hidden": 'true' })); }, keyboardCtrl: props.keyboardCtrl, ariaLabelledById: submenuItemId }),
|
|
1699
|
-
React__default["default"].createElement("div", { className: "piped-text-submenu-item" },
|
|
1700
|
-
React__default["default"].createElement("div", { className: 'label-text' }, menuItem.label),
|
|
1701
|
-
React__default["default"].createElement("div", { className: "piped-text-icon" },
|
|
1702
|
-
React__default["default"].createElement(uiReact.Icon, { type: uiReact.IconTypes.ChevronRight, size: 'medium' })))));
|
|
1703
|
-
}
|
|
1704
|
-
else {
|
|
1705
|
-
innerContent = (React__default["default"].createElement("div", { className: "piped-text-menu-item", role: 'presentation' }, menuItem.label));
|
|
1706
|
-
}
|
|
1707
|
-
menuItemEl = (React__default["default"].createElement("div", { className: "piped-text-menu-item-content", role: 'presentation' }, innerContent));
|
|
1708
|
-
return menuItemEl;
|
|
1709
|
-
}
|
|
1710
|
-
function handleClick($e) {
|
|
1711
|
-
if (_isSubmenu || _isEmbeddedDataMenu) {
|
|
1712
|
-
handleSubmenuItemClick(props.menuItem);
|
|
1713
|
-
}
|
|
1714
|
-
else if (_isFocusable) {
|
|
1715
|
-
handleMenuItemClick(props.menuItem);
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
function handleMouseEnter($e) {
|
|
1719
|
-
if (_isSubmenu || _isEmbeddedDataMenu) {
|
|
1720
|
-
handleSubmenuHover(props.menuItem);
|
|
1721
|
-
}
|
|
1722
|
-
else if (_isFocusable) {
|
|
1723
|
-
handleMenuItemHovered(props.menuItem);
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
function handleKeyDown($e) {
|
|
1727
|
-
if (!props.isHighlighted) {
|
|
1728
|
-
return;
|
|
1729
|
-
}
|
|
1730
|
-
if (!props.keyboardCtrl.isMenuItemInCurrentFocusMenu(localRef)) {
|
|
1731
|
-
return;
|
|
1732
|
-
}
|
|
1733
|
-
if (($e.key === ' ')
|
|
1734
|
-
|| ($e.key === 'Enter')) {
|
|
1735
|
-
if (_isSubmenu || _isEmbeddedDataMenu) {
|
|
1736
|
-
props.onSubmenuItemClick(props.menuItem);
|
|
1737
|
-
}
|
|
1738
|
-
else {
|
|
1739
|
-
props.onMenuItemClicked(props.menuItem);
|
|
1740
|
-
}
|
|
1741
|
-
$e.preventDefault(); // prevent scroll
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
function handleMenuItemFocused(menuItem) {
|
|
1745
|
-
if (_isSubmenu || _isEmbeddedDataMenu) {
|
|
1746
|
-
props.onSubmenuHover(menuItem, localRef);
|
|
1747
|
-
}
|
|
1748
|
-
else {
|
|
1749
|
-
props.onMenuItemHover(menuItem, localRef);
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
function handleSubmenuItemClick(menuItem) {
|
|
1753
|
-
props.onSubmenuItemClick(menuItem);
|
|
1754
|
-
}
|
|
1755
|
-
function handleMenuItemClick(menuItem) {
|
|
1756
|
-
props.onMenuItemClicked(menuItem);
|
|
1757
|
-
}
|
|
1758
|
-
function handleSubmenuHover(menuItem) {
|
|
1759
|
-
props.onSubmenuHover(menuItem, localRef);
|
|
1760
|
-
}
|
|
1761
|
-
function handleMenuItemHovered(menuItem) {
|
|
1762
|
-
props.onMenuItemHover(menuItem, localRef);
|
|
1763
|
-
}
|
|
1764
|
-
function handleEmbeddedDataSelect(edLocator) {
|
|
1765
|
-
var edMenuItem;
|
|
1766
|
-
/* Instead of returning the menuItem, we'll construct one that matches the interface.
|
|
1767
|
-
There is no mappable "menuItem" here, when ED values are added they can be different
|
|
1768
|
-
potentially every time, so we trigger events generically ad hoc
|
|
1769
|
-
*/
|
|
1770
|
-
edMenuItem = {
|
|
1771
|
-
value: {
|
|
1772
|
-
locator: edLocator,
|
|
1773
|
-
},
|
|
1774
|
-
};
|
|
1775
|
-
props.onMenuItemClicked(edMenuItem);
|
|
1776
|
-
}
|
|
1777
|
-
});
|
|
1778
|
-
|
|
1779
|
-
var PipedTextSearchInput = React__default["default"].forwardRef(function PipedTextSearchInput(props, ref) {
|
|
1780
|
-
var textInputRef = React__default["default"].useRef();
|
|
1781
|
-
return (React__default["default"].createElement("div", { className: 'piped-text-search-input', tabIndex: -1, ref: ref, onFocus: handleContainerFocus },
|
|
1782
|
-
React__default["default"].createElement("form", { onSubmit: props.onSearchSubmit },
|
|
1783
|
-
React__default["default"].createElement(uiReact.Input, { small: true, full: true, className: "q-plugin-popover-input", ref: textInputRef, placeholder: props.searchPlaceholder, value: props.value, onChange: props.onInputChange, onClick: props.onInputClick, onKeyDown: handleKeyDown, role: 'searchbox' }))));
|
|
1784
|
-
function handleKeyDown($e) {
|
|
1785
|
-
if (!TEXT_INPUT_KEYS_TO_ALLOW.includes($e.key)) {
|
|
1786
|
-
$e.stopPropagation();
|
|
1787
|
-
}
|
|
1788
|
-
}
|
|
1789
|
-
function handleContainerFocus($e) {
|
|
1790
|
-
var _a;
|
|
1791
|
-
if ($e.target !== textInputRef.current) {
|
|
1792
|
-
(_a = textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1793
|
-
}
|
|
1794
|
-
props.onFocus($e);
|
|
1795
|
-
}
|
|
1796
|
-
});
|
|
1797
|
-
|
|
1798
|
-
var PipedTextMenuList = React__default["default"].forwardRef(function PipedTextMenuList(props, ref) {
|
|
1799
|
-
var _this = this;
|
|
1800
|
-
var _a, _b;
|
|
1801
|
-
var _c = React.useState(false), isLoading = _c[0], setIsLoading = _c[1];
|
|
1802
|
-
var _d = React.useState(false), isLoadError = _d[0], setIsLoadError = _d[1];
|
|
1803
|
-
var _e = React.useState(), menuItems = _e[0], setMenuItems = _e[1];
|
|
1804
|
-
var _f = React.useState(), itemsToRender = _f[0], setItemsToRender = _f[1];
|
|
1805
|
-
var _g = React.useState(), menuChildren = _g[0], setMenuChildren = _g[1];
|
|
1806
|
-
var _h = React.useState(), focusMenuItems = _h[0], setFocusMenuItems = _h[1];
|
|
1807
|
-
var _j = React.useState(''), searchValue = _j[0], setSearchValue = _j[1];
|
|
1808
|
-
var _k = React.useState(false), autoFocusedOnOpen = _k[0], setAutoFocusedOnOpen = _k[1];
|
|
1809
|
-
var pipedTextMenuId = (_a = props.pipedTextMenuId) !== null && _a !== void 0 ? _a : useId();
|
|
1810
|
-
var externalAriaLabelledBy = props['aria-labelledby'];
|
|
1811
|
-
var localRef = React.useRef();
|
|
1812
|
-
var searchRef = React.useRef();
|
|
1813
|
-
/*
|
|
1814
|
-
We need to track whether or not the menu component has rendered, and the
|
|
1815
|
-
localRef is available, so that we can add it to the keyboardCtrl
|
|
1816
|
-
before the menuItems have finished loading
|
|
1817
|
-
*/
|
|
1818
|
-
var _l = React.useState(false), isLocalRefReady = _l[0], setIsLocalRefReady = _l[1];
|
|
1819
|
-
var localRefReadyCb = React.useCallback(function (node) {
|
|
1820
|
-
if (node) {
|
|
1821
|
-
setIsLocalRefReady(true);
|
|
1822
|
-
}
|
|
1823
|
-
}, []);
|
|
1824
|
-
var _m = React.useState(false), isSearchRefReady = _m[0], setIsSearchRefReady = _m[1];
|
|
1825
|
-
var searchRefReadyCb = React.useCallback(function (node) {
|
|
1826
|
-
if (node) {
|
|
1827
|
-
setIsSearchRefReady(true);
|
|
1828
|
-
}
|
|
1829
|
-
}, []);
|
|
1830
|
-
var isRoot = props.keyboardCtrl === undefined;
|
|
1831
|
-
var _o = React.useState(isRoot
|
|
1832
|
-
? new PipedTextMenuKeyboardCtrl
|
|
1833
|
-
: props.keyboardCtrl), keyboardCtrl = _o[0]; _o[1];
|
|
1834
|
-
var schedulePopoverUpdate = function () {
|
|
1835
|
-
var _a;
|
|
1836
|
-
if (typeof ((_a = props.popoverOptionsRef) === null || _a === void 0 ? void 0 : _a.current.scheduleUpdate) === 'function') {
|
|
1837
|
-
props.popoverOptionsRef.current.scheduleUpdate();
|
|
1838
|
-
}
|
|
1839
|
-
};
|
|
1840
|
-
React.useEffect(function () {
|
|
1841
|
-
var $destroy = function () {
|
|
1842
|
-
keyboardCtrl.removeMenu(localRef);
|
|
1843
|
-
};
|
|
1844
|
-
return $destroy;
|
|
1845
|
-
}, []);
|
|
1846
|
-
React.useEffect(function () {
|
|
1847
|
-
var nextMenuItemRefs, focusMenuItemRefs;
|
|
1848
|
-
if (localRef.current
|
|
1849
|
-
&& searchRef.current
|
|
1850
|
-
&& menuChildren
|
|
1851
|
-
&& !isLoading) {
|
|
1852
|
-
focusMenuItemRefs = React__default["default"].Children.map(focusMenuItems, function (menuChild) {
|
|
1853
|
-
return menuChild.ref;
|
|
1854
|
-
});
|
|
1855
|
-
nextMenuItemRefs = __spreadArray([
|
|
1856
|
-
searchRef
|
|
1857
|
-
], focusMenuItemRefs, true);
|
|
1858
|
-
keyboardCtrl.addMenu(localRef, nextMenuItemRefs);
|
|
1859
|
-
if (isRoot && (autoFocusedOnOpen === false)) {
|
|
1860
|
-
setTimeout(function () {
|
|
1861
|
-
var _a;
|
|
1862
|
-
/*
|
|
1863
|
-
Hack - see https://github.com/floating-ui/react-popper/issues/395
|
|
1864
|
-
Without this, the page jitters on focus as the page scroll position
|
|
1865
|
-
updates. Using setTimeout, we give Popper one render cycle to
|
|
1866
|
-
set its own position before triggering the autofocus - then the input
|
|
1867
|
-
element will have correct positioning by the time we call .focus()
|
|
1868
|
-
*/
|
|
1869
|
-
(_a = localRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1870
|
-
}, 0);
|
|
1871
|
-
setAutoFocusedOnOpen(true);
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
}, [
|
|
1875
|
-
localRef,
|
|
1876
|
-
menuChildren,
|
|
1877
|
-
keyboardCtrl,
|
|
1878
|
-
isLoading,
|
|
1879
|
-
]);
|
|
1880
|
-
React.useEffect(function () {
|
|
1881
|
-
var menuItemRefs;
|
|
1882
|
-
if (isLocalRefReady) {
|
|
1883
|
-
menuItemRefs = [];
|
|
1884
|
-
if (isSearchRefReady) {
|
|
1885
|
-
menuItemRefs.push(searchRef);
|
|
1886
|
-
}
|
|
1887
|
-
keyboardCtrl.addMenu(localRef, menuItemRefs);
|
|
1888
|
-
}
|
|
1889
|
-
}, [
|
|
1890
|
-
isLocalRefReady,
|
|
1891
|
-
isSearchRefReady,
|
|
1892
|
-
]);
|
|
1893
|
-
React.useEffect(function () {
|
|
1894
|
-
if (props.items === undefined) {
|
|
1895
|
-
return;
|
|
1896
|
-
}
|
|
1897
|
-
(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1898
|
-
var rawMenuItems, nextMenuItems;
|
|
1899
|
-
return __generator(this, function (_a) {
|
|
1900
|
-
switch (_a.label) {
|
|
1901
|
-
case 0:
|
|
1902
|
-
if (!((typeof props.items) === 'function')) return [3 /*break*/, 5];
|
|
1903
|
-
setIsLoading(true);
|
|
1904
|
-
_a.label = 1;
|
|
1905
|
-
case 1:
|
|
1906
|
-
_a.trys.push([1, 3, , 4]);
|
|
1907
|
-
return [4 /*yield*/, props.items()];
|
|
1908
|
-
case 2:
|
|
1909
|
-
rawMenuItems = _a.sent();
|
|
1910
|
-
return [3 /*break*/, 4];
|
|
1911
|
-
case 3:
|
|
1912
|
-
_a.sent();
|
|
1913
|
-
setIsLoadError(true);
|
|
1914
|
-
return [3 /*break*/, 4];
|
|
1915
|
-
case 4:
|
|
1916
|
-
setIsLoading(false);
|
|
1917
|
-
return [3 /*break*/, 6];
|
|
1918
|
-
case 5:
|
|
1919
|
-
rawMenuItems = props.items;
|
|
1920
|
-
_a.label = 6;
|
|
1921
|
-
case 6:
|
|
1922
|
-
try {
|
|
1923
|
-
nextMenuItems = pipedTextDataAdapter(rawMenuItems);
|
|
1924
|
-
setMenuItems(nextMenuItems);
|
|
1925
|
-
}
|
|
1926
|
-
catch (e) {
|
|
1927
|
-
setIsLoadError(true);
|
|
1928
|
-
}
|
|
1929
|
-
return [2 /*return*/];
|
|
1930
|
-
}
|
|
1931
|
-
});
|
|
1932
|
-
}); })();
|
|
1933
|
-
}, [
|
|
1934
|
-
props.items,
|
|
1935
|
-
]);
|
|
1936
|
-
React.useEffect(function () {
|
|
1937
|
-
var nextItemsToRender;
|
|
1938
|
-
if (menuItems === undefined) {
|
|
1939
|
-
return;
|
|
1940
|
-
}
|
|
1941
|
-
nextItemsToRender = (menuItems || []).filter(matchesSearch);
|
|
1942
|
-
setItemsToRender(nextItemsToRender);
|
|
1943
|
-
}, [
|
|
1944
|
-
searchValue,
|
|
1945
|
-
menuItems,
|
|
1946
|
-
]);
|
|
1947
|
-
React.useEffect(function () {
|
|
1948
|
-
var nextMenuChildren;
|
|
1949
|
-
if (!Array.isArray(itemsToRender)) {
|
|
1950
|
-
return;
|
|
1951
|
-
}
|
|
1952
|
-
nextMenuChildren = getPipedTextMenuItems(itemsToRender);
|
|
1953
|
-
setMenuChildren(nextMenuChildren);
|
|
1954
|
-
}, [
|
|
1955
|
-
itemsToRender,
|
|
1956
|
-
]);
|
|
1957
|
-
schedulePopoverUpdate();
|
|
1958
|
-
return (React__default["default"].createElement("div", { className: "piped-text-menu-list ".concat((_b = props.className) !== null && _b !== void 0 ? _b : ''), ref: mergeRefs([
|
|
1959
|
-
ref,
|
|
1960
|
-
localRef,
|
|
1961
|
-
localRefReadyCb,
|
|
1962
|
-
]), id: pipedTextMenuId, "aria-labelledby": externalAriaLabelledBy, role: "menu",
|
|
1963
|
-
// role="listbox"
|
|
1964
|
-
tabIndex: (props.tabIndex === undefined)
|
|
1965
|
-
? -1
|
|
1966
|
-
: props.tabIndex, onKeyDown: function ($e) {
|
|
1967
|
-
handleKeyDown($e);
|
|
1968
|
-
}, onFocus: function ($e) {
|
|
1969
|
-
handleMenuListFocus($e);
|
|
1970
|
-
} },
|
|
1971
|
-
React__default["default"].createElement("div", { className: "piped-text-popover-menu", role: 'presentation' }, ((isLoadError)
|
|
1972
|
-
? (React__default["default"].createElement(PipedTextMenuLoadError, { errorText: props.errorText }))
|
|
1973
|
-
: (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1974
|
-
React__default["default"].createElement(PipedTextSearchInput, { ref: mergeRefs([
|
|
1975
|
-
searchRef,
|
|
1976
|
-
searchRefReadyCb,
|
|
1977
|
-
]), value: searchValue, onSearchSubmit: handleSearchSubmit, searchPlaceholder: props.searchPlaceholder, onInputChange: function ($e) { return onSearchInputChange($e); }, onInputClick: function ($e) { return handleSearchInputClick($e); }, onFocus: function () {
|
|
1978
|
-
handleSearchFocus();
|
|
1979
|
-
} }),
|
|
1980
|
-
(isLoading)
|
|
1981
|
-
? (React__default["default"].createElement("div", { className: "piped-text-loading-spinner" },
|
|
1982
|
-
React__default["default"].createElement(uiReact.LoadingSpinner, { show: true, size: "medium" })))
|
|
1983
|
-
: menuChildren))))));
|
|
1984
|
-
function handleMenuListFocus($e) {
|
|
1985
|
-
var _a;
|
|
1986
|
-
if ($e.currentTarget === localRef.current) {
|
|
1987
|
-
keyboardCtrl.setFocus(localRef.current);
|
|
1988
|
-
if (keyboardCtrl.getFocusMenuHighlightedIdx(localRef) === -1) {
|
|
1989
|
-
(_a = searchRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1990
|
-
}
|
|
1991
|
-
$e.stopPropagation();
|
|
1992
|
-
$e.preventDefault();
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
function handleKeyDown($e) {
|
|
1996
|
-
var currFocusMenuContainerRef;
|
|
1997
|
-
switch ($e.key) {
|
|
1998
|
-
case 'Tab':
|
|
1999
|
-
onClose();
|
|
2000
|
-
}
|
|
2001
|
-
props === null || props === void 0 ? void 0 : props.menuKeyDown($e);
|
|
2002
|
-
currFocusMenuContainerRef = keyboardCtrl.getCurrentFocusMenuRef();
|
|
2003
|
-
if (localRef.current !== (currFocusMenuContainerRef === null || currFocusMenuContainerRef === void 0 ? void 0 : currFocusMenuContainerRef.current)) {
|
|
2004
|
-
return;
|
|
2005
|
-
}
|
|
2006
|
-
switch ($e.key) {
|
|
2007
|
-
case 'ArrowDown':
|
|
2008
|
-
case 'ArrowUp':
|
|
2009
|
-
case 'ArrowRight':
|
|
2010
|
-
case 'ArrowLeft':
|
|
2011
|
-
case 'Escape':
|
|
2012
|
-
case 'PageUp':
|
|
2013
|
-
case 'Home':
|
|
2014
|
-
case 'PageDown':
|
|
2015
|
-
case 'End':
|
|
2016
|
-
keyboardCtrl.handleKeyEvent($e);
|
|
2017
|
-
$e.preventDefault(); // prevent scroll
|
|
2018
|
-
break;
|
|
2019
|
-
}
|
|
2020
|
-
}
|
|
2021
|
-
function onClose() {
|
|
2022
|
-
var _a;
|
|
2023
|
-
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
2024
|
-
}
|
|
2025
|
-
function onSearchInputChange(evt) {
|
|
2026
|
-
var nextSearchValue;
|
|
2027
|
-
nextSearchValue = evt.target.value;
|
|
2028
|
-
setSearchValue(nextSearchValue);
|
|
2029
|
-
}
|
|
2030
|
-
function handleSearchInputClick(evt) {
|
|
2031
|
-
evt.stopPropagation();
|
|
2032
|
-
}
|
|
2033
|
-
function matchesSearch(menuItem) {
|
|
2034
|
-
var searchVal;
|
|
2035
|
-
searchVal = searchValue || '';
|
|
2036
|
-
return JSON.stringify(menuItem).toLowerCase().includes(searchVal.toLowerCase());
|
|
2037
|
-
}
|
|
2038
|
-
function handleSearchSubmit(e) {
|
|
2039
|
-
var searchVal, locator, selected;
|
|
2040
|
-
e.preventDefault();
|
|
2041
|
-
if (!(props.allowCustom === true && props.customScheme)) {
|
|
2042
|
-
return;
|
|
2043
|
-
}
|
|
2044
|
-
searchVal = searchValue.trim();
|
|
2045
|
-
if (searchVal === '') {
|
|
2046
|
-
return;
|
|
2047
|
-
}
|
|
2048
|
-
locator = "${".concat(props.customScheme, "://Field/").concat(encodeURIComponent(searchVal), "}");
|
|
2049
|
-
selected = {
|
|
2050
|
-
value: {
|
|
2051
|
-
locator: locator,
|
|
2052
|
-
},
|
|
2053
|
-
};
|
|
2054
|
-
props.onSelected(selected);
|
|
2055
|
-
onClose();
|
|
2056
|
-
}
|
|
2057
|
-
function getPipedTextMenuItems(_menuItems) {
|
|
2058
|
-
var pipedTextMenuItems, nextFocusMenuItems;
|
|
2059
|
-
var focusItemIdx, currHighlightedIdx;
|
|
2060
|
-
pipedTextMenuItems = [];
|
|
2061
|
-
nextFocusMenuItems = [];
|
|
2062
|
-
if (_menuItems.length === 0 && props.allowCustom === true && props.customInputMessage) {
|
|
2063
|
-
return (React__default["default"].createElement("div", null,
|
|
2064
|
-
React__default["default"].createElement("div", { className: "piped-text-information-message" }, props.customInputMessage)));
|
|
2065
|
-
}
|
|
2066
|
-
focusItemIdx = 0;
|
|
2067
|
-
currHighlightedIdx = keyboardCtrl.getFocusMenuHighlightedIdx(localRef);
|
|
2068
|
-
pipedTextMenuItems = _menuItems.map(function (menuItem) {
|
|
2069
|
-
var isFocusable, menuItemEl;
|
|
2070
|
-
var isHighlighted;
|
|
2071
|
-
var menuItemRef = React__default["default"].createRef();
|
|
2072
|
-
isFocusable = checkMenuItemFocusable(menuItem);
|
|
2073
|
-
isHighlighted = (isFocusable) && ((currHighlightedIdx - 1) === focusItemIdx);
|
|
2074
|
-
menuItemEl = (React__default["default"].createElement(PipedTextMenuItem, { ref: menuItemRef, key: menuItem.key, menuItem: menuItem, onSubmenuHover: submenuHovered, onMenuItemHover: menuSelectItemHovered, onMenuItemClicked: menuItemClicked, onSubmenuItemClick: submenuItemClicked, onEmbeddedDataItemClick: embeddedDataItemClicked, keyboardCtrl: keyboardCtrl, isHighlighted: isHighlighted }));
|
|
2075
|
-
if (isFocusable) {
|
|
2076
|
-
nextFocusMenuItems.push(menuItemEl);
|
|
2077
|
-
focusItemIdx++;
|
|
2078
|
-
}
|
|
2079
|
-
return menuItemEl;
|
|
2080
|
-
});
|
|
2081
|
-
setFocusMenuItems(nextFocusMenuItems);
|
|
2082
|
-
return pipedTextMenuItems;
|
|
2083
|
-
}
|
|
2084
|
-
function submenuHovered(menuItem, menuItemRef) {
|
|
2085
|
-
var nextMenuItems;
|
|
2086
|
-
nextMenuItems = menuItems.slice();
|
|
2087
|
-
handleMenuItemHovered(menuItem, menuItemRef);
|
|
2088
|
-
closeSubmenus(nextMenuItems);
|
|
2089
|
-
setMenuItems(nextMenuItems);
|
|
2090
|
-
if (!menuItem.show) {
|
|
2091
|
-
menuItem.show = true;
|
|
2092
|
-
}
|
|
2093
|
-
}
|
|
2094
|
-
function menuSelectItemHovered(menuItem, menuItemRef) {
|
|
2095
|
-
var nextMenuItems;
|
|
2096
|
-
nextMenuItems = menuItems.slice();
|
|
2097
|
-
handleMenuItemHovered(menuItem, menuItemRef);
|
|
2098
|
-
closeSubmenus(nextMenuItems);
|
|
2099
|
-
setMenuItems(nextMenuItems);
|
|
2100
|
-
}
|
|
2101
|
-
function handleSearchFocus() {
|
|
2102
|
-
var _a;
|
|
2103
|
-
var nextMenuItems;
|
|
2104
|
-
nextMenuItems = (_a = menuItems === null || menuItems === void 0 ? void 0 : menuItems.slice()) !== null && _a !== void 0 ? _a : [];
|
|
2105
|
-
keyboardCtrl.setFocusMenuHighlightedIdx(localRef, searchRef);
|
|
2106
|
-
closeSubmenus(nextMenuItems);
|
|
2107
|
-
setMenuItems(nextMenuItems);
|
|
2108
|
-
}
|
|
2109
|
-
function handleMenuItemHovered(menuItem, menuItemRef) {
|
|
2110
|
-
var _a;
|
|
2111
|
-
keyboardCtrl.setFocusMenuHighlightedIdx(localRef, menuItemRef);
|
|
2112
|
-
(_a = menuItemRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2113
|
-
}
|
|
2114
|
-
function menuItemClicked(menuItem) {
|
|
2115
|
-
if (!menuItem.disabled) {
|
|
2116
|
-
props.onSelected(menuItem);
|
|
2117
|
-
}
|
|
2118
|
-
}
|
|
2119
|
-
function submenuItemClicked(menuItem) {
|
|
2120
|
-
console.log('PipedTextMenuList submenu click');
|
|
2121
|
-
keyboardCtrl.focusNextSubmenu();
|
|
2122
|
-
}
|
|
2123
|
-
function embeddedDataItemClicked(menuItem) {
|
|
2124
|
-
// let nextMenuItems: PipedTextMenuItemData[];
|
|
2125
|
-
// nextMenuItems = menuItems.slice();
|
|
2126
|
-
// menuItem.show = true;
|
|
2127
|
-
// setMenuItems(nextMenuItems);
|
|
2128
|
-
}
|
|
2129
|
-
});
|
|
2130
|
-
function closeSubmenus(menuItems) {
|
|
2131
|
-
menuItems.forEach(function (item) {
|
|
2132
|
-
if (item.show) {
|
|
2133
|
-
item.show = false;
|
|
2134
|
-
}
|
|
2135
|
-
});
|
|
2136
|
-
}
|
|
2137
|
-
|
|
2138
|
-
var css_248z$e = "div[role=\"menu\"] .piped-text-search-input-container {\n padding: 5px 10px; }\n\n.piped-text-search-input {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .piped-text-search-input input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n\n.piped-text-menu-empty-anchor {\n /* the margin-right hack was not in harmony with tao.\n now, the empty-anchor is truly empty */ }\n\n.piped-text-submenu-item-container {\n position: relative; }\n .piped-text-submenu-item-container .piped-text-menu .piped-text-submenu-anchor {\n position: absolute;\n z-index: -1;\n bottom: 0;\n top: 0;\n left: 0;\n right: 0;\n min-width: 100%; }\n\n.piped-text-submenu-item {\n padding-right: 24px; }\n\n.piped-text-information-message {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n color: #74777A;\n text-align: center;\n white-space: pre-line; }\n\n.piped-text-loading-spinner {\n width: fit-content;\n margin: 0 auto; }\n\n.piped-text-error-container {\n color: #BB0000; }\n .piped-text-error-container .piped-text-error-icon {\n padding: 8px 0; }\n .piped-text-error-container .piped-text-error-icon svg {\n fill: #BB0000;\n display: block;\n margin: 0 auto; }\n .piped-text-error-container .piped-text-error-text {\n text-align: center;\n white-space: pre-line;\n padding: 0 12px 8px; }\n";
|
|
2139
|
-
styleInject(css_248z$e);
|
|
2140
|
-
|
|
2141
|
-
/* eslint-disable-next-line prefer-arrow-callback */
|
|
2142
|
-
var PipedTextMenu = React__default["default"].forwardRef(function PipedTextMenu(props, ref) {
|
|
2143
|
-
var optionsRef = React.useRef({});
|
|
2144
|
-
var _a = React.useState(props.show), isMenuOpen = _a[0], setIsMenuOpen = _a[1];
|
|
2145
|
-
var externalAriaLabelledBy = props['aria-labelledby'];
|
|
2146
|
-
var onClose = props.onClose || (function () { return undefined; });
|
|
2147
|
-
/*
|
|
2148
|
-
This ref is left for use cases where the
|
|
2149
|
-
container popover may need to be referenced
|
|
2150
|
-
directly
|
|
2151
|
-
*/
|
|
2152
|
-
var _b = React.useState(null); _b[0]; var setPopoverEl = _b[1];
|
|
2153
|
-
var popoverRefCb = React.useCallback(function (el) {
|
|
2154
|
-
setPopoverEl(el);
|
|
2155
|
-
}, []);
|
|
2156
|
-
React.useEffect(function () {
|
|
2157
|
-
if (props.show) {
|
|
2158
|
-
setIsMenuOpen(true);
|
|
2159
|
-
}
|
|
2160
|
-
}, [props.show]);
|
|
2161
|
-
React.useEffect(function () {
|
|
2162
|
-
return function () { return onClose(); };
|
|
2163
|
-
}, []);
|
|
2164
|
-
var _onClose = function () {
|
|
2165
|
-
onToggleClick(false);
|
|
2166
|
-
onClose();
|
|
2167
|
-
};
|
|
2168
|
-
var onToggleClick = function (force) {
|
|
2169
|
-
var nextIsMenuOpen;
|
|
2170
|
-
nextIsMenuOpen = ((typeof force) === 'boolean')
|
|
2171
|
-
? force
|
|
2172
|
-
: !isMenuOpen;
|
|
2173
|
-
setIsMenuOpen(nextIsMenuOpen);
|
|
2174
|
-
};
|
|
2175
|
-
return (React__default["default"].createElement("div", { className: "piped-text-menu" },
|
|
2176
|
-
React__default["default"].createElement(Popover, { show: isMenuOpen, onClose: _onClose, placement: props.placement || 'right-start', anchor: props.anchor, ignoreClickSelector: props.ignoreClickSelector },
|
|
2177
|
-
React__default["default"].createElement(PipedTextMenuList, { className: "piped-text-popover-container", items: props.items, errorText: props.errorText, "aria-labelledby": externalAriaLabelledBy, ref: popoverRefCb, allowCustom: props.allowCustom, customInputMessage: props.customInputMessage, customScheme: props.customScheme, searchPlaceholder: props.searchPlaceholder, onSelected: function (menuItem) {
|
|
2178
|
-
props.onSelected(menuItem);
|
|
2179
|
-
closeAndFocusAnchor();
|
|
2180
|
-
}, onClose: function () { return onClose(); }, popoverOptionsRef: optionsRef, keyboardCtrl: props.keyboardCtrl, menuKeyDown: handleMenuKeyDown, pipedTextMenuId: props.pipedTextMenuId }),
|
|
2181
|
-
React__default["default"].createElement(OptionsPlaceholder, { optionsRef: optionsRef }))));
|
|
2182
|
-
function handleMenuKeyDown($e) {
|
|
2183
|
-
switch ($e.key) {
|
|
2184
|
-
case 'Tab':
|
|
2185
|
-
case 'Escape':
|
|
2186
|
-
closeAndFocusAnchor();
|
|
2187
|
-
break;
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
function closeAndFocusAnchor() {
|
|
2191
|
-
var _a, _b;
|
|
2192
|
-
onClose();
|
|
2193
|
-
(_b = (_a = props.anchorRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
2194
|
-
}
|
|
2195
|
-
});
|
|
2196
|
-
function OptionsPlaceholder(props) {
|
|
2197
|
-
return (React__default["default"].createElement("div", null));
|
|
2198
|
-
}
|
|
2199
|
-
/*
|
|
2200
|
-
Takes piped text menu input data and formats it to be compatible
|
|
2201
|
-
with the piped-text-select component(s)
|
|
2202
|
-
*/
|
|
2203
|
-
function pipedTextDataAdapter(pipedTextData, recursed) {
|
|
2204
|
-
var uniqueKey;
|
|
2205
|
-
if (!recursed) {
|
|
2206
|
-
pipedTextData = _cloneDeep__default["default"](pipedTextData);
|
|
2207
|
-
}
|
|
2208
|
-
uniqueKey = 1;
|
|
2209
|
-
pipedTextData.forEach(function (pipedTextItem) {
|
|
2210
|
-
pipedTextItem.key = pipedTextItem.key || uniqueKey++;
|
|
2211
|
-
pipedTextItem.hasSubmenu = (!!_get__default["default"](pipedTextItem, 'submenu.items.length') || ((typeof _get__default["default"](pipedTextItem, 'submenu.items')) === 'function'));
|
|
2212
|
-
if (pipedTextItem.hasSubmenu || pipedTextItem.value === EMBEDDED_DATA_LOCATOR) {
|
|
2213
|
-
pipedTextItem.show = false; // used by menu component to show/hide submenu popover
|
|
2214
|
-
}
|
|
2215
|
-
if (pipedTextItem.hasSubmenu) {
|
|
2216
|
-
if (!(typeof pipedTextItem.submenu.items === 'function')) {
|
|
2217
|
-
pipedTextDataAdapter(pipedTextItem.submenu.items, true);
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
});
|
|
2221
|
-
return pipedTextData;
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
|
-
var css_248z$d = ".piped-text-dropdown button[type=button].popover-toggle-button {\n min-width: 128px; }\n\n.piped-text-popover-container {\n padding: 0; }\n .piped-text-popover-container > * {\n min-height: 32px; }\n .piped-text-popover-container .piped-text-submenu-item .label-text, .piped-text-popover-container .piped-text-submenu-item > .piped-text-icon {\n display: inline-block;\n vertical-align: middle;\n overflow-wrap: break-word;\n word-wrap: break-word;\n -webkit-hyphens: auto;\n -ms-hyphens: auto;\n -moz-hyphens: auto;\n hyphens: auto; }\n .piped-text-popover-container .piped-text-submenu-item .piped-text-icon {\n display: inline-block;\n box-sizing: content-box;\n position: absolute;\n right: 0;\n max-width: 24px;\n min-width: 24px;\n max-height: 24px; }\n .piped-text-popover-container .piped-text-submenu-item .piped-text-icon > svg {\n position: relative;\n margin-left: -5px;\n margin-top: -3px; }\n";
|
|
2225
|
-
styleInject(css_248z$d);
|
|
2226
|
-
|
|
2227
|
-
var defaultAnchor = function defaultAnchor(ref) {
|
|
2228
|
-
return React__default["default"].createElement("div", {
|
|
2229
|
-
ref: ref,
|
|
2230
|
-
className: "piped-text-menu-empty-anchor"
|
|
2231
|
-
});
|
|
2232
|
-
};
|
|
2233
|
-
|
|
2234
|
-
function PipedTextSelect(props) {
|
|
2235
|
-
var _useState = React.useState(props.show),
|
|
2236
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2237
|
-
isMenuOpen = _useState2[0],
|
|
2238
|
-
setIsMenuOpen = _useState2[1];
|
|
2239
|
-
|
|
2240
|
-
var _useState3 = React.useState(initializePipedText()),
|
|
2241
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
2242
|
-
pipedTextItems = _useState4[0],
|
|
2243
|
-
setPipedTextItems = _useState4[1];
|
|
2244
|
-
|
|
2245
|
-
var defaultAnchorRef = React.useRef(null);
|
|
2246
|
-
var externalAnchor = props.anchor;
|
|
2247
|
-
var ariaLabelledBy = props['aria-labelledby'];
|
|
2248
|
-
React.useEffect(function () {
|
|
2249
|
-
return function () {
|
|
2250
|
-
return onClose();
|
|
2251
|
-
};
|
|
2252
|
-
}, []);
|
|
2253
|
-
React.useEffect(function () {
|
|
2254
|
-
var nextIsMenuOpen;
|
|
2255
|
-
nextIsMenuOpen = props.show;
|
|
2256
|
-
setIsMenuOpen(nextIsMenuOpen);
|
|
2257
|
-
}, [props.show]);
|
|
2258
|
-
React.useEffect(function () {
|
|
2259
|
-
var formattedPipedText = initializePipedText();
|
|
2260
|
-
setPipedTextItems(formattedPipedText);
|
|
2261
|
-
}, [props.items]);
|
|
2262
|
-
|
|
2263
|
-
var onClose = function onClose() {
|
|
2264
|
-
if (props.onClose) {
|
|
2265
|
-
props.onClose();
|
|
2266
|
-
}
|
|
2267
|
-
};
|
|
2268
|
-
|
|
2269
|
-
var onSelect = function onSelect(selected) {
|
|
2270
|
-
props.onSelect(selected);
|
|
2271
|
-
onClose();
|
|
2272
|
-
};
|
|
2273
|
-
|
|
2274
|
-
var actualAnchor = externalAnchor !== undefined ? React__default["default"].cloneElement(externalAnchor, {
|
|
2275
|
-
ref: externalAnchor.ref
|
|
2276
|
-
}) : defaultAnchor(defaultAnchorRef);
|
|
2277
|
-
var anchorRef = props.anchorRef || actualAnchor.ref;
|
|
2278
|
-
return React__default["default"].createElement("div", {
|
|
2279
|
-
className: "piped-text-dropdown"
|
|
2280
|
-
}, isMenuOpen && React__default["default"].createElement(PipedTextMenu, {
|
|
2281
|
-
onClose: onClose,
|
|
2282
|
-
show: isMenuOpen,
|
|
2283
|
-
onSelected: onSelect,
|
|
2284
|
-
items: pipedTextItems,
|
|
2285
|
-
anchor: actualAnchor,
|
|
2286
|
-
anchorRef: anchorRef,
|
|
2287
|
-
ignoreClickSelector: props.ignoreClickSelector,
|
|
2288
|
-
"aria-labelledby": ariaLabelledBy
|
|
2289
|
-
}));
|
|
2290
|
-
|
|
2291
|
-
function initializePipedText() {
|
|
2292
|
-
if (props.items) {
|
|
2293
|
-
return pipedTextDataAdapter(props.items);
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
|
-
}
|
|
2297
|
-
|
|
2298
|
-
var css_248z$c = ".piped-text-input .piped-text-input-toggle, .piped-text-input .piped-text-select-container {\n display: inline-block; }\n\n.piped-text-input .piped-text-input-toggle {\n display: flex; }\n .piped-text-input .piped-text-input-toggle input {\n flex: 1 1;\n box-sizing: border-box; }\n .piped-text-input .piped-text-input-toggle.multiline-input textarea {\n flex: 1 1;\n box-sizing: border-box; }\n .piped-text-input .piped-text-input-toggle input + button, .piped-text-input .piped-text-input-toggle textarea + button {\n margin-left: 4px; }\n\n.piped-text-input .addon-text-container {\n /*\n These styles are intended to match CFE QDS components,\n notably FormField and InputField.\n See: https://gitlab-app.eng.qops.net/cfe/ui/-/blob/master/packages/ui-react/src/FormField/Caption.less\n */\n margin-top: 6px; }\n .piped-text-input .addon-text-container .helper-text, .piped-text-input .addon-text-container .error-text {\n font-size: 12px; }\n .piped-text-input .addon-text-container .helper-text {\n color: #74777a;\n fill: #74777a; }\n .piped-text-input .addon-text-container .helper-text + .error-text {\n margin-top: 4px; }\n .piped-text-input .addon-text-container .error-text {\n display: flex;\n align-items: center;\n color: #b00;\n fill: #b00; }\n .piped-text-input .addon-text-container .error-text .error-text-icon svg {\n margin-left: -2px;\n margin-right: 3px;\n width: 16px;\n height: 16px; }\n";
|
|
2299
|
-
styleInject(css_248z$c);
|
|
2300
|
-
|
|
2301
|
-
function PipedTextInput(props) {
|
|
2302
|
-
var _a = React.useState(false), showMenu = _a[0], setShowMenu = _a[1];
|
|
2303
|
-
var _b = React.useState(), cursorPosition = _b[0], setCursorPosition = _b[1];
|
|
2304
|
-
var pipedTextButtonId = useId();
|
|
2305
|
-
var pipedTextButtonRef = React.useRef(null);
|
|
2306
|
-
/*
|
|
2307
|
-
This has to be an Object type ref instead of 'string' or React will lose
|
|
2308
|
-
track of state, and the supplied props input value will become stale
|
|
2309
|
-
*/
|
|
2310
|
-
var _c = React.useState({
|
|
2311
|
-
value: props.value || ''
|
|
2312
|
-
}), inputRefValue = _c[0], setInputRefValue = _c[1];
|
|
2313
|
-
var items = props.items, value = props.value, placeholder = props.placeholder, onChange = props.onChange, onSelect = props.onSelect, onClose = props.onClose, errorText = props.errorText, helperText = props.helperText, _d = props.multiline, multiline = _d === void 0 ? false : _d, restProps = __rest(props, ["items", "value", "placeholder", "onChange", "onSelect", "onClose", "errorText", "helperText", "multiline"]);
|
|
2314
|
-
React.useEffect(function () {
|
|
2315
|
-
updateCursorPosition();
|
|
2316
|
-
if (onSelect !== undefined && (typeof onSelect) !== 'function') {
|
|
2317
|
-
throw new Error('PipedTextInput: onSelect property must be a function');
|
|
2318
|
-
}
|
|
2319
|
-
if (onChange !== undefined && (typeof onChange) !== 'function') {
|
|
2320
|
-
throw new Error('PipedTextInput: onChange property must be a function');
|
|
2321
|
-
}
|
|
2322
|
-
}, []);
|
|
2323
|
-
React.useEffect(function () {
|
|
2324
|
-
var nextInputValue;
|
|
2325
|
-
if ((typeof value) === 'string') {
|
|
2326
|
-
nextInputValue = value;
|
|
2327
|
-
}
|
|
2328
|
-
else {
|
|
2329
|
-
nextInputValue = '';
|
|
2330
|
-
}
|
|
2331
|
-
setInputRefValue({
|
|
2332
|
-
value: nextInputValue,
|
|
2333
|
-
});
|
|
2334
|
-
}, [props.value]);
|
|
2335
|
-
return (React__default["default"].createElement("div", { className: "piped-text-input" },
|
|
2336
|
-
React__default["default"].createElement("div", { className: 'piped-text-input-toggle popover-toggle' + (multiline ? ' multiline-input' : '') },
|
|
2337
|
-
React__default["default"].createElement(uiReact.Input, __assign({ value: inputRefValue.value, onChange: function (evt) {
|
|
2338
|
-
onInputChange(evt);
|
|
2339
|
-
}, onBlur: onInputBlur, placeholder: placeholder, multiline: multiline }, restProps)),
|
|
2340
|
-
React__default["default"].createElement(uiReact.IconButton, { id: pipedTextButtonId, "aria-label": "PipedText", "aria-haspopup": "menu", "aria-expanded": showMenu ? true : undefined, role: "button", onClick: toggleMenu, ref: pipedTextButtonRef },
|
|
2341
|
-
React__default["default"].createElement(icons.PipedTextIcon, null)),
|
|
2342
|
-
React__default["default"].createElement("div", { className: "piped-text-select-container" },
|
|
2343
|
-
React__default["default"].createElement(PipedTextSelect, { items: items, onSelect: pipedTextSelected, show: showMenu, onClose: handleClose, ignoreClickSelector: "piped-text-input-toggle", anchorRef: pipedTextButtonRef, "aria-labelledby": pipedTextButtonId }))),
|
|
2344
|
-
showAddonText() && (React__default["default"].createElement("div", { className: "addon-text-container" },
|
|
2345
|
-
helperText && (React__default["default"].createElement("div", { className: "helper-text" }, helperText)),
|
|
2346
|
-
errorText && (React__default["default"].createElement("div", { className: "error-text" },
|
|
2347
|
-
React__default["default"].createElement("div", { className: "error-text-icon" },
|
|
2348
|
-
React__default["default"].createElement(icons.ErrorIcon, null)),
|
|
2349
|
-
React__default["default"].createElement("div", { className: "error-text-content" }, errorText)))))));
|
|
2350
|
-
function showAddonText() {
|
|
2351
|
-
return ((helperText !== undefined) || (errorText !== undefined));
|
|
2352
|
-
}
|
|
2353
|
-
function updateCursorPosition() {
|
|
2354
|
-
if ((cursorPosition === undefined) && value) {
|
|
2355
|
-
var initialCursorPositon = (value.length - 1) || 0;
|
|
2356
|
-
setCursorPosition(initialCursorPositon);
|
|
2357
|
-
}
|
|
2358
|
-
else {
|
|
2359
|
-
// default to 0 if no cursorPosition is found or no value is passed
|
|
2360
|
-
setCursorPosition(0);
|
|
2361
|
-
}
|
|
2362
|
-
}
|
|
2363
|
-
function handleClose() {
|
|
2364
|
-
if (onClose) {
|
|
2365
|
-
onClose();
|
|
2366
|
-
}
|
|
2367
|
-
setShowMenu(false);
|
|
2368
|
-
}
|
|
2369
|
-
function pipedTextSelected(selected) {
|
|
2370
|
-
var nextInputValue, prependString, appendString;
|
|
2371
|
-
handleSelect(selected);
|
|
2372
|
-
if (_get__default["default"](selected, 'value.locator')) {
|
|
2373
|
-
prependString = inputRefValue.value.substring(0, cursorPosition);
|
|
2374
|
-
appendString = inputRefValue.value.substring(cursorPosition);
|
|
2375
|
-
nextInputValue = "".concat(prependString).concat(selected.value.locator).concat(appendString);
|
|
2376
|
-
setInputRefValue({
|
|
2377
|
-
value: nextInputValue,
|
|
2378
|
-
});
|
|
2379
|
-
handleChange(nextInputValue);
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
function toggleMenu() {
|
|
2383
|
-
var nextShowMenu;
|
|
2384
|
-
nextShowMenu = !showMenu;
|
|
2385
|
-
if (!nextShowMenu) {
|
|
2386
|
-
handleClose();
|
|
2387
|
-
}
|
|
2388
|
-
setShowMenu(nextShowMenu);
|
|
2389
|
-
}
|
|
2390
|
-
function onInputChange(evt) {
|
|
2391
|
-
var nextInputValue;
|
|
2392
|
-
nextInputValue = evt.target.value;
|
|
2393
|
-
setInputRefValue({
|
|
2394
|
-
value: nextInputValue,
|
|
2395
|
-
});
|
|
2396
|
-
handleChange(nextInputValue, evt);
|
|
2397
|
-
}
|
|
2398
|
-
function onInputBlur(evt) {
|
|
2399
|
-
var nextCursorPosition;
|
|
2400
|
-
nextCursorPosition = evt.target.selectionStart;
|
|
2401
|
-
setCursorPosition(nextCursorPosition);
|
|
2402
|
-
}
|
|
2403
|
-
function handleChange(value, evt) {
|
|
2404
|
-
if (onChange) {
|
|
2405
|
-
onChange(value, evt);
|
|
2406
|
-
}
|
|
2407
|
-
}
|
|
2408
|
-
function handleSelect(selected) {
|
|
2409
|
-
if (onSelect) {
|
|
2410
|
-
onSelect(selected);
|
|
2411
|
-
}
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
|
|
2415
|
-
var css_248z$b = ".field-row {\n min-width: 475px;\n display: flex;\n align-items: center; }\n .field-row .field-selector, .field-row .field-input, .field-row .delete-row, .field-row .required-indicator {\n display: inline-block; }\n .field-row .field-selector, .field-row .field-input {\n padding: 0 10px; }\n .field-row .custom-field-name, .field-row .field-input, .field-row .delete-row {\n box-sizing: border-box; }\n .field-row .field-selector {\n min-width: 30%; }\n .field-row .field-selector.required-field button:hover {\n cursor: not-allowed; }\n .field-row .field-selector .required-indicator-container {\n padding-left: 12px;\n display: flex;\n color: #32363A; }\n .field-row .field-selector .required-indicator-container .required-indicator-text {\n min-width: 0;\n font-size: 14px; }\n .field-row .field-selector .required-indicator-container .required-indicator-symbol {\n margin-top: -2px; }\n .field-row .field-selector .left-align {\n text-align: left; }\n .field-row .field-selector .custom-field-name {\n padding-left: 16px;\n padding-right: 30px; }\n .field-row .field-selector .custom-field-name input {\n text-align: center;\n display: inline-block;\n width: 100%;\n padding: 0; }\n .field-row .field-input-container {\n display: flex;\n flex: 1 0;\n align-items: center; }\n .field-row .field-input-container .field-input {\n flex: 1;\n min-width: 0;\n margin-right: 4px; }\n .field-row .field-input-container .delete-row {\n max-width: 36px;\n margin-left: 12px;\n vertical-align: middle; }\n .field-row .field-input-container .delete-row .icon-wrapper {\n display: block;\n width: fit-content;\n margin: 0 auto;\n min-width: 41px; }\n .field-row .field-input-container .delete-row .icon-wrapper:hover {\n cursor: pointer; }\n .field-row .full-width {\n width: 100%; }\n";
|
|
2416
|
-
styleInject(css_248z$b);
|
|
2417
|
-
|
|
2418
|
-
function FieldRow(props) {
|
|
2419
|
-
var _useState = React.useState(props.children),
|
|
2420
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2421
|
-
children = _useState2[0],
|
|
2422
|
-
setChildren = _useState2[1];
|
|
2423
|
-
|
|
2424
|
-
React.useEffect(function () {
|
|
2425
|
-
var nextChildren;
|
|
2426
|
-
|
|
2427
|
-
if (!Array.isArray(children)) {
|
|
2428
|
-
nextChildren = [];
|
|
2429
|
-
nextChildren.push(children);
|
|
2430
|
-
setChildren(nextChildren);
|
|
2431
|
-
}
|
|
2432
|
-
}, []);
|
|
2433
|
-
React.useEffect(function () {
|
|
2434
|
-
var nextChildren;
|
|
2435
|
-
nextChildren = props.children.slice();
|
|
2436
|
-
setChildren(nextChildren);
|
|
2437
|
-
}, [props.children]);
|
|
2438
|
-
|
|
2439
|
-
var getRowDelete = function getRowDelete() {
|
|
2440
|
-
var handleDelete = function handleDelete() {
|
|
2441
|
-
if (typeof props.onRemove === 'function') {
|
|
2442
|
-
props.onRemove(props.id);
|
|
2443
|
-
}
|
|
2444
|
-
};
|
|
2445
|
-
|
|
2446
|
-
return React__default["default"].createElement("div", {
|
|
2447
|
-
className: "icon-wrapper",
|
|
2448
|
-
onClick: handleDelete
|
|
2449
|
-
}, !props.required && React__default["default"].createElement(uiReact.IconButton, {
|
|
2450
|
-
"aria-label": "RemoveRow",
|
|
2451
|
-
size: "medium"
|
|
2452
|
-
}, React__default["default"].createElement(icons.RemoveItemIcon, null)));
|
|
2453
|
-
};
|
|
2454
|
-
|
|
2455
|
-
var handleFieldSwitch = function handleFieldSwitch(newFieldId) {
|
|
2456
|
-
if (typeof props.onFieldSwitch === 'function') {
|
|
2457
|
-
props.onFieldSwitch(props.id, newFieldId);
|
|
2458
|
-
}
|
|
2459
|
-
};
|
|
2460
|
-
|
|
2461
|
-
var handleFieldNameChange = function handleFieldNameChange(event) {
|
|
2462
|
-
if (typeof props.onFieldNameChange === 'function') {
|
|
2463
|
-
props.onFieldNameChange(props.id, event);
|
|
2464
|
-
}
|
|
2465
|
-
};
|
|
2466
|
-
|
|
2467
|
-
var handleFieldValueChange = function handleFieldValueChange(value, event) {
|
|
2468
|
-
if (typeof props.onFieldValueChange === 'function') {
|
|
2469
|
-
props.onFieldValueChange(props.id, value, event);
|
|
2470
|
-
}
|
|
2471
|
-
};
|
|
2472
|
-
|
|
2473
|
-
var shouldDisableTooltip = function shouldDisableTooltip(tooltipValue) {
|
|
2474
|
-
if (typeof tooltipValue === 'string') {
|
|
2475
|
-
return tooltipValue.trim().length === 0;
|
|
2476
|
-
}
|
|
2477
|
-
|
|
2478
|
-
if (typeof tooltipValue === 'function' || tooltipValue === undefined || tooltipValue === null) {
|
|
2479
|
-
return true;
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
|
-
return "".concat(tooltipValue).trim().length === 0;
|
|
2483
|
-
};
|
|
2484
|
-
|
|
2485
|
-
var getFieldSelector = function getFieldSelector() {
|
|
2486
|
-
var getInternalContent = function getInternalContent() {
|
|
2487
|
-
if (props.isCustom) {
|
|
2488
|
-
return React__default["default"].createElement(uiReact.Input, {
|
|
2489
|
-
full: true,
|
|
2490
|
-
value: props.fieldName === undefined ? '' : props.fieldName,
|
|
2491
|
-
placeholder: props.customNamePlaceholder === undefined ? '' : props.customNamePlaceholder,
|
|
2492
|
-
className: "custom-field-name",
|
|
2493
|
-
onChange: handleFieldNameChange
|
|
2494
|
-
});
|
|
2495
|
-
}
|
|
2496
|
-
|
|
2497
|
-
if (props.required || !props.children || Array.isArray(children) && children.length === 0) {
|
|
2498
|
-
if (props.subMenu) {
|
|
2499
|
-
return React__default["default"].createElement(uiReact.SelectMenu, {
|
|
2500
|
-
searchable: props.searchable !== undefined && props.searchable !== false,
|
|
2501
|
-
defaultLabel: props.fieldName || '',
|
|
2502
|
-
label: props.fieldName,
|
|
2503
|
-
className: "full-width left-align",
|
|
2504
|
-
onChange: handleFieldSwitch
|
|
2505
|
-
}, createMenuItems([{
|
|
2506
|
-
id: props.id,
|
|
2507
|
-
name: props.fieldName,
|
|
2508
|
-
subMenu: props.subMenu,
|
|
2509
|
-
subMenuLabel: props.subMenuLabel
|
|
2510
|
-
}]));
|
|
2511
|
-
} else {
|
|
2512
|
-
return React__default["default"].createElement("div", {
|
|
2513
|
-
className: "required-indicator-container"
|
|
2514
|
-
}, React__default["default"].createElement("div", {
|
|
2515
|
-
className: "required-indicator-text"
|
|
2516
|
-
}, props.fieldName), props.required && React__default["default"].createElement("div", {
|
|
2517
|
-
className: "required-indicator-symbol"
|
|
2518
|
-
}, "*"));
|
|
2519
|
-
}
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2522
|
-
return React__default["default"].createElement(uiReact.SelectMenu, {
|
|
2523
|
-
searchable: props.searchable !== undefined && props.searchable !== false,
|
|
2524
|
-
defaultLabel: props.fieldName || '',
|
|
2525
|
-
label: props.fieldName,
|
|
2526
|
-
className: "full-width left-align",
|
|
2527
|
-
onChange: handleFieldSwitch
|
|
2528
|
-
}, createMenuItems(children));
|
|
2529
|
-
};
|
|
2530
|
-
|
|
2531
|
-
var tooltipContent = React__default["default"].createElement("div", null, props.nameTooltip);
|
|
2532
|
-
return React__default["default"].createElement(uiReact.Tooltip, {
|
|
2533
|
-
disabled: !props.isCustom || shouldDisableTooltip(props.nameTooltip),
|
|
2534
|
-
placement: "top",
|
|
2535
|
-
content: tooltipContent
|
|
2536
|
-
}, React__default["default"].createElement("div", null, getInternalContent()));
|
|
2537
|
-
};
|
|
2538
|
-
|
|
2539
|
-
var createMenuItems = function createMenuItems(items) {
|
|
2540
|
-
return items.map(function (_ref) {
|
|
2541
|
-
var id = _ref.id,
|
|
2542
|
-
name = _ref.name,
|
|
2543
|
-
subMenu = _ref.subMenu,
|
|
2544
|
-
subMenuLabel = _ref.subMenuLabel;
|
|
2545
|
-
return subMenu !== undefined ? React__default["default"].createElement(uiReact.SelectMenu, {
|
|
2546
|
-
label: subMenuLabel ? subMenuLabel : name,
|
|
2547
|
-
key: id
|
|
2548
|
-
}, createMenuItems(subMenu)) : React__default["default"].createElement(uiReact.MenuItem, {
|
|
2549
|
-
key: id,
|
|
2550
|
-
value: id
|
|
2551
|
-
}, name);
|
|
2552
|
-
});
|
|
2553
|
-
};
|
|
2554
|
-
|
|
2555
|
-
var getFieldInput = function getFieldInput() {
|
|
2556
|
-
var getInternalContent = function getInternalContent() {
|
|
2557
|
-
if (props.customInput) {
|
|
2558
|
-
return props.customInput;
|
|
2559
|
-
} else {
|
|
2560
|
-
return React__default["default"].createElement(PipedTextInput, {
|
|
2561
|
-
items: props.pipedTextItems,
|
|
2562
|
-
value: props.value === undefined ? '' : props.value,
|
|
2563
|
-
onChange: handleFieldValueChange,
|
|
2564
|
-
placeholder: props.valuePlaceholder === undefined ? '' : props.valuePlaceholder
|
|
2565
|
-
});
|
|
2566
|
-
}
|
|
2567
|
-
};
|
|
2568
|
-
|
|
2569
|
-
var tooltipContent = React__default["default"].createElement("div", null, props.valueTooltip);
|
|
2570
|
-
return React__default["default"].createElement(uiReact.Tooltip, {
|
|
2571
|
-
disabled: shouldDisableTooltip(props.valueTooltip),
|
|
2572
|
-
placement: "top",
|
|
2573
|
-
content: tooltipContent
|
|
2574
|
-
}, React__default["default"].createElement("div", null, getInternalContent()));
|
|
2575
|
-
};
|
|
2576
|
-
|
|
2577
|
-
return React__default["default"].createElement("div", {
|
|
2578
|
-
className: "field-row"
|
|
2579
|
-
}, React__default["default"].createElement("div", {
|
|
2580
|
-
className: "field-selector ".concat(props.required && !props.subMenu ? 'required-field' : '')
|
|
2581
|
-
}, getFieldSelector()), React__default["default"].createElement("div", {
|
|
2582
|
-
className: "field-input-container"
|
|
2583
|
-
}, React__default["default"].createElement("div", {
|
|
2584
|
-
className: "field-input"
|
|
2585
|
-
}, getFieldInput()), React__default["default"].createElement("div", {
|
|
2586
|
-
className: "delete-row"
|
|
2587
|
-
}, getRowDelete())));
|
|
2588
|
-
}
|
|
2589
|
-
|
|
2590
|
-
var css_248z$a = "";
|
|
2591
|
-
styleInject(css_248z$a);
|
|
2592
|
-
|
|
2593
|
-
function FieldItem(props) {
|
|
2594
|
-
var label = props.name || undefined;
|
|
2595
|
-
|
|
2596
|
-
var handleClick = function handleClick() {
|
|
2597
|
-
if (typeof props.onClick === 'function') {
|
|
2598
|
-
props.onClick(props.id);
|
|
2599
|
-
}
|
|
2600
|
-
};
|
|
2601
|
-
|
|
2602
|
-
return React__default["default"].createElement("div", {
|
|
2603
|
-
className: "field-item",
|
|
2604
|
-
onClick: handleClick
|
|
2605
|
-
}, label);
|
|
2606
|
-
}
|
|
2607
|
-
|
|
2608
|
-
var css_248z$9 = ".task-fields .add-field-button {\n margin-right: 100px; }\n .task-fields .add-field-button .add-field-button-label {\n padding: 0 3px; }\n\n.task-fields .field-table {\n padding-right: 100px;\n overflow-x: auto; }\n .task-fields .field-table .field-headers {\n margin-bottom: 10px;\n padding-left: 12px; }\n .task-fields .field-table .field-headers .field-row {\n color: #6A6D70;\n font-weight: bold; }\n .task-fields .field-table .field-headers .field-row .field-selector label, .task-fields .field-table .field-headers .field-row .field-input label {\n font-size: 12px; }\n .task-fields .field-table .field-headers .field-row .field-selector {\n padding-top: 0;\n padding-right: 24px;\n padding-bottom: 0;\n padding-left: 0; }\n .task-fields .field-table .field-headers .field-row .field-input {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n padding-left: 12px; }\n .task-fields .field-table .field-rows {\n padding-bottom: 12px; }\n .task-fields .field-table .field-rows .field-row {\n border-top: 1px solid #E5E5E5; }\n .task-fields .field-table .field-rows .field-row .field-selector {\n padding-top: 8px;\n padding-right: 12px;\n padding-bottom: 8px;\n padding-left: 12px; }\n .task-fields .field-table .field-rows .field-row .field-input {\n border-left: 1px solid #E5E5E5;\n padding-top: 8px;\n padding-right: 0;\n padding-bottom: 8px;\n padding-left: 12px; }\n\n.q-popover .field-item {\n padding: 5px 32px; }\n .q-popover .field-item:hover {\n cursor: pointer;\n user-select: none;\n background: #007ac0;\n color: #fff;\n fill: #fff; }\n";
|
|
2609
|
-
styleInject(css_248z$9);
|
|
2610
|
-
|
|
2611
|
-
var uuidv4 = uuid__default["default"].v4;
|
|
2612
|
-
var CUSTOM_TYPE = 'custom';
|
|
2613
|
-
function TaskFields(props) {
|
|
2614
|
-
var _useState = React.useState([]),
|
|
2615
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2616
|
-
fieldsInUse = _useState2[0],
|
|
2617
|
-
setFieldsInUse = _useState2[1];
|
|
2618
|
-
|
|
2619
|
-
var _useState3 = React.useState([]),
|
|
2620
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
2621
|
-
availableFields = _useState4[0],
|
|
2622
|
-
setAvailableFields = _useState4[1];
|
|
2623
|
-
|
|
2624
|
-
var _useState5 = React.useState(),
|
|
2625
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
2626
|
-
allFieldOptions = _useState6[0],
|
|
2627
|
-
setAllFieldOptions = _useState6[1];
|
|
2628
|
-
|
|
2629
|
-
var onFieldSwitch = function onFieldSwitch(oldId, newId) {
|
|
2630
|
-
if (typeof props.onFieldSwitch === 'function') {
|
|
2631
|
-
props.onFieldSwitch(oldId, newId);
|
|
2632
|
-
}
|
|
2633
|
-
};
|
|
2634
|
-
|
|
2635
|
-
var onFieldValueChange = function onFieldValueChange(fieldId, value, event) {
|
|
2636
|
-
if (typeof props.onFieldInputChange === 'function') {
|
|
2637
|
-
props.onFieldInputChange(fieldId, value, event);
|
|
2638
|
-
}
|
|
2639
|
-
};
|
|
2640
|
-
|
|
2641
|
-
var onFieldNameChange = function onFieldNameChange(fieldId, event) {
|
|
2642
|
-
var changeFn = _get__default["default"](props, 'customFieldOptions.onCustomFieldNameChange');
|
|
2643
|
-
|
|
2644
|
-
if (typeof changeFn === 'function') {
|
|
2645
|
-
changeFn(fieldId, event);
|
|
2646
|
-
}
|
|
2647
|
-
};
|
|
2648
|
-
|
|
2649
|
-
var getFieldRows = function getFieldRows() {
|
|
2650
|
-
return fieldsInUse.map(function (field) {
|
|
2651
|
-
return React__default["default"].createElement(FieldRow, {
|
|
2652
|
-
customInput: field.children,
|
|
2653
|
-
required: field.required,
|
|
2654
|
-
fieldName: field.name,
|
|
2655
|
-
id: field.id,
|
|
2656
|
-
subMenu: field.subMenu,
|
|
2657
|
-
subMenuLabel: field.subMenuLabel,
|
|
2658
|
-
nameTooltip: field.type === CUSTOM_TYPE ? _get__default["default"](props, 'customFieldOptions.nameTooltip', '') : field.nameTooltip,
|
|
2659
|
-
valueTooltip: field.type === CUSTOM_TYPE ? _get__default["default"](props, 'customFieldOptions.valueTooltip', '') : field.valueTooltip,
|
|
2660
|
-
onFieldNameChange: onFieldNameChange,
|
|
2661
|
-
onFieldValueChange: onFieldValueChange,
|
|
2662
|
-
onFieldSwitch: onFieldSwitch,
|
|
2663
|
-
onRemove: onFieldRemove,
|
|
2664
|
-
isCustom: field.type === CUSTOM_TYPE,
|
|
2665
|
-
key: field.id,
|
|
2666
|
-
value: field.value,
|
|
2667
|
-
valuePlaceholder: field.type === CUSTOM_TYPE ? _get__default["default"](props, 'customFieldOptions.valuePlaceholder', '') : field.valuePlaceholder,
|
|
2668
|
-
customNamePlaceholder: _get__default["default"](props, 'customFieldOptions.namePlaceholder', ''),
|
|
2669
|
-
pipedTextItems: props.pipedTextItems,
|
|
2670
|
-
searchable: props.searchable
|
|
2671
|
-
}, allFieldOptions && getFieldsForFieldRow(availableFields, allFieldOptions, field.id));
|
|
2672
|
-
});
|
|
2673
|
-
};
|
|
2674
|
-
|
|
2675
|
-
var getFieldsForFieldRow = function getFieldsForFieldRow(allAvailableFields, allFields, fieldId) {
|
|
2676
|
-
var fieldsToAdd = allAvailableFields.slice();
|
|
2677
|
-
allFields.forEach(function (field) {
|
|
2678
|
-
if (field.subMenu !== undefined && fieldId === field.id) {
|
|
2679
|
-
var foundIndex = fieldsToAdd.findIndex(function (fieldToAdd) {
|
|
2680
|
-
return fieldToAdd.id === field.id;
|
|
2681
|
-
});
|
|
2682
|
-
|
|
2683
|
-
if (foundIndex === -1) {
|
|
2684
|
-
fieldsToAdd.push(field);
|
|
2685
|
-
}
|
|
2686
|
-
}
|
|
2687
|
-
});
|
|
2688
|
-
return fieldsToAdd;
|
|
2689
|
-
};
|
|
2690
|
-
|
|
2691
|
-
var onFieldAdd = function onFieldAdd(fieldId) {
|
|
2692
|
-
if (typeof props.onFieldAdd === 'function') {
|
|
2693
|
-
props.onFieldAdd(fieldId);
|
|
2694
|
-
}
|
|
2695
|
-
};
|
|
2696
|
-
|
|
2697
|
-
var onCustomFieldAdd = function onCustomFieldAdd() {
|
|
2698
|
-
var handleFn = _get__default["default"](props, 'customFieldOptions.onCustomFieldAdd', function () {});
|
|
2699
|
-
|
|
2700
|
-
handleFn();
|
|
2701
|
-
};
|
|
2702
|
-
|
|
2703
|
-
var getAvailableFields = function getAvailableFields() {
|
|
2704
|
-
return availableFields.map(function (field) {
|
|
2705
|
-
return React__default["default"].createElement(FieldItem, {
|
|
2706
|
-
name: field.name,
|
|
2707
|
-
type: field.type,
|
|
2708
|
-
required: field.required,
|
|
2709
|
-
key: field.id,
|
|
2710
|
-
id: field.id,
|
|
2711
|
-
subMenu: field.subMenu,
|
|
2712
|
-
subMenuLabel: field.subMenuLabel
|
|
2713
|
-
});
|
|
2714
|
-
});
|
|
2715
|
-
};
|
|
2716
|
-
|
|
2717
|
-
var onFieldRemove = function onFieldRemove(fieldId) {
|
|
2718
|
-
if (typeof props.onFieldRemove === 'function') {
|
|
2719
|
-
props.onFieldRemove(fieldId);
|
|
2720
|
-
}
|
|
2721
|
-
};
|
|
2722
|
-
|
|
2723
|
-
var getFieldsInUse = function getFieldsInUse(allFieldOptions) {
|
|
2724
|
-
var nextFieldsInUse = [];
|
|
2725
|
-
var taskFieldsChildren;
|
|
2726
|
-
|
|
2727
|
-
if (allFieldOptions === undefined) {
|
|
2728
|
-
return undefined;
|
|
2729
|
-
}
|
|
2730
|
-
|
|
2731
|
-
if (!Array.isArray(props.children)) {
|
|
2732
|
-
taskFieldsChildren = [];
|
|
2733
|
-
taskFieldsChildren.push(props.children);
|
|
2734
|
-
} else {
|
|
2735
|
-
taskFieldsChildren = props.children;
|
|
2736
|
-
}
|
|
2737
|
-
|
|
2738
|
-
nextFieldsInUse = getRequiredFields(taskFieldsChildren);
|
|
2739
|
-
nextFieldsInUse = getFieldsWithValues(nextFieldsInUse);
|
|
2740
|
-
nextFieldsInUse = getInlineFields(nextFieldsInUse, taskFieldsChildren);
|
|
2741
|
-
return nextFieldsInUse;
|
|
2742
|
-
|
|
2743
|
-
function getInlineFields(fieldsInUse, fieldChildren) {
|
|
2744
|
-
var nextFieldsInUse = fieldsInUse.slice();
|
|
2745
|
-
var values = props.values || [];
|
|
2746
|
-
nextFieldsInUse = nextFieldsInUse.map(function (nextFieldInUse) {
|
|
2747
|
-
var foundFieldValue, foundNextChild, foundFieldOption;
|
|
2748
|
-
foundFieldValue = values.find(function (value) {
|
|
2749
|
-
return value.id === nextFieldInUse.id;
|
|
2750
|
-
});
|
|
2751
|
-
foundFieldOption = fieldChildren.find(function (child) {
|
|
2752
|
-
return child.props.id === foundFieldValue.id;
|
|
2753
|
-
});
|
|
2754
|
-
|
|
2755
|
-
if (foundFieldOption !== undefined && !nextFieldInUse.required) {
|
|
2756
|
-
foundNextChild = fieldChildren.find(function (nextChild) {
|
|
2757
|
-
return nextChild.props.id === foundFieldValue.id;
|
|
2758
|
-
});
|
|
2759
|
-
nextFieldInUse = Object.assign({}, nextFieldInUse, {
|
|
2760
|
-
name: foundNextChild.props.name,
|
|
2761
|
-
id: foundNextChild.props.id,
|
|
2762
|
-
children: foundNextChild.props.children,
|
|
2763
|
-
nameTooltip: foundNextChild.props.nameTooltip,
|
|
2764
|
-
valueTooltip: foundNextChild.props.valueTooltip,
|
|
2765
|
-
valuePlaceholder: foundNextChild.props.valuePlaceholder,
|
|
2766
|
-
subMenu: foundNextChild.props.subMenu,
|
|
2767
|
-
subMenuLabel: foundNextChild.props.subMenuLabel
|
|
2768
|
-
});
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2771
|
-
return nextFieldInUse;
|
|
2772
|
-
});
|
|
2773
|
-
return nextFieldsInUse;
|
|
2774
|
-
}
|
|
2775
|
-
|
|
2776
|
-
function getRequiredFields(fieldsToSearch) {
|
|
2777
|
-
var requiredFields = [];
|
|
2778
|
-
fieldsToSearch.forEach(function (field) {
|
|
2779
|
-
if (field.props.required) {
|
|
2780
|
-
requiredFields.push({
|
|
2781
|
-
required: field.props.required,
|
|
2782
|
-
name: field.props.name,
|
|
2783
|
-
id: field.props.id,
|
|
2784
|
-
children: field.props.children,
|
|
2785
|
-
nameTooltip: field.props.nameTooltip,
|
|
2786
|
-
valueTooltip: field.props.valueTooltip,
|
|
2787
|
-
value: field.props.value || undefined,
|
|
2788
|
-
valuePlaceholder: field.props.valuePlaceholder,
|
|
2789
|
-
subMenu: field.props.subMenu,
|
|
2790
|
-
subMenuLabel: field.props.subMenuLabel
|
|
2791
|
-
});
|
|
2792
|
-
}
|
|
2793
|
-
});
|
|
2794
|
-
return requiredFields;
|
|
2795
|
-
}
|
|
2796
|
-
|
|
2797
|
-
function getFieldsWithValues(fieldsInUse) {
|
|
2798
|
-
var nextFieldsInUse = fieldsInUse.slice();
|
|
2799
|
-
var fieldValues = props.values || [];
|
|
2800
|
-
fieldValues.forEach(function (currentField) {
|
|
2801
|
-
var fieldMetadata = allFieldOptions.find(function (field) {
|
|
2802
|
-
return field.id === currentField.id;
|
|
2803
|
-
});
|
|
2804
|
-
|
|
2805
|
-
if (fieldMetadata !== undefined) {
|
|
2806
|
-
setFieldValue(nextFieldsInUse, currentField, fieldMetadata);
|
|
2807
|
-
} else if (props.customFieldOptions) {
|
|
2808
|
-
var customFieldValue = {
|
|
2809
|
-
required: false,
|
|
2810
|
-
name: currentField.name,
|
|
2811
|
-
id: currentField.id,
|
|
2812
|
-
value: currentField.value,
|
|
2813
|
-
nameTooltip: _get__default["default"](props, 'customFieldOptions.nameTooltip', ''),
|
|
2814
|
-
valueTooltip: _get__default["default"](props, 'customFieldOptions.valueTooltip', ''),
|
|
2815
|
-
namePlaceholder: _get__default["default"](props, 'customFieldOptions.namePlaceholder', ''),
|
|
2816
|
-
type: CUSTOM_TYPE,
|
|
2817
|
-
subMenu: currentField.subMenu,
|
|
2818
|
-
subMenuLabel: currentField.subMenuLabel
|
|
2819
|
-
};
|
|
2820
|
-
nextFieldsInUse.push(customFieldValue);
|
|
2821
|
-
}
|
|
2822
|
-
});
|
|
2823
|
-
return nextFieldsInUse;
|
|
2824
|
-
|
|
2825
|
-
function setFieldValue(fieldsInUse, fieldValue, fieldMetadata) {
|
|
2826
|
-
var field = fieldsInUse.find(function (field) {
|
|
2827
|
-
return field.id === fieldValue.id;
|
|
2828
|
-
});
|
|
2829
|
-
|
|
2830
|
-
if (field !== undefined) {
|
|
2831
|
-
field.value = fieldValue.value;
|
|
2832
|
-
} else {
|
|
2833
|
-
var newField = _cloneDeepWith__default["default"](fieldMetadata, function (value) {
|
|
2834
|
-
if (React__default["default"].isValidElement(value)) {
|
|
2835
|
-
return React__default["default"].cloneElement(value);
|
|
2836
|
-
}
|
|
2837
|
-
});
|
|
2838
|
-
|
|
2839
|
-
newField.value = fieldValue.value;
|
|
2840
|
-
fieldsInUse.push(newField);
|
|
2841
|
-
}
|
|
2842
|
-
}
|
|
2843
|
-
}
|
|
2844
|
-
};
|
|
2845
|
-
|
|
2846
|
-
var updateAvailableFields = function updateAvailableFields() {
|
|
2847
|
-
var nextAllFieldOptions = props.children.map(function (child) {
|
|
2848
|
-
var childProps = child.props;
|
|
2849
|
-
return {
|
|
2850
|
-
required: childProps.required,
|
|
2851
|
-
name: childProps.name,
|
|
2852
|
-
id: childProps.id,
|
|
2853
|
-
children: childProps.children,
|
|
2854
|
-
nameTooltip: childProps.nameTooltip,
|
|
2855
|
-
valueTooltip: childProps.valueTooltip,
|
|
2856
|
-
valuePlaceholder: childProps.valuePlaceholder,
|
|
2857
|
-
subMenu: childProps.subMenu,
|
|
2858
|
-
subMenuLabel: childProps.subMenuLabel
|
|
2859
|
-
};
|
|
2860
|
-
});
|
|
2861
|
-
var nextFieldsInUse = getFieldsInUse(nextAllFieldOptions);
|
|
2862
|
-
var nextAvailableFields = nextAllFieldOptions.filter(function (field) {
|
|
2863
|
-
var foundFieldIdx = nextFieldsInUse.findIndex(function (usedField) {
|
|
2864
|
-
return field.id === usedField.id;
|
|
2865
|
-
});
|
|
2866
|
-
return foundFieldIdx === -1;
|
|
2867
|
-
});
|
|
2868
|
-
setAllFieldOptions(nextAllFieldOptions);
|
|
2869
|
-
setFieldsInUse(nextFieldsInUse);
|
|
2870
|
-
setAvailableFields(nextAvailableFields);
|
|
2871
|
-
};
|
|
2872
|
-
|
|
2873
|
-
React.useEffect(function () {
|
|
2874
|
-
updateAvailableFields();
|
|
2875
|
-
}, []);
|
|
2876
|
-
React.useEffect(function () {
|
|
2877
|
-
updateAvailableFields();
|
|
2878
|
-
}, [props.values]);
|
|
2879
|
-
return React__default["default"].createElement("div", {
|
|
2880
|
-
className: "task-fields"
|
|
2881
|
-
}, React__default["default"].createElement("div", {
|
|
2882
|
-
className: "field-table",
|
|
2883
|
-
tabIndex: "0"
|
|
2884
|
-
}, React__default["default"].createElement("div", {
|
|
2885
|
-
className: "field-headers"
|
|
2886
|
-
}, React__default["default"].createElement(AddFieldHeaders, {
|
|
2887
|
-
itemHeaderText: props.fieldItemsHeaderText,
|
|
2888
|
-
inputHeaderText: props.fieldInputsHeaderText
|
|
2889
|
-
})), React__default["default"].createElement("div", {
|
|
2890
|
-
className: "field-rows"
|
|
2891
|
-
}, getFieldRows())), React__default["default"].createElement("div", {
|
|
2892
|
-
className: "add-field-container"
|
|
2893
|
-
}, React__default["default"].createElement(AddFieldButton, {
|
|
2894
|
-
label: props.addFieldLabel,
|
|
2895
|
-
onFieldAdded: onFieldAdd,
|
|
2896
|
-
disableAddFieldPopover: props.disableAddFieldPopover,
|
|
2897
|
-
allowCustom: props.customFieldOptions,
|
|
2898
|
-
customLabel: _get__default["default"](props, 'customFieldOptions.label', ''),
|
|
2899
|
-
onCustomFieldAdded: props.customFieldOptions ? onCustomFieldAdd : function () {}
|
|
2900
|
-
}, getAvailableFields())));
|
|
2901
|
-
}
|
|
2902
|
-
|
|
2903
|
-
function AddFieldButton(props) {
|
|
2904
|
-
var label = props.label || '';
|
|
2905
|
-
var customLabel = props.customLabel || '';
|
|
2906
|
-
var disableAddFieldPopover = props.disableAddFieldPopover;
|
|
2907
|
-
|
|
2908
|
-
var _useState7 = React.useState(false),
|
|
2909
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
2910
|
-
popoverShow = _useState8[0],
|
|
2911
|
-
setPopoverShow = _useState8[1];
|
|
2912
|
-
|
|
2913
|
-
var customId = uuidv4();
|
|
2914
|
-
var CUSTOM_OPTION = React__default["default"].createElement(FieldItem, {
|
|
2915
|
-
key: customId,
|
|
2916
|
-
onClick: function onClick() {
|
|
2917
|
-
props.onCustomFieldAdded();
|
|
2918
|
-
setPopoverShow(false);
|
|
2919
|
-
},
|
|
2920
|
-
id: customId,
|
|
2921
|
-
name: customLabel
|
|
2922
|
-
});
|
|
2923
|
-
|
|
2924
|
-
var onPopoverClose = function onPopoverClose() {
|
|
2925
|
-
setPopoverShow(false);
|
|
2926
|
-
};
|
|
2927
|
-
|
|
2928
|
-
var children = [];
|
|
2929
|
-
|
|
2930
|
-
var onPopoverAnchorClick = function onPopoverAnchorClick() {
|
|
2931
|
-
if (!disableAddFieldPopover) {
|
|
2932
|
-
setPopoverShow(!popoverShow);
|
|
2933
|
-
} else {
|
|
2934
|
-
props.onFieldAdded(props.children !== 0 ? getFieldIdWhenPopoverIsClicked(props.children[0].props) : '');
|
|
2935
|
-
}
|
|
2936
|
-
};
|
|
2937
|
-
|
|
2938
|
-
var getFieldIdWhenPopoverIsClicked = function getFieldIdWhenPopoverIsClicked(field) {
|
|
2939
|
-
if (field.subMenu) {
|
|
2940
|
-
return getFieldIdWhenPopoverIsClicked(field.subMenu[0]);
|
|
2941
|
-
} else {
|
|
2942
|
-
return field.id;
|
|
2943
|
-
}
|
|
2944
|
-
};
|
|
2945
|
-
|
|
2946
|
-
children = props.children.map(function (child) {
|
|
2947
|
-
return React__default["default"].createElement(FieldItem, {
|
|
2948
|
-
name: child.props.name,
|
|
2949
|
-
key: child.props.id,
|
|
2950
|
-
id: child.props.id,
|
|
2951
|
-
subMenu: child.props.subMenu,
|
|
2952
|
-
onClick: function onClick(fieldId) {
|
|
2953
|
-
setPopoverShow(false);
|
|
2954
|
-
props.onFieldAdded(fieldId);
|
|
2955
|
-
}
|
|
2956
|
-
});
|
|
2957
|
-
});
|
|
2958
|
-
|
|
2959
|
-
if (props.allowCustom) {
|
|
2960
|
-
children.push(CUSTOM_OPTION);
|
|
2961
|
-
}
|
|
2962
|
-
|
|
2963
|
-
return React__default["default"].createElement("div", {
|
|
2964
|
-
className: "add-field-button-container"
|
|
2965
|
-
}, React__default["default"].createElement(Popover, {
|
|
2966
|
-
show: popoverShow,
|
|
2967
|
-
onClose: onPopoverClose,
|
|
2968
|
-
ignoreClickSelector: ".add-field-button",
|
|
2969
|
-
anchor: React__default["default"].createElement(uiReact.Button, {
|
|
2970
|
-
disabled: children.length === 0,
|
|
2971
|
-
kind: "secondary",
|
|
2972
|
-
className: "add-field-button",
|
|
2973
|
-
onClick: onPopoverAnchorClick
|
|
2974
|
-
}, React__default["default"].createElement("span", {
|
|
2975
|
-
className: "add-field-button-label"
|
|
2976
|
-
}, label))
|
|
2977
|
-
}, children));
|
|
2978
|
-
}
|
|
2979
|
-
|
|
2980
|
-
function AddFieldHeaders(props) {
|
|
2981
|
-
var itemHeaderText = props.itemHeaderText,
|
|
2982
|
-
inputHeaderText = props.inputHeaderText;
|
|
2983
|
-
|
|
2984
|
-
if (itemHeaderText || inputHeaderText) {
|
|
2985
|
-
return React__default["default"].createElement("div", {
|
|
2986
|
-
className: "field-row"
|
|
2987
|
-
}, React__default["default"].createElement("div", {
|
|
2988
|
-
className: "field-selector"
|
|
2989
|
-
}, React__default["default"].createElement(uiReact.Label, null, itemHeaderText)), React__default["default"].createElement("div", {
|
|
2990
|
-
className: "field-input"
|
|
2991
|
-
}, React__default["default"].createElement(uiReact.Label, null, inputHeaderText)));
|
|
2992
|
-
} else {
|
|
2993
|
-
return null;
|
|
2994
|
-
}
|
|
2995
|
-
}
|
|
2996
|
-
|
|
2997
|
-
var css_248z$8 = ".select-item .item {\n padding: 5px 32px;\n display: inline-flex;\n align-items: center;\n box-sizing: border-box;\n width: 100%; }\n .select-item .item .checked-container, .select-item .item .item-content {\n display: inline-block; }\n .select-item .item .checked-container {\n margin-bottom: -3px;\n transition: opacity cubic-bezier(0.4, 0, 0.2, 1) 0.1s; }\n .select-item .item .checked-container.checked {\n opacity: 1; }\n .select-item .item .checked-container:not(.checked) {\n opacity: 0; }\n .select-item .item:hover {\n cursor: pointer;\n user-select: none;\n background: #007ac0;\n color: #fff;\n fill: #fff; }\n";
|
|
2998
|
-
styleInject(css_248z$8);
|
|
2999
|
-
|
|
3000
|
-
function SelectItem(props) {
|
|
3001
|
-
var checked = props.checked || false;
|
|
3002
|
-
var children = props.children || '';
|
|
3003
|
-
return React__default["default"].createElement("div", {
|
|
3004
|
-
className: "select-item",
|
|
3005
|
-
onClick: function onClick(event) {
|
|
3006
|
-
return props.onChange(props.value, event);
|
|
3007
|
-
}
|
|
3008
|
-
}, React__default["default"].createElement("div", {
|
|
3009
|
-
className: "item"
|
|
3010
|
-
}, React__default["default"].createElement("div", {
|
|
3011
|
-
className: "checked-container ".concat(checked ? 'checked' : '')
|
|
3012
|
-
}, React__default["default"].createElement(uiReact.Icon, {
|
|
3013
|
-
type: uiReact.IconTypes.Check,
|
|
3014
|
-
size: "medium"
|
|
3015
|
-
})), React__default["default"].createElement("div", {
|
|
3016
|
-
className: "item-content"
|
|
3017
|
-
}, children)));
|
|
3018
|
-
}
|
|
3019
|
-
|
|
3020
|
-
var css_248z$7 = "";
|
|
3021
|
-
styleInject(css_248z$7);
|
|
3022
|
-
|
|
3023
|
-
function MultiselectDropdown(props) {
|
|
3024
|
-
var _useState = React.useState(false),
|
|
3025
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3026
|
-
isDropdownOpen = _useState2[0],
|
|
3027
|
-
setIsDropdownOpen = _useState2[1];
|
|
3028
|
-
|
|
3029
|
-
var label = props.label || '';
|
|
3030
|
-
|
|
3031
|
-
var onPopoverClose = function onPopoverClose() {
|
|
3032
|
-
setIsDropdownOpen(false);
|
|
3033
|
-
};
|
|
3034
|
-
|
|
3035
|
-
var handleChange = function handleChange(value, event) {
|
|
3036
|
-
if (typeof props.onChange === 'function') {
|
|
3037
|
-
props.onChange(value, event);
|
|
3038
|
-
}
|
|
3039
|
-
};
|
|
3040
|
-
|
|
3041
|
-
var renderToggleButton = function renderToggleButton() {
|
|
3042
|
-
return React__default["default"].createElement("div", {
|
|
3043
|
-
className: "multiselect-dropdown-toggle"
|
|
3044
|
-
}, React__default["default"].createElement(uiReact.Button, {
|
|
3045
|
-
onClick: function onClick() {
|
|
3046
|
-
setIsDropdownOpen(!isDropdownOpen);
|
|
3047
|
-
}
|
|
3048
|
-
}, label));
|
|
3049
|
-
};
|
|
3050
|
-
|
|
3051
|
-
var children = props.children || [];
|
|
3052
|
-
|
|
3053
|
-
if (!Array.isArray(children)) {
|
|
3054
|
-
var temp = [];
|
|
3055
|
-
temp.push(children);
|
|
3056
|
-
children = temp;
|
|
3057
|
-
}
|
|
3058
|
-
|
|
3059
|
-
return React__default["default"].createElement("div", {
|
|
3060
|
-
className: "multiselect-dropdown"
|
|
3061
|
-
}, React__default["default"].createElement(Popover, {
|
|
3062
|
-
show: isDropdownOpen,
|
|
3063
|
-
onClose: onPopoverClose,
|
|
3064
|
-
ignoreClickSelector: ".multiselect-dropdown-toggle",
|
|
3065
|
-
anchor: renderToggleButton()
|
|
3066
|
-
}, children.map(function (child) {
|
|
3067
|
-
return React__default["default"].createElement(SelectItem, {
|
|
3068
|
-
onChange: handleChange,
|
|
3069
|
-
checked: child.props.checked,
|
|
3070
|
-
value: child.props.value,
|
|
3071
|
-
key: child.props.value
|
|
3072
|
-
}, child.props.children);
|
|
3073
|
-
})));
|
|
3074
|
-
}
|
|
3075
|
-
|
|
3076
|
-
var css_248z$6 = ".dynamic-search-input .search-input {\n box-sizing: border-box; }\n\n.dynamic-search-popover-child {\n padding: 5px 32px; }\n .dynamic-search-popover-child:hover {\n cursor: pointer;\n user-select: none;\n background: #007ac0;\n color: #fff;\n fill: #fff; }\n";
|
|
3077
|
-
styleInject(css_248z$6);
|
|
3078
|
-
|
|
3079
|
-
function DynamicSearchInput(props) {
|
|
3080
|
-
var _useState = React.useState(false),
|
|
3081
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3082
|
-
isDropdownOpen = _useState2[0],
|
|
3083
|
-
setIsDropdownOpen = _useState2[1];
|
|
3084
|
-
|
|
3085
|
-
var _useState3 = React.useState([]),
|
|
3086
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
3087
|
-
searchResults = _useState4[0],
|
|
3088
|
-
setSearchResults = _useState4[1];
|
|
3089
|
-
|
|
3090
|
-
var _useState5 = React.useState(''),
|
|
3091
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
3092
|
-
inputValue = _useState6[0],
|
|
3093
|
-
setInputValue = _useState6[1];
|
|
3094
|
-
|
|
3095
|
-
React.useEffect(function () {
|
|
3096
|
-
if (props.search && typeof props.search !== 'function') {
|
|
3097
|
-
throw new Error('DynamicSearchInput: Expected function for search property');
|
|
3098
|
-
}
|
|
3099
|
-
|
|
3100
|
-
if (props.onChange && typeof props.onChange !== 'function') {
|
|
3101
|
-
throw new Error("DynamicSearchInput: Expected onChange to be a function. Received type ".concat(_typeof(props.onChange)));
|
|
3102
|
-
}
|
|
3103
|
-
|
|
3104
|
-
if (!props.search && props.items === undefined) {
|
|
3105
|
-
throw new Error('DynamicSearchInput: Expected one of either items or search function but found neither');
|
|
3106
|
-
}
|
|
3107
|
-
|
|
3108
|
-
if (props.search && props.items !== undefined) {
|
|
3109
|
-
throw new Error('DynamicSearchInput: Expected one of either items or search function but found both');
|
|
3110
|
-
}
|
|
3111
|
-
|
|
3112
|
-
if (props.items !== undefined) {
|
|
3113
|
-
if (!Array.isArray(props.items)) {
|
|
3114
|
-
throw new Error('DynamicSearchInput: expected items property to be an Array');
|
|
3115
|
-
}
|
|
3116
|
-
|
|
3117
|
-
props.items.forEach(function (item) {
|
|
3118
|
-
if (item.props.label === undefined) {
|
|
3119
|
-
throw new Error('DynamicSearchInput: expected items in items property to have "label" property');
|
|
3120
|
-
}
|
|
3121
|
-
});
|
|
3122
|
-
}
|
|
3123
|
-
}, []);
|
|
3124
|
-
|
|
3125
|
-
var handleChange = function handleChange(value, event) {
|
|
3126
|
-
if (typeof props.onChange === 'function') {
|
|
3127
|
-
props.onChange(value, event);
|
|
3128
|
-
}
|
|
3129
|
-
};
|
|
3130
|
-
|
|
3131
|
-
var handleSearchItemSelected = function handleSearchItemSelected(value) {
|
|
3132
|
-
setInputValue(value);
|
|
3133
|
-
handleChange(value);
|
|
3134
|
-
setIsDropdownOpen(false);
|
|
3135
|
-
};
|
|
3136
|
-
|
|
3137
|
-
var onPopoverClose = function onPopoverClose() {
|
|
3138
|
-
setIsDropdownOpen(false);
|
|
3139
|
-
};
|
|
3140
|
-
|
|
3141
|
-
var defaultSearch = function () {
|
|
3142
|
-
var _ref = _asyncToGenerator(_regeneratorRuntime().mark(function _callee(value) {
|
|
3143
|
-
var results;
|
|
3144
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3145
|
-
while (1) {
|
|
3146
|
-
switch (_context.prev = _context.next) {
|
|
3147
|
-
case 0:
|
|
3148
|
-
value = ((value || '') + '').trim().toLowerCase();
|
|
3149
|
-
|
|
3150
|
-
if (!(value === '')) {
|
|
3151
|
-
_context.next = 3;
|
|
3152
|
-
break;
|
|
3153
|
-
}
|
|
3154
|
-
|
|
3155
|
-
return _context.abrupt("return", []);
|
|
3156
|
-
|
|
3157
|
-
case 3:
|
|
3158
|
-
results = props.items.filter(function (item) {
|
|
3159
|
-
return item.props.label.toLowerCase().includes(value);
|
|
3160
|
-
});
|
|
3161
|
-
return _context.abrupt("return", results);
|
|
3162
|
-
|
|
3163
|
-
case 5:
|
|
3164
|
-
case "end":
|
|
3165
|
-
return _context.stop();
|
|
3166
|
-
}
|
|
3167
|
-
}
|
|
3168
|
-
}, _callee);
|
|
3169
|
-
}));
|
|
3170
|
-
|
|
3171
|
-
return function defaultSearch(_x) {
|
|
3172
|
-
return _ref.apply(this, arguments);
|
|
3173
|
-
};
|
|
3174
|
-
}();
|
|
3175
|
-
|
|
3176
|
-
var handleInputChange = function () {
|
|
3177
|
-
var _ref2 = _asyncToGenerator(_regeneratorRuntime().mark(function _callee2(event) {
|
|
3178
|
-
var inputVal, searchFunc, results, resultsType, nextSearchResults;
|
|
3179
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3180
|
-
while (1) {
|
|
3181
|
-
switch (_context2.prev = _context2.next) {
|
|
3182
|
-
case 0:
|
|
3183
|
-
event.persist();
|
|
3184
|
-
inputVal = _get__default["default"](event, 'target.value', '');
|
|
3185
|
-
searchFunc = props.search ? props.search : defaultSearch;
|
|
3186
|
-
_context2.next = 5;
|
|
3187
|
-
return searchFunc(inputVal);
|
|
3188
|
-
|
|
3189
|
-
case 5:
|
|
3190
|
-
results = _context2.sent;
|
|
3191
|
-
|
|
3192
|
-
if (Array.isArray(results)) {
|
|
3193
|
-
_context2.next = 9;
|
|
3194
|
-
break;
|
|
3195
|
-
}
|
|
3196
|
-
|
|
3197
|
-
resultsType = typeof results === 'undefined' && 'undefined' || results === null && 'null' || results.constructor && results.constructor.name || results;
|
|
3198
|
-
throw new Error("DynamicSearchInput: expected result from search function to be Array, but was ".concat(resultsType));
|
|
3199
|
-
|
|
3200
|
-
case 9:
|
|
3201
|
-
nextSearchResults = results.map(function (result) {
|
|
3202
|
-
if (_get__default["default"](result, 'props.label') === undefined) {
|
|
3203
|
-
throw new Error('DynamicSearchInput: expected search result array values to have label property but found none');
|
|
3204
|
-
}
|
|
3205
|
-
|
|
3206
|
-
return React__default["default"].createElement(SearchItem, {
|
|
3207
|
-
key: result.props.id,
|
|
3208
|
-
onClick: function onClick() {
|
|
3209
|
-
handleSearchItemSelected(result.props.label);
|
|
3210
|
-
}
|
|
3211
|
-
}, result);
|
|
3212
|
-
});
|
|
3213
|
-
setInputValue(inputVal);
|
|
3214
|
-
|
|
3215
|
-
if (nextSearchResults.length > 0) {
|
|
3216
|
-
setIsDropdownOpen(true);
|
|
3217
|
-
} else {
|
|
3218
|
-
setIsDropdownOpen(false);
|
|
3219
|
-
}
|
|
3220
|
-
|
|
3221
|
-
setSearchResults(nextSearchResults);
|
|
3222
|
-
handleChange(inputVal, event);
|
|
3223
|
-
|
|
3224
|
-
case 14:
|
|
3225
|
-
case "end":
|
|
3226
|
-
return _context2.stop();
|
|
3227
|
-
}
|
|
3228
|
-
}
|
|
3229
|
-
}, _callee2);
|
|
3230
|
-
}));
|
|
3231
|
-
|
|
3232
|
-
return function handleInputChange(_x2) {
|
|
3233
|
-
return _ref2.apply(this, arguments);
|
|
3234
|
-
};
|
|
3235
|
-
}();
|
|
3236
|
-
|
|
3237
|
-
return React__default["default"].createElement("div", {
|
|
3238
|
-
className: "dynamic-search-input"
|
|
3239
|
-
}, React__default["default"].createElement(Popover, {
|
|
3240
|
-
show: isDropdownOpen,
|
|
3241
|
-
onClose: onPopoverClose,
|
|
3242
|
-
anchor: React__default["default"].createElement(uiReact.Input, {
|
|
3243
|
-
className: "search-input",
|
|
3244
|
-
full: true,
|
|
3245
|
-
small: true,
|
|
3246
|
-
placeholder: props.placeholder,
|
|
3247
|
-
value: inputValue,
|
|
3248
|
-
onChange: handleInputChange
|
|
3249
|
-
})
|
|
3250
|
-
}, searchResults));
|
|
3251
|
-
}
|
|
3252
|
-
|
|
3253
|
-
function SearchItem(props) {
|
|
3254
|
-
return React__default["default"].createElement("div", {
|
|
3255
|
-
className: "dynamic-search-popover-child",
|
|
3256
|
-
onClick: props.onClick
|
|
3257
|
-
}, props.children);
|
|
3258
|
-
}
|
|
3259
|
-
|
|
3260
|
-
var css_248z$5 = ".capture-event .capture-event-controls {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 20px; }\n .capture-event .capture-event-controls .status-message {\n font-size: 12px;\n line-height: 16px;\n display: flex;\n align-items: center;\n gap: 4px; }\n .capture-event .capture-event-controls .status-message.pending {\n color: #74777a; }\n .capture-event .capture-event-controls .status-message.success {\n color: #107e3e;\n fill: #107e3e; }\n .capture-event .capture-event-controls .status-message.failure {\n color: #bb0000;\n fill: #bb0000; }\n";
|
|
3261
|
-
styleInject(css_248z$5);
|
|
3262
|
-
|
|
3263
|
-
function CaptureEvent(props) {
|
|
3264
|
-
return (React__default["default"].createElement("div", { className: "capture-event" },
|
|
3265
|
-
React__default["default"].createElement("div", { className: "capture-event-controls" },
|
|
3266
|
-
getCaptureEventButton(),
|
|
3267
|
-
getStatusMessage()),
|
|
3268
|
-
props.payload !== undefined && (React__default["default"].createElement(uiReact.FormField, { isReadOnly: true },
|
|
3269
|
-
React__default["default"].createElement(uiReact.InputField, { "aria-readonly": true, label: props.payloadLabelTranslation, multiline: true, readOnly: true, full: true, value: props.payload, className: "polled-response-output" })))));
|
|
3270
|
-
function getCaptureEventButton() {
|
|
3271
|
-
if (props.status === 'pending') {
|
|
3272
|
-
return (React__default["default"].createElement("div", { className: "capture-event-button-container" },
|
|
3273
|
-
React__default["default"].createElement(uiReact.Button, { kind: "secondary", onClick: function () { return props.onCancel(); } }, props.cancelCaptureTranslation)));
|
|
3274
|
-
}
|
|
3275
|
-
else {
|
|
3276
|
-
return (React__default["default"].createElement("div", { className: "capture-event-button-container" },
|
|
3277
|
-
React__default["default"].createElement(uiReact.Button, { kind: "primary", onClick: function () { return props.onStart(); } }, props.startCaptureTranslation)));
|
|
3278
|
-
}
|
|
3279
|
-
}
|
|
3280
|
-
function getStatusMessage() {
|
|
3281
|
-
var statusMessages = {
|
|
3282
|
-
default: ['', undefined],
|
|
3283
|
-
pending: [props.pendingStatusTranslation, React__default["default"].createElement(uiReact.LoadingSpinner, { size: "small", show: true })],
|
|
3284
|
-
success: [props.successStatusTranslation, React__default["default"].createElement(icons.SuccessIcon, { size: "small" })],
|
|
3285
|
-
failure: [props.failureStatusTranslation, React__default["default"].createElement(icons.ErrorIcon, { size: "small" })]
|
|
3286
|
-
};
|
|
3287
|
-
var _a = statusMessages[props.status], statusLabel = _a[0], statusIcon = _a[1];
|
|
3288
|
-
return (React__default["default"].createElement("div", { className: "status-message ".concat(props.status) },
|
|
3289
|
-
statusIcon,
|
|
3290
|
-
statusLabel));
|
|
3291
|
-
}
|
|
3292
|
-
}
|
|
3293
|
-
|
|
3294
|
-
var css_248z$4 = ".copy-text {\n display: flex;\n column-gap: 8px; }\n .copy-text .input-container {\n width: 100%; }\n .copy-text .input-container .input-textbox {\n width: 100%; }\n .copy-text .copy-button-container .selected-button {\n display: flex; }\n .copy-text .copy-button-container .selected-button .selected-button-text {\n display: flex;\n align-self: center; }\n";
|
|
3295
|
-
styleInject(css_248z$4);
|
|
3296
|
-
|
|
3297
|
-
var COPY_BUTTON_SELECTED_TEXT_TIME = 1.5 * 1000; // seconds * milliseconds
|
|
3298
|
-
function CopyText(props) {
|
|
3299
|
-
var _a = React.useState(false), copyButtonSelected = _a[0], setCopyButtonSelected = _a[1];
|
|
3300
|
-
return (React__default["default"].createElement("div", { className: "copy-text" },
|
|
3301
|
-
React__default["default"].createElement("div", { className: "input-container" },
|
|
3302
|
-
React__default["default"].createElement(uiReact.Input, { className: "input-textbox", defaultValue: props.text, "aria-readonly": true, readOnly: true })),
|
|
3303
|
-
React__default["default"].createElement("div", { className: "copy-button-container" },
|
|
3304
|
-
React__default["default"].createElement(uiReact.Button, { kind: "secondary", disabled: copyButtonSelected, onClick: copyTextToClipboard }, getCopyButtonContent()))));
|
|
3305
|
-
function copyTextToClipboard() {
|
|
3306
|
-
try {
|
|
3307
|
-
navigator.clipboard.writeText(props.text);
|
|
3308
|
-
setCopyButtonSelected(true);
|
|
3309
|
-
setTimeout(function () { return setCopyButtonSelected(false); }, COPY_BUTTON_SELECTED_TEXT_TIME);
|
|
3310
|
-
}
|
|
3311
|
-
catch (err) {
|
|
3312
|
-
console.error('Failed to copy text');
|
|
3313
|
-
console.error(err);
|
|
3314
|
-
}
|
|
3315
|
-
}
|
|
3316
|
-
function getCopyButtonContent() {
|
|
3317
|
-
if (copyButtonSelected) {
|
|
3318
|
-
return (React__default["default"].createElement("div", { className: "selected-button" },
|
|
3319
|
-
React__default["default"].createElement("div", { className: "selected-button-icon" },
|
|
3320
|
-
React__default["default"].createElement(icons.CheckIcon, null)),
|
|
3321
|
-
React__default["default"].createElement("div", { className: "selected-button-text" }, props.copySelectedTranslation)));
|
|
3322
|
-
}
|
|
3323
|
-
else {
|
|
3324
|
-
return (React__default["default"].createElement("div", { className: "default-button" }, props.copyTranslation));
|
|
3325
|
-
}
|
|
3326
|
-
}
|
|
3327
|
-
}
|
|
3328
|
-
|
|
3329
|
-
var css_248z$3 = ".field-mapper {\n padding-bottom: 12px; }\n .field-mapper .field-mapper-row-container .field-mapper-row {\n border-top: 1px solid #E5E5E5; }\n .field-mapper .field-mapper-row-container.field-mapper-header-row {\n margin-bottom: 10px;\n padding-left: 12px; }\n .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-row {\n border: 0; }\n .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-key, .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-value {\n border: 0;\n display: flex;\n align-items: center; }\n .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-key .field-mapper-header-cell, .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-value .field-mapper-header-cell {\n color: #6A6D70;\n font-weight: bold;\n font-size: 12px; }\n .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-key {\n padding-top: 0;\n padding-right: 24px;\n padding-bottom: 0;\n padding-left: 0; }\n .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-value {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n padding-left: 12px; }\n .field-mapper .add-field-button-container {\n padding-top: 12px; }\n";
|
|
3330
|
-
styleInject(css_248z$3);
|
|
3331
|
-
|
|
3332
|
-
function isString(val) {
|
|
3333
|
-
return (typeof val) === 'string';
|
|
3334
|
-
}
|
|
3335
|
-
|
|
3336
|
-
var css_248z$2 = ".field-mapper-row .field-mapper-row-content {\n display: flex;\n align-items: center; }\n .field-mapper-row .field-mapper-row-content .field-mapper-key {\n flex: 4;\n min-width: 33%; }\n .field-mapper-row .field-mapper-row-content .field-mapper-value {\n flex: 7; }\n .field-mapper-row .field-mapper-row-content .remove-row-container {\n min-height: 100%;\n padding: 8px 12px;\n border-left: 1px solid #E5E5E5; }\n .field-mapper-row .field-mapper-row-content .remove-row-container.hide-remove-button {\n border: 0; }\n .field-mapper-row .field-mapper-row-content .remove-row-container .empty-remove-button {\n min-width: 36px; }\n";
|
|
3337
|
-
styleInject(css_248z$2);
|
|
3338
|
-
|
|
3339
|
-
var css_248z$1 = ".field-mapper-key {\n padding-top: 8px;\n padding-right: 12px;\n padding-bottom: 8px;\n padding-left: 12px; }\n .field-mapper-key .field-mapper-key-select-container .field-mapper-key-dropdown {\n width: 100%; }\n .field-mapper-key .field-mapper-key-select-container .field-mapper-key-dropdown-button {\n width: 100%; }\n .field-mapper-key .field-mapper-key-select-container .field-mapper-key-disabled {\n opacity: 1;\n /*\n Styles below are copied \n verbatim from the styles on the <span> element\n in the QDS Dropdwon & DropdownButton components\n */\n /*[BEGIN COPIED STYLES]*/\n line-height: normal;\n padding: 0 4px 0 12px;\n display: inline-flex;\n justify-content: space-between;\n align-items: center;\n background-color: #fafafa;\n color: #32363a;\n border-color: rgba(137, 137, 137, 0.6);\n /*[END COPIED STYLES]*/ }\n .field-mapper-key .field-mapper-key-select-container .field-mapper-key-disabled .field-mapper-key-disabled-text {\n /*[BEGIN COPIED STYLES]*/\n font-size: 14px;\n white-space: nowrap;\n text-overflow: ellipsis;\n min-height: 10px;\n /*[END COPIED STYLES]*/\n opacity: 0.9; }\n .field-mapper-key .field-mapper-key-select-container .field-mapper-key-disabled .field-mapper-key-disabled-icon {\n /*[BEGIN COPIED STYLES]*/\n fill: #515559;\n /*[END COPIED STYLES]*/\n opacity: 0.6; }\n .field-mapper-key .field-mapper-key-select-container .required-field-container {\n display: flex; }\n .field-mapper-key .field-mapper-key-select-container .required-field-container .required-field-text {\n min-width: 0;\n font-size: 14px; }\n .field-mapper-key .field-mapper-key-select-container .required-field-container .required-field-symbol {\n margin-top: -2px; }\n";
|
|
3340
|
-
styleInject(css_248z$1);
|
|
3341
|
-
|
|
3342
|
-
var FieldMapperKey = React__default["default"].forwardRef(function FieldMapperKey(props, ref) {
|
|
3343
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3344
|
-
var availableFields;
|
|
3345
|
-
var onFieldKeyChange;
|
|
3346
|
-
availableFields = Array.isArray(props.availableFields)
|
|
3347
|
-
? props.availableFields
|
|
3348
|
-
: [];
|
|
3349
|
-
onFieldKeyChange = (typeof props.onChange === 'function')
|
|
3350
|
-
? props.onChange
|
|
3351
|
-
: function () { return undefined; };
|
|
3352
|
-
return (React__default["default"].createElement("div", { className: 'field-mapper-key' + (props.className ? ' ' + props.className : ''), ref: ref },
|
|
3353
|
-
React__default["default"].createElement(uiReact.Tooltip, { disabled: !props.tooltip, content: (_a = props.tooltip) !== null && _a !== void 0 ? _a : null }, ((React__default["default"].Children.count(props.children) > 0)
|
|
3354
|
-
? props.children
|
|
3355
|
-
: (React__default["default"].createElement("div", { className: "field-mapper-key-select-container" }, fieldMapperKeyDropdownDisabled()
|
|
3356
|
-
? (React__default["default"].createElement(uiReact.Button, { className: "field-mapper-key-disabled", disabled: true, full: true },
|
|
3357
|
-
React__default["default"].createElement("div", { className: "field-mapper-key-disabled-text" }, (_b = props.selectedField) === null || _b === void 0 ? void 0 : _b.label),
|
|
3358
|
-
React__default["default"].createElement(icons.ChevronDownIcon, { className: "field-mapper-key-disabled-icon", size: "medium", "aria-hidden": "true" })))
|
|
3359
|
-
: (((_c = props.selectedField) === null || _c === void 0 ? void 0 : _c.required) === true)
|
|
3360
|
-
? (React__default["default"].createElement("div", { className: "required-field-container" },
|
|
3361
|
-
React__default["default"].createElement("div", { className: "required-field-text" }, (_d = props.selectedField) === null || _d === void 0 ? void 0 : _d.label),
|
|
3362
|
-
React__default["default"].createElement("div", { className: "required-field-symbol" }, "*")))
|
|
3363
|
-
: (React__default["default"].createElement(uiReact.Dropdown, { className: "field-mapper-key-dropdown", onChange: handleFieldKeyChange },
|
|
3364
|
-
React__default["default"].createElement(uiReact.DropdownButton, { className: "field-mapper-key-dropdown-button", label: (_e = props.selectedField) === null || _e === void 0 ? void 0 : _e.label }),
|
|
3365
|
-
React__default["default"].createElement(uiReact.DropdownList, null, (_f = props.availableFields) === null || _f === void 0 ? void 0 : _f.map(function (fieldItem) {
|
|
3366
|
-
return (React__default["default"].createElement(uiReact.DropdownOption, { key: fieldItem.key, label: fieldItem.label, value: fieldItem.value }));
|
|
3367
|
-
}))))))))));
|
|
3368
|
-
function handleFieldKeyChange(value) {
|
|
3369
|
-
var foundSelectedFieldKey;
|
|
3370
|
-
foundSelectedFieldKey = availableFields.find(function (availableField) {
|
|
3371
|
-
return availableField.value === value;
|
|
3372
|
-
});
|
|
3373
|
-
if (foundSelectedFieldKey === undefined) {
|
|
3374
|
-
return;
|
|
3375
|
-
}
|
|
3376
|
-
onFieldKeyChange(props.selectedField, foundSelectedFieldKey);
|
|
3377
|
-
}
|
|
3378
|
-
function fieldMapperKeyDropdownDisabled() {
|
|
3379
|
-
var _a;
|
|
3380
|
-
var hasAvailableFields;
|
|
3381
|
-
hasAvailableFields = (availableFields === null || availableFields === void 0 ? void 0 : availableFields.length) > 0;
|
|
3382
|
-
return !hasAvailableFields && !((_a = props.selectedField) === null || _a === void 0 ? void 0 : _a.required);
|
|
3383
|
-
}
|
|
3384
|
-
});
|
|
3385
|
-
|
|
3386
|
-
var css_248z = ".field-mapper-value {\n border-left: 1px solid #E5E5E5;\n padding-top: 8px;\n padding-right: 12px;\n padding-bottom: 8px;\n padding-left: 12px; }\n";
|
|
3387
|
-
styleInject(css_248z);
|
|
3388
|
-
|
|
3389
|
-
var FieldMapperValue = React__default["default"].forwardRef(function FieldMapperValue(props, ref) {
|
|
3390
|
-
var _a, _b, _c;
|
|
3391
|
-
return (React__default["default"].createElement("div", { className: 'field-mapper-value' + (props.className ? ' ' + props.className : ''), ref: ref },
|
|
3392
|
-
React__default["default"].createElement(uiReact.Tooltip, { disabled: !props.tooltip, content: (_a = props.tooltip) !== null && _a !== void 0 ? _a : null }, ((React__default["default"].Children.count(props.children) > 0)
|
|
3393
|
-
? props.children
|
|
3394
|
-
: (React__default["default"].createElement("div", { className: "piped-text-input-value-container" },
|
|
3395
|
-
React__default["default"].createElement(PipedTextInput, { items: (_b = props.pipedTextItems) !== null && _b !== void 0 ? _b : [], onChange: (_c = props.onChange) !== null && _c !== void 0 ? _c : (function () { return undefined; }), value: props.inputValue })))))));
|
|
3396
|
-
});
|
|
3397
|
-
|
|
3398
|
-
var FieldMapperRow = React__default["default"].forwardRef(function FieldMapperRow(props, ref) {
|
|
3399
|
-
return (React__default["default"].createElement("div", { className: 'field-mapper-row' + (props.className ? ' ' + props.className : ''), ref: ref },
|
|
3400
|
-
React__default["default"].createElement("div", { className: "field-mapper-row-content" },
|
|
3401
|
-
React__default["default"].Children.map(props.children, function (child) {
|
|
3402
|
-
return getWrappedKeyValue(child);
|
|
3403
|
-
}),
|
|
3404
|
-
React__default["default"].createElement("div", { className: 'remove-row-container' + ((props.showRemove === false) ? ' hide-remove-button' : '') }, (props.showRemove === false)
|
|
3405
|
-
? (React__default["default"].createElement("div", { className: "empty-remove-button" }))
|
|
3406
|
-
: (React__default["default"].createElement(uiReact.IconButton
|
|
3407
|
-
/*
|
|
3408
|
-
TODO: Require an i18n string to be passed in for a11y labels
|
|
3409
|
-
*/
|
|
3410
|
-
, { "aria-label": "Remove", onClick: function ($e) { return handleRemoveClick(); } },
|
|
3411
|
-
React__default["default"].createElement(icons.RemoveItemIcon, null)))))));
|
|
3412
|
-
function handleRemoveClick(evt) {
|
|
3413
|
-
var _a;
|
|
3414
|
-
(_a = props.onFieldRemove) === null || _a === void 0 ? void 0 : _a.call(props, props.selectedField);
|
|
3415
|
-
}
|
|
3416
|
-
function getWrappedKeyValue(child) {
|
|
3417
|
-
var _a, _b, _c, _d;
|
|
3418
|
-
var wrappedEl;
|
|
3419
|
-
var fieldMapperKeyProps, fieldMapperValueProps;
|
|
3420
|
-
var includeAvailableFields, includeSelectedField, includeOnFieldKeyChange;
|
|
3421
|
-
var includePipedTextItems, includeOnFieldValueChange;
|
|
3422
|
-
fieldMapperKeyProps = {};
|
|
3423
|
-
fieldMapperValueProps = {};
|
|
3424
|
-
switch (child.type) {
|
|
3425
|
-
case FieldMapperKey:
|
|
3426
|
-
includeAvailableFields = (!Array.isArray(child.props.availableFields)
|
|
3427
|
-
&& (((_a = props.availableFields) === null || _a === void 0 ? void 0 : _a.length) > 0));
|
|
3428
|
-
includeSelectedField = (((typeof child.props.selectedField) !== 'object')
|
|
3429
|
-
&& (props.selectedField !== undefined));
|
|
3430
|
-
includeOnFieldKeyChange = (((typeof child.props.onChange) !== 'function')
|
|
3431
|
-
&& ((typeof props.onFieldKeyChange) === 'function'));
|
|
3432
|
-
if (includeAvailableFields) {
|
|
3433
|
-
fieldMapperKeyProps.availableFields = (_c = (_b = props.availableFields) === null || _b === void 0 ? void 0 : _b.slice()) !== null && _c !== void 0 ? _c : [];
|
|
3434
|
-
}
|
|
3435
|
-
if (includeSelectedField) {
|
|
3436
|
-
fieldMapperKeyProps.selectedField = Object.assign({}, props.selectedField);
|
|
3437
|
-
}
|
|
3438
|
-
if (includeOnFieldKeyChange) {
|
|
3439
|
-
fieldMapperKeyProps.onChange = function (prevField, fieldItem) {
|
|
3440
|
-
props.onFieldKeyChange(prevField, fieldItem);
|
|
3441
|
-
};
|
|
3442
|
-
}
|
|
3443
|
-
if (React__default["default"].isValidElement(child)
|
|
3444
|
-
&& (includeAvailableFields
|
|
3445
|
-
|| includeSelectedField
|
|
3446
|
-
|| includeOnFieldKeyChange)) {
|
|
3447
|
-
child = React__default["default"].cloneElement(child, fieldMapperKeyProps);
|
|
3448
|
-
}
|
|
3449
|
-
wrappedEl = child;
|
|
3450
|
-
break;
|
|
3451
|
-
case FieldMapperValue:
|
|
3452
|
-
includePipedTextItems = (!Array.isArray(child.props.pipedTextItems)
|
|
3453
|
-
&& (((_d = props.pipedTextItems) === null || _d === void 0 ? void 0 : _d.length) > 0));
|
|
3454
|
-
includeOnFieldValueChange = (((typeof child.props.onChange) !== 'function')
|
|
3455
|
-
&& ((typeof props.onFieldValueChange) === 'function'));
|
|
3456
|
-
if (includePipedTextItems) {
|
|
3457
|
-
fieldMapperValueProps.pipedTextItems = props.pipedTextItems;
|
|
3458
|
-
}
|
|
3459
|
-
if (includeOnFieldValueChange) {
|
|
3460
|
-
fieldMapperValueProps.onChange = function (value) {
|
|
3461
|
-
props.onFieldValueChange(props.selectedField, value);
|
|
3462
|
-
};
|
|
3463
|
-
}
|
|
3464
|
-
if (React__default["default"].isValidElement(child)
|
|
3465
|
-
&& (includePipedTextItems
|
|
3466
|
-
|| includeOnFieldValueChange)) {
|
|
3467
|
-
child = React__default["default"].cloneElement(child, fieldMapperValueProps);
|
|
3468
|
-
}
|
|
3469
|
-
wrappedEl = child;
|
|
3470
|
-
break;
|
|
3471
|
-
default:
|
|
3472
|
-
wrappedEl = child;
|
|
3473
|
-
}
|
|
3474
|
-
return wrappedEl;
|
|
3475
|
-
}
|
|
3476
|
-
});
|
|
3477
|
-
|
|
3478
|
-
var MISSING_TRANSLATION_WARNING = '{{MISSING_I18N_STRING}}';
|
|
3479
|
-
var FieldMapper = React__default["default"].forwardRef(function FieldMapper(props, ref) {
|
|
3480
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3481
|
-
return (React__default["default"].createElement("div", { className: 'field-mapper ' + ((_a = props.className) !== null && _a !== void 0 ? _a : ''), ref: ref },
|
|
3482
|
-
hasHeaderRow() && (React__default["default"].createElement("div", { className: "field-mapper-row-container field-mapper-header-row" },
|
|
3483
|
-
React__default["default"].createElement(FieldMapperRow, { showRemove: false },
|
|
3484
|
-
React__default["default"].createElement(FieldMapperKey, null,
|
|
3485
|
-
React__default["default"].createElement("div", { className: "field-mapper-header-cell field-mapper-key-header" }, (_b = props.fieldKeysHeaderText) !== null && _b !== void 0 ? _b : '')),
|
|
3486
|
-
React__default["default"].createElement(FieldMapperValue, null,
|
|
3487
|
-
React__default["default"].createElement("div", { className: "field-mapper-header-cell field-mapper-value-header" }, (_c = props.fieldValuesHeaderText) !== null && _c !== void 0 ? _c : ''))))),
|
|
3488
|
-
React__default["default"].createElement("div", { className: "field-mapper-row-container" }, React__default["default"].Children.map(props.children, function (child) {
|
|
3489
|
-
return getWrappedFieldRow(child);
|
|
3490
|
-
})),
|
|
3491
|
-
React__default["default"].createElement("div", { className: "add-field-button-container" }, isAddFieldDisabled()
|
|
3492
|
-
? (React__default["default"].createElement(uiReact.Button, { disabled: true, kind: "secondary", className: "add-field-button" },
|
|
3493
|
-
React__default["default"].createElement("div", { className: "add-field-icon" },
|
|
3494
|
-
React__default["default"].createElement(icons.AddIcon, null)),
|
|
3495
|
-
React__default["default"].createElement("div", { className: "add-field-button-label" }, (_d = props.addFieldLabel) !== null && _d !== void 0 ? _d : MISSING_TRANSLATION_WARNING)))
|
|
3496
|
-
: (React__default["default"].createElement(uiReact.Dropdown, null,
|
|
3497
|
-
React__default["default"].createElement(uiReact.DropdownButton, null,
|
|
3498
|
-
React__default["default"].createElement(uiReact.Button, { className: "add-field-button", kind: "secondary" },
|
|
3499
|
-
React__default["default"].createElement("div", { className: "add-field-icon" },
|
|
3500
|
-
React__default["default"].createElement(icons.AddIcon, null)),
|
|
3501
|
-
React__default["default"].createElement("div", { className: "add-field-button-label" }, (_e = props.addFieldLabel) !== null && _e !== void 0 ? _e : MISSING_TRANSLATION_WARNING))),
|
|
3502
|
-
React__default["default"].createElement(uiReact.DropdownList, null, (_f = props.availableFields) === null || _f === void 0 ? void 0 : _f.map(function (fieldItem) {
|
|
3503
|
-
return (React__default["default"].createElement(uiReact.DropdownOption, { key: fieldItem.key, value: fieldItem.value, label: fieldItem.label, onSelect: function ($e) {
|
|
3504
|
-
handleDropdownSelect(fieldItem.value);
|
|
3505
|
-
} }));
|
|
3506
|
-
})))))));
|
|
3507
|
-
function hasHeaderRow() {
|
|
3508
|
-
return (isString(props.fieldKeysHeaderText)
|
|
3509
|
-
|| isString(props.fieldValuesHeaderText));
|
|
3510
|
-
}
|
|
3511
|
-
function getWrappedFieldRow(child) {
|
|
3512
|
-
var _a, _b, _c;
|
|
3513
|
-
var wrappedEl;
|
|
3514
|
-
var fieldMapperRowProps;
|
|
3515
|
-
var includeAvailableFields, includeOnFieldRemove, includePipedTextItems, includeOnFieldKeyChange, includeOnFieldValueChange, includeShowRemove;
|
|
3516
|
-
fieldMapperRowProps = {};
|
|
3517
|
-
switch (child.type) {
|
|
3518
|
-
case FieldMapperRow:
|
|
3519
|
-
wrappedEl = child;
|
|
3520
|
-
break;
|
|
3521
|
-
default:
|
|
3522
|
-
wrappedEl = (React__default["default"].createElement(FieldMapperRow, null, child));
|
|
3523
|
-
}
|
|
3524
|
-
includeAvailableFields = (!Array.isArray(wrappedEl.props.availableFields)
|
|
3525
|
-
&& (((_a = props.availableFields) === null || _a === void 0 ? void 0 : _a.length) > 0));
|
|
3526
|
-
includeOnFieldRemove = (((typeof wrappedEl.props.onFieldRemove) !== 'function')
|
|
3527
|
-
&& ((typeof props.onFieldRemove) === 'function'));
|
|
3528
|
-
includePipedTextItems = (!Array.isArray(wrappedEl.props.pipedTextItems)
|
|
3529
|
-
&& (((_b = props.pipedTextItems) === null || _b === void 0 ? void 0 : _b.length) > 0));
|
|
3530
|
-
includeOnFieldKeyChange = (((typeof wrappedEl.props.onFieldKeyChange) !== 'function')
|
|
3531
|
-
&& (typeof props.onFieldKeyChange === 'function'));
|
|
3532
|
-
includeOnFieldValueChange = (((typeof wrappedEl.props.onFieldValueChange) !== 'function')
|
|
3533
|
-
&& (typeof props.onFieldValueChange === 'function'));
|
|
3534
|
-
includeShowRemove = (((typeof wrappedEl.props.showRemove !== 'boolean'))
|
|
3535
|
-
&& ((typeof ((_c = child.props.selectedField) === null || _c === void 0 ? void 0 : _c.required)) === 'boolean'));
|
|
3536
|
-
if (includeAvailableFields) {
|
|
3537
|
-
fieldMapperRowProps.availableFields = props.availableFields.slice();
|
|
3538
|
-
}
|
|
3539
|
-
if (includeOnFieldRemove) {
|
|
3540
|
-
fieldMapperRowProps.onFieldRemove = function (fieldItem) {
|
|
3541
|
-
return props.onFieldRemove(fieldItem);
|
|
3542
|
-
};
|
|
3543
|
-
}
|
|
3544
|
-
if (includePipedTextItems) {
|
|
3545
|
-
fieldMapperRowProps.pipedTextItems = props.pipedTextItems;
|
|
3546
|
-
}
|
|
3547
|
-
if (includeOnFieldKeyChange) {
|
|
3548
|
-
fieldMapperRowProps.onFieldKeyChange = function (prevField, fieldItem) {
|
|
3549
|
-
return props.onFieldKeyChange(prevField, fieldItem);
|
|
3550
|
-
};
|
|
3551
|
-
}
|
|
3552
|
-
if (includeOnFieldValueChange) {
|
|
3553
|
-
fieldMapperRowProps.onFieldValueChange = function (fieldItem, inputValue) {
|
|
3554
|
-
return props.onFieldValueChange(fieldItem, inputValue);
|
|
3555
|
-
};
|
|
3556
|
-
}
|
|
3557
|
-
if (includeShowRemove) {
|
|
3558
|
-
fieldMapperRowProps.showRemove = !child.props.selectedField.required;
|
|
3559
|
-
}
|
|
3560
|
-
wrappedEl = React__default["default"].cloneElement(wrappedEl, fieldMapperRowProps);
|
|
3561
|
-
return wrappedEl;
|
|
3562
|
-
}
|
|
3563
|
-
function handleDropdownSelect(value) {
|
|
3564
|
-
var foundFieldMapperItem;
|
|
3565
|
-
foundFieldMapperItem = props.availableFields.find(function (availableField) {
|
|
3566
|
-
return availableField.value === value;
|
|
3567
|
-
});
|
|
3568
|
-
if (foundFieldMapperItem) {
|
|
3569
|
-
props.onFieldAdd(foundFieldMapperItem);
|
|
3570
|
-
}
|
|
3571
|
-
}
|
|
3572
|
-
function isAddFieldDisabled() {
|
|
3573
|
-
var hasAvailableFields;
|
|
3574
|
-
hasAvailableFields = ((Array.isArray(props.availableFields))
|
|
3575
|
-
&& (props.availableFields.length > 0));
|
|
3576
|
-
return !hasAvailableFields;
|
|
3577
|
-
}
|
|
3578
|
-
});
|
|
3579
|
-
|
|
3580
|
-
exports.CaptureEvent = CaptureEvent;
|
|
3581
|
-
exports.CopyText = CopyText;
|
|
3582
|
-
exports.DynamicSearchInput = DynamicSearchInput;
|
|
3583
|
-
exports.FieldItem = FieldItem;
|
|
3584
|
-
exports.FieldMapper = FieldMapper;
|
|
3585
|
-
exports.FieldMapperKey = FieldMapperKey;
|
|
3586
|
-
exports.FieldMapperRow = FieldMapperRow;
|
|
3587
|
-
exports.FieldMapperValue = FieldMapperValue;
|
|
3588
|
-
exports.MultiselectDropdown = MultiselectDropdown;
|
|
3589
|
-
exports.PipedTextInput = PipedTextInput;
|
|
3590
|
-
exports.PipedTextSelect = PipedTextSelect;
|
|
3591
|
-
exports.PluginSdkService = PluginSdkService;
|
|
3592
|
-
exports.Popover = Popover;
|
|
3593
|
-
exports.SelectItem = SelectItem;
|
|
3594
|
-
exports.TaskFields = TaskFields;
|
|
3595
|
-
exports.languageCodeAdapter = languageCodeAdapter;
|
|
48
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.array.find-index.js"),require("core-js/modules/es.array.splice.js"),require("core-js/modules/es.array.for-each.js"),require("core-js/modules/web.dom-collections.for-each.js");var e=require("react"),t=require("lodash.get"),n=require("@qualtrics/ui-react"),r=require("@qualtrics/ui-react/icons");require("core-js/modules/es.string.anchor.js");var i=require("lodash.clonedeep");require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.is-array.js");var o=require("react-popper"),a=require("react-dom"),l=require("uuid");require("core-js/modules/es.array.map.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.array.find.js"),require("core-js/modules/es.object.assign.js"),require("core-js/modules/es.array.filter.js");var u=require("lodash.clonedeepwith");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("core-js/modules/es.string.trim.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.search.js");var c=d(e),s=d(t),p=d(i),f=d(a),m=d(l),h=d(u);function v(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function g(){
|
|
49
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
50
|
+
g=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof s?t:s,o=Object.create(i.prototype),a=new k(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return S()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var l=w(a,n);if(l){if(l===c)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,a),o}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var c={};function s(){}function p(){}function f(){}var m={};l(m,i,(function(){return this}));var h=Object.getPrototypeOf,v=h&&h(h(C([])));v&&v!==t&&n.call(v,i)&&(m=v);var x=f.prototype=s.prototype=Object.create(m);function b(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){function r(i,o,a,l){var u=d(e[i],e,o);if("throw"!==u.type){var c=u.arg,s=c.value;return s&&"object"==typeof s&&n.call(s,"__await")?t.resolve(s.__await).then((function(e){r("next",e,a,l)}),(function(e){r("throw",e,a,l)})):t.resolve(s).then((function(e){c.value=e,a(c)}),(function(e){return r("throw",e,a,l)}))}l(u.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return c;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=d(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,c;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,c):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,c)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function C(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return p.prototype=f,l(x,"constructor",f),l(f,"constructor",p),p.displayName=l(f,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,l(e,a,"GeneratorFunction")),e.prototype=Object.create(x),e},e.awrap=function(e){return{__await:e}},b(y.prototype),l(y.prototype,o,(function(){return this})),e.AsyncIterator=y,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new y(u(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(x),l(x,a,"Generator"),l(x,i,(function(){return this})),l(x,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=C,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var l=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(l&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,c):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:C(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},e}function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function w(e,t,n,r,i,o,a){try{var l=e[o](a),u=l.value}catch(e){return void n(e)}l.done?t(u):Promise.resolve(u).then(r,i)}function E(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){w(o,r,i,a,l,"next",e)}function l(e){w(o,r,i,a,l,"throw",e)}a(void 0)}))}}function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function C(e,t,n){return t&&k(e.prototype,t),n&&k(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N(e){return N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},N(e)}function F(e,t){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},F(e,t)}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function P(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return T(e)}function M(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=N(e);if(t){var i=N(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return P(this,n)}}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){l=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw i}}return o}(e,t)||A(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||A(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){if(e){if("string"==typeof e)return q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?q(e,t):void 0}}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}v(".react-app {\n background-color: RGBA(0, 0, 0, 0.1); }\n");var R,L=0,D=function(){function e(t){var n=this;I(this,e),S(this,"register",(function(e){var t;return n.isSingletonHandler?(n.handler=e,function(){return n.handler=void 0}):(t=L++,n.handlers.push({callback:e,id:t}),function(){n.unregister(t)})})),this.isSingletonHandler=!!t,this.handlers=[],this.handler=function(){}}return C(e,[{key:"unregister",value:function(e){var t;this.isSingletonHandler||-1!==(t=this.handlers.findIndex((function(t){return t.id===e})))&&this.handlers.splice(t,1)}},{key:"trigger",value:function(e){if(this.isSingletonHandler)return this.handler(e);this.handlers.forEach((function(t){t.callback(e)}))}}]),e}(),z=void 0!==("undefined"==typeof global?"undefined":y(global))?global:void 0!==("undefined"==typeof self?"undefined":y(self))?self:void 0!==("undefined"==typeof window?"undefined":y(window))?window:{},B={actions_task:{save:new D(!0)}},H={actions_task:{save:function(e){return B.actions_task.save.trigger(e)}}},_={getPluginSdkClient:function(e){var t=!z.PluginClient;if(void 0!==R)return t?R:new Promise((function(e){return e(R)}));if(t)return n=z.PluginSDKClient,console.error("Warning - Initializing outdated version of PluginSDKClient. Please upgrade to PluginClient v1.0.0"),R=n.initialize();if(t||void 0===z.PluginClient)throw new Error("No PluginClient or PluginSDKClient found on global object");return function(e,t){var n,r=function(e){var t,n;t=void 0,n={},"object"===y(e)?n=e:"string"==typeof e?(t=e,n=H[e]||{}):n=e;return{pluginType:t,eventHandlers:n}}(t),i=r.pluginType,o=r.eventHandlers;return n=function(e,t){return Object.keys(o).includes(e)?B[i][e].register(t):function(){}},e.initialize(o).then((function(e){return"function"!=typeof e.registerHandler&&(e.registerHandler=n),R=e}))}(z.PluginClient,e);var n}};var K={DA:"da",DE:"de",EN:"en","EN-GB":"en-GB",ES:"es","ES-ES":"es-419",FI:"fi",FR:"fr","FR-CA":"fr-CA",ID:"id",IT:"it",JA:"ja",KO:"ko",MS:"ms",NL:"nl",PB:"pb",PT:"pt","PT-BR":"pt-BR","RI-GI":"ri-GI",RU:"ru",SV:"sv",TH:"th","ZH-S":"zh-Hans","ZH-T":"zh-Hant"};var G=function(){return G=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},G.apply(this,arguments)};function V(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function l(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,l)}u((r=r.apply(e,t||[])).next())}))}function U(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}var Y=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&F(e,t)}(r,e.Component);var n=M(r);function r(){var e;I(this,r);for(var t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];return S(T(e=n.call.apply(n,[this].concat(i))),"rootSelector",document.body),S(T(e),"container",document.createElement("div")),e}return C(r,[{key:"componentDidMount",value:function(){this.rootSelector.appendChild(this.container)}},{key:"componentWillUnmount",value:function(){this.rootSelector.removeChild(this.container)}},{key:"render",value:function(){return f.default.createPortal(this.props.children,this.container)}}]),r}();v(".q-popover {\n position: absolute;\n z-index: 1000;\n padding: 4px 0;\n font-size: 14px;\n line-height: 20px;\n color: #32363A;\n fill: #333;\n list-style: none;\n min-width: 160px;\n max-width: 500px;\n min-height: 10px;\n max-height: 99%;\n background: #fff;\n border-radius: 4px;\n box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 0px 10px 1px rgba(0, 0, 0, 0.14), 0 0px 10px 2px rgba(0, 0, 0, 0.12);\n z-index: 9000; }\n\nbody .q-popover {\n max-height: 50vh;\n overflow-y: scroll;\n max-width: 30vw; }\n");var $=new D,J=c.default.createElement(n.Button,null," anchor "),Q=[];function W(t){var n=j(e.useState(!1),2),r=n[0],i=n[1],a=[].concat(Q,O(t.modifiers||[])),l=function(){i(!1),t.onClose&&t.onClose()};return e.useEffect((function(){var e,n;return n=t.ignoreClickSelector,e=$.register((function(e){var t;n&&(t=e.target.closest(n)),t||l()})),function(){e()}}),[]),e.useEffect((function(){t.show?i(t.show):l()}),[t.show]),c.default.createElement(o.Manager,null,c.default.createElement(o.Reference,null,(function(e){var n,r=e.ref;return"function"==typeof t.anchor?n=t.anchor(r):(n=t.anchor,n=c.default.createElement("div",{ref:r,className:"popover-anchor-container"},t.anchor||J)),n})),c.default.createElement(Y,null,r&&c.default.createElement(o.Popper,{placement:t.placement||"bottom-start",modifiers:a},(function(e){var n,r=e.ref,i=e.style,o=e.placement,a=e.arrowProps,l=e.update;return n=[],Array.isArray(t.children)?n=t.children:void 0!==t.children&&(n=[t.children]),n.forEach((function(e){e.props.optionsRef&&(e.props.optionsRef.current.scheduleUpdate=l)})),c.default.createElement("div",{ref:r,"data-placement":o,style:b({},i),className:"q-popover"},t.children,c.default.createElement("div",{ref:a.ref,style:a.style}))}))))}window.addEventListener("click",(function(e){null===e.target.closest(".q-popover")?$.trigger(e):(e.stopPropagation(),e.stopImmediatePropagation())}));function Z(t){return e.useState((function(){return null!=t?t:l.v4()}))[0]}v(".piped-text-menu-list .piped-text-popover-menu > * {\n min-height: 32px; }\n");function X(e){return c.default.createElement("div",{className:"piped-text-popover-container"},c.default.createElement("div",{className:"piped-text-error-container"},c.default.createElement("div",{className:"piped-text-error-icon"},c.default.createElement(r.ErrorIcon,{size:"medium"})),e.errorText&&c.default.createElement("div",{className:"piped-text-error-text"},e.errorText)))}v("");function ee(e){return"embeddedData"===e.value}function te(e){return!0===e.header||!0===e.disabled}function ne(e){return!!e.hasSubmenu}function re(e){var t,n,r;return t=ee(e),n=ne(e),r=function(e){return!(ee(e)||te(e)||ne(e))}(e),t||n||r}v('div[role="menu"] .piped-text-search-input-container {\n padding: 5px 10px; }\n\n.piped-text-search-input {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .piped-text-search-input input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n\n.piped-text-menu-empty-anchor {\n /* the margin-right hack was not in harmony with tao.\n now, the empty-anchor is truly empty */ }\n\n.piped-text-submenu-item-container {\n position: relative; }\n .piped-text-submenu-item-container .piped-text-menu .piped-text-submenu-anchor {\n position: absolute;\n z-index: -1;\n bottom: 0;\n top: 0;\n left: 0;\n right: 0;\n min-width: 100%; }\n\n.piped-text-submenu-item {\n padding-right: 24px; }\n\n.piped-text-information-message {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n color: #74777A;\n text-align: center;\n white-space: pre-line; }\n\n.piped-text-loading-spinner {\n width: fit-content;\n margin: 0 auto; }\n\n.piped-text-error-container {\n color: #BB0000; }\n .piped-text-error-container .piped-text-error-icon {\n padding: 8px 0; }\n .piped-text-error-container .piped-text-error-icon svg {\n fill: #BB0000;\n display: block;\n margin: 0 auto; }\n .piped-text-error-container .piped-text-error-text {\n text-align: center;\n white-space: pre-line;\n padding: 0 12px 8px; }\n\n.piped-text-menu-item-container.highlighted-menu-item {\n background: RGBA(50, 54, 58, 0.08); }\n\n.piped-text-menu-item-container .piped-text-menu-item, .piped-text-menu-item-container .piped-text-submenu-item {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis; }\n .piped-text-menu-item-container .piped-text-menu-item:not(.piped-text-header):not(.piped-text-disabled):hover, .piped-text-menu-item-container .piped-text-submenu-item:not(.piped-text-header):not(.piped-text-disabled):hover {\n cursor: pointer; }\n .piped-text-menu-item-container .piped-text-menu-item.piped-text-header, .piped-text-menu-item-container .piped-text-submenu-item.piped-text-header {\n font-size: 12px;\n line-height: 16px;\n font-weight: 700;\n padding: 12px; }\n .piped-text-menu-item-container .piped-text-menu-item.piped-text-disabled:not(.piped-text-header), .piped-text-menu-item-container .piped-text-submenu-item.piped-text-disabled:not(.piped-text-header) {\n color: RGB(116, 119, 122); }\n');v("");var ie=c.default.forwardRef((function(t,r){var i=e.useRef(null),o=Z(),a=t.menuItem;return c.default.createElement("div",{"data-testid":"piped-text-submenu",className:"piped-text-submenu-item-container",role:"presentation"},a.show&&c.default.createElement(he,{"aria-labelledby":o,items:a.submenu.items,show:a.show,placement:"right-start",onClose:function(){a.show=!1},allowCustom:a.submenu.allowCustom,customScheme:a.submenu.customScheme,customInputMessage:a.submenu.customInputMessage,searchPlaceholder:a.submenu.searchPlaceholder,errorText:a.submenu.errorText,onSelected:function(e){t.onMenuItemClick(e)},anchor:function(e){return c.default.createElement("div",{ref:e,className:"piped-text-submenu-anchor"})},anchorRef:i,keyboardCtrl:t.keyboardCtrl,pipedTextMenuId:t.pipedTextMenuId}),c.default.createElement("div",{id:o,className:"piped-text-submenu-item",ref:i},c.default.createElement("div",{className:"label-text"},a.label),c.default.createElement("div",{className:"piped-text-icon"},c.default.createElement(n.Icon,{type:n.IconTypes.ChevronRight,size:"medium"}))))}));v('div[role="menu"] .piped-text-search-input-container {\n padding: 5px 10px; }\n\n.piped-text-search-input {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .piped-text-search-input input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n\n.piped-text-menu-empty-anchor {\n /* the margin-right hack was not in harmony with tao.\n now, the empty-anchor is truly empty */ }\n\n.piped-text-submenu-item-container {\n position: relative; }\n .piped-text-submenu-item-container .piped-text-menu .piped-text-submenu-anchor {\n position: absolute;\n z-index: -1;\n bottom: 0;\n top: 0;\n left: 0;\n right: 0;\n min-width: 100%; }\n\n.piped-text-submenu-item {\n padding-right: 24px; }\n\n.piped-text-information-message {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n color: #74777A;\n text-align: center;\n white-space: pre-line; }\n\n.piped-text-loading-spinner {\n width: fit-content;\n margin: 0 auto; }\n\n.piped-text-error-container {\n color: #BB0000; }\n .piped-text-error-container .piped-text-error-icon {\n padding: 8px 0; }\n .piped-text-error-container .piped-text-error-icon svg {\n fill: #BB0000;\n display: block;\n margin: 0 auto; }\n .piped-text-error-container .piped-text-error-text {\n text-align: center;\n white-space: pre-line;\n padding: 0 12px 8px; }\n\n.embedded-data-menu {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .embedded-data-menu input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n');v("");var oe=["ArrowDown","Escape","Tab","PageUp","Home","PageDown","End","Enter"],ae=function(){function e(e,t){this.currentContainer=e,this.menuItems=t,this.highlightedIdx=-1}return e.prototype.setMenuItems=function(e){this.menuItems=e},e.prototype.findMenuItemIdx=function(e){return this.menuItems.findIndex((function(t){return t.current===e.current}))},e}(),le=function(){function e(){this.menuFocusItems=[],this.currFocusItemIdx=-1}return e.prototype.getFocusMenu=function(e){var t;if(-1!==(t=this.menuFocusItems.findIndex((function(t){return t.currentContainer.current===e.current}))))return this.menuFocusItems[t]},e.prototype.getCurrentFocusMenu=function(){return this.menuFocusItems[this.currFocusItemIdx]},e.prototype.addMenu=function(e,t){var n,r;r=this.menuFocusItems.findIndex((function(t){return t.currentContainer.current===e.current})),0===this.menuFocusItems.length||-1===r?(n=new ae(e,t),this.menuFocusItems.push(n)):(n=this.menuFocusItems[r]).setMenuItems(t)},e.prototype.removeMenu=function(e){var t;if(-1===(t=this.menuFocusItems.findIndex((function(t){return t.currentContainer.current===e.current}))))throw console.error(this),console.error(e),new Error("Could not find a matching PipedTextMenu");this.menuFocusItems.splice(t,1)},e.prototype.handleKeyEvent=function(e){var t,n,r,i,o,a,l,u,d,c,s,p;if(u=e.key,void 0!==(d=this.getCurrentFocusMenu()))switch(u){case"ArrowDown":d.highlightedIdx<d.menuItems.length-1&&(s=d.menuItems[d.highlightedIdx+1],this.setFocusMenuHighlightedIdx(d.currentContainer,s),null===(t=null==s?void 0:s.current)||void 0===t||t.focus());break;case"ArrowUp":d.highlightedIdx>0&&(s=d.menuItems[d.highlightedIdx-1],this.setFocusMenuHighlightedIdx(d.currentContainer,s),null===(n=null==s?void 0:s.current)||void 0===n||n.focus());break;case"ArrowRight":this.focusNextSubmenu();break;case"ArrowLeft":case"Escape":this.currFocusItemIdx>0&&(e.stopPropagation(),void 0!==(c=this.menuFocusItems[this.currFocusItemIdx-1])&&(void 0===(p=c.menuItems[c.highlightedIdx])?null===(i=null===(r=c.currentContainer)||void 0===r?void 0:r.current)||void 0===i||i.focus():null===(o=null==p?void 0:p.current)||void 0===o||o.focus()));break;case"PageUp":case"Home":(s=d.menuItems[0])&&(this.setFocusMenuHighlightedIdx(d.currentContainer,s),null===(a=null==s?void 0:s.current)||void 0===a||a.focus());break;case"PageDown":case"End":(s=d.menuItems[d.menuItems.length-1])&&(this.setFocusMenuHighlightedIdx(d.currentContainer,s),null===(l=null==s?void 0:s.current)||void 0===l||l.focus())}},e.prototype.focusNextSubmenu=function(){var e,t,n,r,i;void 0!==this.getCurrentFocusMenu()&&void 0!==(r=this.menuFocusItems[this.currFocusItemIdx+1])&&(void 0===(i=r.menuItems[r.highlightedIdx])?null===(t=null===(e=r.currentContainer)||void 0===e?void 0:e.current)||void 0===t||t.focus():null===(n=null==i?void 0:i.current)||void 0===n||n.focus())},e.prototype.getCurrentFocusMenuRef=function(){var e;return null===(e=this.getCurrentFocusMenu())||void 0===e?void 0:e.currentContainer},e.prototype.isMenuItemInCurrentFocusMenu=function(e){return void 0!==this.getCurrentFocusMenu().menuItems.find((function(t){return t.current===e.current}))},e.prototype.setFocus=function(e){var t;if(-1===(t=this.menuFocusItems.findIndex((function(t){return t.currentContainer.current===e}))))throw console.error(this),console.error(e),new Error("Could not find a matching PipedTextMenu");this.currFocusItemIdx=t},e.prototype.getFocusMenuHighlightedIdx=function(e){var t;return void 0===(t=this.getFocusMenu(e))?-1:t.highlightedIdx},e.prototype.setFocusMenuHighlightedIdx=function(e,t){var n,r;void 0!==(n=this.getFocusMenu(e))&&-1!==(r=n.findMenuItemIdx(t))&&(n.highlightedIdx=r)},e}();function ue(t){var r=e.useState(""),i=r[0],o=r[1],a=e.useState(!1),l=a[0],u=a[1],d=e.useRef(),s=e.useRef();return e.useEffect((function(){t.keyboardCtrl.addMenu(d,[s])}),[d]),e.useEffect((function(){return function(){t.keyboardCtrl.removeMenu(d)}}),[]),c.default.createElement("div",{className:"embedded-data-input",tabIndex:-1,"aria-labelledby":t.ariaLabelledById,ref:d,onFocus:function(e){var n;e.currentTarget===d.current&&(t.keyboardCtrl.setFocus(d.current),null===(n=null==s?void 0:s.current)||void 0===n||n.focus(),t.keyboardCtrl.setFocusMenuHighlightedIdx(d,s),e.stopPropagation(),e.preventDefault())},onKeyDown:function(e){switch(e.key){case"ArrowDown":case"ArrowUp":case"ArrowRight":case"ArrowLeft":case"Escape":t.keyboardCtrl.handleKeyEvent(e),e.preventDefault();break;case"Enter":p(),e.stopPropagation(),e.preventDefault();break;case"PageUp":case"Home":case"PageDown":case"End":e.stopPropagation(),e.preventDefault()}}},c.default.createElement(n.InputGroup,null,c.default.createElement(n.Input,{onChange:function(e){!function(e){var t=(e.target.value||"").trim(),n=encodeURIComponent(t);o(n),n.length>0&&l&&u(!1)}(e)},invalid:l,onKeyDown:function(e){var t=e.key;oe.includes(e.key)||e.stopPropagation();e.shiftKey||"Tab"!==t||e.stopPropagation()},className:"q-plugin-popover-input",ref:s}),c.default.createElement(n.Button,{kind:"primary",onClick:p,onKeyDown:function(e){e.shiftKey&&"Tab"===e.key&&e.stopPropagation()},onFocus:function(e){e.stopPropagation()}},c.default.createElement(n.Icon,{type:n.IconTypes.Add}))));function p(){var e;(i||"").trim().length<1?u(!0):(e="${e://Field/".concat(i,"}"),t.onSelect(e))}}var de=c.default.forwardRef((function(e,t){var n=e.anchor,r=e.onClose||function(){},i=e.onSelect||function(){};return c.default.createElement(W,{show:e.show,anchor:n,onClose:r,ignoreClickSelector:"embedded-data-menu-content",placement:e.placement||"right-start"},c.default.createElement("div",{className:"embedded-data-menu",ref:t},c.default.createElement(ue,{onSelect:i,keyboardCtrl:e.keyboardCtrl,ariaLabelledById:e.ariaLabelledById})))}));function ce(e){return function(t){e.forEach((function(e){"function"==typeof e?e(t):null!==e&&(e.current=t)}))}}var se=c.default.forwardRef((function(t,r){var i=e.useState(),o=i[0],a=i[1],l=e.useState(),u=l[0],d=l[1],s=e.useState(),p=s[0],f=s[1],m=e.useState(),h=m[0],v=m[1],x=e.useState(),b=x[0],g=x[1],y=e.useState(),w=y[0],E=y[1],I=e.useState(),k=I[0],C=I[1],S=e.useRef(),N=Z(),F=Z();return e.useEffect((function(){var e,n,r,i,o,l,u;void 0!==t.menuItem&&(e=re(t.menuItem),r=ne(t.menuItem),i=ee(t.menuItem),n=te(t.menuItem),e&&(o=-1,u="menuitem"),(r||i)&&(l="menu"),a(l),d(o),f(u),v(r),g(n),E(e),C(i))}),[t.menuItem]),c.default.createElement("div",{className:"piped-text-menu-item-container "+(t.isHighlighted?"highlighted-menu-item":""),ref:ce([r,S]),"aria-haspopup":o,tabIndex:u,role:p,id:o?N:void 0,"aria-controls":o?F:void 0,"aria-expanded":t.menuItem.show,onFocus:function(e){var n;n=t.menuItem,h||k?t.onSubmenuHover(n,S):t.onMenuItemHover(n,S)},onKeyDown:function(e){!function(e){if(!t.isHighlighted)return;if(!t.keyboardCtrl.isMenuItemInCurrentFocusMenu(S))return;" "!==e.key&&"Enter"!==e.key||(h||k?t.onSubmenuItemClick(t.menuItem):t.onMenuItemClicked(t.menuItem),e.preventDefault())}(e)},onMouseEnter:function(e){h||k?(n=t.menuItem,t.onSubmenuHover(n,S)):w&&function(e){t.onMenuItemHover(e,S)}(t.menuItem);var n},onClick:function(e){h||k?(n=t.menuItem,t.onSubmenuItemClick(n)):w&&T(t.menuItem);var n}},function(e){var r,i,o,a;h?r=c.default.createElement(ie,{key:e.key,menuItem:e,onMenuItemClick:T,keyboardCtrl:t.keyboardCtrl,pipedTextMenuId:F}):b?(i=!0===e.header?"piped-text-header":"",o=!0===e.disabled?"piped-text-disabled":"",a="piped-text-menu-item ".concat(i," ").concat(o),r=c.default.createElement("div",{className:a},e.label)):r=k?c.default.createElement("div",{role:"presentation"},c.default.createElement(de,{show:e.show,onSelect:P,anchor:function(e){return c.default.createElement("div",{ref:e,className:"embedded-data-menu-anchor","aria-hidden":"true"})},keyboardCtrl:t.keyboardCtrl,ariaLabelledById:N}),c.default.createElement("div",{className:"piped-text-submenu-item"},c.default.createElement("div",{className:"label-text"},e.label),c.default.createElement("div",{className:"piped-text-icon"},c.default.createElement(n.Icon,{type:n.IconTypes.ChevronRight,size:"medium"})))):c.default.createElement("div",{className:"piped-text-menu-item",role:"presentation"},e.label);return c.default.createElement("div",{className:"piped-text-menu-item-content",role:"presentation"},r)}(t.menuItem));function T(e){t.onMenuItemClicked(e)}function P(e){var n;n={value:{locator:e}},t.onMenuItemClicked(n)}})),pe=c.default.forwardRef((function(e,t){var r=c.default.useRef();return c.default.createElement("div",{className:"piped-text-search-input",tabIndex:-1,ref:t,onFocus:function(t){var n;t.target!==r.current&&(null===(n=r.current)||void 0===n||n.focus());e.onFocus(t)}},c.default.createElement("form",{onSubmit:e.onSearchSubmit},c.default.createElement(n.Input,{small:!0,full:!0,className:"q-plugin-popover-input",ref:r,placeholder:e.searchPlaceholder,value:e.value,onChange:e.onInputChange,onClick:e.onInputClick,onKeyDown:function(e){oe.includes(e.key)||e.stopPropagation()},role:"searchbox"})))})),fe=c.default.forwardRef((function(t,r){var i,o,a=this,l=e.useState(!1),u=l[0],d=l[1],s=e.useState(!1),p=s[0],f=s[1],m=e.useState(),h=m[0],v=m[1],x=e.useState(),b=x[0],g=x[1],y=e.useState(),w=y[0],E=y[1],I=e.useState(),k=I[0],C=I[1],S=e.useState(""),N=S[0],F=S[1],T=e.useState(!1),P=T[0],M=T[1],j=null!==(i=t.pipedTextMenuId)&&void 0!==i?i:Z(),O=t["aria-labelledby"],A=e.useRef(),q=e.useRef(),R=e.useState(!1),L=R[0],D=R[1],z=e.useCallback((function(e){e&&D(!0)}),[]),B=e.useState(!1),H=B[0],_=B[1],K=e.useCallback((function(e){e&&_(!0)}),[]),G=void 0===t.keyboardCtrl,Y=e.useState(G?new le:t.keyboardCtrl),$=Y[0];Y[1];return e.useEffect((function(){return function(){$.removeMenu(A)}}),[]),e.useEffect((function(){var e,t;A.current&&q.current&&w&&!u&&(t=c.default.Children.map(k,(function(e){return e.ref})),e=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([q],t,!0),$.addMenu(A,e),G&&!1===P&&(setTimeout((function(){var e;null===(e=A.current)||void 0===e||e.focus()}),0),M(!0)))}),[A,w,$,u]),e.useEffect((function(){var e;L&&(e=[],H&&e.push(q),$.addMenu(A,e))}),[L,H]),e.useEffect((function(){void 0!==t.items&&V(a,void 0,void 0,(function(){var e,n;return U(this,(function(r){switch(r.label){case 0:if("function"!=typeof t.items)return[3,5];d(!0),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.items()];case 2:return e=r.sent(),[3,4];case 3:return r.sent(),f(!0),[3,4];case 4:return d(!1),[3,6];case 5:e=t.items,r.label=6;case 6:try{n=xe(e),v(n)}catch(e){f(!0)}return[2]}}))}))}),[t.items]),e.useEffect((function(){var e;void 0!==h&&(e=(h||[]).filter(Q),g(e))}),[N,h]),e.useEffect((function(){var e;Array.isArray(b)&&(e=function(e){var n,r,i,o;if(n=[],r=[],0===e.length&&!0===t.allowCustom&&t.customInputMessage)return c.default.createElement("div",null,c.default.createElement("div",{className:"piped-text-information-message"},t.customInputMessage));return i=0,o=$.getFocusMenuHighlightedIdx(A),n=e.map((function(e){var t,n,a,l=c.default.createRef();return a=(t=re(e))&&o-1===i,n=c.default.createElement(se,{ref:l,key:e.key,menuItem:e,onSubmenuHover:W,onMenuItemHover:ee,onMenuItemClicked:ne,onSubmenuItemClick:ie,onEmbeddedDataItemClick:oe,keyboardCtrl:$,isHighlighted:a}),t&&(r.push(n),i++),n})),C(r),n}(b),E(e))}),[b]),function(){var e;"function"==typeof(null===(e=t.popoverOptionsRef)||void 0===e?void 0:e.current.scheduleUpdate)&&t.popoverOptionsRef.current.scheduleUpdate()}(),c.default.createElement("div",{className:"piped-text-menu-list ".concat(null!==(o=t.className)&&void 0!==o?o:""),ref:ce([r,A,z]),id:j,"aria-labelledby":O,role:"menu",tabIndex:void 0===t.tabIndex?-1:t.tabIndex,onKeyDown:function(e){!function(e){var n;if("Tab"===e.key)J();if(null==t||t.menuKeyDown(e),n=$.getCurrentFocusMenuRef(),A.current!==(null==n?void 0:n.current))return;switch(e.key){case"ArrowDown":case"ArrowUp":case"ArrowRight":case"ArrowLeft":case"Escape":case"PageUp":case"Home":case"PageDown":case"End":$.handleKeyEvent(e),e.preventDefault()}}(e)},onFocus:function(e){!function(e){var t;e.currentTarget===A.current&&($.setFocus(A.current),-1===$.getFocusMenuHighlightedIdx(A)&&(null===(t=q.current)||void 0===t||t.focus()),e.stopPropagation(),e.preventDefault())}(e)}},c.default.createElement("div",{className:"piped-text-popover-menu",role:"presentation"},p?c.default.createElement(X,{errorText:t.errorText}):c.default.createElement(c.default.Fragment,null,c.default.createElement(pe,{ref:ce([q,K]),value:N,onSearchSubmit:function(e){var n,r,i;if(e.preventDefault(),!(!0===t.allowCustom&&t.customScheme))return;if(""===(n=N.trim()))return;r="${".concat(t.customScheme,"://Field/").concat(encodeURIComponent(n),"}"),i={value:{locator:r}},t.onSelected(i),J()},searchPlaceholder:t.searchPlaceholder,onInputChange:function(e){return t=e.target.value,void F(t);var t},onInputClick:function(e){e.stopPropagation()},onFocus:function(){!function(){var e,t;t=null!==(e=null==h?void 0:h.slice())&&void 0!==e?e:[],$.setFocusMenuHighlightedIdx(A,q),me(t),v(t)}()}}),u?c.default.createElement("div",{className:"piped-text-loading-spinner"},c.default.createElement(n.LoadingSpinner,{show:!0,size:"medium"})):w)));function J(){var e;null===(e=t.onClose)||void 0===e||e.call(t)}function Q(e){var t;return t=N||"",JSON.stringify(e).toLowerCase().includes(t.toLowerCase())}function W(e,t){var n;n=h.slice(),te(e,t),me(n),v(n),e.show||(e.show=!0)}function ee(e,t){var n;n=h.slice(),te(e,t),me(n),v(n)}function te(e,t){var n;$.setFocusMenuHighlightedIdx(A,t),null===(n=t.current)||void 0===n||n.focus()}function ne(e){e.disabled||t.onSelected(e)}function ie(e){console.log("PipedTextMenuList submenu click"),$.focusNextSubmenu()}function oe(e){}}));function me(e){e.forEach((function(e){e.show&&(e.show=!1)}))}v('div[role="menu"] .piped-text-search-input-container {\n padding: 5px 10px; }\n\n.piped-text-search-input {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n align-content: center;\n padding: 4px 8px 8px; }\n .piped-text-search-input input.q-plugin-popover-input {\n box-sizing: border-box;\n height: 36px;\n padding: 7px 9px; }\n\n.piped-text-menu-empty-anchor {\n /* the margin-right hack was not in harmony with tao.\n now, the empty-anchor is truly empty */ }\n\n.piped-text-submenu-item-container {\n position: relative; }\n .piped-text-submenu-item-container .piped-text-menu .piped-text-submenu-anchor {\n position: absolute;\n z-index: -1;\n bottom: 0;\n top: 0;\n left: 0;\n right: 0;\n min-width: 100%; }\n\n.piped-text-submenu-item {\n padding-right: 24px; }\n\n.piped-text-information-message {\n padding: 10px 12px;\n user-select: none;\n box-sizing: border-box;\n overflow-x: hidden;\n text-overflow: ellipsis;\n color: #74777A;\n text-align: center;\n white-space: pre-line; }\n\n.piped-text-loading-spinner {\n width: fit-content;\n margin: 0 auto; }\n\n.piped-text-error-container {\n color: #BB0000; }\n .piped-text-error-container .piped-text-error-icon {\n padding: 8px 0; }\n .piped-text-error-container .piped-text-error-icon svg {\n fill: #BB0000;\n display: block;\n margin: 0 auto; }\n .piped-text-error-container .piped-text-error-text {\n text-align: center;\n white-space: pre-line;\n padding: 0 12px 8px; }\n');var he=c.default.forwardRef((function(t,n){var r=e.useRef({}),i=e.useState(t.show),o=i[0],a=i[1],l=t["aria-labelledby"],u=t.onClose||function(){},d=e.useState(null);d[0];var s=d[1],p=e.useCallback((function(e){s(e)}),[]);e.useEffect((function(){t.show&&a(!0)}),[t.show]),e.useEffect((function(){return function(){return u()}}),[]);var f=function(e){a("boolean"==typeof e?e:!o)};return c.default.createElement("div",{className:"piped-text-menu"},c.default.createElement(W,{show:o,onClose:function(){f(!1),u()},placement:t.placement||"right-start",anchor:t.anchor,ignoreClickSelector:t.ignoreClickSelector},c.default.createElement(fe,{className:"piped-text-popover-container",items:t.items,errorText:t.errorText,"aria-labelledby":l,ref:p,allowCustom:t.allowCustom,customInputMessage:t.customInputMessage,customScheme:t.customScheme,searchPlaceholder:t.searchPlaceholder,onSelected:function(e){t.onSelected(e),m()},onClose:function(){return u()},popoverOptionsRef:r,keyboardCtrl:t.keyboardCtrl,menuKeyDown:function(e){switch(e.key){case"Tab":case"Escape":m()}},pipedTextMenuId:t.pipedTextMenuId}),c.default.createElement(ve,{optionsRef:r})));function m(){var e,n;u(),null===(n=null===(e=t.anchorRef)||void 0===e?void 0:e.current)||void 0===n||n.focus()}}));function ve(e){return c.default.createElement("div",null)}function xe(e,t){var n;return t||(e=p.default(e)),n=1,e.forEach((function(e){e.key=e.key||n++,e.hasSubmenu=!!s.default(e,"submenu.items.length")||"function"==typeof s.default(e,"submenu.items"),(e.hasSubmenu||"embeddedData"===e.value)&&(e.show=!1),e.hasSubmenu&&"function"!=typeof e.submenu.items&&xe(e.submenu.items,!0)})),e}v(".piped-text-dropdown button[type=button].popover-toggle-button {\n min-width: 128px; }\n\n.piped-text-popover-container {\n padding: 0; }\n .piped-text-popover-container > * {\n min-height: 32px; }\n .piped-text-popover-container .piped-text-submenu-item .label-text, .piped-text-popover-container .piped-text-submenu-item > .piped-text-icon {\n display: inline-block;\n vertical-align: middle;\n overflow-wrap: break-word;\n word-wrap: break-word;\n -webkit-hyphens: auto;\n -ms-hyphens: auto;\n -moz-hyphens: auto;\n hyphens: auto; }\n .piped-text-popover-container .piped-text-submenu-item .piped-text-icon {\n display: inline-block;\n box-sizing: content-box;\n position: absolute;\n right: 0;\n max-width: 24px;\n min-width: 24px;\n max-height: 24px; }\n .piped-text-popover-container .piped-text-submenu-item .piped-text-icon > svg {\n position: relative;\n margin-left: -5px;\n margin-top: -3px; }\n");function be(t){var n=j(e.useState(t.show),2),r=n[0],i=n[1],o=j(e.useState(v()),2),a=o[0],l=o[1],u=e.useRef(null),d=t.anchor,s=t["aria-labelledby"];e.useEffect((function(){return function(){return f()}}),[]),e.useEffect((function(){var e;e=t.show,i(e)}),[t.show]),e.useEffect((function(){var e=v();l(e)}),[t.items]);var p,f=function(){t.onClose&&t.onClose()},m=void 0!==d?c.default.cloneElement(d,{ref:d.ref}):(p=u,c.default.createElement("div",{ref:p,className:"piped-text-menu-empty-anchor"})),h=t.anchorRef||m.ref;return c.default.createElement("div",{className:"piped-text-dropdown"},r&&c.default.createElement(he,{onClose:f,show:r,onSelected:function(e){t.onSelect(e),f()},items:a,anchor:m,anchorRef:h,ignoreClickSelector:t.ignoreClickSelector,"aria-labelledby":s}));function v(){if(t.items)return xe(t.items)}}function ge(t){var i=e.useState(!1),o=i[0],a=i[1],l=e.useState(),u=l[0],d=l[1],p=Z(),f=e.useRef(null),m=e.useState({value:t.value||""}),h=m[0],v=m[1],x=t.items,b=t.value,g=t.placeholder,y=t.onChange,w=t.onSelect,E=t.onClose,I=t.errorText,k=t.helperText,C=t.multiline,S=void 0!==C&&C,N=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["items","value","placeholder","onChange","onSelect","onClose","errorText","helperText","multiline"]);return e.useEffect((function(){if(function(){if(void 0===u&&b){var e=b.length-1||0;d(e)}else d(0)}(),void 0!==w&&"function"!=typeof w)throw new Error("PipedTextInput: onSelect property must be a function");if(void 0!==y&&"function"!=typeof y)throw new Error("PipedTextInput: onChange property must be a function")}),[]),e.useEffect((function(){v({value:"string"==typeof b?b:""})}),[t.value]),c.default.createElement("div",{className:"piped-text-input"},c.default.createElement("div",{className:"piped-text-input-toggle popover-toggle"+(S?" multiline-input":"")},c.default.createElement(n.Input,G({value:h.value,onChange:function(e){!function(e){var t;t=e.target.value,v({value:t}),T(t,e)}(e)},onBlur:function(e){var t;t=e.target.selectionStart,d(t)},placeholder:g,multiline:S},N)),c.default.createElement(n.IconButton,{id:p,"aria-label":"PipedText","aria-haspopup":"menu","aria-expanded":!!o||void 0,role:"button",onClick:function(){var e;(e=!o)||F();a(e)},ref:f},c.default.createElement(r.PipedTextIcon,null)),c.default.createElement("div",{className:"piped-text-select-container"},c.default.createElement(be,{items:x,onSelect:function(e){var t,n,r;P(e),s.default(e,"value.locator")&&(n=h.value.substring(0,u),r=h.value.substring(u),t="".concat(n).concat(e.value.locator).concat(r),v({value:t}),T(t))},show:o,onClose:F,ignoreClickSelector:"piped-text-input-toggle",anchorRef:f,"aria-labelledby":p}))),(void 0!==k||void 0!==I)&&c.default.createElement("div",{className:"addon-text-container"},k&&c.default.createElement("div",{className:"helper-text"},k),I&&c.default.createElement("div",{className:"error-text"},c.default.createElement("div",{className:"error-text-icon"},c.default.createElement(r.ErrorIcon,null)),c.default.createElement("div",{className:"error-text-content"},I))));function F(){E&&E(),a(!1)}function T(e,t){y&&y(e,t)}function P(e){w&&w(e)}}v(".piped-text-input .piped-text-input-toggle, .piped-text-input .piped-text-select-container {\n display: inline-block; }\n\n.piped-text-input .piped-text-input-toggle {\n display: flex; }\n .piped-text-input .piped-text-input-toggle input {\n flex: 1 1;\n box-sizing: border-box; }\n .piped-text-input .piped-text-input-toggle.multiline-input textarea {\n flex: 1 1;\n box-sizing: border-box; }\n .piped-text-input .piped-text-input-toggle input + button, .piped-text-input .piped-text-input-toggle textarea + button {\n margin-left: 4px; }\n\n.piped-text-input .addon-text-container {\n /*\n These styles are intended to match CFE QDS components,\n notably FormField and InputField.\n See: https://gitlab-app.eng.qops.net/cfe/ui/-/blob/master/packages/ui-react/src/FormField/Caption.less\n */\n margin-top: 6px; }\n .piped-text-input .addon-text-container .helper-text, .piped-text-input .addon-text-container .error-text {\n font-size: 12px; }\n .piped-text-input .addon-text-container .helper-text {\n color: #74777a;\n fill: #74777a; }\n .piped-text-input .addon-text-container .helper-text + .error-text {\n margin-top: 4px; }\n .piped-text-input .addon-text-container .error-text {\n display: flex;\n align-items: center;\n color: #b00;\n fill: #b00; }\n .piped-text-input .addon-text-container .error-text .error-text-icon svg {\n margin-left: -2px;\n margin-right: 3px;\n width: 16px;\n height: 16px; }\n");function ye(t){var i=j(e.useState(t.children),2),o=i[0],a=i[1];e.useEffect((function(){var e;Array.isArray(o)||((e=[]).push(o),a(e))}),[]),e.useEffect((function(){var e;e=t.children.slice(),a(e)}),[t.children]);var l,u=function(e){"function"==typeof t.onFieldSwitch&&t.onFieldSwitch(t.id,e)},d=function(e){"function"==typeof t.onFieldNameChange&&t.onFieldNameChange(t.id,e)},s=function(e,n){"function"==typeof t.onFieldValueChange&&t.onFieldValueChange(t.id,e,n)},p=function(e){return"string"==typeof e?0===e.trim().length:"function"==typeof e||null==e||0==="".concat(e).trim().length},f=function e(t){return t.map((function(t){var r=t.id,i=t.name,o=t.subMenu,a=t.subMenuLabel;return void 0!==o?c.default.createElement(n.SelectMenu,{label:a||i,key:r},e(o)):c.default.createElement(n.MenuItem,{key:r,value:r},i)}))};return c.default.createElement("div",{className:"field-row"},c.default.createElement("div",{className:"field-selector ".concat(t.required&&!t.subMenu?"required-field":"")},(l=c.default.createElement("div",null,t.nameTooltip),c.default.createElement(n.Tooltip,{disabled:!t.isCustom||p(t.nameTooltip),placement:"top",content:l},c.default.createElement("div",null,t.isCustom?c.default.createElement(n.Input,{full:!0,value:void 0===t.fieldName?"":t.fieldName,placeholder:void 0===t.customNamePlaceholder?"":t.customNamePlaceholder,className:"custom-field-name",onChange:d}):t.required||!t.children||Array.isArray(o)&&0===o.length?t.subMenu?c.default.createElement(n.SelectMenu,{searchable:void 0!==t.searchable&&!1!==t.searchable,defaultLabel:t.fieldName||"",label:t.fieldName,className:"full-width left-align",onChange:u},f([{id:t.id,name:t.fieldName,subMenu:t.subMenu,subMenuLabel:t.subMenuLabel}])):c.default.createElement("div",{className:"required-indicator-container"},c.default.createElement("div",{className:"required-indicator-text"},t.fieldName),t.required&&c.default.createElement("div",{className:"required-indicator-symbol"},"*")):c.default.createElement(n.SelectMenu,{searchable:void 0!==t.searchable&&!1!==t.searchable,defaultLabel:t.fieldName||"",label:t.fieldName,className:"full-width left-align",onChange:u},f(o)))))),c.default.createElement("div",{className:"field-input-container"},c.default.createElement("div",{className:"field-input"},function(){var e=c.default.createElement("div",null,t.valueTooltip);return c.default.createElement(n.Tooltip,{disabled:p(t.valueTooltip),placement:"top",content:e},c.default.createElement("div",null,t.customInput?t.customInput:c.default.createElement(ge,{items:t.pipedTextItems,value:void 0===t.value?"":t.value,onChange:s,placeholder:void 0===t.valuePlaceholder?"":t.valuePlaceholder})))}()),c.default.createElement("div",{className:"delete-row"},c.default.createElement("div",{className:"icon-wrapper",onClick:function(){"function"==typeof t.onRemove&&t.onRemove(t.id)}},!t.required&&c.default.createElement(n.IconButton,{"aria-label":"RemoveRow",size:"medium"},c.default.createElement(r.RemoveItemIcon,null))))))}v(".field-row {\n min-width: 475px;\n display: flex;\n align-items: center; }\n .field-row .field-selector, .field-row .field-input, .field-row .delete-row, .field-row .required-indicator {\n display: inline-block; }\n .field-row .field-selector, .field-row .field-input {\n padding: 0 10px; }\n .field-row .custom-field-name, .field-row .field-input, .field-row .delete-row {\n box-sizing: border-box; }\n .field-row .field-selector {\n min-width: 30%; }\n .field-row .field-selector.required-field button:hover {\n cursor: not-allowed; }\n .field-row .field-selector .required-indicator-container {\n padding-left: 12px;\n display: flex;\n color: #32363A; }\n .field-row .field-selector .required-indicator-container .required-indicator-text {\n min-width: 0;\n font-size: 14px; }\n .field-row .field-selector .required-indicator-container .required-indicator-symbol {\n margin-top: -2px; }\n .field-row .field-selector .left-align {\n text-align: left; }\n .field-row .field-selector .custom-field-name {\n padding-left: 16px;\n padding-right: 30px; }\n .field-row .field-selector .custom-field-name input {\n text-align: center;\n display: inline-block;\n width: 100%;\n padding: 0; }\n .field-row .field-input-container {\n display: flex;\n flex: 1 0;\n align-items: center; }\n .field-row .field-input-container .field-input {\n flex: 1;\n min-width: 0;\n margin-right: 4px; }\n .field-row .field-input-container .delete-row {\n max-width: 36px;\n margin-left: 12px;\n vertical-align: middle; }\n .field-row .field-input-container .delete-row .icon-wrapper {\n display: block;\n width: fit-content;\n margin: 0 auto;\n min-width: 41px; }\n .field-row .field-input-container .delete-row .icon-wrapper:hover {\n cursor: pointer; }\n .field-row .full-width {\n width: 100%; }\n");function we(e){var t=e.name||void 0;return c.default.createElement("div",{className:"field-item",onClick:function(){"function"==typeof e.onClick&&e.onClick(e.id)}},t)}v("");v(".task-fields .add-field-button {\n margin-right: 100px; }\n .task-fields .add-field-button .add-field-button-label {\n padding: 0 3px; }\n\n.task-fields .field-table {\n padding-right: 100px;\n overflow-x: auto; }\n .task-fields .field-table .field-headers {\n margin-bottom: 10px;\n padding-left: 12px; }\n .task-fields .field-table .field-headers .field-row {\n color: #6A6D70;\n font-weight: bold; }\n .task-fields .field-table .field-headers .field-row .field-selector label, .task-fields .field-table .field-headers .field-row .field-input label {\n font-size: 12px; }\n .task-fields .field-table .field-headers .field-row .field-selector {\n padding-top: 0;\n padding-right: 24px;\n padding-bottom: 0;\n padding-left: 0; }\n .task-fields .field-table .field-headers .field-row .field-input {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n padding-left: 12px; }\n .task-fields .field-table .field-rows {\n padding-bottom: 12px; }\n .task-fields .field-table .field-rows .field-row {\n border-top: 1px solid #E5E5E5; }\n .task-fields .field-table .field-rows .field-row .field-selector {\n padding-top: 8px;\n padding-right: 12px;\n padding-bottom: 8px;\n padding-left: 12px; }\n .task-fields .field-table .field-rows .field-row .field-input {\n border-left: 1px solid #E5E5E5;\n padding-top: 8px;\n padding-right: 0;\n padding-bottom: 8px;\n padding-left: 12px; }\n\n.q-popover .field-item {\n padding: 5px 32px; }\n .q-popover .field-item:hover {\n cursor: pointer;\n user-select: none;\n background: #007ac0;\n color: #fff;\n fill: #fff; }\n");var Ee=m.default.v4;function Ie(t){var r=t.label||"",i=t.customLabel||"",o=t.disableAddFieldPopover,a=j(e.useState(!1),2),l=a[0],u=a[1],d=Ee(),s=c.default.createElement(we,{key:d,onClick:function(){t.onCustomFieldAdded(),u(!1)},id:d,name:i}),p=[],f=function e(t){return t.subMenu?e(t.subMenu[0]):t.id};return p=t.children.map((function(e){return c.default.createElement(we,{name:e.props.name,key:e.props.id,id:e.props.id,subMenu:e.props.subMenu,onClick:function(e){u(!1),t.onFieldAdded(e)}})})),t.allowCustom&&p.push(s),c.default.createElement("div",{className:"add-field-button-container"},c.default.createElement(W,{show:l,onClose:function(){u(!1)},ignoreClickSelector:".add-field-button",anchor:c.default.createElement(n.Button,{disabled:0===p.length,kind:"secondary",className:"add-field-button",onClick:function(){o?t.onFieldAdded(0!==t.children?f(t.children[0].props):""):u(!l)}},c.default.createElement("span",{className:"add-field-button-label"},r))},p))}function ke(e){var t=e.itemHeaderText,r=e.inputHeaderText;return t||r?c.default.createElement("div",{className:"field-row"},c.default.createElement("div",{className:"field-selector"},c.default.createElement(n.Label,null,t)),c.default.createElement("div",{className:"field-input"},c.default.createElement(n.Label,null,r))):null}function Ce(e){var t=e.checked||!1,r=e.children||"";return c.default.createElement("div",{className:"select-item",onClick:function(t){return e.onChange(e.value,t)}},c.default.createElement("div",{className:"item"},c.default.createElement("div",{className:"checked-container ".concat(t?"checked":"")},c.default.createElement(n.Icon,{type:n.IconTypes.Check,size:"medium"})),c.default.createElement("div",{className:"item-content"},r)))}v(".select-item .item {\n padding: 5px 32px;\n display: inline-flex;\n align-items: center;\n box-sizing: border-box;\n width: 100%; }\n .select-item .item .checked-container, .select-item .item .item-content {\n display: inline-block; }\n .select-item .item .checked-container {\n margin-bottom: -3px;\n transition: opacity cubic-bezier(0.4, 0, 0.2, 1) 0.1s; }\n .select-item .item .checked-container.checked {\n opacity: 1; }\n .select-item .item .checked-container:not(.checked) {\n opacity: 0; }\n .select-item .item:hover {\n cursor: pointer;\n user-select: none;\n background: #007ac0;\n color: #fff;\n fill: #fff; }\n");v("");function Se(e){return c.default.createElement("div",{className:"dynamic-search-popover-child",onClick:e.onClick},e.children)}v(".dynamic-search-input .search-input {\n box-sizing: border-box; }\n\n.dynamic-search-popover-child {\n padding: 5px 32px; }\n .dynamic-search-popover-child:hover {\n cursor: pointer;\n user-select: none;\n background: #007ac0;\n color: #fff;\n fill: #fff; }\n");v(".capture-event .capture-event-controls {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 20px; }\n .capture-event .capture-event-controls .status-message {\n font-size: 12px;\n line-height: 16px;\n display: flex;\n align-items: center;\n gap: 4px; }\n .capture-event .capture-event-controls .status-message.pending {\n color: #74777a; }\n .capture-event .capture-event-controls .status-message.success {\n color: #107e3e;\n fill: #107e3e; }\n .capture-event .capture-event-controls .status-message.failure {\n color: #bb0000;\n fill: #bb0000; }\n");v(".copy-text {\n display: flex;\n column-gap: 8px; }\n .copy-text .input-container {\n width: 100%; }\n .copy-text .input-container .input-textbox {\n width: 100%; }\n .copy-text .copy-button-container .selected-button {\n display: flex; }\n .copy-text .copy-button-container .selected-button .selected-button-text {\n display: flex;\n align-self: center; }\n");function Ne(e){return"string"==typeof e}v(".field-mapper {\n padding-bottom: 12px; }\n .field-mapper .field-mapper-row-container .field-mapper-row {\n border-top: 1px solid #E5E5E5; }\n .field-mapper .field-mapper-row-container.field-mapper-header-row {\n margin-bottom: 10px;\n padding-left: 12px; }\n .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-row {\n border: 0; }\n .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-key, .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-value {\n border: 0;\n display: flex;\n align-items: center; }\n .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-key .field-mapper-header-cell, .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-value .field-mapper-header-cell {\n color: #6A6D70;\n font-weight: bold;\n font-size: 12px; }\n .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-key {\n padding-top: 0;\n padding-right: 24px;\n padding-bottom: 0;\n padding-left: 0; }\n .field-mapper .field-mapper-row-container.field-mapper-header-row .field-mapper-value {\n padding-top: 0;\n padding-right: 0;\n padding-bottom: 0;\n padding-left: 12px; }\n .field-mapper .add-field-button-container {\n padding-top: 12px; }\n");v(".field-mapper-row .field-mapper-row-content {\n display: flex;\n align-items: center; }\n .field-mapper-row .field-mapper-row-content .field-mapper-key {\n flex: 4;\n min-width: 33%; }\n .field-mapper-row .field-mapper-row-content .field-mapper-value {\n flex: 7; }\n .field-mapper-row .field-mapper-row-content .remove-row-container {\n min-height: 100%;\n padding: 8px 12px;\n border-left: 1px solid #E5E5E5; }\n .field-mapper-row .field-mapper-row-content .remove-row-container.hide-remove-button {\n border: 0; }\n .field-mapper-row .field-mapper-row-content .remove-row-container .empty-remove-button {\n min-width: 36px; }\n");v(".field-mapper-key {\n padding-top: 8px;\n padding-right: 12px;\n padding-bottom: 8px;\n padding-left: 12px; }\n .field-mapper-key .field-mapper-key-select-container .field-mapper-key-dropdown {\n width: 100%; }\n .field-mapper-key .field-mapper-key-select-container .field-mapper-key-dropdown-button {\n width: 100%; }\n .field-mapper-key .field-mapper-key-select-container .field-mapper-key-disabled {\n opacity: 1;\n /*\n Styles below are copied \n verbatim from the styles on the <span> element\n in the QDS Dropdwon & DropdownButton components\n */\n /*[BEGIN COPIED STYLES]*/\n line-height: normal;\n padding: 0 4px 0 12px;\n display: inline-flex;\n justify-content: space-between;\n align-items: center;\n background-color: #fafafa;\n color: #32363a;\n border-color: rgba(137, 137, 137, 0.6);\n /*[END COPIED STYLES]*/ }\n .field-mapper-key .field-mapper-key-select-container .field-mapper-key-disabled .field-mapper-key-disabled-text {\n /*[BEGIN COPIED STYLES]*/\n font-size: 14px;\n white-space: nowrap;\n text-overflow: ellipsis;\n min-height: 10px;\n /*[END COPIED STYLES]*/\n opacity: 0.9; }\n .field-mapper-key .field-mapper-key-select-container .field-mapper-key-disabled .field-mapper-key-disabled-icon {\n /*[BEGIN COPIED STYLES]*/\n fill: #515559;\n /*[END COPIED STYLES]*/\n opacity: 0.6; }\n .field-mapper-key .field-mapper-key-select-container .required-field-container {\n display: flex; }\n .field-mapper-key .field-mapper-key-select-container .required-field-container .required-field-text {\n min-width: 0;\n font-size: 14px; }\n .field-mapper-key .field-mapper-key-select-container .required-field-container .required-field-symbol {\n margin-top: -2px; }\n");var Fe=c.default.forwardRef((function(e,t){var i,o,a,l,u,d,s,p;return s=Array.isArray(e.availableFields)?e.availableFields:[],p="function"==typeof e.onChange?e.onChange:function(){},c.default.createElement("div",{className:"field-mapper-key"+(e.className?" "+e.className:""),ref:t},c.default.createElement(n.Tooltip,{disabled:!e.tooltip,content:null!==(i=e.tooltip)&&void 0!==i?i:null},c.default.Children.count(e.children)>0?e.children:c.default.createElement("div",{className:"field-mapper-key-select-container"},function(){var t;return!((null==s?void 0:s.length)>0)&&!(null===(t=e.selectedField)||void 0===t?void 0:t.required)}()?c.default.createElement(n.Button,{className:"field-mapper-key-disabled",disabled:!0,full:!0},c.default.createElement("div",{className:"field-mapper-key-disabled-text"},null===(o=e.selectedField)||void 0===o?void 0:o.label),c.default.createElement(r.ChevronDownIcon,{className:"field-mapper-key-disabled-icon",size:"medium","aria-hidden":"true"})):!0===(null===(a=e.selectedField)||void 0===a?void 0:a.required)?c.default.createElement("div",{className:"required-field-container"},c.default.createElement("div",{className:"required-field-text"},null===(l=e.selectedField)||void 0===l?void 0:l.label),c.default.createElement("div",{className:"required-field-symbol"},"*")):c.default.createElement(n.Dropdown,{className:"field-mapper-key-dropdown",onChange:function(t){var n;if(void 0===(n=s.find((function(e){return e.value===t}))))return;p(e.selectedField,n)}},c.default.createElement(n.DropdownButton,{className:"field-mapper-key-dropdown-button",label:null===(u=e.selectedField)||void 0===u?void 0:u.label}),c.default.createElement(n.DropdownList,null,null===(d=e.availableFields)||void 0===d?void 0:d.map((function(e){return c.default.createElement(n.DropdownOption,{key:e.key,label:e.label,value:e.value})})))))))}));v(".field-mapper-value {\n border-left: 1px solid #E5E5E5;\n padding-top: 8px;\n padding-right: 12px;\n padding-bottom: 8px;\n padding-left: 12px; }\n");var Te=c.default.forwardRef((function(e,t){var r,i,o;return c.default.createElement("div",{className:"field-mapper-value"+(e.className?" "+e.className:""),ref:t},c.default.createElement(n.Tooltip,{disabled:!e.tooltip,content:null!==(r=e.tooltip)&&void 0!==r?r:null},c.default.Children.count(e.children)>0?e.children:c.default.createElement("div",{className:"piped-text-input-value-container"},c.default.createElement(ge,G({items:null!==(i=e.pipedTextItems)&&void 0!==i?i:[],onChange:null!==(o=e.onChange)&&void 0!==o?o:function(){},value:e.inputValue},e.inputProps)))))})),Pe=c.default.forwardRef((function(e,t){return c.default.createElement("div",{className:"field-mapper-row"+(e.className?" "+e.className:""),ref:t},c.default.createElement("div",{className:"field-mapper-row-content"},c.default.Children.map(e.children,(function(t){return function(t){var n,r,i,o,a,l,u,d,s,p,f,m;switch(l={},u={},t.type){case Fe:d=!Array.isArray(t.props.availableFields)&&(null===(n=e.availableFields)||void 0===n?void 0:n.length)>0,s="object"!=typeof t.props.selectedField&&void 0!==e.selectedField,p="function"!=typeof t.props.onChange&&"function"==typeof e.onFieldKeyChange,d&&(l.availableFields=null!==(i=null===(r=e.availableFields)||void 0===r?void 0:r.slice())&&void 0!==i?i:[]),s&&(l.selectedField=Object.assign({},e.selectedField)),p&&(l.onChange=function(t,n){e.onFieldKeyChange(t,n)}),c.default.isValidElement(t)&&(d||s||p)&&(t=c.default.cloneElement(t,l)),a=t;break;case Te:f=!Array.isArray(t.props.pipedTextItems)&&(null===(o=e.pipedTextItems)||void 0===o?void 0:o.length)>0,m="function"!=typeof t.props.onChange&&"function"==typeof e.onFieldValueChange,f&&(u.pipedTextItems=e.pipedTextItems),m&&(u.onChange=function(t){e.onFieldValueChange(e.selectedField,t)}),c.default.isValidElement(t)&&(f||m)&&(t=c.default.cloneElement(t,u)),a=t;break;default:a=t}return a}(t)})),c.default.createElement("div",{className:"remove-row-container"+(!1===e.showRemove?" hide-remove-button":"")},!1===e.showRemove?c.default.createElement("div",{className:"empty-remove-button"}):c.default.createElement(n.IconButton,{"aria-label":"Remove",onClick:function(t){var n;null===(n=e.onFieldRemove)||void 0===n||n.call(e,e.selectedField)}},c.default.createElement(r.RemoveItemIcon,null)))))})),Me=c.default.forwardRef((function(e,t){var i,o,a,l,u,d;return c.default.createElement("div",{className:"field-mapper "+(null!==(i=e.className)&&void 0!==i?i:""),ref:t},(Ne(e.fieldKeysHeaderText)||Ne(e.fieldValuesHeaderText))&&c.default.createElement("div",{className:"field-mapper-row-container field-mapper-header-row"},c.default.createElement(Pe,{showRemove:!1},c.default.createElement(Fe,null,c.default.createElement("div",{className:"field-mapper-header-cell field-mapper-key-header"},null!==(o=e.fieldKeysHeaderText)&&void 0!==o?o:"")),c.default.createElement(Te,null,c.default.createElement("div",{className:"field-mapper-header-cell field-mapper-value-header"},null!==(a=e.fieldValuesHeaderText)&&void 0!==a?a:"")))),c.default.createElement("div",{className:"field-mapper-row-container"},c.default.Children.map(e.children,(function(t){return function(t){var n,r,i,o,a,l,u,d,s,p,f;if(a={},t.type===Pe)o=t;else o=c.default.createElement(Pe,null,t);l=!Array.isArray(o.props.availableFields)&&(null===(n=e.availableFields)||void 0===n?void 0:n.length)>0,u="function"!=typeof o.props.onFieldRemove&&"function"==typeof e.onFieldRemove,d=!Array.isArray(o.props.pipedTextItems)&&(null===(r=e.pipedTextItems)||void 0===r?void 0:r.length)>0,s="function"!=typeof o.props.onFieldKeyChange&&"function"==typeof e.onFieldKeyChange,p="function"!=typeof o.props.onFieldValueChange&&"function"==typeof e.onFieldValueChange,f="boolean"!=typeof o.props.showRemove&&"boolean"==typeof(null===(i=t.props.selectedField)||void 0===i?void 0:i.required),l&&(a.availableFields=e.availableFields.slice());u&&(a.onFieldRemove=function(t){return e.onFieldRemove(t)});d&&(a.pipedTextItems=e.pipedTextItems);s&&(a.onFieldKeyChange=function(t,n){return e.onFieldKeyChange(t,n)});p&&(a.onFieldValueChange=function(t,n){return e.onFieldValueChange(t,n)});f&&(a.showRemove=!t.props.selectedField.required);return o=c.default.cloneElement(o,a)}(t)}))),c.default.createElement("div",{className:"add-field-button-container"},Array.isArray(e.availableFields)&&e.availableFields.length>0?c.default.createElement(n.Dropdown,null,c.default.createElement(n.DropdownButton,null,c.default.createElement(n.Button,{className:"add-field-button",kind:"secondary"},c.default.createElement("div",{className:"add-field-icon"},c.default.createElement(r.AddIcon,null)),c.default.createElement("div",{className:"add-field-button-label"},null!==(u=e.addFieldLabel)&&void 0!==u?u:"{{MISSING_I18N_STRING}}"))),c.default.createElement(n.DropdownList,null,null===(d=e.availableFields)||void 0===d?void 0:d.map((function(t){return c.default.createElement(n.DropdownOption,{key:t.key,value:t.value,label:t.label,onSelect:function(n){var r,i;r=t.value,(i=e.availableFields.find((function(e){return e.value===r})))&&e.onFieldAdd(i)}})})))):c.default.createElement(n.Button,{disabled:!0,kind:"secondary",className:"add-field-button"},c.default.createElement("div",{className:"add-field-icon"},c.default.createElement(r.AddIcon,null)),c.default.createElement("div",{className:"add-field-button-label"},null!==(l=e.addFieldLabel)&&void 0!==l?l:"{{MISSING_I18N_STRING}}"))))}));exports.CaptureEvent=function(e){return c.default.createElement("div",{className:"capture-event"},c.default.createElement("div",{className:"capture-event-controls"},"pending"===e.status?c.default.createElement("div",{className:"capture-event-button-container"},c.default.createElement(n.Button,{kind:"secondary",onClick:function(){return e.onCancel()}},e.cancelCaptureTranslation)):c.default.createElement("div",{className:"capture-event-button-container"},c.default.createElement(n.Button,{kind:"primary",onClick:function(){return e.onStart()}},e.startCaptureTranslation)),(t={default:["",void 0],pending:[e.pendingStatusTranslation,c.default.createElement(n.LoadingSpinner,{size:"small",show:!0})],success:[e.successStatusTranslation,c.default.createElement(r.SuccessIcon,{size:"small"})],failure:[e.failureStatusTranslation,c.default.createElement(r.ErrorIcon,{size:"small"})]}[e.status],i=t[0],o=t[1],c.default.createElement("div",{className:"status-message ".concat(e.status)},o,i))),void 0!==e.payload&&c.default.createElement(n.FormField,{isReadOnly:!0},c.default.createElement(n.InputField,{"aria-readonly":!0,label:e.payloadLabelTranslation,multiline:!0,readOnly:!0,full:!0,value:e.payload,className:"polled-response-output"})));var t,i,o},exports.CopyText=function(t){var i=e.useState(!1),o=i[0],a=i[1];return c.default.createElement("div",{className:"copy-text"},c.default.createElement("div",{className:"input-container"},c.default.createElement(n.Input,{className:"input-textbox",defaultValue:t.text,"aria-readonly":!0,readOnly:!0})),c.default.createElement("div",{className:"copy-button-container"},c.default.createElement(n.Button,{kind:"secondary",disabled:o,onClick:function(){try{navigator.clipboard.writeText(t.text),a(!0),setTimeout((function(){return a(!1)}),1500)}catch(e){console.error("Failed to copy text"),console.error(e)}}},o?c.default.createElement("div",{className:"selected-button"},c.default.createElement("div",{className:"selected-button-icon"},c.default.createElement(r.CheckIcon,null)),c.default.createElement("div",{className:"selected-button-text"},t.copySelectedTranslation)):c.default.createElement("div",{className:"default-button"},t.copyTranslation))))},exports.DynamicSearchInput=function(t){var r=j(e.useState(!1),2),i=r[0],o=r[1],a=j(e.useState([]),2),l=a[0],u=a[1],d=j(e.useState(""),2),p=d[0],f=d[1];e.useEffect((function(){if(t.search&&"function"!=typeof t.search)throw new Error("DynamicSearchInput: Expected function for search property");if(t.onChange&&"function"!=typeof t.onChange)throw new Error("DynamicSearchInput: Expected onChange to be a function. Received type ".concat(y(t.onChange)));if(!t.search&&void 0===t.items)throw new Error("DynamicSearchInput: Expected one of either items or search function but found neither");if(t.search&&void 0!==t.items)throw new Error("DynamicSearchInput: Expected one of either items or search function but found both");if(void 0!==t.items){if(!Array.isArray(t.items))throw new Error("DynamicSearchInput: expected items property to be an Array");t.items.forEach((function(e){if(void 0===e.props.label)throw new Error('DynamicSearchInput: expected items in items property to have "label" property')}))}}),[]);var m,h,v=function(e,n){"function"==typeof t.onChange&&t.onChange(e,n)},x=(m=E(g().mark((function e(n){var r;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(""!==(n=((n||"")+"").trim().toLowerCase())){e.next=3;break}return e.abrupt("return",[]);case 3:return r=t.items.filter((function(e){return e.props.label.toLowerCase().includes(n)})),e.abrupt("return",r);case 5:case"end":return e.stop()}}),e)}))),function(e){return m.apply(this,arguments)}),b=(h=E(g().mark((function e(n){var r,i,a,l,d;return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.persist(),r=s.default(n,"target.value",""),i=t.search?t.search:x,e.next=5,i(r);case 5:if(a=e.sent,Array.isArray(a)){e.next=9;break}throw l=(void 0===a?"undefined":null===a&&"null")||a.constructor&&a.constructor.name||a,new Error("DynamicSearchInput: expected result from search function to be Array, but was ".concat(l));case 9:d=a.map((function(e){if(void 0===s.default(e,"props.label"))throw new Error("DynamicSearchInput: expected search result array values to have label property but found none");return c.default.createElement(Se,{key:e.props.id,onClick:function(){var t;t=e.props.label,f(t),v(t),o(!1)}},e)})),f(r),d.length>0?o(!0):o(!1),u(d),v(r,n);case 14:case"end":return e.stop()}}),e)}))),function(e){return h.apply(this,arguments)});return c.default.createElement("div",{className:"dynamic-search-input"},c.default.createElement(W,{show:i,onClose:function(){o(!1)},anchor:c.default.createElement(n.Input,{className:"search-input",full:!0,small:!0,placeholder:t.placeholder,value:p,onChange:b})},l))},exports.FieldItem=we,exports.FieldMapper=Me,exports.FieldMapperKey=Fe,exports.FieldMapperRow=Pe,exports.FieldMapperValue=Te,exports.MultiselectDropdown=function(t){var r=j(e.useState(!1),2),i=r[0],o=r[1],a=t.label||"",l=function(e,n){"function"==typeof t.onChange&&t.onChange(e,n)},u=t.children||[];if(!Array.isArray(u)){var d=[];d.push(u),u=d}return c.default.createElement("div",{className:"multiselect-dropdown"},c.default.createElement(W,{show:i,onClose:function(){o(!1)},ignoreClickSelector:".multiselect-dropdown-toggle",anchor:c.default.createElement("div",{className:"multiselect-dropdown-toggle"},c.default.createElement(n.Button,{onClick:function(){o(!i)}},a))},u.map((function(e){return c.default.createElement(Ce,{onChange:l,checked:e.props.checked,value:e.props.value,key:e.props.value},e.props.children)}))))},exports.PipedTextInput=ge,exports.PipedTextSelect=be,exports.PluginSdkService=_,exports.Popover=W,exports.SelectItem=Ce,exports.TaskFields=function(t){var n=j(e.useState([]),2),r=n[0],i=n[1],o=j(e.useState([]),2),a=o[0],l=o[1],u=j(e.useState(),2),d=u[0],p=u[1],f=function(e,n){"function"==typeof t.onFieldSwitch&&t.onFieldSwitch(e,n)},m=function(e,n,r){"function"==typeof t.onFieldInputChange&&t.onFieldInputChange(e,n,r)},v=function(e,n){var r=s.default(t,"customFieldOptions.onCustomFieldNameChange");"function"==typeof r&&r(e,n)},x=function(e,t,n){var r=e.slice();return t.forEach((function(e){void 0!==e.subMenu&&n===e.id&&(-1===r.findIndex((function(t){return t.id===e.id}))&&r.push(e))})),r},b=function(e){"function"==typeof t.onFieldRemove&&t.onFieldRemove(e)},g=function(e){var n,r,i=[];if(void 0!==e)return Array.isArray(t.children)?n=t.children:(n=[]).push(t.children),r=[],n.forEach((function(e){e.props.required&&r.push({required:e.props.required,name:e.props.name,id:e.props.id,children:e.props.children,nameTooltip:e.props.nameTooltip,valueTooltip:e.props.valueTooltip,value:e.props.value||void 0,valuePlaceholder:e.props.valuePlaceholder,subMenu:e.props.subMenu,subMenuLabel:e.props.subMenuLabel})})),i=function(n){var r=n.slice();return(t.values||[]).forEach((function(n){var i=e.find((function(e){return e.id===n.id}));if(void 0!==i)!function(e,t,n){var r=e.find((function(e){return e.id===t.id}));if(void 0!==r)r.value=t.value;else{var i=h.default(n,(function(e){if(c.default.isValidElement(e))return c.default.cloneElement(e)}));i.value=t.value,e.push(i)}}(r,n,i);else if(t.customFieldOptions){var o={required:!1,name:n.name,id:n.id,value:n.value,nameTooltip:s.default(t,"customFieldOptions.nameTooltip",""),valueTooltip:s.default(t,"customFieldOptions.valueTooltip",""),namePlaceholder:s.default(t,"customFieldOptions.namePlaceholder",""),type:"custom",subMenu:n.subMenu,subMenuLabel:n.subMenuLabel};r.push(o)}})),r}(i=r),i=function(e,n){var r=e.slice(),i=t.values||[];return r=r.map((function(e){var t,r;return t=i.find((function(t){return t.id===e.id})),void 0===n.find((function(e){return e.props.id===t.id}))||e.required||(r=n.find((function(e){return e.props.id===t.id})),e=Object.assign({},e,{name:r.props.name,id:r.props.id,children:r.props.children,nameTooltip:r.props.nameTooltip,valueTooltip:r.props.valueTooltip,valuePlaceholder:r.props.valuePlaceholder,subMenu:r.props.subMenu,subMenuLabel:r.props.subMenuLabel})),e}))}(i,n),i},y=function(){var e=t.children.map((function(e){var t=e.props;return{required:t.required,name:t.name,id:t.id,children:t.children,nameTooltip:t.nameTooltip,valueTooltip:t.valueTooltip,valuePlaceholder:t.valuePlaceholder,subMenu:t.subMenu,subMenuLabel:t.subMenuLabel}})),n=g(e),r=e.filter((function(e){return-1===n.findIndex((function(t){return e.id===t.id}))}));p(e),i(n),l(r)};return e.useEffect((function(){y()}),[]),e.useEffect((function(){y()}),[t.values]),c.default.createElement("div",{className:"task-fields"},c.default.createElement("div",{className:"field-table",tabIndex:"0"},c.default.createElement("div",{className:"field-headers"},c.default.createElement(ke,{itemHeaderText:t.fieldItemsHeaderText,inputHeaderText:t.fieldInputsHeaderText})),c.default.createElement("div",{className:"field-rows"},r.map((function(e){return c.default.createElement(ye,{customInput:e.children,required:e.required,fieldName:e.name,id:e.id,subMenu:e.subMenu,subMenuLabel:e.subMenuLabel,nameTooltip:"custom"===e.type?s.default(t,"customFieldOptions.nameTooltip",""):e.nameTooltip,valueTooltip:"custom"===e.type?s.default(t,"customFieldOptions.valueTooltip",""):e.valueTooltip,onFieldNameChange:v,onFieldValueChange:m,onFieldSwitch:f,onRemove:b,isCustom:"custom"===e.type,key:e.id,value:e.value,valuePlaceholder:"custom"===e.type?s.default(t,"customFieldOptions.valuePlaceholder",""):e.valuePlaceholder,customNamePlaceholder:s.default(t,"customFieldOptions.namePlaceholder",""),pipedTextItems:t.pipedTextItems,searchable:t.searchable},d&&x(a,d,e.id))})))),c.default.createElement("div",{className:"add-field-container"},c.default.createElement(Ie,{label:t.addFieldLabel,onFieldAdded:function(e){"function"==typeof t.onFieldAdd&&t.onFieldAdd(e)},disableAddFieldPopover:t.disableAddFieldPopover,allowCustom:t.customFieldOptions,customLabel:s.default(t,"customFieldOptions.label",""),onCustomFieldAdded:t.customFieldOptions?function(){s.default(t,"customFieldOptions.onCustomFieldAdd",(function(){}))()}:function(){}},a.map((function(e){return c.default.createElement(we,{name:e.name,type:e.type,required:e.required,key:e.id,id:e.id,subMenu:e.subMenu,subMenuLabel:e.subMenuLabel})})))))},exports.languageCodeAdapter=function(e){var t;if(void 0===(t=K[e]))throw new Error("No language code mapping found for supplied code: '".concat(e,"'"));return t};
|