cosey 0.11.2 → 0.11.4

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.
@@ -1,4 +1,4 @@
1
- import { defineComponent, inject, reactive, toRef, createVNode, mergeProps, Fragment, isVNode } from 'vue';
1
+ import { defineComponent, inject, reactive, toRef, ref, watch, createVNode, mergeProps, Fragment, isVNode } from 'vue';
2
2
  import { formEmits, formSlots, formProps, formBubbleContextSymbol } from './form.api.js';
3
3
  import { ElForm, ElButton } from 'element-plus';
4
4
  import { useFormTemplate } from './useFormTemplate.js';
@@ -6,6 +6,7 @@ import { Row as _Row } from '../row/index.js';
6
6
  import { OptionalWrapper as _OptionalWrapper } from '../optional-wrapper/index.js';
7
7
  import stdin_default$2 from './form-item.vue.js';
8
8
  import stdin_default$1 from './form.style.js';
9
+ import { useLayoutStore } from '../../store/layout.js';
9
10
  import { useComponentConfig } from '../config-provider/config-provider.api.js';
10
11
  import { useLocale } from '../../hooks/useLocale.js';
11
12
 
@@ -48,11 +49,19 @@ var stdin_default = defineComponent({
48
49
  clearValidate,
49
50
  submit
50
51
  }));
52
+ const innerInline = ref(props.inline);
53
+ const layoutStore = useLayoutStore();
54
+ watch(() => layoutStore.isMobile, isMobile => {
55
+ innerInline.value = isMobile ? false : props.inline;
56
+ }, {
57
+ immediate: true
58
+ });
51
59
  _expose(expose);
