@nocobase/utils 1.8.0-beta.11 → 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/date.d.ts CHANGED
@@ -12,6 +12,7 @@ export interface Str2momentOptions {
12
12
  picker?: 'year' | 'month' | 'week' | 'quarter';
13
13
  utcOffset?: number;
14
14
  utc?: boolean;
15
+ dateOnly?: boolean;
15
16
  }
16
17
  export type Str2momentValue = string | string[] | dayjs.Dayjs | dayjs.Dayjs[];
17
18
  export interface GetDefaultFormatProps {
package/lib/date.js CHANGED
@@ -102,10 +102,13 @@ const toMoment = /* @__PURE__ */ __name((val, options) => {
102
102
  return;
103
103
  }
104
104
  const offset = options.utcOffset;
105
- const { gmt, picker, utc = true } = options;
105
+ const { gmt, picker, utc = true, dateOnly } = options;
106
106
  if ((0, import_dayjs.dayjs)(val).isValid()) {
107
+ if (dateOnly) {
108
+ return import_dayjs.dayjs.utc(val, "YYYY-MM-DD");
109
+ }
107
110
  if (!utc) {
108
- return (0, import_dayjs.dayjs)(val);
111
+ return import_dayjs.dayjs.utc(val);
109
112
  }
110
113
  if (import_dayjs.dayjs.isDayjs(val)) {
111
114
  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,6 +196,9 @@ 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
+ }
199
202
  return value;
200
203
  }
201
204
  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.8.0-beta.11",
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": "95dcdf842f5dce58786ec01f0e4d40a87d2fff2e"
19
+ "gitHead": "9ccd306ff667a54317ba07a000fc5aa00685d5e6"
20
20
  }