@krainovsd/js-helpers 0.15.3 → 0.16.0

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.
Files changed (59) hide show
  1. package/lib/cjs/index.cjs +658 -569
  2. package/lib/cjs/index.cjs.map +1 -1
  3. package/lib/esm/{lib/api/middlewares/console-post-middleware.js → api/after/logger-after-handler.js} +4 -4
  4. package/lib/esm/api/after/logger-after-handler.js.map +1 -0
  5. package/lib/esm/api/api.constants.js +23 -0
  6. package/lib/esm/api/api.constants.js.map +1 -0
  7. package/lib/esm/api/api.js +343 -0
  8. package/lib/esm/api/api.js.map +1 -0
  9. package/lib/esm/{lib/api/middlewares/console-middleware.js → api/before/logger-before-handler.js} +4 -4
  10. package/lib/esm/api/before/logger-before-handler.js.map +1 -0
  11. package/lib/esm/api/before/oauth-before-handler.js +56 -0
  12. package/lib/esm/api/before/oauth-before-handler.js.map +1 -0
  13. package/lib/esm/{lib/api/oauth/token.js → api/oauth.js} +30 -10
  14. package/lib/esm/api/oauth.js.map +1 -0
  15. package/lib/esm/constants/errors.js +16 -0
  16. package/lib/esm/constants/errors.js.map +1 -0
  17. package/lib/esm/constants/index.js +27 -0
  18. package/lib/esm/constants/index.js.map +1 -0
  19. package/lib/esm/index.js +9 -8
  20. package/lib/esm/index.js.map +1 -1
  21. package/lib/esm/lib/colors/get-color-format.js +1 -2
  22. package/lib/esm/lib/colors/get-color-format.js.map +1 -1
  23. package/lib/esm/lib/colors/take-opacity-colors.js +1 -2
  24. package/lib/esm/lib/colors/take-opacity-colors.js.map +1 -1
  25. package/lib/esm/lib/colors/transform-to-color.js +1 -2
  26. package/lib/esm/lib/colors/transform-to-color.js.map +1 -1
  27. package/lib/esm/lib/date/get-date-by-rules.js +1 -2
  28. package/lib/esm/lib/date/get-date-by-rules.js.map +1 -1
  29. package/lib/esm/lib/date/is-yesterday.js +0 -1
  30. package/lib/esm/lib/date/is-yesterday.js.map +1 -1
  31. package/lib/esm/lib/utils/build-query-string.js.map +1 -1
  32. package/lib/esm/lib/utils/{create-url-with-params.js → create-url-with-queries.js} +3 -3
  33. package/lib/esm/lib/utils/create-url-with-queries.js.map +1 -0
  34. package/lib/esm/lib/utils/field-view-format.js +1 -2
  35. package/lib/esm/lib/utils/field-view-format.js.map +1 -1
  36. package/lib/index.d.ts +224 -170
  37. package/package.json +4 -2
  38. package/lib/esm/constants/api.js +0 -10
  39. package/lib/esm/constants/api.js.map +0 -1
  40. package/lib/esm/constants/colors.js +0 -9
  41. package/lib/esm/constants/colors.js.map +0 -1
  42. package/lib/esm/constants/date.js +0 -11
  43. package/lib/esm/constants/date.js.map +0 -1
  44. package/lib/esm/constants/fields.js +0 -11
  45. package/lib/esm/constants/fields.js.map +0 -1
  46. package/lib/esm/lib/api/constants.js +0 -4
  47. package/lib/esm/lib/api/constants.js.map +0 -1
  48. package/lib/esm/lib/api/core.js +0 -191
  49. package/lib/esm/lib/api/core.js.map +0 -1
  50. package/lib/esm/lib/api/middlewares/console-middleware.js.map +0 -1
  51. package/lib/esm/lib/api/middlewares/console-post-middleware.js.map +0 -1
  52. package/lib/esm/lib/api/middlewares/index.js +0 -65
  53. package/lib/esm/lib/api/middlewares/index.js.map +0 -1
  54. package/lib/esm/lib/api/middlewares/oauth-middleware.js +0 -75
  55. package/lib/esm/lib/api/middlewares/oauth-middleware.js.map +0 -1
  56. package/lib/esm/lib/api/oauth/token.js.map +0 -1
  57. package/lib/esm/lib/api/oauth/user.js +0 -35
  58. package/lib/esm/lib/api/oauth/user.js.map +0 -1
  59. package/lib/esm/lib/utils/create-url-with-params.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sources":["../../../src/constants/errors.ts"],"sourcesContent":["import type { RequestHeader } from \"../api\";\n\ntype ResponseErrorOptions = {\n message: string;\n status: number;\n code?: number;\n description?: unknown;\n headers?: RequestHeader;\n};\n\nexport class ResponseError extends Error {\n status: number;\n code?: number;\n description?: unknown;\n headers?: RequestHeader;\n\n constructor({ message, status, description, code, headers }: ResponseErrorOptions) {\n super(message);\n this.status = status;\n this.description = description;\n this.code = code;\n this.headers = headers;\n }\n}\n"],"names":[],"mappings":"AAUM,MAAO,aAAc,SAAQ,KAAK,CAAA;AACtC,IAAA,MAAM;AACN,IAAA,IAAI;AACJ,IAAA,WAAW;AACX,IAAA,OAAO;IAEP,WAAY,CAAA,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAwB,EAAA;QAC/E,KAAK,CAAC,OAAO,CAAC;AACd,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM;AACpB,QAAA,IAAI,CAAC,WAAW,GAAG,WAAW;AAC9B,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI;AAChB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;;AAEzB;;;;"}
