cnhis-design-vue 3.1.16-beta.5 → 3.1.16-beta.8

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.
Files changed (41) hide show
  1. package/es/packages/button-print/src/ButtonPrint.vue_vue_type_script_setup_true_lang.js +2 -1
  2. package/es/packages/fabric-chart/src/hooks/constant.js +4 -4
  3. package/es/packages/fabric-chart/src/hooks/useCenter.js +20 -23
  4. package/es/packages/fabric-chart/src/hooks/useDraw.js +11 -4
  5. package/es/packages/fabric-chart/src/hooks/useEvent.js +11 -3
  6. package/es/packages/fabric-chart/src/hooks/useLeft.js +8 -4
  7. package/es/packages/fabric-chart/src/hooks/useTop.js +5 -8
  8. package/es/packages/form-config/index.d.ts +38 -24
  9. package/es/packages/form-config/src/FormConfig.vue.d.ts +38 -24
  10. package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +10 -3
  11. package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +15 -8
  12. package/es/packages/form-config/src/hooks/useSortable.d.ts +1 -0
  13. package/es/packages/form-render/index.d.ts +10 -3
  14. package/es/packages/form-render/src/FormRender.js +1 -0
  15. package/es/packages/form-render/src/FormRender.vue.d.ts +11 -4
  16. package/es/packages/form-render/src/components/renderer/cascader.d.ts +2 -14
  17. package/es/packages/form-render/src/components/renderer/cascader.js +2 -2
  18. package/es/packages/form-render/src/components/renderer/date.d.ts +20 -4
  19. package/es/packages/form-render/src/components/renderer/date.js +36 -20
  20. package/es/packages/form-render/src/components/renderer/select.d.ts +1 -10
  21. package/es/packages/form-render/src/components/renderer/select.js +11 -8
  22. package/es/packages/form-render/src/components/renderer/slider.d.ts +8 -344
  23. package/es/packages/form-render/src/components/renderer/slider.js +23 -1
  24. package/es/packages/form-render/src/hooks/useAnchor.js +7 -4
  25. package/es/packages/form-render/src/hooks/useBusinessBinding.d.ts +5 -2
  26. package/es/packages/form-render/src/hooks/useBusinessBinding.js +9 -5
  27. package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +3 -3
  28. package/es/packages/form-render/src/hooks/useFormContext.js +1 -1
  29. package/es/packages/form-render/src/hooks/useFormValidator.js +13 -3
  30. package/es/packages/form-render/src/hooks/useInitialData.d.ts +1 -1
  31. package/es/packages/form-render/src/hooks/useInitialData.js +9 -4
  32. package/es/packages/form-render/src/types/fieldItem.d.ts +11 -12
  33. package/es/packages/form-render/src/types/index.d.ts +7 -0
  34. package/es/packages/form-render/src/utils/business.js +15 -2
  35. package/es/packages/form-render/src/utils/index.d.ts +1 -1
  36. package/es/packages/form-render/src/utils/index.js +5 -2
  37. package/es/packages/form-render/src/utils/schema.d.ts +1 -0
  38. package/es/packages/form-render/src/utils/schema.js +12 -1
  39. package/es/packages/shortcut-setter/index.d.ts +15 -8
  40. package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +15 -8
  41. package/package.json +1 -1
