@mapomodule/utils 1.0.0 → 2.0.0-beta.1
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/README.md +33 -0
- package/dist/debounce.js +19 -0
- package/dist/debounce.js.map +1 -0
- package/dist/deepMerge.js +31 -0
- package/dist/deepMerge.js.map +1 -0
- package/dist/formatDate.js +23 -0
- package/dist/formatDate.js.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/jsonSchema/conditionals.js +326 -0
- package/dist/jsonSchema/conditionals.js.map +1 -0
- package/dist/jsonSchema/index.js +3 -0
- package/dist/jsonSchema/index.js.map +1 -0
- package/dist/jsonSchema/resolve.js +133 -0
- package/dist/jsonSchema/resolve.js.map +1 -0
- package/dist/jsonSchema/types.js +2 -0
- package/dist/jsonSchema/types.js.map +1 -0
- package/dist/menuHelpers.js +56 -0
- package/dist/menuHelpers.js.map +1 -0
- package/dist/nestedValue.js +53 -0
- package/dist/nestedValue.js.map +1 -0
- package/dist/normalizeEndpoint.js +39 -0
- package/dist/normalizeEndpoint.js.map +1 -0
- package/dist/objectDiff.js +58 -0
- package/dist/objectDiff.js.map +1 -0
- package/dist/objectHelpers.js +93 -0
- package/dist/objectHelpers.js.map +1 -0
- package/dist/slotNamespace.js +15 -0
- package/dist/slotNamespace.js.map +1 -0
- package/dist/types/debounce.d.ts +11 -0
- package/dist/types/debounce.d.ts.map +1 -0
- package/dist/types/deepMerge.d.ts +12 -0
- package/dist/types/deepMerge.d.ts.map +1 -0
- package/dist/types/formatDate.d.ts +11 -0
- package/dist/types/formatDate.d.ts.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/jsonSchema/conditionals.d.ts +40 -0
- package/dist/types/jsonSchema/conditionals.d.ts.map +1 -0
- package/dist/types/jsonSchema/index.d.ts +15 -0
- package/dist/types/jsonSchema/index.d.ts.map +1 -0
- package/dist/types/jsonSchema/resolve.d.ts +41 -0
- package/dist/types/jsonSchema/resolve.d.ts.map +1 -0
- package/dist/types/jsonSchema/types.d.ts +43 -0
- package/dist/types/jsonSchema/types.d.ts.map +1 -0
- package/dist/types/menuHelpers.d.ts +22 -0
- package/dist/types/menuHelpers.d.ts.map +1 -0
- package/dist/types/nestedValue.d.ts +25 -0
- package/dist/types/nestedValue.d.ts.map +1 -0
- package/dist/types/normalizeEndpoint.d.ts +28 -0
- package/dist/types/normalizeEndpoint.d.ts.map +1 -0
- package/dist/types/objectDiff.d.ts +12 -0
- package/dist/types/objectDiff.d.ts.map +1 -0
- package/dist/types/objectHelpers.d.ts +33 -0
- package/dist/types/objectHelpers.d.ts.map +1 -0
- package/dist/types/slotNamespace.d.ts +12 -0
- package/dist/types/slotNamespace.d.ts.map +1 -0
- package/package.json +41 -7
- package/CHANGELOG.md +0 -182
- package/helpers/cssVariables.js +0 -12
- package/helpers/datetime.js +0 -68
- package/helpers/debounce.js +0 -42
- package/helpers/formatters.js +0 -52
- package/helpers/menu.js +0 -15
- package/helpers/objHelpers.js +0 -118
- package/helpers/slots.js +0 -9
- package/index.js +0 -13
- package/loaders/dummy-loader.js +0 -1
- package/plugins/v-draggable-modals.js +0 -39
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensures an API endpoint path has exactly one leading and one trailing slash.
|
|
3
|
+
* Query strings are preserved unchanged — the slash is inserted before the `?`.
|
|
4
|
+
* Used by `useCrud` to normalize user-provided endpoint paths before making requests.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* normalizeEndpoint('api/articles') // '/api/articles/'
|
|
8
|
+
* normalizeEndpoint('/api/articles') // '/api/articles/'
|
|
9
|
+
* normalizeEndpoint('/api/articles/') // '/api/articles/'
|
|
10
|
+
* normalizeEndpoint('/api/articles/?q=1') // '/api/articles/?q=1'
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalizeEndpoint(endpoint: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Splits an endpoint string into its clean path and parsed query params.
|
|
15
|
+
* Useful when an endpoint carries baked-in params (e.g. `?fields=id,title`) that
|
|
16
|
+
* must be merged into request params while CRUD mutations target the bare path.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* splitEndpointParams('/api/articles/?fields=id,title')
|
|
20
|
+
* { path: '/api/articles/', params: { fields: 'id,title' } }
|
|
21
|
+
* splitEndpointParams('/api/articles/')
|
|
22
|
+
* { path: '/api/articles/', params: {} }
|
|
23
|
+
*/
|
|
24
|
+
export declare function splitEndpointParams(endpoint: string): {
|
|
25
|
+
path: string;
|
|
26
|
+
params: Record<string, string>;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=normalizeEndpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeEndpoint.d.ts","sourceRoot":"","sources":["../../src/normalizeEndpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC,CAOA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes a deep diff between two objects and returns only changed fields.
|
|
3
|
+
*
|
|
4
|
+
* Nested objects are diffed recursively. Arrays are compared deeply and, when changed,
|
|
5
|
+
* are returned as the full current array value.
|
|
6
|
+
*
|
|
7
|
+
* @param base Base object used as the comparison reference.
|
|
8
|
+
* @param current Current object to compare against `base`.
|
|
9
|
+
* @returns A partial object containing only keys whose values differ from `base`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function objectDiff<T extends object>(base: T, current: T): Partial<T>;
|
|
12
|
+
//# sourceMappingURL=objectDiff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectDiff.d.ts","sourceRoot":"","sources":["../../src/objectDiff.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CA2B5E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep-clones a value and returns a detached copy.
|
|
3
|
+
*
|
|
4
|
+
* The function first unwraps Vue reactive proxies (when present), then:
|
|
5
|
+
* - uses `structuredClone` when available
|
|
6
|
+
* - falls back to recursive cloning for plain objects/arrays
|
|
7
|
+
*
|
|
8
|
+
* The recursive fallback does not support circular references.
|
|
9
|
+
*/
|
|
10
|
+
export declare function deepClone<T>(value: T): T;
|
|
11
|
+
/**
|
|
12
|
+
* Type guard that returns true when `value` is a browser `File`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isFile(value: unknown): value is File;
|
|
15
|
+
/**
|
|
16
|
+
* Type guard that returns true when `value` is a browser `Blob`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isBlob(value: unknown): value is Blob;
|
|
19
|
+
/**
|
|
20
|
+
* Type guard that returns true when `value` is either a `File` or a `Blob`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isFileOrBlob(value: unknown): value is File | Blob;
|
|
23
|
+
/**
|
|
24
|
+
* Return all dot-notation paths in `obj` where the predicate is truthy.
|
|
25
|
+
*/
|
|
26
|
+
export declare function findPropPaths(obj: unknown, predicate: (val: unknown) => boolean, _prefix?: string): string[];
|
|
27
|
+
/** Return all paths in `obj` that hold a File or Blob. */
|
|
28
|
+
export declare function filesInObject(obj: unknown): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Return a shallow copy of `obj` containing only the listed top-level keys.
|
|
31
|
+
*/
|
|
32
|
+
export declare function filterObj<T extends Record<string, unknown>>(obj: T, keys: (keyof T)[]): Partial<T>;
|
|
33
|
+
//# sourceMappingURL=objectHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectHelpers.d.ts","sourceRoot":"","sources":["../../src/objectHelpers.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAkBxC;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAEpD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAEpD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,IAAI,CAEjE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,EACpC,OAAO,SAAK,GACX,MAAM,EAAE,CAaV;AAED,0DAA0D;AAC1D,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,EAAE,CAEpD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzD,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,GAChB,OAAO,CAAC,CAAC,CAAC,CAQZ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Slots } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a namespaced view of slots, including only those that start with the given prefix.
|
|
4
|
+
*
|
|
5
|
+
* Filtered slot names are normalized by removing the prefix from the slot key.
|
|
6
|
+
*
|
|
7
|
+
* @param slots Source Vue slots object.
|
|
8
|
+
* @param prefix Prefix used to select which slots to include.
|
|
9
|
+
* @returns A new `Slots` object containing only prefixed slots, renamed without the prefix.
|
|
10
|
+
*/
|
|
11
|
+
export declare function slotNamespace(slots: Slots, prefix: string): Slots;
|
|
12
|
+
//# sourceMappingURL=slotNamespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slotNamespace.d.ts","sourceRoot":"","sources":["../../src/slotNamespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AAEjC;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAMjE"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mapomodule/utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
|
+
"description": "Mapo typed utilities",
|
|
5
|
+
"type": "module",
|
|
4
6
|
"license": "MIT",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"repository":
|
|
8
|
-
|
|
7
|
+
"author": "Lotrek Agency (https://lotrek.it)",
|
|
8
|
+
"homepage": "https://lotrekagency.github.io/mapo-new/",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/lotrekagency/mapo-new.git",
|
|
12
|
+
"directory": "packages/@mapomodule/utils"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/lotrekagency/mapo-new/issues"
|
|
16
|
+
},
|
|
9
17
|
"publishConfig": {
|
|
10
|
-
"access": "public"
|
|
18
|
+
"access": "public",
|
|
19
|
+
"tag": "next"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/types/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./jsonSchema": {
|
|
27
|
+
"types": "./dist/types/jsonSchema/index.d.ts",
|
|
28
|
+
"import": "./dist/jsonSchema/index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"main": "./dist/index.js",
|
|
32
|
+
"types": "./dist/types/index.d.ts",
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
38
|
+
"build": "tsc -p tsconfig.json",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"lint": "eslint src",
|
|
41
|
+
"test": "vitest run"
|
|
11
42
|
},
|
|
12
|
-
"
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"vue": "^3.5.32",
|
|
45
|
+
"vue-router": "^5.0.4"
|
|
46
|
+
}
|
|
13
47
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [1.0.0](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.60...v1.0.0) (2026-07-02)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @mapomodule/utils
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [1.0.0-alpha.49](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.48...v1.0.0-alpha.49) (2023-07-27)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
### Features
|
|
18
|
-
|
|
19
|
-
* added max-depth prop to menu manager to give the possibility of set a limit in depth for nesting ([e4ab7a1](https://github.com/lotrekagency/mapo/commit/e4ab7a137cbb392e709e8865404105d7707a7634))
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# [1.0.0-alpha.45](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.44...v1.0.0-alpha.45) (2023-06-10)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Bug Fixes
|
|
29
|
-
|
|
30
|
-
* fix setPointed ([f43685d](https://github.com/lotrekagency/mapo/commit/f43685dce23fb9383d7b0501767b1c40ff442686))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# [1.0.0-alpha.44](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.43...v1.0.0-alpha.44) (2023-06-10)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
### Bug Fixes
|
|
40
|
-
|
|
41
|
-
* added better reactivity to setPointed function ([78a4a88](https://github.com/lotrekagency/mapo/commit/78a4a88fbc98e5ce0d2662c074541eb4f8fd3ea1))
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### Performance Improvements
|
|
45
|
-
|
|
46
|
-
* EXPERIMENTAL: use Vue.set in setpointed and directly manipulate js object in FormField ([1c384e9](https://github.com/lotrekagency/mapo/commit/1c384e9d7c922b0e876512de874a3f9832ac30f1))
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
# [1.0.0-alpha.43](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.42...v1.0.0-alpha.43) (2023-02-02)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### Bug Fixes
|
|
56
|
-
|
|
57
|
-
* put version on @mapomodule/utils ([9182283](https://github.com/lotrekagency/mapo/commit/9182283aeef7075a664ce12a45c94b934d5c491a))
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
# [1.0.0-alpha.40](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.39...v1.0.0-alpha.40) (2022-12-20)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
### Bug Fixes
|
|
67
|
-
|
|
68
|
-
* rewritten and more precise diffObjs function ([3e79775](https://github.com/lotrekagency/mapo/commit/3e797756d0dc48142febcdb806390552ea522b30))
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
### Features
|
|
72
|
-
|
|
73
|
-
* style scrollbars ([48e4c7b](https://github.com/lotrekagency/mapo/commit/48e4c7b047a1062464d823ddeebdc60b96ea11a8))
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
# [1.0.0-alpha.34](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2022-11-11)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
### Bug Fixes
|
|
83
|
-
|
|
84
|
-
* fix draggable dialogues ([aeaa009](https://github.com/lotrekagency/mapo/commit/aeaa009cb30e4d13df1288d3996742d529713ffc))
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
# [1.0.0-alpha.30](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.29...v1.0.0-alpha.30) (2022-09-13)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
### Bug Fixes
|
|
94
|
-
|
|
95
|
-
* **auth:** removed js set cookie helpers since mapo login is http-only cookie based now ([6328c13](https://github.com/lotrekagency/mapo/commit/6328c13bec39d8e312f9dd4c33c53182fd64e6ed))
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
### Features
|
|
99
|
-
|
|
100
|
-
* added memoized debounce ([3c9a025](https://github.com/lotrekagency/mapo/commit/3c9a02509ffd8277d362c30eb2cfafabdde995b7))
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
# [1.0.0-alpha.23](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.22...v1.0.0-alpha.23) (2022-05-04)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
### Bug Fixes
|
|
110
|
-
|
|
111
|
-
* **utils:** better File recognition for deepClone util ([72a1002](https://github.com/lotrekagency/mapo/commit/72a1002144ff0be1c016a39f46f8ea712a950825))
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
# [1.0.0-alpha.22](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.21...v1.0.0-alpha.22) (2022-05-01)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
### Features
|
|
121
|
-
|
|
122
|
-
* big code refactor and improovements to fields management ([a818d8b](https://github.com/lotrekagency/mapo/commit/a818d8b891dbb4892f50267d6355c41297e2c6c6))
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
# [1.0.0-alpha.15](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-03-11)
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
### Features
|
|
132
|
-
|
|
133
|
-
* enhance findPropPaths to deal also with arrays indexes ([158a9aa](https://github.com/lotrekagency/mapo/commit/158a9aa9329defbecbb39e1f19df2855dd3ece01))
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
# [1.0.0-alpha.13](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-03-01)
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
### Features
|
|
143
|
-
|
|
144
|
-
* make all modals draggable 🛸 ([57da10d](https://github.com/lotrekagency/mapo/commit/57da10d17aa31d58e55fda5385d45d43beed8c4f))
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
# [1.0.0-alpha.10](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2022-02-11)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
### Bug Fixes
|
|
154
|
-
|
|
155
|
-
* fix objectHelper getPointed returning a keyerror when some point in path are missing ([6f1c2aa](https://github.com/lotrekagency/mapo/commit/6f1c2aa72176c9965e499135042de0646d9a04f8))
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
### Features
|
|
159
|
-
|
|
160
|
-
* **core:** Completely rewritten multipart capabilities, now the crud helper autodiscovers whet to use a multipart request. ([0a6546c](https://github.com/lotrekagency/mapo/commit/0a6546c9adeaf1fcf57a88105101e476b8b786dc))
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
# [1.0.0-alpha.9](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2022-02-08)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
### Bug Fixes
|
|
170
|
-
|
|
171
|
-
* **core:** fix object setPointed to create missing nesting ([7a26510](https://github.com/lotrekagency/mapo/commit/7a26510d6c1648156bd5a8f18d3851e4fe195d29))
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
# [1.0.0-alpha.8](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2022-01-23)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
### Features
|
|
181
|
-
|
|
182
|
-
* **quickedit:** merge detail component logics in to quickedit ([691f610](https://github.com/lotrekagency/mapo/commit/691f610b156f58a5d30598d89bf06425d90451d8))
|
package/helpers/cssVariables.js
DELETED
package/helpers/datetime.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
const pad = (val, len = 2) => String(val).padStart(len, "0");
|
|
2
|
-
const convertToDate = (date) =>
|
|
3
|
-
typeof date == "string" ? new Date(date) : date;
|
|
4
|
-
|
|
5
|
-
function getUTC(date) {
|
|
6
|
-
return new Date(date.toISOString().slice(0, -1));
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function cleanDateStr(dateStr) {
|
|
10
|
-
return dateStr &&
|
|
11
|
-
!dateStr.endsWith("Z") &&
|
|
12
|
-
dateStr.slice(-6).indexOf("+") === -1 &&
|
|
13
|
-
dateStr.slice(-6).indexOf("-") === -1
|
|
14
|
-
? dateStr + "Z"
|
|
15
|
-
: dateStr;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function formatLocalTime(date) {
|
|
19
|
-
return `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(
|
|
20
|
-
date.getSeconds()
|
|
21
|
-
)}`;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function formatLocalDate(date) {
|
|
25
|
-
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(
|
|
26
|
-
date.getDate()
|
|
27
|
-
)}`;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function formatLocalDateTime(date) {
|
|
31
|
-
return `${formatLocalDate(date)}T${formatLocalTime(date)}`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function formatUTCTime(date) {
|
|
35
|
-
return formatLocalTime(getUTC(date));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function formatUTCDate(date) {
|
|
39
|
-
return formatLocalDate(getUTC(date));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const formatOps = Object.fromEntries(
|
|
43
|
-
Object.entries({
|
|
44
|
-
getUTC,
|
|
45
|
-
formatLocalTime,
|
|
46
|
-
formatLocalDate,
|
|
47
|
-
formatLocalDateTime,
|
|
48
|
-
formatUTCTime,
|
|
49
|
-
formatUTCDate
|
|
50
|
-
}).map(([k, func]) => [k, (date) => func(convertToDate(date))])
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
function mergeDate(dateTime, date) {
|
|
54
|
-
let newDateTime = new Date(dateTime);
|
|
55
|
-
date = convertToDate(date);
|
|
56
|
-
newDateTime.setFullYear(date.getFullYear());
|
|
57
|
-
newDateTime.setMonth(date.getMonth());
|
|
58
|
-
newDateTime.setDate(date.getDate());
|
|
59
|
-
return newDateTime;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function mergeTime(dateTime, time) {
|
|
63
|
-
let newDateTime = new Date(dateTime);
|
|
64
|
-
let timeDateTime = new Date(`2000-01-01T${time}`);
|
|
65
|
-
return mergeDate(timeDateTime, newDateTime);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
module.exports = { ...formatOps, cleanDateStr, mergeDate, mergeTime };
|
package/helpers/debounce.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
function debounce(func, wait, immediate) {
|
|
2
|
-
var timeout;
|
|
3
|
-
return function () {
|
|
4
|
-
var context = this,
|
|
5
|
-
args = arguments;
|
|
6
|
-
var later = function () {
|
|
7
|
-
timeout = null;
|
|
8
|
-
if (!immediate) func.apply(context, args);
|
|
9
|
-
};
|
|
10
|
-
var callNow = immediate && !timeout;
|
|
11
|
-
clearTimeout(timeout);
|
|
12
|
-
timeout = setTimeout(later, wait);
|
|
13
|
-
if (callNow) func.apply(context, args);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function memoizedDebounce(
|
|
18
|
-
func,
|
|
19
|
-
wait,
|
|
20
|
-
immediate,
|
|
21
|
-
argsSerializer = (args) => JSON.stringify(args)
|
|
22
|
-
) {
|
|
23
|
-
var timeout = {};
|
|
24
|
-
return function () {
|
|
25
|
-
var context = this,
|
|
26
|
-
args = arguments,
|
|
27
|
-
serializedArgs = argsSerializer(arguments);
|
|
28
|
-
var later = function () {
|
|
29
|
-
timeout[serializedArgs] = null;
|
|
30
|
-
if (!immediate) func.apply(context, args);
|
|
31
|
-
};
|
|
32
|
-
var callNow = immediate && !timeout[serializedArgs];
|
|
33
|
-
clearTimeout(timeout[serializedArgs]);
|
|
34
|
-
timeout[serializedArgs] = setTimeout(later, wait);
|
|
35
|
-
if (callNow) func.apply(context, args);
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
module.exports = {
|
|
40
|
-
debounce,
|
|
41
|
-
memoizedDebounce,
|
|
42
|
-
};
|
package/helpers/formatters.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
function humanFileSize(bytes, si = false, dp = 1) {
|
|
2
|
-
const thresh = si ? 1000 : 1024;
|
|
3
|
-
|
|
4
|
-
if (Math.abs(bytes) < thresh) {
|
|
5
|
-
return bytes + " B";
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const units = si
|
|
9
|
-
? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
|
|
10
|
-
: ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
|
|
11
|
-
let u = -1;
|
|
12
|
-
const r = 10 ** dp;
|
|
13
|
-
|
|
14
|
-
do {
|
|
15
|
-
bytes /= thresh;
|
|
16
|
-
++u;
|
|
17
|
-
} while (
|
|
18
|
-
Math.round(Math.abs(bytes) * r) / r >= thresh &&
|
|
19
|
-
u < units.length - 1
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
return bytes.toFixed(dp) + " " + units[u];
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
function slugify(str) {
|
|
26
|
-
str = str || "";
|
|
27
|
-
str = str.replace(/^\s+|\s+$/g, ''); // trim
|
|
28
|
-
str = str.toLowerCase();
|
|
29
|
-
|
|
30
|
-
// remove accents, swap ñ for n, etc
|
|
31
|
-
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
|
|
32
|
-
var to = "aaaaeeeeiiiioooouuuunc------";
|
|
33
|
-
for (var i = 0, l = from.length; i < l; i++) {
|
|
34
|
-
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
|
|
38
|
-
.replace(/\s+/g, '-') // collapse whitespace and replace by -
|
|
39
|
-
.replace(/-+/g, '-'); // collapse dashes
|
|
40
|
-
|
|
41
|
-
return str;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
function titleCase(string) {
|
|
45
|
-
return (string && string[0].toUpperCase() + string.slice(1).toLowerCase()) || "";
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
module.exports = {
|
|
49
|
-
humanFileSize,
|
|
50
|
-
slugify,
|
|
51
|
-
titleCase,
|
|
52
|
-
}
|
package/helpers/menu.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
function calcMaxMenuNestDepth(node, currentDepth = 0) {
|
|
2
|
-
if (!node?.nodes || node?.nodes?.length === 0) {
|
|
3
|
-
return currentDepth;
|
|
4
|
-
}
|
|
5
|
-
let maxDepth = currentDepth;
|
|
6
|
-
for (const childNode of node.nodes) {
|
|
7
|
-
const childDepth = calcMaxMenuNestDepth(childNode, currentDepth + 1);
|
|
8
|
-
maxDepth = Math.max(maxDepth, childDepth);
|
|
9
|
-
}
|
|
10
|
-
return maxDepth;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
module.exports = {
|
|
14
|
-
calcMaxMenuNestDepth
|
|
15
|
-
}
|
package/helpers/objHelpers.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
var Vue = require('vue')
|
|
2
|
-
Vue = Vue.default || Vue
|
|
3
|
-
|
|
4
|
-
function deepClone(obj) {
|
|
5
|
-
const clone = obj instanceof Array ? Object.assign([]) : Object.assign({});
|
|
6
|
-
for (const i in obj) {
|
|
7
|
-
if (obj[i] != null && typeof (obj[i]) == 'object' && !(isFileOrBlob(obj[i])) && !(obj[i] instanceof Date)) {
|
|
8
|
-
clone[i] = deepClone(obj[i]);
|
|
9
|
-
} else {
|
|
10
|
-
clone[i] = obj[i];
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return clone;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function getPointed(obj, kpointed, def) {
|
|
17
|
-
const result = kpointed.split(".").reduce((o, k) => typeof (o) == 'object' ? (o || {})[k] : o, obj)
|
|
18
|
-
return result === undefined ? def : result
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function setPointed(obj, kpointed, val) {
|
|
22
|
-
const arr = typeof kpointed == 'string' ? kpointed.split(".") : kpointed
|
|
23
|
-
if (arr.length == 1) {
|
|
24
|
-
Vue.set(obj, arr[0], val)
|
|
25
|
-
return obj
|
|
26
|
-
}
|
|
27
|
-
Vue.set(obj, arr[0], obj[arr[0]] || {})
|
|
28
|
-
return setPointed(obj[arr[0]], arr.slice(1), val)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function filterObj(obj, kpointedArr) {
|
|
32
|
-
return (kpointedArr || []).reduce((acc, kpointed) => {
|
|
33
|
-
setPointed(acc, kpointed, getPointed(obj, kpointed))
|
|
34
|
-
return acc
|
|
35
|
-
}, {})
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function isFileInstance(input) {
|
|
39
|
-
if ('File' in window && input instanceof File)
|
|
40
|
-
return true;
|
|
41
|
-
else return false;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function isBlobInstance(input) {
|
|
45
|
-
if ('Blob' in window && input instanceof Blob)
|
|
46
|
-
return true;
|
|
47
|
-
else return false;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function isFileOrBlob(input) {
|
|
51
|
-
return isFileInstance(input) || isBlobInstance(input)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function filesInObject(obj) {
|
|
55
|
-
return findPropPaths(obj, ({ val }) => isFileOrBlob(val))
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function findPropPaths(obj, predicate) {
|
|
59
|
-
const discoveredObjects = [];
|
|
60
|
-
const path = [];
|
|
61
|
-
const results = [];
|
|
62
|
-
if (!obj && (typeof obj !== "object" || Array.isArray(obj))) {
|
|
63
|
-
throw new TypeError("First argument of findPropPaths is not the correct type Object");
|
|
64
|
-
}
|
|
65
|
-
if (typeof predicate !== "function") {
|
|
66
|
-
throw new TypeError("Predicate is not a function");
|
|
67
|
-
}
|
|
68
|
-
(function find(obj) {
|
|
69
|
-
for (const key in obj) {
|
|
70
|
-
if (predicate({ val: obj[key], obj, path, key }) === true) {
|
|
71
|
-
path.push(key);
|
|
72
|
-
results.push(path.join("."));
|
|
73
|
-
path.pop();
|
|
74
|
-
}
|
|
75
|
-
const o = obj[key];
|
|
76
|
-
if (o && typeof o === "object") {
|
|
77
|
-
if (!discoveredObjects.find(obj => obj === o)) {
|
|
78
|
-
path.push(key);
|
|
79
|
-
discoveredObjects.push(o);
|
|
80
|
-
find(o);
|
|
81
|
-
path.pop();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}(obj));
|
|
86
|
-
return results;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function diffObjs(obj1, obj2, clone=deepClone) {
|
|
90
|
-
const a = obj1 && clone(obj1) || obj2 && obj2.__proto__.constructor();
|
|
91
|
-
const b = obj2 && clone(obj2) || obj1 && obj1.__proto__.constructor();
|
|
92
|
-
for (const i in b) {
|
|
93
|
-
if (JSON.stringify(a[i]) === JSON.stringify(b[i])) {
|
|
94
|
-
delete b[i];
|
|
95
|
-
} else if (b[i] && !Array.isArray(b[i]) && typeof b[i] == 'object') {
|
|
96
|
-
const diff = diffObjs(a[i], b[i], (v) => v);
|
|
97
|
-
if (diff !== undefined){
|
|
98
|
-
b[i] = diff;
|
|
99
|
-
} else {
|
|
100
|
-
delete b[i];
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
return b && Object.keys(b).length ? b : undefined;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
module.exports = {
|
|
108
|
-
deepClone,
|
|
109
|
-
getPointed,
|
|
110
|
-
setPointed,
|
|
111
|
-
filterObj,
|
|
112
|
-
isFileInstance,
|
|
113
|
-
isBlobInstance,
|
|
114
|
-
isFileOrBlob,
|
|
115
|
-
filesInObject,
|
|
116
|
-
findPropPaths,
|
|
117
|
-
diffObjs
|
|
118
|
-
}
|
package/helpers/slots.js
DELETED
package/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const auth = require('./helpers/auth');
|
|
2
|
-
const debounce = require('./helpers/debounce');
|
|
3
|
-
const formatters = require('./helpers/formatters');
|
|
4
|
-
const objHelpers = require('./helpers/objHelpers');
|
|
5
|
-
const VDraggableModals = require('./plugins/v-draggable-modals');
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
auth,
|
|
9
|
-
debounce,
|
|
10
|
-
formatters,
|
|
11
|
-
objHelpers,
|
|
12
|
-
VDraggableModals,
|
|
13
|
-
}
|
package/loaders/dummy-loader.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = function (source, map) { this.callback(null, "export default function (Component) {}", map) }
|