@itfin/components 1.3.99 → 1.4.0

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 (151) hide show
  1. package/package.json +1 -1
  2. package/src/components/button/Button.vue +4 -2
  3. package/src/components/card/BentoCard.vue +70 -19
  4. package/src/components/card/BentoGrid.vue +21 -8
  5. package/src/components/filter/FilterAmountRange.vue +50 -42
  6. package/src/components/filter/FilterBadge.vue +27 -22
  7. package/src/components/filter/FilterFacetsList.vue +21 -17
  8. package/src/components/filter/FilterPanel.vue +141 -44
  9. package/src/components/filter/index.stories.js +0 -2
  10. package/src/components/form/Label.vue +19 -2
  11. package/src/components/icon/Icon.vue +4 -2
  12. package/src/components/icon/components/fi_fingerprint.vue +4 -0
  13. package/src/components/icon/components/nomi-ai.vue +6 -0
  14. package/src/components/icon/components/nomi-arrow-down.vue +4 -0
  15. package/src/components/icon/components/nomi-arrow-right-top.vue +4 -0
  16. package/src/components/icon/components/nomi-arrow-up.vue +4 -0
  17. package/src/components/icon/components/nomi-arrow_down.vue +4 -0
  18. package/src/components/icon/components/nomi-arrow_up.vue +4 -0
  19. package/src/components/icon/components/nomi-arrows.vue +7 -0
  20. package/src/components/icon/components/nomi-calendar-alt.vue +4 -0
  21. package/src/components/icon/components/nomi-calendar-alt2.vue +4 -0
  22. package/src/components/icon/components/nomi-calendar.vue +11 -0
  23. package/src/components/icon/components/nomi-card.vue +4 -0
  24. package/src/components/icon/components/nomi-clear.vue +4 -0
  25. package/src/components/icon/components/nomi-close.vue +5 -0
  26. package/src/components/icon/components/nomi-counterparty.vue +4 -0
  27. package/src/components/icon/components/nomi-dashboard.vue +4 -0
  28. package/src/components/icon/components/nomi-expand.vue +7 -0
  29. package/src/components/icon/components/nomi-eye-close.vue +4 -0
  30. package/src/components/icon/components/nomi-eye-open.vue +4 -0
  31. package/src/components/icon/components/nomi-eye.vue +4 -0
  32. package/src/components/icon/components/nomi-filter.vue +4 -0
  33. package/src/components/icon/components/nomi-help.vue +5 -0
  34. package/src/components/icon/components/nomi-hide.vue +4 -0
  35. package/src/components/icon/components/nomi-logout.vue +5 -0
  36. package/src/components/icon/components/nomi-money.vue +4 -0
  37. package/src/components/icon/components/nomi-move-left.vue +4 -0
  38. package/src/components/icon/components/nomi-move-right.vue +4 -0
  39. package/src/components/icon/components/nomi-pen.vue +5 -0
  40. package/src/components/icon/components/nomi-person.vue +5 -0
  41. package/src/components/icon/components/nomi-pin.vue +7 -0
  42. package/src/components/icon/components/nomi-project.vue +4 -0
  43. package/src/components/icon/components/nomi-recurrence.vue +2 -0
  44. package/src/components/icon/components/nomi-repeat.vue +7 -0
  45. package/src/components/icon/components/nomi-report.vue +4 -0
  46. package/src/components/icon/components/nomi-scissors.vue +4 -0
  47. package/src/components/icon/components/nomi-settings.vue +4 -0
  48. package/src/components/icon/components/nomi-sort-asc.vue +7 -0
  49. package/src/components/icon/components/nomi-sort-desc.vue +7 -0
  50. package/src/components/icon/components/nomi-table-view.vue +4 -0
  51. package/src/components/icon/components/nomi-tag.vue +4 -0
  52. package/src/components/icon/components/nomi-target.vue +4 -0
  53. package/src/components/icon/components/nomi-text.vue +6 -0
  54. package/src/components/icon/components/nomi-transactions.vue +8 -0
  55. package/src/components/icon/components/nomi-trash.vue +4 -0
  56. package/src/components/icon/components/nomi-unpin.vue +7 -0
  57. package/src/components/icon/components/nomi-user.vue +5 -0
  58. package/src/components/icon/convert-icons.js +11 -0
  59. package/src/components/icon/icons.js +332 -286
  60. package/src/components/icon/new-icons/ai.svg +5 -0
  61. package/src/components/icon/new-icons/arrow-down.svg +3 -0
  62. package/src/components/icon/new-icons/arrow-right-top.svg +3 -0
  63. package/src/components/icon/new-icons/arrow-up.svg +3 -0
  64. package/src/components/icon/new-icons/arrow_down.svg +3 -0
  65. package/src/components/icon/new-icons/arrow_up.svg +3 -0
  66. package/src/components/icon/new-icons/arrows.svg +6 -0
  67. package/src/components/icon/new-icons/calendar-alt.svg +3 -0
  68. package/src/components/icon/new-icons/calendar-alt2.svg +3 -0
  69. package/src/components/icon/new-icons/calendar.svg +10 -0
  70. package/src/components/icon/new-icons/card.svg +3 -0
  71. package/src/components/icon/new-icons/clear.svg +3 -0
  72. package/src/components/icon/new-icons/close.svg +4 -0
  73. package/src/components/icon/new-icons/counterparty.svg +3 -0
  74. package/src/components/icon/new-icons/dashboard.svg +3 -0
  75. package/src/components/icon/new-icons/expand.svg +6 -0
  76. package/src/components/icon/new-icons/eye-close.svg +3 -0
  77. package/src/components/icon/new-icons/eye-open.svg +3 -0
  78. package/src/components/icon/new-icons/eye.svg +3 -0
  79. package/src/components/icon/new-icons/filter.svg +3 -0
  80. package/src/components/icon/new-icons/help.svg +4 -0
  81. package/src/components/icon/new-icons/hide.svg +3 -0
  82. package/src/components/icon/new-icons/logout.svg +4 -0
  83. package/src/components/icon/new-icons/money.svg +3 -0
  84. package/src/components/icon/new-icons/move-left.svg +3 -0
  85. package/src/components/icon/new-icons/move-right.svg +3 -0
  86. package/src/components/icon/new-icons/pen.svg +4 -0
  87. package/src/components/icon/new-icons/person.svg +4 -0
  88. package/src/components/icon/new-icons/pin.svg +6 -0
  89. package/src/components/icon/new-icons/project.svg +3 -0
  90. package/src/components/icon/new-icons/recurrence.svg +1 -0
  91. package/src/components/icon/new-icons/repeat.svg +6 -0
  92. package/src/components/icon/new-icons/report.svg +3 -0
  93. package/src/components/icon/new-icons/scissors.svg +3 -0
  94. package/src/components/icon/new-icons/settings.svg +3 -0
  95. package/src/components/icon/new-icons/sort-asc.svg +6 -0
  96. package/src/components/icon/new-icons/sort-desc.svg +6 -0
  97. package/src/components/icon/new-icons/table-view.svg +3 -0
  98. package/src/components/icon/new-icons/tag.svg +3 -0
  99. package/src/components/icon/new-icons/target.svg +3 -0
  100. package/src/components/icon/new-icons/text.svg +5 -0
  101. package/src/components/icon/new-icons/transactions.svg +7 -0
  102. package/src/components/icon/new-icons/trash.svg +3 -0
  103. package/src/components/icon/new-icons/unpin.svg +6 -0
  104. package/src/components/icon/new-icons/user.svg +4 -0
  105. package/src/components/modal/DeleteConfirmModal.vue +0 -2
  106. package/src/components/modal/ItemEditor.vue +1 -5
  107. package/src/components/pagination/Pagination.vue +3 -2
  108. package/src/components/pagination/Pagination2.vue +179 -0
  109. package/src/components/panels/Panel.vue +23 -7
  110. package/src/components/panels/PanelItemEdit.vue +62 -0
  111. package/src/components/panels/PanelLink.vue +26 -6
  112. package/src/components/panels/PanelList.vue +27 -26
  113. package/src/components/panels/helpers.spec.ts +27 -0
  114. package/src/components/panels/helpers.ts +37 -0
  115. package/src/components/popover/NoticePopout.vue +1 -1
  116. package/src/components/select/Select.vue +1 -1
  117. package/src/components/sortable/draggable.js +2 -1
  118. package/src/components/table/Table2.vue +35 -8
  119. package/src/components/table/TableBody.vue +10 -18
  120. package/src/components/table/TableGroup.vue +30 -14
  121. package/src/components/table/TableHeader.vue +122 -73
  122. package/src/components/table/TableRowToggle.vue +51 -0
  123. package/src/components/table/TableRows.vue +20 -29
  124. package/src/components/table/index.stories.js +22 -200
  125. package/src/components/table/table2.scss +237 -68
  126. package/src/components/text-field/MoneyField.vue +23 -21
  127. package/src/components/text-field/TextField.vue +12 -8
  128. package/src/components/tree/TreeEditor.vue +615 -0
  129. package/src/components/view/View.vue +244 -0
  130. package/src/components/view/index.stories.js +588 -0
  131. package/src/helpers/formatters.js +14 -1
  132. package/src/helpers/tree/cdbl.js +32 -0
  133. package/src/helpers/tree/cint.js +43 -0
  134. package/src/helpers/tree/domDrag.js +911 -0
  135. package/src/helpers/tree/domFinds.js +20 -0
  136. package/src/helpers/tree/domGetPointFromEvent.js +53 -0
  137. package/src/helpers/tree/domIsClientXYIn.js +65 -0
  138. package/src/helpers/tree/domRemove.js +50 -0
  139. package/src/helpers/tree/evem.js +27 -0
  140. package/src/helpers/tree/genID.js +56 -0
  141. package/src/helpers/tree/isEle.js +28 -0
  142. package/src/helpers/tree/isestr.js +35 -0
  143. package/src/helpers/tree/isint.js +40 -0
  144. package/src/helpers/tree/isnbr.js +24 -0
  145. package/src/helpers/tree/isnum.js +38 -0
  146. package/src/helpers/tree/ispint.js +41 -0
  147. package/src/helpers/tree/isstr.js +27 -0
  148. package/src/helpers/tree.js +30 -0
  149. package/src/helpers/vuetifyColor.js +136 -0
  150. package/src/locales/en.js +17 -0
  151. package/src/locales/uk.js +17 -0
