@luomus/laji-form 15.1.74 → 15.1.75

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.
@@ -74,17 +74,11 @@ const LajiForm_1 = __importDefault(require("../LajiForm"));
74
74
  const utils_1 = require("../../utils");
75
75
  const BaseComponent_1 = __importDefault(require("../BaseComponent"));
76
76
  const react_spinner_1 = __importDefault(require("react-spinner"));
77
- const exif_js_1 = __importDefault(require("exif-js"));
77
+ const exifreader_1 = __importDefault(require("exifreader"));
78
78
  const utils_2 = require("@luomus/laji-map/lib/utils");
79
79
  const moment_1 = __importDefault(require("moment"));
80
80
  const ReactContext_1 = __importDefault(require("../../ReactContext"));
81
81
  const utils_3 = require("@rjsf/utils");
82
- function toDecimal(number) {
83
- if (!number)
84
- return undefined;
85
- return number[0].numerator + number[1].numerator /
86
- (60 * number[1].denominator) + number[2].numerator / (3600 * number[2].denominator);
87
- }
88
82
  let mediaUuid = 0;
89
83
  let ImageArrayField = class ImageArrayField extends React.Component {
90
84
  constructor() {
@@ -270,11 +264,16 @@ function MediaArrayField(ComposedComponent) {
270
264
  return promise;
271
265
  }
272
266
  return promise.then(found => new Promise(resolve => {
273
- exif_js_1.default.getData(file, function () {
267
+ exifreader_1.default.load(file).then(tags => {
268
+ var _a, _b;
274
269
  if ("geometry" in found)
275
270
  try {
276
- const coordinates = ["GPSLongitude", "GPSLatitude"].map(tag => toDecimal(exif_js_1.default.getTag(this, tag)));
277
- const rawDatum = exif_js_1.default.getTag(this, "GPSMapDatum");
271
+ const coordinates = ["GPSLongitude", "GPSLatitude"].map(tag => {
272
+ var _a;
273
+ const coord = (_a = tags[tag]) === null || _a === void 0 ? void 0 : _a.description;
274
+ return coord;
275
+ });
276
+ const rawDatum = (_a = tags["GPSMapDatum"]) === null || _a === void 0 ? void 0 : _a.description;
278
277
  const datum = typeof rawDatum === "string"
279
278
  ? rawDatum.trim().toUpperCase()
280
279
  : undefined;
@@ -301,7 +300,7 @@ function MediaArrayField(ComposedComponent) {
301
300
  };
302
301
  if ("date" in found) {
303
302
  try {
304
- const rawDate = exif_js_1.default.getTag(this, "DateTimeOriginal");
303
+ const rawDate = (_b = tags["DateTimeOriginal"]) === null || _b === void 0 ? void 0 : _b.description;
305
304
  const momentDate = (0, moment_1.default)(rawDate, "YYYY:MM:DD HH:mm:ss");
306
305
  if (momentDate.isValid()) {
307
306
  found.date = momentDate.format("YYYY-MM-DDTHH:mm");
@@ -87,8 +87,10 @@ class _AutosuggestWidget extends React.Component {
87
87
  return React.createElement(TaxonAutosuggestWidget, Object.assign({}, this.props, { options: Object.assign(Object.assign({}, this.props.options), { autosuggestField: "taxa" }) }));
88
88
  case "unit":
89
89
  return React.createElement(UnitAutosuggestWidget, Object.assign({}, this.props, { basePath: "/shorthand/unit/trip-report" }));
90
- case "friends":
91
90
  case "person":
91
+ return React.createElement(FriendsAutosuggestWidget, Object.assign({}, this.props, { options: Object.assign(Object.assign({}, this.props.options), { autosuggestField: "persons" }) }));
92
+ case "friends":
93
+ case "persons":
92
94
  return React.createElement(FriendsAutosuggestWidget, Object.assign({}, this.props));
93
95
  case "organization":
94
96
  return React.createElement(OrganizationAutosuggestWidget, Object.assign({}, this.props));
@@ -115,6 +117,7 @@ class _AutosuggestWidget extends React.Component {
115
117
  break;
116
118
  case "friends":
117
119
  case "person":
120
+ case "persons":
118
121
  component = FriendsAutosuggestWidget;
119
122
  break;
120
123
  case "organization":
@@ -330,7 +333,7 @@ class FriendsAutosuggestWidget extends React.Component {
330
333
  const { showID } = (0, utils_1.getUiOptions)(this.props);
331
334
  const { isAdmin } = this.props.formContext.uiSchemaContext;
332
335
  if (this.isValueSuggested(value)) {
333
- const { fullName, group, id } = yield this.props.formContext.apiClient.get(`/person/by-id/${value}`);
336
+ const { fullName, group, id } = yield this.props.formContext.apiClient.get(`/person/${value}`);
334
337
  if (fullName) {
335
338
  const addGroup = str => group ? `${str} (${group})` : str;
336
339
  const addID = str => isAdmin && showID ? `${str} (${id})` : str;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luomus/laji-form",
3
- "version": "15.1.74",
3
+ "version": "15.1.75",
4
4
  "description": "React module capable of building dynamic forms from Laji form json schemas",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -52,7 +52,7 @@
52
52
  "@types/react-spinner": "^0.2.0",
53
53
  "deep-equal": "^2.0.5",
54
54
  "deepmerge": "^4.2.2",
55
- "exif-js": "^2.3.0",
55
+ "exifreader": "^4.32.0",
56
56
  "immutability-helper": "^3.1.1",
57
57
  "isomorphic-fetch": "^3.0.0",
58
58
  "memoizee": "^0.4.15",