eco-vue-js 0.4.8 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, toRef, provide, inject, watch, onBeforeUnmount, openBlock, createElementBlock, renderSlot } from 'vue';
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 = computed(() => props.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,SAQpF,CAAA"}
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 (message.startsWith(fieldMessageStart) || message.startsWith(subformMessageStart)) {
12
- return `${subformMessageStart}${title}:
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] ?? key;
14
+ return titleMap.value[key];
15
15
  };
16
16
  provide(wFormTitleUpdater, titleMapUpdater);
17
17
  const titleUpdaterInjected = inject(wFormTitleUpdater, void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"WSelectSingle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectSingle.vue"],"names":[],"mappings":"AAoDA;AAEA,OAAO,EAA8B,KAAK,SAAS,EAAC,MAAM,KAAK,CAAA;;;YAmNrD,MAAM;;;;;gBADF,IAAI,GAAG,IAAI;;;;;;;;;;;;;;;aAEd,IAAI,EAAE;;;gBAOsB,IAAI;;;;;;;;WAsBpC,GAAG;;;;;;YAtDmB,GAAG;uBACJ,GAAG;;;YAtJzB,mBAAmB,SAAS,IAAI,GAAG,IAAI,GAAG,IAAI;YAC9C,eAAe,SAAS,MAAM,GAAG,IAAI;YACrC,eAAe,SAAS,MAAM,GAAG,IA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I;WACpE,GAAG;;;;;;YAtDmB,GAAG;uBACJ,GAAG;;;YAxJzB,mBAAmB,SAAS,IAAI,GAAG,IAAI,GAAG,IAAI;YAC9C,eAAe,SAAS,MAAM,GAAG,IAAI;YACrC,eAAe,SAAS,MAAM,GAAG,IAAI;;;;;;;;oBA6KjC,MAAM;;;;;wBADF,IAAI,GAAG,IAAI;;;;;;;;;;;;;;;qBAEd,IAAI,EAAE;;;wBAOsB,IAAI;;;;;;;;;;aAqB4B,IAAI;eACpE,GAAG;;;;;;gBAtDmB,GAAG;2BACJ,GAAG;;;gBAxJzB,mBAAmB,SAAS,IAAI,GAAG,IAAI,GAAG,IAAI;gBAC9C,eAAe,SAAS,MAAM,GAAG,IAAI;gBACrC,eAAe,SAAS,MAAM,GAAG,IAAI;;;;AApC3C,wBAoP2E"}
@@ -34,9 +34,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
34
34
  const props = __props;
35
35
  const emit = __emit;
36
36
  const selectComponent = ref();
37
- const arrayValue = computed(() => props.modelValue ? [props.modelValue] : []);
37
+ const arrayValue = computed(() => props.modelValue !== null ? [props.modelValue] : []);
38
38
  const updateModelValue = (value) => {
39
39
  emit("update:modelValue", value);
40
+ blur();
40
41
  };
41
42
  const createOption = (value) => {
42
43
  emit("create:option", value);
@@ -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":["../../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AC,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, [
@@ -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, number | string> & {page?: number}>
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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/rsmple/eco-vue-js.git"
6
6
  },
7
- "version": "0.4.8",
7
+ "version": "0.4.10",
8
8
  "scripts": {
9
9
  "dev": "vite",
10
10
  "build": "run-p type-check build-only",