@nebula.js/sn-action-button 1.14.1 → 1.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4292 +1,7 @@
1
1
  /*
2
- * @nebula.js/sn-action-button v1.14.1
3
- * Copyright (c) 2021 QlikTech International AB
2
+ * @nebula.js/sn-action-button v1.15.3
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, inputBlock, 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 item;
1068
-
1069
- for (var i = 0; i < blocks.blocks.length; i++) {
1070
- if (blocks.blocks[i].displayName === 'Inputs') {
1071
- item = blocks.blocks[i];
1072
- break;
1073
- }
1074
- }
1075
-
1076
- return item.form[0].label.toLowerCase();
1077
- });
1078
-
1079
- case 13:
1080
- inputBlock = _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(inputBlock, "=").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: 'dropdown',
2501
- translation: 'Object.ActionButton.Automation',
2502
- ref: 'automation',
2503
- options: function () {
2504
- var _options4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
2505
- var automations;
2506
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
2507
- while (1) {
2508
- switch (_context4.prev = _context4.next) {
2509
- case 0:
2510
- _context4.next = 2;
2511
- return fetch('../api/v1/items?resourceType=automation').then(function (response) {
2512
- return response.json();
2513
- });
2514
-
2515
- case 2:
2516
- automations = _context4.sent;
2517
- return _context4.abrupt("return", automations.data.map(function (blend) {
2518
- return {
2519
- value: blend.id,
2520
- label: blend.name
2521
- };
2522
- }));
2523
-
2524
- case 4:
2525
- case "end":
2526
- return _context4.stop();
2527
- }
2528
- }
2529
- }, _callee4);
2530
- }));
2531
-
2532
- function options() {
2533
- return _options4.apply(this, arguments);
2534
- }
2535
-
2536
- return options;
2537
- }(),
2538
- show: function show(data) {
2539
- return checkShowAction(data, 'automation');
2540
- }
2541
- },
2542
- // Boolean property to instruct the automation action to create a
2543
- // bookmark and send it to the selected automation in the
2544
- // property panel.
2545
- automationPostData: {
2546
- type: 'boolean',
2547
- ref: 'automationPostData',
2548
- translation: 'Object.ActionButton.Automation.SendSelections',
2549
- show: function show(data) {
2550
- return checkShowAction(data, 'automation');
2551
- },
2552
- defaultValue: false
2553
- }
2554
- }
2555
- },
2556
- navigation: {
2557
- translation: 'Object.ActionButton.Navigation',
2558
- type: 'items',
2559
- items: {
2560
- action: {
2561
- ref: 'navigation.action',
2562
- translation: 'Object.ActionButton.Navigation',
2563
- component: 'expression-with-dropdown',
2564
- defaultValue: null,
2565
- options: navigationActions,
2566
- dropdownOnly: true
2567
- },
2568
- sheetId: {
2569
- type: 'string',
2570
- ref: 'navigation.sheet',
2571
- translation: 'properties.sheet',
2572
- expression: 'optional',
2573
- show: function show(data) {
2574
- return checkShowNavigation(data, 'sheetId');
2575
- }
2576
- },
2577
- sheet: {
2578
- type: 'string',
2579
- ref: 'navigation.sheet',
2580
- translation: 'properties.sheet',
2581
- component: 'expression-with-dropdown',
2582
- expressionType: 'StringExpression',
2583
- show: function show(data) {
2584
- return checkShowNavigation(data, 'sheet');
2585
- },
2586
- options: function () {
2587
- var _options5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(action, hyperCubeHandler) {
2588
- var sheets;
2589
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
2590
- while (1) {
2591
- switch (_context5.prev = _context5.next) {
2592
- case 0:
2593
- _context5.next = 2;
2594
- return hyperCubeHandler.app.getSheetList();
2595
-
2596
- case 2:
2597
- sheets = _context5.sent;
2598
- return _context5.abrupt("return", sheets.map(function (sheet) {
2599
- return {
2600
- value: sheet.qInfo.qId,
2601
- label: sheet.qMeta.title,
2602
- showCondition: sheet.qData.showCondition
2603
- };
2604
- }));
2605
-
2606
- case 4:
2607
- case "end":
2608
- return _context5.stop();
2609
- }
2610
- }
2611
- }, _callee5);
2612
- }));
2613
-
2614
- function options(_x7, _x8) {
2615
- return _options5.apply(this, arguments);
2616
- }
2617
-
2618
- return options;
2619
- }()
2620
- },
2621
- story: {
2622
- type: 'string',
2623
- ref: 'navigation.story',
2624
- translation: 'properties.story',
2625
- component: 'expression-with-dropdown',
2626
- expressionType: 'StringExpression',
2627
- show: function show(data) {
2628
- return checkShowNavigation(data, 'story');
2629
- },
2630
- options: function () {
2631
- var _options6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(action, hyperCubeHandler) {
2632
- var stories;
2633
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
2634
- while (1) {
2635
- switch (_context6.prev = _context6.next) {
2636
- case 0:
2637
- _context6.next = 2;
2638
- return hyperCubeHandler.app.getStoryList();
2639
-
2640
- case 2:
2641
- stories = _context6.sent;
2642
- return _context6.abrupt("return", stories.map(function (story) {
2643
- return {
2644
- value: story.qInfo.qId,
2645
- label: story.qMeta.title
2646
- };
2647
- }));
2648
-
2649
- case 4:
2650
- case "end":
2651
- return _context6.stop();
2652
- }
2653
- }
2654
- }, _callee6);
2655
- }));
2656
-
2657
- function options(_x9, _x10) {
2658
- return _options6.apply(this, arguments);
2659
- }
2660
-
2661
- return options;
2662
- }()
2663
- },
2664
- websiteUrl: {
2665
- type: 'string',
2666
- expression: 'optional',
2667
- ref: 'navigation.websiteUrl',
2668
- translation: 'properties.website',
2669
- show: function show(data) {
2670
- return checkShowNavigation(data, 'websiteUrl');
2671
- }
2672
- },
2673
- sameWindow: {
2674
- type: 'boolean',
2675
- ref: 'navigation.sameWindow',
2676
- translation: 'properties.sameWindow',
2677
- show: function show(data) {
2678
- return checkShowNavigation(data, 'websiteUrl');
2679
- },
2680
- defaultValue: false
2681
- }
2682
- }
2683
- }
2684
- }
2685
- },
2686
- enableCondition: {
2687
- type: 'items',
2688
- translation: 'properties.enableConditionSection',
2689
- items: {
2690
- useCondition: {
2691
- type: 'boolean',
2692
- component: 'switch',
2693
- translation: 'properties.enableToggle',
2694
- ref: 'useEnabledCondition',
2695
- options: [{
2696
- value: true,
2697
- translation: 'properties.on'
2698
- }, {
2699
- value: false,
2700
- translation: 'properties.off'
2701
- }]
2702
- },
2703
- condition: {
2704
- ref: 'enabledCondition',
2705
- translation: 'properties.enableCondition',
2706
- type: 'integer',
2707
- expression: 'optional',
2708
- show: function show(data) {
2709
- return data.useEnabledCondition;
2710
- }
2711
- }
2712
- }
2713
- },
2714
- settings: {
2715
- component: 'expandable-items',
2716
- translation: 'Common.Appearance',
2717
- uses: 'settings',
2718
- items: {
2719
- general: {
2720
- type: 'items',
2721
- translation: 'properties.general',
2722
- items: {
2723
- showTitles: {},
2724
- details: {
2725
- show: false
2726
- },
2727
- label: {
2728
- component: 'string',
2729
- ref: 'style.label',
2730
- translation: 'Common.Label',
2731
- expression: 'optional'
2732
- }
2733
- }
2734
- },
2735
- font: {
2736
- grouped: true,
2737
- type: 'items',
2738
- translation: 'properties.font',
2739
- items: {
2740
- sizeAndColor: {
2741
- type: 'items',
2742
- items: {
2743
- fontSize: {
2744
- component: 'slider',
2745
- type: 'number',
2746
- ref: 'style.font.size',
2747
- translation: 'properties.fontSize',
2748
- min: 0.2,
2749
- max: 1,
2750
- step: 0.01
2751
- },
2752
- useFontColorExpression: {
2753
- ref: 'style.font.useColorExpression',
2754
- type: 'boolean',
2755
- translation: 'properties.fontColor',
2756
- component: 'dropdown',
2757
- options: colorOptions
2758
- },
2759
- colorPicker: {
2760
- component: 'color-picker',
2761
- type: 'object',
2762
- ref: 'style.font.color',
2763
- translation: 'properties.color',
2764
- dualOutput: true,
2765
- show: function show(data) {
2766
- return !propertyResolver.getValue(data, 'style.font.useColorExpression');
2767
- }
2768
- },
2769
- colorExpression: {
2770
- component: 'string',
2771
- type: 'string',
2772
- ref: 'style.font.colorExpression',
2773
- translation: 'Common.Expression',
2774
- expression: 'optional',
2775
- show: function show(data) {
2776
- return propertyResolver.getValue(data, 'style.font.useColorExpression');
2777
- }
2778
- }
2779
- }
2780
- },
2781
- stylingAndAlign: {
2782
- type: 'items',
2783
- items: {
2784
- fontStyling: {
2785
- component: 'item-selection-list',
2786
- type: 'string',
2787
- ref: 'style.font.style',
2788
- translation: 'properties.textStyle',
2789
- horizontal: true,
2790
- multipleSelect: true,
2791
- items: [{
2792
- component: 'icon-item',
2793
- icon: 'bold',
2794
- value: 'bold',
2795
- translation: 'Common.bold',
2796
- labelPlacement: 'bottom'
2797
- }, {
2798
- component: 'icon-item',
2799
- icon: 'italic',
2800
- value: 'italic',
2801
- translation: 'Common.italic',
2802
- labelPlacement: 'bottom'
2803
- }, {
2804
- component: 'icon-item',
2805
- icon: 'underline',
2806
- value: 'underline',
2807
- translation: 'Common.underline',
2808
- labelPlacement: 'bottom'
2809
- }]
2810
- },
2811
- textAlign: {
2812
- component: 'item-selection-list',
2813
- type: 'string',
2814
- ref: 'style.font.align',
2815
- translation: 'properties.Alignment',
2816
- horizontal: true,
2817
- items: [{
2818
- component: 'icon-item',
2819
- icon: 'align_left',
2820
- value: 'left',
2821
- translation: 'properties.dock.left',
2822
- labelPlacement: 'bottom'
2823
- }, {
2824
- component: 'icon-item',
2825
- icon: 'align_center',
2826
- value: 'center',
2827
- translation: 'Common.Center',
2828
- labelPlacement: 'bottom'
2829
- }, {
2830
- component: 'icon-item',
2831
- icon: 'align_right',
2832
- value: 'right',
2833
- translation: 'properties.dock.right',
2834
- labelPlacement: 'bottom'
2835
- }]
2836
- }
2837
- }
2838
- }
2839
- }
2840
- },
2841
- background: {
2842
- grouped: true,
2843
- type: 'items',
2844
- translation: 'properties.background',
2845
- items: {
2846
- backgroundColor: {
2847
- type: 'items',
2848
- items: {
2849
- useColorExpression: {
2850
- ref: 'style.background.useColorExpression',
2851
- type: 'boolean',
2852
- translation: 'AppDetails.SheetBackgroundColor',
2853
- component: 'dropdown',
2854
- options: colorOptions
2855
- },
2856
- colorPicker: {
2857
- component: 'color-picker',
2858
- type: 'object',
2859
- ref: 'style.background.color',
2860
- translation: 'properties.color',
2861
- dualOutput: true,
2862
- show: function show(data) {
2863
- return !propertyResolver.getValue(data, 'style.background.useColorExpression');
2864
- }
2865
- },
2866
- colorExpression: {
2867
- component: 'string',
2868
- type: 'string',
2869
- ref: 'style.background.colorExpression',
2870
- translation: 'Common.Expression',
2871
- expression: 'optional',
2872
- show: function show(data) {
2873
- return propertyResolver.getValue(data, 'style.background.useColorExpression');
2874
- }
2875
- }
2876
- }
2877
- },
2878
- backgroundImage: {
2879
- type: 'items',
2880
- items: {
2881
- useBackgroundImage: {
2882
- ref: 'style.background.useImage',
2883
- type: 'boolean',
2884
- translation: 'properties.backgroundImage.use',
2885
- component: 'switch',
2886
- options: toggleOptions
2887
- },
2888
- backgroundUrl: {
2889
- ref: 'style.background.url.qStaticContentUrlDef.qUrl',
2890
- layoutRef: 'style.background.url.qStaticContentUrl.qUrl',
2891
- schemaIgnore: true,
2892
- translation: 'Common.Image',
2893
- tooltip: {
2894
- select: 'properties.media.select',
2895
- remove: 'properties.media.removeBackground'
2896
- },
2897
- type: 'string',
2898
- component: 'media',
2899
- show: function show(data) {
2900
- return propertyResolver.getValue(data, 'style.background.useImage');
2901
- }
2902
- },
2903
- backgroundSize: {
2904
- ref: 'style.background.size',
2905
- translation: 'properties.backgroundImage.size',
2906
- type: 'string',
2907
- component: 'dropdown',
2908
- options: [{
2909
- value: 'auto',
2910
- translation: 'properties.backgroundImage.originalSize'
2911
- }, {
2912
- value: 'alwaysFit',
2913
- translation: 'properties.backgroundImage.sizeAlwaysFit'
2914
- }, {
2915
- value: 'fitWidth',
2916
- translation: 'properties.backgroundImage.sizeFitWidth'
2917
- }, {
2918
- value: 'fitHeight',
2919
- translation: 'properties.backgroundImage.sizeFitHeight'
2920
- }, {
2921
- value: 'fill',
2922
- translation: 'properties.backgroundImage.sizeStretch'
2923
- }, {
2924
- value: 'alwaysFill',
2925
- translation: 'properties.backgroundImage.sizeAlwaysFill'
2926
- }],
2927
- show: function show(data) {
2928
- return propertyResolver.getValue(data, 'style.background.useImage') && !!propertyResolver.getValue(data, 'style.background.url.qStaticContentUrlDef.qUrl');
2929
- }
2930
- },
2931
- backgroundPosition: {
2932
- ref: 'style.background.position',
2933
- translation: 'Common.Position',
2934
- type: 'string',
2935
- component: 'align-matrix',
2936
- show: function show(data) {
2937
- return propertyResolver.getValue(data, 'style.background.useImage') && propertyResolver.getValue(data, 'style.background.url.qStaticContentUrlDef.qUrl') && propertyResolver.getValue(data, 'style.background.size') !== 'fill';
2938
- },
2939
- currentSize: function currentSize(data) {
2940
- return propertyResolver.getValue(data, 'style.background.size');
2941
- }
2942
- }
2943
- }
2944
- }
2945
- }
2946
- },
2947
- border: {
2948
- type: 'items',
2949
- grouped: true,
2950
- translation: 'properties.border',
2951
- items: {
2952
- borderSettings: {
2953
- type: 'items',
2954
- items: {
2955
- useBorder: {
2956
- ref: 'style.border.useBorder',
2957
- type: 'boolean',
2958
- translation: 'properties.border.use',
2959
- component: 'switch',
2960
- options: toggleOptions
2961
- },
2962
- borderRadius: {
2963
- component: 'slider',
2964
- show: function show(data) {
2965
- return propertyResolver.getValue(data, 'style.border.useBorder');
2966
- },
2967
- translation: 'properties.border.radius',
2968
- type: 'number',
2969
- ref: 'style.border.radius',
2970
- min: 0,
2971
- max: 1,
2972
- step: 0.01
2973
- },
2974
- borderWidth: {
2975
- component: 'slider',
2976
- show: function show(data) {
2977
- return propertyResolver.getValue(data, 'style.border.useBorder');
2978
- },
2979
- type: 'number',
2980
- ref: 'style.border.width',
2981
- translation: 'properties.border.width',
2982
- min: 0,
2983
- max: 0.5,
2984
- step: 0.005
2985
- },
2986
- colorDropdown: {
2987
- type: 'string',
2988
- show: function show(data) {
2989
- return propertyResolver.getValue(data, 'style.border.useBorder');
2990
- },
2991
- component: 'dropdown',
2992
- translation: 'properties.border.color',
2993
- ref: 'style.border.useColorExpression',
2994
- options: colorOptions
2995
- },
2996
- colorPicker: {
2997
- component: 'color-picker',
2998
- type: 'object',
2999
- ref: 'style.border.color',
3000
- translation: 'properties.color',
3001
- dualOutput: true,
3002
- show: function show(data) {
3003
- return propertyResolver.getValue(data, 'style.border.useBorder') && !propertyResolver.getValue(data, 'style.border.useColorExpression');
3004
- }
3005
- },
3006
- colorExpression: {
3007
- component: 'string',
3008
- type: 'string',
3009
- ref: 'style.border.colorExpression',
3010
- translation: 'Common.Expression',
3011
- show: function show(data) {
3012
- return propertyResolver.getValue(data, 'style.border.useBorder') && propertyResolver.getValue(data, 'style.border.useColorExpression');
3013
- },
3014
- expression: 'optional'
3015
- }
3016
- }
3017
- }
3018
- }
3019
- },
3020
- icon: {
3021
- type: 'items',
3022
- grouped: true,
3023
- translation: 'properties.icon',
3024
- items: {
3025
- iconSettings: {
3026
- type: 'items',
3027
- items: {
3028
- useIcon: {
3029
- ref: 'style.icon.useIcon',
3030
- type: 'boolean',
3031
- translation: 'properties.icon.use',
3032
- component: 'switch',
3033
- options: toggleOptions
3034
- },
3035
- iconType: {
3036
- ref: 'style.icon.iconType',
3037
- component: 'expression-with-dropdown',
3038
- translation: 'properties.icon',
3039
- defaultValue: '',
3040
- options: luiIcons,
3041
- expressionType: 'StringExpression',
3042
- show: function show(data) {
3043
- return propertyResolver.getValue(data, 'style.icon.useIcon');
3044
- }
3045
- },
3046
- iconPosition: {
3047
- ref: 'style.icon.position',
3048
- component: 'dropdown',
3049
- translation: 'Common.Position',
3050
- options: [{
3051
- translation: 'properties.dock.left',
3052
- value: 'left'
3053
- }, {
3054
- translation: 'properties.dock.right',
3055
- value: 'right'
3056
- }],
3057
- show: function show(data) {
3058
- return propertyResolver.getValue(data, 'style.icon.useIcon');
3059
- }
3060
- }
3061
- }
3062
- }
3063
- }
3064
- }
3065
- }
3066
- }
3067
- }
3068
- },
3069
- importProperties: importProperties,
3070
- exportProperties: null,
3071
- support: {
3072
- export: !1,
3073
- exportData: !1,
3074
- snapshot: !1,
3075
- viewData: !1,
3076
- quickMobile: !0
3077
- }
3078
- };
3079
- }
3080
-
3081
- var colorStruct = {
3082
- aliceblue: {
3083
- r: 240,
3084
- g: 248,
3085
- b: 255
3086
- },
3087
- antiquewhite: {
3088
- r: 250,
3089
- g: 235,
3090
- b: 215
3091
- },
3092
- aqua: {
3093
- r: 0,
3094
- g: 255,
3095
- b: 255
3096
- },
3097
- aquamarine: {
3098
- r: 127,
3099
- g: 255,
3100
- b: 212
3101
- },
3102
- azure: {
3103
- r: 240,
3104
- g: 255,
3105
- b: 255
3106
- },
3107
- beige: {
3108
- r: 245,
3109
- g: 245,
3110
- b: 220
3111
- },
3112
- bisque: {
3113
- r: 255,
3114
- g: 228,
3115
- b: 196
3116
- },
3117
- black: {
3118
- r: 0,
3119
- g: 0,
3120
- b: 0
3121
- },
3122
- blanchedalmond: {
3123
- r: 255,
3124
- g: 235,
3125
- b: 205
3126
- },
3127
- blue: {
3128
- r: 0,
3129
- g: 0,
3130
- b: 255
3131
- },
3132
- blueviolet: {
3133
- r: 138,
3134
- g: 43,
3135
- b: 226
3136
- },
3137
- brown: {
3138
- r: 165,
3139
- g: 42,
3140
- b: 42
3141
- },
3142
- burlywood: {
3143
- r: 222,
3144
- g: 184,
3145
- b: 135
3146
- },
3147
- cadetblue: {
3148
- r: 95,
3149
- g: 158,
3150
- b: 160
3151
- },
3152
- chartreuse: {
3153
- r: 127,
3154
- g: 255,
3155
- b: 0
3156
- },
3157
- chocolate: {
3158
- r: 210,
3159
- g: 105,
3160
- b: 30
3161
- },
3162
- coral: {
3163
- r: 255,
3164
- g: 127,
3165
- b: 80
3166
- },
3167
- cornflowerblue: {
3168
- r: 100,
3169
- g: 149,
3170
- b: 237
3171
- },
3172
- cornsilk: {
3173
- r: 255,
3174
- g: 248,
3175
- b: 220
3176
- },
3177
- crimson: {
3178
- r: 220,
3179
- g: 20,
3180
- b: 60
3181
- },
3182
- cyan: {
3183
- r: 0,
3184
- g: 255,
3185
- b: 255
3186
- },
3187
- darkblue: {
3188
- r: 0,
3189
- g: 0,
3190
- b: 139
3191
- },
3192
- darkcyan: {
3193
- r: 0,
3194
- g: 139,
3195
- b: 139
3196
- },
3197
- darkgoldenrod: {
3198
- r: 184,
3199
- g: 134,
3200
- b: 11
3201
- },
3202
- darkgray: {
3203
- r: 169,
3204
- g: 169,
3205
- b: 169
3206
- },
3207
- darkgreen: {
3208
- r: 0,
3209
- g: 100,
3210
- b: 0
3211
- },
3212
- darkgrey: {
3213
- r: 169,
3214
- g: 169,
3215
- b: 169
3216
- },
3217
- darkkhaki: {
3218
- r: 189,
3219
- g: 183,
3220
- b: 107
3221
- },
3222
- darkmagenta: {
3223
- r: 139,
3224
- g: 0,
3225
- b: 139
3226
- },
3227
- darkolivegreen: {
3228
- r: 85,
3229
- g: 107,
3230
- b: 47
3231
- },
3232
- darkorange: {
3233
- r: 255,
3234
- g: 140,
3235
- b: 0
3236
- },
3237
- darkorchid: {
3238
- r: 153,
3239
- g: 50,
3240
- b: 204
3241
- },
3242
- darkred: {
3243
- r: 139,
3244
- g: 0,
3245
- b: 0
3246
- },
3247
- darksalmon: {
3248
- r: 233,
3249
- g: 150,
3250
- b: 122
3251
- },
3252
- darkseagreen: {
3253
- r: 143,
3254
- g: 188,
3255
- b: 143
3256
- },
3257
- darkslateblue: {
3258
- r: 72,
3259
- g: 61,
3260
- b: 139
3261
- },
3262
- darkslategray: {
3263
- r: 47,
3264
- g: 79,
3265
- b: 79
3266
- },
3267
- darkslategrey: {
3268
- r: 47,
3269
- g: 79,
3270
- b: 79
3271
- },
3272
- darkturquoise: {
3273
- r: 0,
3274
- g: 206,
3275
- b: 209
3276
- },
3277
- darkviolet: {
3278
- r: 148,
3279
- g: 0,
3280
- b: 211
3281
- },
3282
- deeppink: {
3283
- r: 255,
3284
- g: 20,
3285
- b: 147
3286
- },
3287
- deepskyblue: {
3288
- r: 0,
3289
- g: 191,
3290
- b: 255
3291
- },
3292
- dimgray: {
3293
- r: 105,
3294
- g: 105,
3295
- b: 105
3296
- },
3297
- dimgrey: {
3298
- r: 105,
3299
- g: 105,
3300
- b: 105
3301
- },
3302
- dodgerblue: {
3303
- r: 30,
3304
- g: 144,
3305
- b: 255
3306
- },
3307
- firebrick: {
3308
- r: 178,
3309
- g: 34,
3310
- b: 34
3311
- },
3312
- floralwhite: {
3313
- r: 255,
3314
- g: 250,
3315
- b: 240
3316
- },
3317
- forestgreen: {
3318
- r: 34,
3319
- g: 139,
3320
- b: 34
3321
- },
3322
- fuchsia: {
3323
- r: 255,
3324
- g: 0,
3325
- b: 255
3326
- },
3327
- gainsboro: {
3328
- r: 220,
3329
- g: 220,
3330
- b: 220
3331
- },
3332
- ghostwhite: {
3333
- r: 248,
3334
- g: 248,
3335
- b: 255
3336
- },
3337
- gold: {
3338
- r: 255,
3339
- g: 215,
3340
- b: 0
3341
- },
3342
- goldenrod: {
3343
- r: 218,
3344
- g: 165,
3345
- b: 32
3346
- },
3347
- gray: {
3348
- r: 128,
3349
- g: 128,
3350
- b: 128
3351
- },
3352
- green: {
3353
- r: 0,
3354
- g: 128,
3355
- b: 0
3356
- },
3357
- greenyellow: {
3358
- r: 173,
3359
- g: 255,
3360
- b: 47
3361
- },
3362
- grey: {
3363
- r: 128,
3364
- g: 128,
3365
- b: 128
3366
- },
3367
- honeydew: {
3368
- r: 240,
3369
- g: 255,
3370
- b: 240
3371
- },
3372
- hotpink: {
3373
- r: 255,
3374
- g: 105,
3375
- b: 180
3376
- },
3377
- indianred: {
3378
- r: 205,
3379
- g: 92,
3380
- b: 92
3381
- },
3382
- indigo: {
3383
- r: 75,
3384
- g: 0,
3385
- b: 130
3386
- },
3387
- ivory: {
3388
- r: 255,
3389
- g: 255,
3390
- b: 240
3391
- },
3392
- khaki: {
3393
- r: 240,
3394
- g: 230,
3395
- b: 140
3396
- },
3397
- lavender: {
3398
- r: 230,
3399
- g: 230,
3400
- b: 250
3401
- },
3402
- lavenderblush: {
3403
- r: 255,
3404
- g: 240,
3405
- b: 245
3406
- },
3407
- lawngreen: {
3408
- r: 124,
3409
- g: 252,
3410
- b: 0
3411
- },
3412
- lemonchiffon: {
3413
- r: 255,
3414
- g: 250,
3415
- b: 205
3416
- },
3417
- lightblue: {
3418
- r: 173,
3419
- g: 216,
3420
- b: 230
3421
- },
3422
- lightcoral: {
3423
- r: 240,
3424
- g: 128,
3425
- b: 128
3426
- },
3427
- lightcyan: {
3428
- r: 224,
3429
- g: 255,
3430
- b: 255
3431
- },
3432
- lightgoldenrodyellow: {
3433
- r: 250,
3434
- g: 250,
3435
- b: 210
3436
- },
3437
- lightgray: {
3438
- r: 211,
3439
- g: 211,
3440
- b: 211
3441
- },
3442
- lightgreen: {
3443
- r: 144,
3444
- g: 238,
3445
- b: 144
3446
- },
3447
- lightgrey: {
3448
- r: 211,
3449
- g: 211,
3450
- b: 211
3451
- },
3452
- lightpink: {
3453
- r: 255,
3454
- g: 182,
3455
- b: 193
3456
- },
3457
- lightsalmon: {
3458
- r: 255,
3459
- g: 160,
3460
- b: 122
3461
- },
3462
- lightseagreen: {
3463
- r: 32,
3464
- g: 178,
3465
- b: 170
3466
- },
3467
- lightskyblue: {
3468
- r: 135,
3469
- g: 206,
3470
- b: 250
3471
- },
3472
- lightslategray: {
3473
- r: 119,
3474
- g: 136,
3475
- b: 153
3476
- },
3477
- lightslategrey: {
3478
- r: 119,
3479
- g: 136,
3480
- b: 153
3481
- },
3482
- lightsteelblue: {
3483
- r: 176,
3484
- g: 196,
3485
- b: 222
3486
- },
3487
- lightyellow: {
3488
- r: 255,
3489
- g: 255,
3490
- b: 224
3491
- },
3492
- lime: {
3493
- r: 0,
3494
- g: 255,
3495
- b: 0
3496
- },
3497
- limegreen: {
3498
- r: 50,
3499
- g: 205,
3500
- b: 50
3501
- },
3502
- linen: {
3503
- r: 250,
3504
- g: 240,
3505
- b: 230
3506
- },
3507
- magenta: {
3508
- r: 255,
3509
- g: 0,
3510
- b: 255
3511
- },
3512
- maroon: {
3513
- r: 128,
3514
- g: 0,
3515
- b: 0
3516
- },
3517
- mediumaquamarine: {
3518
- r: 102,
3519
- g: 205,
3520
- b: 170
3521
- },
3522
- mediumblue: {
3523
- r: 0,
3524
- g: 0,
3525
- b: 205
3526
- },
3527
- mediumorchid: {
3528
- r: 186,
3529
- g: 85,
3530
- b: 211
3531
- },
3532
- mediumpurple: {
3533
- r: 147,
3534
- g: 112,
3535
- b: 219
3536
- },
3537
- mediumseagreen: {
3538
- r: 60,
3539
- g: 179,
3540
- b: 113
3541
- },
3542
- mediumslateblue: {
3543
- r: 123,
3544
- g: 104,
3545
- b: 238
3546
- },
3547
- mediumspringgreen: {
3548
- r: 0,
3549
- g: 250,
3550
- b: 154
3551
- },
3552
- mediumturquoise: {
3553
- r: 72,
3554
- g: 209,
3555
- b: 204
3556
- },
3557
- mediumvioletred: {
3558
- r: 199,
3559
- g: 21,
3560
- b: 133
3561
- },
3562
- midnightblue: {
3563
- r: 25,
3564
- g: 25,
3565
- b: 112
3566
- },
3567
- mintcream: {
3568
- r: 245,
3569
- g: 255,
3570
- b: 250
3571
- },
3572
- mistyrose: {
3573
- r: 255,
3574
- g: 228,
3575
- b: 225
3576
- },
3577
- moccasin: {
3578
- r: 255,
3579
- g: 228,
3580
- b: 181
3581
- },
3582
- navajowhite: {
3583
- r: 255,
3584
- g: 222,
3585
- b: 173
3586
- },
3587
- navy: {
3588
- r: 0,
3589
- g: 0,
3590
- b: 128
3591
- },
3592
- oldlace: {
3593
- r: 253,
3594
- g: 245,
3595
- b: 230
3596
- },
3597
- olive: {
3598
- r: 128,
3599
- g: 128,
3600
- b: 0
3601
- },
3602
- olivedrab: {
3603
- r: 107,
3604
- g: 142,
3605
- b: 35
3606
- },
3607
- orange: {
3608
- r: 255,
3609
- g: 165,
3610
- b: 0
3611
- },
3612
- orangered: {
3613
- r: 255,
3614
- g: 69,
3615
- b: 0
3616
- },
3617
- orchid: {
3618
- r: 218,
3619
- g: 112,
3620
- b: 214
3621
- },
3622
- palegoldenrod: {
3623
- r: 238,
3624
- g: 232,
3625
- b: 170
3626
- },
3627
- palegreen: {
3628
- r: 152,
3629
- g: 251,
3630
- b: 152
3631
- },
3632
- paleturquoise: {
3633
- r: 175,
3634
- g: 238,
3635
- b: 238
3636
- },
3637
- palevioletred: {
3638
- r: 219,
3639
- g: 112,
3640
- b: 147
3641
- },
3642
- papayawhip: {
3643
- r: 255,
3644
- g: 239,
3645
- b: 213
3646
- },
3647
- peachpuff: {
3648
- r: 255,
3649
- g: 218,
3650
- b: 185
3651
- },
3652
- peru: {
3653
- r: 205,
3654
- g: 133,
3655
- b: 63
3656
- },
3657
- pink: {
3658
- r: 255,
3659
- g: 192,
3660
- b: 203
3661
- },
3662
- plum: {
3663
- r: 221,
3664
- g: 160,
3665
- b: 221
3666
- },
3667
- powderblue: {
3668
- r: 176,
3669
- g: 224,
3670
- b: 230
3671
- },
3672
- purple: {
3673
- r: 128,
3674
- g: 0,
3675
- b: 128
3676
- },
3677
- rebeccapurple: {
3678
- r: 102,
3679
- g: 51,
3680
- b: 153
3681
- },
3682
- red: {
3683
- r: 255,
3684
- g: 0,
3685
- b: 0
3686
- },
3687
- rosybrown: {
3688
- r: 188,
3689
- g: 143,
3690
- b: 143
3691
- },
3692
- royalblue: {
3693
- r: 65,
3694
- g: 105,
3695
- b: 225
3696
- },
3697
- saddlebrown: {
3698
- r: 139,
3699
- g: 69,
3700
- b: 19
3701
- },
3702
- salmon: {
3703
- r: 250,
3704
- g: 128,
3705
- b: 114
3706
- },
3707
- sandybrown: {
3708
- r: 244,
3709
- g: 164,
3710
- b: 96
3711
- },
3712
- seagreen: {
3713
- r: 46,
3714
- g: 139,
3715
- b: 87
3716
- },
3717
- seashell: {
3718
- r: 255,
3719
- g: 245,
3720
- b: 238
3721
- },
3722
- sienna: {
3723
- r: 160,
3724
- g: 82,
3725
- b: 45
3726
- },
3727
- silver: {
3728
- r: 192,
3729
- g: 192,
3730
- b: 192
3731
- },
3732
- skyblue: {
3733
- r: 135,
3734
- g: 206,
3735
- b: 235
3736
- },
3737
- slateblue: {
3738
- r: 106,
3739
- g: 90,
3740
- b: 205
3741
- },
3742
- slategray: {
3743
- r: 112,
3744
- g: 128,
3745
- b: 144
3746
- },
3747
- slategrey: {
3748
- r: 112,
3749
- g: 128,
3750
- b: 144
3751
- },
3752
- snow: {
3753
- r: 255,
3754
- g: 250,
3755
- b: 250
3756
- },
3757
- springgreen: {
3758
- r: 0,
3759
- g: 255,
3760
- b: 127
3761
- },
3762
- steelblue: {
3763
- r: 70,
3764
- g: 130,
3765
- b: 180
3766
- },
3767
- tan: {
3768
- r: 210,
3769
- g: 180,
3770
- b: 140
3771
- },
3772
- teal: {
3773
- r: 0,
3774
- g: 128,
3775
- b: 128
3776
- },
3777
- thistle: {
3778
- r: 216,
3779
- g: 191,
3780
- b: 216
3781
- },
3782
- tomato: {
3783
- r: 255,
3784
- g: 99,
3785
- b: 71
3786
- },
3787
- transparent: {
3788
- r: 255,
3789
- g: 255,
3790
- b: 255,
3791
- a: 0
3792
- },
3793
- turquoise: {
3794
- r: 64,
3795
- g: 224,
3796
- b: 208
3797
- },
3798
- violet: {
3799
- r: 238,
3800
- g: 130,
3801
- b: 238
3802
- },
3803
- wheat: {
3804
- r: 245,
3805
- g: 222,
3806
- b: 179
3807
- },
3808
- white: {
3809
- r: 255,
3810
- g: 255,
3811
- b: 255
3812
- },
3813
- whitesmoke: {
3814
- r: 245,
3815
- g: 245,
3816
- b: 245
3817
- },
3818
- yellow: {
3819
- r: 255,
3820
- g: 255,
3821
- b: 0
3822
- },
3823
- yellowgreen: {
3824
- r: 154,
3825
- g: 205,
3826
- b: 50
3827
- }
3828
- };
3829
-
3830
- /* eslint-disable no-cond-assign */
3831
- var colorUtils = {
3832
- resolveExpression: function resolveExpression(input) {
3833
- // rgb
3834
- var matches = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(input);
3835
-
3836
- if (matches) {
3837
- return "rgb(".concat(matches[1], ",").concat(matches[2], ",").concat(matches[3], ")");
3838
- } // argb
3839
-
3840
-
3841
- 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);
3842
-
3843
- if (matches) {
3844
- var a = Math.round(matches[1] / 255 * 100) / 100;
3845
- return "rgba(".concat(matches[2], ",").concat(matches[3], ",").concat(matches[4], ",").concat(a, ")");
3846
- } // hex
3847
-
3848
-
3849
- matches = /^#([A-f0-9]{2})([A-f0-9]{2})([A-f0-9]{2})$/i.exec(input);
3850
-
3851
- if (matches) {
3852
- return input;
3853
- } // css color
3854
-
3855
-
3856
- var color = input && colorStruct[input.toLowerCase()];
3857
-
3858
- if (color) {
3859
- var _a = color.a !== undefined ? color.a : 1;
3860
-
3861
- return "rgba(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ",").concat(_a, ")");
3862
- } // invalid
3863
-
3864
-
3865
- return 'none';
3866
- },
3867
- getFadedColor: function getFadedColor(color) {
3868
- var percent = 0.15;
3869
- var f;
3870
- var R;
3871
- var B;
3872
- var G;
3873
-
3874
- if (color.length > 7) {
3875
- f = color.split(',');
3876
- var rgba = f[0].indexOf('a') !== -1;
3877
- R = rgba ? parseInt(f[0].slice(5), 10) : parseInt(f[0].slice(4), 10);
3878
- G = parseInt(f[1], 10);
3879
- B = parseInt(f[2], 10);
3880
- 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]) : ')');
3881
- }
3882
-
3883
- f = parseInt(color.slice(1), 16);
3884
- R = f >> 16;
3885
- G = f >> 8 & 0x00FF;
3886
- B = f & 0x0000FF;
3887
- 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));
3888
- }
3889
- };
3890
-
3891
- var getImageUrl = function getImageUrl(imgUrl) {
3892
- imgUrl.replace(/^\.\.\//i, '/');
3893
- imgUrl = imgUrl.replace(/"/g, '\\"');
3894
- imgUrl = imgUrl.replace(/'/g, "\\'");
3895
- var a = document.createElement('a');
3896
- a.href = '../';
3897
- var rootPath = a.href;
3898
- imgUrl = rootPath + (imgUrl[0] === '/' ? imgUrl.substr(1) : imgUrl);
3899
- return imgUrl;
3900
- };
3901
-
3902
- var urlUtils = {
3903
- getImageUrl: getImageUrl
3904
- };
3905
-
3906
- var backgroundSize = {
3907
- auto: 'auto auto',
3908
- alwaysFit: 'contain',
3909
- fitWidth: '100% auto',
3910
- fitHeight: 'auto 100%',
3911
- fill: '100% 100%',
3912
- alwaysFill: 'cover'
3913
- };
3914
- var backgroundPosition = {
3915
- topLeft: '0% 0%',
3916
- // top left
3917
- centerLeft: '50% 0%',
3918
- // center left
3919
- bottomLeft: '100% 0%',
3920
- // bottom left
3921
- topCenter: '0% 50%',
3922
- // top center
3923
- centerCenter: '50% 50%',
3924
- // center center
3925
- bottomCenter: '100% 50%',
3926
- // bottom center
3927
- topRight: '0% 100%',
3928
- // top right
3929
- centerRight: '50% 100%',
3930
- // center right
3931
- bottomRight: '100% 100%' // bottom right
3932
-
3933
- };
3934
-
3935
- var formatProperty = function formatProperty(path, setting) {
3936
- return "".concat(path, ": ").concat(setting, ";");
3937
- };
3938
-
3939
- var getColor = function getColor(_ref, defaultColor, theme) {
3940
- var useColorExpression = _ref.useColorExpression,
3941
- colorExpression = _ref.colorExpression,
3942
- color = _ref.color;
3943
- var resolvedColor;
3944
-
3945
- if (useColorExpression) {
3946
- resolvedColor = colorUtils.resolveExpression(colorExpression);
3947
- } else if (typeof color === 'string') {
3948
- resolvedColor = color;
3949
- } else if (color) {
3950
- resolvedColor = theme.getColorPickerColor(color);
3951
- }
3952
-
3953
- return !resolvedColor || resolvedColor === 'none' ? defaultColor : resolvedColor;
3954
- };
3955
-
3956
- var styleFormatter = {
3957
- getStyles: function getStyles(_ref2) {
3958
- var style = _ref2.style,
3959
- disabled = _ref2.disabled,
3960
- theme = _ref2.theme,
3961
- element = _ref2.element;
3962
- var styles = 'width: 100%;height: 100%;transition: transform .1s ease-in-out;position: absolute;';
3963
- var font = style.font,
3964
- background = style.background,
3965
- border = style.border;
3966
- var primaryColor = theme.getDataColorSpecials().primary; // enable
3967
-
3968
- styles += disabled ? formatProperty('opacity', 0.4) : formatProperty('cursor', 'pointer'); // font
3969
-
3970
- styles += formatProperty('color', getColor(font, '#ffffff', theme));
3971
- font.style.bold && (styles += formatProperty('font-weight', 'bold'));
3972
- font.style.italic && (styles += formatProperty('font-style', 'italic')); // background
3973
-
3974
- var backgroundColor = getColor(background, primaryColor, theme);
3975
- styles += formatProperty('background-color', backgroundColor);
3976
-
3977
- if (background.useImage && background.url.qStaticContentUrl) {
3978
- var bgUrl = background.url.qStaticContentUrl.qUrl;
3979
-
3980
- if (bgUrl) {
3981
- bgUrl = urlUtils.getImageUrl(bgUrl);
3982
- styles += formatProperty('background-image', "url('".concat(bgUrl, "')"));
3983
- styles += formatProperty('background-size', backgroundSize[background.size]);
3984
- styles += formatProperty('background-position', backgroundPosition[background.position]);
3985
- styles += formatProperty('background-repeat', 'no-repeat');
3986
- }
3987
- } // border
3988
-
3989
-
3990
- if (border.useBorder) {
3991
- var lengthShortSide = Math.min(element.offsetWidth, element.offsetHeight);
3992
- var borderColor = getColor(border, colorUtils.getFadedColor(backgroundColor), theme);
3993
- var borderSize = border.width * lengthShortSide / 2;
3994
- styles += formatProperty('border', "".concat(borderSize, "px solid ").concat(borderColor));
3995
- styles += formatProperty('border-radius', "".concat(border.radius * lengthShortSide / 2, "px"));
3996
- } else {
3997
- styles += 'border: none;';
3998
- }
3999
-
4000
- return styles;
4001
- },
4002
- createLabelAndIcon: function createLabelAndIcon(_ref3) {
4003
- var button = _ref3.button,
4004
- theme = _ref3.theme,
4005
- style = _ref3.style,
4006
- isSense = _ref3.isSense;
4007
- var icon = style.icon,
4008
- font = style.font,
4009
- label = style.label; // text element wrapping label and icon
4010
-
4011
- var text = document.createElement('text');
4012
- text.style.whiteSpace = 'nowrap';
4013
- text.style.fontFamily = theme.getStyle('', '', 'fontFamily'); // label
4014
-
4015
- var textSpan = document.createElement('span');
4016
- textSpan.textContent = label;
4017
- textSpan.style.whiteSpace = 'nowrap';
4018
- textSpan.style.textOverflow = 'ellipsis';
4019
- textSpan.style.overflow = 'visible';
4020
- font.style.underline && (textSpan.style.textDecoration = 'underline');
4021
- text.appendChild(textSpan); // icon
4022
-
4023
- var hasIcon = isSense && icon.useIcon && icon.iconType !== '';
4024
-
4025
- if (hasIcon) {
4026
- var iconSpan = document.createElement('span');
4027
- var iconType = luiIcons.find(function (iconObj) {
4028
- return iconObj.label === icon.iconType || iconObj.value === icon.iconType;
4029
- });
4030
- iconSpan.style.textDecoration = 'none';
4031
- iconSpan.style.fontSize = 'inherit';
4032
- iconSpan.setAttribute('class', "lui-icon lui-icon--".concat(iconType ? iconType.value : ''));
4033
- icon.position === 'left' ? text.insertBefore(iconSpan, textSpan) : text.appendChild(iconSpan);
4034
- }
4035
-
4036
- button.innerHTML = '';
4037
- button.appendChild(text); // Calculations on font size.
4038
- // 1. Setting font size to height of button container
4039
-
4040
- text.style.fontSize = "".concat(button.clientHeight, "px"); // 2. Adjust the font size to the height ratio between button container and text box
4041
-
4042
- var newFontsize = button.clientHeight / text.offsetHeight * button.clientHeight;
4043
- text.style.fontSize = "".concat(newFontsize, "px"); // 3. Adjust the font size to the width ratio between button container and text box
4044
-
4045
- if (text.offsetWidth > button.clientWidth) {
4046
- newFontsize *= button.clientWidth / text.offsetWidth;
4047
- } // 4. Setting final font size by scaling with the font size from the layout + other font styling
4048
-
4049
-
4050
- if (font.style.italic) {
4051
- if (hasIcon) {
4052
- text.style.fontSize = "".concat(Math.max(newFontsize * font.size * 0.84, 8), "px");
4053
- text.children[0].style.marginRight = "".concat(text.offsetWidth * 0.04, "px");
4054
- text.children[1].style.marginRight = "".concat(text.offsetWidth * 0.04, "px");
4055
- } else {
4056
- text.style.fontSize = "".concat(Math.max(newFontsize * font.size * 0.9, 8), "px");
4057
- text.children[0].style.marginRight = "".concat(text.offsetWidth * 0.02, "px");
4058
- }
4059
- } else if (hasIcon) {
4060
- text.style.fontSize = "".concat(Math.max(newFontsize * font.size * 0.88, 8), "px");
4061
- text.children[0].style.marginRight = "".concat(text.offsetWidth * 0.04, "px");
4062
- } else {
4063
- text.style.fontSize = "".concat(Math.max(newFontsize * font.size * 0.92, 8), "px");
4064
- } // hide overflow when there can be overflow
4065
-
4066
-
4067
- if (text.style.fontSize === '8px') {
4068
- text.children.forEach(function (child) {
4069
- child.style.overflow = 'hidden';
4070
- });
4071
- }
4072
-
4073
- text.style.margin = '0 3%';
4074
- text.style.display = 'flex';
4075
- text.style.alignItems = 'center';
4076
- text.style.justifyContent = font.align === 'left' ? 'flex-start' : font.align === 'right' ? 'flex-end' : 'center';
4077
- }
4078
- };
4079
-
4080
- var runActions = /*#__PURE__*/function () {
4081
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(actionList) {
4082
- var i;
4083
- return regeneratorRuntime.wrap(function _callee$(_context) {
4084
- while (1) {
4085
- switch (_context.prev = _context.next) {
4086
- case 0:
4087
- i = 0;
4088
-
4089
- case 1:
4090
- if (!(i < actionList.length)) {
4091
- _context.next = 7;
4092
- break;
4093
- }
4094
-
4095
- _context.next = 4;
4096
- return actionList[i]();
4097
-
4098
- case 4:
4099
- i++;
4100
- _context.next = 1;
4101
- break;
4102
-
4103
- case 7:
4104
- case "end":
4105
- return _context.stop();
4106
- }
4107
- }
4108
- }, _callee);
4109
- }));
4110
-
4111
- return function runActions(_x) {
4112
- return _ref.apply(this, arguments);
4113
- };
4114
- }();
4115
- function renderButton(_ref2) {
4116
- var layout = _ref2.layout,
4117
- theme = _ref2.theme,
4118
- app = _ref2.app,
4119
- constraints = _ref2.constraints,
4120
- senseNavigation = _ref2.senseNavigation,
4121
- element = _ref2.element;
4122
- var isSense = !!senseNavigation;
4123
- var button = element.firstElementChild;
4124
- var style = layout.style,
4125
- qStateName = layout.qStateName;
4126
- var disabled = layout.useEnabledCondition && layout.enabledCondition === 0;
4127
- var isClickable = !disabled && !constraints.active;
4128
- var formattedStyles = styleFormatter.getStyles({
4129
- style: style,
4130
- disabled: disabled,
4131
- theme: theme,
4132
- element: element
4133
- });
4134
- button.setAttribute('style', formattedStyles);
4135
- button.setAttribute('tabindex', '-1');
4136
- styleFormatter.createLabelAndIcon({
4137
- button: button,
4138
- theme: theme,
4139
- style: style,
4140
- isSense: isSense
4141
- });
4142
- button.onclick = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
4143
- var actionCallList, actions$1, navigation, navigationObject;
4144
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
4145
- while (1) {
4146
- switch (_context2.prev = _context2.next) {
4147
- case 0:
4148
- if (!isClickable) {
4149
- _context2.next = 14;
4150
- break;
4151
- }
4152
-
4153
- actionCallList = [];
4154
- actions$1 = layout.actions;
4155
- actions$1.forEach(function (action) {
4156
- var actionObj = actions.find(function (act) {
4157
- return act.value === action.actionType;
4158
- });
4159
- actionObj && actionCallList.push(actionObj.getActionCall(_objectSpread2({
4160
- app: app,
4161
- qStateName: qStateName
4162
- }, action)));
4163
- });
4164
- button.setAttribute('disabled', true);
4165
- _context2.next = 7;
4166
- return runActions(actionCallList);
4167
-
4168
- case 7:
4169
- if (!(senseNavigation && !senseNavigation.getCurrentStoryId())) {
4170
- _context2.next = 13;
4171
- break;
4172
- }
4173
-
4174
- navigation = layout.navigation;
4175
- navigationObject = navigation && navigationActions.find(function (nav) {
4176
- return nav.value === navigation.action;
4177
- });
4178
-
4179
- if (!(senseNavigation && navigationObject && typeof navigationObject.navigationCall === 'function')) {
4180
- _context2.next = 13;
4181
- break;
4182
- }
4183
-
4184
- _context2.next = 13;
4185
- return navigationObject.navigationCall(_objectSpread2({
4186
- app: app,
4187
- senseNavigation: senseNavigation
4188
- }, navigation));
4189
-
4190
- case 13:
4191
- button.removeAttribute('disabled');
4192
-
4193
- case 14:
4194
- case "end":
4195
- return _context2.stop();
4196
- }
4197
- }
4198
- }, _callee2);
4199
- }));
4200
-
4201
- var scale = function scale() {
4202
- if (isClickable) {
4203
- var offsetWidth = button.offsetWidth,
4204
- offsetHeight = button.offsetHeight;
4205
- button.style.transform = offsetHeight > offsetWidth ? "scale(".concat(0.98, ", ", 1 - offsetWidth / offsetHeight * 0.02, ")") : "scale(".concat(1 - offsetHeight / offsetWidth * 0.02, ", ", 0.98, ")");
4206
- }
4207
- };
4208
-
4209
- var resetScale = function resetScale() {
4210
- var transform = button.style.transform;
4211
-
4212
- if (isClickable && transform !== '' && transform !== 'scale(1)') {
4213
- button.style.transform = 'scale(1)';
4214
- }
4215
- };
4216
-
4217
- button.onmousedown = function (event) {
4218
- if (event.button === 0) {
4219
- scale();
4220
- }
4221
- };
4222
-
4223
- button.onmouseup = resetScale;
4224
- button.onmouseleave = resetScale;
4225
- button.ontouchstart = scale;
4226
- button.ontouchend = resetScale;
4227
- button.ontouchcancel = resetScale;
4228
- return function () {
4229
- button.onclick = undefined;
4230
- button.onmousedown = undefined;
4231
- button.onmouseup = undefined;
4232
- button.onmouseleave = undefined;
4233
- button.ontouchstart = undefined;
4234
- button.ontouchend = undefined;
4235
- button.ontouchcancel = undefined;
4236
- };
4237
- }
4238
-
4239
- function supernova(env) {
4240
- var sense = env.sense,
4241
- translator = env.translator,
4242
- isEnabled = env.flags.isEnabled;
4243
- var senseNavigation = sense && sense.navigation;
4244
- var automationsEnabled = isEnabled('ACTION_BUTTON_AUTOMATIONS');
4245
- properties.style.label = sense ? translator.get('Object.ActionButton') : 'Button';
4246
- return {
4247
- qae: {
4248
- properties: properties,
4249
- data: data
4250
- },
4251
- component: function component() {
4252
- var element = useElement();
4253
- var theme = useTheme();
4254
- useMemo(function () {
4255
- var button = document.createElement('button');
4256
- button.appendChild(document.createElement('text'));
4257
- element.appendChild(button);
4258
- }, []);
4259
- var layout = useStaleLayout();
4260
- var app = useApp();
4261
- var constraints = useConstraints();
4262
- var cleanup = renderButton({
4263
- element: element,
4264
- layout: layout,
4265
- constraints: constraints,
4266
- theme: theme,
4267
- app: app,
4268
- senseNavigation: senseNavigation,
4269
- automationsEnabled: automationsEnabled
4270
- });
4271
- useEffect(function () {
4272
- return function () {
4273
- cleanup();
4274
- };
4275
- }, [element]);
4276
- useImperativeHandle(function () {
4277
- return {
4278
- focus: function focus() {
4279
- element.firstElementChild.onclick();
4280
- }
4281
- };
4282
- }, [element]);
4283
- },
4284
- ext: ext({
4285
- translator: translator,
4286
- automationsEnabled: automationsEnabled
4287
- })
4288
- };
4289
- }
4290
-
4291
- export { supernova as default };
4292
- //# 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.3",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){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}));if(o.length>0){const a=new Date,n={qProp:{qInfo:{qId:`automation_${e.id}_${t}_${a.getTime()}`,qType:"bookmark"},qMetaDef:{title:`Generated automation bookmark on ${a.toISOString()}`,description:"Generated to provide target automation with bookmark to get current selection state",_createdBy:"sn-action-button",_createdFor:"automation",_createdOn:`${a.toISOString()}`,_id:`automation_${encodeURIComponent(e.id)}_${t}_${a.getTime()}`}}},i=await e.createBookmark(n).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()}=${i}`}}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};