@@ -0,0 +1,27 @@
1
+ export { IS_BROWSER, IS_BUN, IS_DENO, IS_JEST, IS_NODE, IS_WEB_WORKER } from './environment.js';
2
+
3
+ const COLOR_FORMATS = {
4
+ Hex: "HEX",
5
+ Rgb: "RGB",
6
+ Rgba: "RGBA",
7
+ Hsl: "HSL",
8
+ };
9
+ const DATE_TYPES = {
10
+ Days: "days",
11
+ Months: "months",
12
+ Years: "years",
13
+ Seconds: "seconds",
14
+ Minutes: "minutes",
15
+ Hours: "hours",
16
+ };
17
+ const FIELD_TYPES = {
18
+ Date: "date",
19
+ Time: "time",
20
+ DateTime: "dateTime",
21
+ String: "string",
22
+ Number: "number",
23
+ Array: "array",
24
+ };
25
+
26
+ export { COLOR_FORMATS, DATE_TYPES, FIELD_TYPES };
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/constants/index.ts"],"sourcesContent":["export * from \"./errors\";\nexport * from \"./environment\";\n\nexport const COLOR_FORMATS = {\n Hex: \"HEX\",\n Rgb: \"RGB\",\n Rgba: \"RGBA\",\n Hsl: \"HSL\",\n} as const;\n\nexport const DATE_TYPES = {\n Days: \"days\",\n Months: \"months\",\n Years: \"years\",\n Seconds: \"seconds\",\n Minutes: \"minutes\",\n Hours: \"hours\",\n} as const;\n\nexport const FIELD_TYPES = {\n Date: \"date\",\n Time: \"time\",\n DateTime: \"dateTime\",\n String: \"string\",\n Number: \"number\",\n Array: \"array\",\n} as const;\n"],"names":[],"mappings":";;AAGa,MAAA,aAAa,GAAG;AAC3B,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,GAAG,EAAE,KAAK;;AAGC,MAAA,UAAU,GAAG;AACxB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,KAAK,EAAE,OAAO;;AAGH,MAAA,WAAW,GAAG;AACzB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,KAAK,EAAE,OAAO;;;;;"}
package/lib/esm/index.js CHANGED
@@ -1,6 +1,3 @@
1
- export { ResponseError, createRequestClientInstance } from './lib/api/core.js';
2
- export { getOauthToken, getOauthTokenFromOtherWindow } from './lib/api/oauth/token.js';
3
- export { getAuthUser, updateAuthUser } from './lib/api/oauth/user.js';
4
1
  export { downloadFile } from './lib/browser/download-file.js';
5
2
  export { downloadJson } from './lib/browser/download-json.js';
6
3
  export { readFile } from './lib/browser/read-file.js';
@@ -32,7 +29,7 @@ export { jsonParse } from './lib/utils/json-parse.js';
32
29
  export { randomString } from './lib/utils/random-string.js';
33
30
  export { wait } from './lib/utils/wait.js';
34
31
  export { transformToNumber } from './lib/utils/transform-to-number.js';
35
- export { createURLWithParams } from './lib/utils/create-url-with-params.js';
32
+ export { createURLWithQueries } from './lib/utils/create-url-with-queries.js';
36
33
  export { trimUrl } from './lib/utils/trim-url.js';
37
34
  export { arrayToMapByKey } from './lib/utils/array-to-map-by-key.js';
38
35
  export { buildQueryString } from './lib/utils/build-query-string.js';
@@ -70,9 +67,13 @@ export { differenceWith } from './lib/lodash/difference-with.js';
70
67
  export { isEqual } from './lib/lodash/is-equal.js';
71
68
  export { throttle } from './lib/lodash/throttle.js';
72
69
  export { type } from './lib/lodash/type.js';
73
- export { DATE_TYPES } from './constants/date.js';
74
- export { API_MIDDLEWARES, POST_API_MIDDLEWARES } from './constants/api.js';
70
+ export { COLOR_FORMATS, DATE_TYPES, FIELD_TYPES } from './constants/index.js';
71
+ export { createFetchClient } from './api/api.js';
72
+ export { getOauthToken, getOauthTokenFromOtherWindow, refetchAfterOauth } from './api/oauth.js';
73
+ export { loggerAfterHandler } from './api/after/logger-after-handler.js';
74
+ export { loggerBeforeHandler } from './api/before/logger-before-handler.js';
75
+ export { oauthBeforeHandler } from './api/before/oauth-before-handler.js';
76
+ export { OAUTH_STATE, REQUEST_ERROR, RESPONSE_DATA_SYMBOL } from './api/api.constants.js';
77
+ export { ResponseError } from './constants/errors.js';
75
78
  export { IS_BROWSER, IS_BUN, IS_DENO, IS_JEST, IS_NODE, IS_WEB_WORKER } from './constants/environment.js';
76
- export { COLOR_FORMATS } from './constants/colors.js';
77
- export { FIELD_TYPES } from './constants/fields.js';
78
79
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,4 @@
1
- import '../../constants/environment.js';
2
- import { COLOR_FORMATS } from '../../constants/colors.js';
1
+ import { COLOR_FORMATS } from '../../constants/index.js';
3
2
 
