@nebula.js/sn-action-button 1.14.3 → 1.15.2

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.
@@ -1,4293 +1,7 @@
1
1
  /*
2
- * @nebula.js/sn-action-button v1.14.3
3
- * Copyright (c) 2021 QlikTech International AB
2
+ * @nebula.js/sn-action-button v1.15.2
3
+ * Copyright (c) 2022 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
6
6
 
7
- import { useElement, useTheme, useMemo, useStaleLayout, useApp, useConstraints, useEffect, useImperativeHandle } from '@nebula.js/stardust';
8
-
9
- var properties = {
10
- /**
11
- * @type {boolean}
12
- */
13
- showTitles: false,
14
-
15
- /**
16
- * @type {string}
17
- */
18
- title: '',
19
-
20
- /**
21
- * @type {string}
22
- */
23
- subtitle: '',
24
-
25
- /**
26
- * @type {string}
27
- */
28
- footnote: '',
29
-
30
- /**
31
- * @type {boolean}
32
- */
33
- useEnabledCondition: false,
34
-
35
- /**
36
- * @type {number}
37
- */
38
- enabledCondition: 1,
39
-
40
- /**
41
- * @type {object}
42
- */
43
- navigation: {
44
- action: 'none'
45
- },
46
-
47
- /**
48
- * @type {object}
49
- */
50
- style: {
51
- /**
52
- * @type {string}
53
- */
54
- label: 'Button',
55
-
56
- /**
57
- * @type {object}
58
- */
59
- font: {
60
- /**
61
- * @type {number}
62
- */
63
- size: 0.5,
64
-
65
- /**
66
- * @type {boolean}
67
- */
68
- useColorExpression: false,
69
-
70
- /**
71
- * @type {object}
72
- */
73
- color: {
74
- index: -1,
75
- color: null
76
- },
77
-
78
- /**
79
- * @type {string}
80
- */
81
- colorExpression: '',
82
-
83
- /**
84
- * @type {object}
85
- */
86
- style: {
87
- bold: true,
88
- italic: false,
89
- underline: false
90
- },
91
-
92
- /**
93
- * @type {string}
94
- */
95
- align: 'center'
96
- },
97
-
98
- /**
99
- * @type {object}
100
- */
101
- background: {
102
- /**
103
- * @type {boolean}
104
- */
105
- useColorExpression: false,
106
-
107
- /**
108
- * @type {object}
109
- */
110
- color: {
111
- index: -1,
112
- color: null
113
- },
114
-
115
- /**
116
- * @type {string}
117
- */
118
- colorExpression: '',
119
-
120
- /**
121
- * @type {boolean}
122
- */
123
- useImage: false,
124
-
125
- /**
126
- * @type {object}
127
- */
128
- url: {
129
- /**
130
- * @type {object}
131
- */
132
- qStaticContentUrlDef: {
133
- /**
134
- * @type {string}
135
- */
136
- qUrl: ''
137
- }
138
- },
139
-
140
- /**
141
- * @type {string}
142
- */
143
- size: 'auto',
144
-
145
- /**
146
- * @type {string}
147
- */
148
- position: 'centerCenter'
149
- },
150
-
151
- /**
152
- * @type {object}
153
- */
154
- border: {
155
- /**
156
- * @type {boolean}
157
- */
158
- useBorder: false,
159
-
160
- /**
161
- * @type {number}
162
- */
163
- radius: 0,
164
-
165
- /**
166
- * @type {number}
167
- */
168
- width: 0,
169
-
170
- /**
171
- * @type {boolean}
172
- */
173
- useColorExpression: false,
174
-
175
- /**
176
- * @type {object}
177
- */
178
- color: {
179
- index: -1,
180
- color: null
181
- },
182
-
183
- /**
184
- * @type {string}
185
- */
186
- colorExpression: ''
187
- },
188
-
189
- /**
190
- * @type {object}
191
- */
192
- icon: {
193
- /**
194
- * @type {boolean}
195
- */
196
- useIcon: false,
197
-
198
- /**
199
- * @type {string}
200
- */
201
- iconType: '',
202
-
203
- /**
204
- * @type {string}
205
- */
206
- position: 'left'
207
- }
208
- },
209
-
210
- /**
211
- * @type {array}
212
- */
213
- actions: []
214
- };
215
-
216
- var data = {
217
- targets: []
218
- };
219
-
220
- function ownKeys(object, enumerableOnly) {
221
- var keys = Object.keys(object);
222
-
223
- if (Object.getOwnPropertySymbols) {
224
- var symbols = Object.getOwnPropertySymbols(object);
225
-
226
- if (enumerableOnly) {
227
- symbols = symbols.filter(function (sym) {
228
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
229
- });
230
- }
231
-
232
- keys.push.apply(keys, symbols);
233
- }
234
-
235
- return keys;
236
- }
237
-
238
- function _objectSpread2(target) {
239
- for (var i = 1; i < arguments.length; i++) {
240
- var source = arguments[i] != null ? arguments[i] : {};
241
-
242
- if (i % 2) {
243
- ownKeys(Object(source), true).forEach(function (key) {
244
- _defineProperty(target, key, source[key]);
245
- });
246
- } else if (Object.getOwnPropertyDescriptors) {
247
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
248
- } else {
249
- ownKeys(Object(source)).forEach(function (key) {
250
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
251
- });
252
- }
253
- }
254
-
255
- return target;
256
- }
257
-
258
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
259
- try {
260
- var info = gen[key](arg);
261
- var value = info.value;
262
- } catch (error) {
263
- reject(error);
264
- return;
265
- }
266
-
267
- if (info.done) {
268
- resolve(value);
269
- } else {
270
- Promise.resolve(value).then(_next, _throw);
271
- }
272
- }
273
-
274
- function _asyncToGenerator(fn) {
275
- return function () {
276
- var self = this,
277
- args = arguments;
278
- return new Promise(function (resolve, reject) {
279
- var gen = fn.apply(self, args);
280
-
281
- function _next(value) {
282
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
283
- }
284
-
285
- function _throw(err) {
286
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
287
- }
288
-
289
- _next(undefined);
290
- });
291
- };
292
- }
293
-
294
- function _defineProperty(obj, key, value) {
295
- if (key in obj) {
296
- Object.defineProperty(obj, key, {
297
- value: value,
298
- enumerable: true,
299
- configurable: true,
300
- writable: true
301
- });
302
- } else {
303
- obj[key] = value;
304
- }
305
-
306
- return obj;
307
- }
308
-
309
- var getValueList = /*#__PURE__*/function () {
310
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(app, values, isDate) {
311
- var valuesArray, dateExpression, convertedDates;
312
- return regeneratorRuntime.wrap(function _callee$(_context) {
313
- while (1) {
314
- switch (_context.prev = _context.next) {
315
- case 0:
316
- valuesArray = values.split(';');
317
-
318
- if (!isDate) {
319
- _context.next = 8;
320
- break;
321
- }
322
-
323
- dateExpression = '';
324
- valuesArray.forEach(function (date) {
325
- dateExpression += "Num('".concat(date, "')&';'&");
326
- });
327
- _context.next = 6;
328
- return app.evaluate(dateExpression.slice(0, -5));
329
-
330
- case 6:
331
- convertedDates = _context.sent;
332
- valuesArray = convertedDates.split(';');
333
-
334
- case 8:
335
- return _context.abrupt("return", valuesArray.map(function (value) {
336
- return Number.isNaN(+value) ? {
337
- qText: value
338
- } : {
339
- qIsNumeric: true,
340
- qNumber: Number(value)
341
- };
342
- }));
343
-
344
- case 9:
345
- case "end":
346
- return _context.stop();
347
- }
348
- }
349
- }, _callee);
350
- }));
351
-
352
- return function getValueList(_x, _x2, _x3) {
353
- return _ref.apply(this, arguments);
354
- };
355
- }();
356
- var actions = [{
357
- value: 'applyBookmark',
358
- translation: 'Object.ActionButton.ApplyBookmark',
359
- group: 'bookmark',
360
- getActionCall: function getActionCall(_ref2) {
361
- var app = _ref2.app,
362
- bookmark = _ref2.bookmark;
363
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
364
- var bookMarks, findBm;
365
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
366
- while (1) {
367
- switch (_context2.prev = _context2.next) {
368
- case 0:
369
- _context2.next = 2;
370
- return app.getBookmarkList();
371
-
372
- case 2:
373
- bookMarks = _context2.sent;
374
- findBm = bookMarks.find(function (bm) {
375
- return bm.qData.title === bookmark;
376
- });
377
- _context2.t0 = bookmark;
378
-
379
- if (!_context2.t0) {
380
- _context2.next = 8;
381
- break;
382
- }
383
-
384
- _context2.next = 8;
385
- return app.applyBookmark(findBm && findBm.qInfo && findBm.qInfo.qId || bookmark);
386
-
387
- case 8:
388
- case "end":
389
- return _context2.stop();
390
- }
391
- }
392
- }, _callee2);
393
- }));
394
- },
395
- requiredInput: ['bookmark']
396
- }, {
397
- value: 'back',
398
- translation: 'Object.ActionButton.MoveBackward',
399
- group: 'selection',
400
- getActionCall: function getActionCall(_ref4) {
401
- var app = _ref4.app;
402
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
403
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
404
- while (1) {
405
- switch (_context3.prev = _context3.next) {
406
- case 0:
407
- _context3.next = 2;
408
- return app.back();
409
-
410
- case 2:
411
- case "end":
412
- return _context3.stop();
413
- }
414
- }
415
- }, _callee3);
416
- }));
417
- },
418
- requiredInput: []
419
- }, {
420
- value: 'forward',
421
- translation: 'Object.ActionButton.MoveForward',
422
- group: 'selection',
423
- getActionCall: function getActionCall(_ref6) {
424
- var app = _ref6.app;
425
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
426
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
427
- while (1) {
428
- switch (_context4.prev = _context4.next) {
429
- case 0:
430
- _context4.next = 2;
431
- return app.forward();
432
-
433
- case 2:
434
- case "end":
435
- return _context4.stop();
436
- }
437
- }
438
- }, _callee4);
439
- }));
440
- },
441
- requiredInput: []
442
- }, {
443
- value: 'clearAll',
444
- translation: 'Object.ActionButton.ClearAll',
445
- group: 'selection',
446
- getActionCall: function getActionCall(_ref8) {
447
- var app = _ref8.app,
448
- softLock = _ref8.softLock;
449
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
450
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
451
- while (1) {
452
- switch (_context5.prev = _context5.next) {
453
- case 0:
454
- _context5.next = 2;
455
- return app.clearAll(softLock);
456
-
457
- case 2:
458
- case "end":
459
- return _context5.stop();
460
- }
461
- }
462
- }, _callee5);
463
- }));
464
- },
465
- requiredInput: ['softLock']
466
- }, {
467
- value: 'clearAllButThis',
468
- translation: 'Object.ActionButton.ClearAllButThis',
469
- group: 'selection',
470
- getActionCall: function getActionCall(_ref10) {
471
- var app = _ref10.app,
472
- qStateName = _ref10.qStateName,
473
- field = _ref10.field,
474
- softLock = _ref10.softLock;
475
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
476
- var fieldObj;
477
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
478
- while (1) {
479
- switch (_context6.prev = _context6.next) {
480
- case 0:
481
- if (!field) {
482
- _context6.next = 6;
483
- break;
484
- }
485
-
486
- _context6.next = 3;
487
- return app.getField(field, qStateName);
488
-
489
- case 3:
490
- fieldObj = _context6.sent;
491
- _context6.next = 6;
492
- return fieldObj.clearAllButThis(softLock);
493
-
494
- case 6:
495
- case "end":
496
- return _context6.stop();
497
- }
498
- }
499
- }, _callee6);
500
- }));
501
- },
502
- requiredInput: ['field', 'softLock']
503
- }, {
504
- value: 'clearField',
505
- translation: 'Object.ActionButton.ClearSelectionInField',
506
- group: 'selection',
507
- getActionCall: function getActionCall(_ref12) {
508
- var app = _ref12.app,
509
- qStateName = _ref12.qStateName,
510
- field = _ref12.field;
511
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
512
- var fieldObj;
513
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
514
- while (1) {
515
- switch (_context7.prev = _context7.next) {
516
- case 0:
517
- if (!field) {
518
- _context7.next = 6;
519
- break;
520
- }
521
-
522
- _context7.next = 3;
523
- return app.getField(field, qStateName);
524
-
525
- case 3:
526
- fieldObj = _context7.sent;
527
- _context7.next = 6;
528
- return fieldObj.clear();
529
-
530
- case 6:
531
- case "end":
532
- return _context7.stop();
533
- }
534
- }
535
- }, _callee7);
536
- }));
537
- },
538
- requiredInput: ['field']
539
- }, {
540
- value: 'selectAll',
541
- translation: 'Object.ActionButton.SelectAllInField',
542
- group: 'selection',
543
- getActionCall: function getActionCall(_ref14) {
544
- var app = _ref14.app,
545
- qStateName = _ref14.qStateName,
546
- field = _ref14.field,
547
- softLock = _ref14.softLock;
548
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
549
- var fieldObj;
550
- return regeneratorRuntime.wrap(function _callee8$(_context8) {
551
- while (1) {
552
- switch (_context8.prev = _context8.next) {
553
- case 0:
554
- if (!field) {
555
- _context8.next = 6;
556
- break;
557
- }
558
-
559
- _context8.next = 3;
560
- return app.getField(field, qStateName);
561
-
562
- case 3:
563
- fieldObj = _context8.sent;
564
- _context8.next = 6;
565
- return fieldObj.selectAll(softLock);
566
-
567
- case 6:
568
- case "end":
569
- return _context8.stop();
570
- }
571
- }
572
- }, _callee8);
573
- }));
574
- },
575
- requiredInput: ['field', 'softLock']
576
- }, {
577
- value: 'selectValues',
578
- translation: 'Object.ActionButton.SelectValuesInField',
579
- group: 'selection',
580
- getActionCall: function getActionCall(_ref16) {
581
- var app = _ref16.app,
582
- qStateName = _ref16.qStateName,
583
- field = _ref16.field,
584
- value = _ref16.value,
585
- softLock = _ref16.softLock;
586
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
587
- var fieldObj, fieldInfo, valueList;
588
- return regeneratorRuntime.wrap(function _callee9$(_context9) {
589
- while (1) {
590
- switch (_context9.prev = _context9.next) {
591
- case 0:
592
- if (!(field && value)) {
593
- _context9.next = 12;
594
- break;
595
- }
596
-
597
- _context9.next = 3;
598
- return app.getField(field, qStateName);
599
-
600
- case 3:
601
- fieldObj = _context9.sent;
602
- _context9.next = 6;
603
- return app.getFieldDescription(field);
604
-
605
- case 6:
606
- fieldInfo = _context9.sent;
607
- _context9.next = 9;
608
- return getValueList(app, value, fieldInfo.qTags.includes('$date'));
609
-
610
- case 9:
611
- valueList = _context9.sent;
612
- _context9.next = 12;
613
- return fieldObj.selectValues(valueList, false, softLock);
614
-
615
- case 12:
616
- case "end":
617
- return _context9.stop();
618
- }
619
- }
620
- }, _callee9);
621
- }));
622
- },
623
- requiredInput: ['field', 'value', 'softLock']
624
- }, {
625
- value: 'selectMatchingValues',
626
- translation: 'Object.ActionButton.SelectMatchingValues',
627
- group: 'selection',
628
- getActionCall: function getActionCall(_ref18) {
629
- var app = _ref18.app,
630
- qStateName = _ref18.qStateName,
631
- field = _ref18.field,
632
- value = _ref18.value,
633
- softLock = _ref18.softLock;
634
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
635
- var fieldObj;
636
- return regeneratorRuntime.wrap(function _callee10$(_context10) {
637
- while (1) {
638
- switch (_context10.prev = _context10.next) {
639
- case 0:
640
- if (!(field && value)) {
641
- _context10.next = 6;
642
- break;
643
- }
644
-
645
- _context10.next = 3;
646
- return app.getField(field, qStateName);
647
-
648
- case 3:
649
- fieldObj = _context10.sent;
650
- _context10.next = 6;
651
- return fieldObj.select(value, false, softLock);
652
-
653
- case 6:
654
- case "end":
655
- return _context10.stop();
656
- }
657
- }
658
- }, _callee10);
659
- }));
660
- },
661
- requiredInput: ['field', 'value', 'softLock']
662
- }, {
663
- value: 'selectAlternative',
664
- translation: 'Object.ActionButton.SelectAlternatives',
665
- group: 'selection',
666
- getActionCall: function getActionCall(_ref20) {
667
- var app = _ref20.app,
668
- qStateName = _ref20.qStateName,
669
- field = _ref20.field,
670
- softLock = _ref20.softLock;
671
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
672
- var fieldObj;
673
- return regeneratorRuntime.wrap(function _callee11$(_context11) {
674
- while (1) {
675
- switch (_context11.prev = _context11.next) {
676
- case 0:
677
- if (!field) {
678
- _context11.next = 6;
679
- break;
680
- }
681
-
682
- _context11.next = 3;
683
- return app.getField(field, qStateName);
684
-
685
- case 3:
686
- fieldObj = _context11.sent;
687
- _context11.next = 6;
688
- return fieldObj.selectAlternative(softLock);
689
-
690
- case 6:
691
- case "end":
692
- return _context11.stop();
693
- }
694
- }
695
- }, _callee11);
696
- }));
697
- },
698
- requiredInput: ['field', 'softLock']
699
- }, {
700
- value: 'selectExcluded',
701
- translation: 'Object.ActionButton.SelectExcluded',
702
- group: 'selection',
703
- getActionCall: function getActionCall(_ref22) {
704
- var app = _ref22.app,
705
- qStateName = _ref22.qStateName,
706
- field = _ref22.field,
707
- softLock = _ref22.softLock;
708
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
709
- var fieldObj;
710
- return regeneratorRuntime.wrap(function _callee12$(_context12) {
711
- while (1) {
712
- switch (_context12.prev = _context12.next) {
713
- case 0:
714
- if (!field) {
715
- _context12.next = 6;
716
- break;
717
- }
718
-
719
- _context12.next = 3;
720
- return app.getField(field, qStateName);
721
-
722
- case 3:
723
- fieldObj = _context12.sent;
724
- _context12.next = 6;
725
- return fieldObj.selectExcluded(softLock);
726
-
727
- case 6:
728
- case "end":
729
- return _context12.stop();
730
- }
731
- }
732
- }, _callee12);
733
- }));
734
- },
735
- requiredInput: ['field', 'softLock']
736
- }, {
737
- value: 'selectPossible',
738
- translation: 'Object.ActionButton.SelectPossibleValues',
739
- group: 'selection',
740
- getActionCall: function getActionCall(_ref24) {
741
- var app = _ref24.app,
742
- qStateName = _ref24.qStateName,
743
- field = _ref24.field,
744
- softLock = _ref24.softLock;
745
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13() {
746
- var fieldObj;
747
- return regeneratorRuntime.wrap(function _callee13$(_context13) {
748
- while (1) {
749
- switch (_context13.prev = _context13.next) {
750
- case 0:
751
- if (!field) {
752
- _context13.next = 6;
753
- break;
754
- }
755
-
756
- _context13.next = 3;
757
- return app.getField(field, qStateName);
758
-
759
- case 3:
760
- fieldObj = _context13.sent;
761
- _context13.next = 6;
762
- return fieldObj.selectPossible(softLock);
763
-
764
- case 6:
765
- case "end":
766
- return _context13.stop();
767
- }
768
- }
769
- }, _callee13);
770
- }));
771
- },
772
- requiredInput: ['field', 'softLock']
773
- }, {
774
- value: 'toggleSelect',
775
- translation: 'Object.ActionButton.ToggleFieldSelection',
776
- group: 'selection',
777
- getActionCall: function getActionCall(_ref26) {
778
- var app = _ref26.app,
779
- qStateName = _ref26.qStateName,
780
- field = _ref26.field,
781
- value = _ref26.value,
782
- softLock = _ref26.softLock;
783
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14() {
784
- var fieldObj;
785
- return regeneratorRuntime.wrap(function _callee14$(_context14) {
786
- while (1) {
787
- switch (_context14.prev = _context14.next) {
788
- case 0:
789
- if (!(field && value)) {
790
- _context14.next = 6;
791
- break;
792
- }
793
-
794
- _context14.next = 3;
795
- return app.getField(field, qStateName);
796
-
797
- case 3:
798
- fieldObj = _context14.sent;
799
- _context14.next = 6;
800
- return fieldObj.toggleSelect(value, softLock);
801
-
802
- case 6:
803
- case "end":
804
- return _context14.stop();
805
- }
806
- }
807
- }, _callee14);
808
- }));
809
- },
810
- requiredInput: ['field', 'value', 'softLock']
811
- }, {
812
- value: 'lockAll',
813
- translation: 'Object.ActionButton.LockAllSelections',
814
- group: 'selection',
815
- getActionCall: function getActionCall(_ref28) {
816
- var app = _ref28.app;
817
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15() {
818
- return regeneratorRuntime.wrap(function _callee15$(_context15) {
819
- while (1) {
820
- switch (_context15.prev = _context15.next) {
821
- case 0:
822
- _context15.next = 2;
823
- return app.lockAll();
824
-
825
- case 2:
826
- case "end":
827
- return _context15.stop();
828
- }
829
- }
830
- }, _callee15);
831
- }));
832
- },
833
- requiredInput: []
834
- }, {
835
- value: 'lockField',
836
- translation: 'Object.ActionButton.LockField',
837
- group: 'selection',
838
- getActionCall: function getActionCall(_ref30) {
839
- var app = _ref30.app,
840
- qStateName = _ref30.qStateName,
841
- field = _ref30.field;
842
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16() {
843
- var fieldObj;
844
- return regeneratorRuntime.wrap(function _callee16$(_context16) {
845
- while (1) {
846
- switch (_context16.prev = _context16.next) {
847
- case 0:
848
- if (!field) {
849
- _context16.next = 6;
850
- break;
851
- }
852
-
853
- _context16.next = 3;
854
- return app.getField(field, qStateName);
855
-
856
- case 3:
857
- fieldObj = _context16.sent;
858
- _context16.next = 6;
859
- return fieldObj.lock();
860
-
861
- case 6:
862
- case "end":
863
- return _context16.stop();
864
- }
865
- }
866
- }, _callee16);
867
- }));
868
- },
869
- requiredInput: ['field']
870
- }, {
871
- value: 'unlockAll',
872
- translation: 'Object.ActionButton.UnlockAllSelections',
873
- group: 'selection',
874
- getActionCall: function getActionCall(_ref32) {
875
- var app = _ref32.app;
876
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17() {
877
- return regeneratorRuntime.wrap(function _callee17$(_context17) {
878
- while (1) {
879
- switch (_context17.prev = _context17.next) {
880
- case 0:
881
- _context17.next = 2;
882
- return app.unlockAll();
883
-
884
- case 2:
885
- case "end":
886
- return _context17.stop();
887
- }
888
- }
889
- }, _callee17);
890
- }));
891
- },
892
- requiredInput: []
893
- }, {
894
- value: 'unlockField',
895
- translation: 'Object.ActionButton.UnlockAField',
896
- group: 'selection',
897
- getActionCall: function getActionCall(_ref34) {
898
- var app = _ref34.app,
899
- qStateName = _ref34.qStateName,
900
- field = _ref34.field;
901
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18() {
902
- var fieldObj;
903
- return regeneratorRuntime.wrap(function _callee18$(_context18) {
904
- while (1) {
905
- switch (_context18.prev = _context18.next) {
906
- case 0:
907
- if (!field) {
908
- _context18.next = 6;
909
- break;
910
- }
911
-
912
- _context18.next = 3;
913
- return app.getField(field, qStateName);
914
-
915
- case 3:
916
- fieldObj = _context18.sent;
917
- _context18.next = 6;
918
- return fieldObj.unlock();
919
-
920
- case 6:
921
- case "end":
922
- return _context18.stop();
923
- }
924
- }
925
- }, _callee18);
926
- }));
927
- },
928
- requiredInput: ['field']
929
- }, {
930
- value: 'setVariable',
931
- translation: 'Object.ActionButton.SetVariable',
932
- group: 'variables',
933
- getActionCall: function getActionCall(_ref36) {
934
- var app = _ref36.app,
935
- variable = _ref36.variable,
936
- value = _ref36.value;
937
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19() {
938
- var variableObj;
939
- return regeneratorRuntime.wrap(function _callee19$(_context19) {
940
- while (1) {
941
- switch (_context19.prev = _context19.next) {
942
- case 0:
943
- if (!(variable && value)) {
944
- _context19.next = 11;
945
- break;
946
- }
947
-
948
- _context19.prev = 1;
949
- _context19.next = 4;
950
- return app.getVariableByName(variable);
951
-
952
- case 4:
953
- variableObj = _context19.sent;
954
- _context19.next = 7;
955
- return variableObj.setStringValue(value);
956
-
957
- case 7:
958
- _context19.next = 11;
959
- break;
960
-
961
- case 9:
962
- _context19.prev = 9;
963
- _context19.t0 = _context19["catch"](1);
964
-
965
- case 11:
966
- case "end":
967
- return _context19.stop();
968
- }
969
- }
970
- }, _callee19, null, [[1, 9]]);
971
- }));
972
- },
973
- requiredInput: ['variable', 'value']
974
- }, {
975
- value: 'doReload',
976
- translation: 'Object.ActionButton.DoReload',
977
- group: 'reload',
978
- getActionCall: function getActionCall(_ref38) {
979
- var app = _ref38.app,
980
- partial = _ref38.partial;
981
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20() {
982
- var e;
983
- return regeneratorRuntime.wrap(function _callee20$(_context20) {
984
- while (1) {
985
- switch (_context20.prev = _context20.next) {
986
- case 0:
987
- _context20.next = 2;
988
- return app.doReload(0, !!partial, false);
989
-
990
- case 2:
991
- e = _context20.sent;
992
-
993
- if (!e) {
994
- _context20.next = 6;
995
- break;
996
- }
997
-
998
- _context20.next = 6;
999
- return app.doSave();
1000
-
1001
- case 6:
1002
- case "end":
1003
- return _context20.stop();
1004
- }
1005
- }
1006
- }, _callee20);
1007
- }));
1008
- },
1009
- requiredInput: ['partial']
1010
- }, {
1011
- /** *************************************
1012
- * Execute Automation contacts internal urls to obtain automation
1013
- * information and execute the automation selected in the property panel in
1014
- * edit mode.
1015
- *
1016
- * ARGS
1017
- * app - Reference to current app inherited from index.js
1018
- * automation - the item id of the automation to contact the items api
1019
- * automationPostData - boolean value. If true, creates a bookmark of the
1020
- * current selections and sends the resulting bookmark id as an input
1021
- * parameter to the selected automation.
1022
- */
1023
- translation: 'Object.ActionButton.ExecuteAutomation',
1024
- value: 'executeAutomation',
1025
- getActionCall: function getActionCall(_ref40) {
1026
- var app = _ref40.app,
1027
- automation = _ref40.automation,
1028
- automationPostData = _ref40.automationPostData;
1029
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21() {
1030
- var itemInfo, autoInfo, executePath, inputBlocks, newDate, bmkProp, bmk;
1031
- return regeneratorRuntime.wrap(function _callee21$(_context21) {
1032
- while (1) {
1033
- switch (_context21.prev = _context21.next) {
1034
- case 0:
1035
- if (!(automation !== undefined)) {
1036
- _context21.next = 26;
1037
- break;
1038
- }
1039
-
1040
- _context21.prev = 1;
1041
- automation = encodeURIComponent(automation);
1042
- _context21.next = 5;
1043
- return fetch("../api/v1/items/".concat(automation)).then(function (response) {
1044
- return response.json();
1045
- });
1046
-
1047
- case 5:
1048
- itemInfo = _context21.sent;
1049
- _context21.next = 8;
1050
- return fetch("../api/v1/automations/".concat(itemInfo.resourceId)).then(function (response) {
1051
- return response.json();
1052
- });
1053
-
1054
- case 8:
1055
- autoInfo = _context21.sent;
1056
- executePath = "../api/v1/automations/".concat(autoInfo.guid, "/actions/execute?X-Execution-Token=").concat(autoInfo.execution_token);
1057
-
1058
- if (!(automationPostData && autoInfo.hasinputs)) {
1059
- _context21.next = 20;
1060
- break;
1061
- }
1062
-
1063
- _context21.next = 13;
1064
- return fetch("../api/v1/automations/".concat(itemInfo.resourceId, "/blocks")).then(function (response) {
1065
- return response.json();
1066
- }).then(function (blocks) {
1067
- var items;
1068
-
1069
- for (var i = 0; i < blocks.blocks.length; i++) {
1070
- if (blocks.blocks[i].displayName === 'Inputs') {
1071
- items = blocks.blocks[i].form;
1072
- break;
1073
- }
1074
- }
1075
-
1076
- return items;
1077
- });
1078
-
1079
- case 13:
1080
- inputBlocks = _context21.sent;
1081
- newDate = new Date();
1082
- bmkProp = {
1083
- qProp: {
1084
- qInfo: {
1085
- qId: "automation_".concat(app.id, "_").concat(automation, "_").concat(newDate.getTime()),
1086
- qType: 'bookmark'
1087
- },
1088
- qMetaDef: {
1089
- title: "Generated automation bookmark on ".concat(newDate.toISOString()),
1090
- description: 'Generated to provide target automation with bookmark to get current selection state',
1091
- _createdBy: 'sn-action-button',
1092
- _createdFor: 'automation',
1093
- _createdOn: "".concat(newDate.toISOString()),
1094
- _id: "automation_".concat(encodeURIComponent(app.id), "_").concat(automation, "_").concat(newDate.getTime())
1095
- }
1096
- }
1097
- };
1098
- _context21.next = 18;
1099
- return app.createBookmark(bmkProp).then(function (bookmark) {
1100
- return bookmark.getLayout();
1101
- }).then(function (layout) {
1102
- return layout.qInfo.qId;
1103
- });
1104
-
1105
- case 18:
1106
- bmk = _context21.sent;
1107
- executePath = "".concat(executePath, "&").concat(inputBlocks[0].label.toLowerCase(), "=").concat(encodeURIComponent(app.id), "&").concat(inputBlocks[1].label.toLowerCase(), "=").concat(bmk);
1108
-
1109
- case 20:
1110
- _context21.next = 22;
1111
- return fetch(executePath).then(function (response) {
1112
- return response.json();
1113
- });
1114
-
1115
- case 22:
1116
- _context21.next = 26;
1117
- break;
1118
-
1119
- case 24:
1120
- _context21.prev = 24;
1121
- _context21.t0 = _context21["catch"](1);
1122
-
1123
- case 26:
1124
- case "end":
1125
- return _context21.stop();
1126
- }
1127
- }
1128
- }, _callee21, null, [[1, 24]]);
1129
- }));
1130
- },
1131
- requiredInput: ['automation']
1132
- }];
1133
- function checkShowAction(data, field) {
1134
- var act = actions.find(function (action) {
1135
- return data.actionType === action.value;
1136
- });
1137
- return act && act.requiredInput && act.requiredInput.indexOf(field) !== -1;
1138
- }
1139
-
1140
- function evaluateCondition(condition) {
1141
- // case condition is commented
1142
- if (condition && condition.length >= 2 && condition[0] === '/' && condition[1] === '/') {
1143
- return true;
1144
- } // convert to numeric with -1 (true) as the default
1145
-
1146
-
1147
- var condVal = condition ? +condition : -1; // handle the string 'true' as true and all other strings as false
1148
-
1149
- if (Number.isNaN(+condVal)) {
1150
- return condition.toLowerCase() === 'true';
1151
- }
1152
-
1153
- return condVal !== 0;
1154
- }
1155
-
1156
- var Util = {
1157
- evaluateCondition: evaluateCondition
1158
- };
1159
-
1160
- var inIframe = function inIframe() {
1161
- try {
1162
- return window.self !== window.top;
1163
- } catch (error) {
1164
- return true;
1165
- }
1166
- };
1167
- var getOrderedVisibleSheet = /*#__PURE__*/function () {
1168
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(app) {
1169
- var sheets, visibleSheets;
1170
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
1171
- while (1) {
1172
- switch (_context2.prev = _context2.next) {
1173
- case 0:
1174
- _context2.next = 2;
1175
- return app.getSheetList();
1176
-
1177
- case 2:
1178
- sheets = _context2.sent;
1179
- visibleSheets = sheets.filter(function (sheet) {
1180
- return Util.evaluateCondition(sheet.qData.showCondition);
1181
- });
1182
- return _context2.abrupt("return", visibleSheets.sort(function (current, next) {
1183
- return current.qData.rank - next.qData.rank;
1184
- }));
1185
-
1186
- case 5:
1187
- case "end":
1188
- return _context2.stop();
1189
- }
1190
- }
1191
- }, _callee2);
1192
- }));
1193
-
1194
- return function getOrderedVisibleSheet(_x2) {
1195
- return _ref2.apply(this, arguments);
1196
- };
1197
- }();
1198
- var navigationActions = [{
1199
- translation: 'Object.ActionButton.NoNavigation',
1200
- value: 'none'
1201
- }, {
1202
- translation: 'Object.ActionButton.GoToNextSheet',
1203
- value: 'nextSheet',
1204
- navigationCall: function () {
1205
- var _navigationCall = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref3) {
1206
- var senseNavigation;
1207
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
1208
- while (1) {
1209
- switch (_context3.prev = _context3.next) {
1210
- case 0:
1211
- senseNavigation = _ref3.senseNavigation;
1212
- _context3.next = 3;
1213
- return senseNavigation.nextSheet();
1214
-
1215
- case 3:
1216
- case "end":
1217
- return _context3.stop();
1218
- }
1219
- }
1220
- }, _callee3);
1221
- }));
1222
-
1223
- function navigationCall(_x3) {
1224
- return _navigationCall.apply(this, arguments);
1225
- }
1226
-
1227
- return navigationCall;
1228
- }(),
1229
- requiredInput: []
1230
- }, {
1231
- translation: 'Object.ActionButton.GoToPreviousSheet',
1232
- value: 'prevSheet',
1233
- navigationCall: function () {
1234
- var _navigationCall2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref4) {
1235
- var senseNavigation;
1236
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
1237
- while (1) {
1238
- switch (_context4.prev = _context4.next) {
1239
- case 0:
1240
- senseNavigation = _ref4.senseNavigation;
1241
- _context4.next = 3;
1242
- return senseNavigation.prevSheet();
1243
-
1244
- case 3:
1245
- case "end":
1246
- return _context4.stop();
1247
- }
1248
- }
1249
- }, _callee4);
1250
- }));
1251
-
1252
- function navigationCall(_x4) {
1253
- return _navigationCall2.apply(this, arguments);
1254
- }
1255
-
1256
- return navigationCall;
1257
- }(),
1258
- requiredInput: []
1259
- }, {
1260
- translation: 'Object.ActionButton.GoToLastSheet',
1261
- value: 'lastSheet',
1262
- navigationCall: function () {
1263
- var _navigationCall3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(_ref5) {
1264
- var app, senseNavigation, sheets;
1265
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
1266
- while (1) {
1267
- switch (_context5.prev = _context5.next) {
1268
- case 0:
1269
- app = _ref5.app, senseNavigation = _ref5.senseNavigation;
1270
- _context5.next = 3;
1271
- return getOrderedVisibleSheet(app);
1272
-
1273
- case 3:
1274
- sheets = _context5.sent;
1275
- _context5.next = 6;
1276
- return senseNavigation.goToSheet(sheets[sheets.length - 1].qInfo.qId);
1277
-
1278
- case 6:
1279
- case "end":
1280
- return _context5.stop();
1281
- }
1282
- }
1283
- }, _callee5);
1284
- }));
1285
-
1286
- function navigationCall(_x5) {
1287
- return _navigationCall3.apply(this, arguments);
1288
- }
1289
-
1290
- return navigationCall;
1291
- }(),
1292
- requiredInput: []
1293
- }, {
1294
- translation: 'Object.ActionButton.GoToFirstSheet',
1295
- value: 'firstSheet',
1296
- navigationCall: function () {
1297
- var _navigationCall4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(_ref6) {
1298
- var app, senseNavigation, sheets;
1299
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
1300
- while (1) {
1301
- switch (_context6.prev = _context6.next) {
1302
- case 0:
1303
- app = _ref6.app, senseNavigation = _ref6.senseNavigation;
1304
- _context6.next = 3;
1305
- return getOrderedVisibleSheet(app);
1306
-
1307
- case 3:
1308
- sheets = _context6.sent;
1309
- _context6.next = 6;
1310
- return senseNavigation.goToSheet(sheets[0].qInfo.qId);
1311
-
1312
- case 6:
1313
- case "end":
1314
- return _context6.stop();
1315
- }
1316
- }
1317
- }, _callee6);
1318
- }));
1319
-
1320
- function navigationCall(_x6) {
1321
- return _navigationCall4.apply(this, arguments);
1322
- }
1323
-
1324
- return navigationCall;
1325
- }(),
1326
- requiredInput: []
1327
- }, {
1328
- translation: 'Object.ActionButton.GoToASheet',
1329
- value: 'goToSheet',
1330
- navigationCall: function () {
1331
- var _navigationCall5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(_ref7) {
1332
- var senseNavigation, sheet;
1333
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
1334
- while (1) {
1335
- switch (_context7.prev = _context7.next) {
1336
- case 0:
1337
- senseNavigation = _ref7.senseNavigation, sheet = _ref7.sheet;
1338
- _context7.t0 = sheet;
1339
-
1340
- if (!_context7.t0) {
1341
- _context7.next = 5;
1342
- break;
1343
- }
1344
-
1345
- _context7.next = 5;
1346
- return senseNavigation.goToSheet(sheet);
1347
-
1348
- case 5:
1349
- case "end":
1350
- return _context7.stop();
1351
- }
1352
- }
1353
- }, _callee7);
1354
- }));
1355
-
1356
- function navigationCall(_x7) {
1357
- return _navigationCall5.apply(this, arguments);
1358
- }
1359
-
1360
- return navigationCall;
1361
- }(),
1362
- // TODO replace by searchable dropdown
1363
- requiredInput: ['sheet']
1364
- }, {
1365
- translation: 'Object.ActionButton.GoToSheetById',
1366
- value: 'goToSheetById',
1367
- navigationCall: function () {
1368
- var _navigationCall6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(_ref8) {
1369
- var senseNavigation, sheet;
1370
- return regeneratorRuntime.wrap(function _callee8$(_context8) {
1371
- while (1) {
1372
- switch (_context8.prev = _context8.next) {
1373
- case 0:
1374
- senseNavigation = _ref8.senseNavigation, sheet = _ref8.sheet;
1375
- _context8.t0 = sheet;
1376
-
1377
- if (!_context8.t0) {
1378
- _context8.next = 5;
1379
- break;
1380
- }
1381
-
1382
- _context8.next = 5;
1383
- return senseNavigation.goToSheet(sheet);
1384
-
1385
- case 5:
1386
- case "end":
1387
- return _context8.stop();
1388
- }
1389
- }
1390
- }, _callee8);
1391
- }));
1392
-
1393
- function navigationCall(_x8) {
1394
- return _navigationCall6.apply(this, arguments);
1395
- }
1396
-
1397
- return navigationCall;
1398
- }(),
1399
- // TODO replace by searchable dropdown
1400
- requiredInput: ['sheetId']
1401
- }, {
1402
- translation: 'Object.ActionButton.GoToStory',
1403
- value: 'goToStory',
1404
- navigationCall: function () {
1405
- var _navigationCall7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(_ref9) {
1406
- var senseNavigation, story;
1407
- return regeneratorRuntime.wrap(function _callee9$(_context9) {
1408
- while (1) {
1409
- switch (_context9.prev = _context9.next) {
1410
- case 0:
1411
- senseNavigation = _ref9.senseNavigation, story = _ref9.story;
1412
- _context9.t0 = story;
1413
-
1414
- if (!_context9.t0) {
1415
- _context9.next = 5;
1416
- break;
1417
- }
1418
-
1419
- _context9.next = 5;
1420
- return senseNavigation.goToStory(story);
1421
-
1422
- case 5:
1423
- case "end":
1424
- return _context9.stop();
1425
- }
1426
- }
1427
- }, _callee9);
1428
- }));
1429
-
1430
- function navigationCall(_x9) {
1431
- return _navigationCall7.apply(this, arguments);
1432
- }
1433
-
1434
- return navigationCall;
1435
- }(),
1436
- requiredInput: ['story']
1437
- }, {
1438
- translation: 'Object.ActionButton.OpenWebsiteEmail',
1439
- value: 'openWebsite',
1440
- navigationCall: function () {
1441
- var _navigationCall8 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(_ref10) {
1442
- var websiteUrl, sameWindow, url, target;
1443
- return regeneratorRuntime.wrap(function _callee10$(_context10) {
1444
- while (1) {
1445
- switch (_context10.prev = _context10.next) {
1446
- case 0:
1447
- websiteUrl = _ref10.websiteUrl, sameWindow = _ref10.sameWindow;
1448
-
1449
- try {
1450
- if (websiteUrl) {
1451
- url = websiteUrl.match(/^(https?:\/\/|mailto:)/) ? websiteUrl : "http://".concat(websiteUrl);
1452
- target = '';
1453
-
1454
- if (sameWindow) {
1455
- target = inIframe() ? '_parent' : '_self';
1456
- }
1457
-
1458
- window.open(url, target);
1459
- }
1460
- } catch (error) {// no-op
1461
- }
1462
-
1463
- case 2:
1464
- case "end":
1465
- return _context10.stop();
1466
- }
1467
- }
1468
- }, _callee10);
1469
- }));
1470
-
1471
- function navigationCall(_x10) {
1472
- return _navigationCall8.apply(this, arguments);
1473
- }
1474
-
1475
- return navigationCall;
1476
- }(),
1477
- requiredInput: ['websiteUrl']
1478
- }];
1479
- var checkShowNavigation = function checkShowNavigation(data, field) {
1480
- var nav = navigationActions.find(function (navigation) {
1481
- return data.navigation.action === navigation.value;
1482
- });
1483
- return nav && nav.requiredInput && nav.requiredInput.indexOf(field) !== -1;
1484
- };
1485
-
1486
- function getValue(dataContainer, reference, defaultValue) {
1487
- var steps = reference.split('.');
1488
- var i;
1489
-
1490
- if (dataContainer === undefined) {
1491
- return defaultValue;
1492
- }
1493
-
1494
- for (i = 0; i < steps.length; ++i) {
1495
- if (typeof dataContainer[steps[i]] === 'undefined') {
1496
- return defaultValue;
1497
- }
1498
-
1499
- dataContainer = dataContainer[steps[i]];
1500
- }
1501
-
1502
- return dataContainer;
1503
- }
1504
-
1505
- var propertyResolver = {
1506
- getValue: getValue
1507
- };
1508
-
1509
- function convertAction(action, newProperties) {
1510
- var newAction = {
1511
- actionType: action.actionType,
1512
- bookmark: action.selectedBookmark,
1513
- // Will need to convert field selected by expression
1514
- field: action.selectedField,
1515
- // Need to convert expression for variable
1516
- variable: action.variable,
1517
- value: action.value,
1518
- softLock: action.softLock,
1519
- cId: action.cId
1520
- };
1521
-
1522
- switch (action.actionType) {
1523
- case 'clearOther':
1524
- newAction.actionType = 'clearAllButThis';
1525
- break;
1526
-
1527
- case 'unlockAllAndClearAll':
1528
- newAction.actionType = 'clearAll';
1529
- newAction.softLock = true;
1530
- break;
1531
-
1532
- case 'selectField':
1533
- newAction.actionType = 'selectMatchingValues';
1534
- break;
1535
-
1536
- case 'selectAndLockField':
1537
- newProperties.actions.push(_objectSpread2(_objectSpread2({}, newAction), {}, {
1538
- cId: null,
1539
- actionType: 'selectMatchingValues'
1540
- }));
1541
- newAction.actionType = 'lockField';
1542
- break;
1543
- }
1544
-
1545
- return newProperties.actions.push(newAction);
1546
- }
1547
- function convertNavigation(oldType) {
1548
- switch (oldType) {
1549
- case 'gotoSheet':
1550
- return 'goToSheet';
1551
-
1552
- case 'gotoSheetById':
1553
- return 'goToSheetById';
1554
-
1555
- case 'gotoStory':
1556
- return 'goToStory';
1557
-
1558
- case 'switchToEdit':
1559
- return 'none';
1560
-
1561
- default:
1562
- return oldType;
1563
- }
1564
- }
1565
-
1566
- var importProperties = function importProperties(exportedFmt, initialProperties) {
1567
- var newPropertyTree = {
1568
- qChildren: []
1569
- };
1570
-
1571
- var newProperties = _objectSpread2({
1572
- actions: [],
1573
- // Adding props to avoid errors from old navigation button. Converting to any other chart will still give these errors
1574
- props: {
1575
- useEnabledCondition: null,
1576
- fullWidth: 'auto'
1577
- },
1578
- qLayoutExclude: {
1579
- disabled: {}
1580
- }
1581
- }, initialProperties);
1582
-
1583
- if (exportedFmt && exportedFmt.properties.visualization === 'qlik-button-for-navigation') {
1584
- Object.keys(exportedFmt.properties).forEach(function (key) {
1585
- var props;
1586
-
1587
- switch (key) {
1588
- case 'props':
1589
- props = exportedFmt.properties[key];
1590
- newProperties.style.label = props.buttonLabel;
1591
- newProperties.style.icon.useIcon = props.buttonShowIcon;
1592
- newProperties.style.icon.iconType = props.buttonIconLui;
1593
- newProperties.style.font.align = props.buttonTextAlign;
1594
- newProperties.useEnabledCondition = props.useEnabledCondition;
1595
- newProperties.enabledCondition = props.enabledCondition;
1596
- props.actionItems && props.actionItems.forEach(function (actionItem) {
1597
- convertAction(actionItem, newProperties);
1598
- });
1599
- newProperties.navigation = {
1600
- action: convertNavigation(props.navigationAction),
1601
- // Need to convert sheet from expression
1602
- sheet: props.navigationAction === 'gotoSheetById' ? props.sheetId : props.selectedSheet,
1603
- story: props.selectedStory,
1604
- websiteUrl: props.websiteUrl,
1605
- sameWindow: props.sameWindow
1606
- };
1607
- break;
1608
-
1609
- case 'qStateName':
1610
- case 'showTitles':
1611
- case 'title':
1612
- case 'subtitle':
1613
- case 'footnote':
1614
- newProperties[key] = exportedFmt.properties[key];
1615
- break;
1616
- }
1617
- });
1618
- }
1619
-
1620
- newPropertyTree.qProperty = newProperties;
1621
- return newPropertyTree;
1622
- };
1623
-
1624
- var luiIcons = [{
1625
- value: 'image',
1626
- icon: 'image',
1627
- label: 'Image'
1628
- }, {
1629
- value: 'back',
1630
- icon: 'back',
1631
- label: 'Back'
1632
- }, {
1633
- value: 'forward',
1634
- icon: 'forward',
1635
- label: 'Forward'
1636
- }, {
1637
- value: 'history',
1638
- icon: 'history',
1639
- label: 'History'
1640
- }, {
1641
- value: 'help',
1642
- icon: 'help',
1643
- label: 'Help'
1644
- }, {
1645
- value: 'info',
1646
- icon: 'info',
1647
- label: 'Info'
1648
- }, {
1649
- value: 'text',
1650
- icon: 'text',
1651
- label: 'Text'
1652
- }, {
1653
- value: 'group',
1654
- icon: 'group',
1655
- label: 'Group'
1656
- }, {
1657
- value: 'search',
1658
- icon: 'search',
1659
- label: 'Search'
1660
- }, {
1661
- value: 'zoom-in',
1662
- icon: 'zoom-in',
1663
- label: 'Zoom in'
1664
- }, {
1665
- value: 'zoom-out',
1666
- icon: 'zoom-out',
1667
- label: 'Zoom out'
1668
- }, {
1669
- value: 'export',
1670
- icon: 'export',
1671
- label: 'Export'
1672
- }, {
1673
- value: 'import',
1674
- icon: 'import',
1675
- label: 'Import'
1676
- }, {
1677
- value: 'field',
1678
- icon: 'field',
1679
- label: 'Field'
1680
- }, {
1681
- value: 'lock',
1682
- icon: 'lock',
1683
- label: 'Lock'
1684
- }, {
1685
- value: 'unlock',
1686
- icon: 'unlock',
1687
- label: 'Unlock'
1688
- }, {
1689
- value: 'database',
1690
- icon: 'database',
1691
- label: 'Database'
1692
- }, {
1693
- value: 'calendar',
1694
- icon: 'calendar',
1695
- label: 'Calendar'
1696
- }, {
1697
- value: 'bookmark',
1698
- icon: 'bookmark',
1699
- label: 'Bookmark'
1700
- }, {
1701
- value: 'library',
1702
- icon: 'library',
1703
- label: 'Library'
1704
- }, {
1705
- value: 'star',
1706
- icon: 'star',
1707
- label: 'Star'
1708
- }, {
1709
- value: 'print',
1710
- icon: 'print',
1711
- label: 'Print'
1712
- }, {
1713
- value: 'remove',
1714
- icon: 'remove',
1715
- label: 'Remove'
1716
- }, {
1717
- value: 'handle',
1718
- icon: 'handle',
1719
- label: 'Handle'
1720
- }, {
1721
- value: 'handle-horizontal',
1722
- icon: 'handle-horizontal',
1723
- label: 'Handle horizontal'
1724
- }, {
1725
- value: 'menu',
1726
- icon: 'menu',
1727
- label: 'Menu'
1728
- }, {
1729
- value: 'list',
1730
- icon: 'list',
1731
- label: 'List'
1732
- }, {
1733
- value: 'unordered-list',
1734
- icon: 'unordered-list',
1735
- label: 'Unordered list'
1736
- }, {
1737
- value: 'clock',
1738
- icon: 'clock',
1739
- label: 'Clock'
1740
- }, {
1741
- value: 'puzzle',
1742
- icon: 'puzzle',
1743
- label: 'Puzzle'
1744
- }, {
1745
- value: 'filterpane',
1746
- icon: 'filterpane',
1747
- label: 'Filterpane'
1748
- }, {
1749
- value: 'plus',
1750
- icon: 'plus',
1751
- label: 'Plus'
1752
- }, {
1753
- value: 'minus',
1754
- icon: 'minus',
1755
- label: 'Minus'
1756
- }, {
1757
- value: 'triangle-top',
1758
- icon: 'triangle-top',
1759
- label: 'Triangle top'
1760
- }, {
1761
- value: 'triangle-bottom',
1762
- icon: 'triangle-bottom',
1763
- label: 'Triangle bottom'
1764
- }, {
1765
- value: 'triangle-left',
1766
- icon: 'triangle-left',
1767
- label: 'Triangle left'
1768
- }, {
1769
- value: 'triangle-right',
1770
- icon: 'triangle-right',
1771
- label: 'Triangle right'
1772
- }, {
1773
- value: 'tick',
1774
- icon: 'tick',
1775
- label: 'Tick'
1776
- }, {
1777
- value: 'cogwheel',
1778
- icon: 'cogwheel',
1779
- label: 'Cogwheel'
1780
- }, {
1781
- value: 'settings',
1782
- icon: 'settings',
1783
- label: 'Settings'
1784
- }, {
1785
- value: 'cut',
1786
- icon: 'cut',
1787
- label: 'Cut'
1788
- }, {
1789
- value: 'copy',
1790
- icon: 'copy',
1791
- label: 'Copy'
1792
- }, {
1793
- value: 'paste',
1794
- icon: 'paste',
1795
- label: 'Paste'
1796
- }, {
1797
- value: 'camera',
1798
- icon: 'camera',
1799
- label: 'Camera'
1800
- }, {
1801
- value: 'slide-show',
1802
- icon: 'slide-show',
1803
- label: 'Slide show'
1804
- }, {
1805
- value: 'palette',
1806
- icon: 'palette',
1807
- label: 'Palette'
1808
- }, {
1809
- value: 'shapes',
1810
- icon: 'shapes',
1811
- label: 'Shapes'
1812
- }, {
1813
- value: 'effects',
1814
- icon: 'effects',
1815
- label: 'Effects'
1816
- }, {
1817
- value: 'file',
1818
- icon: 'file',
1819
- label: 'File'
1820
- }, {
1821
- value: 'expand',
1822
- icon: 'expand',
1823
- label: 'Expand'
1824
- }, {
1825
- value: 'collapse',
1826
- icon: 'collapse',
1827
- label: 'Collapse'
1828
- }, {
1829
- value: 'bin',
1830
- icon: 'bin',
1831
- label: 'Bin'
1832
- }, {
1833
- value: 'link',
1834
- icon: 'link',
1835
- label: 'Link'
1836
- }, {
1837
- value: 'pivot',
1838
- icon: 'pivot',
1839
- label: 'Pivot'
1840
- }, {
1841
- value: 'reload',
1842
- icon: 'reload',
1843
- label: 'Reload'
1844
- }, {
1845
- value: 'add',
1846
- icon: 'add',
1847
- label: 'Add'
1848
- }, {
1849
- value: 'edit',
1850
- icon: 'edit',
1851
- label: 'Edit'
1852
- }, {
1853
- value: 'key',
1854
- icon: 'key',
1855
- label: 'Key'
1856
- }, {
1857
- value: 'box',
1858
- icon: 'box',
1859
- label: 'Box'
1860
- }, {
1861
- value: 'home',
1862
- icon: 'home',
1863
- label: 'Home'
1864
- }, {
1865
- value: 'person',
1866
- icon: 'person',
1867
- label: 'Person'
1868
- }, {
1869
- value: 'grid',
1870
- icon: 'grid',
1871
- label: 'Grid'
1872
- }, {
1873
- value: 'cloud',
1874
- icon: 'cloud',
1875
- label: 'Cloud'
1876
- }, {
1877
- value: 'more',
1878
- icon: 'more',
1879
- label: 'More'
1880
- }, {
1881
- value: 'folder',
1882
- icon: 'folder',
1883
- label: 'Folder'
1884
- }, {
1885
- value: 'drop',
1886
- icon: 'drop',
1887
- label: 'Drop'
1888
- }, {
1889
- value: 'play',
1890
- icon: 'play',
1891
- label: 'Play'
1892
- }, {
1893
- value: 'tag',
1894
- icon: 'tag',
1895
- label: 'Tag'
1896
- }, {
1897
- value: 'close',
1898
- icon: 'close',
1899
- label: 'Close'
1900
- }, {
1901
- value: 'warning',
1902
- icon: 'warning',
1903
- label: 'Warning'
1904
- }, {
1905
- value: 'warning-triangle',
1906
- icon: 'warning-triangle',
1907
- label: 'Warning triangle'
1908
- }, {
1909
- value: 'share',
1910
- icon: 'share',
1911
- label: 'Share'
1912
- }, {
1913
- value: 'top',
1914
- icon: 'top',
1915
- label: 'Top'
1916
- }, {
1917
- value: 'low-resolution',
1918
- icon: 'low-resolution',
1919
- label: 'Low resolution'
1920
- }, {
1921
- value: 'high-resolution',
1922
- icon: 'high-resolution',
1923
- label: 'High resolution'
1924
- }, {
1925
- value: 'view',
1926
- icon: 'view',
1927
- label: 'View'
1928
- }, {
1929
- value: 'control',
1930
- icon: 'control',
1931
- label: 'Control'
1932
- }, {
1933
- value: 'code',
1934
- icon: 'code',
1935
- label: 'Code'
1936
- }, {
1937
- value: 'upload',
1938
- icon: 'upload',
1939
- label: 'Upload'
1940
- }, {
1941
- value: 'repair',
1942
- icon: 'repair',
1943
- label: 'Repair'
1944
- }, {
1945
- value: 'split',
1946
- icon: 'split',
1947
- label: 'Split'
1948
- }, {
1949
- value: 'up-down',
1950
- icon: 'up-down',
1951
- label: 'Up down'
1952
- }, {
1953
- value: 'disconnect',
1954
- icon: 'disconnect',
1955
- label: 'Disconnect'
1956
- }, {
1957
- value: 'photo-library',
1958
- icon: 'photo-library',
1959
- label: 'Photo library'
1960
- }, {
1961
- value: 'application',
1962
- icon: 'application',
1963
- label: 'Application'
1964
- }, {
1965
- value: 'new-tab',
1966
- icon: 'new-tab',
1967
- label: 'New tab'
1968
- }, {
1969
- value: 'ascending',
1970
- icon: 'ascending',
1971
- label: 'Ascending'
1972
- }, {
1973
- value: 'descending',
1974
- icon: 'descending',
1975
- label: 'Descending'
1976
- }, {
1977
- value: 'arrow-up',
1978
- icon: 'arrow-up',
1979
- label: 'Arrow up'
1980
- }, {
1981
- value: 'arrow-down',
1982
- icon: 'arrow-down',
1983
- label: 'Arrow down'
1984
- }, {
1985
- value: 'arrow-right',
1986
- icon: 'arrow-right',
1987
- label: 'Arrow right'
1988
- }, {
1989
- value: 'arrow-left',
1990
- icon: 'arrow-left',
1991
- label: 'Arrow left'
1992
- }, {
1993
- value: 'sync',
1994
- icon: 'sync',
1995
- label: 'Sync'
1996
- }, {
1997
- value: 'draggable',
1998
- icon: 'draggable',
1999
- label: 'Draggable'
2000
- }, {
2001
- value: 'book',
2002
- icon: 'book',
2003
- label: 'Book'
2004
- }, {
2005
- value: 'measure',
2006
- icon: 'measure',
2007
- label: 'Measure'
2008
- }, {
2009
- value: 'download',
2010
- icon: 'download',
2011
- label: 'Download'
2012
- }, {
2013
- value: 'more-rounded',
2014
- icon: 'more-rounded',
2015
- label: 'More rounded'
2016
- }, {
2017
- value: 'align-object-left',
2018
- icon: 'align-object-left',
2019
- label: 'Align object-left'
2020
- }, {
2021
- value: 'align-object-center',
2022
- icon: 'align-object-center',
2023
- label: 'Align object-center'
2024
- }, {
2025
- value: 'align-object-right',
2026
- icon: 'align-object-right',
2027
- label: 'Align object-right'
2028
- }, {
2029
- value: 'submit',
2030
- icon: 'submit',
2031
- label: 'Submit'
2032
- }, {
2033
- value: 'operators',
2034
- icon: 'operators',
2035
- label: 'Operators'
2036
- }, {
2037
- value: 'general-data-class',
2038
- icon: 'general-data-class',
2039
- label: 'General data-class'
2040
- }, {
2041
- value: 'building',
2042
- icon: 'building',
2043
- label: 'Building'
2044
- }, {
2045
- value: 'bell',
2046
- icon: 'bell',
2047
- label: 'Bell'
2048
- }, {
2049
- value: 'unlink',
2050
- icon: 'unlink',
2051
- label: 'Unlink'
2052
- }, {
2053
- value: 'lightbulb',
2054
- icon: 'lightbulb',
2055
- label: 'Lightbulb'
2056
- }, {
2057
- value: 'log-in',
2058
- icon: 'log-in',
2059
- label: 'Log in'
2060
- }, {
2061
- value: 'log-out',
2062
- icon: 'log-out',
2063
- label: 'Log out'
2064
- }, {
2065
- value: 'previous',
2066
- icon: 'previous',
2067
- label: 'Previous'
2068
- }, {
2069
- value: 'goto',
2070
- icon: 'goto',
2071
- label: 'Goto'
2072
- }, {
2073
- value: 'save',
2074
- icon: 'save',
2075
- label: 'Save'
2076
- }, {
2077
- value: 'pause',
2078
- icon: 'pause',
2079
- label: 'Pause'
2080
- }, {
2081
- value: 'stop',
2082
- icon: 'stop',
2083
- label: 'Stop'
2084
- }, {
2085
- value: 'step-in',
2086
- icon: 'step-in',
2087
- label: 'Step in'
2088
- }, {
2089
- value: 'comment',
2090
- icon: 'comment',
2091
- label: 'Comment'
2092
- }, {
2093
- value: 'indent',
2094
- icon: 'indent',
2095
- label: 'Indent'
2096
- }, {
2097
- value: 'undent',
2098
- icon: 'undent',
2099
- label: 'Undent'
2100
- }, {
2101
- value: 'filter',
2102
- icon: 'filter',
2103
- label: 'Filter'
2104
- }, {
2105
- value: 'clear-filter',
2106
- icon: 'clear-filter',
2107
- label: 'Clear filter'
2108
- }, {
2109
- value: 'insert',
2110
- icon: 'insert',
2111
- label: 'Insert'
2112
- }, {
2113
- value: 'direction-left',
2114
- icon: 'direction-left',
2115
- label: 'Direction left'
2116
- }, {
2117
- value: 'swap',
2118
- icon: 'swap',
2119
- label: 'Swap'
2120
- }, {
2121
- value: 'bubbles',
2122
- icon: 'bubbles',
2123
- label: 'Bubbles'
2124
- }, {
2125
- value: 'sheet',
2126
- icon: 'sheet',
2127
- label: 'Sheet'
2128
- }, {
2129
- value: 'object',
2130
- icon: 'object',
2131
- label: 'Object'
2132
- }, {
2133
- value: 'clear-selections',
2134
- icon: 'clear-selections',
2135
- label: 'Clear selections'
2136
- }, {
2137
- value: 'selections-tool',
2138
- icon: 'selections-tool',
2139
- label: 'Selections tool'
2140
- }, {
2141
- value: 'selections-reload',
2142
- icon: 'selections-reload',
2143
- label: 'Selections reload'
2144
- }, {
2145
- value: 'selections-back',
2146
- icon: 'selections-back',
2147
- label: 'Selections back'
2148
- }, {
2149
- value: 'selections-forward',
2150
- icon: 'selections-forward',
2151
- label: 'Selections forward'
2152
- }, {
2153
- value: 'expression',
2154
- icon: 'expression',
2155
- label: 'Expression'
2156
- }, {
2157
- value: 'select-alternative',
2158
- icon: 'select-alternative',
2159
- label: 'Select alternative'
2160
- }, {
2161
- value: 'select-possible',
2162
- icon: 'select-possible',
2163
- label: 'Select possible'
2164
- }, {
2165
- value: 'select-excluded',
2166
- icon: 'select-excluded',
2167
- label: 'Select excluded'
2168
- }, {
2169
- value: 'select-all',
2170
- icon: 'select-all',
2171
- label: 'Select all'
2172
- }, {
2173
- value: 'bar-chart',
2174
- icon: 'bar-chart',
2175
- label: 'Bar chart'
2176
- }, {
2177
- value: 'bar-chart-horizontal',
2178
- icon: 'bar-chart-horizontal',
2179
- label: 'Bar chart-horizontal'
2180
- }, {
2181
- value: 'line-chart',
2182
- icon: 'line-chart',
2183
- label: 'Line chart'
2184
- }, {
2185
- value: 'pie-chart',
2186
- icon: 'pie-chart',
2187
- label: 'Pie chart'
2188
- }, {
2189
- value: 'gauge-chart',
2190
- icon: 'gauge-chart',
2191
- label: 'Gauge chart'
2192
- }, {
2193
- value: 'kpi',
2194
- icon: 'kpi',
2195
- label: 'Kpi'
2196
- }, {
2197
- value: 'scatter-chart',
2198
- icon: 'scatter-chart',
2199
- label: 'Scatter chart'
2200
- }, {
2201
- value: 'map',
2202
- icon: 'map',
2203
- label: 'Map'
2204
- }, {
2205
- value: 'table',
2206
- icon: 'table',
2207
- label: 'Table'
2208
- }, {
2209
- value: 'pivot-table',
2210
- icon: 'pivot-table',
2211
- label: 'Pivot table'
2212
- }, {
2213
- value: 'treemap',
2214
- icon: 'treemap',
2215
- label: 'Treemap'
2216
- }, {
2217
- value: 'combo-chart',
2218
- icon: 'combo-chart',
2219
- label: 'Combo chart'
2220
- }, {
2221
- value: 'boxplot',
2222
- icon: 'boxplot',
2223
- label: 'Boxplot'
2224
- }, {
2225
- value: 'distributionplot',
2226
- icon: 'distributionplot',
2227
- label: 'Distributionplot'
2228
- }, {
2229
- value: 'histogram',
2230
- icon: 'histogram',
2231
- label: 'Histogram'
2232
- }, {
2233
- value: 'direct-discovery',
2234
- icon: 'direct-discovery',
2235
- label: 'Direct discovery'
2236
- }, {
2237
- value: 'data-model',
2238
- icon: 'data-model',
2239
- label: 'Data model'
2240
- }, {
2241
- value: 'script',
2242
- icon: 'script',
2243
- label: 'Script'
2244
- }, {
2245
- value: 'script-ok',
2246
- icon: 'script-ok',
2247
- label: 'Script ok'
2248
- }, {
2249
- value: 'debug',
2250
- icon: 'debug',
2251
- label: 'Debug'
2252
- }, {
2253
- value: 'auto-layout',
2254
- icon: 'auto-layout',
2255
- label: 'Auto layout'
2256
- }];
2257
-
2258
- var colorOptions = [{
2259
- value: false,
2260
- translation: 'properties.colorMode.primary'
2261
- }, {
2262
- value: true,
2263
- translation: 'properties.colorMode.byExpression'
2264
- }];
2265
- var toggleOptions = [{
2266
- value: true,
2267
- translation: 'properties.on'
2268
- }, {
2269
- value: false,
2270
- translation: 'properties.off'
2271
- }];
2272
- function ext(_ref) {
2273
- var translator = _ref.translator,
2274
- automationsEnabled = _ref.automationsEnabled;
2275
- return {
2276
- definition: {
2277
- type: 'items',
2278
- component: 'accordion',
2279
- items: {
2280
- actions: {
2281
- type: 'items',
2282
- translation: 'Object.ActionButton.ActionsAndNavigation',
2283
- grouped: true,
2284
- items: {
2285
- actions: {
2286
- type: 'array',
2287
- translation: 'Object.ActionButton.Actions',
2288
- ref: 'actions',
2289
- itemTitleRef: function itemTitleRef(data) {
2290
- if (data.actionLabel) {
2291
- return data.actionLabel;
2292
- } // If actionType exists but it's not found in the actions list,
2293
- // the action is invalid for the current version of the button
2294
-
2295
-
2296
- var fallbackTitle = data.actionType ? 'Object.ActionButton.InvalidAction' : 'Object.ActionButton.NewAction';
2297
- var action = actions.find(function (act) {
2298
- return data.actionType === act.value;
2299
- });
2300
- return translator.get(action && action.translation || fallbackTitle);
2301
- },
2302
- allowAdd: true,
2303
- allowRemove: true,
2304
- allowMove: true,
2305
- addTranslation: 'Object.ActionButton.AddAction',
2306
- items: {
2307
- label: {
2308
- component: 'string',
2309
- ref: 'actionLabel',
2310
- translation: 'Common.Label',
2311
- expression: 'optional',
2312
- defaultValue: ''
2313
- },
2314
- actionType: {
2315
- type: 'string',
2316
- ref: 'actionType',
2317
- component: 'expression-with-dropdown',
2318
- translation: 'Object.ActionButton.Action',
2319
- defaultValue: '',
2320
- options: actions.filter(function (action) {
2321
- return action.value !== 'executeAutomation' || automationsEnabled;
2322
- }),
2323
- dropdownOnly: true
2324
- },
2325
- bookmark: {
2326
- type: 'string',
2327
- ref: 'bookmark',
2328
- component: 'expression-with-dropdown',
2329
- translation: 'ExpressionEditor.SetExpresions.Bookmark',
2330
- defaultValue: '',
2331
- dropdownOnly: true,
2332
- options: function () {
2333
- var _options = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(action, hyperCubeHandler) {
2334
- var bms;
2335
- return regeneratorRuntime.wrap(function _callee$(_context) {
2336
- while (1) {
2337
- switch (_context.prev = _context.next) {
2338
- case 0:
2339
- _context.next = 2;
2340
- return hyperCubeHandler.app.getBookmarkList();
2341
-
2342
- case 2:
2343
- bms = _context.sent;
2344
- return _context.abrupt("return", bms.map(function (bookmark) {
2345
- return {
2346
- label: bookmark.qData.title,
2347
- value: bookmark.qInfo.qId
2348
- };
2349
- }));
2350
-
2351
- case 4:
2352
- case "end":
2353
- return _context.stop();
2354
- }
2355
- }
2356
- }, _callee);
2357
- }));
2358
-
2359
- function options(_x, _x2) {
2360
- return _options.apply(this, arguments);
2361
- }
2362
-
2363
- return options;
2364
- }(),
2365
- show: function show(data) {
2366
- return checkShowAction(data, 'bookmark');
2367
- }
2368
- },
2369
- field: {
2370
- type: 'string',
2371
- ref: 'field',
2372
- component: 'expression-with-dropdown',
2373
- translation: 'Common.Field',
2374
- defaultValue: '',
2375
- dropdownOnly: true,
2376
- options: function () {
2377
- var _options2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(action, hyperCubeHandler) {
2378
- var fields;
2379
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
2380
- while (1) {
2381
- switch (_context2.prev = _context2.next) {
2382
- case 0:
2383
- _context2.next = 2;
2384
- return hyperCubeHandler.app.getFieldList();
2385
-
2386
- case 2:
2387
- fields = _context2.sent;
2388
- return _context2.abrupt("return", fields.map(function (field) {
2389
- return {
2390
- label: field.qName,
2391
- value: field.qName
2392
- };
2393
- }));
2394
-
2395
- case 4:
2396
- case "end":
2397
- return _context2.stop();
2398
- }
2399
- }
2400
- }, _callee2);
2401
- }));
2402
-
2403
- function options(_x3, _x4) {
2404
- return _options2.apply(this, arguments);
2405
- }
2406
-
2407
- return options;
2408
- }(),
2409
- show: function show(data) {
2410
- return checkShowAction(data, 'field');
2411
- }
2412
- },
2413
- variable: {
2414
- type: 'string',
2415
- ref: 'variable',
2416
- component: 'expression-with-dropdown',
2417
- translation: 'Common.Variable',
2418
- defaultValue: '',
2419
- expressionType: 'StringExpression',
2420
- options: function () {
2421
- var _options3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(action, hyperCubeHandler) {
2422
- var variables;
2423
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
2424
- while (1) {
2425
- switch (_context3.prev = _context3.next) {
2426
- case 0:
2427
- _context3.next = 2;
2428
- return hyperCubeHandler.app.getVariableList();
2429
-
2430
- case 2:
2431
- variables = _context3.sent;
2432
- return _context3.abrupt("return", variables.filter(function (v) {
2433
- return !v.qIsReserved || v.qIsReserved && action.showSystemVariables;
2434
- }).map(function (v) {
2435
- return {
2436
- label: v.qName,
2437
- value: v.qName
2438
- };
2439
- }));
2440
-
2441
- case 4:
2442
- case "end":
2443
- return _context3.stop();
2444
- }
2445
- }
2446
- }, _callee3);
2447
- }));
2448
-
2449
- function options(_x5, _x6) {
2450
- return _options3.apply(this, arguments);
2451
- }
2452
-
2453
- return options;
2454
- }(),
2455
- show: function show(data) {
2456
- return checkShowAction(data, 'variable');
2457
- }
2458
- },
2459
- showSystemVariables: {
2460
- type: 'boolean',
2461
- ref: 'showSystemVariables',
2462
- translation: 'ExpressionEditor.SystemVariables',
2463
- defaultValue: false,
2464
- show: function show(data) {
2465
- return checkShowAction(data, 'variable');
2466
- }
2467
- },
2468
- softLock: {
2469
- type: 'boolean',
2470
- ref: 'softLock',
2471
- translation: 'Object.ActionButton.Softlock',
2472
- defaultValue: false,
2473
- show: function show(data) {
2474
- return checkShowAction(data, 'softLock');
2475
- }
2476
- },
2477
- value: {
2478
- type: 'string',
2479
- ref: 'value',
2480
- component: 'string',
2481
- translation: 'properties.value',
2482
- expression: 'optional',
2483
- show: function show(data) {
2484
- return checkShowAction(data, 'value');
2485
- }
2486
- },
2487
- partial: {
2488
- type: 'boolean',
2489
- ref: 'partial',
2490
- translation: 'Object.ActionButton.Partial',
2491
- defaultValue: false,
2492
- show: function show(data) {
2493
- return checkShowAction(data, 'partial');
2494
- }
2495
- },
2496
- // adds automation to actions and adds a dropdown property panel
2497
- // item to select the automation for the button to trigger
2498
- automation: {
2499
- type: 'string',
2500
- component: 'expression-with-dropdown',
2501
- translation: 'Object.ActionButton.Automation',
2502
- ref: 'automation',
2503
- dropdownOnly: true,
2504
- options: function () {
2505
- var _options4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
2506
- var automations;
2507
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
2508
- while (1) {
2509
- switch (_context4.prev = _context4.next) {
2510
- case 0:
2511
- _context4.next = 2;
2512
- return fetch('../api/v1/items?resourceType=automation&limit=100').then(function (response) {
2513
- return response.json();
2514
- });
2515
-
2516
- case 2:
2517
- automations = _context4.sent;
2518
- return _context4.abrupt("return", automations.data.map(function (blend) {
2519
- return {
2520
- value: blend.id,
2521
- label: blend.name
2522
- };
2523
- }));
2524
-
2525
- case 4:
2526
- case "end":
2527
- return _context4.stop();
2528
- }
2529
- }
2530
- }, _callee4);
2531
- }));
2532
-
2533
- function options() {
2534
- return _options4.apply(this, arguments);
2535
- }
2536
-
2537
- return options;
2538
- }(),
2539
- show: function show(data) {
2540
- return checkShowAction(data, 'automation');
2541
- }
2542
- },
2543
- // Boolean property to instruct the automation action to create a
2544
- // bookmark and send it to the selected automation in the
2545
- // property panel.
2546
- automationPostData: {
2547
- type: 'boolean',
2548
- ref: 'automationPostData',
2549
- translation: 'Object.ActionButton.Automation.SendSelections',
2550
- show: function show(data) {
2551
- return checkShowAction(data, 'automation');
2552
- },
2553
- defaultValue: false
2554
- }
2555
- }
2556
- },
2557
- navigation: {
2558
- translation: 'Object.ActionButton.Navigation',
2559
- type: 'items',
2560
- items: {
2561
- action: {
2562
- ref: 'navigation.action',
2563
- translation: 'Object.ActionButton.Navigation',
2564
- component: 'expression-with-dropdown',
2565
- defaultValue: null,
2566
- options: navigationActions,
2567
- dropdownOnly: true
2568
- },
2569
- sheetId: {
2570
- type: 'string',
2571
- ref: 'navigation.sheet',
2572
- translation: 'properties.sheet',
2573
- expression: 'optional',
2574
- show: function show(data) {
2575
- return checkShowNavigation(data, 'sheetId');
2576
- }
2577
- },
2578
- sheet: {
2579
- type: 'string',
2580
- ref: 'navigation.sheet',
2581
- translation: 'properties.sheet',
2582
- component: 'expression-with-dropdown',
2583
- expressionType: 'StringExpression',
2584
- show: function show(data) {
2585
- return checkShowNavigation(data, 'sheet');
2586
- },
2587
- options: function () {
2588
- var _options5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(action, hyperCubeHandler) {
2589
- var sheets;
2590
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
2591
- while (1) {
2592
- switch (_context5.prev = _context5.next) {
2593
- case 0:
2594
- _context5.next = 2;
2595
- return hyperCubeHandler.app.getSheetList();
2596
-
2597
- case 2:
2598
- sheets = _context5.sent;
2599
- return _context5.abrupt("return", sheets.map(function (sheet) {
2600
- return {
2601
- value: sheet.qInfo.qId,
2602
- label: sheet.qMeta.title,
2603
- showCondition: sheet.qData.showCondition
2604
- };
2605
- }));
2606
-
2607
- case 4:
2608
- case "end":
2609
- return _context5.stop();
2610
- }
2611
- }
2612
- }, _callee5);
2613
- }));
2614
-
2615
- function options(_x7, _x8) {
2616
- return _options5.apply(this, arguments);
2617
- }
2618
-
2619
- return options;
2620
- }()
2621
- },
2622
- story: {
2623
- type: 'string',
2624
- ref: 'navigation.story',
2625
- translation: 'properties.story',
2626
- component: 'expression-with-dropdown',
2627
- expressionType: 'StringExpression',
2628
- show: function show(data) {
2629
- return checkShowNavigation(data, 'story');
2630
- },
2631
- options: function () {
2632
- var _options6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(action, hyperCubeHandler) {
2633
- var stories;
2634
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
2635
- while (1) {
2636
- switch (_context6.prev = _context6.next) {
2637
- case 0:
2638
- _context6.next = 2;
2639
- return hyperCubeHandler.app.getStoryList();
2640
-
2641
- case 2:
2642
- stories = _context6.sent;
2643
- return _context6.abrupt("return", stories.map(function (story) {
2644
- return {
2645
- value: story.qInfo.qId,
2646
- label: story.qMeta.title
2647
- };
2648
- }));
2649
-
2650
- case 4:
2651
- case "end":
2652
- return _context6.stop();
2653
- }
2654
- }
2655
- }, _callee6);
2656
- }));
2657
-
2658
- function options(_x9, _x10) {
2659
- return _options6.apply(this, arguments);
2660
- }
2661
-
2662
- return options;
2663
- }()
2664
- },
2665
- websiteUrl: {
2666
- type: 'string',
2667
- expression: 'optional',
2668
- ref: 'navigation.websiteUrl',
2669
- translation: 'properties.website',
2670
- show: function show(data) {
2671
- return checkShowNavigation(data, 'websiteUrl');
2672
- }
2673
- },
2674
- sameWindow: {
2675
- type: 'boolean',
2676
- ref: 'navigation.sameWindow',
2677
- translation: 'properties.sameWindow',
2678
- show: function show(data) {
2679
- return checkShowNavigation(data, 'websiteUrl');
2680
- },
2681
- defaultValue: false
2682
- }
2683
- }
2684
- }
2685
- }
2686
- },
2687
- enableCondition: {
2688
- type: 'items',
2689
- translation: 'properties.enableConditionSection',
2690
- items: {
2691
- useCondition: {
2692
- type: 'boolean',
2693
- component: 'switch',
2694
- translation: 'properties.enableToggle',
2695
- ref: 'useEnabledCondition',
2696
- options: [{
2697
- value: true,
2698
- translation: 'properties.on'
2699
- }, {
2700
- value: false,
2701
- translation: 'properties.off'
2702
- }]
2703
- },
2704
- condition: {
2705
- ref: 'enabledCondition',
2706
- translation: 'properties.enableCondition',
2707
- type: 'integer',
2708
- expression: 'optional',
2709
- show: function show(data) {
2710
- return data.useEnabledCondition;
2711
- }
2712
- }
2713
- }
2714
- },
2715
- settings: {
2716
- component: 'expandable-items',
2717
- translation: 'Common.Appearance',
2718
- uses: 'settings',
2719
- items: {
2720
- general: {
2721
- type: 'items',
2722
- translation: 'properties.general',
2723
- items: {
2724
- showTitles: {},
2725
- details: {
2726
- show: false
2727
- },
2728
- label: {
2729
- component: 'string',
2730
- ref: 'style.label',
2731
- translation: 'Common.Label',
2732
- expression: 'optional'
2733
- }
2734
- }
2735
- },
2736
- font: {
2737
- grouped: true,
2738
- type: 'items',
2739
- translation: 'properties.font',
2740
- items: {
2741
- sizeAndColor: {
2742
- type: 'items',
2743
- items: {
2744
- fontSize: {
2745
- component: 'slider',
2746
- type: 'number',
2747
- ref: 'style.font.size',
2748
- translation: 'properties.fontSize',
2749
- min: 0.2,
2750
- max: 1,
2751
- step: 0.01
2752
- },
2753
- useFontColorExpression: {
2754
- ref: 'style.font.useColorExpression',
2755
- type: 'boolean',
2756
- translation: 'properties.fontColor',
2757
- component: 'dropdown',
2758
- options: colorOptions
2759
- },
2760
- colorPicker: {
2761
- component: 'color-picker',
2762
- type: 'object',
2763
- ref: 'style.font.color',
2764
- translation: 'properties.color',
2765
- dualOutput: true,
2766
- show: function show(data) {
2767
- return !propertyResolver.getValue(data, 'style.font.useColorExpression');
2768
- }
2769
- },
2770
- colorExpression: {
2771
- component: 'string',
2772
- type: 'string',
2773
- ref: 'style.font.colorExpression',
2774
- translation: 'Common.Expression',
2775
- expression: 'optional',
2776
- show: function show(data) {
2777
- return propertyResolver.getValue(data, 'style.font.useColorExpression');
2778
- }
2779
- }
2780
- }
2781
- },
2782
- stylingAndAlign: {
2783
- type: 'items',
2784
- items: {
2785
- fontStyling: {
2786
- component: 'item-selection-list',
2787
- type: 'string',
2788
- ref: 'style.font.style',
2789
- translation: 'properties.textStyle',
2790
- horizontal: true,
2791
- multipleSelect: true,
2792
- items: [{
2793
- component: 'icon-item',
2794
- icon: 'bold',
2795
- value: 'bold',
2796
- translation: 'Common.bold',
2797
- labelPlacement: 'bottom'
2798
- }, {
2799
- component: 'icon-item',
2800
- icon: 'italic',
2801
- value: 'italic',
2802
- translation: 'Common.italic',
2803
- labelPlacement: 'bottom'
2804
- }, {
2805
- component: 'icon-item',
2806
- icon: 'underline',
2807
- value: 'underline',
2808
- translation: 'Common.underline',
2809
- labelPlacement: 'bottom'
2810
- }]
2811
- },
2812
- textAlign: {
2813
- component: 'item-selection-list',
2814
- type: 'string',
2815
- ref: 'style.font.align',
2816
- translation: 'properties.Alignment',
2817
- horizontal: true,
2818
- items: [{
2819
- component: 'icon-item',
2820
- icon: 'align_left',
2821
- value: 'left',
2822
- translation: 'properties.dock.left',
2823
- labelPlacement: 'bottom'
2824
- }, {
2825
- component: 'icon-item',
2826
- icon: 'align_center',
2827
- value: 'center',
2828
- translation: 'Common.Center',
2829
- labelPlacement: 'bottom'
2830
- }, {
2831
- component: 'icon-item',
2832
- icon: 'align_right',
2833
- value: 'right',
2834
- translation: 'properties.dock.right',
2835
- labelPlacement: 'bottom'
2836
- }]
2837
- }
2838
- }
2839
- }
2840
- }
2841
- },
2842
- background: {
2843
- grouped: true,
2844
- type: 'items',
2845
- translation: 'properties.background',
2846
- items: {
2847
- backgroundColor: {
2848
- type: 'items',
2849
- items: {
2850
- useColorExpression: {
2851
- ref: 'style.background.useColorExpression',
2852
- type: 'boolean',
2853
- translation: 'AppDetails.SheetBackgroundColor',
2854
- component: 'dropdown',
2855
- options: colorOptions
2856
- },
2857
- colorPicker: {
2858
- component: 'color-picker',
2859
- type: 'object',
2860
- ref: 'style.background.color',
2861
- translation: 'properties.color',
2862
- dualOutput: true,
2863
- show: function show(data) {
2864
- return !propertyResolver.getValue(data, 'style.background.useColorExpression');
2865
- }
2866
- },
2867
- colorExpression: {
2868
- component: 'string',
2869
- type: 'string',
2870
- ref: 'style.background.colorExpression',
2871
- translation: 'Common.Expression',
2872
- expression: 'optional',
2873
- show: function show(data) {
2874
- return propertyResolver.getValue(data, 'style.background.useColorExpression');
2875
- }
2876
- }
2877
- }
2878
- },
2879
- backgroundImage: {
2880
- type: 'items',
2881
- items: {
2882
- useBackgroundImage: {
2883
- ref: 'style.background.useImage',
2884
- type: 'boolean',
2885
- translation: 'properties.backgroundImage.use',
2886
- component: 'switch',
2887
- options: toggleOptions
2888
- },
2889
- backgroundUrl: {
2890
- ref: 'style.background.url.qStaticContentUrlDef.qUrl',
2891
- layoutRef: 'style.background.url.qStaticContentUrl.qUrl',
2892
- schemaIgnore: true,
2893
- translation: 'Common.Image',
2894
- tooltip: {
2895
- select: 'properties.media.select',
2896
- remove: 'properties.media.removeBackground'
2897
- },
2898
- type: 'string',
2899
- component: 'media',
2900
- show: function show(data) {
2901
- return propertyResolver.getValue(data, 'style.background.useImage');
2902
- }
2903
- },
2904
- backgroundSize: {
2905
- ref: 'style.background.size',
2906
- translation: 'properties.backgroundImage.size',
2907
- type: 'string',
2908
- component: 'dropdown',
2909
- options: [{
2910
- value: 'auto',
2911
- translation: 'properties.backgroundImage.originalSize'
2912
- }, {
2913
- value: 'alwaysFit',
2914
- translation: 'properties.backgroundImage.sizeAlwaysFit'
2915
- }, {
2916
- value: 'fitWidth',
2917
- translation: 'properties.backgroundImage.sizeFitWidth'
2918
- }, {
2919
- value: 'fitHeight',
2920
- translation: 'properties.backgroundImage.sizeFitHeight'
2921
- }, {
2922
- value: 'fill',
2923
- translation: 'properties.backgroundImage.sizeStretch'
2924
- }, {
2925
- value: 'alwaysFill',
2926
- translation: 'properties.backgroundImage.sizeAlwaysFill'
2927
- }],
2928
- show: function show(data) {
2929
- return propertyResolver.getValue(data, 'style.background.useImage') && !!propertyResolver.getValue(data, 'style.background.url.qStaticContentUrlDef.qUrl');
2930
- }
2931
- },
2932
- backgroundPosition: {
2933
- ref: 'style.background.position',
2934
- translation: 'Common.Position',
2935
- type: 'string',
2936
- component: 'align-matrix',
2937
- show: function show(data) {
2938
- return propertyResolver.getValue(data, 'style.background.useImage') && propertyResolver.getValue(data, 'style.background.url.qStaticContentUrlDef.qUrl') && propertyResolver.getValue(data, 'style.background.size') !== 'fill';
2939
- },
2940
- currentSize: function currentSize(data) {
2941
- return propertyResolver.getValue(data, 'style.background.size');
2942
- }
2943
- }
2944
- }
2945
- }
2946
- }
2947
- },
2948
- border: {
2949
- type: 'items',
2950
- grouped: true,
2951
- translation: 'properties.border',
2952
- items: {
2953
- borderSettings: {
2954
- type: 'items',
2955
- items: {
2956
- useBorder: {
2957
- ref: 'style.border.useBorder',
2958
- type: 'boolean',
2959
- translation: 'properties.border.use',
2960
- component: 'switch',
2961
- options: toggleOptions
2962
- },
2963
- borderRadius: {
2964
- component: 'slider',
2965
- show: function show(data) {
2966
- return propertyResolver.getValue(data, 'style.border.useBorder');
2967
- },
2968
- translation: 'properties.border.radius',
2969
- type: 'number',
2970
- ref: 'style.border.radius',
2971
- min: 0,
2972
- max: 1,
2973
- step: 0.01
2974
- },
2975
- borderWidth: {
2976
- component: 'slider',
2977
- show: function show(data) {
2978
- return propertyResolver.getValue(data, 'style.border.useBorder');
2979
- },
2980
- type: 'number',
2981
- ref: 'style.border.width',
2982
- translation: 'properties.border.width',
2983
- min: 0,
2984
- max: 0.5,
2985
- step: 0.005
2986
- },
2987
- colorDropdown: {
2988
- type: 'string',
2989
- show: function show(data) {
2990
- return propertyResolver.getValue(data, 'style.border.useBorder');
2991
- },
2992
- component: 'dropdown',
2993
- translation: 'properties.border.color',
2994
- ref: 'style.border.useColorExpression',
2995
- options: colorOptions
2996
- },
2997
- colorPicker: {
2998
- component: 'color-picker',
2999
- type: 'object',
3000
- ref: 'style.border.color',
3001
- translation: 'properties.color',
3002
- dualOutput: true,
3003
- show: function show(data) {
3004
- return propertyResolver.getValue(data, 'style.border.useBorder') && !propertyResolver.getValue(data, 'style.border.useColorExpression');
3005
- }
3006
- },
3007
- colorExpression: {
3008
- component: 'string',
3009
- type: 'string',
3010
- ref: 'style.border.colorExpression',
3011
- translation: 'Common.Expression',
3012
- show: function show(data) {
3013
- return propertyResolver.getValue(data, 'style.border.useBorder') && propertyResolver.getValue(data, 'style.border.useColorExpression');
3014
- },
3015
- expression: 'optional'
3016
- }
3017
- }
3018
- }
3019
- }
3020
- },
3021
- icon: {
3022
- type: 'items',
3023
- grouped: true,
3024
- translation: 'properties.icon',
3025
- items: {
3026
- iconSettings: {
3027
- type: 'items',
3028
- items: {
3029
- useIcon: {
3030
- ref: 'style.icon.useIcon',
3031
- type: 'boolean',
3032
- translation: 'properties.icon.use',
3033
- component: 'switch',
3034
- options: toggleOptions
3035
- },
3036
- iconType: {
3037
- ref: 'style.icon.iconType',
3038
- component: 'expression-with-dropdown',
3039
- translation: 'properties.icon',
3040
- defaultValue: '',
3041
- options: luiIcons,
3042
- expressionType: 'StringExpression',
3043
- show: function show(data) {
3044
- return propertyResolver.getValue(data, 'style.icon.useIcon');
3045
- }
3046
- },
3047
- iconPosition: {
3048
- ref: 'style.icon.position',
3049
- component: 'dropdown',
3050
- translation: 'Common.Position',
3051
- options: [{
3052
- translation: 'properties.dock.left',
3053
- value: 'left'
3054
- }, {
3055
- translation: 'properties.dock.right',
3056
- value: 'right'
3057
- }],
3058
- show: function show(data) {
3059
- return propertyResolver.getValue(data, 'style.icon.useIcon');
3060
- }
3061
- }
3062
- }
3063
- }
3064
- }
3065
- }
3066
- }
3067
- }
3068
- }
3069
- },
3070
- importProperties: importProperties,
3071
- exportProperties: null,
3072
- support: {
3073
- export: !1,
3074
- exportData: !1,
3075
- snapshot: !1,
3076
- viewData: !1,
3077
- quickMobile: !0
3078
- }
3079
- };
3080
- }
3081
-
3082
- var colorStruct = {
3083
- aliceblue: {
3084
- r: 240,
3085
- g: 248,
3086
- b: 255
3087
- },
3088
- antiquewhite: {
3089
- r: 250,
3090
- g: 235,
3091
- b: 215
3092
- },
3093
- aqua: {
3094
- r: 0,
3095
- g: 255,
3096
- b: 255
3097
- },
3098
- aquamarine: {
3099
- r: 127,
3100
- g: 255,
3101
- b: 212
3102
- },
3103
- azure: {
3104
- r: 240,
3105
- g: 255,
3106
- b: 255
3107
- },
3108
- beige: {
3109
- r: 245,
3110
- g: 245,
3111
- b: 220
3112
- },
3113
- bisque: {
3114
- r: 255,
3115
- g: 228,
3116
- b: 196
3117
- },
3118
- black: {
3119
- r: 0,
3120
- g: 0,
3121
- b: 0
3122
- },
3123
- blanchedalmond: {
3124
- r: 255,
3125
- g: 235,
3126
- b: 205
3127
- },
3128
- blue: {
3129
- r: 0,
3130
- g: 0,
3131
- b: 255
3132
- },
3133
- blueviolet: {
3134
- r: 138,
3135
- g: 43,
3136
- b: 226
3137
- },
3138
- brown: {
3139
- r: 165,
3140
- g: 42,
3141
- b: 42
3142
- },
3143
- burlywood: {
3144
- r: 222,
3145
- g: 184,
3146
- b: 135
3147
- },
3148
- cadetblue: {
3149
- r: 95,
3150
- g: 158,
3151
- b: 160
3152
- },
3153
- chartreuse: {
3154
- r: 127,
3155
- g: 255,
3156
- b: 0
3157
- },
3158
- chocolate: {
3159
- r: 210,
3160
- g: 105,
3161
- b: 30
3162
- },
3163
- coral: {
3164
- r: 255,
3165
- g: 127,
3166
- b: 80
3167
- },
3168
- cornflowerblue: {
3169
- r: 100,
3170
- g: 149,
3171
- b: 237
3172
- },
3173
- cornsilk: {
3174
- r: 255,
3175
- g: 248,
3176
- b: 220
3177
- },
3178
- crimson: {
3179
- r: 220,
3180
- g: 20,
3181
- b: 60
3182
- },
3183
- cyan: {
3184
- r: 0,
3185
- g: 255,
3186
- b: 255
3187
- },
3188
- darkblue: {
3189
- r: 0,
3190
- g: 0,
3191
- b: 139
3192
- },
3193
- darkcyan: {
3194
- r: 0,
3195
- g: 139,
3196
- b: 139
3197
- },
3198
- darkgoldenrod: {
3199
- r: 184,
3200
- g: 134,
3201
- b: 11
3202
- },
3203
- darkgray: {
3204
- r: 169,
3205
- g: 169,
3206
- b: 169
3207
- },
3208
- darkgreen: {
3209
- r: 0,
3210
- g: 100,
3211
- b: 0
3212
- },
3213
- darkgrey: {
3214
- r: 169,
3215
- g: 169,
3216
- b: 169
3217
- },
3218
- darkkhaki: {
3219
- r: 189,
3220
- g: 183,
3221
- b: 107
3222
- },
3223
- darkmagenta: {
3224
- r: 139,
3225
- g: 0,
3226
- b: 139
3227
- },
3228
- darkolivegreen: {
3229
- r: 85,
3230
- g: 107,
3231
- b: 47
3232
- },
3233
- darkorange: {
3234
- r: 255,
3235
- g: 140,
3236
- b: 0
3237
- },
3238
- darkorchid: {
3239
- r: 153,
3240
- g: 50,
3241
- b: 204
3242
- },
3243
- darkred: {
3244
- r: 139,
3245
- g: 0,
3246
- b: 0
3247
- },
3248
- darksalmon: {
3249
- r: 233,
3250
- g: 150,
3251
- b: 122
3252
- },
3253
- darkseagreen: {
3254
- r: 143,
3255
- g: 188,
3256
- b: 143
3257
- },
3258
- darkslateblue: {
3259
- r: 72,
3260
- g: 61,
3261
- b: 139
3262
- },
3263
- darkslategray: {
3264
- r: 47,
3265
- g: 79,
3266
- b: 79
3267
- },
3268
- darkslategrey: {
3269
- r: 47,
3270
- g: 79,
3271
- b: 79
3272
- },
3273
- darkturquoise: {
3274
- r: 0,
3275
- g: 206,
3276
- b: 209
3277
- },
3278
- darkviolet: {
3279
- r: 148,
3280
- g: 0,
3281
- b: 211
3282
- },
3283
- deeppink: {
3284
- r: 255,
3285
- g: 20,
3286
- b: 147
3287
- },
3288
- deepskyblue: {
3289
- r: 0,
3290
- g: 191,
3291
- b: 255
3292
- },
3293
- dimgray: {
3294
- r: 105,
3295
- g: 105,
3296
- b: 105
3297
- },
3298
- dimgrey: {
3299
- r: 105,
3300
- g: 105,
3301
- b: 105
3302
- },
3303
- dodgerblue: {
3304
- r: 30,
3305
- g: 144,
3306
- b: 255
3307
- },
3308
- firebrick: {
3309
- r: 178,
3310
- g: 34,
3311
- b: 34
3312
- },
3313
- floralwhite: {
3314
- r: 255,
3315
- g: 250,
3316
- b: 240
3317
- },
3318
- forestgreen: {
3319
- r: 34,
3320
- g: 139,
3321
- b: 34
3322
- },
3323
- fuchsia: {
3324
- r: 255,
3325
- g: 0,
3326
- b: 255
3327
- },
3328
- gainsboro: {
3329
- r: 220,
3330
- g: 220,
3331
- b: 220
3332
- },
3333
- ghostwhite: {
3334
- r: 248,
3335
- g: 248,
3336
- b: 255
3337
- },
3338
- gold: {
3339
- r: 255,
3340
- g: 215,
3341
- b: 0
3342
- },
3343
- goldenrod: {
3344
- r: 218,
3345
- g: 165,
3346
- b: 32
3347
- },
3348
- gray: {
3349
- r: 128,
3350
- g: 128,
3351
- b: 128
3352
- },
3353
- green: {
3354
- r: 0,
3355
- g: 128,
3356
- b: 0
3357
- },
3358
- greenyellow: {
3359
- r: 173,
3360
- g: 255,
3361
- b: 47
3362
- },
3363
- grey: {
3364
- r: 128,
3365
- g: 128,
3366
- b: 128
3367
- },
3368
- honeydew: {
3369
- r: 240,
3370
- g: 255,
3371
- b: 240
3372
- },
3373
- hotpink: {
3374
- r: 255,
3375
- g: 105,
3376
- b: 180
3377
- },
3378
- indianred: {
3379
- r: 205,
3380
- g: 92,
3381
- b: 92
3382
- },
3383
- indigo: {
3384
- r: 75,
3385
- g: 0,
3386
- b: 130
3387
- },
3388
- ivory: {
3389
- r: 255,
3390
- g: 255,
3391
- b: 240
3392
- },
3393
- khaki: {
3394
- r: 240,
3395
- g: 230,
3396
- b: 140
3397
- },
3398
- lavender: {
3399
- r: 230,
3400
- g: 230,
3401
- b: 250
3402
- },
3403
- lavenderblush: {
3404
- r: 255,
3405
- g: 240,
3406
- b: 245
3407
- },
3408
- lawngreen: {
3409
- r: 124,
3410
- g: 252,
3411
- b: 0
3412
- },
3413
- lemonchiffon: {
3414
- r: 255,
3415
- g: 250,
3416
- b: 205
3417
- },
3418
- lightblue: {
3419
- r: 173,
3420
- g: 216,
3421
- b: 230
3422
- },
3423
- lightcoral: {
3424
- r: 240,
3425
- g: 128,
3426
- b: 128
3427
- },
3428
- lightcyan: {
3429
- r: 224,
3430
- g: 255,
3431
- b: 255
3432
- },
3433
- lightgoldenrodyellow: {
3434
- r: 250,
3435
- g: 250,
3436
- b: 210
3437
- },
3438
- lightgray: {
3439
- r: 211,
3440
- g: 211,
3441
- b: 211
3442
- },
3443
- lightgreen: {
3444
- r: 144,
3445
- g: 238,
3446
- b: 144
3447
- },
3448
- lightgrey: {
3449
- r: 211,
3450
- g: 211,
3451
- b: 211
3452
- },
3453
- lightpink: {
3454
- r: 255,
3455
- g: 182,
3456
- b: 193
3457
- },
3458
- lightsalmon: {
3459
- r: 255,
3460
- g: 160,
3461
- b: 122
3462
- },
3463
- lightseagreen: {
3464
- r: 32,
3465
- g: 178,
3466
- b: 170
3467
- },
3468
- lightskyblue: {
3469
- r: 135,
3470
- g: 206,
3471
- b: 250
3472
- },
3473
- lightslategray: {
3474
- r: 119,
3475
- g: 136,
3476
- b: 153
3477
- },
3478
- lightslategrey: {
3479
- r: 119,
3480
- g: 136,
3481
- b: 153
3482
- },
3483
- lightsteelblue: {
3484
- r: 176,
3485
- g: 196,
3486
- b: 222
3487
- },
3488
- lightyellow: {
3489
- r: 255,
3490
- g: 255,
3491
- b: 224
3492
- },
3493
- lime: {
3494
- r: 0,
3495
- g: 255,
3496
- b: 0
3497
- },
3498
- limegreen: {
3499
- r: 50,
3500
- g: 205,
3501
- b: 50
3502
- },
3503
- linen: {
3504
- r: 250,
3505
- g: 240,
3506
- b: 230
3507
- },
3508
- magenta: {
3509
- r: 255,
3510
- g: 0,
3511
- b: 255
3512
- },
3513
- maroon: {
3514
- r: 128,
3515
- g: 0,
3516
- b: 0
3517
- },
3518
- mediumaquamarine: {
3519
- r: 102,
3520
- g: 205,
3521
- b: 170
3522
- },
3523
- mediumblue: {
3524
- r: 0,
3525
- g: 0,
3526
- b: 205
3527
- },
3528
- mediumorchid: {
3529
- r: 186,
3530
- g: 85,
3531
- b: 211
3532
- },
3533
- mediumpurple: {
3534
- r: 147,
3535
- g: 112,
3536
- b: 219
3537
- },
3538
- mediumseagreen: {
3539
- r: 60,
3540
- g: 179,
3541
- b: 113
3542
- },
3543
- mediumslateblue: {
3544
- r: 123,
3545
- g: 104,
3546
- b: 238
3547
- },
3548
- mediumspringgreen: {
3549
- r: 0,
3550
- g: 250,
3551
- b: 154
3552
- },
3553
- mediumturquoise: {
3554
- r: 72,
3555
- g: 209,
3556
- b: 204
3557
- },
3558
- mediumvioletred: {
3559
- r: 199,
3560
- g: 21,
3561
- b: 133
3562
- },
3563
- midnightblue: {
3564
- r: 25,
3565
- g: 25,
3566
- b: 112
3567
- },
3568
- mintcream: {
3569
- r: 245,
3570
- g: 255,
3571
- b: 250
3572
- },
3573
- mistyrose: {
3574
- r: 255,
3575
- g: 228,
3576
- b: 225
3577
- },
3578
- moccasin: {
3579
- r: 255,
3580
- g: 228,
3581
- b: 181
3582
- },
3583
- navajowhite: {
3584
- r: 255,
3585
- g: 222,
3586
- b: 173
3587
- },
3588
- navy: {
3589
- r: 0,
3590
- g: 0,
3591
- b: 128
3592
- },
3593
- oldlace: {
3594
- r: 253,
3595
- g: 245,
3596
- b: 230
3597
- },
3598
- olive: {
3599
- r: 128,
3600
- g: 128,
3601
- b: 0
3602
- },
3603
- olivedrab: {
3604
- r: 107,
3605
- g: 142,
3606
- b: 35
3607
- },
3608
- orange: {
3609
- r: 255,
3610
- g: 165,
3611
- b: 0
3612
- },
3613
- orangered: {
3614
- r: 255,
3615
- g: 69,
3616
- b: 0
3617
- },
3618
- orchid: {
3619
- r: 218,
3620
- g: 112,
3621
- b: 214
3622
- },
3623
- palegoldenrod: {
3624
- r: 238,
3625
- g: 232,
3626
- b: 170
3627
- },
3628
- palegreen: {
3629
- r: 152,
3630
- g: 251,
3631
- b: 152
3632
- },
3633
- paleturquoise: {
3634
- r: 175,
3635
- g: 238,
3636
- b: 238
3637
- },
3638
- palevioletred: {
3639
- r: 219,
3640
- g: 112,
3641
- b: 147
3642
- },
3643
- papayawhip: {
3644
- r: 255,
3645
- g: 239,
3646
- b: 213
3647
- },
3648
- peachpuff: {
3649
- r: 255,
3650
- g: 218,
3651
- b: 185
3652
- },
3653
- peru: {
3654
- r: 205,
3655
- g: 133,
3656
- b: 63
3657
- },
3658
- pink: {
3659
- r: 255,
3660
- g: 192,
3661
- b: 203
3662
- },
3663
- plum: {
3664
- r: 221,
3665
- g: 160,
3666
- b: 221
3667
- },
3668
- powderblue: {
3669
- r: 176,
3670
- g: 224,
3671
- b: 230
3672
- },
3673
- purple: {
3674
- r: 128,
3675
- g: 0,
3676
- b: 128
3677
- },
3678
- rebeccapurple: {
3679
- r: 102,
3680
- g: 51,
3681
- b: 153
3682
- },
3683
- red: {
3684
- r: 255,
3685
- g: 0,
3686
- b: 0
3687
- },
3688
- rosybrown: {
3689
- r: 188,
3690
- g: 143,
3691
- b: 143
3692
- },
3693
- royalblue: {
3694
- r: 65,
3695
- g: 105,
3696
- b: 225
3697
- },
3698
- saddlebrown: {
3699
- r: 139,
3700
- g: 69,
3701
- b: 19
3702
- },
3703
- salmon: {
3704
- r: 250,
3705
- g: 128,
3706
- b: 114
3707
- },
3708
- sandybrown: {
3709
- r: 244,
3710
- g: 164,
3711
- b: 96
3712
- },
3713
- seagreen: {
3714
- r: 46,
3715
- g: 139,
3716
- b: 87
3717
- },
3718
- seashell: {
3719
- r: 255,
3720
- g: 245,
3721
- b: 238
3722
- },
3723
- sienna: {
3724
- r: 160,
3725
- g: 82,
3726
- b: 45
3727
- },
3728
- silver: {
3729
- r: 192,
3730
- g: 192,
3731
- b: 192
3732
- },
3733
- skyblue: {
3734
- r: 135,
3735
- g: 206,
3736
- b: 235
3737
- },
3738
- slateblue: {
3739
- r: 106,
3740
- g: 90,
3741
- b: 205
3742
- },
3743
- slategray: {
3744
- r: 112,
3745
- g: 128,
3746
- b: 144
3747
- },
3748
- slategrey: {
3749
- r: 112,
3750
- g: 128,
3751
- b: 144
3752
- },
3753
- snow: {
3754
- r: 255,
3755
- g: 250,
3756
- b: 250
3757
- },
3758
- springgreen: {
3759
- r: 0,
3760
- g: 255,
3761
- b: 127
3762
- },
3763
- steelblue: {
3764
- r: 70,
3765
- g: 130,
3766
- b: 180
3767
- },
3768
- tan: {
3769
- r: 210,
3770
- g: 180,
3771
- b: 140
3772
- },
3773
- teal: {
3774
- r: 0,
3775
- g: 128,
3776
- b: 128
3777
- },
3778
- thistle: {
3779
- r: 216,
3780
- g: 191,
3781
- b: 216
3782
- },
3783
- tomato: {
3784
- r: 255,
3785
- g: 99,
3786
- b: 71
3787
- },
3788
- transparent: {
3789
- r: 255,
3790
- g: 255,
3791
- b: 255,
3792
- a: 0
3793
- },
3794
- turquoise: {
3795
- r: 64,
3796
- g: 224,
3797
- b: 208
3798
- },
3799
- violet: {
3800
- r: 238,
3801
- g: 130,
3802
- b: 238
3803
- },
3804
- wheat: {
3805
- r: 245,
3806
- g: 222,
3807
- b: 179
3808
- },
3809
- white: {
3810
- r: 255,
3811
- g: 255,
3812
- b: 255
3813
- },
3814
- whitesmoke: {
3815
- r: 245,
3816
- g: 245,
3817
- b: 245
3818
- },
3819
- yellow: {
3820
- r: 255,
3821
- g: 255,
3822
- b: 0
3823
- },
3824
- yellowgreen: {
3825
- r: 154,
3826
- g: 205,
3827
- b: 50
3828
- }
3829
- };
3830
-
3831
- /* eslint-disable no-cond-assign */
3832
- var colorUtils = {
3833
- resolveExpression: function resolveExpression(input) {
3834
- // rgb
3835
- var matches = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(input);
3836
-
3837
- if (matches) {
3838
- return "rgb(".concat(matches[1], ",").concat(matches[2], ",").concat(matches[3], ")");
3839
- } // argb
3840
-
3841
-
3842
- matches = /^argb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(input);
3843
-
3844
- if (matches) {
3845
- var a = Math.round(matches[1] / 255 * 100) / 100;
3846
- return "rgba(".concat(matches[2], ",").concat(matches[3], ",").concat(matches[4], ",").concat(a, ")");
3847
- } // hex
3848
-
3849
-
3850
- matches = /^#([A-f0-9]{2})([A-f0-9]{2})([A-f0-9]{2})$/i.exec(input);
3851
-
3852
- if (matches) {
3853
- return input;
3854
- } // css color
3855
-
3856
-
3857
- var color = input && colorStruct[input.toLowerCase()];
3858
-
3859
- if (color) {
3860
- var _a = color.a !== undefined ? color.a : 1;
3861
-
3862
- return "rgba(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ",").concat(_a, ")");
3863
- } // invalid
3864
-
3865
-
3866
- return 'none';
3867
- },
3868
- getFadedColor: function getFadedColor(color) {
3869
- var percent = 0.15;
3870
- var f;
3871
- var R;
3872
- var B;
3873
- var G;
3874
-
3875
- if (color.length > 7) {
3876
- f = color.split(',');
3877
- var rgba = f[0].indexOf('a') !== -1;
3878
- R = rgba ? parseInt(f[0].slice(5), 10) : parseInt(f[0].slice(4), 10);
3879
- G = parseInt(f[1], 10);
3880
- B = parseInt(f[2], 10);
3881
- return "".concat((rgba ? 'rgba(' : 'rgb(') + (Math.round((0 - R) * percent) + R), ",").concat(Math.round((0 - G) * percent) + G, ",").concat(Math.round((0 - B) * percent) + B).concat(rgba ? ",".concat(f[3]) : ')');
3882
- }
3883
-
3884
- f = parseInt(color.slice(1), 16);
3885
- R = f >> 16;
3886
- G = f >> 8 & 0x00FF;
3887
- B = f & 0x0000FF;
3888
- return "#".concat((0x1000000 + (Math.round((0 - R) * percent) + R) * 0x10000 + (Math.round((0 - G) * percent) + G) * 0x100 + (Math.round((0 - B) * percent) + B)).toString(16).slice(1));
3889
- }
3890
- };
3891
-
3892
- var getImageUrl = function getImageUrl(imgUrl) {
3893
- imgUrl.replace(/^\.\.\//i, '/');
3894
- imgUrl = imgUrl.replace(/"/g, '\\"');
3895
- imgUrl = imgUrl.replace(/'/g, "\\'");
3896
- var a = document.createElement('a');
3897
- a.href = '../';
3898
- var rootPath = a.href;
3899
- imgUrl = rootPath + (imgUrl[0] === '/' ? imgUrl.substr(1) : imgUrl);
3900
- return imgUrl;
3901
- };
3902
-
3903
- var urlUtils = {
3904
- getImageUrl: getImageUrl
3905
- };
3906
-
3907
- var backgroundSize = {
3908
- auto: 'auto auto',
3909
- alwaysFit: 'contain',
3910
- fitWidth: '100% auto',
3911
- fitHeight: 'auto 100%',
3912
- fill: '100% 100%',
3913
- alwaysFill: 'cover'
3914
- };
3915
- var backgroundPosition = {
3916
- topLeft: '0% 0%',
3917
- // top left
3918
- centerLeft: '50% 0%',
3919
- // center left
3920
- bottomLeft: '100% 0%',
3921
- // bottom left
3922
- topCenter: '0% 50%',
3923
- // top center
3924
- centerCenter: '50% 50%',
3925
- // center center
3926
- bottomCenter: '100% 50%',
3927
- // bottom center
3928
- topRight: '0% 100%',
3929
- // top right
3930
- centerRight: '50% 100%',
3931
- // center right
3932
- bottomRight: '100% 100%' // bottom right
3933
-
3934
- };
3935
-
3936
- var formatProperty = function formatProperty(path, setting) {
3937
- return "".concat(path, ": ").concat(setting, ";");
3938
- };
3939
-
3940
- var getColor = function getColor(_ref, defaultColor, theme) {
3941
- var useColorExpression = _ref.useColorExpression,
3942
- colorExpression = _ref.colorExpression,
3943
- color = _ref.color;
3944
- var resolvedColor;
3945
-
3946
- if (useColorExpression) {
3947
- resolvedColor = colorUtils.resolveExpression(colorExpression);
3948
- } else if (typeof color === 'string') {
3949
- resolvedColor = color;
3950
- } else if (color) {
3951
- resolvedColor = theme.getColorPickerColor(color);
3952
- }
3953
-
3954
- return !resolvedColor || resolvedColor === 'none' ? defaultColor : resolvedColor;
3955
- };
3956
-
3957
- var styleFormatter = {
3958
- getStyles: function getStyles(_ref2) {
3959
- var style = _ref2.style,
3960
- disabled = _ref2.disabled,
3961
- theme = _ref2.theme,
3962
- element = _ref2.element;
3963
- var styles = 'width: 100%;height: 100%;transition: transform .1s ease-in-out;position: absolute;';
3964
- var font = style.font,
3965
- background = style.background,
3966
- border = style.border;
3967
- var primaryColor = theme.getDataColorSpecials().primary; // enable
3968
-
3969
- styles += disabled ? formatProperty('opacity', 0.4) : formatProperty('cursor', 'pointer'); // font
3970
-
3971
- styles += formatProperty('color', getColor(font, '#ffffff', theme));
3972
- font.style.bold && (styles += formatProperty('font-weight', 'bold'));
3973
- font.style.italic && (styles += formatProperty('font-style', 'italic')); // background
3974
-
3975
- var backgroundColor = getColor(background, primaryColor, theme);
3976
- styles += formatProperty('background-color', backgroundColor);
3977
-
3978
- if (background.useImage && background.url.qStaticContentUrl) {
3979
- var bgUrl = background.url.qStaticContentUrl.qUrl;
3980
-
3981
- if (bgUrl) {
3982
- bgUrl = urlUtils.getImageUrl(bgUrl);
3983
- styles += formatProperty('background-image', "url('".concat(bgUrl, "')"));
3984
- styles += formatProperty('background-size', backgroundSize[background.size]);
3985
- styles += formatProperty('background-position', backgroundPosition[background.position]);
3986
- styles += formatProperty('background-repeat', 'no-repeat');
3987
- }
3988
- } // border
3989
-
3990
-
3991
- if (border.useBorder) {
3992
- var lengthShortSide = Math.min(element.offsetWidth, element.offsetHeight);
3993
- var borderColor = getColor(border, colorUtils.getFadedColor(backgroundColor), theme);
3994
- var borderSize = border.width * lengthShortSide / 2;
3995
- styles += formatProperty('border', "".concat(borderSize, "px solid ").concat(borderColor));
3996
- styles += formatProperty('border-radius', "".concat(border.radius * lengthShortSide / 2, "px"));
3997
- } else {
3998
- styles += 'border: none;';
3999
- }
4000
-
4001
- return styles;
4002
- },
4003
- createLabelAndIcon: function createLabelAndIcon(_ref3) {
4004
- var button = _ref3.button,
4005
- theme = _ref3.theme,
4006
- style = _ref3.style,
4007
- isSense = _ref3.isSense;
4008
- var icon = style.icon,
4009
- font = style.font,
4010
- label = style.label; // text element wrapping label and icon
4011
-
4012
- var text = document.createElement('text');
4013
- text.style.whiteSpace = 'nowrap';
4014
- text.style.fontFamily = theme.getStyle('', '', 'fontFamily'); // label
4015
-
4016
- var textSpan = document.createElement('span');
4017
- textSpan.textContent = label;
4018
- textSpan.style.whiteSpace = 'nowrap';
4019
- textSpan.style.textOverflow = 'ellipsis';
4020
- textSpan.style.overflow = 'visible';
4021
- font.style.underline && (textSpan.style.textDecoration = 'underline');
4022
- text.appendChild(textSpan); // icon
4023
-
4024
- var hasIcon = isSense && icon.useIcon && icon.iconType !== '';
4025
-
4026
- if (hasIcon) {
4027
- var iconSpan = document.createElement('span');
4028
- var iconType = luiIcons.find(function (iconObj) {
4029
- return iconObj.label === icon.iconType || iconObj.value === icon.iconType;
4030
- });
4031
- iconSpan.style.textDecoration = 'none';
4032
- iconSpan.style.fontSize = 'inherit';
4033
- iconSpan.setAttribute('class', "lui-icon lui-icon--".concat(iconType ? iconType.value : ''));
4034
- icon.position === 'left' ? text.insertBefore(iconSpan, textSpan) : text.appendChild(iconSpan);
4035
- }
4036
-
4037
- button.innerHTML = '';
4038
- button.appendChild(text); // Calculations on font size.
4039
- // 1. Setting font size to height of button container
4040
-
4041
- text.style.fontSize = "".concat(button.clientHeight, "px"); // 2. Adjust the font size to the height ratio between button container and text box
4042
-
4043
- var newFontsize = button.clientHeight / text.offsetHeight * button.clientHeight;
4044
- text.style.fontSize = "".concat(newFontsize, "px"); // 3. Adjust the font size to the width ratio between button container and text box
4045
-
4046
- if (text.offsetWidth > button.clientWidth) {
4047
- newFontsize *= button.clientWidth / text.offsetWidth;
4048
- } // 4. Setting final font size by scaling with the font size from the layout + other font styling
4049
-
4050
-
4051
- if (font.style.italic) {
4052
- if (hasIcon) {
4053
- text.style.fontSize = "".concat(Math.max(newFontsize * font.size * 0.84, 8), "px");
4054
- text.children[0].style.marginRight = "".concat(text.offsetWidth * 0.04, "px");
4055
- text.children[1].style.marginRight = "".concat(text.offsetWidth * 0.04, "px");
4056
- } else {
4057
- text.style.fontSize = "".concat(Math.max(newFontsize * font.size * 0.9, 8), "px");
4058
- text.children[0].style.marginRight = "".concat(text.offsetWidth * 0.02, "px");
4059
- }
4060
- } else if (hasIcon) {
4061
- text.style.fontSize = "".concat(Math.max(newFontsize * font.size * 0.88, 8), "px");
4062
- text.children[0].style.marginRight = "".concat(text.offsetWidth * 0.04, "px");
4063
- } else {
4064
- text.style.fontSize = "".concat(Math.max(newFontsize * font.size * 0.92, 8), "px");
4065
- } // hide overflow when there can be overflow
4066
-
4067
-
4068
- if (text.style.fontSize === '8px') {
4069
- text.children.forEach(function (child) {
4070
- child.style.overflow = 'hidden';
4071
- });
4072
- }
4073
-
4074
- text.style.margin = '0 3%';
4075
- text.style.display = 'flex';
4076
- text.style.alignItems = 'center';
4077
- text.style.justifyContent = font.align === 'left' ? 'flex-start' : font.align === 'right' ? 'flex-end' : 'center';
4078
- }
4079
- };
4080
-
4081
- var runActions = /*#__PURE__*/function () {
4082
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(actionList) {
4083
- var i;
4084
- return regeneratorRuntime.wrap(function _callee$(_context) {
4085
- while (1) {
4086
- switch (_context.prev = _context.next) {
4087
- case 0:
4088
- i = 0;
4089
-
4090
- case 1:
4091
- if (!(i < actionList.length)) {
4092
- _context.next = 7;
4093
- break;
4094
- }
4095
-
4096
- _context.next = 4;
4097
- return actionList[i]();
4098
-
4099
- case 4:
4100
- i++;
4101
- _context.next = 1;
4102
- break;
4103
-
4104
- case 7:
4105
- case "end":
4106
- return _context.stop();
4107
- }
4108
- }
4109
- }, _callee);
4110
- }));
4111
-
4112
- return function runActions(_x) {
4113
- return _ref.apply(this, arguments);
4114
- };
4115
- }();
4116
- function renderButton(_ref2) {
4117
- var layout = _ref2.layout,
4118
- theme = _ref2.theme,
4119
- app = _ref2.app,
4120
- constraints = _ref2.constraints,
4121
- senseNavigation = _ref2.senseNavigation,
4122
- element = _ref2.element;
4123
- var isSense = !!senseNavigation;
4124
- var button = element.firstElementChild;
4125
- var style = layout.style,
4126
- qStateName = layout.qStateName;
4127
- var disabled = layout.useEnabledCondition && layout.enabledCondition === 0;
4128
- var isClickable = !disabled && !constraints.active;
4129
- var formattedStyles = styleFormatter.getStyles({
4130
- style: style,
4131
- disabled: disabled,
4132
- theme: theme,
4133
- element: element
4134
- });
4135
- button.setAttribute('style', formattedStyles);
4136
- button.setAttribute('tabindex', '-1');
4137
- styleFormatter.createLabelAndIcon({
4138
- button: button,
4139
- theme: theme,
4140
- style: style,
4141
- isSense: isSense
4142
- });
4143
- button.onclick = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
4144
- var actionCallList, actions$1, navigation, navigationObject;
4145
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
4146
- while (1) {
4147
- switch (_context2.prev = _context2.next) {
4148
- case 0:
4149
- if (!isClickable) {
4150
- _context2.next = 14;
4151
- break;
4152
- }
4153
-
4154
- actionCallList = [];
4155
- actions$1 = layout.actions;
4156
- actions$1.forEach(function (action) {
4157
- var actionObj = actions.find(function (act) {
4158
- return act.value === action.actionType;
4159
- });
4160
- actionObj && actionCallList.push(actionObj.getActionCall(_objectSpread2({
4161
- app: app,
4162
- qStateName: qStateName
4163
- }, action)));
4164
- });
4165
- button.setAttribute('disabled', true);
4166
- _context2.next = 7;
4167
- return runActions(actionCallList);
4168
-
4169
- case 7:
4170
- if (!(senseNavigation && !senseNavigation.getCurrentStoryId())) {
4171
- _context2.next = 13;
4172
- break;
4173
- }
4174
-
4175
- navigation = layout.navigation;
4176
- navigationObject = navigation && navigationActions.find(function (nav) {
4177
- return nav.value === navigation.action;
4178
- });
4179
-
4180
- if (!(senseNavigation && navigationObject && typeof navigationObject.navigationCall === 'function')) {
4181
- _context2.next = 13;
4182
- break;
4183
- }
4184
-
4185
- _context2.next = 13;
4186
- return navigationObject.navigationCall(_objectSpread2({
4187
- app: app,
4188
- senseNavigation: senseNavigation
4189
- }, navigation));
4190
-
4191
- case 13:
4192
- button.removeAttribute('disabled');
4193
-
4194
- case 14:
4195
- case "end":
4196
- return _context2.stop();
4197
- }
4198
- }
4199
- }, _callee2);
4200
- }));
4201
-
4202
- var scale = function scale() {
4203
- if (isClickable) {
4204
- var offsetWidth = button.offsetWidth,
4205
- offsetHeight = button.offsetHeight;
4206
- button.style.transform = offsetHeight > offsetWidth ? "scale(".concat(0.98, ", ", 1 - offsetWidth / offsetHeight * 0.02, ")") : "scale(".concat(1 - offsetHeight / offsetWidth * 0.02, ", ", 0.98, ")");
4207
- }
4208
- };
4209
-
4210
- var resetScale = function resetScale() {
4211
- var transform = button.style.transform;
4212
-
4213
- if (isClickable && transform !== '' && transform !== 'scale(1)') {
4214
- button.style.transform = 'scale(1)';
4215
- }
4216
- };
4217
-
4218
- button.onmousedown = function (event) {
4219
- if (event.button === 0) {
4220
- scale();
4221
- }
4222
- };
4223
-
4224
- button.onmouseup = resetScale;
4225
- button.onmouseleave = resetScale;
4226
- button.ontouchstart = scale;
4227
- button.ontouchend = resetScale;
4228
- button.ontouchcancel = resetScale;
4229
- return function () {
4230
- button.onclick = undefined;
4231
- button.onmousedown = undefined;
4232
- button.onmouseup = undefined;
4233
- button.onmouseleave = undefined;
4234
- button.ontouchstart = undefined;
4235
- button.ontouchend = undefined;
4236
- button.ontouchcancel = undefined;
4237
- };
4238
- }
4239
-
4240
- function supernova(env) {
4241
- var sense = env.sense,
4242
- translator = env.translator,
4243
- isEnabled = env.flags.isEnabled;
4244
- var senseNavigation = sense && sense.navigation;
4245
- var automationsEnabled = isEnabled('ACTION_BUTTON_AUTOMATIONS');
4246
- properties.style.label = sense ? translator.get('Object.ActionButton') : 'Button';
4247
- return {
4248
- qae: {
4249
- properties: properties,
4250
- data: data
4251
- },
4252
- component: function component() {
4253
- var element = useElement();
4254
- var theme = useTheme();
4255
- useMemo(function () {
4256
- var button = document.createElement('button');
4257
- button.appendChild(document.createElement('text'));
4258
- element.appendChild(button);
4259
- }, []);
4260
- var layout = useStaleLayout();
4261
- var app = useApp();
4262
- var constraints = useConstraints();
4263
- var cleanup = renderButton({
4264
- element: element,
4265
- layout: layout,
4266
- constraints: constraints,
4267
- theme: theme,
4268
- app: app,
4269
- senseNavigation: senseNavigation,
4270
- automationsEnabled: automationsEnabled
4271
- });
4272
- useEffect(function () {
4273
- return function () {
4274
- cleanup();
4275
- };
4276
- }, [element]);
4277
- useImperativeHandle(function () {
4278
- return {
4279
- focus: function focus() {
4280
- element.firstElementChild.onclick();
4281
- }
4282
- };
4283
- }, [element]);
4284
- },
4285
- ext: ext({
4286
- translator: translator,
4287
- automationsEnabled: automationsEnabled
4288
- })
4289
- };
4290
- }
4291
-
4292
- export { supernova as default };
4293
- //# sourceMappingURL=sn-action-button.esm.js.map
7
+ import{useElement as e,useTheme as t,useMemo as o,useStaleLayout as a,useApp as n,useConstraints as l,useEffect as i,useImperativeHandle as r}from"@nebula.js/stardust";var s={LABEL:"Button",FONT_SIZE:.5,COLOR:{index:-1,color:null},FONT_STYLE:{bold:!0,italic:!1,underline:!1},TEXT_ALIGN:"center",BACKGROUND_SIZE:"auto",BACKGROUND_POSITION:"centerCenter",BORDER_RADIUS:0,BORDER_WIDTH:0,ICON_POSITION:"left"};const c={version:"1.15.2",showTitles:!0,title:"",subtitle:"",footnote:"",useEnabledCondition:!1,enabledCondition:1,actions:[],navigation:{action:"none"},style:{label:s.LABEL,font:{useColorExpression:!1,color:s.COLOR,colorExpression:"",size:s.FONT_SIZE,style:s.FONT_STYLE,align:s.TEXT_ALIGN},background:{useColorExpression:!1,color:s.COLOR,colorExpression:"",useImage:!1,url:{qStaticContentUrlDef:{qUrl:""}},size:s.BACKGROUND_SIZE,position:s.BACKGROUND_POSITION},border:{useColorExpression:!1,color:s.COLOR,colorExpression:"",useBorder:!1,radius:s.BORDER_RADIUS,width:s.BORDER_WIDTH},icon:{useIcon:!1,iconType:"",position:s.ICON_POSITION}}};var u={targets:[]};const p=[{value:"applyBookmark",translation:"Object.ActionButton.ApplyBookmark",group:"bookmark",getActionCall:({app:e,bookmark:t})=>async()=>{const o=(await e.getBookmarkList()).find((e=>e.qData.title===t));t&&await e.applyBookmark(o&&o.qInfo&&o.qInfo.qId||t)},requiredInput:["bookmark"]},{value:"back",translation:"Object.ActionButton.MoveBackward",group:"selection",getActionCall:({app:e})=>async()=>{await e.back()},requiredInput:[]},{value:"forward",translation:"Object.ActionButton.MoveForward",group:"selection",getActionCall:({app:e})=>async()=>{await e.forward()},requiredInput:[]},{value:"clearAll",translation:"Object.ActionButton.ClearAll",group:"selection",getActionCall:({app:e,softLock:t})=>async()=>{await e.clearAll(t)},requiredInput:["softLock"]},{value:"clearAllButThis",translation:"Object.ActionButton.ClearAllButThis",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:a})=>async()=>{if(o){const n=await e.getField(o,t);await n.clearAllButThis(a)}},requiredInput:["field","softLock"]},{value:"clearField",translation:"Object.ActionButton.ClearSelectionInField",group:"selection",getActionCall:({app:e,qStateName:t,field:o})=>async()=>{if(o){const a=await e.getField(o,t);await a.clear()}},requiredInput:["field"]},{value:"selectAll",translation:"Object.ActionButton.SelectAllInField",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:a})=>async()=>{if(o){const n=await e.getField(o,t);await n.selectAll(a)}},requiredInput:["field","softLock"]},{value:"selectValues",translation:"Object.ActionButton.SelectValuesInField",group:"selection",getActionCall:({app:e,qStateName:t,field:o,value:a,softLock:n})=>async()=>{if(o&&a){const l=await e.getField(o,t),i=await e.getFieldDescription(o),r=await(async(e,t,o)=>{let a=t.split(";");if(o){let t="";a.forEach((e=>{t+=`Num('${e}')&';'&`})),a=(await e.evaluate(t.slice(0,-5))).split(";")}return a.map((e=>Number.isNaN(+e)?{qText:e}:{qIsNumeric:!0,qNumber:Number(e)}))})(e,a,i.qTags.includes("$date"));await l.selectValues(r,!1,n)}},requiredInput:["field","value","softLock"]},{value:"selectMatchingValues",translation:"Object.ActionButton.SelectMatchingValues",group:"selection",getActionCall:({app:e,qStateName:t,field:o,value:a,softLock:n})=>async()=>{if(o&&a){const l=await e.getField(o,t);await l.select(a,!1,n)}},requiredInput:["field","value","softLock"]},{value:"selectAlternative",translation:"Object.ActionButton.SelectAlternatives",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:a})=>async()=>{if(o){const n=await e.getField(o,t);await n.selectAlternative(a)}},requiredInput:["field","softLock"]},{value:"selectExcluded",translation:"Object.ActionButton.SelectExcluded",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:a})=>async()=>{if(o){const n=await e.getField(o,t);await n.selectExcluded(a)}},requiredInput:["field","softLock"]},{value:"selectPossible",translation:"Object.ActionButton.SelectPossibleValues",group:"selection",getActionCall:({app:e,qStateName:t,field:o,softLock:a})=>async()=>{if(o){const n=await e.getField(o,t);await n.selectPossible(a)}},requiredInput:["field","softLock"]},{value:"toggleSelect",translation:"Object.ActionButton.ToggleFieldSelection",group:"selection",getActionCall:({app:e,qStateName:t,field:o,value:a,softLock:n})=>async()=>{if(o&&a){const l=await e.getField(o,t);await l.toggleSelect(a,n)}},requiredInput:["field","value","softLock"]},{value:"lockAll",translation:"Object.ActionButton.LockAllSelections",group:"selection",getActionCall:({app:e})=>async()=>{await e.lockAll()},requiredInput:[]},{value:"lockField",translation:"Object.ActionButton.LockField",group:"selection",getActionCall:({app:e,qStateName:t,field:o})=>async()=>{if(o){const a=await e.getField(o,t);await a.lock()}},requiredInput:["field"]},{value:"unlockAll",translation:"Object.ActionButton.UnlockAllSelections",group:"selection",getActionCall:({app:e})=>async()=>{await e.unlockAll()},requiredInput:[]},{value:"unlockField",translation:"Object.ActionButton.UnlockAField",group:"selection",getActionCall:({app:e,qStateName:t,field:o})=>async()=>{if(o){const a=await e.getField(o,t);await a.unlock()}},requiredInput:["field"]},{value:"setVariable",translation:"Object.ActionButton.SetVariable",group:"variables",getActionCall:({app:e,variable:t,value:o})=>async()=>{if(t&&o)try{const a=await e.getVariableByName(t);await a.setStringValue(o)}catch(e){}},requiredInput:["variable","value"]},{value:"doReload",translation:"Object.ActionButton.DoReload",group:"reload",getActionCall:({app:e,partial:t})=>async()=>{await e.doReload(0,!!t,!1)&&await e.doSave()},requiredInput:["partial"]},{translation:"Object.ActionButton.ExecuteAutomation",value:"executeAutomation",getActionCall:({app:e,automation:t,automationPostData:o})=>async()=>{if(void 0!==t)try{t=encodeURIComponent(t);const a=await fetch(`../api/v1/items/${t}`).then((e=>e.json())),n=await fetch(`../api/v1/automations/${a.resourceId}`).then((e=>e.json()));let l=`../api/v1/automations/${n.guid}/actions/execute?X-Execution-Token=${n.execution_token}`;if(o&&n.hasinputs){const o=await fetch(`../api/v1/automations/${a.resourceId}/blocks`).then((e=>e.json())).then((e=>{let t;for(let o=0;o<e.blocks.length;o++)if("Inputs"===e.blocks[o].displayName){t=e.blocks[o].form;break}return t})),n=new Date,i={qProp:{qInfo:{qId:`automation_${e.id}_${t}_${n.getTime()}`,qType:"bookmark"},qMetaDef:{title:`Generated automation bookmark on ${n.toISOString()}`,description:"Generated to provide target automation with bookmark to get current selection state",_createdBy:"sn-action-button",_createdFor:"automation",_createdOn:`${n.toISOString()}`,_id:`automation_${encodeURIComponent(e.id)}_${t}_${n.getTime()}`}}},r=await e.createBookmark(i).then((e=>e.getLayout())).then((e=>e.qInfo.qId));await e.saveObjects(),l=`${l}&${o[0].label.toLowerCase()}=${encodeURIComponent(e.id)}&${o[1].label.toLowerCase()}=${r}`}await fetch(l).then((e=>e.json()))}catch(e){}},requiredInput:["automation"]}];function b(e,t){const o=p.find((t=>e.actionType===t.value));return o&&o.requiredInput&&-1!==o.requiredInput.indexOf(t)}var d={evaluateCondition:function(e){if(e&&e.length>=2&&"/"===e[0]&&"/"===e[1])return!0;const t=e?+e:-1;return Number.isNaN(+t)?"true"===e.toLowerCase():0!==t}};const g=async e=>(await e.getSheetList()).filter((e=>d.evaluateCondition(e.qData.showCondition))).sort(((e,t)=>e.qData.rank-t.qData.rank)),m=[{translation:"Object.ActionButton.NoNavigation",value:"none"},{translation:"Object.ActionButton.GoToNextSheet",value:"nextSheet",navigationCall:async({senseNavigation:e})=>{await e.nextSheet()},requiredInput:[]},{translation:"Object.ActionButton.GoToPreviousSheet",value:"prevSheet",navigationCall:async({senseNavigation:e})=>{await e.prevSheet()},requiredInput:[]},{translation:"Object.ActionButton.GoToLastSheet",value:"lastSheet",navigationCall:async({app:e,senseNavigation:t})=>{const o=await g(e);await t.goToSheet(o[o.length-1].qInfo.qId)},requiredInput:[]},{translation:"Object.ActionButton.GoToFirstSheet",value:"firstSheet",navigationCall:async({app:e,senseNavigation:t})=>{const o=await g(e);await t.goToSheet(o[0].qInfo.qId)},requiredInput:[]},{translation:"Object.ActionButton.GoToASheet",value:"goToSheet",navigationCall:async({senseNavigation:e,sheet:t})=>{t&&await e.goToSheet(t)},requiredInput:["sheet"]},{translation:"Object.ActionButton.GoToSheetById",value:"goToSheetById",navigationCall:async({senseNavigation:e,sheet:t})=>{t&&await e.goToSheet(t)},requiredInput:["sheetId"]},{translation:"Object.ActionButton.GoToStory",value:"goToStory",navigationCall:async({senseNavigation:e,story:t})=>{t&&await e.goToStory(t)},requiredInput:["story"]},{translation:"Object.ActionButton.OpenWebsiteEmail",value:"openWebsite",navigationCall:async({websiteUrl:e,sameWindow:t})=>{try{if(e){const o=e.match(/^(https?:\/\/|mailto:)/)?e:`http://${e}`;let a="";t&&(a=(()=>{try{return window.self!==window.top}catch(e){return!0}})()?"_parent":"_self"),window.open(o,a)}}catch(e){}},requiredInput:["websiteUrl"]}],v=(e,t)=>{const o=m.find((t=>e.navigation.action===t.value));return o&&o.requiredInput&&-1!==o.requiredInput.indexOf(t)};var h={getValue:function(e,t,o){const a=t.split(".");let n;if(void 0===e)return o;for(n=0;n<a.length;++n){if(void 0===e[a[n]])return o;e=e[a[n]]}return e}};function f(e){switch(e){case"gotoSheet":return"goToSheet";case"gotoSheetById":return"goToSheetById";case"gotoStory":return"goToStory";case"switchToEdit":return"none";default:return e}}const y=(e,t)=>{const o={qChildren:[]},a={actions:[],props:{useEnabledCondition:null,fullWidth:"auto"},qLayoutExclude:{disabled:{}},...t};return e&&"qlik-button-for-navigation"===e.properties.visualization&&Object.keys(e.properties).forEach((t=>{let o;switch(t){case"props":o=e.properties[t],a.style.label=o.buttonLabel,a.style.icon.useIcon=o.buttonShowIcon,a.style.icon.iconType=o.buttonIconLui,a.style.font.align=o.buttonTextAlign,a.useEnabledCondition=o.useEnabledCondition,a.enabledCondition=o.enabledCondition,o.actionItems&&o.actionItems.forEach((e=>{!function(e,t){const o={actionType:e.actionType,bookmark:e.selectedBookmark,field:e.selectedField,variable:e.variable,value:e.value,softLock:e.softLock,cId:e.cId};switch(e.actionType){case"clearOther":o.actionType="clearAllButThis";break;case"unlockAllAndClearAll":o.actionType="clearAll",o.softLock=!0;break;case"selectField":o.actionType="selectMatchingValues";break;case"selectAndLockField":t.actions.push({...o,cId:null,actionType:"selectMatchingValues"}),o.actionType="lockField"}t.actions.push(o)}(e,a)})),a.navigation={action:f(o.navigationAction),sheet:"gotoSheetById"===o.navigationAction?o.sheetId:o.selectedSheet,story:o.selectedStory,websiteUrl:o.websiteUrl,sameWindow:o.sameWindow};break;case"qStateName":case"showTitles":case"title":case"subtitle":case"footnote":a[t]=e.properties[t]}})),o.qProperty=a,o};var w=[{value:"image",icon:"image",label:"Image"},{value:"back",icon:"back",label:"Back"},{value:"forward",icon:"forward",label:"Forward"},{value:"history",icon:"history",label:"History"},{value:"help",icon:"help",label:"Help"},{value:"info",icon:"info",label:"Info"},{value:"text",icon:"text",label:"Text"},{value:"group",icon:"group",label:"Group"},{value:"search",icon:"search",label:"Search"},{value:"zoom-in",icon:"zoom-in",label:"Zoom in"},{value:"zoom-out",icon:"zoom-out",label:"Zoom out"},{value:"export",icon:"export",label:"Export"},{value:"import",icon:"import",label:"Import"},{value:"field",icon:"field",label:"Field"},{value:"lock",icon:"lock",label:"Lock"},{value:"unlock",icon:"unlock",label:"Unlock"},{value:"database",icon:"database",label:"Database"},{value:"calendar",icon:"calendar",label:"Calendar"},{value:"bookmark",icon:"bookmark",label:"Bookmark"},{value:"library",icon:"library",label:"Library"},{value:"star",icon:"star",label:"Star"},{value:"print",icon:"print",label:"Print"},{value:"remove",icon:"remove",label:"Remove"},{value:"handle",icon:"handle",label:"Handle"},{value:"handle-horizontal",icon:"handle-horizontal",label:"Handle horizontal"},{value:"menu",icon:"menu",label:"Menu"},{value:"list",icon:"list",label:"List"},{value:"unordered-list",icon:"unordered-list",label:"Unordered list"},{value:"clock",icon:"clock",label:"Clock"},{value:"puzzle",icon:"puzzle",label:"Puzzle"},{value:"filterpane",icon:"filterpane",label:"Filterpane"},{value:"plus",icon:"plus",label:"Plus"},{value:"minus",icon:"minus",label:"Minus"},{value:"triangle-top",icon:"triangle-top",label:"Triangle top"},{value:"triangle-bottom",icon:"triangle-bottom",label:"Triangle bottom"},{value:"triangle-left",icon:"triangle-left",label:"Triangle left"},{value:"triangle-right",icon:"triangle-right",label:"Triangle right"},{value:"tick",icon:"tick",label:"Tick"},{value:"cogwheel",icon:"cogwheel",label:"Cogwheel"},{value:"settings",icon:"settings",label:"Settings"},{value:"cut",icon:"cut",label:"Cut"},{value:"copy",icon:"copy",label:"Copy"},{value:"paste",icon:"paste",label:"Paste"},{value:"camera",icon:"camera",label:"Camera"},{value:"slide-show",icon:"slide-show",label:"Slide show"},{value:"palette",icon:"palette",label:"Palette"},{value:"shapes",icon:"shapes",label:"Shapes"},{value:"effects",icon:"effects",label:"Effects"},{value:"file",icon:"file",label:"File"},{value:"expand",icon:"expand",label:"Expand"},{value:"collapse",icon:"collapse",label:"Collapse"},{value:"bin",icon:"bin",label:"Bin"},{value:"link",icon:"link",label:"Link"},{value:"pivot",icon:"pivot",label:"Pivot"},{value:"reload",icon:"reload",label:"Reload"},{value:"add",icon:"add",label:"Add"},{value:"edit",icon:"edit",label:"Edit"},{value:"key",icon:"key",label:"Key"},{value:"box",icon:"box",label:"Box"},{value:"home",icon:"home",label:"Home"},{value:"person",icon:"person",label:"Person"},{value:"grid",icon:"grid",label:"Grid"},{value:"cloud",icon:"cloud",label:"Cloud"},{value:"more",icon:"more",label:"More"},{value:"folder",icon:"folder",label:"Folder"},{value:"drop",icon:"drop",label:"Drop"},{value:"play",icon:"play",label:"Play"},{value:"tag",icon:"tag",label:"Tag"},{value:"close",icon:"close",label:"Close"},{value:"warning",icon:"warning",label:"Warning"},{value:"warning-triangle",icon:"warning-triangle",label:"Warning triangle"},{value:"share",icon:"share",label:"Share"},{value:"top",icon:"top",label:"Top"},{value:"low-resolution",icon:"low-resolution",label:"Low resolution"},{value:"high-resolution",icon:"high-resolution",label:"High resolution"},{value:"view",icon:"view",label:"View"},{value:"control",icon:"control",label:"Control"},{value:"code",icon:"code",label:"Code"},{value:"upload",icon:"upload",label:"Upload"},{value:"repair",icon:"repair",label:"Repair"},{value:"split",icon:"split",label:"Split"},{value:"up-down",icon:"up-down",label:"Up down"},{value:"disconnect",icon:"disconnect",label:"Disconnect"},{value:"photo-library",icon:"photo-library",label:"Photo library"},{value:"application",icon:"application",label:"Application"},{value:"new-tab",icon:"new-tab",label:"New tab"},{value:"ascending",icon:"ascending",label:"Ascending"},{value:"descending",icon:"descending",label:"Descending"},{value:"arrow-up",icon:"arrow-up",label:"Arrow up"},{value:"arrow-down",icon:"arrow-down",label:"Arrow down"},{value:"arrow-right",icon:"arrow-right",label:"Arrow right"},{value:"arrow-left",icon:"arrow-left",label:"Arrow left"},{value:"sync",icon:"sync",label:"Sync"},{value:"draggable",icon:"draggable",label:"Draggable"},{value:"book",icon:"book",label:"Book"},{value:"measure",icon:"measure",label:"Measure"},{value:"download",icon:"download",label:"Download"},{value:"more-rounded",icon:"more-rounded",label:"More rounded"},{value:"align-object-left",icon:"align-object-left",label:"Align object-left"},{value:"align-object-center",icon:"align-object-center",label:"Align object-center"},{value:"align-object-right",icon:"align-object-right",label:"Align object-right"},{value:"submit",icon:"submit",label:"Submit"},{value:"operators",icon:"operators",label:"Operators"},{value:"general-data-class",icon:"general-data-class",label:"General data-class"},{value:"building",icon:"building",label:"Building"},{value:"bell",icon:"bell",label:"Bell"},{value:"unlink",icon:"unlink",label:"Unlink"},{value:"lightbulb",icon:"lightbulb",label:"Lightbulb"},{value:"log-in",icon:"log-in",label:"Log in"},{value:"log-out",icon:"log-out",label:"Log out"},{value:"previous",icon:"previous",label:"Previous"},{value:"goto",icon:"goto",label:"Goto"},{value:"save",icon:"save",label:"Save"},{value:"pause",icon:"pause",label:"Pause"},{value:"stop",icon:"stop",label:"Stop"},{value:"step-in",icon:"step-in",label:"Step in"},{value:"comment",icon:"comment",label:"Comment"},{value:"indent",icon:"indent",label:"Indent"},{value:"undent",icon:"undent",label:"Undent"},{value:"filter",icon:"filter",label:"Filter"},{value:"clear-filter",icon:"clear-filter",label:"Clear filter"},{value:"insert",icon:"insert",label:"Insert"},{value:"direction-left",icon:"direction-left",label:"Direction left"},{value:"swap",icon:"swap",label:"Swap"},{value:"bubbles",icon:"bubbles",label:"Bubbles"},{value:"sheet",icon:"sheet",label:"Sheet"},{value:"object",icon:"object",label:"Object"},{value:"clear-selections",icon:"clear-selections",label:"Clear selections"},{value:"selections-tool",icon:"selections-tool",label:"Selections tool"},{value:"selections-reload",icon:"selections-reload",label:"Selections reload"},{value:"selections-back",icon:"selections-back",label:"Selections back"},{value:"selections-forward",icon:"selections-forward",label:"Selections forward"},{value:"expression",icon:"expression",label:"Expression"},{value:"select-alternative",icon:"select-alternative",label:"Select alternative"},{value:"select-possible",icon:"select-possible",label:"Select possible"},{value:"select-excluded",icon:"select-excluded",label:"Select excluded"},{value:"select-all",icon:"select-all",label:"Select all"},{value:"bar-chart",icon:"bar-chart",label:"Bar chart"},{value:"bar-chart-horizontal",icon:"bar-chart-horizontal",label:"Bar chart-horizontal"},{value:"line-chart",icon:"line-chart",label:"Line chart"},{value:"pie-chart",icon:"pie-chart",label:"Pie chart"},{value:"gauge-chart",icon:"gauge-chart",label:"Gauge chart"},{value:"kpi",icon:"kpi",label:"Kpi"},{value:"scatter-chart",icon:"scatter-chart",label:"Scatter chart"},{value:"map",icon:"map",label:"Map"},{value:"table",icon:"table",label:"Table"},{value:"pivot-table",icon:"pivot-table",label:"Pivot table"},{value:"treemap",icon:"treemap",label:"Treemap"},{value:"combo-chart",icon:"combo-chart",label:"Combo chart"},{value:"boxplot",icon:"boxplot",label:"Boxplot"},{value:"distributionplot",icon:"distributionplot",label:"Distributionplot"},{value:"histogram",icon:"histogram",label:"Histogram"},{value:"direct-discovery",icon:"direct-discovery",label:"Direct discovery"},{value:"data-model",icon:"data-model",label:"Data model"},{value:"script",icon:"script",label:"Script"},{value:"script-ok",icon:"script-ok",label:"Script ok"},{value:"debug",icon:"debug",label:"Debug"},{value:"auto-layout",icon:"auto-layout",label:"Auto layout"}];const k=[{value:!1,translation:"properties.colorMode.primary"},{value:!0,translation:"properties.colorMode.byExpression"}],S=[{value:!0,translation:"properties.on"},{value:!1,translation:"properties.off"}];function A({translator:e,automationsEnabled:t}){return{definition:{type:"items",component:"accordion",items:{actions:{type:"items",translation:"Object.ActionButton.ActionsAndNavigation",grouped:!0,items:{actions:{type:"array",translation:"Object.ActionButton.Actions",ref:"actions",itemTitleRef:t=>{if(t.actionLabel)return t.actionLabel;const o=t.actionType?"Object.ActionButton.InvalidAction":"Object.ActionButton.NewAction",a=p.find((e=>t.actionType===e.value));return e.get(a&&a.translation||o)},allowAdd:!0,allowRemove:!0,allowMove:!0,addTranslation:"Object.ActionButton.AddAction",items:{label:{component:"string",ref:"actionLabel",translation:"Common.Label",expression:"optional",defaultValue:""},actionType:{type:"string",ref:"actionType",component:"expression-with-dropdown",translation:"Object.ActionButton.Action",defaultValue:"",options:p.filter((e=>"executeAutomation"!==e.value||t)),dropdownOnly:!0},bookmark:{type:"string",ref:"bookmark",component:"expression-with-dropdown",translation:"ExpressionEditor.SetExpresions.Bookmark",defaultValue:"",dropdownOnly:!0,options:async(e,t)=>(await t.app.getBookmarkList()).map((e=>({label:e.qData.title,value:e.qInfo.qId}))),show:e=>b(e,"bookmark")},field:{type:"string",ref:"field",component:"expression-with-dropdown",translation:"Common.Field",defaultValue:"",dropdownOnly:!0,options:async(e,t)=>(await t.app.getFieldList()).map((e=>({label:e.qName,value:e.qName}))),show:e=>b(e,"field")},variable:{type:"string",ref:"variable",component:"expression-with-dropdown",translation:"Common.Variable",defaultValue:"",expressionType:"StringExpression",options:async(e,t)=>(await t.app.getVariableList()).filter((t=>!t.qIsReserved||t.qIsReserved&&e.showSystemVariables)).map((e=>({label:e.qName,value:e.qName}))),show:e=>b(e,"variable")},showSystemVariables:{type:"boolean",ref:"showSystemVariables",translation:"ExpressionEditor.SystemVariables",defaultValue:!1,show:e=>b(e,"variable")},softLock:{type:"boolean",ref:"softLock",translation:"Object.ActionButton.Softlock",defaultValue:!1,show:e=>b(e,"softLock")},value:{type:"string",ref:"value",component:"string",translation:"properties.value",expression:"optional",show:e=>b(e,"value")},partial:{type:"boolean",ref:"partial",translation:"Object.ActionButton.Partial",defaultValue:!1,show:e=>b(e,"partial")},automation:{type:"string",component:"expression-with-dropdown",translation:"Object.ActionButton.Automation",ref:"automation",dropdownOnly:!0,options:async()=>(await fetch("../api/v1/items?resourceType=automation&limit=100").then((e=>e.json()))).data.map((e=>({value:e.id,label:e.name}))),show:e=>b(e,"automation")},automationPostData:{type:"boolean",ref:"automationPostData",translation:"Object.ActionButton.Automation.SendSelections",show:e=>b(e,"automation"),defaultValue:!1}}},navigation:{translation:"Object.ActionButton.Navigation",type:"items",items:{action:{ref:"navigation.action",translation:"Object.ActionButton.Navigation",component:"expression-with-dropdown",defaultValue:null,options:m,dropdownOnly:!0},sheetId:{type:"string",ref:"navigation.sheet",translation:"properties.sheet",expression:"optional",show:e=>v(e,"sheetId")},sheet:{type:"string",ref:"navigation.sheet",translation:"properties.sheet",component:"expression-with-dropdown",expressionType:"StringExpression",show:e=>v(e,"sheet"),options:async(e,t)=>(await t.app.getSheetList()).map((e=>({value:e.qInfo.qId,label:e.qMeta.title,showCondition:e.qData.showCondition})))},story:{type:"string",ref:"navigation.story",translation:"properties.story",component:"expression-with-dropdown",expressionType:"StringExpression",show:e=>v(e,"story"),options:async(e,t)=>(await t.app.getStoryList()).map((e=>({value:e.qInfo.qId,label:e.qMeta.title})))},websiteUrl:{type:"string",expression:"optional",ref:"navigation.websiteUrl",translation:"properties.website",show:e=>v(e,"websiteUrl")},sameWindow:{type:"boolean",ref:"navigation.sameWindow",translation:"properties.sameWindow",show:e=>v(e,"websiteUrl"),defaultValue:!1}}}}},enableCondition:{type:"items",translation:"properties.enableConditionSection",items:{useCondition:{type:"boolean",component:"switch",translation:"properties.enableToggle",ref:"useEnabledCondition",options:[{value:!0,translation:"properties.on"},{value:!1,translation:"properties.off"}]},condition:{ref:"enabledCondition",translation:"properties.enableCondition",type:"integer",expression:"optional",show:e=>e.useEnabledCondition}}},settings:{component:"expandable-items",translation:"Common.Appearance",uses:"settings",items:{general:{type:"items",translation:"properties.general",items:{showTitles:{},details:{show:!1},label:{component:"string",ref:"style.label",translation:"Common.Label",expression:"optional"}}},font:{grouped:!0,type:"items",translation:"properties.font",items:{sizeAndColor:{type:"items",items:{fontSize:{component:"slider",type:"number",ref:"style.font.size",translation:"properties.fontSize",min:.2,max:1,step:.01},useFontColorExpression:{ref:"style.font.useColorExpression",type:"boolean",translation:"properties.fontColor",component:"dropdown",options:k},colorPicker:{component:"color-picker",type:"object",ref:"style.font.color",translation:"properties.color",dualOutput:!0,show:e=>!h.getValue(e,"style.font.useColorExpression")},colorExpression:{component:"string",type:"string",ref:"style.font.colorExpression",translation:"Common.Expression",expression:"optional",show:e=>h.getValue(e,"style.font.useColorExpression")}}},stylingAndAlign:{type:"items",items:{fontStyling:{component:"item-selection-list",type:"string",ref:"style.font.style",translation:"properties.textStyle",horizontal:!0,multipleSelect:!0,items:[{component:"icon-item",icon:"bold",value:"bold",translation:"Common.bold",labelPlacement:"bottom"},{component:"icon-item",icon:"italic",value:"italic",translation:"Common.italic",labelPlacement:"bottom"},{component:"icon-item",icon:"underline",value:"underline",translation:"Common.underline",labelPlacement:"bottom"}]},textAlign:{component:"item-selection-list",type:"string",ref:"style.font.align",translation:"properties.Alignment",horizontal:!0,items:[{component:"icon-item",icon:"align_left",value:"left",translation:"properties.dock.left",labelPlacement:"bottom"},{component:"icon-item",icon:"align_center",value:"center",translation:"Common.Center",labelPlacement:"bottom"},{component:"icon-item",icon:"align_right",value:"right",translation:"properties.dock.right",labelPlacement:"bottom"}]}}}}},background:{grouped:!0,type:"items",translation:"properties.background",items:{backgroundColor:{type:"items",items:{useColorExpression:{ref:"style.background.useColorExpression",type:"boolean",translation:"AppDetails.SheetBackgroundColor",component:"dropdown",options:k},colorPicker:{component:"color-picker",type:"object",ref:"style.background.color",translation:"properties.color",dualOutput:!0,show:e=>!h.getValue(e,"style.background.useColorExpression")},colorExpression:{component:"string",type:"string",ref:"style.background.colorExpression",translation:"Common.Expression",expression:"optional",show:e=>h.getValue(e,"style.background.useColorExpression")}}},backgroundImage:{type:"items",items:{useBackgroundImage:{ref:"style.background.useImage",type:"boolean",translation:"properties.backgroundImage.use",component:"switch",options:S},backgroundUrl:{ref:"style.background.url.qStaticContentUrlDef.qUrl",layoutRef:"style.background.url.qStaticContentUrl.qUrl",schemaIgnore:!0,translation:"Common.Image",tooltip:{select:"properties.media.select",remove:"properties.media.removeBackground"},type:"string",component:"media",show:e=>h.getValue(e,"style.background.useImage")},backgroundSize:{ref:"style.background.size",translation:"properties.backgroundImage.size",type:"string",component:"dropdown",options:[{value:"auto",translation:"properties.backgroundImage.originalSize"},{value:"alwaysFit",translation:"properties.backgroundImage.sizeAlwaysFit"},{value:"fitWidth",translation:"properties.backgroundImage.sizeFitWidth"},{value:"fitHeight",translation:"properties.backgroundImage.sizeFitHeight"},{value:"fill",translation:"properties.backgroundImage.sizeStretch"},{value:"alwaysFill",translation:"properties.backgroundImage.sizeAlwaysFill"}],show:e=>h.getValue(e,"style.background.useImage")&&!!h.getValue(e,"style.background.url.qStaticContentUrlDef.qUrl")},backgroundPosition:{ref:"style.background.position",translation:"Common.Position",type:"string",component:"align-matrix",show:e=>h.getValue(e,"style.background.useImage")&&h.getValue(e,"style.background.url.qStaticContentUrlDef.qUrl")&&"fill"!==h.getValue(e,"style.background.size"),currentSize:e=>h.getValue(e,"style.background.size")}}}}},border:{type:"items",grouped:!0,translation:"properties.border",items:{borderSettings:{type:"items",items:{useBorder:{ref:"style.border.useBorder",type:"boolean",translation:"properties.border.use",component:"switch",options:S},borderRadius:{component:"slider",show:e=>h.getValue(e,"style.border.useBorder"),translation:"properties.border.radius",type:"number",ref:"style.border.radius",min:0,max:1,step:.01},borderWidth:{component:"slider",show:e=>h.getValue(e,"style.border.useBorder"),type:"number",ref:"style.border.width",translation:"properties.border.width",min:0,max:.5,step:.005},colorDropdown:{type:"string",show:e=>h.getValue(e,"style.border.useBorder"),component:"dropdown",translation:"properties.border.color",ref:"style.border.useColorExpression",options:k},colorPicker:{component:"color-picker",type:"object",ref:"style.border.color",translation:"properties.color",dualOutput:!0,show:e=>h.getValue(e,"style.border.useBorder")&&!h.getValue(e,"style.border.useColorExpression")},colorExpression:{component:"string",type:"string",ref:"style.border.colorExpression",translation:"Common.Expression",show:e=>h.getValue(e,"style.border.useBorder")&&h.getValue(e,"style.border.useColorExpression"),expression:"optional"}}}}},icon:{type:"items",grouped:!0,translation:"properties.icon",items:{iconSettings:{type:"items",items:{useIcon:{ref:"style.icon.useIcon",type:"boolean",translation:"properties.icon.use",component:"switch",options:S},iconType:{ref:"style.icon.iconType",component:"expression-with-dropdown",translation:"properties.icon",defaultValue:"",options:w,expressionType:"StringExpression",show:e=>h.getValue(e,"style.icon.useIcon")},iconPosition:{ref:"style.icon.position",component:"dropdown",translation:"Common.Position",options:[{translation:"properties.dock.left",value:"left"},{translation:"properties.dock.right",value:"right"}],show:e=>h.getValue(e,"style.icon.useIcon")}}}}}}}}},importProperties:y,exportProperties:null,support:{export:!1,exportData:!1,snapshot:!1,viewData:!1,quickMobile:!0}}}const C={aliceblue:{r:240,g:248,b:255},antiquewhite:{r:250,g:235,b:215},aqua:{r:0,g:255,b:255},aquamarine:{r:127,g:255,b:212},azure:{r:240,g:255,b:255},beige:{r:245,g:245,b:220},bisque:{r:255,g:228,b:196},black:{r:0,g:0,b:0},blanchedalmond:{r:255,g:235,b:205},blue:{r:0,g:0,b:255},blueviolet:{r:138,g:43,b:226},brown:{r:165,g:42,b:42},burlywood:{r:222,g:184,b:135},cadetblue:{r:95,g:158,b:160},chartreuse:{r:127,g:255,b:0},chocolate:{r:210,g:105,b:30},coral:{r:255,g:127,b:80},cornflowerblue:{r:100,g:149,b:237},cornsilk:{r:255,g:248,b:220},crimson:{r:220,g:20,b:60},cyan:{r:0,g:255,b:255},darkblue:{r:0,g:0,b:139},darkcyan:{r:0,g:139,b:139},darkgoldenrod:{r:184,g:134,b:11},darkgray:{r:169,g:169,b:169},darkgreen:{r:0,g:100,b:0},darkgrey:{r:169,g:169,b:169},darkkhaki:{r:189,g:183,b:107},darkmagenta:{r:139,g:0,b:139},darkolivegreen:{r:85,g:107,b:47},darkorange:{r:255,g:140,b:0},darkorchid:{r:153,g:50,b:204},darkred:{r:139,g:0,b:0},darksalmon:{r:233,g:150,b:122},darkseagreen:{r:143,g:188,b:143},darkslateblue:{r:72,g:61,b:139},darkslategray:{r:47,g:79,b:79},darkslategrey:{r:47,g:79,b:79},darkturquoise:{r:0,g:206,b:209},darkviolet:{r:148,g:0,b:211},deeppink:{r:255,g:20,b:147},deepskyblue:{r:0,g:191,b:255},dimgray:{r:105,g:105,b:105},dimgrey:{r:105,g:105,b:105},dodgerblue:{r:30,g:144,b:255},firebrick:{r:178,g:34,b:34},floralwhite:{r:255,g:250,b:240},forestgreen:{r:34,g:139,b:34},fuchsia:{r:255,g:0,b:255},gainsboro:{r:220,g:220,b:220},ghostwhite:{r:248,g:248,b:255},gold:{r:255,g:215,b:0},goldenrod:{r:218,g:165,b:32},gray:{r:128,g:128,b:128},green:{r:0,g:128,b:0},greenyellow:{r:173,g:255,b:47},grey:{r:128,g:128,b:128},honeydew:{r:240,g:255,b:240},hotpink:{r:255,g:105,b:180},indianred:{r:205,g:92,b:92},indigo:{r:75,g:0,b:130},ivory:{r:255,g:255,b:240},khaki:{r:240,g:230,b:140},lavender:{r:230,g:230,b:250},lavenderblush:{r:255,g:240,b:245},lawngreen:{r:124,g:252,b:0},lemonchiffon:{r:255,g:250,b:205},lightblue:{r:173,g:216,b:230},lightcoral:{r:240,g:128,b:128},lightcyan:{r:224,g:255,b:255},lightgoldenrodyellow:{r:250,g:250,b:210},lightgray:{r:211,g:211,b:211},lightgreen:{r:144,g:238,b:144},lightgrey:{r:211,g:211,b:211},lightpink:{r:255,g:182,b:193},lightsalmon:{r:255,g:160,b:122},lightseagreen:{r:32,g:178,b:170},lightskyblue:{r:135,g:206,b:250},lightslategray:{r:119,g:136,b:153},lightslategrey:{r:119,g:136,b:153},lightsteelblue:{r:176,g:196,b:222},lightyellow:{r:255,g:255,b:224},lime:{r:0,g:255,b:0},limegreen:{r:50,g:205,b:50},linen:{r:250,g:240,b:230},magenta:{r:255,g:0,b:255},maroon:{r:128,g:0,b:0},mediumaquamarine:{r:102,g:205,b:170},mediumblue:{r:0,g:0,b:205},mediumorchid:{r:186,g:85,b:211},mediumpurple:{r:147,g:112,b:219},mediumseagreen:{r:60,g:179,b:113},mediumslateblue:{r:123,g:104,b:238},mediumspringgreen:{r:0,g:250,b:154},mediumturquoise:{r:72,g:209,b:204},mediumvioletred:{r:199,g:21,b:133},midnightblue:{r:25,g:25,b:112},mintcream:{r:245,g:255,b:250},mistyrose:{r:255,g:228,b:225},moccasin:{r:255,g:228,b:181},navajowhite:{r:255,g:222,b:173},navy:{r:0,g:0,b:128},oldlace:{r:253,g:245,b:230},olive:{r:128,g:128,b:0},olivedrab:{r:107,g:142,b:35},orange:{r:255,g:165,b:0},orangered:{r:255,g:69,b:0},orchid:{r:218,g:112,b:214},palegoldenrod:{r:238,g:232,b:170},palegreen:{r:152,g:251,b:152},paleturquoise:{r:175,g:238,b:238},palevioletred:{r:219,g:112,b:147},papayawhip:{r:255,g:239,b:213},peachpuff:{r:255,g:218,b:185},peru:{r:205,g:133,b:63},pink:{r:255,g:192,b:203},plum:{r:221,g:160,b:221},powderblue:{r:176,g:224,b:230},purple:{r:128,g:0,b:128},rebeccapurple:{r:102,g:51,b:153},red:{r:255,g:0,b:0},rosybrown:{r:188,g:143,b:143},royalblue:{r:65,g:105,b:225},saddlebrown:{r:139,g:69,b:19},salmon:{r:250,g:128,b:114},sandybrown:{r:244,g:164,b:96},seagreen:{r:46,g:139,b:87},seashell:{r:255,g:245,b:238},sienna:{r:160,g:82,b:45},silver:{r:192,g:192,b:192},skyblue:{r:135,g:206,b:235},slateblue:{r:106,g:90,b:205},slategray:{r:112,g:128,b:144},slategrey:{r:112,g:128,b:144},snow:{r:255,g:250,b:250},springgreen:{r:0,g:255,b:127},steelblue:{r:70,g:130,b:180},tan:{r:210,g:180,b:140},teal:{r:0,g:128,b:128},thistle:{r:216,g:191,b:216},tomato:{r:255,g:99,b:71},transparent:{r:255,g:255,b:255,a:0},turquoise:{r:64,g:224,b:208},violet:{r:238,g:130,b:238},wheat:{r:245,g:222,b:179},white:{r:255,g:255,b:255},whitesmoke:{r:245,g:245,b:245},yellow:{r:255,g:255,b:0},yellowgreen:{r:154,g:205,b:50}},I={resolveExpression:e=>{let t=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(e);if(t)return`rgb(${t[1]},${t[2]},${t[3]})`;if(t=/^argb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(e),t){const e=Math.round(t[1]/255*100)/100;return`rgba(${t[2]},${t[3]},${t[4]},${e})`}if(t=/^#([A-f0-9]{2})([A-f0-9]{2})([A-f0-9]{2})$/i.exec(e),t)return e;const o=e&&C[e.toLowerCase()];if(o){const e=void 0!==o.a?o.a:1;return`rgba(${o.r},${o.g},${o.b},${e})`}return"none"},getFadedColor(e){const t=.15;let o,a,n,l;if(e.length>7){o=e.split(",");const i=-1!==o[0].indexOf("a");return a=i?parseInt(o[0].slice(5),10):parseInt(o[0].slice(4),10),l=parseInt(o[1],10),n=parseInt(o[2],10),`${(i?"rgba(":"rgb(")+(Math.round((0-a)*t)+a)},${Math.round((0-l)*t)+l},${Math.round((0-n)*t)+n}${i?`,${o[3]}`:")"}`}return o=parseInt(e.slice(1),16),a=o>>16,l=o>>8&255,n=255&o,`#${(16777216+65536*(Math.round((0-a)*t)+a)+256*(Math.round((0-l)*t)+l)+(Math.round((0-n)*t)+n)).toString(16).slice(1)}`}};var x=e=>{e.replace(/^\.\.\//i,"/"),e=(e=e.replace(/"/g,'\\"')).replace(/'/g,"\\'");const t=document.createElement("a");t.href="../";return e=t.href+("/"===e[0]?e.substr(1):e)};const q={auto:"auto auto",alwaysFit:"contain",fitWidth:"100% auto",fitHeight:"auto 100%",fill:"100% 100%",alwaysFill:"cover"},O={topLeft:"0% 0%",centerLeft:"50% 0%",bottomLeft:"100% 0%",topCenter:"0% 50%",centerCenter:"50% 50%",bottomCenter:"100% 50%",topRight:"0% 100%",centerRight:"50% 100%",bottomRight:"100% 100%"},B=(e,t)=>`${e}: ${t};`,T=({useColorExpression:e=!1,colorExpression:t="",color:o=s.COLOR},a,n)=>{let l;return e?l=I.resolveExpression(t):"string"==typeof o?l=o:o&&(l=n.getColorPickerColor(o)),l&&"none"!==l?l:a};var E={getStyles({style:e={},disabled:t,theme:o,element:a}){let n="width: 100%;height: 100%;transition: transform .1s ease-in-out;position: absolute;";const{font:l={},background:i={},border:r={}}=e,c=o.getDataColorSpecials().primary;n+=t?B("opacity",.4):B("cursor","pointer"),n+=B("color",T(l,"#ffffff",o));const u=l.style||s.FONT_STYLE;u.bold&&(n+=B("font-weight","bold")),u.italic&&(n+=B("font-style","italic"));const p=T(i,c,o);if(n+=B("background-color",p),i.useImage&&i.url.qStaticContentUrl){let e=i.url.qStaticContentUrl.qUrl;e&&(e=x(e),n+=B("background-image",`url('${e}')`),n+=B("background-size",q[i.size||s.BACKGROUND_SIZE]),n+=B("background-position",O[i.position||s.BACKGROUND_POSITION]),n+=B("background-repeat","no-repeat"))}if(r.useBorder){const e=Math.min(a.offsetWidth,a.offsetHeight),t=T(r,I.getFadedColor(p),o),l=(r.width||s.BORDER_WIDTH)*e/2;n+=B("border",`${l}px solid ${t}`),n+=B("border-radius",(r.radius||s.BORDER_RADIUS)*e/2+"px")}else n+="border: none;";return n},createLabelAndIcon({button:e,theme:t,style:o={},isSense:a}){const{icon:n={},font:l={},label:i=s.LABEL}=o,r=document.createElement("text");r.style.whiteSpace="nowrap",r.style.fontFamily=t.getStyle("","","fontFamily");const c=document.createElement("span");c.textContent=i,c.style.whiteSpace="nowrap",c.style.textOverflow="ellipsis",c.style.overflow="visible",l.style&&l.style.underline&&(c.style.textDecoration="underline"),r.appendChild(c);const u=a&&n.useIcon&&""!==n.iconType;if(u){const e=document.createElement("span"),t=w.find((e=>e.label===n.iconType||e.value===n.iconType));e.style.textDecoration="none",e.style.fontSize="inherit",e.setAttribute("class",`lui-icon lui-icon--${t?t.value:""}`),"right"===n.position?r.appendChild(e):r.insertBefore(e,c)}e.innerHTML="",e.appendChild(r),r.style.fontSize=`${e.clientHeight}px`;let p=e.clientHeight/r.offsetHeight*e.clientHeight;r.style.fontSize=`${p}px`,r.offsetWidth>e.clientWidth&&(p*=e.clientWidth/r.offsetWidth);const b=l.size||s.FONT_SIZE;l.style&&l.style.italic?u?(r.style.fontSize=`${Math.max(p*b*.84,8)}px`,r.children[0].style.marginRight=.04*r.offsetWidth+"px",r.children[1].style.marginRight=.04*r.offsetWidth+"px"):(r.style.fontSize=`${Math.max(p*b*.9,8)}px`,r.children[0].style.marginRight=.02*r.offsetWidth+"px"):u?(r.style.fontSize=`${Math.max(p*b*.88,8)}px`,r.children[0].style.marginRight=.04*r.offsetWidth+"px"):r.style.fontSize=`${Math.max(p*b*.92,8)}px`,"8px"===r.style.fontSize&&r.children.forEach((e=>{e.style.overflow="hidden"})),r.style.margin="0 3%",r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="left"===l.align?"flex-start":"right"===l.align?"flex-end":"center"}};function L(s){const{sense:b,translator:d,flags:{isEnabled:g}}=s,v=b&&b.navigation,h=g("ACTION_BUTTON_AUTOMATIONS");return c.style.label=b?d.get("Object.ActionButton"):"Button",{qae:{properties:c,data:u},component(){const s=e(),c=t();o((()=>{const e=document.createElement("button");e.appendChild(document.createElement("text")),s.appendChild(e)}),[]);const u=a(),b=n(),d=l(),g=(({layout:e,theme:t,app:o,constraints:a,senseNavigation:n,element:l})=>{const i=!!n,r=l.firstElementChild,{style:s,qStateName:c}=e,u=e.useEnabledCondition&&0===e.enabledCondition,b=!u&&!a.active,d=E.getStyles({style:s,disabled:u,theme:t,element:l});r.setAttribute("style",d),r.setAttribute("tabindex","-1"),E.createLabelAndIcon({button:r,theme:t,style:s,isSense:i}),r.onclick=async()=>{if(b){const t=[],{actions:a}=e;if(a.forEach((e=>{const a=p.find((t=>t.value===e.actionType));a&&t.push(a.getActionCall({app:o,qStateName:c,...e}))})),r.setAttribute("disabled",!0),await(async e=>{for(let t=0;t<e.length;t++)await e[t]()})(t),n&&!n.getCurrentStoryId()){const{navigation:t}=e,a=t&&m.find((e=>e.value===t.action));n&&a&&"function"==typeof a.navigationCall&&await a.navigationCall({app:o,senseNavigation:n,...t})}r.removeAttribute("disabled")}};const g=()=>{if(b){const{offsetWidth:e,offsetHeight:t}=r;r.style.transform=t>e?`scale(0.98, ${1-e/t*.02})`:`scale(${1-t/e*.02}, 0.98)`}},v=()=>{const{transform:e}=r.style;b&&""!==e&&"scale(1)"!==e&&(r.style.transform="scale(1)")};return r.onmousedown=e=>{0===e.button&&g()},r.onmouseup=v,r.onmouseleave=v,r.ontouchstart=g,r.ontouchend=v,r.ontouchcancel=v,()=>{r.onclick=void 0,r.onmousedown=void 0,r.onmouseup=void 0,r.onmouseleave=void 0,r.ontouchstart=void 0,r.ontouchend=void 0,r.ontouchcancel=void 0}})({element:s,layout:u,constraints:d,theme:c,app:b,senseNavigation:v,automationsEnabled:h});i((()=>()=>{g()}),[s]),r((()=>({focus(){s.firstElementChild.onclick()}})),[s])},ext:A({translator:d,automationsEnabled:h})}}export{L as default};