@nocobase/utils 1.8.0-beta.12 → 1.8.0-beta.13

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/index.d.ts CHANGED
@@ -37,5 +37,6 @@ export * from './url';
37
37
  export * from './i18n';
38
38
  export * from './wrap-middleware';
39
39
  export * from './object-to-cli-args';
40
+ export * from './parsedValue';
40
41
  export * from './dateRangeUtils';
41
42
  export { Schema } from '@formily/json-schema';
package/lib/index.js CHANGED
@@ -72,6 +72,7 @@ __reExport(src_exports, require("./url"), module.exports);
72
72
  __reExport(src_exports, require("./i18n"), module.exports);
73
73
  __reExport(src_exports, require("./wrap-middleware"), module.exports);
74
74
  __reExport(src_exports, require("./object-to-cli-args"), module.exports);
75
+ __reExport(src_exports, require("./parsedValue"), module.exports);
75
76
  __reExport(src_exports, require("./dateRangeUtils"), module.exports);
76
77
  var import_json_schema = require("@formily/json-schema");
77
78
  // Annotate the CommonJS export names for ESM import in node:
@@ -107,5 +108,6 @@ var import_json_schema = require("@formily/json-schema");
107
108
  ...require("./i18n"),
108
109
  ...require("./wrap-middleware"),
109
110
  ...require("./object-to-cli-args"),
111
+ ...require("./parsedValue"),
110
112
  ...require("./dateRangeUtils")
111
113
  });
@@ -0,0 +1 @@
1
+ export declare const parsedValue: (value: any, variables: any) => any;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
+ var __export = (target, all) => {
16
+ for (var name in all)
17
+ __defProp(target, name, { get: all[name], enumerable: true });
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") {
21
+ for (let key of __getOwnPropNames(from))
22
+ if (!__hasOwnProp.call(to, key) && key !== except)
23
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
+ }
25
+ return to;
26
+ };
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var parsedValue_exports = {};
29
+ __export(parsedValue_exports, {
30
+ parsedValue: () => parsedValue
31
+ });
32
+ module.exports = __toCommonJS(parsedValue_exports);
33
+ var import_json_templates = require("./json-templates");
34
+ function appendArrayColumn(scope, key) {
35
+ const paths = key.split(".");
36
+ let data = scope;
37
+ for (let p = 0; p < paths.length && data != null; p++) {
38
+ const path = paths[p];
39
+ const isIndex = path.match(/^\d+$/);
40
+ if (Array.isArray(data) && !isIndex && !data[path]) {
41
+ data[path] = data.map((item) => item[path]).flat();
42
+ }
43
+ data = data == null ? void 0 : data[path];
44
+ }
45
+ }
46
+ __name(appendArrayColumn, "appendArrayColumn");
47
+ const parsedValue = /* @__PURE__ */ __name((value, variables) => {
48
+ const template = (0, import_json_templates.parse)(value);
49
+ template.parameters.forEach(({ key }) => {
50
+ appendArrayColumn(variables, key);
51
+ });
52
+ return template(variables);
53
+ }, "parsedValue");
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ parsedValue
57
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/utils",
3
- "version": "1.8.0-beta.12",
3
+ "version": "1.8.0-beta.13",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "license": "AGPL-3.0",
@@ -16,5 +16,5 @@
16
16
  "multer": "^1.4.5-lts.2",
17
17
  "object-path": "^0.11.8"
18
18
  },
19
- "gitHead": "b244f9b23ce35bd75baf7b357c6d53d0fbddf3be"
19
+ "gitHead": "9ccd306ff667a54317ba07a000fc5aa00685d5e6"
20
20
  }