cnhis-design-vue 3.1.16-beta.5 → 3.1.16-beta.6
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/es/packages/fabric-chart/src/hooks/useLeft.js +8 -4
- package/es/packages/form-config/index.d.ts +5 -9
- package/es/packages/form-config/src/FormConfig.vue.d.ts +5 -9
- package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +1 -3
- package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +1 -3
- package/es/packages/form-config/src/hooks/useSortable.d.ts +1 -0
- package/es/packages/form-render/index.d.ts +1 -3
- package/es/packages/form-render/src/FormRender.vue.d.ts +1 -3
- package/es/packages/form-render/src/components/renderer/cascader.js +2 -2
- package/es/packages/form-render/src/components/renderer/date.d.ts +20 -4
- package/es/packages/form-render/src/components/renderer/date.js +36 -20
- package/es/packages/form-render/src/components/renderer/select.js +5 -5
- package/es/packages/form-render/src/components/renderer/slider.d.ts +8 -344
- package/es/packages/form-render/src/components/renderer/slider.js +23 -1
- package/es/packages/form-render/src/hooks/useAnchor.js +7 -4
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +3 -3
- package/es/packages/form-render/src/hooks/useFormValidator.js +13 -3
- package/es/packages/form-render/src/hooks/useInitialData.d.ts +1 -1
- package/es/packages/form-render/src/hooks/useInitialData.js +9 -4
- package/es/packages/form-render/src/utils/business.js +15 -2
- package/es/packages/form-render/src/utils/index.d.ts +1 -1
- package/es/packages/form-render/src/utils/index.js +5 -2
- package/es/packages/form-render/src/utils/schema.d.ts +1 -0
- package/es/packages/form-render/src/utils/schema.js +12 -1
- package/es/packages/shortcut-setter/index.d.ts +1 -3
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -3
- package/global.d.ts +8 -8
- package/package.json +1 -1
|
@@ -65,12 +65,14 @@ function useLeft(canvas, propItems, emits, setPopup, pointTipProps, getXValue, g
|
|
|
65
65
|
const list = [];
|
|
66
66
|
if (item.showScale || item.showNumber) {
|
|
67
67
|
const { lineXMain, textLeft } = getScaleInfo(item.position, iconsWidth, originX - iconsWidth);
|
|
68
|
+
const listLen = item.list.length;
|
|
68
69
|
item.list.forEach((v, i) => {
|
|
69
70
|
let top = painOriginY.endY - i * yCellHeight * item.spaceGridNumber;
|
|
70
71
|
if (i === 0) {
|
|
71
72
|
top = endY - 5;
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
+
const isMaxMinNumber = i === 0 || i === listLen - 1;
|
|
75
|
+
if (item.showNumber && (isMaxMinNumber ? item.showMaxMinNumber : true)) {
|
|
74
76
|
list.push(drawScaleNumber(v, item, textLeft, top));
|
|
75
77
|
}
|
|
76
78
|
if (item.showScale && i !== 0) {
|
|
@@ -117,20 +119,22 @@ function useLeft(canvas, propItems, emits, setPopup, pointTipProps, getXValue, g
|
|
|
117
119
|
const spaceScale = spaceGridNumber * yCellHeight / 5;
|
|
118
120
|
const position = item.position || "center";
|
|
119
121
|
const { lineXMain, lineXSub, textLeft } = getScaleInfo(item.position, rectLeft, rectWidth);
|
|
122
|
+
const listLen = item.list.length;
|
|
120
123
|
item.list.forEach((v, i) => {
|
|
121
124
|
const top = vitalSignsOriginY.endY - i * yCellHeight * spaceGridNumber;
|
|
122
|
-
|
|
125
|
+
const isMaxMinNumber = i === 0 || i === listLen - 1;
|
|
126
|
+
if (item.showNumber && (isMaxMinNumber ? item.showMaxMinNumber : true)) {
|
|
123
127
|
const text = drawScaleNumber(v, item, textLeft, i === 0 ? top - 5 : top);
|
|
124
128
|
list.push(text);
|
|
125
129
|
}
|
|
126
|
-
if (item.showScale && i !==
|
|
130
|
+
if (item.showScale && i !== listLen - 1) {
|
|
127
131
|
for (let j = 0; j < 5; j++) {
|
|
128
132
|
if (j > 0 || !item.showNumber || position !== "center") {
|
|
129
133
|
const x1 = j == 0 ? lineXMain[0] : lineXSub[0];
|
|
130
134
|
const x2 = j == 0 ? lineXMain[1] : lineXSub[1];
|
|
131
135
|
const y = top - j * spaceScale;
|
|
132
136
|
createLine([x1, y, x2, y]);
|
|
133
|
-
if (i ==
|
|
137
|
+
if (i == listLen - 2 && j == 4) {
|
|
134
138
|
createLine([lineXMain[0], y - spaceScale, lineXMain[1], y - spaceScale]);
|
|
135
139
|
}
|
|
136
140
|
}
|
|
@@ -14,9 +14,9 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
14
14
|
[x: `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
|
|
15
15
|
}>>;
|
|
16
16
|
commonConfig: {
|
|
17
|
-
onMove: ({ to, from }:
|
|
18
|
-
onChoose: ({ target, item }:
|
|
19
|
-
onUnchoose: ({ from, to, target, item }:
|
|
17
|
+
onMove: ({ to, from }: import("sortablejs").SortableEvent) => void;
|
|
18
|
+
onChoose: ({ target, item }: import("sortablejs").SortableEvent) => void;
|
|
19
|
+
onUnchoose: ({ from, to, target, item }: import("sortablejs").SortableEvent) => void;
|
|
20
20
|
tag: string;
|
|
21
21
|
animation: string;
|
|
22
22
|
'item-key': string;
|
|
@@ -7239,9 +7239,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
7239
7239
|
}>>;
|
|
7240
7240
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
7241
7241
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
7242
|
-
formModel: import("@formily/core").Form<
|
|
7243
|
-
[x: string]: any;
|
|
7244
|
-
}>;
|
|
7242
|
+
formModel: import("@formily/core").Form<any>;
|
|
7245
7243
|
SchemaField: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
7246
7244
|
businessCollector: import("..").BusinessCollector;
|
|
7247
7245
|
formItemDepsCollector: import("..").FormItemDepsCollector;
|
|
@@ -12317,9 +12315,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
12317
12315
|
}>>;
|
|
12318
12316
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
12319
12317
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
12320
|
-
formModel: import("@formily/core").Form<
|
|
12321
|
-
[x: string]: any;
|
|
12322
|
-
}>;
|
|
12318
|
+
formModel: import("@formily/core").Form<any>;
|
|
12323
12319
|
SchemaField: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
12324
12320
|
businessCollector: import("..").BusinessCollector;
|
|
12325
12321
|
formItemDepsCollector: import("..").FormItemDepsCollector;
|
|
@@ -16,9 +16,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
16
16
|
[x: `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
|
|
17
17
|
}>>;
|
|
18
18
|
commonConfig: {
|
|
19
|
-
onMove: ({ to, from }:
|
|
20
|
-
onChoose: ({ target, item }:
|
|
21
|
-
onUnchoose: ({ from, to, target, item }:
|
|
19
|
+
onMove: ({ to, from }: import("sortablejs").SortableEvent) => void;
|
|
20
|
+
onChoose: ({ target, item }: import("sortablejs").SortableEvent) => void;
|
|
21
|
+
onUnchoose: ({ from, to, target, item }: import("sortablejs").SortableEvent) => void;
|
|
22
22
|
tag: string;
|
|
23
23
|
animation: string;
|
|
24
24
|
'item-key': string;
|
|
@@ -7241,9 +7241,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
7241
7241
|
}>>;
|
|
7242
7242
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
7243
7243
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
7244
|
-
formModel: import("@formily/core").Form<
|
|
7245
|
-
[x: string]: any;
|
|
7246
|
-
}>;
|
|
7244
|
+
formModel: import("@formily/core").Form<any>;
|
|
7247
7245
|
SchemaField: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
7248
7246
|
businessCollector: import("../../../../es/packages/form-render").BusinessCollector;
|
|
7249
7247
|
formItemDepsCollector: import("../../../../es/packages/form-render").FormItemDepsCollector;
|
|
@@ -12319,9 +12317,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
12319
12317
|
}>>;
|
|
12320
12318
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
12321
12319
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
12322
|
-
formModel: import("@formily/core").Form<
|
|
12323
|
-
[x: string]: any;
|
|
12324
|
-
}>;
|
|
12320
|
+
formModel: import("@formily/core").Form<any>;
|
|
12325
12321
|
SchemaField: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
12326
12322
|
businessCollector: import("../../../../es/packages/form-render").BusinessCollector;
|
|
12327
12323
|
formItemDepsCollector: import("../../../../es/packages/form-render").FormItemDepsCollector;
|
|
@@ -3571,9 +3571,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
3571
3571
|
}>>;
|
|
3572
3572
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
3573
3573
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
3574
|
-
formModel: import("@formily/core").Form<
|
|
3575
|
-
[x: string]: any;
|
|
3576
|
-
}>;
|
|
3574
|
+
formModel: import("@formily/core").Form<any>;
|
|
3577
3575
|
SchemaField: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
3578
3576
|
businessCollector: import("../../../../../es/packages/form-render").BusinessCollector;
|
|
3579
3577
|
formItemDepsCollector: import("../../../../../es/packages/form-render").FormItemDepsCollector;
|
|
@@ -3817,9 +3817,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
3817
3817
|
}>>;
|
|
3818
3818
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
3819
3819
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
3820
|
-
formModel: import("@formily/core").Form<
|
|
3821
|
-
[x: string]: any;
|
|
3822
|
-
}>;
|
|
3820
|
+
formModel: import("@formily/core").Form<any>;
|
|
3823
3821
|
SchemaField: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
3824
3822
|
businessCollector: import("../../../../../es/packages/form-render").BusinessCollector;
|
|
3825
3823
|
formItemDepsCollector: import("../../../../../es/packages/form-render").FormItemDepsCollector;
|
|
@@ -230,9 +230,7 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
230
230
|
}>>;
|
|
231
231
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
232
232
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
233
|
-
formModel: import("@formily/core").Form<
|
|
234
|
-
[x: string]: any;
|
|
235
|
-
}>;
|
|
233
|
+
formModel: import("@formily/core").Form<any>;
|
|
236
234
|
SchemaField: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
237
235
|
businessCollector: import("./src/hooks").BusinessCollector;
|
|
238
236
|
formItemDepsCollector: import("./src/hooks").FormItemDepsCollector;
|
|
@@ -230,9 +230,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
230
230
|
}>>;
|
|
231
231
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
232
232
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
233
|
-
formModel: import("@formily/core").Form<
|
|
234
|
-
[x: string]: any;
|
|
235
|
-
}>;
|
|
233
|
+
formModel: import("@formily/core").Form<any>;
|
|
236
234
|
SchemaField: Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
237
235
|
businessCollector: import("./hooks").BusinessCollector;
|
|
238
236
|
formItemDepsCollector: import("./hooks").FormItemDepsCollector;
|
|
@@ -46,7 +46,7 @@ const script = defineComponent({
|
|
|
46
46
|
var _a, _b;
|
|
47
47
|
return (_b = (_a = props.urlConfig) == null ? void 0 : _a.valueKey) != null ? _b : "value";
|
|
48
48
|
});
|
|
49
|
-
const
|
|
49
|
+
const valueRef = computed(() => {
|
|
50
50
|
try {
|
|
51
51
|
const parsed = Array.isArray(props.value) ? props.value : JSON.parse(props.value || "");
|
|
52
52
|
if (!Array.isArray(parsed) || !parsed.length)
|
|
@@ -158,7 +158,7 @@ const script = defineComponent({
|
|
|
158
158
|
"checkStrategy": "child",
|
|
159
159
|
"show": !!show.value,
|
|
160
160
|
"onUpdate:show": updateShow,
|
|
161
|
-
"value":
|
|
161
|
+
"value": valueRef.value,
|
|
162
162
|
"onUpdate:value": updateValue,
|
|
163
163
|
"labelField": labelKey.value,
|
|
164
164
|
"valueField": valueKey.value,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
2
|
export declare const DATE: import("vue").DefineComponent<{
|
|
3
3
|
onChange: {};
|
|
4
|
-
value: {
|
|
4
|
+
value: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
};
|
|
5
7
|
validate: {
|
|
6
8
|
type: PropType<Partial<{
|
|
7
9
|
[key: string]: any;
|
|
@@ -16,9 +18,15 @@ export declare const DATE: import("vue").DefineComponent<{
|
|
|
16
18
|
regular_error_tip: string;
|
|
17
19
|
}>>;
|
|
18
20
|
};
|
|
19
|
-
|
|
21
|
+
valueFormat: {
|
|
22
|
+
type: StringConstructor;
|
|
23
|
+
default: string;
|
|
24
|
+
};
|
|
25
|
+
}, () => 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<{
|
|
20
26
|
onChange: {};
|
|
21
|
-
value: {
|
|
27
|
+
value: {
|
|
28
|
+
type: StringConstructor;
|
|
29
|
+
};
|
|
22
30
|
validate: {
|
|
23
31
|
type: PropType<Partial<{
|
|
24
32
|
[key: string]: any;
|
|
@@ -33,4 +41,12 @@ export declare const DATE: import("vue").DefineComponent<{
|
|
|
33
41
|
regular_error_tip: string;
|
|
34
42
|
}>>;
|
|
35
43
|
};
|
|
36
|
-
|
|
44
|
+
valueFormat: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
}>> & {
|
|
49
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
valueFormat: string;
|
|
52
|
+
}>;
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
import { defineComponent, computed, createVNode } from 'vue';
|
|
2
|
-
import { isField } from '@formily/core';
|
|
1
|
+
import { defineComponent, computed, watch, createVNode, mergeProps } from 'vue';
|
|
3
2
|
import { connect, mapProps } from '@formily/vue';
|
|
4
3
|
import { isObject } from '@vueuse/core';
|
|
4
|
+
import { format } from 'date-fns';
|
|
5
5
|
import { NDatePicker } from 'naive-ui';
|
|
6
6
|
import { useCommonInjection } from '../../../../../packages/form-render/src/hooks/useCommonInjection';
|
|
7
|
+
import { assignUpdateValue } from '../../../../../packages/form-render/src/utils';
|
|
7
8
|
|
|
8
9
|
const script = defineComponent({
|
|
9
10
|
props: {
|
|
10
11
|
onChange: {},
|
|
11
|
-
value: {
|
|
12
|
+
value: {
|
|
13
|
+
type: String
|
|
14
|
+
},
|
|
12
15
|
validate: {
|
|
13
16
|
type: Object
|
|
17
|
+
},
|
|
18
|
+
valueFormat: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "yyyy-MM-dd"
|
|
14
21
|
}
|
|
15
22
|
},
|
|
16
|
-
|
|
23
|
+
emits: ["update:value"],
|
|
24
|
+
setup(props, {
|
|
25
|
+
emit
|
|
26
|
+
}) {
|
|
17
27
|
useCommonInjection().injectValueValidate(() => props.value);
|
|
18
28
|
function minCurrentDate() {
|
|
19
29
|
var _a;
|
|
@@ -56,7 +66,9 @@ const script = defineComponent({
|
|
|
56
66
|
}
|
|
57
67
|
}
|
|
58
68
|
const validateConfig = computed(() => {
|
|
59
|
-
const result = {
|
|
69
|
+
const result = {
|
|
70
|
+
valueFormat: props.valueFormat
|
|
71
|
+
};
|
|
60
72
|
if (isObject(props.validate)) {
|
|
61
73
|
const {
|
|
62
74
|
min_date,
|
|
@@ -69,22 +81,26 @@ const script = defineComponent({
|
|
|
69
81
|
}
|
|
70
82
|
return result;
|
|
71
83
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
function formatDate(value) {
|
|
85
|
+
if (!value)
|
|
86
|
+
return value;
|
|
87
|
+
return format(new Date(value), props.valueFormat);
|
|
88
|
+
}
|
|
89
|
+
watch(() => props.value, (value) => {
|
|
90
|
+
if (!value || formatDate(value) === value)
|
|
91
|
+
return;
|
|
92
|
+
emit("update:value", formatDate(value));
|
|
93
|
+
});
|
|
94
|
+
const valueRef = computed({
|
|
95
|
+
get: () => formatDate(props.value),
|
|
96
|
+
set: (value) => emit("update:value", value)
|
|
85
97
|
});
|
|
98
|
+
return () => createVNode(NDatePicker, mergeProps(validateConfig.value, {
|
|
99
|
+
"formatted-value": valueRef.value,
|
|
100
|
+
"onUpdate:formatted-value": ($event) => valueRef.value = $event
|
|
101
|
+
}), null);
|
|
86
102
|
}
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
});
|
|
104
|
+
const DATE = connect(script, mapProps(assignUpdateValue));
|
|
89
105
|
|
|
90
106
|
export { DATE };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, ref, inject, nextTick, watch, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
|
-
import { isEqual } from 'lodash-es';
|
|
3
|
+
import { cloneDeep, isEqual } from 'lodash-es';
|
|
4
4
|
import { useCommonInjection } from '../../../../../packages/form-render/src/hooks/useCommonInjection';
|
|
5
5
|
import { InjectAsyncQueue, InjectionChangeContextCollector, InjectionFormItemDepsCollector } from '../../constants/index.js';
|
|
6
6
|
import { connect, mapProps } from '@formily/vue';
|
|
@@ -105,7 +105,7 @@ const script = defineComponent({
|
|
|
105
105
|
changeContextCollector == null ? void 0 : changeContextCollector.setContext(fieldKey.value, async () => {
|
|
106
106
|
await nextTick();
|
|
107
107
|
return {
|
|
108
|
-
currentOption: parsedOptions.value.find((option) => option[valueKey.value] ===
|
|
108
|
+
currentOption: cloneDeep(parsedOptions.value.find((option) => option[valueKey.value] === valueRef.value))
|
|
109
109
|
};
|
|
110
110
|
});
|
|
111
111
|
const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
|
|
@@ -120,7 +120,7 @@ const script = defineComponent({
|
|
|
120
120
|
emit("update:value", null);
|
|
121
121
|
!props.lazyRequest && await fetchData();
|
|
122
122
|
});
|
|
123
|
-
(
|
|
123
|
+
(valueRef.value || !props.lazyRequest) && fetchData();
|
|
124
124
|
}, {
|
|
125
125
|
immediate: true
|
|
126
126
|
});
|
|
@@ -128,8 +128,8 @@ const script = defineComponent({
|
|
|
128
128
|
injectValueValidate,
|
|
129
129
|
injectValueWatchFromEmpty
|
|
130
130
|
} = useCommonInjection();
|
|
131
|
-
injectValueWatchFromEmpty(
|
|
132
|
-
injectValueValidate(
|
|
131
|
+
injectValueWatchFromEmpty(valueRef, fetchData);
|
|
132
|
+
injectValueValidate(valueRef);
|
|
133
133
|
function focusDecorator(onFocus) {
|
|
134
134
|
return (...args) => {
|
|
135
135
|
if (isField(field.value)) {
|
|
@@ -1,347 +1,11 @@
|
|
|
1
1
|
export declare const SLIDER: import("vue").DefineComponent<{
|
|
2
|
-
|
|
3
|
-
type:
|
|
4
|
-
default: undefined;
|
|
2
|
+
value: {
|
|
3
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
5
4
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
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
|
|
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
|
|
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);
|
|
@@ -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:
|
|
132
|
-
max:
|
|
133
|
-
min:
|
|
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;
|
|
@@ -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
|
-
[
|
|
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
|
-
(
|
|
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[]) =>
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
}
|
|
@@ -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
|
|
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);
|
|
@@ -8,7 +8,7 @@ export declare function formRenderLog(message: string, type?: keyof Console): vo
|
|
|
8
8
|
export declare function arrayed<T>(maybeArray: T): T extends Array<any> ? T : [T];
|
|
9
9
|
export declare function mergeDeepProperties(target: AnyObject, fieldList: FieldItem[], traverseProperties?: string[], property?: string, targetProperty?: string): AnyObject;
|
|
10
10
|
export declare function injectOrProvide<T>(key: InjectionKey<T>, creator: () => T): T;
|
|
11
|
-
export declare function parseNumberFromMaybeString(value:
|
|
11
|
+
export declare function parseNumberFromMaybeString<T>(value: T): T extends number | string ? number : T;
|
|
12
12
|
export declare function uuidGenerator(): string;
|
|
13
13
|
export declare function createSlot(renderer: unknown, props: AnyObject): Record<string, () => ArrayAble<VNode>> | {
|
|
14
14
|
default(): any;
|
|
@@ -3,7 +3,7 @@ import { isObject } from '@vue/shared';
|
|
|
3
3
|
import { isNumber, isString, isFunction } from 'lodash-es';
|
|
4
4
|
export { isIdCard, isMobile, parseAge2Birthday, parseAge2FromContext, parseBirthday, parseIdCard, transformDateFormat } from './business.js';
|
|
5
5
|
export { queryDecorator, queryInput } from './dom.js';
|
|
6
|
-
export { assignUpdateValue, createLinebarId, elementIdEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseSchema } from './schema.js';
|
|
6
|
+
export { assignUpdateValue, createLinebarId, elementIdEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseFieldList, traverseSchema } from './schema.js';
|
|
7
7
|
|
|
8
8
|
function formRenderLog(message, type = "log") {
|
|
9
9
|
console[type](`[FormRender]: ${message}`);
|
|
@@ -56,10 +56,13 @@ function parseNumberFromMaybeString(value) {
|
|
|
56
56
|
return value;
|
|
57
57
|
}
|
|
58
58
|
function uuidGenerator() {
|
|
59
|
-
|
|
59
|
+
if (window.isSecureContext && window.crypto)
|
|
60
|
+
return `key${window.crypto.randomUUID()}`;
|
|
61
|
+
const uuid = "xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
60
62
|
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
|
61
63
|
return v.toString(16);
|
|
62
64
|
});
|
|
65
|
+
return `key${uuid}`;
|
|
63
66
|
}
|
|
64
67
|
function createSlot(renderer, props) {
|
|
65
68
|
if (isObject(renderer) && !isFunction(renderer)) {
|
|
@@ -13,3 +13,4 @@ export declare function getParentLinebar(key: string, fieldList: FieldItem[]): W
|
|
|
13
13
|
export declare function assignUpdateValue(props: AnyObject, field: GeneralField): {
|
|
14
14
|
[x: string]: any;
|
|
15
15
|
};
|
|
16
|
+
export declare function traverseFieldList(fieldList: FieldItem[], handler: (field: FieldItem) => void): void;
|
|
@@ -79,5 +79,16 @@ function assignUpdateValue(props, field) {
|
|
|
79
79
|
}
|
|
80
80
|
return _props;
|
|
81
81
|
}
|
|
82
|
+
function traverseFieldList(fieldList, handler) {
|
|
83
|
+
function traverse(fieldList2) {
|
|
84
|
+
if (!isArray(fieldList2))
|
|
85
|
+
return;
|
|
86
|
+
fieldList2.forEach((field) => {
|
|
87
|
+
handler(field);
|
|
88
|
+
traverse(field.properties);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
traverse(fieldList);
|
|
92
|
+
}
|
|
82
93
|
|
|
83
|
-
export { assignUpdateValue, createLinebarId, elementIdEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseSchema };
|
|
94
|
+
export { assignUpdateValue, createLinebarId, elementIdEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseFieldList, traverseSchema };
|
|
@@ -1925,9 +1925,7 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1925
1925
|
}>>;
|
|
1926
1926
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
1927
1927
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
1928
|
-
formModel: import("@formily/core").Form<
|
|
1929
|
-
[x: string]: any;
|
|
1930
|
-
}>;
|
|
1928
|
+
formModel: import("@formily/core").Form<any>;
|
|
1931
1929
|
SchemaField: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
1932
1930
|
businessCollector: import("..").BusinessCollector;
|
|
1933
1931
|
formItemDepsCollector: import("..").FormItemDepsCollector;
|
|
@@ -1927,9 +1927,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1927
1927
|
}>>;
|
|
1928
1928
|
emit: (event: "formChange", ...args: any[]) => void;
|
|
1929
1929
|
nuiThemeOverrides: import("naive-ui").GlobalThemeOverrides;
|
|
1930
|
-
formModel: import("@formily/core").Form<
|
|
1931
|
-
[x: string]: any;
|
|
1932
|
-
}>;
|
|
1930
|
+
formModel: import("@formily/core").Form<any>;
|
|
1933
1931
|
SchemaField: Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
1934
1932
|
businessCollector: import("../../../../es/packages/form-render").BusinessCollector;
|
|
1935
1933
|
formItemDepsCollector: import("../../../../es/packages/form-render").FormItemDepsCollector;
|
package/global.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as NaiveUI from 'naive-ui';
|
|
2
|
-
|
|
3
|
-
declare module 'naive-ui' {
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
export const NTree: any;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export {};
|
|
1
|
+
import * as NaiveUI from 'naive-ui';
|
|
2
|
+
|
|
3
|
+
declare module 'naive-ui' {
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
export const NTree: any;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export {};
|