@nocobase/utils 1.6.0-alpha.7 → 1.6.0-alpha.9

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
@@ -36,3 +36,4 @@ export declare const moment2str: (value?: dayjs.Dayjs, options?: Moment2strOptio
36
36
  */
37
37
  export declare function offsetFromString(string: string | number): number;
38
38
  export declare const getPickerFormat: (picker: any) => "YYYY-MM" | "YYYY" | "YYYY[W]W" | "YYYY-MM-DD" | "YYYY[Q]Q";
39
+ export declare const getDateTimeFormat: (picker: any, format: any, showTime: any, timeFormat: any) => any;
package/lib/date.js CHANGED
@@ -37,6 +37,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
37
37
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
38
  var date_exports = {};
39
39
  __export(date_exports, {
40
+ getDateTimeFormat: () => getDateTimeFormat,
40
41
  getDefaultFormat: () => getDefaultFormat,
41
42
  getPickerFormat: () => getPickerFormat,
42
43
  moment2str: () => moment2str,
@@ -205,8 +206,18 @@ const getPickerFormat = /* @__PURE__ */ __name((picker) => {
205
206
  return "YYYY-MM-DD";
206
207
  }
207
208
  }, "getPickerFormat");
209
+ const getDateTimeFormat = /* @__PURE__ */ __name((picker, format, showTime, timeFormat) => {
210
+ if (picker === "date") {
211
+ if (showTime) {
212
+ return format + timeFormat || "HH:mm:ss";
213
+ }
214
+ return format;
215
+ }
216
+ return format;
217
+ }, "getDateTimeFormat");
208
218
  // Annotate the CommonJS export names for ESM import in node:
209
219
  0 && (module.exports = {
220
+ getDateTimeFormat,
210
221
  getDefaultFormat,
211
222
  getPickerFormat,
212
223
  moment2str,
package/lib/index.d.ts CHANGED
@@ -34,5 +34,6 @@ export * from './uid';
34
34
  export * from './url';
35
35
  export * from './i18n';
36
36
  export * from './wrap-middleware';
37
+ export * from './object-to-cli-args';
37
38
  export { dayjs, lodash };
38
39
  export { Schema } from '@formily/json-schema';
package/lib/index.js CHANGED
@@ -70,6 +70,7 @@ __reExport(src_exports, require("./uid"), module.exports);
70
70
  __reExport(src_exports, require("./url"), module.exports);
71
71
  __reExport(src_exports, require("./i18n"), module.exports);
72
72
  __reExport(src_exports, require("./wrap-middleware"), module.exports);
73
+ __reExport(src_exports, require("./object-to-cli-args"), module.exports);
73
74
  var import_json_schema = require("@formily/json-schema");
74
75
  // Annotate the CommonJS export names for ESM import in node:
75
76
  0 && (module.exports = {
@@ -101,5 +102,6 @@ var import_json_schema = require("@formily/json-schema");
101
102
  ...require("./uid"),
102
103
  ...require("./url"),
103
104
  ...require("./i18n"),
104
- ...require("./wrap-middleware")
105
+ ...require("./wrap-middleware"),
106
+ ...require("./object-to-cli-args")
105
107
  });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Convert object to CLI arguments array
3
+ * @param obj Object to convert
4
+ * @returns CLI arguments array
5
+ */
6
+ export declare function objectToCliArgs(obj: Record<string, any>): string[];
@@ -0,0 +1,43 @@
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 object_to_cli_args_exports = {};
29
+ __export(object_to_cli_args_exports, {
30
+ objectToCliArgs: () => objectToCliArgs
31
+ });
32
+ module.exports = __toCommonJS(object_to_cli_args_exports);
33
+ function objectToCliArgs(obj) {
34
+ return Object.entries(obj).filter(([_, value]) => value !== null && value !== void 0).map(([key, value]) => {
35
+ const stringValue = typeof value === "object" ? JSON.stringify(value) : value;
36
+ return `--${key}=${stringValue}`;
37
+ });
38
+ }
39
+ __name(objectToCliArgs, "objectToCliArgs");
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ objectToCliArgs
43
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/utils",
3
- "version": "1.6.0-alpha.7",
3
+ "version": "1.6.0-alpha.9",
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.1",
17
17
  "object-path": "^0.11.8"
18
18
  },
19
- "gitHead": "d9552440f5e3ce2795c9f2f23a1b04f5376a1550"
19
+ "gitHead": "c6136fc6c9a2daab33fb1a20716cd9768e9a147f"
20
20
  }