blixify-ui-web 1.3.49 → 1.3.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAoCA,OAAO,KASN,MAAM,OAAO,CAAC;AA8Hf,OAAO,EAGL,iBAAiB,EAOlB,MAAM,kBAAkB,CAAC;AAmL1B,eAAO,MAAM,qBAAqB,OAAO,CAAC;AA6C1C,eAAO,MAAM,yBAAyB,UAAW,GAAG,YAYnD,CAAC;AAeF,eAAO,MAAM,YAAY,mFA2hlBvB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAoCA,OAAO,KASN,MAAM,OAAO,CAAC;AA8Hf,OAAO,EAGL,iBAAiB,EAOlB,MAAM,kBAAkB,CAAC;AAmL1B,eAAO,MAAM,qBAAqB,OAAO,CAAC;AA6C1C,eAAO,MAAM,yBAAyB,UAAW,GAAG,YAYnD,CAAC;AAeF,eAAO,MAAM,YAAY,mFAmjlBvB,CAAC"}
@@ -11964,6 +11964,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
11964
11964
  var _a, _b, _c;
11965
11965
  (_b = (_a = props.organise) === null || _a === void 0 ? void 0 : _a.onAddColumns) === null || _b === void 0 ? void 0 : _b.call(_a, (0, lookup_1.handleRestoreLookupColumns)((0, systemColumns_1.handleStripSystemColumns)(columns, ((_c = props.model) !== null && _c !== void 0 ? _c : []).map(function (each) { return each.id; })), rawProps.model));
11966
11966
  };
11967
+ // INFO: a single file or image column stores every upload under one name,
11968
+ // and that name is what the cell shows and what the preview reads the type
11969
+ // from. A file column takes PDFs unless it names its own extensions; the
11970
+ // rest are images.
11971
+ var handleDefaultAssetFileName = function (column) {
11972
+ var _a;
11973
+ if (column.type !== "file")
11974
+ return "".concat(column.id, ".png");
11975
+ var extension = ((_a = column.fileExtension) !== null && _a !== void 0 ? _a : "").split(",")[0].trim().replace(/^\./, "") ||
11976
+ "pdf";
11977
+ return "".concat(column.id, ".").concat(extension);
11978
+ };
11967
11979
  var handleAddPlainColumn = function (column) {
11968
11980
  var newColumn = __assign({}, column);
11969
11981
  // INFO: the fields a new column needs beyond a name and a type are all
@@ -11971,7 +11983,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
11971
11983
  // workspace's upload endpoint — so they are filled in rather than asked for.
11972
11984
  if (["image", "file", "multipleImage", "multipleFile", "signature"].includes(column.type)) {
11973
11985
  newColumn.imageCollectionName = props.collectionId;
11974
- newColumn.imageFileName = "".concat(column.id, ".png");
11986
+ newColumn.imageFileName = handleDefaultAssetFileName(column);
11975
11987
  if (devSettings.uploadEndpoint)
11976
11988
  newColumn.uploadEndpoint = devSettings.uploadEndpoint;
11977
11989
  }
@@ -11981,12 +11993,20 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (rawProps, ref) {
11981
11993
  // goes out through onAddColumns like adding and removing do. A column now
11982
11994
  // holding files is filed against this table, as a new one is.
11983
11995
  var handleEditPlainColumn = function (column) {
11984
- var _a, _b;
11996
+ var _a;
11985
11997
  var edited = __assign({}, column);
11998
+ var previous = structure.find(function (eachColumn) { return eachColumn.id === column.id; });
11986
11999
  if (["image", "file", "multipleImage", "multipleFile"].includes(column.type)) {
11987
12000
  edited.imageCollectionName =
11988
12001
  (_a = edited.imageCollectionName) !== null && _a !== void 0 ? _a : props.collectionId;
11989
- edited.imageFileName = (_b = edited.imageFileName) !== null && _b !== void 0 ? _b : "".concat(column.id, ".png");
12002
+ // INFO: a column turned from one asset type to another drops the name
12003
+ // given to its old type, so a file column does not keep "<id>.png"
12004
+ var keepsName = edited.imageFileName &&
12005
+ !(previous &&
12006
+ previous.type !== column.type &&
12007
+ edited.imageFileName === handleDefaultAssetFileName(previous));
12008
+ if (!keepsName)
12009
+ edited.imageFileName = handleDefaultAssetFileName(column);
11990
12010
  if (devSettings.uploadEndpoint && !edited.uploadEndpoint)
11991
12011
  edited.uploadEndpoint = devSettings.uploadEndpoint;
11992
12012
  }