@fibery/views 17.0.4 → 18.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/lib/index.js +17 -0
  2. package/lib/jest.config.d.ts +2 -0
  3. package/lib/jest.config.js +33 -0
  4. package/lib/src/field-utils/avatar.d.ts +20 -0
  5. package/lib/src/field-utils/avatar.js +42 -0
  6. package/lib/src/field-utils/back-references.d.ts +15 -0
  7. package/lib/src/field-utils/back-references.js +21 -0
  8. package/lib/src/field-utils/comments.d.ts +60 -0
  9. package/lib/src/field-utils/comments.js +46 -0
  10. package/lib/src/field-utils/date-time.d.ts +14 -0
  11. package/lib/src/field-utils/date-time.js +56 -0
  12. package/lib/src/field-utils/enum-value.d.ts +13 -0
  13. package/lib/src/field-utils/enum-value.js +29 -0
  14. package/lib/src/field-utils/file.d.ts +4 -0
  15. package/lib/src/field-utils/file.js +18 -0
  16. package/lib/src/field-utils/icon.d.ts +10 -0
  17. package/lib/src/field-utils/icon.js +26 -0
  18. package/lib/src/field-utils/number.d.ts +31 -0
  19. package/lib/src/field-utils/number.js +91 -0
  20. package/lib/src/field-utils/reference-collection.d.ts +18 -0
  21. package/lib/src/field-utils/reference-collection.js +45 -0
  22. package/lib/src/field-utils/reference.d.ts +7 -0
  23. package/lib/src/field-utils/reference.js +57 -0
  24. package/lib/src/field-utils/relation-view.d.ts +2 -0
  25. package/lib/src/field-utils/relation-view.js +12 -0
  26. package/lib/src/field-utils/rich-text.d.ts +12 -0
  27. package/lib/src/field-utils/rich-text.js +27 -0
  28. package/lib/src/field-utils/text.d.ts +35 -0
  29. package/lib/src/field-utils/text.js +40 -0
  30. package/lib/src/field-utils/user-active.d.ts +8 -0
  31. package/lib/src/field-utils/user-active.js +28 -0
  32. package/lib/src/field-utils/user-role.d.ts +6 -0
  33. package/lib/src/field-utils/user-role.js +25 -0
  34. package/lib/src/field-utils/workflow.d.ts +15 -0
  35. package/lib/src/field-utils/workflow.js +56 -0
  36. package/lib/src/index.d.ts +16 -0
  37. package/lib/src/index.js +258 -0
  38. package/lib/src/private/board.d.ts +11 -0
  39. package/lib/src/private/board.js +326 -0
  40. package/lib/src/private/calendar.d.ts +10 -0
  41. package/lib/src/private/calendar.js +122 -0
  42. package/lib/src/private/feed.d.ts +10 -0
  43. package/lib/src/private/feed.js +119 -0
  44. package/lib/src/private/form.d.ts +3 -0
  45. package/lib/src/private/form.js +61 -0
  46. package/lib/src/private/map.d.ts +10 -0
  47. package/lib/src/private/map.js +119 -0
  48. package/lib/src/private/smart-folder.d.ts +23 -0
  49. package/lib/src/private/smart-folder.js +274 -0
  50. package/lib/src/private/test-data/garbage-test.d.ts +649 -0
  51. package/lib/src/private/test-data/garbage-test.js +520 -0
  52. package/lib/src/private/test-data/kanban.d.ts +1123 -0
  53. package/lib/src/private/test-data/kanban.js +1203 -0
  54. package/lib/src/private/test-data/tasks.d.ts +3216 -0
  55. package/lib/src/private/test-data/tasks.js +2731 -0
  56. package/lib/src/private/timeline.d.ts +10 -0
  57. package/lib/src/private/timeline.js +323 -0
  58. package/lib/src/private/units.d.ts +6 -0
  59. package/lib/src/private/units.js +144 -0
  60. package/lib/src/private/utils.d.ts +17 -0
  61. package/lib/src/private/utils.js +267 -0
  62. package/lib/src/tsfixme.d.ts +1 -0
  63. package/lib/src/tsfixme.js +2 -0
  64. package/lib/src/unit-definitions/avatar-collection.d.ts +2 -0
  65. package/lib/src/unit-definitions/avatar-collection.js +53 -0
  66. package/lib/src/unit-definitions/avatar-input.d.ts +2 -0
  67. package/lib/src/unit-definitions/avatar-input.js +12 -0
  68. package/lib/src/unit-definitions/avatar.d.ts +2 -0
  69. package/lib/src/unit-definitions/avatar.js +80 -0
  70. package/lib/src/unit-definitions/back-references-list.d.ts +2 -0
  71. package/lib/src/unit-definitions/back-references-list.js +38 -0
  72. package/lib/src/unit-definitions/bool-checkbox.d.ts +2 -0
  73. package/lib/src/unit-definitions/bool-checkbox.js +25 -0
  74. package/lib/src/unit-definitions/bool.d.ts +2 -0
  75. package/lib/src/unit-definitions/bool.js +22 -0
  76. package/lib/src/unit-definitions/collection-count.d.ts +2 -0
  77. package/lib/src/unit-definitions/collection-count.js +32 -0
  78. package/lib/src/unit-definitions/color-input.d.ts +2 -0
  79. package/lib/src/unit-definitions/color-input.js +21 -0
  80. package/lib/src/unit-definitions/comments-list.d.ts +2 -0
  81. package/lib/src/unit-definitions/comments-list.js +25 -0
  82. package/lib/src/unit-definitions/date-range-combobox.d.ts +2 -0
  83. package/lib/src/unit-definitions/date-range-combobox.js +22 -0
  84. package/lib/src/unit-definitions/date-range.d.ts +2 -0
  85. package/lib/src/unit-definitions/date-range.js +22 -0
  86. package/lib/src/unit-definitions/date-time-combobox.d.ts +2 -0
  87. package/lib/src/unit-definitions/date-time-combobox.js +22 -0
  88. package/lib/src/unit-definitions/date.d.ts +2 -0
  89. package/lib/src/unit-definitions/date.js +22 -0
  90. package/lib/src/unit-definitions/email-input.d.ts +2 -0
  91. package/lib/src/unit-definitions/email-input.js +12 -0
  92. package/lib/src/unit-definitions/email.d.ts +2 -0
  93. package/lib/src/unit-definitions/email.js +17 -0
  94. package/lib/src/unit-definitions/emoji.d.ts +2 -0
  95. package/lib/src/unit-definitions/emoji.js +17 -0
  96. package/lib/src/unit-definitions/file-collection-count.d.ts +2 -0
  97. package/lib/src/unit-definitions/file-collection-count.js +30 -0
  98. package/lib/src/unit-definitions/file-compact-collection.d.ts +2 -0
  99. package/lib/src/unit-definitions/file-compact-collection.js +30 -0
  100. package/lib/src/unit-definitions/file-compact-reference.d.ts +2 -0
  101. package/lib/src/unit-definitions/file-compact-reference.js +36 -0
  102. package/lib/src/unit-definitions/file-reference.d.ts +2 -0
  103. package/lib/src/unit-definitions/file-reference.js +26 -0
  104. package/lib/src/unit-definitions/files-gallery.d.ts +2 -0
  105. package/lib/src/unit-definitions/files-gallery.js +30 -0
  106. package/lib/src/unit-definitions/files-l-list-item.d.ts +2 -0
  107. package/lib/src/unit-definitions/files-l-list-item.js +26 -0
  108. package/lib/src/unit-definitions/files-l-list.d.ts +2 -0
  109. package/lib/src/unit-definitions/files-l-list.js +30 -0
  110. package/lib/src/unit-definitions/files-list-item.d.ts +2 -0
  111. package/lib/src/unit-definitions/files-list-item.js +26 -0
  112. package/lib/src/unit-definitions/files-list.d.ts +2 -0
  113. package/lib/src/unit-definitions/files-list.js +30 -0
  114. package/lib/src/unit-definitions/geometry-preview.d.ts +2 -0
  115. package/lib/src/unit-definitions/geometry-preview.js +17 -0
  116. package/lib/src/unit-definitions/icon-button.d.ts +2 -0
  117. package/lib/src/unit-definitions/icon-button.js +29 -0
  118. package/lib/src/unit-definitions/icon-input.d.ts +2 -0
  119. package/lib/src/unit-definitions/icon-input.js +12 -0
  120. package/lib/src/unit-definitions/id.d.ts +2 -0
  121. package/lib/src/unit-definitions/id.js +29 -0
  122. package/lib/src/unit-definitions/index.d.ts +27 -0
  123. package/lib/src/unit-definitions/index.js +57 -0
  124. package/lib/src/unit-definitions/json-input.d.ts +2 -0
  125. package/lib/src/unit-definitions/json-input.js +21 -0
  126. package/lib/src/unit-definitions/location-input.d.ts +2 -0
  127. package/lib/src/unit-definitions/location-input.js +18 -0
  128. package/lib/src/unit-definitions/location.d.ts +2 -0
  129. package/lib/src/unit-definitions/location.js +17 -0
  130. package/lib/src/unit-definitions/not-found.d.ts +2 -0
  131. package/lib/src/unit-definitions/not-found.js +24 -0
  132. package/lib/src/unit-definitions/number-input.d.ts +2 -0
  133. package/lib/src/unit-definitions/number-input.js +22 -0
  134. package/lib/src/unit-definitions/number.d.ts +2 -0
  135. package/lib/src/unit-definitions/number.js +27 -0
  136. package/lib/src/unit-definitions/phone-input.d.ts +2 -0
  137. package/lib/src/unit-definitions/phone-input.js +12 -0
  138. package/lib/src/unit-definitions/phone.d.ts +2 -0
  139. package/lib/src/unit-definitions/phone.js +12 -0
  140. package/lib/src/unit-definitions/progress-bar.d.ts +2 -0
  141. package/lib/src/unit-definitions/progress-bar.js +32 -0
  142. package/lib/src/unit-definitions/reference-collection-combobox.d.ts +2 -0
  143. package/lib/src/unit-definitions/reference-collection-combobox.js +21 -0
  144. package/lib/src/unit-definitions/reference-collection-list.d.ts +2 -0
  145. package/lib/src/unit-definitions/reference-collection-list.js +22 -0
  146. package/lib/src/unit-definitions/reference-collection-view.d.ts +2 -0
  147. package/lib/src/unit-definitions/reference-collection-view.js +19 -0
  148. package/lib/src/unit-definitions/reference-collection.d.ts +2 -0
  149. package/lib/src/unit-definitions/reference-collection.js +27 -0
  150. package/lib/src/unit-definitions/reference-combobox.d.ts +2 -0
  151. package/lib/src/unit-definitions/reference-combobox.js +21 -0
  152. package/lib/src/unit-definitions/reference-icon.d.ts +2 -0
  153. package/lib/src/unit-definitions/reference-icon.js +12 -0
  154. package/lib/src/unit-definitions/reference.d.ts +2 -0
  155. package/lib/src/unit-definitions/reference.js +49 -0
  156. package/lib/src/unit-definitions/rich-text-document.d.ts +2 -0
  157. package/lib/src/unit-definitions/rich-text-document.js +22 -0
  158. package/lib/src/unit-definitions/rich-text-snippet.d.ts +2 -0
  159. package/lib/src/unit-definitions/rich-text-snippet.js +39 -0
  160. package/lib/src/unit-definitions/single-location-preview.d.ts +2 -0
  161. package/lib/src/unit-definitions/single-location-preview.js +17 -0
  162. package/lib/src/unit-definitions/text-input.d.ts +2 -0
  163. package/lib/src/unit-definitions/text-input.js +22 -0
  164. package/lib/src/unit-definitions/text.d.ts +2 -0
  165. package/lib/src/unit-definitions/text.js +22 -0
  166. package/lib/src/unit-definitions/title-input.d.ts +2 -0
  167. package/lib/src/unit-definitions/title-input.js +16 -0
  168. package/lib/src/unit-definitions/title.d.ts +2 -0
  169. package/lib/src/unit-definitions/title.js +34 -0
  170. package/lib/src/unit-definitions/type-badge-abbr.d.ts +2 -0
  171. package/lib/src/unit-definitions/type-badge-abbr.js +25 -0
  172. package/lib/src/unit-definitions/type-badge.d.ts +2 -0
  173. package/lib/src/unit-definitions/type-badge.js +25 -0
  174. package/lib/src/unit-definitions/type-icon.d.ts +2 -0
  175. package/lib/src/unit-definitions/type-icon.js +25 -0
  176. package/lib/src/unit-definitions/url-input.d.ts +2 -0
  177. package/lib/src/unit-definitions/url-input.js +12 -0
  178. package/lib/src/unit-definitions/url.d.ts +2 -0
  179. package/lib/src/unit-definitions/url.js +17 -0
  180. package/lib/src/unit-definitions/user-button.d.ts +2 -0
  181. package/lib/src/unit-definitions/user-button.js +23 -0
  182. package/lib/src/unit-definitions/user-role-input.d.ts +2 -0
  183. package/lib/src/unit-definitions/user-role-input.js +12 -0
  184. package/lib/src/unit-definitions/user-role.d.ts +2 -0
  185. package/lib/src/unit-definitions/user-role.js +29 -0
  186. package/lib/src/unit-utils/access.d.ts +9 -0
  187. package/lib/src/unit-utils/access.js +14 -0
  188. package/lib/src/unit-utils/can-edit-field.d.ts +6 -0
  189. package/lib/src/unit-utils/can-edit-field.js +8 -0
  190. package/lib/src/unit-utils/common.d.ts +14 -0
  191. package/lib/src/unit-utils/common.js +43 -0
  192. package/lib/src/unit-utils/decimal.d.ts +42 -0
  193. package/lib/src/unit-utils/decimal.js +414 -0
  194. package/lib/src/unit-utils/dynamic-keys.d.ts +7 -0
  195. package/lib/src/unit-utils/dynamic-keys.js +13 -0
  196. package/lib/src/unit-utils/enums.d.ts +27 -0
  197. package/lib/src/unit-utils/enums.js +69 -0
  198. package/lib/src/unit-utils/formatters.d.ts +50 -0
  199. package/lib/src/unit-utils/formatters.js +163 -0
  200. package/lib/src/unit-utils/get-export-value.d.ts +45 -0
  201. package/lib/src/unit-utils/get-export-value.js +83 -0
  202. package/lib/src/unit-utils/get-field-label.d.ts +6 -0
  203. package/lib/src/unit-utils/get-field-label.js +10 -0
  204. package/lib/src/unit-utils/get-unmatched-unit-label.d.ts +2 -0
  205. package/lib/src/unit-utils/get-unmatched-unit-label.js +9 -0
  206. package/lib/src/unit-utils/schema.d.ts +4 -0
  207. package/lib/src/unit-utils/schema.js +12 -0
  208. package/lib/src/units/board.d.ts +43 -0
  209. package/lib/src/units/board.js +51 -0
  210. package/lib/src/units/canvas/all-units-data-definitions.d.ts +18 -0
  211. package/lib/src/units/canvas/all-units-data-definitions.js +40 -0
  212. package/lib/src/units/canvas/index.d.ts +42 -0
  213. package/lib/src/units/canvas/index.js +48 -0
  214. package/lib/src/units/canvas/type-badge-abbr.d.ts +36 -0
  215. package/lib/src/units/canvas/type-badge-abbr.js +11 -0
  216. package/lib/src/units/canvas/type-badge.d.ts +36 -0
  217. package/lib/src/units/canvas/type-badge.js +11 -0
  218. package/lib/src/units/default.d.ts +43 -0
  219. package/lib/src/units/default.js +51 -0
  220. package/lib/src/units/gallery.d.ts +3 -0
  221. package/lib/src/units/gallery.js +18 -0
  222. package/lib/src/units/gantt.d.ts +44 -0
  223. package/lib/src/units/gantt.js +59 -0
  224. package/lib/src/units/get-unit-definitions-for-view-type.d.ts +2 -0
  225. package/lib/src/units/get-unit-definitions-for-view-type.js +64 -0
  226. package/lib/src/units/grid.d.ts +42 -0
  227. package/lib/src/units/grid.js +67 -0
  228. package/lib/src/units/list.d.ts +43 -0
  229. package/lib/src/units/list.js +49 -0
  230. package/lib/src/units/make-factory.d.ts +50 -0
  231. package/lib/src/units/make-factory.js +245 -0
  232. package/lib/src/units/types.d.ts +73 -0
  233. package/lib/src/units/types.js +2 -0
  234. package/package.json +42 -52
  235. package/lib/views.js +0 -1813
  236. /package/{index.js → lib/index.d.ts} +0 -0
