@vue-ui-kit/ant 1.8.0 → 1.8.3

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/index.d.ts CHANGED
@@ -1,12 +1,16 @@
1
1
  import { App } from 'vue';
2
+ import { setUIKitConfig, getUIKitConfig, resetUIKitConfig, UIKitConfig } from './packages/utils/config';
3
+ declare function setup(config?: Partial<UIKitConfig>): void;
2
4
  declare const _default: {
3
5
  install(app: App): void;
4
- addFormatter: (formatter: Record<string, (a: import('./declarations/antProxy').CellFuncArg, ...args: any[]) => any>) => void;
6
+ addFormatter: (formatter: Record<string, (a: import('./Declarations/antProxy').CellFuncArg, ...args: any[]) => any>) => void;
5
7
  addRender: (name: string, { renderItemContent, renderDefault, }: {
6
8
  renderItemContent?: (options: import('./declarations/antProxy').RenderOptions, params: import('./declarations/antProxy').RenderFormParams, defaultHandler: Recordable) => any;
7
9
  renderDefault?: (options: import('./declarations/antProxy').RenderOptions, params: import('./declarations/antProxy').RenderTableParams, defaultHandler: Recordable) => any;
8
10
  }) => void;
11
+ setup: typeof setup;
9
12
  };
10
13
  export default _default;
11
14
  export * from './declarations/antProxy';
12
15
  export * from './packages/utils/core';
