eco-vue-js 0.4.9 → 0.4.11
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/dist/components/Form/WForm.vue.js +2 -2
- package/dist/components/Form/models/utils.d.ts +1 -1
- package/dist/components/Form/models/utils.d.ts.map +1 -1
- package/dist/components/Form/models/utils.js +6 -4
- package/dist/components/Form/use/useFormTitleMap.js +1 -1
- package/dist/components/Tabs/WTabs.vue.d.ts +5 -1
- package/dist/components/Tabs/WTabs.vue.d.ts.map +1 -1
- package/dist/components/Tabs/WTabs.vue.js +11 -3
- package/dist/main.js +1 -1
- package/dist/types/global.d.ts +1 -1
- package/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +11 -2
- package/package.json +1 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineComponent,
|
1
|
+
import { defineComponent, toRef, provide, inject, watch, onBeforeUnmount, openBlock, createElementBlock, renderSlot } from 'vue';
|
2
2
|
import { wFormUnlistener } from './models/injection.js';
|
3
3
|
import { useFormErrorMessageMap } from './use/useFormErrorMessageMap.js';
|
4
4
|
import { useFormHasChangesMap } from './use/useFormHasChangesMap.js';
|
@@ -17,7 +17,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
17
|
setup(__props, { expose: __expose, emit: __emit }) {
|
18
18
|
const props = __props;
|
19
19
|
const emit = __emit;
|
20
|
-
const name =
|
20
|
+
const name = toRef(props, "name");
|
21
21
|
const { titleGetter, titleMapUnlistener } = useFormTitleMap(name, toRef(props, "title"));
|
22
22
|
const { errorMessageMapUnlistener, isValid, errorMessage, errorMessageMap } = useFormErrorMessageMap(name, titleGetter);
|
23
23
|
const { hasChangesMapUnlistener, hasChanges } = useFormHasChangesMap(name);
|
@@ -1,3 +1,3 @@
|
|
1
1
|
export declare const removeKey: <T extends Record<string, unknown>>(entity: T, key: string) => T;
|
2
|
-
export declare const compileMessage: (title: string, message: string | undefined) => string | undefined;
|
2
|
+
export declare const compileMessage: (title: string | undefined, message: string | undefined) => string | undefined;
|
3
3
|
//# sourceMappingURL=utils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/models/utils.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,SAAS,8CAA+C,CAAC,OAAO,MAAM,KAAG,CAMrF,CAAA;AAKD,eAAO,MAAM,cAAc,UAAW,MAAM,WAAW,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/models/utils.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,SAAS,8CAA+C,CAAC,OAAO,MAAM,KAAG,CAMrF,CAAA;AAKD,eAAO,MAAM,cAAc,UAAW,MAAM,GAAG,SAAS,WAAW,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SAShG,CAAA"}
|
@@ -3,13 +3,15 @@ const removeKey = (entity, key) => {
|
|
3
3
|
delete result[key];
|
4
4
|
return result;
|
5
5
|
};
|
6
|
-
const fieldMessageStart = "- ";
|
7
|
-
const subformMessageStart = "
|
6
|
+
const fieldMessageStart = " - ";
|
7
|
+
const subformMessageStart = " ";
|
8
8
|
const compileMessage = (title, message) => {
|
9
9
|
if (message === void 0)
|
10
10
|
return void 0;
|
11
|
-
if (
|
12
|
-
return
|
11
|
+
if (title === void 0)
|
12
|
+
return message;
|
13
|
+
if (message.startsWith(subformMessageStart)) {
|
14
|
+
return `${subformMessageStart}${title}
|
13
15
|
${message}`;
|
14
16
|
} else {
|
15
17
|
return `${fieldMessageStart}${title}: ${message}`;
|
@@ -11,7 +11,7 @@ const useFormTitleMap = (name, title) => {
|
|
11
11
|
titleMap.value = removeKey(titleMap.value, key);
|
12
12
|
};
|
13
13
|
const titleGetter = (key) => {
|
14
|
-
return titleMap.value[key]
|
14
|
+
return titleMap.value[key];
|
15
15
|
};
|
16
16
|
provide(wFormTitleUpdater, titleMapUpdater);
|
17
17
|
const titleUpdaterInjected = inject(wFormTitleUpdater, void 0);
|
@@ -10,7 +10,11 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimePr
|
|
10
10
|
updateIndex: (value: number) => void;
|
11
11
|
next: () => void;
|
12
12
|
previous: () => void;
|
13
|
-
validate: (index: number) => string | undefined;
|
13
|
+
validate: (index: number, silent?: boolean | undefined) => string | undefined;
|
14
|
+
invalidate: (index: number, payload: {
|
15
|
+
[x: string]: string | string[];
|
16
|
+
}) => void;
|
17
|
+
initModel: (index: number) => void;
|
14
18
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
15
19
|
"update:current": (value: number) => void;
|
16
20
|
"update:has-changes": (value: boolean) => void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WTabs.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/WTabs.vue"],"names":[],"mappings":"AAkFA;AAEA,OAAO,EAAkC,KAAK,KAAK,EAAoD,MAAM,KAAK,CAAA
|
1
|
+
{"version":3,"file":"WTabs.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/WTabs.vue"],"names":[],"mappings":"AAkFA;AAEA,OAAO,EAAkC,KAAK,KAAK,EAAoD,MAAM,KAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwYlH,wBAaG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC"}
|
@@ -88,8 +88,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
88
88
|
return;
|
89
89
|
minHeight.value = value;
|
90
90
|
};
|
91
|
-
const validate = (index) => {
|
92
|
-
return form?.value[index].validate();
|
91
|
+
const validate = (index, ...args) => {
|
92
|
+
return form?.value[index].validate(...args);
|
93
|
+
};
|
94
|
+
const invalidate = (index, ...args) => {
|
95
|
+
return form?.value[index].invalidate(...args);
|
96
|
+
};
|
97
|
+
const initModel = (index, ...args) => {
|
98
|
+
return form?.value[index].initModel(...args);
|
93
99
|
};
|
94
100
|
const tabItemListenerInjected = inject(wTabItemListener, null);
|
95
101
|
const tabItemUnlistenerInjected = inject(wTabItemUnlistener, null);
|
@@ -111,7 +117,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
111
117
|
updateIndex,
|
112
118
|
next,
|
113
119
|
previous,
|
114
|
-
validate
|
120
|
+
validate,
|
121
|
+
invalidate,
|
122
|
+
initModel
|
115
123
|
});
|
116
124
|
return (_ctx, _cache) => {
|
117
125
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
package/dist/main.js
CHANGED
@@ -70,4 +70,4 @@ export { SemanticType } from './utils/SemanticType.js';
|
|
70
70
|
export { HorizontalAlign } from './utils/HorizontalAlign.js';
|
71
71
|
export { Month, WeekDay, addDay, addMonth, addYear, dateFormat, dateFormatter, dateRegexp, dateToQueryString, datetimeFormat, durationHumanize, getDurationRound, getStartOfDay, getStartOfMonth, getStartOfWeek, isSameDate, isSameMonth, isSameYear, monthShortFormatter, parseDate, timeFormat, weekdayShortFormatter } from './utils/dateTime.js';
|
72
72
|
export { getIsMobile, getIsTouchDevice } from './utils/mobile.js';
|
73
|
-
export { debounce, genId, getAllScrollParents, getScrollParent, hasParent, isClientSide, isEqualObj, numberCompactFormatter, numberFormatter, percentCompactFormatter, throttle } from './utils/utils.js';
|
73
|
+
export { debounce, genId, getAllScrollParents, getScrollParent, hasParent, isClientSide, isEqualArr, isEqualObj, numberCompactFormatter, numberFormatter, percentCompactFormatter, throttle } from './utils/utils.js';
|
package/dist/types/global.d.ts
CHANGED
@@ -40,7 +40,7 @@ declare type DefaultData = {id: number, [key: string]: unknown}
|
|
40
40
|
|
41
41
|
type Params = Parameters<import('@tanstack/vue-query').QueryClient['setQueriesData']>
|
42
42
|
|
43
|
-
declare type QueryParams = Partial<Record<string,
|
43
|
+
declare type QueryParams = Partial<Record<string, unknown> & {page?: number}>
|
44
44
|
|
45
45
|
declare type UseDefaultQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends import('@tanstack/vue-query').QueryKey = import('@tanstack/vue-query').QueryKey> =
|
46
46
|
(...args: Parameters<typeof useQuery<TQueryFnData, TError, TData, TQueryKey>>) => import('@tanstack/vue-query').UseQueryReturnType<TData, TError> & {
|
package/dist/utils/utils.d.ts
CHANGED
@@ -4,6 +4,7 @@ export declare const hasParent: (parent: Element, current: Element) => boolean;
|
|
4
4
|
type DebounceCb = (...args: any[]) => void;
|
5
5
|
export declare function debounce<T extends DebounceCb>(cb: T, delay?: number): T;
|
6
6
|
export declare function throttle<T extends DebounceCb>(cb: T, delay?: number): T;
|
7
|
+
export declare const isEqualArr: (arr1: unknown[], arr2: unknown[]) => boolean;
|
7
8
|
export declare const isEqualObj: (obj1: Record<string, unknown>, obj2: Record<string, unknown>, exclude?: string[]) => boolean;
|
8
9
|
export declare const percentCompactFormatter: Intl.NumberFormat;
|
9
10
|
export declare const numberCompactFormatter: Intl.NumberFormat;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,eAAe,SAAU,OAAO,KAAG,OAAO,GAAG,IAKhD,C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SAAU,OAAO,MAAM,EAAE,OAAO,CAAC,QAAQ,OAAO,MAAM,EAAE,OAAO,CAAC,YAAY,MAAM,EAAE,KAAG,OAS7G,CAAA;AAED,eAAO,MAAM,uBAAuB,mBAAmE,CAAA;AACvG,eAAO,MAAM,sBAAsB,mBAAiD,CAAA;AACpF,eAAO,MAAM,eAAe,mBAA0B,CAAA;AAEtD,eAAO,MAAM,YAAY,EAAE,OAAuC,CAAA;AAIlE,eAAO,MAAM,KAAK,cAEjB,CAAA"}
|
package/dist/utils/utils.js
CHANGED
@@ -46,8 +46,17 @@ function throttle(cb, delay = 200) {
|
|
46
46
|
}, delay);
|
47
47
|
};
|
48
48
|
}
|
49
|
+
const isEqualArr = (arr1, arr2) => {
|
50
|
+
return arr1.length === arr2.length && arr1.every((item) => arr2.includes(item));
|
51
|
+
};
|
49
52
|
const isEqualObj = (obj1, obj2, exclude) => {
|
50
|
-
return
|
53
|
+
return Object.keys({ ...obj1, ...obj2 }).every((key) => {
|
54
|
+
if (exclude?.includes(key) || obj1[key] === obj2[key])
|
55
|
+
return true;
|
56
|
+
if (Array.isArray(obj1[key]) && Array.isArray(obj2[key]))
|
57
|
+
return isEqualArr(obj1[key], obj2[key]);
|
58
|
+
return false;
|
59
|
+
});
|
51
60
|
};
|
52
61
|
const percentCompactFormatter = Intl.NumberFormat("en", { notation: "compact", style: "percent" });
|
53
62
|
const numberCompactFormatter = Intl.NumberFormat("en", { notation: "compact" });
|
@@ -58,4 +67,4 @@ const genId = () => {
|
|
58
67
|
return iterator++;
|
59
68
|
};
|
60
69
|
|
61
|
-
export { debounce, genId, getAllScrollParents, getScrollParent, hasParent, isClientSide, isEqualObj, numberCompactFormatter, numberFormatter, percentCompactFormatter, throttle };
|
70
|
+
export { debounce, genId, getAllScrollParents, getScrollParent, hasParent, isClientSide, isEqualArr, isEqualObj, numberCompactFormatter, numberFormatter, percentCompactFormatter, throttle };
|