4
3
  function getColorFormat(color) {
5
4
  if (color.startsWith("#")) {
@@ -1 +1 @@
1
- {"version":3,"file":"get-color-format.js","sources":["../../../../src/lib/colors/get-color-format.ts"],"sourcesContent":["import { COLOR_FORMATS } from \"../../constants\";\n\nexport function getColorFormat(color: string) {\n if (color.startsWith(\"#\")) {\n return COLOR_FORMATS.Hex;\n }\n if (color.startsWith(\"rgba\")) {\n return COLOR_FORMATS.Rgba;\n }\n if (color.startsWith(\"rgb\")) {\n return COLOR_FORMATS.Rgb;\n }\n if (color.startsWith(\"hsl\")) {\n return COLOR_FORMATS.Hsl;\n }\n}\n"],"names":[],"mappings":";;;AAEM,SAAU,cAAc,CAAC,KAAa,EAAA;AAC1C,IAAA,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACzB,OAAO,aAAa,CAAC,GAAG;;AAE1B,IAAA,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC5B,OAAO,aAAa,CAAC,IAAI;;AAE3B,IAAA,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QAC3B,OAAO,aAAa,CAAC,GAAG;;AAE1B,IAAA,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QAC3B,OAAO,aAAa,CAAC,GAAG;;AAE5B;;;;"}
1
+ {"version":3,"file":"get-color-format.js","sources":["../../../../src/lib/colors/get-color-format.ts"],"sourcesContent":["import { COLOR_FORMATS } from \"../../constants\";\n\nexport function getColorFormat(color: string) {\n if (color.startsWith(\"#\")) {\n return COLOR_FORMATS.Hex;\n }\n if (color.startsWith(\"rgba\")) {\n return COLOR_FORMATS.Rgba;\n }\n if (color.startsWith(\"rgb\")) {\n return COLOR_FORMATS.Rgb;\n }\n if (color.startsWith(\"hsl\")) {\n return COLOR_FORMATS.Hsl;\n }\n}\n"],"names":[],"mappings":";;AAEM,SAAU,cAAc,CAAC,KAAa,EAAA;AAC1C,IAAA,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACzB,OAAO,aAAa,CAAC,GAAG;;AAE1B,IAAA,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC5B,OAAO,aAAa,CAAC,IAAI;;AAE3B,IAAA,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QAC3B,OAAO,aAAa,CAAC,GAAG;;AAE1B,IAAA,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;QAC3B,OAAO,aAAa,CAAC,GAAG;;AAE5B;;;;"}
@@ -1,5 +1,4 @@
1
- import '../../constants/environment.js';
2
- import { COLOR_FORMATS } from '../../constants/colors.js';
1
+ import { COLOR_FORMATS } from '../../constants/index.js';
3
2
  import { getColorFormat } from './get-color-format.js';
4
3
  import { transformHEXtoRGB } from './transform-hex-to-rgb.js';
5
4
  import { transformRGBtoRGBA } from './transform-rgb-to-rgba.js';
@@ -1 +1 @@
1
- {"version":3,"file":"take-opacity-colors.js","sources":["../../../../src/lib/colors/take-opacity-colors.ts"],"sourcesContent":["import { COLOR_FORMATS } from \"../../constants\";\nimport { getColorFormat } from \"./get-color-format\";\nimport { transformHEXtoRGB } from \"./transform-hex-to-rgb\";\nimport { transformRGBtoRGBA } from \"./transform-rgb-to-rgba\";\nimport { transformRGBAtoRGB } from \"./transform-rgba-to-rgb\";\n\nexport function takeOpacityColors(color: string | undefined, opacities: number[]) {\n let rgbColor = color;\n\n if (!rgbColor) return [];\n\n if (getColorFormat(rgbColor) === COLOR_FORMATS.Hex) {\n rgbColor = transformHEXtoRGB(rgbColor);\n } else if (getColorFormat(rgbColor) === COLOR_FORMATS.Rgba) {\n rgbColor = transformRGBAtoRGB(rgbColor);\n }\n\n if (getColorFormat(rgbColor) !== COLOR_FORMATS.Rgb) return [];\n\n return [...opacities.map((opacity) => transformRGBtoRGBA(rgbColor, opacity))];\n}\n"],"names":[],"mappings":";;;;;;;AAMgB,SAAA,iBAAiB,CAAC,KAAyB,EAAE,SAAmB,EAAA;IAC9E,IAAI,QAAQ,GAAG,KAAK;AAEpB,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,OAAO,EAAE;IAExB,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,GAAG,EAAE;AAClD,QAAA,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC;;SACjC,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,IAAI,EAAE;AAC1D,QAAA,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC;;AAGzC,IAAA,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,GAAG;AAAE,QAAA,OAAO,EAAE;AAE7D,IAAA,OAAO,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAC/E;;;;"}
1
+ {"version":3,"file":"take-opacity-colors.js","sources":["../../../../src/lib/colors/take-opacity-colors.ts"],"sourcesContent":["import { COLOR_FORMATS } from \"../../constants\";\nimport { getColorFormat } from \"./get-color-format\";\nimport { transformHEXtoRGB } from \"./transform-hex-to-rgb\";\nimport { transformRGBtoRGBA } from \"./transform-rgb-to-rgba\";\nimport { transformRGBAtoRGB } from \"./transform-rgba-to-rgb\";\n\nexport function takeOpacityColors(color: string | undefined, opacities: number[]) {\n let rgbColor = color;\n\n if (!rgbColor) return [];\n\n if (getColorFormat(rgbColor) === COLOR_FORMATS.Hex) {\n rgbColor = transformHEXtoRGB(rgbColor);\n } else if (getColorFormat(rgbColor) === COLOR_FORMATS.Rgba) {\n rgbColor = transformRGBAtoRGB(rgbColor);\n }\n\n if (getColorFormat(rgbColor) !== COLOR_FORMATS.Rgb) return [];\n\n return [...opacities.map((opacity) => transformRGBtoRGBA(rgbColor, opacity))];\n}\n"],"names":[],"mappings":";;;;;;AAMgB,SAAA,iBAAiB,CAAC,KAAyB,EAAE,SAAmB,EAAA;IAC9E,IAAI,QAAQ,GAAG,KAAK;AAEpB,IAAA,IAAI,CAAC,QAAQ;AAAE,QAAA,OAAO,EAAE;IAExB,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,GAAG,EAAE;AAClD,QAAA,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC;;SACjC,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,IAAI,EAAE;AAC1D,QAAA,QAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC;;AAGzC,IAAA,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,GAAG;AAAE,QAAA,OAAO,EAAE;AAE7D,IAAA,OAAO,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAC/E;;;;"}
@@ -1,5 +1,4 @@
1
- import '../../constants/environment.js';
2
- import { COLOR_FORMATS } from '../../constants/colors.js';
1
+ import { COLOR_FORMATS } from '../../constants/index.js';
3
2
  import { isString } from '../typings/is-string.js';
4
3
  import { getColorFormat } from './get-color-format.js';
5
4
 
@@ -1 +1 @@
1
- {"version":3,"file":"transform-to-color.js","sources":["../../../../src/lib/colors/transform-to-color.ts"],"sourcesContent":["import { COLOR_FORMATS } from \"../../constants\";\nimport type { ColorFormat } from \"../../types\";\nimport { isString } from \"../typings\";\nimport { getColorFormat } from \"./get-color-format\";\n\nexport function transformToColor(\n currentColor: unknown,\n defaultColor: string = \"black\",\n defaultFormat: ColorFormat = COLOR_FORMATS.Hex,\n) {\n if (!isString(currentColor)) return defaultColor;\n\n let correctColor = currentColor;\n\n if (!getColorFormat(correctColor)) {\n switch (defaultFormat) {\n case COLOR_FORMATS.Hex: {\n correctColor = `#${correctColor}`;\n break;\n }\n case COLOR_FORMATS.Rgb: {\n correctColor = `rgb(${correctColor})`;\n break;\n }\n case COLOR_FORMATS.Rgba: {\n correctColor = `rgba(${correctColor})`;\n break;\n }\n case COLOR_FORMATS.Hsl: {\n correctColor = `hsl(${correctColor})`;\n break;\n }\n default: {\n correctColor = `#${correctColor}`;\n break;\n }\n }\n }\n\n return correctColor;\n}\n"],"names":[],"mappings":";;;;;AAKM,SAAU,gBAAgB,CAC9B,YAAqB,EACrB,YAAuB,GAAA,OAAO,EAC9B,aAAA,GAA6B,aAAa,CAAC,GAAG,EAAA;AAE9C,IAAA,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;AAAE,QAAA,OAAO,YAAY;IAEhD,IAAI,YAAY,GAAG,YAAY;AAE/B,IAAA,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE;QACjC,QAAQ,aAAa;AACnB,YAAA,KAAK,aAAa,CAAC,GAAG,EAAE;AACtB,gBAAA,YAAY,GAAG,CAAA,CAAA,EAAI,YAAY,CAAA,CAAE;gBACjC;;AAEF,YAAA,KAAK,aAAa,CAAC,GAAG,EAAE;AACtB,gBAAA,YAAY,GAAG,CAAA,IAAA,EAAO,YAAY,CAAA,CAAA,CAAG;gBACrC;;AAEF,YAAA,KAAK,aAAa,CAAC,IAAI,EAAE;AACvB,gBAAA,YAAY,GAAG,CAAA,KAAA,EAAQ,YAAY,CAAA,CAAA,CAAG;gBACtC;;AAEF,YAAA,KAAK,aAAa,CAAC,GAAG,EAAE;AACtB,gBAAA,YAAY,GAAG,CAAA,IAAA,EAAO,YAAY,CAAA,CAAA,CAAG;gBACrC;;YAEF,SAAS;AACP,gBAAA,YAAY,GAAG,CAAA,CAAA,EAAI,YAAY,CAAA,CAAE;gBACjC;;;;AAKN,IAAA,OAAO,YAAY;AACrB;;;;"}
1
+ {"version":3,"file":"transform-to-color.js","sources":["../../../../src/lib/colors/transform-to-color.ts"],"sourcesContent":["import { COLOR_FORMATS } from \"../../constants\";\nimport type { ColorFormat } from \"../../types\";\nimport { isString } from \"../typings\";\nimport { getColorFormat } from \"./get-color-format\";\n\nexport function transformToColor(\n currentColor: unknown,\n defaultColor: string = \"black\",\n defaultFormat: ColorFormat = COLOR_FORMATS.Hex,\n) {\n if (!isString(currentColor)) return defaultColor;\n\n let correctColor = currentColor;\n\n if (!getColorFormat(correctColor)) {\n switch (defaultFormat) {\n case COLOR_FORMATS.Hex: {\n correctColor = `#${correctColor}`;\n break;\n }\n case COLOR_FORMATS.Rgb: {\n correctColor = `rgb(${correctColor})`;\n break;\n }\n case COLOR_FORMATS.Rgba: {\n correctColor = `rgba(${correctColor})`;\n break;\n }\n case COLOR_FORMATS.Hsl: {\n correctColor = `hsl(${correctColor})`;\n break;\n }\n default: {\n correctColor = `#${correctColor}`;\n break;\n }\n }\n }\n\n return correctColor;\n}\n"],"names":[],"mappings":";;;;AAKM,SAAU,gBAAgB,CAC9B,YAAqB,EACrB,YAAuB,GAAA,OAAO,EAC9B,aAAA,GAA6B,aAAa,CAAC,GAAG,EAAA;AAE9C,IAAA,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;AAAE,QAAA,OAAO,YAAY;IAEhD,IAAI,YAAY,GAAG,YAAY;AAE/B,IAAA,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE;QACjC,QAAQ,aAAa;AACnB,YAAA,KAAK,aAAa,CAAC,GAAG,EAAE;AACtB,gBAAA,YAAY,GAAG,CAAA,CAAA,EAAI,YAAY,CAAA,CAAE;gBACjC;;AAEF,YAAA,KAAK,aAAa,CAAC,GAAG,EAAE;AACtB,gBAAA,YAAY,GAAG,CAAA,IAAA,EAAO,YAAY,CAAA,CAAA,CAAG;gBACrC;;AAEF,YAAA,KAAK,aAAa,CAAC,IAAI,EAAE;AACvB,gBAAA,YAAY,GAAG,CAAA,KAAA,EAAQ,YAAY,CAAA,CAAA,CAAG;gBACtC;;AAEF,YAAA,KAAK,aAAa,CAAC,GAAG,EAAE;AACtB,gBAAA,YAAY,GAAG,CAAA,IAAA,EAAO,YAAY,CAAA,CAAA,CAAG;gBACrC;;YAEF,SAAS;AACP,gBAAA,YAAY,GAAG,CAAA,CAAA,EAAI,YAAY,CAAA,CAAE;gBACjC;;;;AAKN,IAAA,OAAO,YAAY;AACrB;;;;"}
@@ -1,5 +1,4 @@
1
- import { DATE_TYPES } from '../../constants/date.js';
2
- import '../../constants/environment.js';
1
+ import { DATE_TYPES } from '../../constants/index.js';
3
2
 
4
3
  function getDateByRules(rules, date = new Date()) {
5
4
  let result = new Date(date);
@@ -1 +1 @@
1
- {"version":3,"file":"get-date-by-rules.js","sources":["../../../../src/lib/date/get-date-by-rules.ts"],"sourcesContent":["import { DATE_TYPES } from \"../../constants\";\nimport { type DateGetterRule, type DateType } from \"../../types\";\n\nexport function getDateByRules(rules: DateGetterRule[], date: Date = new Date()) {\n let result = new Date(date);\n for (const rule of rules) {\n result = getDate(rule.increment, rule.type, result);\n }\n\n return result;\n}\n\nfunction getDate(increment: number, type: DateType, date: Date = new Date()) {\n const result = new Date(date);\n switch (type) {\n case DATE_TYPES.Days: {\n result.setDate(result.getDate() + increment);\n\n return result;\n }\n case DATE_TYPES.Months: {\n result.setMonth(result.getMonth() + increment);\n\n return result;\n }\n case DATE_TYPES.Years: {\n result.setFullYear(result.getFullYear() + increment);\n\n return result;\n }\n case DATE_TYPES.Seconds: {\n result.setSeconds(result.getSeconds() + increment);\n\n return result;\n }\n case DATE_TYPES.Minutes: {\n result.setMinutes(result.getMinutes() + increment);\n\n return result;\n }\n case DATE_TYPES.Hours: {\n result.setHours(result.getHours() + increment);\n\n return result;\n }\n default:\n return result;\n }\n}\n"],"names":[],"mappings":";;;AAGM,SAAU,cAAc,CAAC,KAAuB,EAAE,IAAa,GAAA,IAAI,IAAI,EAAE,EAAA;AAC7E,IAAA,IAAI,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC;AAC3B,IAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;AACxB,QAAA,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;;AAGrD,IAAA,OAAO,MAAM;AACf;AAEA,SAAS,OAAO,CAAC,SAAiB,EAAE,IAAc,EAAE,IAAA,GAAa,IAAI,IAAI,EAAE,EAAA;AACzE,IAAA,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC;IAC7B,QAAQ,IAAI;AACV,QAAA,KAAK,UAAU,CAAC,IAAI,EAAE;YACpB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC;AAE5C,YAAA,OAAO,MAAM;;AAEf,QAAA,KAAK,UAAU,CAAC,MAAM,EAAE;YACtB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,SAAS,CAAC;AAE9C,YAAA,OAAO,MAAM;;AAEf,QAAA,KAAK,UAAU,CAAC,KAAK,EAAE;YACrB,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC;AAEpD,YAAA,OAAO,MAAM;;AAEf,QAAA,KAAK,UAAU,CAAC,OAAO,EAAE;YACvB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,SAAS,CAAC;AAElD,YAAA,OAAO,MAAM;;AAEf,QAAA,KAAK,UAAU,CAAC,OAAO,EAAE;YACvB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,SAAS,CAAC;AAElD,YAAA,OAAO,MAAM;;AAEf,QAAA,KAAK,UAAU,CAAC,KAAK,EAAE;YACrB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,SAAS,CAAC;AAE9C,YAAA,OAAO,MAAM;;AAEf,QAAA;AACE,YAAA,OAAO,MAAM;;AAEnB;;;;"}
1
+ {"version":3,"file":"get-date-by-rules.js","sources":["../../../../src/lib/date/get-date-by-rules.ts"],"sourcesContent":["import { DATE_TYPES } from \"../../constants\";\nimport { type DateGetterRule, type DateType } from \"../../types\";\n\nexport function getDateByRules(rules: DateGetterRule[], date: Date = new Date()) {\n let result = new Date(date);\n for (const rule of rules) {\n result = getDate(rule.increment, rule.type, result);\n }\n\n return result;\n}\n\nfunction getDate(increment: number, type: DateType, date: Date = new Date()) {\n const result = new Date(date);\n switch (type) {\n case DATE_TYPES.Days: {\n result.setDate(result.getDate() + increment);\n\n return result;\n }\n case DATE_TYPES.Months: {\n result.setMonth(result.getMonth() + increment);\n\n return result;\n }\n case DATE_TYPES.Years: {\n result.setFullYear(result.getFullYear() + increment);\n\n return result;\n }\n case DATE_TYPES.Seconds: {\n result.setSeconds(result.getSeconds() + increment);\n\n return result;\n }\n case DATE_TYPES.Minutes: {\n result.setMinutes(result.getMinutes() + increment);\n\n return result;\n }\n case DATE_TYPES.Hours: {\n result.setHours(result.getHours() + increment);\n\n return result;\n }\n default:\n return result;\n }\n}\n"],"names":[],"mappings":";;AAGM,SAAU,cAAc,CAAC,KAAuB,EAAE,IAAa,GAAA,IAAI,IAAI,EAAE,EAAA;AAC7E,IAAA,IAAI,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC;AAC3B,IAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;AACxB,QAAA,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;;AAGrD,IAAA,OAAO,MAAM;AACf;AAEA,SAAS,OAAO,CAAC,SAAiB,EAAE,IAAc,EAAE,IAAA,GAAa,IAAI,IAAI,EAAE,EAAA;AACzE,IAAA,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC;IAC7B,QAAQ,IAAI;AACV,QAAA,KAAK,UAAU,CAAC,IAAI,EAAE;YACpB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC;AAE5C,YAAA,OAAO,MAAM;;AAEf,QAAA,KAAK,UAAU,CAAC,MAAM,EAAE;YACtB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,SAAS,CAAC;AAE9C,YAAA,OAAO,MAAM;;AAEf,QAAA,KAAK,UAAU,CAAC,KAAK,EAAE;YACrB,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC;AAEpD,YAAA,OAAO,MAAM;;AAEf,QAAA,KAAK,UAAU,CAAC,OAAO,EAAE;YACvB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,SAAS,CAAC;AAElD,YAAA,OAAO,MAAM;;AAEf,QAAA,KAAK,UAAU,CAAC,OAAO,EAAE;YACvB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,SAAS,CAAC;AAElD,YAAA,OAAO,MAAM;;AAEf,QAAA,KAAK,UAAU,CAAC,KAAK,EAAE;YACrB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,SAAS,CAAC;AAE9C,YAAA,OAAO,MAAM;;AAEf,QAAA;AACE,YAAA,OAAO,MAAM;;AAEnB;;;;"}
@@ -1,6 +1,5 @@
1
1
  import dayjs from 'dayjs';
2
2
  import yesterdayPlugin from 'dayjs/plugin/isYesterday';
3
- import '../../constants/environment.js';
4
3
 
5
4
  dayjs.extend(yesterdayPlugin);
6
5
  function isYesterday(date) {
@@ -1 +1 @@
1
- {"version":3,"file":"is-yesterday.js","sources":["../../../../src/lib/date/is-yesterday.ts"],"sourcesContent":["import dayjs from \"dayjs\";\nimport yesterdayPlugin from \"dayjs/plugin/isYesterday\";\nimport { type Maybe } from \"../../types\";\n\ndayjs.extend(yesterdayPlugin);\n\nexport function isYesterday(date: Maybe<string | Date | number>) {\n try {\n return dayjs(date).isYesterday();\n } catch {\n return false;\n }\n}\n"],"names":[],"mappings":";;;;AAIA,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC;AAEvB,SAAU,WAAW,CAAC,IAAmC,EAAA;AAC7D,IAAA,IAAI;AACF,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;;AAChC,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;;AAEhB;;;;"}
1
+ {"version":3,"file":"is-yesterday.js","sources":["../../../../src/lib/date/is-yesterday.ts"],"sourcesContent":["import dayjs from \"dayjs\";\nimport yesterdayPlugin from \"dayjs/plugin/isYesterday\";\nimport { type Maybe } from \"../../types\";\n\ndayjs.extend(yesterdayPlugin);\n\nexport function isYesterday(date: Maybe<string | Date | number>) {\n try {\n return dayjs(date).isYesterday();\n } catch {\n return false;\n }\n}\n"],"names":[],"mappings":";;;AAIA,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC;AAEvB,SAAU,WAAW,CAAC,IAAmC,EAAA;AAC7D,IAAA,IAAI;AACF,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;;AAChC,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;;AAEhB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"build-query-string.js","sources":["../../../../src/lib/utils/build-query-string.ts"],"sourcesContent":["import type { ParamsType } from \"../../types\";\nimport { isArray, isObject } from \"../typings\";\n\nexport function buildQueryString(params: ParamsType): string {\n const queryString: string[] = [];\n\n for (const [key, value] of Object.entries(params)) {\n if (isObject(value) || value == undefined) continue;\n\n if (isArray(value)) {\n for (const item of value) {\n if (item != undefined && !isObject(item))\n queryString.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(item))}`);\n }\n } else {\n queryString.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);\n }\n }\n\n return queryString.join(\"&\");\n}\n"],"names":[],"mappings":";;;AAGM,SAAU,gBAAgB,CAAC,MAAkB,EAAA;IACjD,MAAM,WAAW,GAAa,EAAE;AAEhC,IAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AACjD,QAAA,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,SAAS;YAAE;AAE3C,QAAA,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;AAClB,YAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;gBACxB,IAAI,IAAI,IAAI,SAAS,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;AACtC,oBAAA,WAAW,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA,CAAA,EAAI,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA,CAAE,CAAC;;;aAEjF;AACL,YAAA,WAAW,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA,CAAA,EAAI,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA,CAAE,CAAC;;;AAIvF,IAAA,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;AAC9B;;;;"}
1
+ {"version":3,"file":"build-query-string.js","sources":["../../../../src/lib/utils/build-query-string.ts"],"sourcesContent":["import type { RequestQuery } from \"../../api\";\nimport { isArray, isObject } from \"../typings\";\n\nexport function buildQueryString(params: RequestQuery): string {\n const queryString: string[] = [];\n\n for (const [key, value] of Object.entries(params)) {\n if (isObject(value) || value == undefined) continue;\n\n if (isArray(value)) {\n for (const item of value) {\n if (item != undefined && !isObject(item))\n queryString.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(item))}`);\n }\n } else {\n queryString.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);\n }\n }\n\n return queryString.join(\"&\");\n}\n"],"names":[],"mappings":";;;AAGM,SAAU,gBAAgB,CAAC,MAAoB,EAAA;IACnD,MAAM,WAAW,GAAa,EAAE;AAEhC,IAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;AACjD,QAAA,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,SAAS;YAAE;AAE3C,QAAA,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE;AAClB,YAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;gBACxB,IAAI,IAAI,IAAI,SAAS,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;AACtC,oBAAA,WAAW,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA,CAAA,EAAI,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA,CAAE,CAAC;;;aAEjF;AACL,YAAA,WAAW,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA,CAAA,EAAI,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA,CAAE,CAAC;;;AAIvF,IAAA,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;AAC9B;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { buildQueryString } from './build-query-string.js';
2
2
 
3
- function createURLWithParams(options) {
3
+ function createURLWithQueries(options) {
4
4
  const url = options.baseURL;
5
5
  if (!options.params) {
6
6
  return url;
@@ -9,5 +9,5 @@ function createURLWithParams(options) {
9
9
  return `${url}?${queryString}`;
10
10
  }
11
11
 
12
- export { createURLWithParams };
13
- //# sourceMappingURL=create-url-with-params.js.map
12
+ export { createURLWithQueries };
13
+ //# sourceMappingURL=create-url-with-queries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-url-with-queries.js","sources":["../../../../src/lib/utils/create-url-with-queries.ts"],"sourcesContent":["import type { RequestQuery } from \"../../api\";\nimport { buildQueryString } from \"./build-query-string\";\n\ntype CreateURLOptionsInterface = {\n baseURL: string;\n params?: RequestQuery;\n};\n\nexport function createURLWithQueries(options: CreateURLOptionsInterface): string {\n const url = options.baseURL;\n\n if (!options.params) {\n return url;\n }\n\n const queryString = buildQueryString(options.params);\n\n return `${url}?${queryString}`;\n}\n"],"names":[],"mappings":";;AAQM,SAAU,oBAAoB,CAAC,OAAkC,EAAA;AACrE,IAAA,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO;AAE3B,IAAA,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;AACnB,QAAA,OAAO,GAAG;;IAGZ,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC;AAEpD,IAAA,OAAO,CAAG,EAAA,GAAG,CAAI,CAAA,EAAA,WAAW,EAAE;AAChC;;;;"}
@@ -1,5 +1,4 @@
1
- import '../../constants/environment.js';
2
- import { FIELD_TYPES } from '../../constants/fields.js';
1
+ import { FIELD_TYPES } from '../../constants/index.js';
3
2
  import 'dayjs';
4
3
  import '../date/is-today.js';
5
4
  import '../date/is-tomorrow.js';
@@ -1 +1 @@
1
- {"version":3,"file":"field-view-format.js","sources":["../../../../src/lib/utils/field-view-format.ts"],"sourcesContent":["import { FIELD_TYPES } from \"../../constants\";\nimport type { FieldType } from \"../../types\";\nimport { dateFormat } from \"../date\";\nimport { isArray, isBoolean, isDate, isNumber, isString } from \"../typings\";\nimport { transformToNumber } from \"./transform-to-number\";\n\nexport function fieldViewFormat(field: unknown, type: FieldType = \"string\") {\n switch (type) {\n case FIELD_TYPES.Array: {\n return isArray(field) ? field.join(\", \") : \"\";\n }\n case FIELD_TYPES.Date: {\n return isString(field) || isNumber(field) || isDate(field)\n ? dateFormat(field, \"DD.MM.YYYY\")\n : \"\";\n }\n case FIELD_TYPES.DateTime: {\n return isString(field) || isNumber(field) || isDate(field)\n ? dateFormat(field, \"DD.MM.YYYY HH:mm\")\n : \"\";\n }\n case FIELD_TYPES.Number: {\n return isString(field) || isNumber(field) || isBoolean(field)\n ? String(transformToNumber(field))\n : \"\";\n }\n case FIELD_TYPES.String: {\n return isString(field) || isNumber(field) || isBoolean(field) ? String(field) : \"\";\n }\n case FIELD_TYPES.Time: {\n return isString(field) || isNumber(field) || isDate(field) ? dateFormat(field, \"HH:mm\") : \"\";\n }\n default: {\n return isString(field) || isNumber(field) || isBoolean(field) ? String(field) : \"\";\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;SAMgB,eAAe,CAAC,KAAc,EAAE,OAAkB,QAAQ,EAAA;IACxE,QAAQ,IAAI;AACV,QAAA,KAAK,WAAW,CAAC,KAAK,EAAE;AACtB,YAAA,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;;AAE/C,QAAA,KAAK,WAAW,CAAC,IAAI,EAAE;AACrB,YAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK;AACvD,kBAAE,UAAU,CAAC,KAAK,EAAE,YAAY;kBAC9B,EAAE;;AAER,QAAA,KAAK,WAAW,CAAC,QAAQ,EAAE;AACzB,YAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK;AACvD,kBAAE,UAAU,CAAC,KAAK,EAAE,kBAAkB;kBACpC,EAAE;;AAER,QAAA,KAAK,WAAW,CAAC,MAAM,EAAE;AACvB,YAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,KAAK;AAC1D,kBAAE,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC;kBAC/B,EAAE;;AAER,QAAA,KAAK,WAAW,CAAC,MAAM,EAAE;YACvB,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;;AAEpF,QAAA,KAAK,WAAW,CAAC,IAAI,EAAE;YACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE;;QAE9F,SAAS;YACP,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;;;AAGxF;;;;"}
1
+ {"version":3,"file":"field-view-format.js","sources":["../../../../src/lib/utils/field-view-format.ts"],"sourcesContent":["import { FIELD_TYPES } from \"../../constants\";\nimport type { FieldType } from \"../../types\";\nimport { dateFormat } from \"../date\";\nimport { isArray, isBoolean, isDate, isNumber, isString } from \"../typings\";\nimport { transformToNumber } from \"./transform-to-number\";\n\nexport function fieldViewFormat(field: unknown, type: FieldType = \"string\") {\n switch (type) {\n case FIELD_TYPES.Array: {\n return isArray(field) ? field.join(\", \") : \"\";\n }\n case FIELD_TYPES.Date: {\n return isString(field) || isNumber(field) || isDate(field)\n ? dateFormat(field, \"DD.MM.YYYY\")\n : \"\";\n }\n case FIELD_TYPES.DateTime: {\n return isString(field) || isNumber(field) || isDate(field)\n ? dateFormat(field, \"DD.MM.YYYY HH:mm\")\n : \"\";\n }\n case FIELD_TYPES.Number: {\n return isString(field) || isNumber(field) || isBoolean(field)\n ? String(transformToNumber(field))\n : \"\";\n }\n case FIELD_TYPES.String: {\n return isString(field) || isNumber(field) || isBoolean(field) ? String(field) : \"\";\n }\n case FIELD_TYPES.Time: {\n return isString(field) || isNumber(field) || isDate(field) ? dateFormat(field, \"HH:mm\") : \"\";\n }\n default: {\n return isString(field) || isNumber(field) || isBoolean(field) ? String(field) : \"\";\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;SAMgB,eAAe,CAAC,KAAc,EAAE,OAAkB,QAAQ,EAAA;IACxE,QAAQ,IAAI;AACV,QAAA,KAAK,WAAW,CAAC,KAAK,EAAE;AACtB,YAAA,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;;AAE/C,QAAA,KAAK,WAAW,CAAC,IAAI,EAAE;AACrB,YAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK;AACvD,kBAAE,UAAU,CAAC,KAAK,EAAE,YAAY;kBAC9B,EAAE;;AAER,QAAA,KAAK,WAAW,CAAC,QAAQ,EAAE;AACzB,YAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK;AACvD,kBAAE,UAAU,CAAC,KAAK,EAAE,kBAAkB;kBACpC,EAAE;;AAER,QAAA,KAAK,WAAW,CAAC,MAAM,EAAE;AACvB,YAAA,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,KAAK;AAC1D,kBAAE,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC;kBAC/B,EAAE;;AAER,QAAA,KAAK,WAAW,CAAC,MAAM,EAAE;YACvB,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;;AAEpF,QAAA,KAAK,WAAW,CAAC,IAAI,EAAE;YACrB,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE;;QAE9F,SAAS;YACP,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;;;AAGxF;;;;"}