16
+ export { setup, setUIKitConfig, getUIKitConfig, resetUIKitConfig, type UIKitConfig };
@@ -3,12 +3,10 @@ declare const _default: <T extends Recordable = Recordable<any>>(__VLS_props: No
3
3
  props: __VLS_Prettify<Pick<Partial<{}> & Omit<{
4
4
  readonly onTrigger?: ((cusFields?: string | string[] | undefined) => any) | undefined;
5
5
  readonly onReset?: (() => any) | undefined;
6
- readonly onDelayTrigger?: ((cusFields?: string | string[] | undefined, time?: number | undefined) => any) | undefined;
7
6
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<{}> & Readonly<{
8
7
  onTrigger?: ((cusFields?: string | string[] | undefined) => any) | undefined;
9
8
  onReset?: (() => any) | undefined;
10
- onDelayTrigger?: ((cusFields?: string | string[] | undefined, time?: number | undefined) => any) | undefined;
11
- }>, never>, "onReset" | "onTrigger" | "onDelayTrigger"> & {
9
+ }>, never>, "onReset" | "onTrigger"> & {
12
10
  item: PFormItemProps<T>;
13
11
  formData: T;
14
12
  }> & import('vue').PublicProps;
@@ -16,7 +14,6 @@ declare const _default: <T extends Recordable = Recordable<any>>(__VLS_props: No
16
14
  attrs: any;
17
15
  slots: ReturnType<() => {}>;
18
16
  emit: {
19
- (e: "delayTrigger", cusFields?: string | string[], time?: number): void;
20
17
  (e: "trigger", cusFields?: string | string[]): void;
21
18
  (e: "reset"): void;
22
19
  } & {};
@@ -3,12 +3,12 @@ import { TableProps } from 'ant-design-vue';
3
3
  import { ColumnProps } from '../../declarations/antProxy';
4
4
  declare const _default: <D = Recordable<any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_Prettify<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
5
  props: __VLS_Prettify<Pick<Partial<{
6
- modelValue: D[];
7
6
  tableConfig: TableProps<any>;
7
+ modelValue: D[];
8
8
  editColumns: ColumnProps<Recordable<any>>[];
9
9
  }> & Omit<{
10
- readonly modelValue: D[];
11
10
  readonly tableConfig: TableProps<any>;
11
+ readonly modelValue: D[];
12
12
  readonly editColumns: ColumnProps<Recordable<any>>[];
13
13
  readonly onTrigger?: ((...args: any[]) => any) | undefined;
14
14
  readonly "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
@@ -28,7 +28,7 @@ declare const _default: <D = Recordable<any>>(__VLS_props: NonNullable<Awaited<t
28
28
  }>> & Readonly<{
29
29
  onTrigger?: ((...args: any[]) => any) | undefined;
30
30
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
31
- }>, "modelValue" | "tableConfig" | "editColumns">, "onTrigger" | "onUpdate:modelValue" | ("modelValue" | "tableConfig" | "editColumns")> & {}> & import('vue').PublicProps;
31
+ }>, "tableConfig" | "modelValue" | "editColumns">, "onTrigger" | "onUpdate:modelValue" | ("tableConfig" | "modelValue" | "editColumns")> & {}> & import('vue').PublicProps;
32
32
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
33
33
  attrs: any;
34
34
  slots: ReturnType<() => {}>;
@@ -0,0 +1,17 @@
1
+ import { PFormProps, PGridProps } from '../../declarations/antProxy';
2
+ export interface UIKitConfig {
3
+ form?: {
4
+ labelCol?: any;
5
+ wrapperCol?: any;
6
+ };
7
+ grid?: {
8
+ align?: 'left' | 'right' | 'center';
9
+ lazyReset?: boolean;
10
+ fitHeight?: number;
11
+ };
12
+ }
13
+ export declare function setUIKitConfig(config: Partial<UIKitConfig>): void;
14
+ export declare function getUIKitConfig(): UIKitConfig;
15
+ export declare function getFormDefaults(): Partial<PFormProps>;
16
+ export declare function getGridDefaults(): Partial<PGridProps>;
17
+ export declare function resetUIKitConfig(): void;
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";:root{--p-theme-bg: #fff}.p-pane{background-color:var(--p-theme-bg);padding:16px;border-radius:4px}.w-full{width:100%}.cursor-pointer{cursor:pointer}.py-4x{padding-top:4px;padding-bottom:4px}.px-2x{padding-left:2px;padding-right:2px}.pl-4x{padding-left:1em}.pl-8{padding-left:2em}.h-0{height:0}.h-full{height:100%}.flex{display:flex}.flex-col{flex-direction:column}.flex-1{flex:1}.items-center{align-items:center}.justify-between{justify-content:space-between}.gap-4px{gap:4px}.gap-8px{gap:8px}.pt-8px{padding-top:8px}.px-16px{padding-left:16px;padding-right:16px}.mt-4px{margin-top:4px}.text-right{text-align:right}.overflow-y-auto{overflow-y:auto}.p-theme-bg{background-color:var(--p-theme-bg)}.p-wrapper .p-form-wrapper{z-index:4}.p-wrapper .p-toolbar-wrapper{box-shadow:0 8px #fff;border-radius:.5em .5em 0 0;margin-bottom:-.5em}.p-wrapper .ant-form .ant-form-item{margin-bottom:0}.p-wrapper .ant-form .ant-form-item.p-required .ant-form-item-label>label:before{display:inline-block;margin-inline-end:4px;color:#ff4d4f;font-size:14px;font-family:SimSun,sans-serif;line-height:1;content:"*"}.p-wrapper .ant-form .ant-form-item .ant-form-item-label{display:flex;align-items:start;justify-content:flex-end}.p-wrapper .ant-form .ant-form-item .ant-form-item-label>label{white-space:break-spaces;align-items:flex-start;height:fit-content;padding-top:.36em}.p-wrapper .ant-form .ant-form-item .ant-form-item-label>label:after{padding-left:4px;margin-inline-start:unset}.p-wrapper .ant-form.ant-form-vertical .ant-form-item .ant-form-item-label{justify-content:flex-start;font-weight:600}.p-wrapper .ant-table-sticky-scroll{visibility:hidden}.p-wrapper .ant-table-header.ant-table-sticky-holder:before{content:"";width:100%;position:absolute;height:22px;display:block;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);top:-16px}.p-wrapper .ant-table-wrapper .ant-table-pagination.ant-pagination{margin:unset;padding:16px 0}.p-wrapper .p-inner-scroll>.ant-table-wrapper{height:100%}.p-wrapper .p-inner-scroll>.ant-table-wrapper>.ant-spin-nested-loading{height:100%}.p-wrapper .p-inner-scroll>.ant-table-wrapper>.ant-spin-nested-loading>.ant-spin-container{height:100%;display:flex;flex-direction:column}.p-wrapper .p-inner-scroll>.ant-table-wrapper>.ant-spin-nested-loading>.ant-spin-container>.ant-table{border-radius:unset}.p-wrapper .ant-pagination-options .ant-select{width:100px}.p-error-group-tab{position:relative;overflow:visible;color:#f5222d!important}.p-error-group-tab:after{content:"🏷️";position:absolute;top:-1em;right:0;width:1em;height:1em;font-size:.8em;animation:heartbeat 2s infinite}.p-content-align-right.ant-form-item .ant-form-item-control-input-content{display:flex;justify-content:flex-end;align-items:center;text-align:right}.p-content-align-center.ant-form-item .ant-form-item-control-input-content{display:flex;justify-content:center;align-items:center;text-align:center}@keyframes heartbeat{0%{transform:scale(1)}6%{transform:scale(1.22)}12%{transform:scale(1)}18%{transform:scale(1.18)}24%{transform:scale(1)}48%{transform:scale(1)}54%{transform:scale(1.22)}60%{transform:scale(1)}66%{transform:scale(1.18)}72%{transform:scale(1)}to{transform:scale(1)}}
1
+ @charset "UTF-8";:root{--p-theme-bg: #fff}.p-pane{background-color:var(--p-theme-bg);padding:16px;border-radius:4px}.w-full{width:100%}.cursor-pointer{cursor:pointer}.py-4x{padding-top:4px;padding-bottom:4px}.px-2x{padding-left:2px;padding-right:2px}.pl-4x{padding-left:1em}.pl-8{padding-left:2em}.h-0{height:0}.h-full{height:100%}.flex{display:flex}.flex-col{flex-direction:column}.flex-1{flex:1}.items-center{align-items:center}.justify-between{justify-content:space-between}.gap-4px{gap:4px}.gap-8px{gap:8px}.pt-8px{padding-top:8px}.px-16px{padding-left:16px;padding-right:16px}.mt-4px{margin-top:4px}.text-right{text-align:right}.overflow-y-auto{overflow-y:auto}.p-theme-bg{background-color:var(--p-theme-bg)}.p-wrapper .p-form-wrapper{z-index:4}.p-wrapper .p-error-hang-out .ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(.ant-input-affix-wrapper-borderless).ant-input-affix-wrapper{border-color:#d9d9d9!important}.p-wrapper .p-error-hang-out .ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(.ant-input-affix-wrapper-borderless).ant-input-affix-wrapper:focus{border-color:#4096ff!important}.p-wrapper .p-error-hang-out .ant-form-item-explain-error{opacity:0!important;transform:translateY(-10px)!important;max-height:0!important;overflow:hidden!important;transition:none!important}.p-wrapper .ant-form-item-explain-error{opacity:0;transform:translateY(-10px);max-height:0;overflow:hidden;transition:opacity .3s ease-out .3s,transform .3s ease-out .3s,max-height .3s ease-out .3s}.p-wrapper .ant-form-item-has-error .ant-form-item-explain-error{opacity:1;transform:translateY(0);max-height:100px}.p-wrapper .p-toolbar-wrapper{box-shadow:0 8px #fff;border-radius:.5em .5em 0 0;margin-bottom:-.5em}.p-wrapper .ant-form .ant-form-item{margin-bottom:0}.p-wrapper .ant-form .ant-form-item.p-required .ant-form-item-label>label:before{display:inline-block;margin-inline-end:4px;color:#ff4d4f;font-size:14px;font-family:SimSun,sans-serif;line-height:1;content:"*"}.p-wrapper .ant-form .ant-form-item .ant-form-item-label{display:flex;align-items:start;justify-content:flex-end}.p-wrapper .ant-form .ant-form-item .ant-form-item-label>label{white-space:break-spaces;align-items:flex-start;height:fit-content;padding-top:.36em}.p-wrapper .ant-form .ant-form-item .ant-form-item-label>label:after{padding-left:4px;margin-inline-start:unset}.p-wrapper .ant-form.ant-form-vertical .ant-form-item .ant-form-item-label{justify-content:flex-start;font-weight:600}.p-wrapper .ant-table-sticky-scroll{visibility:hidden}.p-wrapper .ant-table-header.ant-table-sticky-holder:before{content:"";width:100%;position:absolute;height:22px;display:block;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);top:-16px}.p-wrapper .ant-table-wrapper .ant-table-pagination.ant-pagination{margin:unset;padding:16px 0}.p-wrapper .p-inner-scroll>.ant-table-wrapper{height:100%}.p-wrapper .p-inner-scroll>.ant-table-wrapper>.ant-spin-nested-loading{height:100%}.p-wrapper .p-inner-scroll>.ant-table-wrapper>.ant-spin-nested-loading>.ant-spin-container{height:100%;display:flex;flex-direction:column}.p-wrapper .p-inner-scroll>.ant-table-wrapper>.ant-spin-nested-loading>.ant-spin-container>.ant-table{border-radius:unset}.p-wrapper .ant-pagination-options .ant-select{width:100px}.p-error-group-tab{position:relative;overflow:visible;color:#f5222d!important}.p-error-group-tab:after{content:"🏷️";position:absolute;top:-1em;right:0;width:1em;height:1em;font-size:.8em;animation:heartbeat 2s infinite}.p-error-hang-out .ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(.ant-input-affix-wrapper-borderless).ant-input-affix-wrapper{border-color:#d9d9d9!important}.p-error-hang-out .ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(.ant-input-affix-wrapper-borderless).ant-input-affix-wrapper:focus{border-color:#4096ff!important}.p-error-hang-out .ant-form-item-explain-error{display:none}.no-error-border{border-color:#d9d9d9!important}.no-error-border:focus{border-color:#4096ff!important}.p-content-align-right.ant-form-item .ant-form-item-control-input-content{display:flex;justify-content:flex-end;align-items:center;text-align:right}.p-content-align-center.ant-form-item .ant-form-item-control-input-content{display:flex;justify-content:center;align-items:center;text-align:center}@keyframes heartbeat{0%{transform:scale(1)}6%{transform:scale(1.22)}12%{transform:scale(1)}18%{transform:scale(1.18)}24%{transform:scale(1)}48%{transform:scale(1)}54%{transform:scale(1.22)}60%{transform:scale(1)}66%{transform:scale(1.18)}72%{transform:scale(1)}to{transform:scale(1)}}
@@ -0,0 +1,301 @@
1
+ @import 'variables';
2
+
3
+ .p-pane {
4
+ background-color: var(--p-theme-bg);
5
+ padding: 16px;
6
+ border-radius: 4px;
7
+ }
8
+
9
+ //region patch for env without unocss/tailwind/windicss
10
+ .w-full {
11
+ width: 100%;
12
+ }
13
+
14
+ .cursor-pointer {
15
+ cursor: pointer;
16
+ }
17
+
18
+ .py-4x {
19
+ padding-top: 4px;
20
+ padding-bottom: 4px;
21
+ }
22
+
23
+ .px-2x {
24
+ padding-left: 2px;
25
+ padding-right: 2px;
26
+ }
27
+ .pl-4x {
28
+ padding-left: 1em;
29
+ }
30
+ .pl-8 {
31
+ padding-left: 2em;
32
+ }
33
+
34
+ .h-0 {
35
+ height: 0;
36
+ }
37
+
38
+ .h-full {
39
+ height: 100%;
40
+ }
41
+
42
+ .flex {
43
+ display: flex;
44
+ }
45
+
46
+ .flex-col {
47
+ flex-direction: column;
48
+ }
49
+
50
+ .flex-1 {
51
+ flex: 1;
52
+ }
53
+
54
+ .items-center {
55
+ align-items: center;
56
+ }
57
+
58
+ .justify-between {
59
+ justify-content: space-between;
60
+ }
61
+
62
+ .gap-4px {
63
+ gap: 4px;
64
+ }
65
+
66
+ .gap-8px {
67
+ gap: 8px;
68
+ }
69
+
70
+ .pt-8px {
71
+ padding-top: 8px;
72
+ }
73
+
74
+ .px-16px {
75
+ padding-left: 16px;
76
+ padding-right: 16px;
77
+ }
78
+
79
+ .mt-4px {
80
+ margin-top: 4px;
81
+ }
82
+
83
+ .text-right {
84
+ text-align: right;
85
+ }
86
+
87
+ .overflow-y-auto {
88
+ overflow-y: auto;
89
+ }
90
+
91
+ //endregion
92
+
93
+ //region P family styles
94
+ .p-theme-bg {
95
+ background-color: var(--p-theme-bg);
96
+ }
97
+
98
+ .p-wrapper {
99
+ .p-form-wrapper {
100
+ z-index: 4;
101
+ }
102
+ .p-error-hang-out {
103
+ .ant-input-affix-wrapper-status-error:not(
104
+ .ant-input-affix-wrapper-disabled
105
+ ):not(.ant-input-affix-wrapper-borderless).ant-input-affix-wrapper {
106
+ border-color: #d9d9d9 !important;
107
+
108
+ &:focus {
109
+ border-color: #4096ff !important;
110
+ }
111
+ }
112
+ .ant-form-item-explain-error {
113
+ opacity: 0 !important;
114
+ transform: translateY(-10px) !important;
115
+ max-height: 0 !important;
116
+ overflow: hidden !important;
117
+ transition: none !important;
118
+ }
119
+ }
120
+ .ant-form-item-explain-error {
121
+ opacity: 0;
122
+ transform: translateY(-10px);
123
+ max-height: 0;
124
+ overflow: hidden;
125
+ transition: opacity 0.3s ease-out 0.3s, transform 0.3s ease-out 0.3s,
126
+ max-height 0.3s ease-out 0.3s;
127
+ }
128
+ .ant-form-item-has-error .ant-form-item-explain-error {
129
+ opacity: 1;
130
+ transform: translateY(0);
131
+ max-height: 100px;
132
+ }
133
+ .p-toolbar-wrapper {
134
+ box-shadow: 0 8px #fff;
135
+ border-radius: 0.5em 0.5em 0 0;
136
+ margin-bottom: -0.5em;
137
+ }
138
+
139
+ .ant-form {
140
+ .ant-form-item {
141
+ margin-bottom: 0;
142
+
143
+ &.p-required {
144
+ .ant-form-item-label > label:before {
145
+ display: inline-block;
146
+ margin-inline-end: 4px;
147
+ color: #ff4d4f;
148
+ font-size: 14px;
149
+ font-family: SimSun, sans-serif;
150
+ line-height: 1;
151
+ content: '*';
152
+ }
153
+ }
154
+
155
+ .ant-form-item-label {
156
+ display: flex;
157
+ align-items: start;
158
+ justify-content: flex-end;
159
+
160
+ & > label {
161
+ white-space: break-spaces;
162
+ align-items: flex-start;
163
+ height: fit-content;
164
+ padding-top: 0.36em;
165
+
166
+ &:after {
167
+ padding-left: 4px;
168
+ margin-inline-start: unset;
169
+ }
170
+ }
171
+ }
172
+ }
173
+
174
+ &.ant-form-vertical {
175
+ .ant-form-item {
176
+ .ant-form-item-label {
177
+ justify-content: flex-start;
178
+ font-weight: 600;
179
+ }
180
+ }
181
+ }
182
+ }
183
+
184
+ .ant-table-sticky-scroll {
185
+ visibility: hidden;
186
+ }
187
+
188
+ .ant-table-header.ant-table-sticky-holder {
189
+ //overflow: unset !important;
190
+
191
+ &:before {
192
+ content: '';
193
+ width: 100%;
194
+ position: absolute;
195
+ height: 22px;
196
+ display: block;
197
+ backdrop-filter: blur(2px);
198
+ top: -16px;
199
+ }
200
+ }
201
+
202
+ .ant-table-wrapper .ant-table-pagination.ant-pagination {
203
+ margin: unset;
204
+ padding: 16px 0;
205
+ }
206
+
207
+ .p-inner-scroll {
208
+ & > .ant-table-wrapper {
209
+ height: 100%;
210
+
211
+ & > .ant-spin-nested-loading {
212
+ height: 100%;
213
+
214
+ & > .ant-spin-container {
215
+ height: 100%;
216
+ display: flex;
217
+ flex-direction: column;
218
+
219
+ & > .ant-table {
220
+ //flex: 1;
221
+ //height: 0;
222
+ //overflow: auto;
223
+ /*border-radius: unset; 修复模糊问题 according to https://stackoverflow.com/questions/49349337/chrome-text-blur-with-overflow-yscroll-and-fixed-height*/
224
+ border-radius: unset;
225
+ }
226
+ }
227
+ }
228
+ }
229
+ }
230
+
231
+ .ant-pagination-options {
232
+ .ant-select {
233
+ width: 100px;
234
+ }
235
+ }
236
+ }
237
+ .p-error-group-tab{
238
+ position:relative;
239
+ overflow: visible;
240
+ color:#f5222d!important;
241
+ &:after{
242
+ content:'🏷️';
243
+ position:absolute;
244
+ top:-1em;
245
+ right:0;
246
+ width:1em;
247
+ height:1em;
248
+ font-size:0.8em;
249
+ animation: heartbeat 2s infinite;
250
+ }
251
+ }
252
+ .p-error-hang-out {
253
+ .ant-input-affix-wrapper-status-error:not(
254
+ .ant-input-affix-wrapper-disabled
255
+ ):not(.ant-input-affix-wrapper-borderless).ant-input-affix-wrapper {
256
+ border-color: #d9d9d9 !important;
257
+
258
+ &:focus {
259
+ border-color: #4096ff !important;
260
+ }
261
+ }
262
+ .ant-form-item-explain-error {
263
+ display: none;
264
+ }
265
+ }
266
+ .no-error-border {
267
+ border-color: #d9d9d9 !important;
268
+
269
+ &:focus {
270
+ border-color: #4096ff !important;
271
+ }
272
+ }
273
+ //endregion
274
+
275
+ @each $align in right center {
276
+ /**/
277
+ .p-content-align-#{$align}.ant-form-item .ant-form-item-control-input-content {
278
+ display: flex;
279
+ @if $align == right {
280
+ justify-content: flex-end;
281
+ } @else {
282
+ justify-content: center;
283
+ }
284
+ align-items: center;
285
+ text-align: #{$align};
286
+ }
287
+ }
288
+
289
+ @keyframes heartbeat {
290
+ 0% { transform: scale(1); }
291
+ 6% { transform: scale(1.22); }
292
+ 12% { transform: scale(1); }
293
+ 18% { transform: scale(1.18); }
294
+ 24% { transform: scale(1); }
295
+ 48% { transform: scale(1); } // 长停顿
296
+ 54% { transform: scale(1.22); }
297
+ 60% { transform: scale(1); }
298
+ 66% { transform: scale(1.18); }
299
+ 72% { transform: scale(1); }
300
+ 100% { transform: scale(1); } // 长停顿
301
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --p-theme-bg: #fff;
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-ui-kit/ant",
3
- "version": "1.8.0",
3
+ "version": "1.8.3",
4
4
  "description": "Vue3 UI Kit based on Ant Design",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -10,7 +10,8 @@
10
10
  "import": "./dist/es/index.js",
11
11
  "types": "./dist/index.d.ts"
12
12
  },
13
- "./scss": "./src/packages/styles/index.scss"
13
+ "./style.css": "./dist/style.css",
14
+ "./style.scss": "./dist/style.scss"
14
15
  },
15
16
  "files": [
16
17
  "dist",
@@ -203,6 +203,8 @@ export type PGridProps<D = Recordable, F = Recordable> = {
203
203
  proxyConfig?: ProxyConfig<D, F>;
204
204
  tableConfig?: TableProps<D>;
205
205
  scrollMode?: 'outer' | 'inner';
206
+ // 重置后不自动提交
207
+ lazyReset?: boolean;
206
208
  /**
207
209
  * 适应展示区到页面顶部的高度,通常和容器最上的y值有关(正比)
208
210
  */
package/src/index.ts CHANGED
@@ -6,8 +6,16 @@ import PGroupBlock from '@/components/PGroupBlock.vue';
6
6
  import PromisePicker from '@/components/PromisePicker.vue';
7
7
  import { addFormatter } from '@/utils/AFormatters';
8
8
  import { addRender } from '@/store/renderStore';
9
+ import { setUIKitConfig, getUIKitConfig, resetUIKitConfig, UIKitConfig } from '@/utils/config';
9
10
  import * as utils from '@/utils/core';
10
11
 
12
+ // 创建setup方法
13
+ function setup(config?: Partial<UIKitConfig>) {
14
+ if (config) {
15
+ setUIKitConfig(config);
16
+ }
17
+ }
18
+
11
19
  export default {
12
20
  install(app: App) {
13
21
  app.component('PForm', PForm);
@@ -19,7 +27,15 @@ export default {
19
27
  },
20
28
  addFormatter,
21
29
  addRender,
30
+ setup,
22
31
  };
23
32
 
24
33
  export * from '#/antProxy';
25
34
  export * from '@/utils/core';
35
+ export {
36
+ setup,
37
+ setUIKitConfig,
38
+ getUIKitConfig,
39
+ resetUIKitConfig,
40
+ type UIKitConfig
41
+ };
@@ -5,6 +5,7 @@
5
5
  import { v4 as uuid_v4 } from 'uuid';
6
6
  import { isGoodValue } from '@/utils/is';
7
7
  import { eachTree } from '@/utils/treeHelper';
8
+ import { getFormDefaults } from '@/utils/config';
8
9
  import PFormCol from '@/components/PFormCol.vue';
9
10
  import {
10
11
  Form as AForm,
@@ -13,6 +14,15 @@
13
14
 
14
15
  const props = defineProps<PFormProps<F> & { data: F }>();
15
16
  const emit = defineEmits(['apply', 'reset']);
17
+
18
+ // 应用默认值
19
+ const formDefaults = getFormDefaults();
20
+ const propsWithDefaults = computed(() => ({
21
+ ...props,
22
+ labelCol: props.labelCol ?? formDefaults.labelCol ?? { span: 6 },
23
+ wrapperCol: props.wrapperCol ?? formDefaults.wrapperCol ?? { span: 16 },
24
+ }));
25
+
16
26
  const { items, data: formData } = toRefs(props);
17
27
 
18
28
  function handleSubmit() {
@@ -52,9 +62,9 @@
52
62
  };
53
63
  // omit({labelCol:defaultLabelCol,...props},['items','data','model'])
54
64
  const fc = computed(() => ({
55
- ...omit(props, ['items', 'data', 'model', 'labelCol', 'wrapperCol']),
56
- labelCol: props.labelCol ?? { span: 6 },
57
- wrapperCol: props.wrapperCol ?? { span: 16 },
65
+ ...omit(propsWithDefaults.value, ['items', 'data', 'model', 'labelCol', 'wrapperCol']),
66
+ labelCol: propsWithDefaults.value.labelCol,
67
+ wrapperCol: propsWithDefaults.value.wrapperCol,
58
68
  }));
59
69
  const validateField = (fields?: string | string[]) => {
60
70
  if (fields) {
@@ -64,12 +74,7 @@
64
74
  const handleTrigger = (cusFields?: string | string[]) => {
65
75
  validateField(cusFields);
66
76
  };
67
- const handleDelayTrigger = (cusFields?: string | string[], time?: number) => {
68
- const delayTime = time ?? 222;
69
- setTimeout(() => {
70
- validateField(cusFields);
71
- }, delayTime);
72
- };
77
+
73
78
  defineExpose({
74
79
  reset: resetForm,
75
80
  $form: computed(() => formEl.value),
@@ -87,7 +92,6 @@
87
92
  :key="`_col_${idx}`"
88
93
  :form-data="formData"
89
94
  :item="item"
90
- @delay-trigger="handleDelayTrigger"
91
95
  @reset="resetFormData"
92
96
  @trigger="handleTrigger"
93
97
  />
@@ -13,13 +13,18 @@ const props = defineProps<{
13
13
  formData: T
14
14
  }>()
15
15
  const emit = defineEmits<{
16
- (e: 'delayTrigger', cusFields?: string | string[], time?: number): void
17
16
  (e: 'trigger', cusFields?: string | string[]): void
18
17
  (e: 'reset'): void
19
18
  }>()
19
+ const hangOut = ref(false)
20
20
  const renderFormKey = ref(uuid_v4())
21
21
  const handleDelayTrigger = (cusFields?: string | string[], time?: number) => {
22
- emit('delayTrigger', cusFields, time)
22
+ const delayTime = time ?? 222
23
+ hangOut.value = true
24
+ setTimeout(() => {
25
+ hangOut.value = false
26
+ emit('trigger', cusFields)
27
+ }, delayTime)
23
28
  }
24
29
  const handleTrigger = (cusFields?: string | string[]) => {
25
30
  emit('trigger', cusFields)
@@ -45,7 +50,10 @@ watch(() => props.item, (cur, old) => {
45
50
  >
46
51
  <a-form-item
47
52
  :key="`_item_${renderFormKey}`"
48
- :class="`p-content-align-${item.align ?? 'left'} ${item.forceRequired ? 'p-required' : ''}`"
53
+ :class="[
54
+ `p-content-align-${item.align ?? 'left'} ${item.forceRequired ? 'p-required' : ''}`,
55
+ { 'p-error-hang-out': hangOut },
56
+ ]"
49
57
  colon
50
58
  :label="item.title"
51
59
  :name="item.field"