52
60
  return () => {
53
61
  return createVNode(ElForm, mergeProps({
54
62
  "ref": "form"
55
63
  }, elFormProps, {
64
+ "inline": innerInline.value,
56
65
  "class": [hashId.value, prefixCls.value]
57
66
  }, {
58
67
  onSubmit: event => {
@@ -33,6 +33,9 @@ export declare const formQueryProps: {
33
33
  type: BooleanConstructor;
34
34
  default: boolean;
35
35
  };
36
+ resetValues: {
37
+ type: PropType<() => Record<string, any>>;
38
+ };
36
39
  width: {
37
40
  type: PropType<import("..").FormItemWidth>;
38
41
  };
@@ -26,6 +26,9 @@ const formQueryProps = {
26
26
  collapsed: {
27
27
  type: Boolean,
28
28
  default: true
29
+ },
30
+ resetValues: {
31
+ type: Function
29
32
  }
30
33
  };
31
34
  const formQuerySlots = Object;
@@ -22,6 +22,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
22
22
  type: BooleanConstructor;
23
23
  default: boolean;
24
24
  };
25
+ resetValues: {
26
+ type: import("vue").PropType<() => Record<string, any>>;
27
+ };
25
28
  width: {
26
29
  type: import("vue").PropType<import("..").FormItemWidth>;
27
30
  };
@@ -114,6 +117,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
114
117
  type: BooleanConstructor;
115
118
  default: boolean;
116
119
  };
120
+ resetValues: {
121
+ type: import("vue").PropType<() => Record<string, any>>;
122
+ };
117
123
  width: {
118
124
  type: import("vue").PropType<import("..").FormItemWidth>;
119
125
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, ref, Fragment, provide, createVNode, mergeProps, cloneVNode, isVNode } from 'vue';
1
+ import { defineComponent, computed, ref, Fragment, provide, createVNode, mergeProps, cloneVNode, isVNode, unref } from 'vue';
2
2
  import { formQueryEmits, formQuerySlots, formQueryProps, defaultMapSizeColNumber, formQueryContextSymbol } from './form-query.api.js';
3
3
  import { ElForm, ElButton } from 'element-plus';
4
4
  import { FormItem as _FormItem } from '../form/index.js';
@@ -106,16 +106,25 @@ var stdin_default = defineComponent({
106
106
  reset,
107
107
  submit,
108
108
  submitting: submitting.value
109
- }) : createVNode(Fragment, null, [!props.hideSubmit && createVNode(ElButton, {
110
- "onClick": () => submit(),
111
- "type": "primary",
109
+ }) : createVNode(Fragment, null, [!props.hideSubmit && createVNode(ElButton, mergeProps({
110
+ "type": "primary"
111
+ }, props.submitProps, {
112
112
  "loading": submitting.value,
113
- "icon": Search
114
- }, _isSlot(_slot = t("co.form.search")) ? _slot : {
113
+ "icon": Search,
114
+ "onClick": () => submit()
115
+ }), _isSlot(_slot = t(props.submitText)) ? _slot : {
115
116
  default: () => [_slot]
116
- }), !props.hideReset && createVNode(ElButton, {
117
- "onClick": () => reset()
118
- }, _isSlot(_slot2 = t("co.form.reset")) ? _slot2 : {
117
+ }), !props.hideReset && createVNode(ElButton, mergeProps(props.resetProps, {
118
+ "onClick": () => reset(() => {
119
+ if (props.resetValues) {
120
+ const values = props.resetValues();
121
+ const model = unref(props.model);
122
+ if (values && model) {
123
+ Object.assign(model, values);
124
+ }
125
+ }
126
+ })
127
+ }), _isSlot(_slot2 = t(props.resetText)) ? _slot2 : {
119
128
  default: () => [_slot2]
120
129
  })]), props.grid && showToggle.value && createVNode(_Toggle, {
121
130
  "modelValue": innerCollapsed.value,
@@ -24,6 +24,9 @@ declare const _FormQuery: {
24
24
  type: BooleanConstructor;
25
25
  default: boolean;
26
26
  };
27
+ resetValues: {
28
+ type: import("vue").PropType<() => Record<string, any>>;
29
+ };
27
30
  width: {
28
31
  type: import("vue").PropType<import("..").FormItemWidth>;
29
32
  };
@@ -162,6 +165,9 @@ declare const _FormQuery: {
162
165
  type: BooleanConstructor;
163
166
  default: boolean;
164
167
  };
168
+ resetValues: {
169
+ type: import("vue").PropType<() => Record<string, any>>;
170
+ };
165
171
  width: {
166
172
  type: import("vue").PropType<import("..").FormItemWidth>;
167
173
  };
@@ -294,6 +300,9 @@ declare const _FormQuery: {
294
300
  type: BooleanConstructor;
295
301
  default: boolean;
296
302
  };
303
+ resetValues: {
304
+ type: import("vue").PropType<() => Record<string, any>>;
305
+ };
297
306
  width: {
298
307
  type: import("vue").PropType<import("..").FormItemWidth>;
299
308
  };
@@ -43,6 +43,9 @@ declare const _RemoteSelect: {
43
43
  type: BooleanConstructor;
44
44
  default: boolean;
45
45
  };
46
+ resetValues: {
47
+ type: import("vue").PropType<() => Record<string, any>>;
48
+ };
46
49
  width: {
47
50
  type: import("vue").PropType<import("..").FormItemWidth>;
48
51
  };
@@ -338,6 +341,9 @@ declare const _RemoteSelect: {
338
341
  type: BooleanConstructor;
339
342
  default: boolean;
340
343
  };
344
+ resetValues: {
345
+ type: import("vue").PropType<() => Record<string, any>>;
346
+ };
341
347
  width: {
342
348
  type: import("vue").PropType<import("..").FormItemWidth>;
343
349
  };
@@ -54,6 +54,9 @@ declare const _Table: {
54
54
  type: BooleanConstructor;
55
55
  default: boolean;
56
56
  };
57
+ resetValues: {
58
+ type: import("vue").PropType<() => Record<string, any>>;
59
+ };
57
60
  width: {
58
61
  type: import("vue").PropType<import("..").FormItemWidth>;
59
62
  };
@@ -362,6 +365,9 @@ declare const _Table: {
362
365
  type: BooleanConstructor;
363
366
  default: boolean;
364
367
  };
368
+ resetValues: {
369
+ type: import("vue").PropType<() => Record<string, any>>;
370
+ };
365
371
  width: {
366
372
  type: import("vue").PropType<import("..").FormItemWidth>;
367
373
  };
@@ -28,6 +28,9 @@ declare const _TableQuery: {
28
28
  type: BooleanConstructor;
29
29
  default: boolean;
30
30
  };
31
+ resetValues: {
32
+ type: import("vue").PropType<() => Record<string, any>>;
33
+ };
31
34
  width: {
32
35
  type: import("vue").PropType<import("../..").FormItemWidth>;
33
36
  };
@@ -173,6 +176,9 @@ declare const _TableQuery: {
173
176
  type: BooleanConstructor;
174
177
  default: boolean;
175
178
  };
179
+ resetValues: {
180
+ type: import("vue").PropType<() => Record<string, any>>;
181
+ };
176
182
  width: {
177
183
  type: import("vue").PropType<import("../..").FormItemWidth>;
178
184
  };
@@ -312,6 +318,9 @@ declare const _TableQuery: {
312
318
  type: BooleanConstructor;
313
319
  default: boolean;
314
320
  };
321
+ resetValues: {
322
+ type: import("vue").PropType<() => Record<string, any>>;
323
+ };
315
324
  width: {
316
325
  type: import("vue").PropType<import("../..").FormItemWidth>;
317
326
  };
@@ -36,6 +36,9 @@ export declare const tableQueryProps: {
36
36
  type: BooleanConstructor;
37
37
  default: boolean;
38
38
  };
39
+ resetValues: {
40
+ type: PropType<() => Record<string, any>>;
41
+ };
39
42
  width: {
40
43
  type: PropType<import("../..").FormItemWidth>;
41
44
  };
@@ -26,6 +26,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
26
26
  type: BooleanConstructor;
27
27
  default: boolean;
28
28
  };
29
+ resetValues: {
30
+ type: import("vue").PropType<() => Record<string, any>>;
31
+ };
29
32
  width: {
30
33
  type: import("vue").PropType<import("../..").FormItemWidth>;
31
34
  };
@@ -124,6 +127,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
124
127
  type: BooleanConstructor;
125
128
  default: boolean;
126
129
  };
130
+ resetValues: {
131
+ type: import("vue").PropType<() => Record<string, any>>;
132
+ };
127
133
  width: {
128
134
  type: import("vue").PropType<import("../..").FormItemWidth>;
129
135
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosey",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "基于 Vue3 + vite 的后台管理系统框架",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/store/layout.d.ts CHANGED
@@ -273,4 +273,4 @@ export declare const useOuterLayoutStore: (hot?: StoreGeneric) => import("pinia"
273
273
  changePassword: (data: any) => Promise<void>;
274
274
  logout: (lastPath?: string, flushOnly?: boolean) => Promise<void>;
275
275
  flush: (lastPath?: string) => Promise<void>;
276
- }, "changePassword" | "login" | "logout" | "flush" | "initializeData">>;
276
+ }, "changePassword" | "login" | "logout" | "initializeData" | "flush">>;
package/store/user.d.ts CHANGED
@@ -31,7 +31,7 @@ export declare const useUserStore: import("pinia").StoreDefinition<"cosey-user",
31
31
  changePassword: (data: any) => Promise<void>;
32
32
  logout: (lastPath?: string, flushOnly?: boolean) => Promise<void>;
33
33
  flush: (lastPath?: string) => Promise<void>;
34
- }, "changePassword" | "login" | "logout" | "flush" | "initializeData">>;
34
+ }, "changePassword" | "login" | "logout" | "initializeData" | "flush">>;
35
35
  export declare const useOuterUserStore: (hot?: StoreGeneric) => import("pinia").Store<"cosey-user", Pick<{
36
36
  dynamicRoutes: import("vue").ShallowRef<any[], any[]>;
37
37
  userInfo: import("vue").Ref<UserInfo | undefined, UserInfo | undefined>;
@@ -59,4 +59,4 @@ export declare const useOuterUserStore: (hot?: StoreGeneric) => import("pinia").
59
59
  changePassword: (data: any) => Promise<void>;
60
60
  logout: (lastPath?: string, flushOnly?: boolean) => Promise<void>;
61
61
  flush: (lastPath?: string) => Promise<void>;
62
- }, "changePassword" | "login" | "logout" | "flush" | "initializeData">>;
62
+ }, "changePassword" | "login" | "logout" | "initializeData" | "flush">>;