@nocobase/database 1.3.44-beta → 1.3.46-beta

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.
@@ -58,7 +58,11 @@ const _BooleanInterface = class _BooleanInterface extends import_base_interface.
58
58
  const option = enumConfig.find((item) => item.value === value);
59
59
  return option == null ? void 0 : option.label;
60
60
  } else {
61
- return value ? "\u662F" : value === null || value === void 0 ? "" : "\u5426";
61
+ const label = value ? "True" : value === null || value === void 0 ? "" : "False";
62
+ if (ctx == null ? void 0 : ctx.t) {
63
+ return ctx.t(label, { ns: "action-export" });
64
+ }
65
+ return label;
62
66
  }
63
67
  }
64
68
  };
@@ -64,7 +64,13 @@ const _MultipleSelectInterface = class _MultipleSelectInterface extends import_b
64
64
  const enumConfig = ((_a = this.options.uiSchema) == null ? void 0 : _a.enum) || [];
65
65
  return import_lodash.default.castArray(value).map((value2) => {
66
66
  const option = enumConfig.find((item) => item.value === value2);
67
- return option ? option.label : value2;
67
+ if (option) {
68
+ if (ctx == null ? void 0 : ctx.t) {
69
+ return ctx.t(option.label, { ns: "lm-collections" });
70
+ }
71
+ return option.label;
72
+ }
73
+ return value2;
68
74
  }).join(",");
69
75
  }
70
76
  };
@@ -52,7 +52,13 @@ const _SelectInterface = class _SelectInterface extends import_base_interface.Ba
52
52
  var _a;
53
53
  const enumConfig = ((_a = this.options.uiSchema) == null ? void 0 : _a.enum) || [];
54
54
  const option = enumConfig.find((item) => item.value === value);
55
- return (option == null ? void 0 : option.label) || value;
55
+ if (option) {
56
+ if (ctx == null ? void 0 : ctx.t) {
57
+ return ctx.t(option.label, { ns: "lm-collections" });
58
+ }
59
+ return option.label;
60
+ }
61
+ return value;
56
62
  }
57
63
  };
58
64
  __name(_SelectInterface, "SelectInterface");
@@ -39,7 +39,7 @@ const _ToOneInterface = class _ToOneInterface extends import_base_interface.Base
39
39
  if (!str) {
40
40
  return null;
41
41
  }
42
- const { filterKey, targetCollection, transaction } = ctx;
42
+ const { filterKey, associationField, targetCollection, transaction } = ctx;
43
43
  const targetInstance = await targetCollection.repository.findOne({
44
44
  filter: {
45
45
  [filterKey]: str
@@ -49,8 +49,8 @@ const _ToOneInterface = class _ToOneInterface extends import_base_interface.Base
49
49
  if (!targetInstance) {
50
50
  throw new Error(`"${str}" not found in ${targetCollection.model.name} ${filterKey}`);
51
51
  }
52
- const primaryKeyAttribute = targetCollection.model.primaryKeyAttribute;
53
- return targetInstance[primaryKeyAttribute];
52
+ const targetKey = associationField.targetKey || targetCollection.model.primaryKeyAttribute;
53
+ return targetInstance[targetKey];
54
54
  }
55
55
  };
56
56
  __name(_ToOneInterface, "ToOneInterface");
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "1.3.44-beta",
3
+ "version": "1.3.46-beta",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "license": "AGPL-3.0",
8
8
  "dependencies": {
9
- "@nocobase/logger": "1.3.44-beta",
10
- "@nocobase/utils": "1.3.44-beta",
9
+ "@nocobase/logger": "1.3.46-beta",
10
+ "@nocobase/utils": "1.3.46-beta",
11
11
  "async-mutex": "^0.3.2",
12
12
  "chalk": "^4.1.1",
13
13
  "cron-parser": "4.4.0",
@@ -38,5 +38,5 @@
38
38
  "url": "git+https://github.com/nocobase/nocobase.git",
39
39
  "directory": "packages/database"
40
40
  },
41
- "gitHead": "1d5666123ac1e2997e434e38defef963ba0d9f90"
41
+ "gitHead": "f63f7433de426ec069b71c1eb9ed24a17784e990"
42
42
  }