@finema/core 1.4.98 → 1.4.100

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 (63) hide show
  1. package/README.md +60 -60
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1 -1
  4. package/dist/runtime/components/Alert.vue +48 -48
  5. package/dist/runtime/components/Avatar.vue +27 -27
  6. package/dist/runtime/components/Badge.vue +11 -11
  7. package/dist/runtime/components/Breadcrumb.vue +44 -44
  8. package/dist/runtime/components/Button/Group.vue +37 -37
  9. package/dist/runtime/components/Button/index.vue +76 -76
  10. package/dist/runtime/components/Card.vue +38 -38
  11. package/dist/runtime/components/Core.vue +13 -13
  12. package/dist/runtime/components/Dialog/index.vue +108 -108
  13. package/dist/runtime/components/Dropdown/index.vue +70 -70
  14. package/dist/runtime/components/FlexDeck/Base.vue +90 -90
  15. package/dist/runtime/components/FlexDeck/index.vue +66 -66
  16. package/dist/runtime/components/Form/FieldWrapper.vue +23 -23
  17. package/dist/runtime/components/Form/Fields.vue +177 -177
  18. package/dist/runtime/components/Form/InputCheckbox/index.vue +21 -21
  19. package/dist/runtime/components/Form/InputDateTime/index.vue +60 -60
  20. package/dist/runtime/components/Form/InputNumber/index.vue +27 -27
  21. package/dist/runtime/components/Form/InputRadio/index.vue +27 -27
  22. package/dist/runtime/components/Form/InputSelect/index.vue +36 -36
  23. package/dist/runtime/components/Form/InputStatic/index.vue +16 -16
  24. package/dist/runtime/components/Form/InputText/index.vue +67 -67
  25. package/dist/runtime/components/Form/InputTextarea/index.vue +25 -25
  26. package/dist/runtime/components/Form/InputToggle/index.vue +14 -14
  27. package/dist/runtime/components/Form/InputUploadDropzone/index.vue +206 -205
  28. package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +333 -355
  29. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/Item.vue +260 -283
  30. package/dist/runtime/components/Form/InputUploadDropzoneAutoMultiple/index.vue +140 -126
  31. package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/index.vue +148 -134
  32. package/dist/runtime/components/Form/InputUploadDropzoneImageAutoMultiple/item.vue +167 -198
  33. package/dist/runtime/components/Form/InputUploadFileClassic/index.vue +95 -103
  34. package/dist/runtime/components/Form/InputUploadFileClassicAuto/index.vue +143 -178
  35. package/dist/runtime/components/Form/index.vue +6 -6
  36. package/dist/runtime/components/Icon.vue +23 -23
  37. package/dist/runtime/components/Image.vue +36 -36
  38. package/dist/runtime/components/Loader.vue +27 -27
  39. package/dist/runtime/components/Modal/index.vue +146 -146
  40. package/dist/runtime/components/QRCode.vue +1 -1
  41. package/dist/runtime/components/SimplePagination.vue +96 -96
  42. package/dist/runtime/components/Slideover/index.vue +110 -110
  43. package/dist/runtime/components/Table/Base.vue +139 -139
  44. package/dist/runtime/components/Table/ColumnDate.vue +16 -16
  45. package/dist/runtime/components/Table/ColumnDateTime.vue +18 -18
  46. package/dist/runtime/components/Table/ColumnImage.vue +15 -15
  47. package/dist/runtime/components/Table/ColumnNumber.vue +14 -14
  48. package/dist/runtime/components/Table/ColumnText.vue +25 -25
  49. package/dist/runtime/components/Table/Simple.vue +69 -69
  50. package/dist/runtime/components/Table/index.vue +65 -65
  51. package/dist/runtime/components/Tabs/index.vue +64 -64
  52. package/dist/runtime/helpers/componentHelper.d.ts +18 -8
  53. package/dist/runtime/helpers/componentHelper.mjs +47 -8
  54. package/dist/runtime/utils/ArrayHelper.spec.mjs +1 -5
  55. package/dist/runtime/utils/FileHelper.spec.d.ts +1 -0
  56. package/dist/runtime/utils/FileHelper.spec.mjs +14 -0
  57. package/dist/runtime/utils/ObjectHelper.spec.d.ts +1 -0
  58. package/dist/runtime/utils/ObjectHelper.spec.mjs +52 -0
  59. package/dist/runtime/utils/ParamHelper.spec.d.ts +1 -0
  60. package/dist/runtime/utils/ParamHelper.spec.mjs +78 -0
  61. package/dist/runtime/utils/StringHelper.spec.d.ts +1 -0
  62. package/dist/runtime/utils/StringHelper.spec.mjs +76 -0
  63. package/package.json +89 -89
