eco-vue-js 0.8.40 → 0.8.41
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/icons/default/IconAvatar.svg.js +1 -1
- package/dist/assets/icons/default/IconCheck.svg.js +1 -1
- package/dist/assets/icons/default/IconDanger.svg.js +2 -2
- package/dist/assets/icons/default/IconEdit.svg.js +2 -2
- package/dist/assets/icons/default/IconFalsePositive.svg.js +1 -1
- package/dist/assets/icons/default/IconFeedback.svg.js +1 -1
- package/dist/assets/icons/default/IconFilter.svg.js +1 -1
- package/dist/assets/icons/default/IconInProgress.svg.js +2 -2
- package/dist/assets/icons/default/IconJira.svg.js +1 -1
- package/dist/assets/icons/default/IconLogout.svg.js +1 -1
- package/dist/assets/icons/default/IconMore.svg.js +1 -1
- package/dist/assets/icons/default/IconNotification.svg.js +1 -1
- package/dist/assets/icons/default/IconProfile.svg.js +1 -1
- package/dist/assets/icons/default/IconSearch.svg.js +1 -1
- package/dist/assets/icons/default/IconSettings.svg.js +1 -1
- package/dist/assets/icons/default/IconStar.svg.js +1 -1
- package/dist/assets/icons/default/IconSuccess.svg.js +1 -1
- package/dist/assets/icons/default/IconTask.svg.js +1 -1
- package/dist/assets/icons/default/IconTime.svg.js +1 -1
- package/dist/assets/icons/sax/IconAddCircle.svg.js +1 -1
- package/dist/assets/icons/sax/IconAddSquare.svg.js +1 -1
- package/dist/assets/icons/sax/IconAlarm.svg.js +1 -1
- package/dist/assets/icons/sax/IconArchiveBook.svg.js +2 -2
- package/dist/assets/icons/sax/IconCandle.svg.js +1 -1
- package/dist/assets/icons/sax/IconCelery.svg.js +1 -1
- package/dist/assets/icons/sax/IconChart.svg.js +1 -1
- package/dist/assets/icons/sax/IconCheckCircle.svg.js +1 -1
- package/dist/assets/icons/sax/IconCloseCircle.svg.js +1 -1
- package/dist/assets/icons/sax/IconCopy.svg.js +2 -2
- package/dist/assets/icons/sax/IconCopySuccess.svg.js +2 -2
- package/dist/assets/icons/sax/IconCopyright.svg.js +1 -1
- package/dist/assets/icons/sax/IconDedupe.svg.js +2 -2
- package/dist/assets/icons/sax/IconEdit.svg.js +1 -1
- package/dist/assets/icons/sax/IconEditCircle.svg.js +2 -2
- package/dist/assets/icons/sax/IconElement.svg.js +1 -1
- package/dist/assets/icons/sax/IconEye.svg.js +2 -2
- package/dist/assets/icons/sax/IconEyeSlash.svg.js +1 -1
- package/dist/assets/icons/sax/IconFilter.svg.js +1 -1
- package/dist/assets/icons/sax/IconFilterRemove.svg.js +2 -2
- package/dist/assets/icons/sax/IconFinding.svg.js +1 -1
- package/dist/assets/icons/sax/IconJira.svg.js +1 -1
- package/dist/assets/icons/sax/IconKey.svg.js +2 -2
- package/dist/assets/icons/sax/IconKeySquare.svg.js +2 -2
- package/dist/assets/icons/sax/IconLayer.svg.js +1 -1
- package/dist/assets/icons/sax/IconLink.svg.js +2 -2
- package/dist/assets/icons/sax/IconLinkBold.svg.js +1 -1
- package/dist/assets/icons/sax/IconLinkOutline.svg.js +2 -2
- package/dist/assets/icons/sax/IconLogout.svg.js +4 -4
- package/dist/assets/icons/sax/IconMinusCircle.svg.js +1 -1
- package/dist/assets/icons/sax/IconNegate.svg.js +1 -1
- package/dist/assets/icons/sax/IconNegativeInfo.svg.js +1 -1
- package/dist/assets/icons/sax/IconNote.svg.js +2 -2
- package/dist/assets/icons/sax/IconOutlineCheckCircle.svg.js +1 -1
- package/dist/assets/icons/sax/IconOutlineCloseCircle.svg.js +1 -1
- package/dist/assets/icons/sax/IconOutlineEdit.svg.js +2 -2
- package/dist/assets/icons/sax/IconOutlineRefresh.svg.js +1 -1
- package/dist/assets/icons/sax/IconOutlineStar.svg.js +1 -1
- package/dist/assets/icons/sax/IconPaste.svg.js +2 -2
- package/dist/assets/icons/sax/IconProfile.svg.js +2 -2
- package/dist/assets/icons/sax/IconRadar.svg.js +1 -1
- package/dist/assets/icons/sax/IconSearch.svg.js +1 -1
- package/dist/assets/icons/sax/IconSettings.svg.js +2 -2
- package/dist/assets/icons/sax/IconSlash.svg.js +1 -1
- package/dist/assets/icons/sax/IconStar.svg.js +1 -1
- package/dist/assets/icons/sax/IconSummary.svg.js +1 -1
- package/dist/assets/icons/sax/IconTableSettings.svg.js +3 -3
- package/dist/assets/icons/sax/IconTag.svg.js +1 -1
- package/dist/assets/icons/sax/IconTime.svg.js +1 -1
- package/dist/assets/icons/sax/IconTrash.svg.js +1 -1
- package/dist/assets/icons/sax/IconUser.svg.js +1 -1
- package/dist/assets/icons/sax/IconVersionControl.svg.js +1 -1
- package/dist/assets/icons/sax/IconWeight.svg.js +2 -2
- package/dist/components/Button/WButtonCopy.vue.js +1 -1
- package/dist/components/Button/WButtonMore.vue.js +1 -1
- package/dist/components/Dropdown/utils/DropdownStyle.js +2 -2
- package/dist/components/DropdownMenu/WDropdownMenu.vue.d.ts.map +1 -1
- package/dist/components/List/WListCard.vue.js +3 -3
- package/dist/components/List/WListHeader.vue.js +2 -2
- package/dist/components/Modal/WModalStepper.vue.d.ts +2 -2
- package/dist/components/Modal/WModalStepper.vue.d.ts.map +1 -1
- package/dist/components/Modal/WModalStepper.vue.js +2 -2
- package/dist/components/Tabs/WTabs.vue.d.ts +2 -2
- package/dist/components/Tabs/WTabs.vue.d.ts.map +1 -1
- package/dist/components/Tabs/WTabs.vue.js +3 -3
- package/dist/components/Tabs/WTabsColumns.vue.js +2 -2
- package/dist/types/types.d.ts +1 -0
- package/dist/utils/DOMListenerContainer.d.ts.map +1 -1
- package/dist/utils/DOMListenerContainer.js +2 -2
- package/dist/utils/useDefaultQuery.d.ts +5 -3
- package/dist/utils/useDefaultQuery.d.ts.map +1 -1
- package/dist/utils/useDefaultQuery.js +19 -23
- package/package.json +20 -21
- package/tailwind-base/index.cjs +2 -0
@@ -1,12 +1,14 @@
|
|
1
1
|
import { QueryClient, UseQueryReturnType, QueryKey } from '@tanstack/vue-query';
|
2
2
|
import { ApiError } from './api';
|
3
3
|
type Params = Parameters<QueryClient['setQueriesData']>;
|
4
|
+
type SetData<TQueryFnData = unknown> = (updater: TQueryFnData, options?: Params[2]) => ReturnType<QueryClient['setQueriesData']>;
|
5
|
+
type UseQueryReturnTypeSetData<TQueryFnData = unknown, TData = TQueryFnData> = UseQueryReturnType<TData, ApiError> & {
|
6
|
+
setData: SetData<TQueryFnData>;
|
7
|
+
};
|
4
8
|
export declare const useDefaultQuery: <TQueryFnData = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: import('@tanstack/vue-query').UseQueryOptions<TQueryFnData, ApiError<{}, {
|
5
9
|
detail?: string | undefined;
|
6
10
|
non_field_errors?: string[] | undefined;
|
7
|
-
}>, TData, TQueryFnData, TQueryKey>, queryClient?: QueryClient | undefined) =>
|
8
|
-
setData: (updater: TQueryFnData, options?: Params[2]) => ReturnType<QueryClient["setQueriesData"]>;
|
9
|
-
};
|
11
|
+
}>, TData, TQueryFnData, TQueryKey>, queryClient?: QueryClient | undefined) => UseQueryReturnTypeSetData<TQueryFnData, TData>;
|
10
12
|
export declare const PAGE_LENGTH = 24;
|
11
13
|
export declare const makeQueryPaginated: <Data, QueryParams extends {
|
12
14
|
page?: number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useDefaultQuery.d.ts","sourceRoot":"","sources":["../../src/utils/useDefaultQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,QAAQ,EAAC,MAAM,qBAAqB,CAAA;AACtH,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAA;AAG9B,KAAK,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAEvD,
|
1
|
+
{"version":3,"file":"useDefaultQuery.d.ts","sourceRoot":"","sources":["../../src/utils/useDefaultQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,QAAQ,EAAC,MAAM,qBAAqB,CAAA;AACtH,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAA;AAG9B,KAAK,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAEvD,KAAK,OAAO,CAAC,YAAY,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAEhI,KAAK,yBAAyB,CAAC,YAAY,GAAG,OAAO,EAAE,KAAK,GAAG,YAAY,IAAI,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG;IACnH,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,YAAY,YACZ,KAAK,iBACL,SAAS,SAAS,QAAQ;;;+EACuD,yBAAyB,CAAC,YAAY,EAAE,KAAK,CAO/H,CAAA;AAED,eAAO,MAAM,WAAW,KAAK,CAAA;AAE7B,eAAO,MAAM,kBAAkB,GAAI,IAAI,EAAE,WAAW,SAAS;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAC,OAAO,MAAM,UAAU,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,0BAA6B,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAoDvO,CAAA"}
|
@@ -1,14 +1,12 @@
|
|
1
|
-
import {
|
1
|
+
import { useQuery, useQueryClient } from '@tanstack/vue-query';
|
2
2
|
import { ApiError } from './api.js';
|
3
3
|
import { unref } from 'vue';
|
4
4
|
|
5
5
|
const useDefaultQuery = (...args) => {
|
6
|
+
const query = useQuery(...args);
|
6
7
|
const queryClient = args[1] ?? useQueryClient();
|
7
|
-
|
8
|
-
return
|
9
|
-
...useQuery(...args),
|
10
|
-
setData
|
11
|
-
};
|
8
|
+
query.setData = (updater, options) => queryClient.setQueriesData({ queryKey: "queryKey" in args[0] ? args[0].queryKey : void 0 }, updater, options);
|
9
|
+
return query;
|
12
10
|
};
|
13
11
|
const PAGE_LENGTH = 24;
|
14
12
|
const makeQueryPaginated = (key, getter, setter, pageLength = PAGE_LENGTH) => {
|
@@ -33,28 +31,26 @@ const makeQueryPaginated = (key, getter, setter, pageLength = PAGE_LENGTH) => {
|
|
33
31
|
},
|
34
32
|
...options
|
35
33
|
});
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
if (
|
40
|
-
const
|
41
|
-
|
42
|
-
|
43
|
-
const
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
else newList.splice(itemIndex, 1, newItem);
|
50
|
-
setter(newList);
|
51
|
-
}
|
34
|
+
query.setData = (data, options2) => {
|
35
|
+
if (setter && unref(options2)?.index !== void 0) {
|
36
|
+
const index = unref(unref(options2)?.index);
|
37
|
+
if (index !== void 0) {
|
38
|
+
const newList = getter({}).slice();
|
39
|
+
const oldItem = query.data.value?.results[index];
|
40
|
+
if (oldItem !== void 0) {
|
41
|
+
const itemIndex = newList.findIndex((item) => item.id === oldItem.id);
|
42
|
+
const newItem = unref(unref(options2)?.newItem);
|
43
|
+
if (index !== -1) {
|
44
|
+
if (newItem === void 0) newList.splice(itemIndex, 1);
|
45
|
+
else newList.splice(itemIndex, 1, newItem);
|
46
|
+
setter(newList);
|
52
47
|
}
|
53
48
|
}
|
54
49
|
}
|
55
|
-
return query.setData(data, options2);
|
56
50
|
}
|
51
|
+
return query.setData(data, options2);
|
57
52
|
};
|
53
|
+
return query;
|
58
54
|
};
|
59
55
|
};
|
60
56
|
|
package/package.json
CHANGED
@@ -4,16 +4,15 @@
|
|
4
4
|
"type": "git",
|
5
5
|
"url": "https://github.com/rsmple/eco-vue-js.git"
|
6
6
|
},
|
7
|
-
"version": "0.8.
|
7
|
+
"version": "0.8.41",
|
8
8
|
"scripts": {
|
9
|
-
"
|
10
|
-
"build": "run-p type-check build-only",
|
9
|
+
"build": "run-p type-check \"build-only {@}\" --",
|
11
10
|
"preview": "vite preview",
|
12
|
-
"test:unit": "vitest --environment jsdom --root src/",
|
13
11
|
"build-only": "vite build",
|
14
|
-
"type-check": "vue-tsc --
|
15
|
-
"lint": "eslint . --
|
16
|
-
"lint
|
12
|
+
"type-check": "vue-tsc --build --force",
|
13
|
+
"lint": "eslint . --fix",
|
14
|
+
"lint-no-fix": "eslint .",
|
15
|
+
"lint-inspect-config": "npx eslint --inspect-config",
|
17
16
|
"write-imports": "node write-imports.js"
|
18
17
|
},
|
19
18
|
"peerDependencies": {
|
@@ -22,29 +21,29 @@
|
|
22
21
|
"vue-router": ">=4.4.5"
|
23
22
|
},
|
24
23
|
"devDependencies": {
|
25
|
-
"@
|
26
|
-
"@tsconfig/
|
24
|
+
"@tanstack/eslint-plugin-query": "5.60.1",
|
25
|
+
"@tsconfig/node22": "22.0.0",
|
27
26
|
"@types/jsdom": "21.1.7",
|
28
|
-
"@types/node": "22.9.
|
27
|
+
"@types/node": "22.9.1",
|
29
28
|
"@types/postcss-import": "14.0.3",
|
30
|
-
"@vitejs/plugin-vue": "5.
|
31
|
-
"@vue/eslint-config-typescript": "
|
32
|
-
"@vue/tsconfig": "0.
|
29
|
+
"@vitejs/plugin-vue": "5.2.0",
|
30
|
+
"@vue/eslint-config-typescript": "14.1.3",
|
31
|
+
"@vue/tsconfig": "0.6.0",
|
33
32
|
"autoprefixer": "10.4.20",
|
34
|
-
"eslint": "
|
35
|
-
"eslint-plugin-
|
36
|
-
"eslint-plugin-
|
33
|
+
"eslint": "9.15.0",
|
34
|
+
"eslint-plugin-tailwindcss": "3.17.5",
|
35
|
+
"eslint-plugin-unused-imports": "4.1.4",
|
36
|
+
"eslint-plugin-vue": "9.31.0",
|
37
37
|
"jsdom": "25.0.1",
|
38
|
-
"npm-run-
|
38
|
+
"npm-run-all2": "7.0.1",
|
39
39
|
"path": "0.12.7",
|
40
|
-
"postcss": "8.4.
|
40
|
+
"postcss": "8.4.49",
|
41
41
|
"postcss-import": "16.1.0",
|
42
|
-
"tailwindcss": "3.4.
|
42
|
+
"tailwindcss": "3.4.15",
|
43
43
|
"typescript": "5.6.3",
|
44
|
-
"vite": "5.4.
|
44
|
+
"vite": "5.4.11",
|
45
45
|
"vite-plugin-dts": "4.3.0",
|
46
46
|
"vite-svg-loader": "5.1.0",
|
47
|
-
"vitest": "2.1.4",
|
48
47
|
"vue-tsc": "2.1.10"
|
49
48
|
},
|
50
49
|
"type": "module",
|