@@ -1,347 +1,11 @@
1
1
  export declare const SLIDER: import("vue").DefineComponent<{
2
- readonly to: {
3
- type: import("vue").PropType<string | boolean | HTMLElement>;
4
- default: undefined;
2
+ value: {
3
+ type: (NumberConstructor | StringConstructor)[];
5
4
  };
6
- readonly defaultValue: {
7
- readonly type: import("vue").PropType<number | number[]>;
8
- readonly default: 0;
5
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
6
+ value: {
7
+ type: (NumberConstructor | StringConstructor)[];
9
8
  };
10
- readonly marks: import("vue").PropType<Record<string, string>>;
11
- readonly disabled: {
12
- readonly type: import("vue").PropType<boolean | undefined>;
13
- readonly default: undefined;
14
- };
15
- readonly formatTooltip: import("vue").PropType<(value: number) => string | number>;
16
- readonly min: {
17
- readonly type: NumberConstructor;
18
- readonly default: 0;
19
- };
20
- readonly max: {
21
- readonly type: NumberConstructor;
22
- readonly default: 100;
23
- };
24
- readonly step: {
25
- readonly type: import("vue").PropType<number | "mark">;
26
- readonly default: 1;
27
- };
28
- readonly range: BooleanConstructor;
29
- readonly value: import("vue").PropType<number | number[]>;
30
- readonly placement: import("vue").PropType<import("naive-ui").PopoverPlacement>;
31
- readonly showTooltip: {
32
- readonly type: import("vue").PropType<boolean | undefined>;
33
- readonly default: undefined;
34
- };
35
- readonly tooltip: {
36
- readonly type: BooleanConstructor;
37
- readonly default: true;
38
- };
39
- readonly vertical: BooleanConstructor;
40
- readonly reverse: BooleanConstructor;
41
- readonly 'onUpdate:value': import("vue").PropType<import("naive-ui/es/_utils").MaybeArray<(value: number & number[]) => void>>;
42
- readonly onUpdateValue: import("vue").PropType<import("naive-ui/es/_utils").MaybeArray<(value: number & number[]) => void>>;
43
- readonly theme: import("vue").PropType<import("naive-ui/es/_mixins").Theme<"Slider", {
44
- fontSize: string;
45
- railColor: string;
46
- railColorHover: string;
47
- fillColor: string;
48
- fillColorHover: string;
49
- opacityDisabled: string;
50
- handleColor: string;
51
- dotColor: string;
52
- dotColorModal: string;
53
- dotColorPopover: string;
54
- handleBoxShadow: string;
55
- handleBoxShadowHover: string;
56
- handleBoxShadowActive: string;
57
- handleBoxShadowFocus: string;
58
- indicatorColor: string;
59
- indicatorBoxShadow: string;
60
- indicatorTextColor: string;
61
- indicatorBorderRadius: string;
62
- dotBorder: string;
63
- dotBorderActive: string;
64
- dotBoxShadow: string;
65
- railHeight: string;
66
- railWidthVertical: string;
67
- handleSize: string;
68
- dotHeight: string;
69
- dotWidth: string;
70
- dotBorderRadius: string;
71
- }, any>>;
72
- readonly themeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Slider", {
73
- fontSize: string;
74
- railColor: string;
75
- railColorHover: string;
76
- fillColor: string;
77
- fillColorHover: string;
78
- opacityDisabled: string;
79
- handleColor: string;
80
- dotColor: string;
81
- dotColorModal: string;
82
- dotColorPopover: string;
83
- handleBoxShadow: string;
84
- handleBoxShadowHover: string;
85
- handleBoxShadowActive: string;
86
- handleBoxShadowFocus: string;
87
- indicatorColor: string;
88
- indicatorBoxShadow: string;
89
- indicatorTextColor: string;
90
- indicatorBorderRadius: string;
91
- dotBorder: string;
92
- dotBorderActive: string;
93
- dotBoxShadow: string;
94
- railHeight: string;
95
- railWidthVertical: string;
96
- handleSize: string;
97
- dotHeight: string;
98
- dotWidth: string;
99
- dotBorderRadius: string;
100
- }, any>>>;
101
- readonly builtinThemeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Slider", {
102
- fontSize: string;
103
- railColor: string;
104
- railColorHover: string;
105
- fillColor: string;
106
- fillColorHover: string;
107
- opacityDisabled: string;
108
- handleColor: string;
109
- dotColor: string;
110
- dotColorModal: string;
111
- dotColorPopover: string;
112
- handleBoxShadow: string;
113
- handleBoxShadowHover: string;
114
- handleBoxShadowActive: string;
115
- handleBoxShadowFocus: string;
116
- indicatorColor: string;
117
- indicatorBoxShadow: string;
118
- indicatorTextColor: string;
119
- indicatorBorderRadius: string;
120
- dotBorder: string;
121
- dotBorderActive: string;
122
- dotBoxShadow: string;
123
- railHeight: string;
124
- railWidthVertical: string;
125
- handleSize: string;
126
- dotHeight: string;
127
- dotWidth: string;
128
- dotBorderRadius: string;
129
- }, any>>>;
130
- }, {
131
- mergedClsPrefix: import("vue").ComputedRef<string>;
132
- namespace: import("vue").ComputedRef<string | undefined>;
133
- uncontrolledValue: import("vue").Ref<number | number[]>;
134
- mergedValue: import("vue").ComputedRef<number | number[]>;
135
- mergedDisabled: import("vue").ComputedRef<boolean>;
136
- mergedPlacement: import("vue").ComputedRef<import("naive-ui").PopoverPlacement>;
137
- isMounted: Readonly<import("vue").Ref<boolean>>;
138
- adjustedTo: import("vue").ComputedRef<string | HTMLElement>;
139
- dotTransitionDisabled: import("vue").Ref<boolean>;
140
- markInfos: import("vue").ComputedRef<{
141
- active: boolean;
142
- label: string;
143
- style: import("vue").CSSProperties;
144
- }[]>;
145
- isShowTooltip: (index: number) => boolean;
146
- shouldKeepTooltipTransition: (index: number) => boolean;
147
- handleRailRef: import("vue").Ref<HTMLElement | null>;
148
- setHandleRefs: (key: number) => (el: any) => void;
149
- setFollowerRefs: (key: number) => (el: any) => void;
150
- fillStyle: import("vue").ComputedRef<{
151
- [x: string]: string;
152
- height: string;
153
- width?: undefined;
154
- } | {
155
- [x: string]: string;
156
- width: string;
157
- height?: undefined;
158
- } | undefined>;
159
- getHandleStyle: (value: number, index: number) => Record<string, any>;
160
- activeIndex: import("vue").Ref<number>;
161
- arrifiedValues: import("vue").ComputedRef<number[]>;
162
- followerEnabledIndexSet: import("vue").Ref<Set<number>>;
163
- handleRailMouseDown: (event: MouseEvent | TouchEvent) => void;
164
- handleHandleFocus: (index: number) => void;
165
- handleHandleBlur: (index: number) => void;
166
- handleHandleMouseEnter: (index: number) => void;
167
- handleHandleMouseLeave: (index: number) => void;
168
- handleRailKeyDown: (e: KeyboardEvent) => void;
169
- indicatorCssVars: import("vue").ComputedRef<{
170
- '--n-font-size': string;
171
- '--n-indicator-border-radius': string;
172
- '--n-indicator-box-shadow': string;
173
- '--n-indicator-color': string;
174
- '--n-indicator-text-color': string;
175
- }> | undefined;
176
- indicatorThemeClass: import("vue").Ref<string> | undefined;
177
- indicatorOnRender: (() => void) | undefined;
178
- cssVars: import("vue").ComputedRef<{
179
- '--n-bezier': string;
180
- '--n-dot-border': string;
181
- '--n-dot-border-active': string;
182
- '--n-dot-border-radius': string;
183
- '--n-dot-box-shadow': string;
184
- '--n-dot-color': string;
185
- '--n-dot-color-modal': string;
186
- '--n-dot-color-popover': string;
187
- '--n-dot-height': string;
188
- '--n-dot-width': string;
189
- '--n-fill-color': string;
190
- '--n-fill-color-hover': string;
191
- '--n-font-size': string;
192
- '--n-handle-box-shadow': string;
193
- '--n-handle-box-shadow-active': string;
194
- '--n-handle-box-shadow-focus': string;
195
- '--n-handle-box-shadow-hover': string;
196
- '--n-handle-color': string;
197
- '--n-handle-size': string;
198
- '--n-opacity-disabled': string;
199
- '--n-rail-color': string;
200
- '--n-rail-color-hover': string;
201
- '--n-rail-height': string;
202
- '--n-rail-width-vertical': string;
203
- }> | undefined;
204
- themeClass: import("vue").Ref<string> | undefined;
205
- onRender: (() => void) | undefined;
206
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
207
- readonly to: {
208
- type: import("vue").PropType<string | boolean | HTMLElement>;
209
- default: undefined;
210
- };
211
- readonly defaultValue: {
212
- readonly type: import("vue").PropType<number | number[]>;
213
- readonly default: 0;
214
- };
215
- readonly marks: import("vue").PropType<Record<string, string>>;
216
- readonly disabled: {
217
- readonly type: import("vue").PropType<boolean | undefined>;
218
- readonly default: undefined;
219
- };
220
- readonly formatTooltip: import("vue").PropType<(value: number) => string | number>;
221
- readonly min: {
222
- readonly type: NumberConstructor;
223
- readonly default: 0;
224
- };
225
- readonly max: {
226
- readonly type: NumberConstructor;
227
- readonly default: 100;
228
- };
229
- readonly step: {
230
- readonly type: import("vue").PropType<number | "mark">;
231
- readonly default: 1;
232
- };
233
- readonly range: BooleanConstructor;
234
- readonly value: import("vue").PropType<number | number[]>;
235
- readonly placement: import("vue").PropType<import("naive-ui").PopoverPlacement>;
236
- readonly showTooltip: {
237
- readonly type: import("vue").PropType<boolean | undefined>;
238
- readonly default: undefined;
239
- };
240
- readonly tooltip: {
241
- readonly type: BooleanConstructor;
242
- readonly default: true;
243
- };
244
- readonly vertical: BooleanConstructor;
245
- readonly reverse: BooleanConstructor;
246
- readonly 'onUpdate:value': import("vue").PropType<import("naive-ui/es/_utils").MaybeArray<(value: number & number[]) => void>>;
247
- readonly onUpdateValue: import("vue").PropType<import("naive-ui/es/_utils").MaybeArray<(value: number & number[]) => void>>;
248
- readonly theme: import("vue").PropType<import("naive-ui/es/_mixins").Theme<"Slider", {
249
- fontSize: string;
250
- railColor: string;
251
- railColorHover: string;
252
- fillColor: string;
253
- fillColorHover: string;
254
- opacityDisabled: string;
255
- handleColor: string;
256
- dotColor: string;
257
- dotColorModal: string;
258
- dotColorPopover: string;
259
- handleBoxShadow: string;
260
- handleBoxShadowHover: string;
261
- handleBoxShadowActive: string;
262
- handleBoxShadowFocus: string;
263
- indicatorColor: string;
264
- indicatorBoxShadow: string;
265
- indicatorTextColor: string;
266
- indicatorBorderRadius: string;
267
- dotBorder: string;
268
- dotBorderActive: string;
269
- dotBoxShadow: string;
270
- railHeight: string;
271
- railWidthVertical: string;
272
- handleSize: string;
273
- dotHeight: string;
274
- dotWidth: string;
275
- dotBorderRadius: string;
276
- }, any>>;
277
- readonly themeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Slider", {
278
- fontSize: string;
279
- railColor: string;
280
- railColorHover: string;
281
- fillColor: string;
282
- fillColorHover: string;
283
- opacityDisabled: string;
284
- handleColor: string;
285
- dotColor: string;
286
- dotColorModal: string;
287
- dotColorPopover: string;
288
- handleBoxShadow: string;
289
- handleBoxShadowHover: string;
290
- handleBoxShadowActive: string;
291
- handleBoxShadowFocus: string;
292
- indicatorColor: string;
293
- indicatorBoxShadow: string;
294
- indicatorTextColor: string;
295
- indicatorBorderRadius: string;
296
- dotBorder: string;
297
- dotBorderActive: string;
298
- dotBoxShadow: string;
299
- railHeight: string;
300
- railWidthVertical: string;
301
- handleSize: string;
302
- dotHeight: string;
303
- dotWidth: string;
304
- dotBorderRadius: string;
305
- }, any>>>;
306
- readonly builtinThemeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Slider", {
307
- fontSize: string;
308
- railColor: string;
309
- railColorHover: string;
310
- fillColor: string;
311
- fillColorHover: string;
312
- opacityDisabled: string;
313
- handleColor: string;
314
- dotColor: string;
315
- dotColorModal: string;
316
- dotColorPopover: string;
317
- handleBoxShadow: string;
318
- handleBoxShadowHover: string;
319
- handleBoxShadowActive: string;
320
- handleBoxShadowFocus: string;
321
- indicatorColor: string;
322
- indicatorBoxShadow: string;
323
- indicatorTextColor: string;
324
- indicatorBorderRadius: string;
325
- dotBorder: string;
326
- dotBorderActive: string;
327
- dotBoxShadow: string;
328
- railHeight: string;
329
- railWidthVertical: string;
330
- handleSize: string;
331
- dotHeight: string;
332
- dotWidth: string;
333
- dotBorderRadius: string;
334
- }, any>>>;
335
- }>>, {
336
- readonly range: boolean;
337
- readonly reverse: boolean;
338
- readonly vertical: boolean;
339
- readonly tooltip: boolean;
340
- readonly disabled: boolean | undefined;
341
- readonly step: number | "mark";
342
- readonly max: number;
343
- readonly min: number;
344
- readonly to: string | boolean | HTMLElement;
345
- readonly defaultValue: number | number[];
346
- readonly showTooltip: boolean | undefined;
347
- }>;
9
+ }>> & {
10
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
11
+ }, {}>;
@@ -1,8 +1,30 @@
1
+ import { defineComponent, computed, createVNode } from 'vue';
1
2
  import { connect, mapProps } from '@formily/vue';