@@ -0,0 +1,78 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { ParamHelper } from "./ParamHelper.mjs";
3
+ describe("ParamHelper", () => {
4
+ describe("getParams", () => {
5
+ it("should merge params from opts and reqOptions", () => {
6
+ const opts = { params: { page: 1, limit: 10 } };
7
+ const reqOptions = { params: { sort: "name" } };
8
+ const result = ParamHelper.getParams(opts, reqOptions);
9
+ expect(result).toEqual({ page: 1, limit: 10, sort: "name" });
10
+ });
11
+ it("should return reqOptions.params if opts.params is not provided", () => {
12
+ const opts = {};
13
+ const reqOptions = { params: { sort: "name" } };
14
+ const result = ParamHelper.getParams(opts, reqOptions);
15
+ expect(result).toEqual({ sort: "name" });
16
+ });
17
+ });
18
+ describe("getBoolTrue", () => {
19
+ it("should return true for truthy values", () => {
20
+ expect(ParamHelper.getBoolTrue(true)).toBe(true);
21
+ expect(ParamHelper.getBoolTrue(1)).toBe(true);
22
+ expect(ParamHelper.getBoolTrue("true")).toBe(true);
23
+ });
24
+ it("should return false for falsy values", () => {
25
+ expect(ParamHelper.getBoolTrue(false)).toBe(false);
26
+ expect(ParamHelper.getBoolTrue(0)).toBe(false);
27
+ expect(ParamHelper.getBoolTrue("false")).toBe(false);
28
+ });
29
+ it("should return true for null value", () => {
30
+ expect(ParamHelper.getBoolTrue(null)).toBe(true);
31
+ });
32
+ });
33
+ describe("getBoolFalse", () => {
34
+ it("should return false for falsy values", () => {
35
+ expect(ParamHelper.getBoolFalse(false)).toBe(false);
36
+ expect(ParamHelper.getBoolFalse(0)).toBe(false);
37
+ expect(ParamHelper.getBoolFalse("false")).toBe(false);
38
+ });
39
+ it("should return true for truthy values", () => {
40
+ expect(ParamHelper.getBoolFalse(true)).toBe(true);
41
+ expect(ParamHelper.getBoolFalse(1)).toBe(true);
42
+ expect(ParamHelper.getBoolFalse("true")).toBe(true);
43
+ });
44
+ it("should return false for null value", () => {
45
+ expect(ParamHelper.getBoolFalse(null)).toBe(false);
46
+ });
47
+ });
48
+ describe("isNotFoundError", () => {
49
+ it('should return true if the error code is "NOT_FOUND"', () => {
50
+ const error = { code: "NOT_FOUND" };
51
+ expect(ParamHelper.isNotFoundError(error)).toBe(true);
52
+ });
53
+ it('should return false if the error code is not "NOT_FOUND"', () => {
54
+ const error = { code: "INTERNAL_SERVER_ERROR" };
55
+ expect(ParamHelper.isNotFoundError(error)).toBe(false);
56
+ });
57
+ });
58
+ describe("isChangeWithFalse", () => {
59
+ it("should return true if the value changes from true to false", () => {
60
+ expect(ParamHelper.isChangeWithFalse(false, true)).toBe(true);
61
+ });
62
+ it("should return false if the value does not change or changes to true", () => {
63
+ expect(ParamHelper.isChangeWithFalse(true, true)).toBe(false);
64
+ expect(ParamHelper.isChangeWithFalse(false, false)).toBe(false);
65
+ expect(ParamHelper.isChangeWithFalse(true, false)).toBe(false);
66
+ });
67
+ });
68
+ describe("isChangeWithTrue", () => {
69
+ it("should return true if the value changes from false to true", () => {
70
+ expect(ParamHelper.isChangeWithTrue(true, false)).toBe(true);
71
+ });
72
+ it("should return false if the value does not change or changes to false", () => {
73
+ expect(ParamHelper.isChangeWithTrue(false, false)).toBe(false);
74
+ expect(ParamHelper.isChangeWithTrue(true, true)).toBe(false);
75
+ expect(ParamHelper.isChangeWithTrue(false, true)).toBe(false);
76
+ });
77
+ });
78
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,76 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { StringHelper } from "./StringHelper.mjs";
3
+ describe("StringHelper", () => {
4
+ describe("genString", () => {
5
+ it("should generate a random string of the specified length", () => {
6
+ const length = 10;
7
+ const result = StringHelper.genString(length);
8
+ expect(result).toHaveLength(length);
9
+ expect(typeof result).toBe("string");
10
+ });
11
+ it("should generate a random string of default length if not specified", () => {
12
+ const result = StringHelper.genString();
13
+ expect(result).toHaveLength(5);
14
+ expect(typeof result).toBe("string");
15
+ });
16
+ });
17
+ describe("withComma", () => {
18
+ it("should format a number with comma separator", () => {
19
+ expect(StringHelper.withComma(1e3)).toBe("1,000");
20
+ expect(StringHelper.withComma(1234.56)).toBe("1,234.56");
21
+ });
22
+ it('should return "0" for null or undefined values', () => {
23
+ expect(StringHelper.withComma(void 0)).toBe("0");
24
+ });
25
+ });
26
+ describe("withFixed", () => {
27
+ it("should format a number with comma separator and fixed decimal places", () => {
28
+ expect(StringHelper.withFixed(1e3)).toBe("1,000");
29
+ expect(StringHelper.withFixed(1234.56)).toBe("1,234.56");
30
+ });
31
+ it('should return "0" for null or undefined values', () => {
32
+ expect(StringHelper.withFixed(void 0)).toBe("0");
33
+ });
34
+ });
35
+ describe("split", () => {
36
+ it("should split a string into an array based on the specified separator", () => {
37
+ const str = "apple,banana,orange";
38
+ const separator = ",";
39
+ const result = StringHelper.split(str, separator);
40
+ expect(result).toEqual(["apple", "banana", "orange"]);
41
+ });
42
+ it("should return an empty array for null or undefined string", () => {
43
+ expect(StringHelper.split(null, ",")).toEqual([]);
44
+ expect(StringHelper.split(void 0, ",")).toEqual([]);
45
+ });
46
+ });
47
+ describe("joinURL", () => {
48
+ it("should join the provided URL parts", () => {
49
+ const result = StringHelper.joinURL("https://example.com", "path", "to", "resource");
50
+ expect(result).toBe("https://example.com/path/to/resource");
51
+ });
52
+ });
53
+ describe("truncate", () => {
54
+ it("should truncate a string if it exceeds the specified length", () => {
55
+ const str = "This is a long string that needs to be truncated";
56
+ const result = StringHelper.truncate(str, 20);
57
+ expect(result).toBe("This is a long strin...");
58
+ });
59
+ it("should return the original string if it does not exceed the specified length", () => {
60
+ const str = "Short string";
61
+ const result = StringHelper.truncate(str, 20);
62
+ expect(result).toBe("Short string");
63
+ });
64
+ });
65
+ describe("getError", () => {
66
+ it("should return the error message from the errorData", () => {
67
+ const errorData = { code: "ERROR_CODE", message: "Error message" };
68
+ const result = StringHelper.getError(errorData);
69
+ expect(result).toBe("Error message");
70
+ });
71
+ it("should return the default error message if the errorData is empty", () => {
72
+ const result = StringHelper.getError({}, "Default error message");
73
+ expect(result).toBe("Default error message");
74
+ });
75
+ });
76
+ });
package/package.json CHANGED
@@ -1,89 +1,89 @@
1
- {
2
- "name": "@finema/core",
3
- "version": "1.4.98",
4
- "repository": "https://gitlab.finema.co/finema/ui-kit",
5
- "license": "MIT",
6
- "author": "Finema Dev Core Team",
7
- "type": "module",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/types.d.ts",
11
- "import": "./dist/module.mjs",
12
- "require": "./dist/module.cjs"
13
- }
14
- },
15
- "main": "./dist/module.cjs",
16
- "types": "./dist/types.d.ts",
17
- "files": [
18
- "dist"
19
- ],
20
- "engines": {
21
- "node": ">=18.0.0"
22
- },
23
- "scripts": {
24
- "prepack": "nuxt-module-build build",
25
- "docs": "nuxi dev docs",
26
- "dev": "nuxi dev playground",
27
- "dev:build": "nuxi build playground",
28
- "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
29
- "lint": "eslint . --cache",
30
- "lint:fix": "eslint . --fix --cache",
31
- "test": "vitest run",
32
- "test:watch": "vitest watch",
33
- "release": "release-it --ci",
34
- "prepare": "husky install"
35
- },
36
- "dependencies": {
37
- "@nuxt/kit": "^3.10.3",
38
- "@nuxt/ui": "^2.14.2",
39
- "@pinia/nuxt": "^0.5.1",
40
- "@vee-validate/nuxt": "^4.12.5",
41
- "@vee-validate/zod": "^4.12.5",
42
- "@vuepic/vue-datepicker": "^8.2.0",
43
- "axios": "^1.6.7",
44
- "date-fns": "^3.3.1",
45
- "i18next": "^23.10.0",
46
- "maska": "^2.1.11",
47
- "nuxt-lodash": "^2.5.3",
48
- "nuxt-security": "^1.2.1",
49
- "pinia": "^2.1.7",
50
- "qrcode.vue": "^3.4.1",
51
- "url-join": "^5.0.0",
52
- "zod": "^3.22.4",
53
- "zod-i18n-map": "^2.27.0"
54
- },
55
- "devDependencies": {
56
- "@finema/eslint-config": "^1.2.0",
57
- "@nuxt/devtools": "latest",
58
- "@nuxt/eslint-config": "^0.2.0",
59
- "@nuxt/module-builder": "^0.5.5",
60
- "@nuxt/schema": "^3.10.3",
61
- "@nuxt/test-utils": "^3.11.0",
62
- "@release-it/conventional-changelog": "^8.0.1",
63
- "@types/node": "^20.10.17",
64
- "@vue/test-utils": "^2.4.3",
65
- "changelogen": "^0.5.5",
66
- "eslint": "^8.56.0",
67
- "happy-dom": "^13.0.0",
68
- "husky": "^9.0.11",
69
- "lint-staged": "^15.2.0",
70
- "nuxt": "^3.10.3",
71
- "playwright-core": "^1.42.1",
72
- "prettier": "^3.1.1",
73
- "release-it": "^17.0.1",
74
- "sass": "^1.69.5",
75
- "stylelint": "^16.1.0",
76
- "stylelint-config-prettier-scss": "^1.0.0",
77
- "stylelint-config-standard-scss": "^13.0.0",
78
- "vitest": "^1.3.1",
79
- "vue": "^3.4.21"
80
- },
81
- "lint-staged": {
82
- "*.{ts,vue,tsx,js}": "eslint --fix --cache",
83
- "*.{html,json}": "prettier --write"
84
- },
85
- "workspaces": [
86
- "./*"
87
- ],
88
- "packageManager": "yarn@4.1.1"
89
- }
1
+ {
2
+ "name": "@finema/core",
3
+ "version": "1.4.100",
4
+ "repository": "https://gitlab.finema.co/finema/ui-kit",
5
+ "license": "MIT",
6
+ "author": "Finema Dev Core Team",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/types.d.ts",
11
+ "import": "./dist/module.mjs",
12
+ "require": "./dist/module.cjs"
13
+ }
14
+ },
15
+ "main": "./dist/module.cjs",
16
+ "types": "./dist/types.d.ts",
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "engines": {
21
+ "node": ">=18.0.0"
22
+ },
23
+ "scripts": {
24
+ "prepack": "nuxt-module-build build",
25
+ "docs": "nuxi dev docs",
26
+ "dev": "nuxi dev playground",
27
+ "dev:build": "nuxi build playground",
28
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
29
+ "lint": "eslint . --cache",
30
+ "lint:fix": "eslint . --fix --cache",
31
+ "test": "vitest run",
32
+ "test:watch": "vitest watch",
33
+ "release": "release-it --ci",
34
+ "prepare": "husky install"
35
+ },
36
+ "dependencies": {
37
+ "@nuxt/kit": "^3.10.3",
38
+ "@nuxt/ui": "^2.14.2",
39
+ "@pinia/nuxt": "^0.5.1",
40
+ "@vee-validate/nuxt": "^4.12.5",
41
+ "@vee-validate/zod": "^4.12.5",
42
+ "@vuepic/vue-datepicker": "^8.2.0",
43
+ "axios": "^1.6.7",
44
+ "date-fns": "^3.3.1",
45
+ "i18next": "^23.10.0",
46
+ "maska": "^2.1.11",
47
+ "nuxt-lodash": "^2.5.3",
48
+ "nuxt-security": "^1.2.1",
49
+ "pinia": "^2.1.7",
50
+ "qrcode.vue": "^3.4.1",
51
+ "url-join": "^5.0.0",
52
+ "zod": "^3.22.4",
53
+ "zod-i18n-map": "^2.27.0"
54
+ },
55
+ "devDependencies": {
56
+ "@finema/eslint-config": "^1.2.0",
57
+ "@nuxt/devtools": "latest",
58
+ "@nuxt/eslint-config": "^0.2.0",
59
+ "@nuxt/module-builder": "^0.5.5",
60
+ "@nuxt/schema": "^3.10.3",
61
+ "@nuxt/test-utils": "^3.11.0",
62
+ "@release-it/conventional-changelog": "^8.0.1",
63
+ "@types/node": "^20.10.17",
64
+ "@vue/test-utils": "^2.4.3",
65
+ "changelogen": "^0.5.5",
66
+ "eslint": "^8.56.0",
67
+ "happy-dom": "^13.0.0",
68
+ "husky": "^9.0.11",
69
+ "lint-staged": "^15.2.0",
70
+ "nuxt": "^3.10.3",
71
+ "playwright-core": "^1.42.1",
72
+ "prettier": "^3.1.1",
73
+ "release-it": "^17.0.1",
74
+ "sass": "^1.69.5",
75
+ "stylelint": "^16.1.0",
76
+ "stylelint-config-prettier-scss": "^1.0.0",
77
+ "stylelint-config-standard-scss": "^13.0.0",
78
+ "vitest": "^1.3.1",
79
+ "vue": "^3.4.21"
80
+ },
81
+ "lint-staged": {
82
+ "*.{ts,vue,tsx,js}": "eslint --fix --cache",
83
+ "*.{html,json}": "prettier --write"
84
+ },
85
+ "workspaces": [
86
+ "./*"
87
+ ],
88
+ "packageManager": "yarn@4.1.1"
89
+ }