package/lib/views.js DELETED
@@ -1,1813 +0,0 @@
1
- var immutableUpdate = require('immutability-helper');
2
- var _ = require('lodash');
3
- var utils = require('@fibery/expression-utils/src/utils');
4
- var visitors = require('@fibery/expression-utils/src/visitors');
5
-
6
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
7
-
8
- var immutableUpdate__default = /*#__PURE__*/_interopDefaultLegacy(immutableUpdate);
9
- var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
10
-
11
- // Return this symbol from a visitor callback to remove the node from the
12
- // output. Not supported in all places, add support as needed.
13
- const REMOVE = Symbol("remove");
14
- function visitDeleteExpressionInFilterGroup(filter, visitExpression) {
15
- if (filter.kind !== "group") {
16
- return null;
17
- }
18
- const value = filter.value.map(nestedFilter => {
19
- if (nestedFilter.kind === "group") {
20
- return visitFilterGroup(nestedFilter, visitExpression);
21
- }
22
- const expression = nestedFilter.value.expression ? visitExpression(nestedFilter.value.expression) : null;
23
- if (!expression) {
24
- return null;
25
- }
26
- return {
27
- ...nestedFilter,
28
- value: {
29
- ...nestedFilter.value,
30
- expression: expression
31
- }
32
- };
33
- }).filter(Boolean);
34
- if (value.length === 0) {
35
- return null;
36
- }
37
- return {
38
- ...filter,
39
- value: value
40
- };
41
- }
42
- const deleteExpressionWithNotFoundFieldsOrTypesInFilter = (schema, fromType, filter) => {
43
- return visitDeleteExpressionInFilterGroup(filter, expression => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression));
44
- };
45
- const deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression = (schema, queryExpression) => {
46
- const {
47
- "q/from": fromExpression,
48
- "q/where": whereExpression,
49
- "q/order-by": orderByExpression
50
- } = queryExpression;
51
- if (schema.typeObjectsByName.hasOwnProperty(fromExpression)) {
52
- const typeObject = schema.typeObjectsByName[fromExpression];
53
- return ___default["default"].pickBy({
54
- ...queryExpression,
55
- ...(whereExpression ? {
56
- "q/where": visitors.deleteExpressionsWithNotFoundFieldsVisitor(typeObject).visitExpression(whereExpression)
57
- } : null),
58
- ...(orderByExpression ? {
59
- "q/order-by": visitors.deleteExpressionsWithNotFoundFieldsVisitor(typeObject).visitOrderByExpression(orderByExpression)
60
- } : null)
61
- });
62
- }
63
- return null;
64
- };
65
- const replaceNamesWithIdsInExpression = (schema, fromType, expression) => {
66
- if (schema.typeObjectsByName.hasOwnProperty(fromType)) {
67
- const typeObject = schema.typeObjectsByName[fromType];
68
- return visitors.replaceNamesWithIdsVisitor(typeObject).visitExpression(expression);
69
- }
70
- return expression;
71
- };
72
- const replaceIdsWithNamesInExpression = (schema, fromTypeId, expression) => {
73
- if (schema.typeObjectsById.hasOwnProperty(fromTypeId)) {
74
- const typeObject = schema.typeObjectsById[fromTypeId];
75
- return visitors.replaceIdsWithNamesVisitor(typeObject).visitExpression(expression);
76
- }
77
- return expression;
78
- };
79
- const visitViewUnit = (fromType, unit, visitor) => {
80
- const {
81
- expression
82
- } = unit;
83
- if (expression) {
84
- return {
85
- ...unit,
86
- ...{
87
- expression: visitor.visitExpression(fromType, expression)
88
- }
89
- };
90
- }
91
- return unit;
92
- };
93
- const visitContextExpression = (fromType, contextExpression, visitor) => {
94
- const visitContextExpression = visitor.visitContextExpression ? visitor.visitContextExpression : visitor.visitExpression;
95
- return contextExpression ? visitContextExpression(fromType, contextExpression) : contextExpression;
96
- };
97
- const replaceIdsWithNamesInQueryExpression = (schema, queryExpression) => {
98
- const {
99
- "q/from": fromExpression,
100
- "q/where": whereExpression,
101
- "q/order-by": orderByExpression
102
- } = queryExpression;
103
- if (schema.typeObjectsById.hasOwnProperty(fromExpression)) {
104
- const typeObject = schema.typeObjectsById[fromExpression];
105
- return {
106
- ...queryExpression,
107
- ...{
108
- "q/from": typeObject.name
109
- },
110
- ...(whereExpression ? {
111
- "q/where": visitors.replaceIdsWithNamesVisitor(typeObject).visitExpression(whereExpression)
112
- } : null),
113
- ...(orderByExpression ? {
114
- "q/order-by": visitors.replaceIdsWithNamesVisitor(typeObject).visitOrderByExpression(orderByExpression)
115
- } : null)
116
- };
117
- }
118
- return queryExpression;
119
- };
120
- function visitFilterGroup(filter, visitExpression, type) {
121
- if (filter.kind !== "group") {
122
- return null;
123
- }
124
- return {
125
- ...filter,
126
- value: filter.value.map(nestedFilter => {
127
- if (nestedFilter.kind === "group") {
128
- return visitFilterGroup(nestedFilter, visitExpression);
129
- }
130
- return {
131
- ...nestedFilter,
132
- value: {
133
- ...nestedFilter.value,
134
- expression: nestedFilter.value.expression ? visitExpression(nestedFilter.value.expression) : null
135
- }
136
- };
137
- })
138
- };
139
- }
140
- const replaceIdsWithNamesInFilter = (schema, fromType, filter) => {
141
- if (schema.typeObjectsById.hasOwnProperty(fromType)) {
142
- const typeObject = schema.typeObjectsById[fromType];
143
- return filter ? visitFilterGroup(filter, expression => visitors.replaceIdsWithNamesVisitor(typeObject).visitExpression(expression)) : null;
144
- }
145
- return filter;
146
- };
147
- const replaceNamesWithIdsInFilter = (schema, fromType, filter) => {
148
- if (schema.typeObjectsByName.hasOwnProperty(fromType)) {
149
- const typeObject = schema.typeObjectsByName[fromType];
150
- return filter ? visitFilterGroup(filter, expression => visitors.replaceNamesWithIdsVisitor(typeObject).visitExpression(expression)) : null;
151
- }
152
- return filter;
153
- };
154
- const replaceNamesWithIdsInQueryExpression = (schema, queryExpression) => {
155
- const {
156
- "q/from": fromExpression,
157
- "q/where": whereExpression,
158
- "q/order-by": orderByExpression
159
- } = queryExpression;
160
- if (schema.typeObjectsByName.hasOwnProperty(fromExpression)) {
161
- const typeObject = schema.typeObjectsByName[fromExpression];
162
- return {
163
- ...queryExpression,
164
- ...{
165
- "q/from": typeObject.id
166
- },
167
- ...(whereExpression ? {
168
- "q/where": visitors.replaceNamesWithIdsVisitor(typeObject).visitExpression(whereExpression)
169
- } : null),
170
- ...(orderByExpression ? {
171
- "q/order-by": visitors.replaceNamesWithIdsVisitor(typeObject).visitOrderByExpression(orderByExpression)
172
- } : null)
173
- };
174
- }
175
- return queryExpression;
176
- };
177
- const deleteExpressionWithNotFoundFieldsOrTypesInExpression = (schema, fromType, expression) => {
178
- if (schema.typeObjectsByName.hasOwnProperty(fromType)) {
179
- const typeObject = schema.typeObjectsByName[fromType];
180
- return visitors.deleteExpressionsWithNotFoundFieldsVisitor(typeObject).visitExpression(expression);
181
- }
182
- return null;
183
- };
184
- const resetContextExpressionIfBroken = (schema, fromType, expression, defaultExpression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression) || defaultExpression;
185
- const isUnitExpressionValid = unit => {
186
- if (unit.hasOwnProperty("expression")) {
187
- const {
188
- expression
189
- } = unit;
190
- return expression !== null;
191
- }
192
- return true;
193
- };
194
- const getFieldObjectsById = (smartFolder, schema) => {
195
- const types = smartFolder["fibery/meta"].items.map(item => item.query["q/from"]);
196
- return types.reduce((acc, type) => {
197
- if (!(type in schema.typeObjectsById)) {
198
- return acc;
199
- }
200
- const fieldObjects = schema.typeObjectsById[type].fieldObjectsById;
201
- return {
202
- ...acc,
203
- ...fieldObjects
204
- };
205
- }, {});
206
- };
207
- const replaceIdsWithNamesInUnitGroupKey = (unitGroupKey, fieldObjectsById) => {
208
- const keyParts = unitGroupKey.split("|");
209
- return keyParts.map(keyPart => {
210
- const [unitType, ...rest] = keyPart.split("_");
211
- if (unitType === "user-button") {
212
- return keyPart;
213
- }
214
- const fieldId = rest.join("_");
215
- if (!fieldId) {
216
- return keyPart;
217
- }
218
- const fieldObject = fieldObjectsById[fieldId];
219
- if (!fieldObject) {
220
- return keyPart;
221
- }
222
- return `${unitType}_${fieldObject.holderType}:${fieldObject.name}`;
223
- }).filter(Boolean).join("|");
224
- };
225
- const replaceNamesWithIdsInUnitGroupKey = (unitGroupKey, schema) => {
226
- const keyParts = unitGroupKey.split("|");
227
- return keyParts.map(keyPart => {
228
- const [unitType, ...rest] = keyPart.split("_");
229
- if (unitType === "user-button") {
230
- return keyPart;
231
- }
232
- const name = rest.join("_");
233
- if (!name) {
234
- return keyPart;
235
- }
236
- const [type, field] = name.split(":");
237
- if (!field) {
238
- return keyPart;
239
- }
240
- if (!(type in schema.typeObjectsByName)) {
241
- return keyPart;
242
- }
243
- const typeObject = schema.typeObjectsByName[type];
244
- if (!(field in typeObject.fieldObjectsByName)) {
245
- return keyPart;
246
- }
247
- const fieldObject = typeObject.fieldObjectsByName[field];
248
- return `${unitType}_${fieldObject.id}`;
249
- }).filter(Boolean).join("|");
250
- };
251
-
252
- const getField = (schema, fromType, field) => Object.hasOwn(schema.typeObjectsByName, fromType) && Object.hasOwn(schema.typeObjectsByName[fromType].fieldObjectsByName, field) ? schema.typeObjectsByName[fromType].fieldObjectsByName[field] : undefined;
253
- const getFieldType = (schema, fromType, field) => {
254
- var _getField;
255
- return (_getField = getField(schema, fromType, field)) == null ? void 0 : _getField.type;
256
- };
257
- const getFieldMeta = (schema, fromType, field) => {
258
- var _getField2;
259
- return (_getField2 = getField(schema, fromType, field)) == null ? void 0 : _getField2.rawMeta;
260
- };
261
- const getUnitTypeForTextField = fieldMeta => {
262
- switch (fieldMeta["ui/type"]) {
263
- case "email":
264
- return "email";
265
- case "url":
266
- return "url";
267
- case "phone":
268
- return "phone";
269
- default:
270
- return "text";
271
- }
272
- };
273
- const getUnitKind = unit => {
274
- if (unit.type === "user-button") {
275
- return "user-button";
276
- }
277
- if (["type-icon", "type-badge", "type-badge-abbr"].includes(unit.type)) {
278
- return "db";
279
- }
280
- return "field";
281
- };
282
- const migrateUnit = (schema, fromType, unit, units) => {
283
- const {
284
- type,
285
- expression
286
- } = unit;
287
- const kind = unit.kind || getUnitKind(unit);
288
- if (type === "date-time") {
289
- return {
290
- ...unit,
291
- kind,
292
- type: "date"
293
- };
294
- }
295
- if (type === "date-time-range") {
296
- return {
297
- ...unit,
298
- kind,
299
- type: "date-range"
300
- };
301
- }
302
- if (type === "text") {
303
- const [field] = expression;
304
- const fieldType = getFieldType(schema, fromType, field);
305
- if (fieldType === "fibery/email") {
306
- return {
307
- ...unit,
308
- kind,
309
- type: "email"
310
- };
311
- }
312
- }
313
- if (["text", "email", "phone", "url"].includes(type)) {
314
- const [field] = expression;
315
- if (getFieldType(schema, fromType, field) === "fibery/text") {
316
- return {
317
- ...unit,
318
- kind,
319
- type: getUnitTypeForTextField(getFieldMeta(schema, fromType, field))
320
- };
321
- }
322
- }
323
- if (type === "files-collection") {
324
- const [field] = expression;
325
- if (getFieldType(schema, fromType, field) === "fibery/file") {
326
- return {
327
- ...unit,
328
- kind,
329
- type: "collection-count"
330
- };
331
- }
332
- }
333
- if (type === "avatar" && !expression) {
334
- var _schema$typeObjectsBy;
335
- const isAvatarExntensionEnabled = (_schema$typeObjectsBy = schema.typeObjectsByName[fromType]) == null ? void 0 : _schema$typeObjectsBy.installedMixins.has("avatar/avatar-mixin");
336
- const hasAvatarExntensionField = getFieldType(schema, fromType, "avatar/avatars") === "fibery/file";
337
- if (isAvatarExntensionEnabled && hasAvatarExntensionField) {
338
- return {
339
- ...unit,
340
- expression: ["avatar/avatars"],
341
- kind
342
- };
343
- }
344
- }
345
- return {
346
- ...unit,
347
- kind
348
- };
349
- };
350
- const fixViewUnit = (schema, fromType, unit, units, {
351
- unitDefinitions,
352
- getDefaultUnitTypeForField
353
- }) => {
354
- var _unit$expression;
355
- const migrated = migrateUnit(schema, fromType, unit);
356
- const field = (_unit$expression = unit.expression) == null ? void 0 : _unit$expression[0];
357
- const fieldObject = getField(schema, fromType, field);
358
- if (fieldObject) {
359
- const allowedUnits = unitDefinitions.getUnitsForField(fieldObject);
360
- if (allowedUnits.some(u => u.type === migrated.type)) {
361
- return migrated;
362
- } else {
363
- if (unit.checked) {
364
- const otherUnitsForField = units.filter(u => u !== unit && u.expression && u.expression[0] === field);
365
- const hasEnabledUnitForField = otherUnitsForField.some(u => u.checked);
366
- if (hasEnabledUnitForField) {
367
- return REMOVE;
368
- }
369
- const defaultUnitType = getDefaultUnitTypeForField(fieldObject, allowedUnits);
370
- const defaultUnit = defaultUnitType && otherUnitsForField.find(u => u.type === defaultUnitType) || otherUnitsForField[0];
371
- if (defaultUnit) {
372
- defaultUnit.checked = true;
373
- return REMOVE;
374
- }
375
- } else {
376
- return REMOVE;
377
- }
378
- }
379
- }
380
- return migrated;
381
- };
382
- const enableHideWhenEmptyForCheckedEditableUnit = unit => {
383
- if (unit.checked) {
384
- return {
385
- ...unit,
386
- hideWhenEmpty: true
387
- };
388
- }
389
- return unit;
390
- };
391
-
392
- const visitQueryExpressionHolder = (queryHolder, visitor) => {
393
- if (queryHolder) {
394
- const {
395
- query,
396
- filter
397
- } = queryHolder;
398
- const newQueryHolder = {
399
- ...queryHolder
400
- };
401
- if (query) {
402
- const queryNew = visitor.visitQueryExpression(query);
403
- if (queryNew) {
404
- newQueryHolder.query = queryNew;
405
- } else {
406
- return null;
407
- }
408
- const {
409
- "q/from": fromType
410
- } = query;
411
- if (filter && fromType) {
412
- const filterNew = visitor.visitFilter(fromType, filter);
413
- if (filterNew) {
414
- newQueryHolder.filter = filterNew;
415
- } else {
416
- newQueryHolder.filter = null;
417
- }
418
- }
419
- }
420
- return newQueryHolder;
421
- }
422
- return queryHolder;
423
- };
424
- const visitAxisUnits = (axis, fromType, visitor) => {
425
- return fromType ? immutableUpdate__default["default"](axis, {
426
- contextExpression: {
427
- $apply: contextExpression => visitContextExpression(fromType, contextExpression, visitor)
428
- },
429
- units: {
430
- $apply: units => units ? units.filter(unit => Boolean(unit)).map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE) : undefined
431
- }
432
- }) : axis;
433
- };
434
- const visitAxis$1 = (axis, visitor) => {
435
- if (axis && axis.hasOwnProperty("query")) {
436
- const fromType = ___default["default"].get(axis, ["query", "q/from"]);
437
- const axisWithVisitedQuery = visitQueryExpressionHolder(axis, visitor);
438
- if (axisWithVisitedQuery) {
439
- return visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
440
- }
441
- return axisWithVisitedQuery;
442
- }
443
- if (axis && axis.hasOwnProperty("enums")) {
444
- const axisNew = immutableUpdate__default["default"](axis, {
445
- enums: {
446
- $apply: enums => visitor.visitEnums(enums)
447
- }
448
- });
449
- const {
450
- enums
451
- } = axisNew;
452
- return enums ? axisNew : null;
453
- }
454
- return axis;
455
- };
456
- const isAxisFieldExpression = expression => utils.isFieldExpression(expression) && expression.length === 1;
457
- const ensureAxisAndItemExpressionInvariant$1 = view => {
458
- const actions = [];
459
- const x = ___default["default"].get(view, ["fibery/meta", "x"]);
460
- const y = ___default["default"].get(view, ["fibery/meta", "y"]);
461
- const items = ___default["default"].get(view, ["fibery/meta", "items"]);
462
- if (x === null) {
463
- const resetActions = items.map(item => () => item.xExpression = null);
464
- actions.push(...resetActions);
465
- }
466
- if (x !== null && ___default["default"].some(items, ({
467
- xExpression
468
- }) => xExpression === null)) {
469
- const resetActions = items.map(item => () => item.xExpression = null);
470
- actions.push(...resetActions);
471
- actions.push(() => ___default["default"].set(view, ["fibery/meta", "x"], null));
472
- }
473
- if (y === null) {
474
- const resetActions = items.map(item => () => item.yExpression = null);
475
- actions.push(...resetActions);
476
- }
477
- if (y !== null && ___default["default"].some(items, ({
478
- yExpression
479
- }) => yExpression === null)) {
480
- const resetActions = items.map(item => () => item.yExpression = null);
481
- actions.push(...resetActions);
482
- actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
483
- }
484
- if (x !== null && ___default["default"].isEmpty(items)) {
485
- actions.push(() => ___default["default"].set(view, ["fibery/meta", "x"], null));
486
- }
487
- if (y !== null && ___default["default"].isEmpty(items)) {
488
- actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
489
- }
490
- if (x !== null && ___default["default"].some(items, ({
491
- xExpression
492
- }) => !isAxisFieldExpression(xExpression))) {
493
- const resetActions = items.map(item => () => item.xExpression = null);
494
- actions.push(...resetActions);
495
- actions.push(() => ___default["default"].set(view, ["fibery/meta", "x"], null));
496
- }
497
- if (y !== null && ___default["default"].some(items, ({
498
- yExpression
499
- }) => !isAxisFieldExpression(yExpression))) {
500
- const resetActions = items.map(item => () => item.yExpression = null);
501
- actions.push(...resetActions);
502
- actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
503
- }
504
- actions.forEach(action => action());
505
- return view;
506
- };
507
- const visitView$4 = (view, visitor) => immutableUpdate__default["default"](view, {
508
- "fibery/meta": {
509
- x: {
510
- $apply: x => visitAxis$1(x, visitor)
511
- },
512
- y: {
513
- $apply: y => visitAxis$1(y, visitor)
514
- },
515
- items: {
516
- $apply: items => {
517
- if (!items) {
518
- return [];
519
- }
520
- return items.map(item => {
521
- const fromType = ___default["default"].get(item, ["query", "q/from"]);
522
- return fromType ? immutableUpdate__default["default"](item, {
523
- coverExpression: {
524
- $apply: coverExpression => coverExpression ? visitor.visitExpression(fromType, coverExpression) : coverExpression
525
- },
526
- xExpression: {
527
- $apply: xExpression => xExpression ? visitor.visitExpression(fromType, xExpression) : xExpression
528
- },
529
- yExpression: {
530
- $apply: yExpression => yExpression ? visitor.visitExpression(fromType, yExpression) : yExpression
531
- },
532
- contextExpression: {
533
- $apply: contextExpression => visitContextExpression(fromType, contextExpression, visitor)
534
- },
535
- query: {
536
- $apply: query => query ? visitor.visitQueryExpression(query) : null
537
- },
538
- filter: {
539
- $apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
540
- },
541
- units: {
542
- $apply: units => units ? units.filter(unit => Boolean(unit)).map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE) : undefined
543
- },
544
- colorCoding: {
545
- $apply: colorCodings => {
546
- return colorCodings ? colorCodings.map(colorCoding => ({
547
- ...colorCoding,
548
- expression: visitor.visitExpression(fromType, colorCoding.expression)
549
- })).filter(colorCoding => colorCoding.expression !== null) : undefined;
550
- }
551
- }
552
- }) : item;
553
- }).filter(item => {
554
- const {
555
- query
556
- } = item;
557
- return query ? item : null;
558
- });
559
- }
560
- }
561
- }
562
- });
563
- const replaceNamesWithIdsViewVisitor = schema => {
564
- const visitor = {
565
- visitQueryExpression: queryExpression => replaceNamesWithIdsInQueryExpression(schema, queryExpression),
566
- visitFilter: (fromType, filter) => replaceNamesWithIdsInFilter(schema, fromType, filter),
567
- visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
568
- visitEnums: enums => ___default["default"].entries(enums).reduce((result, [type, queryHolder]) => {
569
- if (schema.typeObjectsByName.hasOwnProperty(type)) {
570
- const typeObject = schema.typeObjectsByName[type];
571
- const fromType = ___default["default"].get(queryHolder, ["query", "q/from"]);
572
- const axisWithVisitedQuery = visitQueryExpressionHolder(queryHolder, visitor);
573
- result[typeObject.id] = visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
574
- } else {
575
- result[type] = queryHolder;
576
- }
577
- return result;
578
- }, {})
579
- };
580
- return visitor;
581
- };
582
- const replaceIdsWithNamesViewVisitor = schema => {
583
- const visitor = {
584
- visitQueryExpression: queryExpression => replaceIdsWithNamesInQueryExpression(schema, queryExpression),
585
- visitFilter: (fromType, filter) => {
586
- const replaceIdsWithNamesInFilter1 = replaceIdsWithNamesInFilter(schema, fromType, filter);
587
- return replaceIdsWithNamesInFilter1;
588
- },
589
- visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
590
- visitEnums: enums => ___default["default"].entries(enums).reduce((result, [typeId, queryHolder]) => {
591
- if (schema.typeObjectsById.hasOwnProperty(typeId)) {
592
- const typeObject = schema.typeObjectsById[typeId];
593
- const fromType = ___default["default"].get(queryHolder, ["query", "q/from"]);
594
- const axisWithVisitedQuery = visitQueryExpressionHolder(queryHolder, visitor);
595
- result[typeObject.name] = visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
596
- } else {
597
- result[typeId] = queryHolder;
598
- }
599
- return result;
600
- }, {})
601
- };
602
- return visitor;
603
- };
604
- const deleteExpressionWithNotFoundFieldsOrTypesViewVisitor = schema => {
605
- const visitor = {
606
- visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
607
- visitFilter: (fromType, filter) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, filter),
608
- visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression),
609
- visitEnums: enums => {
610
- const enumsNew = ___default["default"].entries(enums).reduce((result, [type, queryHolder]) => {
611
- if (schema.typeObjectsByName.hasOwnProperty(type)) {
612
- const typeObject = schema.typeObjectsByName[type];
613
- const queryHolderResult = visitQueryExpressionHolder(queryHolder, visitor);
614
- if (queryHolderResult) {
615
- result[typeObject.name] = queryHolderResult;
616
- }
617
- return result;
618
- }
619
- return result;
620
- }, {});
621
- return ___default["default"].isEmpty(enumsNew) ? null : enumsNew;
622
- }
623
- };
624
- return visitor;
625
- };
626
- const fixUserSelectedUnitsViewVisitor = (schema, {
627
- unitDefinitions,
628
- getDefaultUnitTypeForField
629
- }) => {
630
- return {
631
- visitQueryExpression: queryExpression => queryExpression,
632
- visitFilter: (_fromType, filter) => filter,
633
- visitExpression: (_fromType, expression) => expression,
634
- visitEnums: enums => enums,
635
- visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
636
- unitDefinitions,
637
- getDefaultUnitTypeForField
638
- })
639
- };
640
- };
641
- const replaceIdsWithNamesInBoardView = (schema, view) => visitView$4(view, replaceIdsWithNamesViewVisitor(schema));
642
- const replaceNamesWithIdsInBoardView = (schema, view) => visitView$4(view, replaceNamesWithIdsViewVisitor(schema));
643
- const deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView = (schema, view, ensureAxisInvariant = true) => {
644
- const viewNew = visitView$4(view, deleteExpressionWithNotFoundFieldsOrTypesViewVisitor(schema));
645
- return ensureAxisInvariant ? ensureAxisAndItemExpressionInvariant$1(viewNew) : viewNew;
646
- };
647
- const fixUserSelectedUnitsInBoardView = (schema, view, {
648
- unitDefinitions,
649
- getDefaultUnitTypeForField
650
- }) => {
651
- return visitView$4(view, fixUserSelectedUnitsViewVisitor(schema, {
652
- unitDefinitions,
653
- getDefaultUnitTypeForField
654
- }));
655
- };
656
- const fixContextExpressionWithBrokenPath$6 = (schema, view, defaultContextExpression) => visitView$4(view, {
657
- visitQueryExpression: query => query,
658
- visitFilter: (_fromType, filter) => filter,
659
- visitExpression: (_fromType, expression) => expression,
660
- visitEnums: enums => enums,
661
- visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
662
- });
663
- const collectGarbage$6 = view => {
664
- return visitView$4(view, {
665
- visitQueryExpression: queryExpression => queryExpression,
666
- visitFilter: (_fromType, filter) => filter,
667
- visitExpression: (fromType, expression) => expression,
668
- visitEnums: enums => enums,
669
- visitViewUnit: (fromType, unit) => unit.checked ? unit : REMOVE
670
- });
671
- };
672
- const enableHideWhenEmptyForCovers = view => {
673
- return immutableUpdate__default["default"](view, {
674
- "fibery/meta": {
675
- items: {
676
- $apply: items => items.map(item => {
677
- if (!item.coverExpression) {
678
- return item;
679
- }
680
- return {
681
- ...item,
682
- coverHideWhenEmpty: true
683
- };
684
- })
685
- }
686
- }
687
- });
688
- };
689
- const enableHideWhenEmptyForCheckedEditableUnits$1 = view => {
690
- return visitView$4(view, {
691
- visitFilter: (_fromType, filter) => filter,
692
- visitQueryExpression: queryExpression => queryExpression,
693
- visitGroupByExpression: groupBy => groupBy,
694
- visitExpression: (fromType, expression) => expression,
695
- visitEnums: enums => enums,
696
- visitViewUnit: (fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
697
- });
698
- };
699
-
700
- const visitView$3 = (view, visitor) => immutableUpdate__default["default"](view, {
701
- "fibery/meta": {
702
- items: {
703
- $apply: items => items.map(item => {
704
- const fromType = ___default["default"].get(item, ["query", "q/from"]);
705
- return fromType ? immutableUpdate__default["default"](item, {
706
- startExpression: {
707
- $apply: startExpression => startExpression ? visitor.visitExpression(fromType, startExpression) : startExpression
708
- },
709
- endExpression: {
710
- $apply: endExpression => endExpression ? visitor.visitExpression(fromType, endExpression) : endExpression
711
- },
712
- contextExpression: {
713
- $apply: contextExpression => visitContextExpression(fromType, contextExpression, visitor)
714
- },
715
- query: {
716
- $apply: query => query ? visitor.visitQueryExpression(query) : null
717
- },
718
- filter: {
719
- $apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
720
- },
721
- units: {
722
- $apply: units => units ? units.filter(unit => Boolean(unit)).map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE) : undefined
723
- },
724
- colorCoding: {
725
- $apply: colorCodings => {
726
- return colorCodings && colorCodings.map(colorCoding => ({
727
- ...colorCoding,
728
- expression: visitor.visitExpression(fromType, colorCoding.expression)
729
- })).filter(colorCoding => colorCoding.expression !== null);
730
- }
731
- }
732
- }) : item;
733
- }).filter(item => {
734
- const {
735
- query
736
- } = item;
737
- return query ? item : null;
738
- })
739
- }
740
- }
741
- });
742
- const replaceNamesWithIdsInCalendarView = (schema, view) => {
743
- return visitView$3(view, {
744
- visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
745
- visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
746
- visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query)
747
- });
748
- };
749
- const replaceIdsWithNamesInCalendarView = (schema, view) => {
750
- return visitView$3(view, {
751
- visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
752
- visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
753
- visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query)
754
- });
755
- };
756
- const deleteExpressionWithNotFoundFieldsOrTypesInCalendarView = (schema, view) => visitView$3(view, {
757
- visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
758
- visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
759
- visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
760
- });
761
- const fixUserSelectedUnitsInCalendarView = (schema, view, {
762
- unitDefinitions,
763
- getDefaultUnitTypeForField
764
- }) => {
765
- return visitView$3(view, {
766
- visitExpression: (_fromType, expression) => expression,
767
- visitFilter: (_fromType, filter) => filter,
768
- visitQueryExpression: query => query,
769
- visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
770
- unitDefinitions,
771
- getDefaultUnitTypeForField
772
- })
773
- });
774
- };
775
- const fixContextExpressionWithBrokenPath$5 = (schema, view, defaultContextExpression) => visitView$3(view, {
776
- visitQueryExpression: query => query,
777
- visitFilter: (_fromType, filter) => filter,
778
- visitExpression: (fromType, expression) => expression,
779
- visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
780
- });
781
- const collectGarbage$5 = view => {
782
- return visitView$3(view, {
783
- visitExpression: (fromType, expression) => expression,
784
- visitFilter: (_fromType, filter) => filter,
785
- visitQueryExpression: query => query,
786
- visitViewUnit: (fromType, unit) => unit.checked ? unit : REMOVE
787
- });
788
- };
789
- const enableHideWhenEmptyForCheckedUnits$3 = view => {
790
- return visitView$3(view, {
791
- visitQueryExpression: queryExpression => queryExpression,
792
- visitFilter: (_fromType, filter) => filter,
793
- visitGroupByExpression: groupBy => groupBy,
794
- visitExpression: (fromType, expression) => expression,
795
- visitEnums: enums => enums,
796
- visitViewUnit: (fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
797
- });
798
- };
799
-
800
- const visitView$2 = (view, visitor) => immutableUpdate__default["default"](view, {
801
- "fibery/meta": {
802
- items: {
803
- $apply: items => items.map(item => {
804
- const fromType = ___default["default"].get(item, ["query", "q/from"]);
805
- return fromType ? immutableUpdate__default["default"](item, {
806
- postExpression: {
807
- $apply: postExpression => postExpression ? visitor.visitExpression(fromType, postExpression) : postExpression
808
- },
809
- contextExpression: {
810
- $apply: contextExpression => visitContextExpression(fromType, contextExpression, visitor)
811
- },
812
- query: {
813
- $apply: query => query ? visitor.visitQueryExpression(query) : null
814
- },
815
- filter: {
816
- $apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
817
- },
818
- units: {
819
- $apply: units => units ? units.filter(unit => Boolean(unit)).map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE) : undefined
820
- },
821
- colorCoding: {
822
- $apply: colorCodings => {
823
- return colorCodings && colorCodings.map(colorCoding => ({
824
- ...colorCoding,
825
- expression: visitor.visitExpression(fromType, colorCoding.expression)
826
- })).filter(colorCoding => colorCoding.expression !== null);
827
- }
828
- }
829
- }) : item;
830
- }).filter(item => {
831
- const {
832
- query
833
- } = item;
834
- return query ? item : null;
835
- })
836
- }
837
- }
838
- });
839
- const replaceNamesWithIdsInFeedView = (schema, view) => {
840
- return visitView$2(view, {
841
- visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
842
- visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
843
- visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query)
844
- });
845
- };
846
- const replaceIdsWithNamesInFeedView = (schema, view) => {
847
- return visitView$2(view, {
848
- visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
849
- visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
850
- visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query)
851
- });
852
- };
853
- const deleteExpressionWithNotFoundFieldsOrTypesInFeedView = (schema, view) => visitView$2(view, {
854
- visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
855
- visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
856
- visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
857
- });
858
- const fixUserSelectedUnitsInFeedView = (schema, view, {
859
- unitDefinitions,
860
- getDefaultUnitTypeForField
861
- }) => {
862
- return visitView$2(view, {
863
- visitExpression: (_fromType, expression) => expression,
864
- visitFilter: (_fromType, filter) => filter,
865
- visitQueryExpression: query => query,
866
- visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
867
- unitDefinitions,
868
- getDefaultUnitTypeForField
869
- })
870
- });
871
- };
872
- const fixContextExpressionWithBrokenPath$4 = (schema, view, defaultContextExpression) => visitView$2(view, {
873
- visitQueryExpression: query => query,
874
- visitFilter: (_fromType, filter) => filter,
875
- visitExpression: (_fromType, expression) => expression,
876
- visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
877
- });
878
- const collectGarbage$4 = view => {
879
- return visitView$2(view, {
880
- visitExpression: (_fromType, expression) => expression,
881
- visitFilter: (_fromType, filter) => filter,
882
- visitQueryExpression: query => query,
883
- visitViewUnit: (fromType, unit) => unit.checked ? unit : REMOVE
884
- });
885
- };
886
- const enableHideWhenEmptyForCheckedUnits$2 = view => {
887
- return visitView$2(view, {
888
- visitQueryExpression: queryExpression => queryExpression,
889
- visitGroupByExpression: groupBy => groupBy,
890
- visitFilter: (_fromType, filter) => filter,
891
- visitExpression: (_fromType, expression) => expression,
892
- visitEnums: enums => enums,
893
- visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
894
- });
895
- };
896
-
897
- const replaceNamesWithIdsInFormView = (schema, view) => {
898
- var _view$fiberyMeta, _view$fiberyMeta2;
899
- const typeId = (_view$fiberyMeta = view["fibery/meta"]) == null ? void 0 : _view$fiberyMeta.typeId;
900
- const typeObject = schema.typeObjectsByName.hasOwnProperty(typeId) ? schema.typeObjectsByName[typeId] : null;
901
- const fields = (_view$fiberyMeta2 = view["fibery/meta"]) == null ? void 0 : _view$fiberyMeta2.fields;
902
- const fieldsInIdsTerms = fields && fields.map(field => {
903
- if (!(typeObject != null && typeObject.fieldObjectsByName.hasOwnProperty(field.id))) {
904
- return field;
905
- }
906
- return {
907
- ...field,
908
- id: typeObject.fieldObjectsByName[field.id].id
909
- };
910
- });
911
- return {
912
- ...view,
913
- "fibery/meta": {
914
- ...view["fibery/meta"],
915
- typeId: typeObject ? typeObject.id : typeId,
916
- fields: fieldsInIdsTerms || fields
917
- }
918
- };
919
- };
920
- const replaceIdsWithNamesInFormView = (schema, view) => {
921
- var _view$fiberyMeta3, _view$fiberyMeta4;
922
- const typeId = (_view$fiberyMeta3 = view["fibery/meta"]) == null ? void 0 : _view$fiberyMeta3.typeId;
923
- const typeObject = schema.typeObjectsById.hasOwnProperty(typeId) ? schema.typeObjectsById[typeId] : null;
924
- const fields = (_view$fiberyMeta4 = view["fibery/meta"]) == null ? void 0 : _view$fiberyMeta4.fields;
925
- const fieldsInNameTerms = fields && fields.map(field => {
926
- if (!(typeObject != null && typeObject.fieldObjectsById.hasOwnProperty(field.id))) {
927
- return field;
928
- }
929
- return {
930
- ...field,
931
- id: typeObject.fieldObjectsById[field.id].name
932
- };
933
- });
934
- return {
935
- ...view,
936
- "fibery/meta": {
937
- ...view["fibery/meta"],
938
- typeId: typeObject ? typeObject.name : typeId,
939
- fields: fieldsInNameTerms || fields
940
- }
941
- };
942
- };
943
- const deleteExpressionWithNotFoundFieldsOrTypesInFormView = (schema, view) => {
944
- var _view$fiberyMeta5, _view$fiberyMeta6;
945
- // we expect view in names terms here.
946
- const typeName = (_view$fiberyMeta5 = view["fibery/meta"]) == null ? void 0 : _view$fiberyMeta5.typeId;
947
- const typeObject = schema.typeObjectsByName.hasOwnProperty(typeName) ? schema.typeObjectsByName[typeName] : null;
948
- const fields = (_view$fiberyMeta6 = view["fibery/meta"]) == null ? void 0 : _view$fiberyMeta6.fields;
949
- const existingFields = fields && fields.filter(field => typeObject == null ? void 0 : typeObject.fieldObjectsByName.hasOwnProperty(field.id));
950
- return {
951
- ...view,
952
- "fibery/meta": {
953
- ...view["fibery/meta"],
954
- typeId: typeObject ? typeObject.name : typeName,
955
- fields: existingFields || fields
956
- }
957
- };
958
- };
959
-
960
- const visitView$1 = (view, visitor) => immutableUpdate__default["default"](view, {
961
- "fibery/meta": {
962
- items: {
963
- $apply: items => items.map(item => {
964
- const fromType = ___default["default"].get(item, ["query", "q/from"]);
965
- return fromType ? immutableUpdate__default["default"](item, {
966
- locationExpression: {
967
- $apply: startExpression => startExpression ? visitor.visitExpression(fromType, startExpression) : startExpression
968
- },
969
- contextExpression: {
970
- $apply: contextExpression => visitContextExpression(fromType, contextExpression, visitor)
971
- },
972
- query: {
973
- $apply: query => query ? visitor.visitQueryExpression(query) : null
974
- },
975
- filter: {
976
- $apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
977
- },
978
- units: {
979
- $apply: units => units ? units.filter(unit => Boolean(unit)).map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE) : undefined
980
- },
981
- colorCoding: {
982
- $apply: colorCodings => {
983
- return colorCodings && colorCodings.map(colorCoding => ({
984
- ...colorCoding,
985
- expression: visitor.visitExpression(fromType, colorCoding.expression)
986
- })).filter(colorCoding => colorCoding.expression !== null);
987
- }
988
- }
989
- }) : item;
990
- }).filter(item => {
991
- const {
992
- query
993
- } = item;
994
- return query ? item : null;
995
- })
996
- }
997
- }
998
- });
999
- const replaceNamesWithIdsInMapView = (schema, view) => {
1000
- return visitView$1(view, {
1001
- visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query),
1002
- visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
1003
- visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression)
1004
- });
1005
- };
1006
- const replaceIdsWithNamesInMapView = (schema, view) => {
1007
- return visitView$1(view, {
1008
- visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query),
1009
- visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
1010
- visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression)
1011
- });
1012
- };
1013
- const deleteExpressionWithNotFoundFieldsOrTypesInMapView = (schema, view) => visitView$1(view, {
1014
- visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
1015
- visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
1016
- visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
1017
- });
1018
- const fixUserSelectedUnitsInMapView = (schema, view, {
1019
- unitDefinitions,
1020
- getDefaultUnitTypeForField
1021
- }) => {
1022
- return visitView$1(view, {
1023
- visitQueryExpression: query => query,
1024
- visitFilter: (_fromType, filter) => filter,
1025
- visitExpression: (_fromType, expression) => expression,
1026
- visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
1027
- unitDefinitions,
1028
- getDefaultUnitTypeForField
1029
- })
1030
- });
1031
- };
1032
- const fixContextExpressionWithBrokenPath$3 = (schema, view, defaultContextExpression) => visitView$1(view, {
1033
- visitExpression: (_fromType, expression) => expression,
1034
- visitQueryExpression: query => query,
1035
- visitFilter: (_fromType, filter) => filter,
1036
- visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
1037
- });
1038
- const collectGarbage$3 = view => {
1039
- return visitView$1(view, {
1040
- visitQueryExpression: query => query,
1041
- visitFilter: (_fromType, filter) => filter,
1042
- visitExpression: (_fromType, expression) => expression,
1043
- visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE
1044
- });
1045
- };
1046
- const enableHideWhenEmptyForCheckedUnits$1 = view => {
1047
- return visitView$1(view, {
1048
- visitQueryExpression: queryExpression => queryExpression,
1049
- visitGroupByExpression: groupBy => groupBy,
1050
- visitFilter: (_fromType, filter) => filter,
1051
- visitExpression: (_fromType, expression) => expression,
1052
- visitEnums: enums => enums,
1053
- visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
1054
- });
1055
- };
1056
-
1057
- const visitSmartFolder = (smartFolder, visitor) => immutableUpdate__default["default"](smartFolder, {
1058
- "fibery/meta": {
1059
- items: {
1060
- $apply: (items = []) => {
1061
- const isOldSmartFolder = !items.every(item => item.hasOwnProperty("groupBy"));
1062
- const removedItemsIndexes = items.map((item, index) => visitor.visitQueryExpression(item.query) ? null : index).filter(value => value !== null);
1063
- return items.map(item => {
1064
- if (isOldSmartFolder) {
1065
- return item;
1066
- }
1067
- const fromType = ___default["default"].get(item, ["query", "q/from"]);
1068
- return fromType ? immutableUpdate__default["default"](item, {
1069
- groupBy: {
1070
- $apply: groupBy => {
1071
- if (!groupBy) {
1072
- return null;
1073
- }
1074
- const groupByIndexes = Object.keys(groupBy).map(key => parseInt(key));
1075
- const removedItemsBeforeTargetLengths = groupByIndexes.map(groupByIndex => removedItemsIndexes.filter(n => n < groupByIndex).length);
1076
- return visitor.visitGroupByExpression(groupBy, fromType, removedItemsBeforeTargetLengths);
1077
- }
1078
- }
1079
- }) : item;
1080
- }).map(item => {
1081
- if (isOldSmartFolder) {
1082
- return item;
1083
- }
1084
- const fromType = ___default["default"].get(item, ["query", "q/from"]);
1085
- return fromType ? immutableUpdate__default["default"](item, {
1086
- groupingExpression: {
1087
- $apply: groupingExpression => {
1088
- if (!groupingExpression) {
1089
- return null;
1090
- }
1091
- const groupingExpressionIndexes = Object.keys(groupingExpression).map(key => parseInt(key));
1092
- const removedItemsBeforeTargetLengths = groupingExpressionIndexes.map(groupByIndex => removedItemsIndexes.filter(n => n < groupByIndex).length);
1093
- return visitor.visitGroupByExpression(groupingExpression, fromType, removedItemsBeforeTargetLengths);
1094
- }
1095
- }
1096
- }) : item;
1097
- }).map(item => {
1098
- const fromType = ___default["default"].get(item, ["query", "q/from"]);
1099
- return fromType ? immutableUpdate__default["default"](item, {
1100
- filter: {
1101
- $apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
1102
- },
1103
- query: {
1104
- $apply: query => {
1105
- const visitedQuery = visitor.visitQueryExpression(query);
1106
- return query ? visitedQuery : null;
1107
- }
1108
- },
1109
- units: {
1110
- $apply: units => {
1111
- return units ? units.filter(unit => Boolean(unit)).map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, index, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE) : undefined;
1112
- }
1113
- },
1114
- contextExpression: {
1115
- $apply: contextExpression => visitContextExpression(fromType, contextExpression, visitor)
1116
- },
1117
- colorCoding: {
1118
- $apply: colorCodings => {
1119
- return colorCodings ? colorCodings.map(colorCoding => ({
1120
- ...colorCoding,
1121
- expression: visitor.visitExpression(fromType, colorCoding.expression)
1122
- })).filter(colorCoding => colorCoding.expression !== null) : undefined;
1123
- }
1124
- }
1125
- }) : item;
1126
- }).filter(item => {
1127
- const {
1128
- query
1129
- } = item;
1130
- return query ? item : null;
1131
- });
1132
- }
1133
- },
1134
- columnOrderWithIds: {
1135
- $apply: columnOrderWithIds => {
1136
- if (!visitor.visitUnitGroupKey || !columnOrderWithIds) {
1137
- return columnOrderWithIds;
1138
- }
1139
- return columnOrderWithIds.map(key => visitor.visitUnitGroupKey(key));
1140
- }
1141
- },
1142
- pinnedColumnsWithIds: {
1143
- $apply: pinnedColumnsWithIds => {
1144
- if (!visitor.visitUnitGroupKey || !pinnedColumnsWithIds) {
1145
- return pinnedColumnsWithIds;
1146
- }
1147
- return pinnedColumnsWithIds.map(key => visitor.visitUnitGroupKey(key));
1148
- }
1149
- },
1150
- columnAggFunc: {
1151
- $apply: columnAggFunc => {
1152
- if (!visitor.visitUnitGroupKey || !columnAggFunc) {
1153
- return columnAggFunc;
1154
- }
1155
- return Object.fromEntries(Object.entries(columnAggFunc).map(([key, value]) => {
1156
- return [visitor.visitUnitGroupKey(key), value];
1157
- }));
1158
- }
1159
- }
1160
- }
1161
- });
1162
- const deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression = (schema, groupByExpression, fromType, removedItems) => {
1163
- if (!groupByExpression) {
1164
- return null;
1165
- }
1166
- const entries = Object.entries(groupByExpression).map(([index, {
1167
- expression
1168
- }], groupByIndex) => {
1169
- const visitedExpression = deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression);
1170
- if (visitedExpression) {
1171
- return [`${parseInt(index) - removedItems[groupByIndex]}`, {
1172
- expression: visitedExpression
1173
- }];
1174
- }
1175
- return null;
1176
- }).filter(Boolean);
1177
- return entries.length > 0 ? Object.fromEntries(entries) : null;
1178
- };
1179
- const replaceIdsWithNamesInGroupByExpression = (schema, groupByExpression, fromType) => {
1180
- if (!groupByExpression) {
1181
- return null;
1182
- }
1183
- return Object.fromEntries(Object.entries(groupByExpression).map(([index, {
1184
- expression
1185
- }]) => {
1186
- if (schema.typeObjectsById.hasOwnProperty(fromType)) {
1187
- const typeObject = schema.typeObjectsById[fromType];
1188
- return [index, {
1189
- expression: visitors.replaceIdsWithNamesVisitor(typeObject).visitExpression(expression)
1190
- }];
1191
- } else {
1192
- return [index, {
1193
- expression
1194
- }];
1195
- }
1196
- }));
1197
- };
1198
- const replaceNamesWithIdsInGroupByExpression = (schema, groupByExpression, fromType) => {
1199
- if (!groupByExpression) {
1200
- return null;
1201
- }
1202
- return Object.fromEntries(Object.entries(groupByExpression).map(([index, {
1203
- expression
1204
- }]) => {
1205
- if (schema.typeObjectsByName.hasOwnProperty(fromType)) {
1206
- const typeObject = schema.typeObjectsByName[fromType];
1207
- return [index, {
1208
- expression: visitors.replaceNamesWithIdsVisitor(typeObject).visitExpression(expression)
1209
- }];
1210
- } else {
1211
- return [index, {
1212
- expression
1213
- }];
1214
- }
1215
- }));
1216
- };
1217
- const replaceNamesWithIdsInSmartFolder = (schema, smartFolder) => visitSmartFolder(smartFolder, {
1218
- visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query),
1219
- visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
1220
- visitGroupByExpression: (groupBy, fromType) => replaceNamesWithIdsInGroupByExpression(schema, groupBy, fromType),
1221
- visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
1222
- visitUnitGroupKey: unitGroupKey => replaceNamesWithIdsInUnitGroupKey(unitGroupKey, schema)
1223
- });
1224
- const replaceIdsWithNamesInSmartFolder = (schema, smartFolder) => visitSmartFolder(smartFolder, {
1225
- visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query),
1226
- visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
1227
- visitGroupByExpression: (groupBy, fromType) => replaceIdsWithNamesInGroupByExpression(schema, groupBy, fromType),
1228
- visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
1229
- visitUnitGroupKey: unitGroupKey => replaceIdsWithNamesInUnitGroupKey(unitGroupKey, getFieldObjectsById(smartFolder, schema))
1230
- });
1231
- const deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder = (schema, smartFolder) => visitSmartFolder(smartFolder, {
1232
- visitQueryExpression: query => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, query),
1233
- visitGroupByExpression: (groupBy, fromType, removedItems) => deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression(schema, groupBy, fromType, removedItems),
1234
- visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
1235
- visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
1236
- });
1237
- const fixContextExpressionWithBrokenPath$2 = (schema, view, defaultContextExpression) => visitSmartFolder(view, {
1238
- visitQueryExpression: query => query,
1239
- visitGroupByExpression: groupBy => groupBy,
1240
- visitExpression: (_fromType, expression) => expression,
1241
- visitFilter: (_fromType, filter) => filter,
1242
- visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
1243
- });
1244
- const fixUserSelectedUnitsInSmartFolder = (schema, view, {
1245
- unitDefinitions,
1246
- getDefaultUnitTypeForField
1247
- }) => {
1248
- return visitSmartFolder(view, {
1249
- visitQueryExpression: query => query,
1250
- visitGroupByExpression: groupBy => groupBy,
1251
- visitFilter: (_fromType, filter) => filter,
1252
- visitExpression: (_fromType, expression) => expression,
1253
- visitViewUnit: (fromType, unit, units) => {
1254
- const {
1255
- type,
1256
- expression
1257
- } = unit;
1258
- if (type === "rich-text" && (view == null ? void 0 : view["fibery/type"]) === "grid") {
1259
- if (unit.checked) {
1260
- const snippetsUnits = units == null ? void 0 : units.filter(x => x.type === "rich-text-snippet");
1261
- const snippetUnitForField = snippetsUnits == null ? void 0 : snippetsUnits.find(x => ___default["default"].isEqual(x.expression, expression));
1262
- if (snippetUnitForField && !snippetUnitForField.checked) {
1263
- snippetUnitForField.checked = true;
1264
- }
1265
- }
1266
- return REMOVE;
1267
- }
1268
- return fixViewUnit(schema, fromType, unit, units, {
1269
- unitDefinitions,
1270
- getDefaultUnitTypeForField
1271
- });
1272
- }
1273
- });
1274
- };
1275
- const collectGarbage$2 = view => {
1276
- return visitSmartFolder(view, {
1277
- visitQueryExpression: query => query,
1278
- visitFilter: (_fromType, filter) => filter,
1279
- visitGroupByExpression: groupBy => groupBy,
1280
- visitExpression: (_fromType, expression) => expression,
1281
- visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE
1282
- });
1283
- };
1284
- const enableHideWhenEmptyForCheckedUnits = view => {
1285
- return visitSmartFolder(view, {
1286
- visitQueryExpression: queryExpression => queryExpression,
1287
- visitGroupByExpression: groupBy => groupBy,
1288
- visitExpression: (_fromType, expression) => expression,
1289
- visitFilter: (_fromType, filter) => filter,
1290
- visitEnums: enums => enums,
1291
- visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
1292
- });
1293
- };
1294
-
1295
- const visitAxisSingle = (axis, visitor) => {
1296
- const fromType = ___default["default"].get(axis, ["query", "q/from"]);
1297
- const firstOrNull = x => ___default["default"].first(x) || null;
1298
- const axisResult = {
1299
- ...axis,
1300
- filter: axis.filter ? visitor.visitFilter(fromType, axis.filter) : null,
1301
- query: axis.query && visitor.visitQueryExpression(axis.query),
1302
- contextExpression: visitContextExpression(fromType, axis.contextExpression, visitor),
1303
- units: axis.units && axis.units.map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE),
1304
- groupByExpression: axis.groupByExpression && firstOrNull(visitor.visitExpression(fromType, [axis.groupByExpression]))
1305
- };
1306
- if (!axisResult.query) {
1307
- return null;
1308
- }
1309
- if (!axisResult.units) {
1310
- delete axisResult.units;
1311
- }
1312
- return axisResult;
1313
- };
1314
- const visitAxis = (axis, visitor) => {
1315
- if (axis && axis.hasOwnProperty("query")) {
1316
- return visitAxisSingle(axis, visitor);
1317
- }
1318
- if (axis && axis.hasOwnProperty("enums")) {
1319
- const axisNew = immutableUpdate__default["default"](axis, {
1320
- enums: {
1321
- $apply: enums => visitor.visitEnums(enums)
1322
- }
1323
- });
1324
- const {
1325
- enums
1326
- } = axisNew;
1327
- return enums ? axisNew : null;
1328
- }
1329
- return axis;
1330
- };
1331
- const visitView = (view, visitor) => immutableUpdate__default["default"](view, {
1332
- "fibery/meta": {
1333
- y: {
1334
- $apply: y => visitAxis(y, visitor)
1335
- },
1336
- items: {
1337
- $apply: items => {
1338
- const removedItemsIndexes = items.map((item, index) => visitor.visitQueryExpression(item.query) ? null : index).filter(value => value !== null);
1339
- return items.map(item => {
1340
- const fromType = ___default["default"].get(item, ["query", "q/from"]);
1341
- const hasGroupingExpression = ___default["default"].has(item, ["groupingExpression"]);
1342
- return fromType ? immutableUpdate__default["default"](item, {
1343
- yExpression: {
1344
- $apply: yExpression => yExpression ? visitor.visitExpression(fromType, yExpression) : yExpression
1345
- },
1346
- startExpression: {
1347
- $apply: startExpression => startExpression ? visitor.visitExpression(fromType, startExpression) : startExpression
1348
- },
1349
- endExpression: {
1350
- $apply: endExpression => endExpression ? visitor.visitExpression(fromType, endExpression) : endExpression
1351
- },
1352
- secondaryStartExpression: {
1353
- $apply: secondaryStartExpression => secondaryStartExpression ? visitor.visitExpression(fromType, secondaryStartExpression) : secondaryStartExpression
1354
- },
1355
- secondaryEndExpression: {
1356
- $apply: secondaryEndExpression => secondaryEndExpression ? visitor.visitExpression(fromType, secondaryEndExpression) : secondaryEndExpression
1357
- },
1358
- contextExpression: {
1359
- $apply: contextExpression => visitContextExpression(fromType, contextExpression, visitor)
1360
- },
1361
- filter: {
1362
- $apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
1363
- },
1364
- query: {
1365
- $apply: query => query ? visitor.visitQueryExpression(query) : null
1366
- },
1367
- units: {
1368
- $apply: units => units ? units.filter(unit => Boolean(unit)).map(unit => visitViewUnit(fromType, unit, visitor)).filter(unit => isUnitExpressionValid(unit)).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(unit => unit !== REMOVE) : undefined
1369
- },
1370
- colorCoding: {
1371
- $apply: colorCodings => {
1372
- return colorCodings && colorCodings.map(colorCoding => ({
1373
- ...colorCoding,
1374
- expression: visitor.visitExpression(fromType, colorCoding.expression)
1375
- })).filter(colorCoding => colorCoding.expression !== null);
1376
- }
1377
- },
1378
- dependencyExpression: {
1379
- $apply: expression => {
1380
- return expression && visitor.visitExpression(fromType, expression);
1381
- }
1382
- },
1383
- groupBy: {
1384
- $apply: groupBy => {
1385
- if (!groupBy) {
1386
- return groupBy;
1387
- }
1388
- const groupByIndexes = Object.keys(groupBy).map(key => parseInt(key));
1389
- const removedItemsBeforeTargetLengths = groupByIndexes.map(groupByIndex => removedItemsIndexes.filter(n => n < groupByIndex).length);
1390
- return visitor.visitGroupByExpression(groupBy, fromType, removedItemsBeforeTargetLengths);
1391
- }
1392
- },
1393
- ...(hasGroupingExpression ? {
1394
- groupingExpression: {
1395
- $apply: groupingExpression => {
1396
- if (!groupingExpression) {
1397
- return null;
1398
- }
1399
- const groupingExpressionIndexes = Object.keys(groupingExpression).map(key => parseInt(key));
1400
- const removedItemsBeforeTargetLengths = groupingExpressionIndexes.map(groupByIndex => removedItemsIndexes.filter(n => n < groupByIndex).length);
1401
- return visitor.visitGroupByExpression(groupingExpression, fromType, removedItemsBeforeTargetLengths);
1402
- }
1403
- }
1404
- } : undefined)
1405
- }) : item;
1406
- }).filter(item => {
1407
- const {
1408
- query
1409
- } = item;
1410
- return query ? item : null;
1411
- });
1412
- }
1413
- },
1414
- milestones: {
1415
- $apply: milestones => {
1416
- if (!milestones) {
1417
- return milestones;
1418
- }
1419
- return milestones.map(item => {
1420
- const fromType = ___default["default"].get(item, ["query", "q/from"]);
1421
- return fromType ? immutableUpdate__default["default"](item, {
1422
- dateExpression: {
1423
- $apply: startExpression => startExpression ? visitor.visitExpression(fromType, startExpression) : startExpression
1424
- },
1425
- filter: {
1426
- $apply: filter => filter ? visitor.visitFilter(fromType, filter) : null
1427
- },
1428
- query: {
1429
- $apply: query => query ? visitor.visitQueryExpression(query) : null
1430
- },
1431
- contextExpression: {
1432
- $apply: contextExpression => visitContextExpression(fromType, contextExpression, visitor)
1433
- }
1434
- }) : item;
1435
- }).filter(item => {
1436
- const {
1437
- query
1438
- } = item;
1439
- return query ? item : null;
1440
- });
1441
- }
1442
- }
1443
- }
1444
- });
1445
- const replaceNamesWithIdsInTimelineView = (schema, view) => {
1446
- const visitor = {
1447
- visitQueryExpression: query => replaceNamesWithIdsInQueryExpression(schema, query),
1448
- visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
1449
- visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
1450
- visitEnums: enums => ___default["default"].entries(enums).reduce((result, [type, axis]) => {
1451
- if (schema.typeObjectsByName.hasOwnProperty(type)) {
1452
- const typeObject = schema.typeObjectsByName[type];
1453
- result[typeObject.id] = visitAxisSingle(axis, visitor);
1454
- } else {
1455
- result[type] = axis;
1456
- }
1457
- return result;
1458
- }, {}),
1459
- visitGroupByExpression: (groupBy, fromType) => replaceNamesWithIdsInGroupByExpression(schema, groupBy, fromType)
1460
- };
1461
- return visitView(view, visitor);
1462
- };
1463
- const replaceIdsWithNamesInTimelineView = (schema, view) => {
1464
- const visitor = {
1465
- visitQueryExpression: query => replaceIdsWithNamesInQueryExpression(schema, query),
1466
- visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
1467
- visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
1468
- visitEnums: enums => ___default["default"].entries(enums).reduce((result, [typeId, axis]) => {
1469
- if (schema.typeObjectsById.hasOwnProperty(typeId)) {
1470
- const typeObject = schema.typeObjectsById[typeId];
1471
- result[typeObject.name] = visitAxisSingle(axis, visitor);
1472
- } else {
1473
- result[typeId] = axis;
1474
- }
1475
- return result;
1476
- }, {}),
1477
- visitGroupByExpression: (groupBy, fromType) => replaceIdsWithNamesInGroupByExpression(schema, groupBy, fromType)
1478
- };
1479
- return visitView(view, visitor);
1480
- };
1481
- const ensureAxisAndItemExpressionInvariant = (view, canGroupMetaItem) => {
1482
- const actions = [];
1483
- const y = ___default["default"].get(view, ["fibery/meta", "y"]);
1484
- const yQuery = ___default["default"].get(view, ["fibery/meta", "y", "query"]);
1485
- const yGroupByExpression = ___default["default"].get(view, ["fibery/meta", "y", "groupByExpression"]);
1486
- const items = ___default["default"].get(view, ["fibery/meta", "items"]);
1487
- if (yQuery === null && yGroupByExpression !== null) {
1488
- actions.push(() => ___default["default"].set(view, ["fibery/meta", "y", "groupByExpression"], null));
1489
- }
1490
- if (y === null) {
1491
- const resetActions = items.map(item => () => item.yExpression = null);
1492
- actions.push(...resetActions);
1493
- }
1494
- const filteredMetaItems = items.filter(canGroupMetaItem);
1495
- if (y !== null && ___default["default"].some(filteredMetaItems, ({
1496
- yExpression
1497
- }) => yExpression === null)) {
1498
- const resetActions = filteredMetaItems.map(item => () => item.yExpression = null);
1499
- actions.push(...resetActions);
1500
- actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
1501
- }
1502
- if (y !== null && ___default["default"].isEmpty(items)) {
1503
- actions.push(() => ___default["default"].set(view, ["fibery/meta", "y"], null));
1504
- }
1505
- actions.forEach(action => action());
1506
- return view;
1507
- };
1508
- const deleteExpressionWithNotFoundFieldsOrTypesInTimelineView = (schema, view, ensureAxisInvariant, canGroupMetaItem = metaItem => true) => {
1509
- const visitor = {
1510
- visitQueryExpression: queryExpression => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
1511
- visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
1512
- visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression),
1513
- visitEnums: enums => {
1514
- const enumsNew = ___default["default"].entries(enums).reduce((result, [type, axis]) => {
1515
- if (schema.typeObjectsByName.hasOwnProperty(type)) {
1516
- const typeObject = schema.typeObjectsByName[type];
1517
- const axisResult = visitAxisSingle(axis, visitor);
1518
- if (axisResult) {
1519
- result[typeObject.name] = axisResult;
1520
- }
1521
- }
1522
- return result;
1523
- }, {});
1524
- return ___default["default"].isEmpty(enumsNew) ? null : enumsNew;
1525
- },
1526
- visitGroupByExpression: (groupBy, fromType, removedItems) => deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression(schema, groupBy, fromType, removedItems)
1527
- };
1528
- const viewNew = visitView(view, visitor);
1529
- return ensureAxisInvariant ? ensureAxisAndItemExpressionInvariant(viewNew, canGroupMetaItem) : viewNew;
1530
- };
1531
- const fixUserSelectedUnitsInTimelineView = (schema, view, {
1532
- unitDefinitions,
1533
- getDefaultUnitTypeForField
1534
- }) => {
1535
- return visitView(view, {
1536
- visitQueryExpression: query => query,
1537
- visitExpression: (_fromType, expression) => expression,
1538
- visitFilter: (_fromType, filter) => filter,
1539
- visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
1540
- unitDefinitions,
1541
- getDefaultUnitTypeForField
1542
- }),
1543
- visitEnums: enums => enums,
1544
- visitGroupByExpression: groupBy => groupBy
1545
- });
1546
- };
1547
- const fixContextExpressionWithBrokenPath$1 = (schema, view, defaultContextExpression) => visitView(view, {
1548
- visitExpression: (_fromType, expression) => expression,
1549
- visitFilter: (_fromType, filter) => filter,
1550
- visitQueryExpression: query => query,
1551
- visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression),
1552
- visitEnums: enums => enums,
1553
- visitGroupByExpression: groupBy => groupBy
1554
- });
1555
- const collectGarbage$1 = view => {
1556
- return visitView(view, {
1557
- visitQueryExpression: query => query,
1558
- visitFilter: (_fromType, filter) => filter,
1559
- visitExpression: (_fromType, expression) => expression,
1560
- visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE,
1561
- visitEnums: enums => enums,
1562
- visitGroupByExpression: groupBy => groupBy
1563
- });
1564
- };
1565
- const enableHideWhenEmptyForCheckedEditableUnits = view => {
1566
- return visitView(view, {
1567
- visitQueryExpression: queryExpression => queryExpression,
1568
- visitExpression: (_fromType, expression) => expression,
1569
- visitFilter: (_fromType, filter) => filter,
1570
- visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit),
1571
- visitEnums: enums => enums,
1572
- visitGroupByExpression: groupBy => groupBy
1573
- });
1574
- };
1575
-
1576
- const deleteExpressionWithNotFoundFieldsOrTypesInView = (schema, view, ensureAxisInvariant = true) => {
1577
- switch (view["fibery/type"]) {
1578
- case "board":
1579
- case "gallery":
1580
- return deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView(schema, view, ensureAxisInvariant);
1581
- case "list":
1582
- case "grid":
1583
- case "table":
1584
- return deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder(schema, view);
1585
- case "timeline":
1586
- return deleteExpressionWithNotFoundFieldsOrTypesInTimelineView(schema, view, ensureAxisInvariant, () => true);
1587
- case "gantt":
1588
- return deleteExpressionWithNotFoundFieldsOrTypesInTimelineView(schema, view, ensureAxisInvariant,
1589
- // Only hierarchy top level meta items can be grouped
1590
- metaItem => !metaItem.groupBy);
1591
- case "calendar":
1592
- return deleteExpressionWithNotFoundFieldsOrTypesInCalendarView(schema, view);
1593
- case "feed":
1594
- return deleteExpressionWithNotFoundFieldsOrTypesInFeedView(schema, view);
1595
- case "form":
1596
- return deleteExpressionWithNotFoundFieldsOrTypesInFormView(schema, view);
1597
- case "map":
1598
- return deleteExpressionWithNotFoundFieldsOrTypesInMapView(schema, view);
1599
- default:
1600
- return view;
1601
- }
1602
- };
1603
- const fixUserSelectedUnits = (schema, view, {
1604
- unitDefinitions,
1605
- getDefaultUnitTypeForField
1606
- }) => {
1607
- switch (view["fibery/type"]) {
1608
- case "board":
1609
- case "gallery":
1610
- return fixUserSelectedUnitsInBoardView(schema, view, {
1611
- unitDefinitions,
1612
- getDefaultUnitTypeForField
1613
- });
1614
- case "list":
1615
- case "grid":
1616
- case "table":
1617
- return fixUserSelectedUnitsInSmartFolder(schema, view, {
1618
- unitDefinitions,
1619
- getDefaultUnitTypeForField
1620
- });
1621
- case "timeline":
1622
- case "gantt":
1623
- return fixUserSelectedUnitsInTimelineView(schema, view, {
1624
- unitDefinitions,
1625
- getDefaultUnitTypeForField
1626
- });
1627
- case "calendar":
1628
- return fixUserSelectedUnitsInCalendarView(schema, view, {
1629
- unitDefinitions,
1630
- getDefaultUnitTypeForField
1631
- });
1632
- case "feed":
1633
- return fixUserSelectedUnitsInFeedView(schema, view, {
1634
- unitDefinitions,
1635
- getDefaultUnitTypeForField
1636
- });
1637
- case "map":
1638
- return fixUserSelectedUnitsInMapView(schema, view, {
1639
- unitDefinitions,
1640
- getDefaultUnitTypeForField
1641
- });
1642
- default:
1643
- return view;
1644
- }
1645
- };
1646
- const fixContextExpressionWithBrokenPath = (schema, view, defaultContextExpression) => {
1647
- switch (view["fibery/type"]) {
1648
- case "board":
1649
- case "gallery":
1650
- return fixContextExpressionWithBrokenPath$6(schema, view, defaultContextExpression);
1651
- case "list":
1652
- case "grid":
1653
- case "table":
1654
- return fixContextExpressionWithBrokenPath$2(schema, view, defaultContextExpression);
1655
- case "timeline":
1656
- case "gantt":
1657
- return fixContextExpressionWithBrokenPath$1(schema, view, defaultContextExpression);
1658
- case "calendar":
1659
- return fixContextExpressionWithBrokenPath$5(schema, view, defaultContextExpression);
1660
- case "feed":
1661
- return fixContextExpressionWithBrokenPath$4(schema, view, defaultContextExpression);
1662
- case "map":
1663
- return fixContextExpressionWithBrokenPath$3(schema, view, defaultContextExpression);
1664
- default:
1665
- return view;
1666
- }
1667
- };
1668
-
1669
- /**
1670
- * Removes garbage from view's meta to reduce the size.
1671
- */
1672
- const collectGarbage = (schema, view) => {
1673
- const deleteRemoved = x => {
1674
- if (Array.isArray(x)) {
1675
- return x.map(deleteRemoved).filter(y => y !== REMOVE);
1676
- }
1677
- if (typeof x === "object" && x !== null) {
1678
- let tmp = Object.entries(x);
1679
- tmp = tmp.map(e => [e[0], deleteRemoved(e[1])]);
1680
- tmp = tmp.filter(e => e[1] !== REMOVE);
1681
- return Object.fromEntries(tmp);
1682
- }
1683
- return x;
1684
- };
1685
- switch (view["fibery/type"]) {
1686
- case "board":
1687
- case "gallery":
1688
- return deleteRemoved(collectGarbage$6(view));
1689
- case "list":
1690
- case "grid":
1691
- case "table":
1692
- return deleteRemoved(collectGarbage$2(view));
1693
- case "timeline":
1694
- case "gantt":
1695
- return deleteRemoved(collectGarbage$1(view));
1696
- case "calendar":
1697
- return deleteRemoved(collectGarbage$5(view));
1698
- case "feed":
1699
- return deleteRemoved(collectGarbage$4(view));
1700
- case "map":
1701
- return deleteRemoved(collectGarbage$3(view));
1702
- default:
1703
- return view;
1704
- }
1705
- };
1706
- const replaceNamesWithIdsInView = (schema, view) => {
1707
- switch (view["fibery/type"]) {
1708
- case "board":
1709
- case "gallery":
1710
- return replaceNamesWithIdsInBoardView(schema, view);
1711
- case "list":
1712
- case "grid":
1713
- case "table":
1714
- return replaceNamesWithIdsInSmartFolder(schema, view);
1715
- case "timeline":
1716
- case "gantt":
1717
- return replaceNamesWithIdsInTimelineView(schema, view);
1718
- case "calendar":
1719
- return replaceNamesWithIdsInCalendarView(schema, view);
1720
- case "feed":
1721
- return replaceNamesWithIdsInFeedView(schema, view);
1722
- case "form":
1723
- return replaceNamesWithIdsInFormView(schema, view);
1724
- case "map":
1725
- return replaceNamesWithIdsInMapView(schema, view);
1726
- default:
1727
- return view;
1728
- }
1729
- };
1730
- const replaceIdsWithNamesInView = (schema, view) => {
1731
- switch (view["fibery/type"]) {
1732
- case "board":
1733
- case "gallery":
1734
- return replaceIdsWithNamesInBoardView(schema, view);
1735
- case "list":
1736
- case "grid":
1737
- case "table":
1738
- return replaceIdsWithNamesInSmartFolder(schema, view);
1739
- case "timeline":
1740
- case "gantt":
1741
- return replaceIdsWithNamesInTimelineView(schema, view);
1742
- case "calendar":
1743
- return replaceIdsWithNamesInCalendarView(schema, view);
1744
- case "feed":
1745
- return replaceIdsWithNamesInFeedView(schema, view);
1746
- case "form":
1747
- return replaceIdsWithNamesInFormView(schema, view);
1748
- case "map":
1749
- return replaceIdsWithNamesInMapView(schema, view);
1750
- default:
1751
- return view;
1752
- }
1753
- };
1754
- const getViewCardTypes = ({
1755
- "fibery/meta": {
1756
- items
1757
- }
1758
- }) => items.map(({
1759
- query: {
1760
- "q/from": type
1761
- }
1762
- }) => type);
1763
- const migrateHideWhenEmptyToUnitsLevel = view => {
1764
- const viewTypesToTransform = ["board", "list", "timeline", "gantt", "calendar", "feed", "map"];
1765
- const viewType = view["fibery/type"];
1766
- if (!viewTypesToTransform.includes(viewType)) {
1767
- return view;
1768
- }
1769
- const showEmptyUnitValues = ___default["default"].get(view, ["fibery/meta", "showEmptyUnitValues"]);
1770
- if (showEmptyUnitValues === undefined) {
1771
- return view;
1772
- }
1773
- let result = immutableUpdate__default["default"](view, {
1774
- "fibery/meta": {
1775
- $apply: x => ___default["default"].omit(x, "showEmptyUnitValues")
1776
- }
1777
- });
1778
- if (showEmptyUnitValues === true) {
1779
- return result;
1780
- }
1781
- switch (result["fibery/type"]) {
1782
- case "board":
1783
- case "gallery":
1784
- result = enableHideWhenEmptyForCovers(result);
1785
- result = enableHideWhenEmptyForCheckedEditableUnits$1(result);
1786
- return result;
1787
- case "list":
1788
- return enableHideWhenEmptyForCheckedUnits(result);
1789
- case "timeline":
1790
- case "gantt":
1791
- return enableHideWhenEmptyForCheckedEditableUnits(result);
1792
- case "calendar":
1793
- return enableHideWhenEmptyForCheckedUnits$3(result);
1794
- case "feed":
1795
- return enableHideWhenEmptyForCheckedUnits$2(result);
1796
- case "map":
1797
- return enableHideWhenEmptyForCheckedUnits$1(result);
1798
- default:
1799
- return result;
1800
- }
1801
- };
1802
-
1803
- exports.collectGarbage = collectGarbage;
1804
- exports.deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder = deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder;
1805
- exports.deleteExpressionWithNotFoundFieldsOrTypesInView = deleteExpressionWithNotFoundFieldsOrTypesInView;
1806
- exports.fixContextExpressionWithBrokenPath = fixContextExpressionWithBrokenPath;
1807
- exports.fixUserSelectedUnits = fixUserSelectedUnits;
1808
- exports.getViewCardTypes = getViewCardTypes;
1809
- exports.migrateHideWhenEmptyToUnitsLevel = migrateHideWhenEmptyToUnitsLevel;
1810
- exports.replaceIdsWithNamesInSmartFolder = replaceIdsWithNamesInSmartFolder;
1811
- exports.replaceIdsWithNamesInView = replaceIdsWithNamesInView;
1812
- exports.replaceNamesWithIdsInSmartFolder = replaceNamesWithIdsInSmartFolder;
1813
- exports.replaceNamesWithIdsInView = replaceNamesWithIdsInView;