2
3
  import { NSlider } from 'naive-ui';
4
+ import { parseNumberFromMaybeString } from '../../utils/index.js';
3
5
  import { assignUpdateValue } from '../../utils/schema.js';
4
6
 
5
- const SLIDER = connect(NSlider, mapProps((props, field) => {
7
+ const script = defineComponent({
8
+ props: {
9
+ value: {
10
+ type: [Number, String]
11
+ }
12
+ },
13
+ emits: ["update:value"],
14
+ setup(props, {
15
+ emit
16
+ }) {
17
+ const valueRef = computed({
18
+ get: () => parseNumberFromMaybeString(props.value),
19
+ set: (v) => emit("update:value", v)
20
+ });
21
+ return () => createVNode(NSlider, {
22
+ "value": valueRef.value,
23
+ "onUpdate:value": ($event) => valueRef.value = $event
24
+ }, null);
25
+ }
26
+ });
27
+ const SLIDER = connect(script, mapProps((props, field) => {
6
28
  const _props = assignUpdateValue(props, field);
7
29
  if (Array.isArray(_props.option)) {
8
30
  _props.marks = _props.option.reduce((fin, option) => {
@@ -37,7 +37,7 @@ function useAnchor(props, scrollbarRef, collector) {
37
37
  doAnimation(scrollbarRef.value.scrollTop, targetAnchor.offsetTop, 300, (top) => {
38
38
  var _a;
39
39
  (_a = scrollbarRef.value) == null ? void 0 : _a.scrollTo({ top });
40
- }, "easeInSine", resolve);
40
+ }, "easeInSine", () => setTimeout(resolve, 300));
41
41
  });
42
42
  } finally {
43
43
  scrollLock = false;
@@ -48,11 +48,14 @@ function useAnchor(props, scrollbarRef, collector) {
48
48
  if (scrollLock || !scrollbarRef.value)
49
49
  return;
50
50
  const { scrollTop, clientHeight } = scrollbarRef.value;
51
- const result = anchorIdList.value.find((anchor) => {
52
- const node = scrollbarRef.value.querySelector(`#${createLinebarId(anchor.name)}`);
51
+ const result = anchorIdList.value.find((anchor, idx, arr) => {
52
+ const nextAnchor = arr[idx + 1];
53
+ if (!nextAnchor)
54
+ return true;
55
+ const node = scrollbarRef.value.querySelector(`#${createLinebarId(nextAnchor.name)}`);
53
56
  if (!node)
54
57
  return;
55
- return node.offsetTop >= scrollTop || node.offsetTop < scrollTop && node.clientHeight + node.offsetTop > scrollTop + clientHeight;
58
+ return node.offsetTop > scrollTop + clientHeight / 2;
56
59
  }) || anchorIdList.value[anchorIdList.value.length - 1];
57
60
  __currentAnchor.value = (_a = result == null ? void 0 : result.name) != null ? _a : "";
58
61
  }, 300);
@@ -1,10 +1,13 @@
1
1
  import { Form } from '@formily/core';
2
+ import { FormBusinessFormatter } from '../../../../../es/packages/form-render';
2
3
  import { FIELD_BUSINESS_TYPE } from '../constants';
3
4
  export declare class BusinessCollector {
4
5
  private formModel;
6
+ private businessFormatter?;
5
7
  private readonly typeCollector;
6
8
  private readonly fieldNameCollector;
7
- constructor(formModel: Form);
9
+ constructor(formModel: Form, businessFormatter?: FormBusinessFormatter | undefined);
10
+ private formatter;
8
11
  collect(type: FIELD_BUSINESS_TYPE, fieldName: string): void;
9
12
  private getField;
10
13
  private getType;
@@ -19,5 +22,5 @@ export declare class BusinessCollector {
19
22
  trigger(fieldName: string, triggerType?: 'change' | 'blur'): void;
20
23
  }
21
24
  export declare function useBusinessBinding(): {
22
- create: (formModel: Form) => BusinessCollector;
25
+ create: (formModel: Form, formatter?: FormBusinessFormatter) => BusinessCollector;
23
26
  };
@@ -1,12 +1,13 @@
1
1
  import { isField } from '@formily/core';
2
2
  import { isString } from '@vueuse/core';
3
- import { isNumber } from 'lodash-es';
3
+ import { isFunction, isNumber } from 'lodash-es';
4
4
  import { FIELD_BUSINESS_TYPE } from '../constants/index.js';
5
5
  import { isIdCard, parseIdCard, parseAge2FromContext, parseBirthday, parseAge2Birthday } from '../utils/business.js';
6
6
 
7
7
  class BusinessCollector {
8
- constructor(formModel) {
8
+ constructor(formModel, businessFormatter) {
9
9
  this.formModel = formModel;
10
+ this.businessFormatter = businessFormatter;
10
11
  this.typeCollector = /* @__PURE__ */ new Map();
11
12
  this.fieldNameCollector = /* @__PURE__ */ new Map();
12
13
  this.handlerChangeMap = /* @__PURE__ */ new Map([
@@ -18,6 +19,9 @@ class BusinessCollector {
18
19
  [FIELD_BUSINESS_TYPE.AGE, this.handlerAgeType.bind(this)]
19
20
  ]);
20
21
  }
22
+ formatter(...args) {
23
+ return isFunction(this.businessFormatter) ? this.businessFormatter(...args) : args[0].value;
24
+ }
21
25
  collect(type, fieldName) {
22
26
  this.typeCollector.set(type, fieldName);
23
27
  this.fieldNameCollector.set(fieldName, type);
@@ -41,7 +45,7 @@ class BusinessCollector {
41
45
  field && this.formModel.setFieldState(field, (state) => {
42
46
  if (!force && state.value)
43
47
  return;
44
- state.value = value;
48
+ state.value = this.formatter({ value, type, fieldKey: field });
45
49
  });
46
50
  }
47
51
  handlerIdCardType() {
@@ -80,8 +84,8 @@ class BusinessCollector {
80
84
  }
81
85
  }
82
86
  function useBusinessBinding() {
83
- function create(formModel) {
84
- return new BusinessCollector(formModel);
87
+ function create(formModel, formatter) {
88
+ return new BusinessCollector(formModel, formatter);
85
89
  }
86
90
  return { create };
87
91
  }
@@ -128,9 +128,9 @@ function useFieldListAdaptor(collector, uuid) {
128
128
  const createSliderSchema = (item) => {
129
129
  const schema = createStandardSchema(item);
130
130
  Object.assign(schema["x-component-props"], {
131
- step: Number(item.step_length),
132
- max: +item.max_length,
133
- min: +item.min_length,
131
+ step: parseNumberFromMaybeString(item.step_length),
132
+ max: parseNumberFromMaybeString(item.max_length),
133
+ min: parseNumberFromMaybeString(item.min_length),
134
134
  option: item.option
135
135
  });
136
136
  return schema;
@@ -34,7 +34,7 @@ function useFormContext(props, formModel) {
34
34
  },
35
35
  scope: Object.assign({}, usePresetScope(), props.scope)
36
36
  }).SchemaField);
37
- const businessCollector = useBusinessBinding().create(formModel);
37
+ const businessCollector = useBusinessBinding().create(formModel, props.businessFormatter);
38
38
  provide(InjectionBusinessCollector, businessCollector);
39
39
  const changeContextCollector = useChangeContext().create();
40
40
  provide(InjectionChangeContextCollector, changeContextCollector);
@@ -1,16 +1,26 @@
1
+ import { isString } from 'lodash-es';
1
2
  import { arrayed } from '../utils/index.js';
2
3
  import { isFunction } from '@vueuse/core';
4
+ import { isIdCard } from '../utils/business.js';
3
5
 
4
6
  function useFormValidator() {
5
7
  const validateMap = /* @__PURE__ */ new Map([
6
8
  ["mobile", ({ validate }) => ({ format: "phone", message: validate == null ? void 0 : validate.message })],
7
9
  ["integer", ({ validate }) => ({ format: "integer", message: validate == null ? void 0 : validate.message })],
8
10
  ["number", ({ validate }) => ({ format: "number", message: validate == null ? void 0 : validate.message })],
9
- ["id_card", ({ validate }) => ({ format: "idcard", message: validate == null ? void 0 : validate.message })],
11
+ [
12
+ "id_card",
13
+ ({ validate }) => ({
14
+ validator(value) {
15
+ var _a;
16
+ if (!isString(value) || !isIdCard(value))
17
+ return (_a = validate == null ? void 0 : validate.message) != null ? _a : "\u8BE5\u5B57\u6BB5\u4E0D\u662F\u5408\u6CD5\u7684\u8EAB\u4EFD\u8BC1\u683C\u5F0F";
18
+ }
19
+ })
20
+ ],
10
21
  [
11
22
  "regular",
12
- (field) => {
13
- const { validate, regular_expression, regular_error_tip } = field;
23
+ ({ validate, regular_expression, regular_error_tip }) => {
14
24
  const pattern = regular_expression || (validate == null ? void 0 : validate.regular_expression) || "";
15
25
  const message = regular_error_tip || (validate == null ? void 0 : validate.regular_error_tip) || (validate == null ? void 0 : validate.message) || "\u683C\u5F0F\u9519\u8BEF";
16
26
  return { pattern, message };
@@ -1,5 +1,5 @@
1
1
  import { AnyObject } from '../../../../../es/src/types';
2
2
  import { FieldItem } from '../types';
3
3
  export declare function useInitialData(): {
4
- assignInitialData: (initialData?: AnyObject, fieldList?: FieldItem[]) => AnyObject;
4
+ assignInitialData: (initialData?: AnyObject, fieldList?: FieldItem[]) => any;
5
5
  };
@@ -1,9 +1,14 @@
1
+ import { Path } from '@formily/path';
2
+ import { mergeWith } from 'lodash-es';
3
+ import { traverseFieldList } from '../../../../packages/form-render/src/utils';
4
+
1
5
  function useInitialData() {
2
6
  function assignInitialData(initialData, fieldList) {
3
- return Object.assign({}, initialData, fieldList == null ? void 0 : fieldList.reduce((fin, cur) => {
4
- cur.default_val != void 0 && (fin[cur.val_key] = cur.default_val);
5
- return fin;
6
- }, {}));
7
+ const defaultVal = {};
8
+ fieldList && traverseFieldList(fieldList, (field) => {
9
+ field.default_val != void 0 && Path.setIn(defaultVal, field.val_key, field.default_val);
10
+ });
11
+ return mergeWith({}, initialData, defaultVal);
7
12
  }
8
13
  return { assignInitialData };
9
14
  }
@@ -1,7 +1,7 @@
1
1
  import { AnyObject, ArrayAble } from '../../../../../es/src/types';
2
2
  import { SchemaTypes } from '@formily/vue';
3
3
  import { CSSProperties, VNode } from 'vue';
4
- import { DependKeyType, FormCommonState } from '../../../../../es/packages/form-render';
4
+ import { DependKeyType, FormCommonState, FormRequestType } from '../../../../../es/packages/form-render';
5
5
  declare type FieldBusinessType = 'password' | 'id_card' | 'age' | 'age_unit' | 'mobile' | 'telephone' | 'email' | 'sex' | 'birthday' | 'bank_card' | 'website' | 'gestational_weeks' | 'gestational_stage' | 'customer_name';
6
6
  export declare type ValidateItem = Partial<{
7
7
  /**
@@ -36,6 +36,15 @@ interface FormRendererPayload {
36
36
  export interface FormRenderer {
37
37
  (payload: FormRendererPayload): ArrayAble<VNode> | any;
38
38
  }
39
+ export declare type UrlConfig = {
40
+ url: string;
41
+ } & Partial<{
42
+ method?: FormRequestType;
43
+ nameKey?: string;
44
+ valueKey?: string;
45
+ params?: AnyObject;
46
+ dependKey?: DependKeyType;
47
+ }>;
39
48
  interface SwitchProperty {
40
49
  value?: any;
41
50
  describe?: string;
@@ -141,17 +150,7 @@ export declare type FieldItem = {
141
150
  * slider控件间距
142
151
  */
143
152
  step_length: string | number;
144
- urlConfig: Partial<{
145
- url: string;
146
- method: 'post' | 'get' | 'put' | 'patch' | 'delete';
147
- /**
148
- * 请求参数依赖关系
149
- */
150
- dependKey: DependKeyType;
151
- params: AnyObject;
152
- nameKey: string;
153
- valueKey: string;
154
- }>;
153
+ urlConfig: UrlConfig;
155
154
  /**
156
155
  * 控件组
157
156
  */
@@ -2,6 +2,7 @@ import { AnyObject, WithUndefined } from '../../../../../es/src/types';
2
2
  import { DataField, Field } from '@formily/core';
3
3
  import { ISchema } from '@formily/json-schema/esm/types';
4
4
  import { Component, FunctionalComponent } from 'vue';
5
+ import { FIELD_BUSINESS_TYPE } from '../../../../../es/packages/form-render/src/constants';
5
6
  import { FieldItem } from '../types';
6
7
  import { AsyncQueue } from '../hooks';
7
8
  export * from './fieldItem';
@@ -69,4 +70,10 @@ export declare type FormRenderProps = Partial<{
69
70
  consumer: boolean;
70
71
  uuid: string;
71
72
  lifeCycle: FormRenderLifeCycle;
73
+ businessFormatter: FormBusinessFormatter;
72
74
  }>;
75
+ export declare type FormBusinessFormatter = (payload: {
76
+ fieldKey: string;
77
+ value: unknown;
78
+ type: FIELD_BUSINESS_TYPE;
79
+ }) => unknown;
@@ -9,7 +9,7 @@ function parseIdCard(idCardNo) {
9
9
  const year = (birthYearSpan == 2 ? "19" : "") + certificateNo.substr(6, birthYearSpan);
10
10
  const month = certificateNo.substr(6 + birthYearSpan, 2);
11
11
  const day = certificateNo.substr(8 + birthYearSpan, 2);
12
- res.birthday = year + "-" + month + "-" + day;
12
+ res.birthday = year + "-" + month + "-" + day + " 00:00:00";
13
13
  const d = new Date();
14
14
  const monthFloor = d.getMonth() + 1 < parseInt(month, 10) || d.getMonth() + 1 == parseInt(month, 10) && d.getDate() < parseInt(day, 10) ? 1 : 0;
15
15
  Object.assign(res, parseBirthday(res.birthday));
@@ -26,8 +26,21 @@ function transformDateFormat(format2 = "") {
26
26
  return "month";
27
27
  return format2.includes("HH") ? "datetime" : "date";
28
28
  }
29
+ function validIdCard(cardNo) {
30
+ if (!cardNo || cardNo.length !== 18) {
31
+ return false;
32
+ }
33
+ const w = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
34
+ const v = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
35
+ let sum = 0;
36
+ for (let i = 0; i < 17; i++) {
37
+ sum += +cardNo[i] * w[i];
38
+ }
39
+ return cardNo.charAt(17).toUpperCase() === v[sum % 11];
40
+ }
41
+ const idcardMatcher = /^\d{6}(((19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}(\d|x|X))|(\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}))$/;
29
42
  function isIdCard(idCardNo) {
30
- return /^\d{6}(((19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}(\d|x|X))|(\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}))$/.test(idCardNo);
43
+ return idcardMatcher.test(idCardNo) && validIdCard(idCardNo);
31
44
  }
32
45
  function isMobile(mobile) {
33
46
  return /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(mobile);