@nocobase/utils 1.7.19 → 1.8.0-alpha.10

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/date.d.ts CHANGED
@@ -12,7 +12,6 @@ export interface Str2momentOptions {
12
12
  picker?: 'year' | 'month' | 'week' | 'quarter';
13
13
  utcOffset?: number;
14
14
  utc?: boolean;
15
- dateOnly?: boolean;
16
15
  }
17
16
  export type Str2momentValue = string | string[] | dayjs.Dayjs | dayjs.Dayjs[];
18
17
  export interface GetDefaultFormatProps {
package/lib/date.js CHANGED
@@ -102,13 +102,10 @@ const toMoment = /* @__PURE__ */ __name((val, options) => {
102
102
  return;
103
103
  }
104
104
  const offset = options.utcOffset;
105
- const { gmt, picker, utc = true, dateOnly } = options;
105
+ const { gmt, picker, utc = true } = options;
106
106
  if ((0, import_dayjs.dayjs)(val).isValid()) {
107
- if (dateOnly) {
108
- return import_dayjs.dayjs.utc(val, "YYYY-MM-DD");
109
- }
110
107
  if (!utc) {
111
- return import_dayjs.dayjs.utc(val);
108
+ return (0, import_dayjs.dayjs)(val);
112
109
  }
113
110
  if (import_dayjs.dayjs.isDayjs(val)) {
114
111
  return offset ? val.utcOffset(offsetFromString(offset)) : val;
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
  });
@@ -196,9 +196,6 @@ const parseFilter = /* @__PURE__ */ __name(async (filter, opts = {}) => {
196
196
  if (isDateOperator(operator)) {
197
197
  const field = getField == null ? void 0 : getField(path);
198
198
  if ((field == null ? void 0 : field.constructor.name) === "DateOnlyField" || (field == null ? void 0 : field.constructor.name) === "DatetimeNoTzField") {
199
- if (value.type) {
200
- return (0, import_dateRangeUtils.getDayRangeByParams)({ ...value, timezone: (field == null ? void 0 : field.timezone) || timezone });
201
- }
202
199
  return value;
203
200
  }
204
201
  return dateValueWrapper(value, (field == null ? void 0 : field.timezone) || timezone);
@@ -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.7.19",
3
+ "version": "1.8.0-alpha.10",
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": "39992983a40047432e6582623b996ba23b51ef5a"
19
+ "gitHead": "31b2895b847f6998492e20bb923c2791e896951d"
20
20
  }