@@ -0,0 +1,588 @@
1
+ import { storiesOf } from '@storybook/vue';
2
+ import itfApp from '../app/App.vue';
3
+ import itfView from './View.vue';
4
+ import itfIcon from '../icon/Icon.vue';
5
+
6
+ storiesOf('Common', module)
7
+ .add('View', () => ({
8
+ components: {
9
+ itfApp,
10
+ itfIcon,
11
+ itfView
12
+ },
13
+ data() {
14
+ return {
15
+ selectedIds: [],
16
+ sorting: 'Description',
17
+ list: Array.from({length: 20}).map((_, i) => ({
18
+ Id: i,
19
+ text: `Рахунок ✅`,
20
+ Name: `Item #${i}`
21
+ })).concat(Array.from({length: 20}).map((_, i) => ({
22
+ Id: i,
23
+ text: `Рахунок ❌`,
24
+ Name: `Item #${i}`
25
+ }))),
26
+ columns2: [
27
+ {
28
+ text: 'Рахунок',
29
+ name: 'Account',
30
+ width: 200,
31
+ min: 250,
32
+ max: 250
33
+ },
34
+ {
35
+ text: 'Рахунок',
36
+ name: 'Account',
37
+ width: 200,
38
+ min: 250,
39
+ max: 250
40
+ }
41
+ ],
42
+ page: 1,
43
+ list2: [
44
+ {
45
+ Id: 1,
46
+ summary: true,
47
+ Description: 'Total asd asd dad ad ada dadad a',
48
+ EmployeeId: 1,
49
+ Total: 100,
50
+ FTE: 1.0,
51
+ Position: { Title: 'Developer', Id: 1 },
52
+ MinutesInternal: '10h 20m',
53
+ MinutesExternal: '10h 20m',
54
+ AmountInternal: 1000,
55
+ AmountExternal: 2000,
56
+ AmountShare: 200,
57
+ Notes: 'Test',
58
+ Rate: '10',
59
+ Time: '10h 00m',
60
+ Amount: 2000
61
+ },
62
+ {
63
+ Id: 2,
64
+ summary: true,
65
+ Description: 'Total asd asd dad ad ada dadad a',
66
+ EmployeeId: 1,
67
+ Total: 100,
68
+ FTE: 1.0,
69
+ Position: { Title: 'Developer', Id: 1 },
70
+ MinutesInternal: '10h 20m',
71
+ MinutesExternal: '10h 20m',
72
+ AmountInternal: 1000,
73
+ AmountExternal: 2000,
74
+ AmountShare: 200,
75
+ Notes: 'Test',
76
+ Rate: '10',
77
+ Time: '10h 00m',
78
+ Amount: 2000
79
+ },
80
+ {
81
+ Id: 2,
82
+ summary: true,
83
+ Description: 'Total asd asd dad ad ada dadad a',
84
+ EmployeeId: 1,
85
+ Total: 100,
86
+ FTE: 1.0,
87
+ Position: { Title: 'Developer', Id: 1 },
88
+ MinutesInternal: '10h 20m',
89
+ MinutesExternal: '10h 20m',
90
+ AmountInternal: 1000,
91
+ AmountExternal: 2000,
92
+ AmountShare: 200,
93
+ Notes: 'Test',
94
+ Rate: '10',
95
+ Time: '10h 00m',
96
+ Amount: 2000
97
+ },
98
+ {
99
+ Id: 2,
100
+ summary: true,
101
+ Description: 'Total asd asd dad ad ada dadad a',
102
+ EmployeeId: 1,
103
+ Total: 100,
104
+ FTE: 1.0,
105
+ Position: { Title: 'Developer', Id: 1 },
106
+ MinutesInternal: '10h 20m',
107
+ MinutesExternal: '10h 20m',
108
+ AmountInternal: 1000,
109
+ AmountExternal: 2000,
110
+ AmountShare: 200,
111
+ Notes: 'Test',
112
+ Rate: '10',
113
+ Time: '10h 00m',
114
+ Amount: 2000
115
+ },
116
+ {
117
+ Id: 2,
118
+ summary: true,
119
+ Description: 'Total asd asd dad ad ada dadad a',
120
+ EmployeeId: 1,
121
+ Total: 100,
122
+ FTE: 1.0,
123
+ Position: { Title: 'Developer', Id: 1 },
124
+ MinutesInternal: '10h 20m',
125
+ MinutesExternal: '10h 20m',
126
+ AmountInternal: 1000,
127
+ AmountExternal: 2000,
128
+ AmountShare: 200,
129
+ Notes: 'Test',
130
+ Rate: '10',
131
+ Time: '10h 00m',
132
+ Amount: 2000
133
+ },
134
+ {
135
+ Id: 2,
136
+ summary: true,
137
+ Description: 'Total asd asd dad ad ada dadad a',
138
+ EmployeeId: 1,
139
+ Total: 100,
140
+ FTE: 1.0,
141
+ Position: { Title: 'Developer', Id: 1 },
142
+ MinutesInternal: '10h 20m',
143
+ MinutesExternal: '10h 20m',
144
+ AmountInternal: 1000,
145
+ AmountExternal: 2000,
146
+ AmountShare: 200,
147
+ Notes: 'Test',
148
+ Rate: '10',
149
+ Time: '10h 00m',
150
+ Amount: 2000
151
+ },
152
+ {
153
+ Id: 2,
154
+ summary: true,
155
+ Description: 'Total asd asd dad ad ada dadad a',
156
+ EmployeeId: 1,
157
+ Total: 100,
158
+ FTE: 1.0,
159
+ Position: { Title: 'Developer', Id: 1 },
160
+ MinutesInternal: '10h 20m',
161
+ MinutesExternal: '10h 20m',
162
+ AmountInternal: 1000,
163
+ AmountExternal: 2000,
164
+ AmountShare: 200,
165
+ Notes: 'Test',
166
+ Rate: '10',
167
+ Time: '10h 00m',
168
+ Amount: 2000
169
+ },
170
+ {
171
+ Id: 2,
172
+ summary: true,
173
+ Description: 'Total asd asd dad ad ada dadad a',
174
+ EmployeeId: 1,
175
+ Total: 100,
176
+ FTE: 1.0,
177
+ Position: { Title: 'Developer', Id: 1 },
178
+ MinutesInternal: '10h 20m',
179
+ MinutesExternal: '10h 20m',
180
+ AmountInternal: 1000,
181
+ AmountExternal: 2000,
182
+ AmountShare: 200,
183
+ Notes: 'Test',
184
+ Rate: '10',
185
+ Time: '10h 00m',
186
+ Amount: 2000
187
+ },
188
+ {
189
+ Id: 2,
190
+ summary: true,
191
+ Description: 'Total asd asd dad ad ada dadad a',
192
+ EmployeeId: 1,
193
+ Total: 100,
194
+ FTE: 1.0,
195
+ Position: { Title: 'Developer', Id: 1 },
196
+ MinutesInternal: '10h 20m',
197
+ MinutesExternal: '10h 20m',
198
+ AmountInternal: 1000,
199
+ AmountExternal: 2000,
200
+ AmountShare: 200,
201
+ Notes: 'Test',
202
+ Rate: '10',
203
+ Time: '10h 00m',
204
+ Amount: 2000
205
+ },
206
+ {
207
+ Id: 2,
208
+ summary: true,
209
+ Description: 'Total asd asd dad ad ada dadad a',
210
+ EmployeeId: 1,
211
+ Total: 100,
212
+ FTE: 1.0,
213
+ Position: { Title: 'Developer', Id: 1 },
214
+ MinutesInternal: '10h 20m',
215
+ MinutesExternal: '10h 20m',
216
+ AmountInternal: 1000,
217
+ AmountExternal: 2000,
218
+ AmountShare: 200,
219
+ Notes: 'Test',
220
+ Rate: '10',
221
+ Time: '10h 00m',
222
+ Amount: 2000
223
+ },
224
+ {
225
+ Id: 2,
226
+ summary: true,
227
+ Description: 'Total asd asd dad ad ada dadad a',
228
+ EmployeeId: 1,
229
+ Total: 100,
230
+ FTE: 1.0,
231
+ Position: { Title: 'Developer', Id: 1 },
232
+ MinutesInternal: '10h 20m',
233
+ MinutesExternal: '10h 20m',
234
+ AmountInternal: 1000,
235
+ AmountExternal: 2000,
236
+ AmountShare: 200,
237
+ Notes: 'Test',
238
+ Rate: '10',
239
+ Time: '10h 00m',
240
+ Amount: 2000
241
+ },
242
+ {
243
+ Id: 2,
244
+ summary: true,
245
+ Description: 'Total asd asd dad ad ada dadad a',
246
+ EmployeeId: 1,
247
+ Total: 100,
248
+ FTE: 1.0,
249
+ Position: { Title: 'Developer', Id: 1 },
250
+ MinutesInternal: '10h 20m',
251
+ MinutesExternal: '10h 20m',
252
+ AmountInternal: 1000,
253
+ AmountExternal: 2000,
254
+ AmountShare: 200,
255
+ Notes: 'Test',
256
+ Rate: '10',
257
+ Time: '10h 00m',
258
+ Amount: 2000
259
+ },
260
+ {
261
+ Id: 2,
262
+ summary: true,
263
+ Description: 'Total asd asd dad ad ada dadad a',
264
+ EmployeeId: 1,
265
+ Total: 100,
266
+ FTE: 1.0,
267
+ Position: { Title: 'Developer', Id: 1 },
268
+ MinutesInternal: '10h 20m',
269
+ MinutesExternal: '10h 20m',
270
+ AmountInternal: 1000,
271
+ AmountExternal: 2000,
272
+ AmountShare: 200,
273
+ Notes: 'Test',
274
+ Rate: '10',
275
+ Time: '10h 00m',
276
+ Amount: 2000
277
+ },
278
+ {
279
+ Id: 2,
280
+ summary: true,
281
+ Description: 'Total asd asd dad ad ada dadad a',
282
+ EmployeeId: 1,
283
+ Total: 100,
284
+ FTE: 1.0,
285
+ Position: { Title: 'Developer', Id: 1 },
286
+ MinutesInternal: '10h 20m',
287
+ MinutesExternal: '10h 20m',
288
+ AmountInternal: 1000,
289
+ AmountExternal: 2000,
290
+ AmountShare: 200,
291
+ Notes: 'Test',
292
+ Rate: '10',
293
+ Time: '10h 00m',
294
+ Amount: 2000
295
+ }
296
+ ],
297
+ schema: {
298
+ "properties": [
299
+ {
300
+ "property": "Description",
301
+ "title": { "en_US": "Description", "uk_UA": "Прізвище" },
302
+ "type": "text",
303
+ "editable": true,
304
+ "sortable": true,
305
+ "filtrable": true,
306
+ icon: 'money',
307
+ width: 200,
308
+ minWidth: 100,
309
+ maxWidth: 300
310
+ },
311
+ {
312
+ "property": "EmployeeId",
313
+ "title": { "en_US": "Employee full name", "uk_UA": "Імʼя" },
314
+ prefix: 'USD',
315
+ "type": "employee",
316
+ "copy": true,
317
+ "editable": true,
318
+ "sortable": false,
319
+ icon: 'card',
320
+ width: 200,
321
+ minWidth: 100,
322
+ maxWidth: 300
323
+ },
324
+ {
325
+ "property": "Rate",
326
+ "title": { "en_US": "Rate", "uk_UA": "Прізвище" },
327
+ "type": "money",
328
+ "editable": true,
329
+ "sortable": false,
330
+ icon: 'calendar',
331
+ width: 200,
332
+ minWidth: 100,
333
+ maxWidth: 300
334
+ },
335
+ {
336
+ "property": "Time",
337
+ "title": { "en_US": "Time", "uk_UA": "Прізвище" },
338
+ "type": "time",
339
+ "editable": true,
340
+ "sortable": false,
341
+ icon: 'person',
342
+ width: 200,
343
+ minWidth: 100,
344
+ maxWidth: 300
345
+ },
346
+ {
347
+ "property": "Amount",
348
+ "title": { "en_US": "Amount", "uk_UA": "Прізвище" },
349
+ "type": "money",
350
+ icon: 'text',
351
+ "sortable": false,
352
+ width: 200,
353
+ minWidth: 100,
354
+ maxWidth: 300
355
+ }
356
+ ]
357
+ },
358
+ filters: [
359
+ {
360
+ "name": "period",
361
+ "type": "period",
362
+ icon: 'calendar',
363
+ "options": {
364
+ "defaultValue": {
365
+ "label": "Весь час",
366
+ "value": null
367
+ }
368
+ }
369
+ },
370
+ {
371
+ "name": "amount",
372
+ "type": "amount",
373
+ icon: 'money',
374
+ "options": {
375
+ "min": 0.05,
376
+ "max": 116907,
377
+ "histogram": [
378
+ 164,
379
+ 10,
380
+ 4,
381
+ 4,
382
+ 2,
383
+ 3,
384
+ 1,
385
+ 4,
386
+ 1,
387
+ 0,
388
+ 1,
389
+ 1,
390
+ 0,
391
+ 0,
392
+ 0,
393
+ 2,
394
+ 1,
395
+ 0,
396
+ 0,
397
+ 0,
398
+ 1,
399
+ 1
400
+ ],
401
+ "defaultValue": {
402
+ "value": [
403
+ 0.05,
404
+ 116907
405
+ ],
406
+ "label": "Будь-яка сума"
407
+ }
408
+ }
409
+ },
410
+ {
411
+ "name": "type",
412
+ "type": "list",
413
+ icon: 'arrows',
414
+ "options": {
415
+ "items": [
416
+ {
417
+ "value": "income",
418
+ "label": "Тільки доходи",
419
+ "text": "Дохідні"
420
+ },
421
+ {
422
+ "value": "outcome",
423
+ "label": "Тільки витрати",
424
+ "text": "Витратні"
425
+ },
426
+ {
427
+ "value": "transfer",
428
+ "label": "Перекази",
429
+ "text": "Перекази"
430
+ },
431
+ {
432
+ "value": "all",
433
+ "label": "Всі операції",
434
+ "text": "Всі"
435
+ }
436
+ ],
437
+ "defaultValue": {
438
+ "value": "all",
439
+ "label": "Всі операції",
440
+ "text": "Всі"
441
+ }
442
+ }
443
+ },
444
+ {
445
+ "name": "accountId",
446
+ "type": "facets-list",
447
+ "options": {
448
+ "multiple": true,
449
+ "title": "Рахунки",
450
+ "items": [
451
+ {
452
+ "value": "wk571",
453
+ "label": "Cash test",
454
+ "count": "8"
455
+ },
456
+ {
457
+ "value": "wrDM1",
458
+ "label": "Ceska",
459
+ "count": "31"
460
+ },
461
+ {
462
+ "value": "e8bEZ",
463
+ "label": "test Account",
464
+ "count": "1"
465
+ },
466
+ {
467
+ "value": "eYvmw",
468
+ "label": "Test2",
469
+ "count": "1"
470
+ },
471
+ {
472
+ "value": "wD54Z",
473
+ "label": "Wise",
474
+ "count": "108"
475
+ },
476
+ {
477
+ "value": "ezJXe",
478
+ "label": "Ukrsib UAH",
479
+ "count": "13"
480
+ },
481
+ {
482
+ "value": "eqxL1",
483
+ "label": "Raiffeisen",
484
+ "count": "10"
485
+ },
486
+ {
487
+ "value": "12gbe",
488
+ "label": "Virtual wallet for refill",
489
+ "count": "3"
490
+ },
491
+ {
492
+ "value": "wOPxZ",
493
+ "label": "Upwork",
494
+ "count": "21"
495
+ },
496
+ {
497
+ "value": "wj58e",
498
+ "label": "Польський банк",
499
+ "count": "3"
500
+ },
501
+ {
502
+ "value": "e47n1",
503
+ "label": "czech account test",
504
+ "count": "1"
505
+ }
506
+ ],
507
+ "total": 200,
508
+ "defaultValue": {
509
+ "label": "Усі рахунки",
510
+ "value": []
511
+ }
512
+ }
513
+ },
514
+ {
515
+ "name": "businessUnitId",
516
+ "type": "facets-list",
517
+ "options": {
518
+ "multiple": true,
519
+ "title": "Бізнес юніти",
520
+ "items": [
521
+ {
522
+ "value": "null",
523
+ "label": "No business unit",
524
+ "count": "39"
525
+ },
526
+ {
527
+ "value": "18edR",
528
+ "label": "BU Main",
529
+ "count": "161"
530
+ }
531
+ ],
532
+ "total": 200,
533
+ "defaultValue": {
534
+ "label": "Усі бізнес юніти",
535
+ "value": []
536
+ }
537
+ }
538
+ }
539
+ ]
540
+ }
541
+ },
542
+ methods: {
543
+ onAdd(title) {
544
+ this.list2.push({ Id: Math.random() });
545
+ }
546
+ },
547
+ template: `<div>
548
+
549
+ <h3>Example</h3>
550
+
551
+ <itf-app>
552
+ <itf-view
553
+ style="height: 500px;"
554
+ add-new-rows
555
+ striped
556
+ @new="onAdd"
557
+ state-name="test"
558
+ :page.sync="page"
559
+ :schema="schema"
560
+ :filters="filters"
561
+ :items="list2"
562
+ v-model="selectedIds"
563
+ show-summary
564
+ id-property="Id"
565
+ :sorting.sync="sorting"
566
+ column-sorting column-resizing show-add-column show-grouping @add-column="onAdd">
567
+ <template #pagination-center>
568
+ <div class="text-muted small d-flex align-items-center">
569
+ <itf-icon name="arrow-up" new />
570
+ 123
571
+ </div>
572
+ </template>
573
+ <template #format.employee="{ item }">
574
+ {{item.EmployeeId}}
575
+ </template>
576
+ <template #edit.employee="{ item }">
577
+ <itf-select
578
+ class="w-100"
579
+ v-model="item.EmployeeId"
580
+ :reduce="item => item.Id"
581
+ :get-option-label="item => item.Name"
582
+ :options="[{ Id: 1, Name: 'Vitalii Savchuk' }]" />
583
+ </template>
584
+ </itf-view>
585
+ </itf-app>
586
+
587
+ </div>`,
588
+ }))
@@ -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