mhz-helpers 0.0.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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './usePagination';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export declare function usePagination<T>(dataRaw: Ref<{
|
|
3
|
+
data: T[];
|
|
4
|
+
total: number;
|
|
5
|
+
} | undefined>): {
|
|
6
|
+
data: import("vue").ComputedRef<T[] | undefined>;
|
|
7
|
+
total: import("vue").ComputedRef<number | undefined>;
|
|
8
|
+
setPage: (pageToSet: number, page: number) => number;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function clone<T>(obj: T): T;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { computed as u, toRaw as m } from "vue";
|
|
2
|
+
function c(t) {
|
|
3
|
+
const o = u(() => t.value?.data), n = u(() => t.value?.total);
|
|
4
|
+
function i(r, e) {
|
|
5
|
+
return !n.value || r === 0 || r === n.value + 1 ? e : r;
|
|
6
|
+
}
|
|
7
|
+
return { data: o, total: n, setPage: i };
|
|
8
|
+
}
|
|
9
|
+
function f(t) {
|
|
10
|
+
return structuredClone(m(t));
|
|
11
|
+
}
|
|
12
|
+
function l(t) {
|
|
13
|
+
return t ? new Intl.DateTimeFormat().format(new Date(t)) : "-";
|
|
14
|
+
}
|
|
15
|
+
function D(t) {
|
|
16
|
+
return t ? new Intl.DateTimeFormat(void 0, {
|
|
17
|
+
year: "numeric",
|
|
18
|
+
month: "numeric",
|
|
19
|
+
day: "numeric",
|
|
20
|
+
hour: "numeric",
|
|
21
|
+
minute: "numeric"
|
|
22
|
+
}).format(new Date(t)) : "-";
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
f as clone,
|
|
26
|
+
l as formatDate,
|
|
27
|
+
D as formatDateTime,
|
|
28
|
+
c as usePagination
|
|
29
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mhz-helpers",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "mhz-helpers",
|
|
5
|
+
"author": "dergunov.com",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "vite build",
|
|
15
|
+
"lint": "eslint src/index.ts",
|
|
16
|
+
"ts": "vue-tsc --noEmit"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"vue": "3.3.4"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "20.4.9",
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "6.3.0",
|
|
24
|
+
"@typescript-eslint/parser": "6.3.0",
|
|
25
|
+
"@vitejs/plugin-vue": "4.2.3",
|
|
26
|
+
"eslint": "8.46.0",
|
|
27
|
+
"eslint-config-prettier": "9.0.0",
|
|
28
|
+
"eslint-import-resolver-typescript": "3.5.5",
|
|
29
|
+
"eslint-plugin-import": "2.28.0",
|
|
30
|
+
"eslint-plugin-prettier": "5.0.0",
|
|
31
|
+
"eslint-plugin-vue": "9.16.1",
|
|
32
|
+
"postcss-html": "1.5.0",
|
|
33
|
+
"prettier": "3.0.1",
|
|
34
|
+
"stylelint": "15.10.2",
|
|
35
|
+
"stylelint-config-recess-order": "4.3.0",
|
|
36
|
+
"stylelint-config-recommended-scss": "12.0.0",
|
|
37
|
+
"stylelint-config-recommended-vue": "1.5.0",
|
|
38
|
+
"stylelint-prettier": "4.0.2",
|
|
39
|
+
"typescript": "5.1.6",
|
|
40
|
+
"vite": "4.4.9",
|
|
41
|
+
"vite-plugin-dts": "3.5.1",
|
|
42
|
+
"vue-linters-config": "0.1.6",
|
|
43
|
+
"vue-tsc": "1.8.8"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"vue": "3.3.4"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": "18"
|
|
50
|
+
}
|
|
51
|
+
}
|