@itfin/components 1.3.95 → 2.0.1

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.
Files changed (109) hide show
  1. package/package.json +1 -1
  2. package/src/assets/scss/_css_variables.scss +2 -2
  3. package/src/assets/scss/_variables.scss +18 -7
  4. package/src/assets/scss/components/_button.scss +10 -0
  5. package/src/assets/scss/components/_pagination.scss +4 -1
  6. package/src/assets/scss/components/_select.scss +1 -3
  7. package/src/assets/scss/components/_text-field.scss +17 -7
  8. package/src/assets/scss/main.scss +36 -2
  9. package/src/components/app/message.js +1 -1
  10. package/src/components/button/Button.vue +4 -2
  11. package/src/components/filter/FilterAmountRange.vue +50 -42
  12. package/src/components/filter/FilterBadge.vue +25 -22
  13. package/src/components/filter/FilterFacetsList.vue +1 -1
  14. package/src/components/filter/FilterPanel.vue +82 -27
  15. package/src/components/filter/index.stories.js +0 -2
  16. package/src/components/icon/Icon.vue +3 -1
  17. package/src/components/icon/components/fi_fingerprint.vue +4 -0
  18. package/src/components/icon/components/nomi-arrow-down.vue +4 -0
  19. package/src/components/icon/components/nomi-arrow-right-top.vue +4 -0
  20. package/src/components/icon/components/nomi-arrow-up.vue +4 -0
  21. package/src/components/icon/components/nomi-arrows.vue +7 -0
  22. package/src/components/icon/components/nomi-calendar-alt.vue +4 -0
  23. package/src/components/icon/components/nomi-calendar.vue +11 -0
  24. package/src/components/icon/components/nomi-card.vue +4 -0
  25. package/src/components/icon/components/nomi-close.vue +5 -0
  26. package/src/components/icon/components/nomi-eye-close.vue +4 -0
  27. package/src/components/icon/components/nomi-eye-open.vue +4 -0
  28. package/src/components/icon/components/nomi-filter.vue +4 -0
  29. package/src/components/icon/components/nomi-hide.vue +4 -0
  30. package/src/components/icon/components/nomi-money.vue +4 -0
  31. package/src/components/icon/components/nomi-move-left.vue +4 -0
  32. package/src/components/icon/components/nomi-move-right.vue +4 -0
  33. package/src/components/icon/components/nomi-person.vue +5 -0
  34. package/src/components/icon/components/nomi-pin.vue +7 -0
  35. package/src/components/icon/components/nomi-sort-asc.vue +7 -0
  36. package/src/components/icon/components/nomi-sort-desc.vue +7 -0
  37. package/src/components/icon/components/nomi-table-view.vue +4 -0
  38. package/src/components/icon/components/nomi-tag.vue +4 -0
  39. package/src/components/icon/components/nomi-target.vue +4 -0
  40. package/src/components/icon/components/nomi-text.vue +6 -0
  41. package/src/components/icon/components/nomi-unpin.vue +7 -0
  42. package/src/components/icon/convert-icons.js +11 -0
  43. package/src/components/icon/icons.js +302 -277
  44. package/src/components/icon/new-icons/arrow-down.svg +3 -0
  45. package/src/components/icon/new-icons/arrow-right-top.svg +3 -0
  46. package/src/components/icon/new-icons/arrow-up.svg +3 -0
  47. package/src/components/icon/new-icons/arrows.svg +6 -0
  48. package/src/components/icon/new-icons/calendar-alt.svg +3 -0
  49. package/src/components/icon/new-icons/calendar.svg +10 -0
  50. package/src/components/icon/new-icons/card.svg +3 -0
  51. package/src/components/icon/new-icons/clear.svg +3 -0
  52. package/src/components/icon/new-icons/close.svg +4 -0
  53. package/src/components/icon/new-icons/eye-close.svg +3 -0
  54. package/src/components/icon/new-icons/eye-open.svg +3 -0
  55. package/src/components/icon/new-icons/filter.svg +3 -0
  56. package/src/components/icon/new-icons/hide.svg +3 -0
  57. package/src/components/icon/new-icons/money.svg +3 -0
  58. package/src/components/icon/new-icons/move-left.svg +3 -0
  59. package/src/components/icon/new-icons/move-right.svg +3 -0
  60. package/src/components/icon/new-icons/person.svg +4 -0
  61. package/src/components/icon/new-icons/pin.svg +6 -0
  62. package/src/components/icon/new-icons/sort-asc.svg +6 -0
  63. package/src/components/icon/new-icons/sort-desc.svg +6 -0
  64. package/src/components/icon/new-icons/table-view.svg +3 -0
  65. package/src/components/icon/new-icons/tag.svg +3 -0
  66. package/src/components/icon/new-icons/target.svg +3 -0
  67. package/src/components/icon/new-icons/text.svg +5 -0
  68. package/src/components/icon/new-icons/unpin.svg +6 -0
  69. package/src/components/pagination/Pagination.vue +3 -2
  70. package/src/components/pagination/Pagination2.vue +176 -0
  71. package/src/components/panels/Panel.vue +5 -1
  72. package/src/components/panels/PanelItemEdit.vue +61 -0
  73. package/src/components/panels/PanelList.vue +2 -0
  74. package/src/components/select/Select.vue +1 -1
  75. package/src/components/sortable/draggable.js +2 -1
  76. package/src/components/table/Table2.vue +24 -1
  77. package/src/components/table/TableBody.vue +7 -2
  78. package/src/components/table/TableGroup.vue +8 -4
  79. package/src/components/table/TableHeader.vue +101 -24
  80. package/src/components/table/TableRows.vue +5 -3
  81. package/src/components/table/index.stories.js +22 -200
  82. package/src/components/table/table2.scss +179 -52
  83. package/src/components/text-field/MoneyField.vue +2 -2
  84. package/src/components/text-field/TextField.vue +12 -8
  85. package/src/components/tree/TreeEditor.vue +602 -0
  86. package/src/components/view/View.vue +119 -0
  87. package/src/components/view/index.stories.js +588 -0
  88. package/src/helpers/formatters.js +14 -1
  89. package/src/helpers/tree/cdbl.js +32 -0
  90. package/src/helpers/tree/cint.js +43 -0
  91. package/src/helpers/tree/domDrag.js +911 -0
  92. package/src/helpers/tree/domFinds.js +20 -0
  93. package/src/helpers/tree/domGetPointFromEvent.js +53 -0
  94. package/src/helpers/tree/domIsClientXYIn.js +65 -0
  95. package/src/helpers/tree/domRemove.js +50 -0
  96. package/src/helpers/tree/evem.js +27 -0
  97. package/src/helpers/tree/genID.js +56 -0
  98. package/src/helpers/tree/isEle.js +28 -0
  99. package/src/helpers/tree/isestr.js +35 -0
  100. package/src/helpers/tree/isint.js +40 -0
  101. package/src/helpers/tree/isnbr.js +24 -0
  102. package/src/helpers/tree/isnum.js +38 -0
  103. package/src/helpers/tree/ispint.js +41 -0
  104. package/src/helpers/tree/isstr.js +27 -0
  105. package/src/helpers/tree.js +30 -0
  106. package/src/helpers/vuetifyColor.js +136 -0
  107. package/src/locales/en.js +13 -0
  108. package/src/locales/uk.js +11 -0
  109. package/src/components/table/TableRow.vue +0 -221
