@fibery/views 11.0.0 → 12.0.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.
- package/lib/views.js +21 -2
- package/package.json +1 -1
package/lib/views.js
CHANGED
|
@@ -270,20 +270,32 @@ const getUnitTypeForTextField = fieldMeta => {
|
|
|
270
270
|
return "text";
|
|
271
271
|
}
|
|
272
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
|
+
};
|
|
273
282
|
const migrateUnit = (schema, fromType, unit, units) => {
|
|
274
283
|
const {
|
|
275
284
|
type,
|
|
276
285
|
expression
|
|
277
286
|
} = unit;
|
|
287
|
+
const kind = unit.kind || getUnitKind(unit);
|
|
278
288
|
if (type === "date-time") {
|
|
279
289
|
return {
|
|
280
290
|
...unit,
|
|
291
|
+
kind,
|
|
281
292
|
type: "date"
|
|
282
293
|
};
|
|
283
294
|
}
|
|
284
295
|
if (type === "date-time-range") {
|
|
285
296
|
return {
|
|
286
297
|
...unit,
|
|
298
|
+
kind,
|
|
287
299
|
type: "date-range"
|
|
288
300
|
};
|
|
289
301
|
}
|
|
@@ -293,6 +305,7 @@ const migrateUnit = (schema, fromType, unit, units) => {
|
|
|
293
305
|
if (fieldType === "fibery/email") {
|
|
294
306
|
return {
|
|
295
307
|
...unit,
|
|
308
|
+
kind,
|
|
296
309
|
type: "email"
|
|
297
310
|
};
|
|
298
311
|
}
|
|
@@ -302,6 +315,7 @@ const migrateUnit = (schema, fromType, unit, units) => {
|
|
|
302
315
|
if (getFieldType(schema, fromType, field) === "fibery/text") {
|
|
303
316
|
return {
|
|
304
317
|
...unit,
|
|
318
|
+
kind,
|
|
305
319
|
type: getUnitTypeForTextField(getFieldMeta(schema, fromType, field))
|
|
306
320
|
};
|
|
307
321
|
}
|
|
@@ -311,6 +325,7 @@ const migrateUnit = (schema, fromType, unit, units) => {
|
|
|
311
325
|
if (getFieldType(schema, fromType, field) === "fibery/file") {
|
|
312
326
|
return {
|
|
313
327
|
...unit,
|
|
328
|
+
kind,
|
|
314
329
|
type: "collection-count"
|
|
315
330
|
};
|
|
316
331
|
}
|
|
@@ -322,11 +337,15 @@ const migrateUnit = (schema, fromType, unit, units) => {
|
|
|
322
337
|
if (isAvatarExntensionEnabled && hasAvatarExntensionField) {
|
|
323
338
|
return {
|
|
324
339
|
...unit,
|
|
325
|
-
expression: ["avatar/avatars"]
|
|
340
|
+
expression: ["avatar/avatars"],
|
|
341
|
+
kind
|
|
326
342
|
};
|
|
327
343
|
}
|
|
328
344
|
}
|
|
329
|
-
return
|
|
345
|
+
return {
|
|
346
|
+
...unit,
|
|
347
|
+
kind
|
|
348
|
+
};
|
|
330
349
|
};
|
|
331
350
|
const fixViewUnit = (schema, fromType, unit, units, {
|
|
332
351
|
unitDefinitions,
|