cnhis-design-vue 3.1.13-beta.0 → 3.1.13-beta.11
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/big-table/src/BigTable.vue.d.ts +3 -16
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +40 -21
- package/es/packages/big-table/src/bigTableEmits.js +2 -1
- package/es/packages/big-table/src/utils.js +2 -1
- package/es/packages/big-table/style/index.css +5 -0
- package/es/packages/bpmn-workflow/src/BpmnWorkflow.d.ts +5 -0
- package/es/packages/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
- package/es/packages/bpmn-workflow/types/ModelingModule.d.ts +1 -0
- package/es/packages/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
- package/es/packages/button-print/index.d.ts +15 -1
- package/es/packages/button-print/src/ButtonPrint.vue.d.ts +199 -185
- package/es/packages/button-print/src/ButtonPrint.vue_vue_type_script_setup_true_lang.js +39 -4
- package/es/packages/button-print/src/utils/print.d.ts +41 -0
- package/es/packages/button-print/src/utils/print.js +325 -0
- package/es/packages/fabric-chart/index.d.ts +3 -4
- package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +3 -4
- package/es/packages/fabric-chart/src/FabricChart.vue_vue_type_script_setup_true_lang.js +24 -18
- package/es/packages/fabric-chart/src/hooks/useBottom.js +1 -2
- package/es/packages/fabric-chart/src/hooks/useCenter.js +89 -19
- package/es/packages/fabric-chart/src/hooks/useCumputedPoint.d.ts +2 -2
- package/es/packages/fabric-chart/src/hooks/useCumputedPoint.js +27 -13
- package/es/packages/fabric-chart/src/hooks/useDraw.d.ts +1 -1
- package/es/packages/fabric-chart/src/hooks/useDraw.js +64 -7
- package/es/packages/fabric-chart/src/hooks/useLeft.js +83 -22
- package/es/packages/fabric-chart/src/hooks/useOther.js +3 -2
- package/es/packages/fabric-chart/src/hooks/useShadow.js +1 -1
- package/es/packages/fabric-chart/src/hooks/useTop.js +6 -4
- package/es/packages/fabric-chart/src/interface.d.ts +2 -2
- package/es/packages/fabric-chart/src/utils/index.d.ts +6823 -2
- package/es/packages/form-render/index.d.ts +311 -0
- package/es/packages/form-render/src/FormRender.vue.d.ts +313 -2
- package/es/packages/form-render/src/FormRender.vue_vue_type_script_setup_true_lang.js +58 -27
- package/es/packages/form-render/src/components/renderer/cascader.d.ts +7 -1
- package/es/packages/form-render/src/components/renderer/cascader.js +65 -53
- package/es/packages/form-render/src/components/renderer/formItem.d.ts +8 -293
- package/es/packages/form-render/src/components/renderer/formItem.js +137 -2
- package/es/packages/form-render/src/components/renderer/input.js +3 -3
- package/es/packages/form-render/src/components/renderer/select.d.ts +7 -5
- package/es/packages/form-render/src/components/renderer/select.js +35 -40
- package/es/packages/form-render/src/components/renderer/simpleComponent.js +2 -15
- package/es/packages/form-render/src/constants/index.d.ts +2 -1
- package/es/packages/form-render/src/constants/index.js +2 -1
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +4 -2
- package/es/packages/form-render/src/hooks/useFormContext.d.ts +2 -1
- package/es/packages/form-render/src/hooks/useFormContext.js +13 -2
- package/es/packages/form-render/src/types/fieldItem.d.ts +58 -7
- package/es/packages/form-render/src/types/index.d.ts +5 -0
- package/es/packages/form-render/src/utils/index.d.ts +13 -4
- package/es/packages/form-render/src/utils/index.js +44 -3
- package/es/packages/form-render/style/index.css +44 -6
- package/es/packages/form-table/src/hooks/useNuiThemeOverrides.d.ts +4 -0
- package/es/packages/form-table/src/hooks/useNuiThemeOverrides.js +18 -0
- package/es/packages/index.css +228 -8
- package/es/packages/index.d.ts +5 -1
- package/es/packages/index.js +12 -1
- package/es/packages/scale-view/src/hooks/scaleview-init.js +1 -5
- package/es/packages/scale-view/src/hooks/scaleview-submit.js +1 -6
- package/es/packages/scale-view/src/hooks/scaleview-validate.js +0 -3
- package/es/packages/shortcut-provider/index.d.ts +17 -0
- package/es/packages/shortcut-provider/index.js +13 -0
- package/es/packages/shortcut-provider/src/ShortcutProvider.js +4 -0
- package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +15 -0
- package/es/packages/shortcut-provider/src/ShortcutProvider.vue_vue_type_script_setup_true_lang.js +32 -0
- package/es/packages/shortcut-provider/src/constants/index.d.ts +7 -0
- package/es/packages/shortcut-provider/src/constants/index.js +8 -0
- package/es/packages/shortcut-provider/src/hooks/index.d.ts +2 -0
- package/es/packages/shortcut-provider/src/hooks/index.js +2 -0
- package/es/packages/shortcut-provider/src/hooks/useShortcutSignature.d.ts +4 -0
- package/es/packages/shortcut-provider/src/hooks/useShortcutSignature.js +12 -0
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +30 -0
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +157 -0
- package/es/packages/shortcut-provider/src/types/index.d.ts +30 -0
- package/es/packages/shortcut-provider/src/types/index.js +1 -0
- package/es/packages/shortcut-provider/src/utils/index.d.ts +7 -0
- package/es/packages/shortcut-provider/src/utils/index.js +49 -0
- package/es/packages/shortcut-provider/style/index.css +3 -0
- package/es/packages/shortcut-setter/constant/index.d.ts +4 -0
- package/es/packages/shortcut-setter/constant/index.js +7 -0
- package/es/packages/shortcut-setter/index.d.ts +4258 -0
- package/es/packages/shortcut-setter/index.js +11 -0
- package/es/packages/shortcut-setter/src/ShortcutSetter.js +4 -0
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +4258 -0
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue_vue_type_script_setup_true_lang.js +38 -0
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +4 -0
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +4238 -0
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue_vue_type_script_setup_true_lang.js +125 -0
- package/es/packages/shortcut-setter/style/index.css +8 -0
- package/es/packages/steps-wheel/index.d.ts +548 -0
- package/es/packages/steps-wheel/index.js +11 -0
- package/es/packages/steps-wheel/src/StepsWheel.js +4 -0
- package/es/packages/steps-wheel/src/StepsWheel.vue.d.ts +547 -0
- package/es/packages/steps-wheel/src/StepsWheel.vue_vue_type_script_setup_true_lang.js +252 -0
- package/es/packages/steps-wheel/style/index.css +161 -0
- package/es/packages/time-line/index.d.ts +1 -0
- package/es/packages/time-line/src/TimeLine.vue.d.ts +1 -0
- package/es/packages/time-line/src/TimeLine.vue_vue_type_script_setup_true_lang.js +6 -1
- package/es/packages/time-line/style/index.css +7 -2
- package/es/src/types/index.d.ts +1 -0
- package/package.json +153 -153
- package/es/packages/button-print/src/utils/print.es.min.d.ts +0 -2
- package/es/packages/button-print/src/utils/print.es.min.js +0 -2532
- package/test.ts +0 -326
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, inject, computed, watch, createVNode } from 'vue';
|
|
1
|
+
import { defineComponent, ref, inject, computed, watch, nextTick, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
3
|
import { cloneDeep } from 'lodash-es';
|
|
4
4
|
import { InjectAsyncQueue, InjectionFormItemDepsCollector, InjectionChangeContextCollector } from '../../constants/index.js';
|
|
@@ -21,17 +21,17 @@ const script = defineComponent({
|
|
|
21
21
|
urlConfig: {
|
|
22
22
|
type: Object
|
|
23
23
|
},
|
|
24
|
-
|
|
24
|
+
onFocus: {
|
|
25
25
|
type: Function
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
|
+
onChange: {}
|
|
27
28
|
},
|
|
28
29
|
emits: ["update:value"],
|
|
29
30
|
setup(props, {
|
|
30
31
|
slots,
|
|
31
32
|
emit
|
|
32
33
|
}) {
|
|
33
|
-
const
|
|
34
|
-
let cachedOptions = null;
|
|
34
|
+
const remoteOptions = ref(null);
|
|
35
35
|
const lastSearch = ref("");
|
|
36
36
|
const asyncQueue = inject(InjectAsyncQueue);
|
|
37
37
|
const {
|
|
@@ -45,54 +45,46 @@ const script = defineComponent({
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
async function fetchData(content) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} else {
|
|
52
|
-
lastSearch.value = content || "";
|
|
53
|
-
}
|
|
48
|
+
lastSearch.value = content || "";
|
|
49
|
+
if (remoteOptions.value)
|
|
50
|
+
return;
|
|
54
51
|
const config = props.urlConfig;
|
|
55
52
|
if (!config) {
|
|
56
|
-
return
|
|
53
|
+
return remoteOptions.value = null;
|
|
57
54
|
}
|
|
58
55
|
if (!isObject(config)) {
|
|
59
56
|
formRenderLog(`invalid urlConfig (${config}) in SELECT => ${title.value}`, "warn");
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
if (cachedOptions) {
|
|
63
|
-
return _options.value = filterOption(cachedOptions, content);
|
|
57
|
+
return remoteOptions.value = null;
|
|
64
58
|
}
|
|
65
59
|
try {
|
|
66
|
-
|
|
67
|
-
...config,
|
|
68
|
-
key: title.value
|
|
69
|
-
params: Object.assign({}, config.params, generateUrlParams(field.value, config.dependKey))
|
|
60
|
+
remoteOptions.value = await asyncQueue.addAsync({
|
|
61
|
+
...createParams(config, field.value),
|
|
62
|
+
key: title.value
|
|
70
63
|
});
|
|
71
|
-
_options.value = data.reduce((res, d) => {
|
|
72
|
-
var _a;
|
|
73
|
-
if (((_a = d[labelKey.value]) == null ? void 0 : _a.includes(content)) || !content) {
|
|
74
|
-
res.push(d);
|
|
75
|
-
}
|
|
76
|
-
return res;
|
|
77
|
-
}, []);
|
|
78
|
-
cachedOptions = _options.value;
|
|
79
64
|
} catch (e) {
|
|
80
|
-
|
|
65
|
+
remoteOptions.value = null;
|
|
66
|
+
}
|
|
67
|
+
function createParams(config2, field2) {
|
|
68
|
+
return {
|
|
69
|
+
...config2,
|
|
70
|
+
params: Object.assign({}, config2.params, generateUrlParams(field2, config2.dependKey))
|
|
71
|
+
};
|
|
81
72
|
}
|
|
82
73
|
}
|
|
83
74
|
const parsedOptions = computed(() => {
|
|
84
|
-
if (
|
|
85
|
-
return
|
|
75
|
+
if (remoteOptions.value)
|
|
76
|
+
return filterOption(remoteOptions.value, lastSearch.value);
|
|
86
77
|
if (!Array.isArray(props.options))
|
|
87
78
|
return [];
|
|
88
79
|
return filterOption(props.options, lastSearch.value);
|
|
89
80
|
});
|
|
90
81
|
const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
|
|
91
82
|
watch(() => props.urlConfig, (config) => {
|
|
92
|
-
|
|
93
|
-
config && formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], () => {
|
|
94
|
-
|
|
95
|
-
|
|
83
|
+
remoteOptions.value = null;
|
|
84
|
+
config && formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], async () => {
|
|
85
|
+
remoteOptions.value = null;
|
|
86
|
+
await nextTick();
|
|
87
|
+
props.value != null && await fetchData();
|
|
96
88
|
});
|
|
97
89
|
}, {
|
|
98
90
|
immediate: true
|
|
@@ -121,10 +113,13 @@ const script = defineComponent({
|
|
|
121
113
|
var _a, _b;
|
|
122
114
|
return (_b = (_a = props.urlConfig) == null ? void 0 : _a.valueKey) != null ? _b : "value";
|
|
123
115
|
});
|
|
124
|
-
function onFocus
|
|
125
|
-
|
|
126
|
-
field.value
|
|
127
|
-
|
|
116
|
+
function focusDecorator(onFocus) {
|
|
117
|
+
return (...args) => {
|
|
118
|
+
if (isField(field.value)) {
|
|
119
|
+
field.value.visited = true;
|
|
120
|
+
}
|
|
121
|
+
return onFocus == null ? void 0 : onFocus(...args);
|
|
122
|
+
};
|
|
128
123
|
}
|
|
129
124
|
return () => createVNode(NSelect, {
|
|
130
125
|
"value": props.value,
|
|
@@ -135,7 +130,7 @@ const script = defineComponent({
|
|
|
135
130
|
"valueField": valueKey.value,
|
|
136
131
|
"onSearch": fetchData,
|
|
137
132
|
"onUpdate:show": (show) => show && fetchData(),
|
|
138
|
-
"onFocus": onFocus,
|
|
133
|
+
"onFocus": focusDecorator(props.onFocus),
|
|
139
134
|
"options": parsedOptions.value
|
|
140
135
|
}, slots);
|
|
141
136
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createVNode, mergeProps, isVNode } from 'vue';
|
|
2
2
|
import { connect, mapProps } from '@formily/vue';
|
|
3
|
-
import {
|
|
3
|
+
import { isFunction } from 'lodash-es';
|
|
4
4
|
import { NButton } from 'naive-ui';
|
|
5
|
+
import { createSlot } from '../../../../../packages/form-render/src/utils';
|
|
5
6
|
|
|
6
7
|
function _isSlot(s) {
|
|
7
8
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
@@ -12,20 +13,6 @@ function createPropFor(props) {
|
|
|
12
13
|
return (_a = props.fieldItem) == null ? void 0 : _a[property];
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
function createSlot(renderer, props) {
|
|
16
|
-
if (isObject(renderer)) {
|
|
17
|
-
const result = {};
|
|
18
|
-
Object.entries(renderer).forEach(([key, renderer2]) => {
|
|
19
|
-
isFunction(renderer2) && (result[key] = () => renderer2(props));
|
|
20
|
-
});
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
default() {
|
|
25
|
-
return isFunction(renderer) ? renderer(props) : renderer;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
16
|
const textScript = (props) => {
|
|
30
17
|
var _a, _b, _c;
|
|
31
18
|
const propFor = createPropFor(props);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ContextCollector } from '../../../../../es/packages/form-render/src/hooks/useChangeContext';
|
|
2
2
|
import { BusinessCollector, FormItemDepsCollector } from '../hooks';
|
|
3
3
|
import { FormAsyncQueue } from '../types';
|
|
4
|
-
import { Component, InjectionKey } from 'vue';
|
|
4
|
+
import { Component, InjectionKey, WritableComputedRef } from 'vue';
|
|
5
5
|
export declare const InjectAsyncQueue: InjectionKey<FormAsyncQueue>;
|
|
6
6
|
export declare const InjectionSchemaField: InjectionKey<Component>;
|
|
7
7
|
export declare const InjectionBusinessCollector: InjectionKey<BusinessCollector>;
|
|
8
8
|
export declare const InjectionChangeContextCollector: InjectionKey<ContextCollector>;
|
|
9
9
|
export declare const InjectionFormItemDepsCollector: InjectionKey<FormItemDepsCollector>;
|
|
10
10
|
export declare const InjectionFormUUID: InjectionKey<string>;
|
|
11
|
+
export declare const InjectionAnnotation: InjectionKey<WritableComputedRef<Record<string, string>>>;
|
|
11
12
|
export declare const FormItemLineBarDepKeyPrepend = "__dep_LINEBAR_";
|
|
12
13
|
export declare enum FIELD_BUSINESS_TYPE {
|
|
13
14
|
PASSWORD = "password",
|
|
@@ -4,6 +4,7 @@ const InjectionBusinessCollector = Symbol("InjectionBusinessCollector");
|
|
|
4
4
|
const InjectionChangeContextCollector = Symbol("InjectionChangeContextCollector");
|
|
5
5
|
const InjectionFormItemDepsCollector = Symbol("InjectionFormItemDepsCollector");
|
|
6
6
|
const InjectionFormUUID = Symbol("InjectionFormUUID");
|
|
7
|
+
const InjectionAnnotation = Symbol("InjectionAnnotation");
|
|
7
8
|
const FormItemLineBarDepKeyPrepend = "__dep_LINEBAR_";
|
|
8
9
|
var FIELD_BUSINESS_TYPE = /* @__PURE__ */ ((FIELD_BUSINESS_TYPE2) => {
|
|
9
10
|
FIELD_BUSINESS_TYPE2["PASSWORD"] = "password";
|
|
@@ -37,4 +38,4 @@ var FIELD_AGE_UNIT = /* @__PURE__ */ ((FIELD_AGE_UNIT2) => {
|
|
|
37
38
|
return FIELD_AGE_UNIT2;
|
|
38
39
|
})(FIELD_AGE_UNIT || {});
|
|
39
40
|
|
|
40
|
-
export { FIELD_AGE_UNIT, FIELD_BUSINESS_TYPE, FIELD_SEX_VALUE, FormItemLineBarDepKeyPrepend, InjectAsyncQueue, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID, InjectionSchemaField };
|
|
41
|
+
export { FIELD_AGE_UNIT, FIELD_BUSINESS_TYPE, FIELD_SEX_VALUE, FormItemLineBarDepKeyPrepend, InjectAsyncQueue, InjectionAnnotation, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID, InjectionSchemaField };
|
|
@@ -13,7 +13,7 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
13
13
|
"x-component": item.html_type,
|
|
14
14
|
"x-component-props": {
|
|
15
15
|
placeholder: item.placeholder,
|
|
16
|
-
clearable: item.is_empty === "
|
|
16
|
+
clearable: item.is_empty === "0",
|
|
17
17
|
...item.componentProps || {}
|
|
18
18
|
},
|
|
19
19
|
"x-display": item.is_show === "0" ? "hidden" : "visible",
|
|
@@ -28,6 +28,8 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
28
28
|
"x-decorator-props": {
|
|
29
29
|
span: item.elem_width,
|
|
30
30
|
showLabel: item.hide_title !== "1",
|
|
31
|
+
propertyKey: item.val_key,
|
|
32
|
+
annotation: item.annotation,
|
|
31
33
|
id: `${uuid}-${item.val_key}`,
|
|
32
34
|
...item.decoratorProps || {}
|
|
33
35
|
}
|
|
@@ -113,7 +115,7 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
113
115
|
const createSliderSchema = (item) => {
|
|
114
116
|
const schema = createStandardSchema(item);
|
|
115
117
|
Object.assign(schema["x-component-props"], {
|
|
116
|
-
step:
|
|
118
|
+
step: Number(item.step_length),
|
|
117
119
|
max: +item.max_length,
|
|
118
120
|
min: +item.min_length,
|
|
119
121
|
option: item.option
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ShallowReactive } from 'vue';
|
|
1
2
|
import { AnyObject } from '../../../../../es/src/types';
|
|
2
|
-
export declare function useFormContext(props: AnyObject): {
|
|
3
|
+
export declare function useFormContext(props: ShallowReactive<AnyObject>): {
|
|
3
4
|
asyncQueue: import("../../../../../es/packages/form-render").FormAsyncQueue;
|
|
4
5
|
SchemaField: import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>;
|
|
5
6
|
businessCollector: import("../../../../../es/packages/form-render").BusinessCollector;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isObject } from 'lodash-es';
|
|
2
|
+
import { provide, computed, readonly } from 'vue';
|
|
2
3
|
import { createSchemaField } from '@formily/vue';
|
|
3
4
|
import { useAsyncQueue, useBusinessBinding, useChangeContext, useFormItemDeps } from '../../../../packages/form-render';
|
|
4
5
|
import * as components from '../../../../packages/form-render/src/components/renderer';
|
|
5
6
|
import { usePresetScope } from '../../../../packages/form-render/src/hooks/usePresetScope';
|
|
6
7
|
import { injectOrProvide, uuidGenerator } from '../../../../packages/form-render/src/utils';
|
|
7
|
-
import { InjectAsyncQueue, InjectionSchemaField, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID } from '../../../../packages/form-render/src/constants';
|
|
8
|
+
import { InjectAsyncQueue, InjectionSchemaField, InjectionBusinessCollector, InjectionChangeContextCollector, InjectionFormItemDepsCollector, InjectionFormUUID, InjectionAnnotation } from '../../../../packages/form-render/src/constants';
|
|
8
9
|
|
|
9
10
|
function useFormContext(props) {
|
|
10
11
|
const asyncQueue = injectOrProvide(InjectAsyncQueue, () => useAsyncQueue().create(props.parallelism));
|
|
@@ -23,6 +24,16 @@ function useFormContext(props) {
|
|
|
23
24
|
provide(InjectionFormItemDepsCollector, formItemDepsCollector);
|
|
24
25
|
const formUUID = props.uuid || uuidGenerator();
|
|
25
26
|
provide(InjectionFormUUID, formUUID);
|
|
27
|
+
provide(InjectionAnnotation, computed({
|
|
28
|
+
get() {
|
|
29
|
+
return props.annotation ? readonly(props.annotation) : null;
|
|
30
|
+
},
|
|
31
|
+
set(payload) {
|
|
32
|
+
if (!isObject(props.annotation))
|
|
33
|
+
return;
|
|
34
|
+
props.annotation[payload.property] = payload.value;
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
26
37
|
return {
|
|
27
38
|
asyncQueue,
|
|
28
39
|
SchemaField,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AnyObject } from '../../../../../es/src/types';
|
|
1
|
+
import { AnyObject, ArrayAble } from '../../../../../es/src/types';
|
|
2
|
+
import { CSSProperties, VNode } from 'vue';
|
|
2
3
|
export declare type ValidateItem = Partial<{
|
|
3
4
|
obj_type: string;
|
|
4
5
|
vali_obj: string;
|
|
@@ -20,12 +21,28 @@ export interface Ievent {
|
|
|
20
21
|
event_field: string;
|
|
21
22
|
event_type: string;
|
|
22
23
|
}
|
|
24
|
+
interface FormRendererPayload {
|
|
25
|
+
clearable: boolean;
|
|
26
|
+
disabled: boolean;
|
|
27
|
+
fieldItem: FieldItem;
|
|
28
|
+
readOnly: boolean;
|
|
29
|
+
value: unknown;
|
|
30
|
+
}
|
|
31
|
+
export interface FormRenderer {
|
|
32
|
+
(payload: FormRendererPayload): ArrayAble<VNode> | any;
|
|
33
|
+
}
|
|
34
|
+
interface SwitchProperty {
|
|
35
|
+
value?: any;
|
|
36
|
+
describe?: string;
|
|
37
|
+
}
|
|
23
38
|
export declare type FieldItem = {
|
|
24
39
|
val_key: string;
|
|
25
|
-
elem_width: number;
|
|
26
40
|
html_type: string;
|
|
27
41
|
} & Partial<{
|
|
42
|
+
annotation: boolean;
|
|
43
|
+
val_key_unit: string;
|
|
28
44
|
is_edit: string;
|
|
45
|
+
elem_width: number;
|
|
29
46
|
is_show: string | number;
|
|
30
47
|
is_null: string;
|
|
31
48
|
name: string;
|
|
@@ -35,13 +52,47 @@ export declare type FieldItem = {
|
|
|
35
52
|
group: string;
|
|
36
53
|
hide_title: string;
|
|
37
54
|
placeholder: string;
|
|
38
|
-
validate
|
|
39
|
-
option
|
|
40
|
-
wordbook
|
|
41
|
-
suFieldList
|
|
42
|
-
bindEventSetting
|
|
55
|
+
validate: ValidateItem;
|
|
56
|
+
option: OptionItem[];
|
|
57
|
+
wordbook: AnyObject;
|
|
58
|
+
suFieldList: any[];
|
|
59
|
+
bindEventSetting: Ievent[];
|
|
60
|
+
open: SwitchProperty;
|
|
61
|
+
close: SwitchProperty;
|
|
62
|
+
date_format: string;
|
|
63
|
+
step_length: string | number;
|
|
64
|
+
urlConfig: Partial<{
|
|
65
|
+
url: string;
|
|
66
|
+
method: 'post' | 'get' | 'put' | 'patch' | 'delete';
|
|
67
|
+
dependKey: string | string[];
|
|
68
|
+
params: AnyObject;
|
|
69
|
+
nameKey: string;
|
|
70
|
+
valueKey: string;
|
|
71
|
+
}>;
|
|
43
72
|
fieldType: 'string' | 'object' | 'array' | 'number' | 'void' | 'boolean' | 'datetime';
|
|
73
|
+
content: string | FormRenderer | Record<string, FormRenderer>;
|
|
44
74
|
properties: FieldItem[];
|
|
75
|
+
children: FieldItem[];
|
|
76
|
+
componentProps: AnyObject;
|
|
77
|
+
decoratorProps: AnyObject;
|
|
78
|
+
display: 'grid' | 'flex';
|
|
79
|
+
wrapperStyle: CSSProperties | Record<string, string>;
|
|
80
|
+
validator: (value: any, fieldItem: FieldItem) => void | string;
|
|
81
|
+
reactions: {
|
|
82
|
+
target?: string;
|
|
83
|
+
dependencies?: string[];
|
|
84
|
+
fulfill: {
|
|
85
|
+
state?: Partial<{
|
|
86
|
+
value: string;
|
|
87
|
+
disabled: string;
|
|
88
|
+
display: string;
|
|
89
|
+
componentProps: AnyObject;
|
|
90
|
+
decoratorProps: AnyObject;
|
|
91
|
+
selfErrors: string;
|
|
92
|
+
[key: string]: string | AnyObject;
|
|
93
|
+
}>;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
45
96
|
[key: string]: any;
|
|
46
97
|
}>;
|
|
47
98
|
export {};
|
|
@@ -26,6 +26,11 @@ export declare type FormRenderExpose = {
|
|
|
26
26
|
getFormValues(): AnyObject;
|
|
27
27
|
setFieldState(path: string, setter: (field: Field) => void): void;
|
|
28
28
|
resetFields(path?: string): void;
|
|
29
|
+
queryWidget(key: string): Promise<{
|
|
30
|
+
widgetElement: HTMLInputElement | null;
|
|
31
|
+
widgetElementList: HTMLInputElement[];
|
|
32
|
+
decoratorElement: HTMLElement | null;
|
|
33
|
+
}>;
|
|
29
34
|
};
|
|
30
35
|
export declare type FormChangeContext = Partial<{
|
|
31
36
|
currentOption: AnyObject;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { AnyObject } from '../../../../../es/src/types';
|
|
1
|
+
import { AnyObject, ArrayAble } from '../../../../../es/src/types';
|
|
2
2
|
import { ISchema } from '@formily/json-schema/esm/types';
|
|
3
3
|
import { GeneralField } from '@formily/core';
|
|
4
|
-
import { InjectionKey } from 'vue';
|
|
5
|
-
import { AgeContext, IdCardParseInfo } from '../types';
|
|
4
|
+
import { InjectionKey, VNode } from 'vue';
|
|
5
|
+
import { AgeContext, FieldItem, IdCardParseInfo } from '../types';
|
|
6
6
|
export declare function formRenderLog(message: string, type?: keyof Console): void;
|
|
7
7
|
export declare function arrayed<T>(maybeArray: T): T extends Array<any> ? T : [T];
|
|
8
8
|
export declare function assignUpdateValue(props: AnyObject, field: GeneralField): {
|
|
9
9
|
[x: string]: any;
|
|
10
10
|
};
|
|
11
|
-
export declare function transformDateFormat(format
|
|
11
|
+
export declare function transformDateFormat(format?: string): "date" | "datetime";
|
|
12
12
|
export declare function isIdCard(idCardNo: string): boolean;
|
|
13
13
|
export declare function isMobile(mobile: string): boolean;
|
|
14
14
|
export declare function parseBirthday(birthday: string): AgeContext;
|
|
@@ -17,3 +17,12 @@ export declare function injectOrProvide<T>(key: InjectionKey<T>, creator: () =>
|
|
|
17
17
|
export declare function generateUrlParams(field: GeneralField, dependKeys?: string | string[]): AnyObject;
|
|
18
18
|
export declare function traverseSchema(schema: ISchema, handler: (_s: ISchema) => void): void;
|
|
19
19
|
export declare function uuidGenerator(): string;
|
|
20
|
+
export declare function createSlot(renderer: unknown, props: any): Record<string, () => ArrayAble<VNode>> | {
|
|
21
|
+
default(): any;
|
|
22
|
+
};
|
|
23
|
+
export declare function queryDecorator(key: string, wrapperElement: HTMLElement, formUUID: string): HTMLElement | null;
|
|
24
|
+
export declare function queryInput(decoratorElement?: HTMLElement | null): {
|
|
25
|
+
widgetElement: HTMLInputElement | null | undefined;
|
|
26
|
+
widgetElementList: HTMLInputElement[];
|
|
27
|
+
};
|
|
28
|
+
export declare function getParentLinebar(key: string, fieldList: FieldItem[]): string | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isObject } from 'lodash-es';
|
|
1
|
+
import { isObject, isFunction } from 'lodash-es';
|
|
2
2
|
import { FIELD_SEX_VALUE } from '../constants/index.js';
|
|
3
3
|
import { isField } from '@formily/core';
|
|
4
4
|
import differenceInDays from '../../../../node_modules/date-fns/esm/differenceInDays/index.js';
|
|
@@ -26,7 +26,7 @@ function assignUpdateValue(props, field) {
|
|
|
26
26
|
}
|
|
27
27
|
return _props;
|
|
28
28
|
}
|
|
29
|
-
function transformDateFormat(format) {
|
|
29
|
+
function transformDateFormat(format = "") {
|
|
30
30
|
return format.includes("HH") ? "datetime" : "date";
|
|
31
31
|
}
|
|
32
32
|
function isIdCard(idCardNo) {
|
|
@@ -95,5 +95,46 @@ function uuidGenerator() {
|
|
|
95
95
|
return v.toString(16);
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
+
function createSlot(renderer, props) {
|
|
99
|
+
if (isObject(renderer) && !isFunction(renderer)) {
|
|
100
|
+
const result = {};
|
|
101
|
+
Object.entries(renderer).forEach(([key, renderer2]) => {
|
|
102
|
+
isFunction(renderer2) && (result[key] = () => renderer2(props));
|
|
103
|
+
});
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
default() {
|
|
108
|
+
return isFunction(renderer) ? renderer(props) : renderer;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function queryDecorator(key, wrapperElement, formUUID) {
|
|
113
|
+
return wrapperElement.querySelector(`#${formUUID}-${key}`);
|
|
114
|
+
}
|
|
115
|
+
function queryInput(decoratorElement) {
|
|
116
|
+
var _a;
|
|
117
|
+
return {
|
|
118
|
+
widgetElement: decoratorElement == null ? void 0 : decoratorElement.querySelector("input"),
|
|
119
|
+
widgetElementList: Array.from((_a = decoratorElement == null ? void 0 : decoratorElement.querySelectorAll("input")) != null ? _a : [])
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function getParentLinebar(key, fieldList) {
|
|
123
|
+
let result = null;
|
|
124
|
+
for (const fieldItem of fieldList) {
|
|
125
|
+
if (fieldItem.val_key === key) {
|
|
126
|
+
if (isLinebar(fieldItem))
|
|
127
|
+
result = null;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
if (isLinebar(fieldItem)) {
|
|
131
|
+
result = fieldItem.val_key;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return result;
|
|
135
|
+
function isLinebar(field) {
|
|
136
|
+
return field.html_type === "LINEBAR";
|
|
137
|
+
}
|
|
138
|
+
}
|
|
98
139
|
|
|
99
|
-
export { arrayed, assignUpdateValue, formRenderLog, generateUrlParams, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, transformDateFormat, traverseSchema, uuidGenerator };
|
|
140
|
+
export { arrayed, assignUpdateValue, createSlot, formRenderLog, generateUrlParams, getParentLinebar, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, queryDecorator, queryInput, transformDateFormat, traverseSchema, uuidGenerator };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.form-render__wrapper {
|
|
2
2
|
display: grid !important;
|
|
3
3
|
grid-template-columns: repeat(var(--column), minmax(0px, 1fr));
|
|
4
|
-
gap: 0
|
|
4
|
+
gap: 0 16px;
|
|
5
5
|
max-height: var(--form-height);
|
|
6
6
|
overflow-y: auto;
|
|
7
7
|
position: relative;
|
|
@@ -12,23 +12,52 @@
|
|
|
12
12
|
.form-render__formItem .n-date-picker {
|
|
13
13
|
width: 100%;
|
|
14
14
|
}
|
|
15
|
+
.form-render__formItemLabel {
|
|
16
|
+
position: relative;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
20
|
+
.form-render__formItemLabel--text.has-annotation {
|
|
21
|
+
margin-right: 15px;
|
|
22
|
+
}
|
|
23
|
+
.form-render__formItemLabel--icon {
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
}
|
|
27
|
+
.form-render__formItemLabel--annotation {
|
|
28
|
+
position: absolute;
|
|
29
|
+
top: 50%;
|
|
30
|
+
transform: translateY(-50%);
|
|
31
|
+
right: calc(var(--icon-right) * 1px);
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
color: #0067ee;
|
|
34
|
+
font-size: 16px;
|
|
35
|
+
user-select: none;
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
}
|
|
39
|
+
.form-render__formItemLabel--annotation.is-active {
|
|
40
|
+
color: rgba(255, 152, 40);
|
|
41
|
+
}
|
|
15
42
|
.form-render__linebar {
|
|
16
43
|
grid-column: span var(--column) / span var(--column);
|
|
17
44
|
}
|
|
18
45
|
.form-render__linebarHeader {
|
|
19
46
|
cursor: pointer;
|
|
20
47
|
display: flex;
|
|
21
|
-
background: #
|
|
22
|
-
height:
|
|
48
|
+
background: #f2f2f2;
|
|
49
|
+
height: 40px;
|
|
50
|
+
font-size: 16px;
|
|
51
|
+
font-weight: 500;
|
|
23
52
|
align-items: center;
|
|
24
53
|
padding: 0 16px;
|
|
25
54
|
margin-bottom: 8px;
|
|
26
|
-
border:
|
|
55
|
+
border-radius: 4px;
|
|
27
56
|
}
|
|
28
57
|
.form-render__linebarItem {
|
|
29
58
|
display: grid !important;
|
|
30
59
|
grid-template-columns: repeat(var(--column), minmax(0px, 1fr));
|
|
31
|
-
gap: 0
|
|
60
|
+
gap: 0 16px;
|
|
32
61
|
}
|
|
33
62
|
.form-render__inputGroup {
|
|
34
63
|
grid-column: span var(--column) / span var(--column);
|
|
@@ -91,9 +120,18 @@
|
|
|
91
120
|
.form-render__complexContent--grid {
|
|
92
121
|
display: grid !important;
|
|
93
122
|
grid-template-columns: repeat(var(--column), minmax(0px, 1fr));
|
|
94
|
-
gap: 0
|
|
123
|
+
gap: 0 16px;
|
|
95
124
|
}
|
|
96
125
|
.form-render__complexContent--flex {
|
|
97
126
|
display: flex !important;
|
|
98
127
|
gap: 0 8px;
|
|
99
128
|
}
|
|
129
|
+
.form-render .n-form-item-label {
|
|
130
|
+
display: inline-flex;
|
|
131
|
+
}
|
|
132
|
+
.form-render .n-form-item-label [form-item-hover-show='true'] {
|
|
133
|
+
visibility: hidden;
|
|
134
|
+
}
|
|
135
|
+
.form-render .n-form-item-label:hover [form-item-hover-show='true'] {
|
|
136
|
+
visibility: visible;
|
|
137
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function useNuiThemeOverrides() {
|
|
2
|
+
const nuiThemeOverrides = {
|
|
3
|
+
Input: { paddingMedium: "8px", paddingSmall: "8px", paddingLarge: "8px", paddingTiny: "8px" },
|
|
4
|
+
InternalSelection: { paddingSingle: "8px", paddingMultiple: "8px" },
|
|
5
|
+
Form: {
|
|
6
|
+
feedbackHeightMedium: "16px",
|
|
7
|
+
feedbackHeightLarge: "16px",
|
|
8
|
+
feedbackHeightSmall: "16px",
|
|
9
|
+
feedbackFontSizeLarge: "12px",
|
|
10
|
+
feedbackFontSizeMedium: "12px",
|
|
11
|
+
feedbackFontSizeSmall: "12px",
|
|
12
|
+
feedbackPadding: "0px"
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
return { nuiThemeOverrides };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { useNuiThemeOverrides };
|