@@ -36,6 +36,19 @@ export function parseHours (str, { hoursInDay } = { hoursInDay: 8 }) {
36
36
  return isNegative * seconds;
37
37
  }
38
38
 
39
+ export function formatFinanceMoney (val, symbol = '', digits = 2, showNegative = true) {
40
+ if (isNaN(val) || val === null || val === undefined) {
41
+ return '—';
42
+ }
43
+ if (typeof symbol !== 'string' && symbol !== null && typeof symbol !== 'undefined') {
44
+ if (symbol.IsCryptoCurrency && digits === 2 && Math.abs(val) < 0.01) {
45
+ digits = 6;
46
+ }
47
+ symbol = symbol.Symbol; // in case of passing object of currency
48
+ }
49
+ const isNegative = showNegative && (val < 0);
50
+ return (isNegative ? '(' : '') + formatMoney(Math.abs(val), symbol, digits) + (isNegative ? ')' : '');
51
+ }
39
52
 
40
53
  // https://stptrans.com/wp-content/uploads/2020/02/Working-with-currency-number-and-date-formats.pdf
41
54
  export function formatMoney (val, symbol = '', digits = null) {
@@ -43,7 +56,7 @@ export function formatMoney (val, symbol = '', digits = null) {
43
56
  const thousandSeparator = ITFSettings.moneyThousandSeparator || ',';
44
57
  const decimalSeparator = ITFSettings.moneyDecimalSeparator || '.';
45
58
 
46
- if (Number.isNaN(val) || val === null) {
59
+ if (Number.isNaN(val) || val === null || val === undefined) {
47
60
  return '—';
48
61
  }
49
62
  let symbolStr = symbol?.currencySymbol ?? symbol?.symbol ?? symbol?.Symbol ?? '';
@@ -0,0 +1,32 @@
1
+ import toFinite from 'lodash/toFinite'
2
+ import isnum from './isnum.js'
3
+
4
+
5
+ /**
6
+ * 數字或字串轉浮點數
7
+ * 若輸入非數字則回傳0
8
+ *
9
+ * Unit Test: {@link https://github.com/yuda-lyu/wsemi/blob/master/test/cdbl.test.js Github}
10
+ * @memberOf wsemi
11
+ * @param {Number|String} v 輸入數字或字串
12
+ * @returns {Number} 回傳數字
13
+ * @example
14
+ *
15
+ * console.log(cdbl('25'))
16
+ * // => 25
17
+ *
18
+ */
19
+ function cdbl(v) {
20
+
21
+ //check
22
+ if (!isnum(v)) {
23
+ return 0
24
+ }
25
+
26
+ let r = toFinite(v)
27
+
28
+ return r
29
+ }
30
+
31
+
32
+ export default cdbl
@@ -0,0 +1,43 @@
1
+ import round from 'lodash/round'
2
+ import isnum from './isnum.js'
3
+ import cdbl from './cdbl.js'
4
+
5
+
6
+ /**
7
+ * 數字或字串四捨五入轉整數
8
+ * 若輸入非數字則回傳0
9
+ *
10
+ * Unit Test: {@link https://github.com/yuda-lyu/wsemi/blob/master/test/cint.test.js Github}
11
+ * @memberOf wsemi
12
+ * @param {Number|String} v 輸入數字或字串
13
+ * @returns {Integer} 回傳四捨五入後整數
14
+ * @example
15
+ *
16
+ * console.log(cint('1.5'))
17
+ * // => 2
18
+ *
19
+ * console.log(cint('-1.5'))
20
+ * // => -1
21
+ *
22
+ */
23
+ function cint(v) {
24
+
25
+ //check
26
+ if (!isnum(v)) {
27
+ return 0
28
+ }
29
+
30
+ v = cdbl(v)
31
+
32
+ let r = round(v)
33
+
34
+ //check -0
35
+ if (String(r) === '0') {
36
+ return 0
37
+ }
38
+
39
+ return r
40
+ }
41
+
42
+
43
+ export default cint