cnhis-design-vue 3.1.32 → 3.1.33-beta.0
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/components/form-render/index.js +1 -1
- package/es/components/form-render/src/FormRender.vue.js +1 -0
- package/es/components/form-render/src/components/renderer/checkbox.js +1 -1
- package/es/components/form-render/src/components/renderer/index.js +0 -6
- package/es/components/form-render/src/components/renderer/radio.js +1 -1
- package/es/components/form-render/src/components/renderer/searchCascade.d.ts +1 -1
- package/es/components/form-render/src/components/renderer/searchCascade.js +3 -2
- package/es/components/form-render/src/components/renderer/select.d.ts +97 -7
- package/es/components/form-render/src/components/renderer/select.js +64 -61
- package/es/components/form-render/src/hooks/index.d.ts +1 -1
- package/es/components/form-render/src/hooks/index.js +1 -1
- package/es/components/form-render/src/hooks/useBusinessBinding.d.ts +3 -3
- package/es/components/form-render/src/hooks/useBusinessBinding.js +15 -9
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +2 -10
- package/es/components/form-render/src/hooks/useFieldNormalize.js +2 -1
- package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +41 -0
- package/es/components/form-render/src/hooks/useFormRenderOptions.js +230 -0
- package/es/components/index.d.ts +1 -0
- package/es/components/index.js +2 -1
- package/es/components/insurance-sdk/index.d.ts +1 -0
- package/es/components/insurance-sdk/index.js +1 -0
- package/es/components/insurance-sdk/src/constants/index.d.ts +161 -0
- package/es/components/insurance-sdk/src/constants/index.js +160 -0
- package/es/components/insurance-sdk/src/utils/index.d.ts +1 -0
- package/es/components/insurance-sdk/src/utils/index.js +1 -0
- package/es/components/insurance-sdk/src/utils/insurance.d.ts +260 -0
- package/es/components/insurance-sdk/src/utils/insurance.js +268 -0
- package/es/components/recommend-search/index.d.ts +1 -1
- package/es/components/recommend-search/src/RecommendSearch.vue.d.ts +1 -1
- package/es/components/recommend-search/src/components/BaseSearch.vue.js +5 -5
- package/es/components/recommend-search/src/components/RecommendInput.vue.d.ts +1 -0
- package/es/components/recommend-search/src/components/RecommendInput.vue.js +6 -0
- package/es/components/recommend-search/src/components/RecommendMenu.vue.js +12 -12
- package/es/components/recommend-search/src/components/RecommendSelect.vue.d.ts +0 -1
- package/es/components/recommend-search/src/components/RecommendSelect.vue.js +2 -11
- package/es/shared/utils/index.d.ts +1 -0
- package/es/shared/utils/index.js +11 -1
- package/package.json +2 -2
- package/es/components/form-render/src/components/renderer/labelSelect.d.ts +0 -1
- package/es/components/form-render/src/components/renderer/labelSelect.js +0 -18
- package/es/components/form-render/src/components/renderer/recommendSelect.d.ts +0 -131
- package/es/components/form-render/src/components/renderer/recommendSelect.js +0 -213
- package/es/components/form-render/src/components/renderer/search.d.ts +0 -86
- package/es/components/form-render/src/components/renderer/search.js +0 -112
- package/es/components/form-render/src/hooks/useAutographOptions.d.ts +0 -17
- package/es/components/form-render/src/hooks/useAutographOptions.js +0 -68
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { defineComponent, inject, createVNode } from 'vue';
|
|
2
|
-
import { useVModel } from '@vueuse/core';
|
|
3
|
-
import { cloneDeep } from 'lodash-es';
|
|
4
|
-
import { InjectionChangeContextCollector } from '../../constants/index.js';
|
|
5
|
-
import '../../../../../shared/utils/index.js';
|
|
6
|
-
import '../../../index.js';
|
|
7
|
-
import '../../utils/index.js';
|
|
8
|
-
import { useFormField } from '../../hooks/useFormField.js';
|
|
9
|
-
import '../../../../../shared/utils/tapable/SyncHook.js';
|
|
10
|
-
import '../../../../../shared/utils/tapable/SyncBailHook.js';
|
|
11
|
-
import '../../../../../shared/utils/tapable/SyncWaterfallHook.js';
|
|
12
|
-
import '../../../../../shared/utils/tapable/SyncLoopHook.js';
|
|
13
|
-
import '../../../../../shared/utils/tapable/AsyncParallelHook.js';
|
|
14
|
-
import '../../../../../shared/utils/tapable/AsyncParallelBailHook.js';
|
|
15
|
-
import '../../../../../shared/utils/tapable/AsyncSeriesHook.js';
|
|
16
|
-
import '../../../../../shared/utils/tapable/AsyncSeriesBailHook.js';
|
|
17
|
-
import '../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js';
|
|
18
|
-
import '../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js';
|
|
19
|
-
import '../../hooks/useFormValidator.js';
|
|
20
|
-
import '@formily/core';
|
|
21
|
-
import { useAutographOptions } from '../../hooks/useAutographOptions.js';
|
|
22
|
-
import '@vue/shared';
|
|
23
|
-
import { connect, mapProps } from '@formily/vue';
|
|
24
|
-
import './index.js';
|
|
25
|
-
import { useCommonInjection, useSelectOptionProps } from '../../hooks/useCommonInjection.js';
|
|
26
|
-
import { NSelect } from 'naive-ui';
|
|
27
|
-
import { visitedDecorator, assignUpdateValue, assignClearBindVisited } from '../../utils/schema.js';
|
|
28
|
-
|
|
29
|
-
const script = defineComponent({
|
|
30
|
-
name: "FormSearch",
|
|
31
|
-
props: {
|
|
32
|
-
value: {
|
|
33
|
-
type: String
|
|
34
|
-
},
|
|
35
|
-
autograph: {
|
|
36
|
-
type: String,
|
|
37
|
-
required: true
|
|
38
|
-
},
|
|
39
|
-
lazyRequest: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: true
|
|
42
|
-
},
|
|
43
|
-
requestCache: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: true
|
|
46
|
-
},
|
|
47
|
-
wordbook: {
|
|
48
|
-
type: Object,
|
|
49
|
-
required: true
|
|
50
|
-
},
|
|
51
|
-
onFocus: {
|
|
52
|
-
type: Function
|
|
53
|
-
},
|
|
54
|
-
onChange: {}
|
|
55
|
-
},
|
|
56
|
-
emits: ["update:value"],
|
|
57
|
-
setup(props, {
|
|
58
|
-
slots,
|
|
59
|
-
emit
|
|
60
|
-
}) {
|
|
61
|
-
const valueRef = useVModel(props, "value", emit);
|
|
62
|
-
const {
|
|
63
|
-
field,
|
|
64
|
-
fieldKey
|
|
65
|
-
} = useFormField();
|
|
66
|
-
const {
|
|
67
|
-
fetchData,
|
|
68
|
-
labelKey,
|
|
69
|
-
valueKey,
|
|
70
|
-
options
|
|
71
|
-
} = useAutographOptions(props, valueRef);
|
|
72
|
-
const changeContextCollector = inject(InjectionChangeContextCollector);
|
|
73
|
-
changeContextCollector.setContext(fieldKey.value, (v) => {
|
|
74
|
-
return {
|
|
75
|
-
currentOption: cloneDeep(getCurrentOption(v))
|
|
76
|
-
};
|
|
77
|
-
function getCurrentOption(v2) {
|
|
78
|
-
return options.value.find((option) => option[valueKey.value] === v2);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
const {
|
|
82
|
-
injectValueValidate,
|
|
83
|
-
injectValueWatchFromEmpty,
|
|
84
|
-
injectValueBindKey
|
|
85
|
-
} = useCommonInjection();
|
|
86
|
-
injectValueWatchFromEmpty(valueRef, fetchData);
|
|
87
|
-
injectValueValidate(valueRef);
|
|
88
|
-
const key = injectValueBindKey(valueRef);
|
|
89
|
-
const {
|
|
90
|
-
menuProps,
|
|
91
|
-
nodeProps
|
|
92
|
-
} = useSelectOptionProps();
|
|
93
|
-
return () => createVNode(NSelect, {
|
|
94
|
-
"remote": true,
|
|
95
|
-
"filterable": true,
|
|
96
|
-
"key": key.value,
|
|
97
|
-
"value": valueRef.value,
|
|
98
|
-
"onUpdate:value": ($event) => valueRef.value = $event,
|
|
99
|
-
"menu-props": menuProps,
|
|
100
|
-
"node-props": nodeProps,
|
|
101
|
-
"labelField": labelKey.value,
|
|
102
|
-
"valueField": valueKey.value,
|
|
103
|
-
"options": options.value,
|
|
104
|
-
"onSearch": fetchData,
|
|
105
|
-
"onUpdate:show": (show) => show && fetchData(),
|
|
106
|
-
"onFocus": visitedDecorator(field, props.onFocus)
|
|
107
|
-
}, slots);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
const SEARCH = connect(script, mapProps(assignUpdateValue, assignClearBindVisited));
|
|
111
|
-
|
|
112
|
-
export { SEARCH };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AnyObject } from '../../../../../es/shared/types';
|
|
2
|
-
import { Ref } from 'vue';
|
|
3
|
-
import { FormWordbook } from '../../../../../es/components/form-render';
|
|
4
|
-
export declare function useAutographOptions(props: {
|
|
5
|
-
requestCache?: boolean;
|
|
6
|
-
wordbook?: FormWordbook;
|
|
7
|
-
autograph?: string;
|
|
8
|
-
lazyRequest?: boolean;
|
|
9
|
-
options?: AnyObject[];
|
|
10
|
-
}, valueRef: Ref): {
|
|
11
|
-
valueRef: Ref<any>;
|
|
12
|
-
options: import("vue").ComputedRef<AnyObject[]>;
|
|
13
|
-
fetchData: (content?: string) => Promise<void>;
|
|
14
|
-
labelKey: import("vue").ComputedRef<string>;
|
|
15
|
-
valueKey: import("vue").ComputedRef<string>;
|
|
16
|
-
lastSearch: Ref<string>;
|
|
17
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { useDebounceFn } from '@vueuse/core';
|
|
2
|
-
import { isString, isEqual } from 'lodash-es';
|
|
3
|
-
import { getCurrentInstance, inject, computed, ref, watch } from 'vue';
|
|
4
|
-
import '../../index.js';
|
|
5
|
-
import { InjectionAsyncQueue } from '../constants/index.js';
|
|
6
|
-
import { formRenderLog, optionMatcherWithKeyword } from '../utils/index.js';
|
|
7
|
-
import { useFormField } from './useFormField.js';
|
|
8
|
-
import { useFormRequest } from './useFormRequest.js';
|
|
9
|
-
|
|
10
|
-
function useAutographOptions(props, valueRef) {
|
|
11
|
-
if (!getCurrentInstance())
|
|
12
|
-
throw new Error("can't use this hook out of setup environment");
|
|
13
|
-
const asyncQueue = inject(InjectionAsyncQueue);
|
|
14
|
-
const labelKey = computed(() => {
|
|
15
|
-
var _a, _b, _c;
|
|
16
|
-
return (_c = (_b = (_a = props.wordbook) == null ? void 0 : _a.render_key) == null ? void 0 : _b[0]) != null ? _c : "text";
|
|
17
|
-
});
|
|
18
|
-
const valueKey = computed(() => {
|
|
19
|
-
var _a, _b;
|
|
20
|
-
return (_b = (_a = props.wordbook) == null ? void 0 : _a.value_key) != null ? _b : "value";
|
|
21
|
-
});
|
|
22
|
-
const remoteOptions = ref(null);
|
|
23
|
-
const lastSearch = ref("");
|
|
24
|
-
const { fieldKey } = useFormField();
|
|
25
|
-
const { getSearchRequestInfo } = useFormRequest();
|
|
26
|
-
const fetchData = useDebounceFn(async function(content) {
|
|
27
|
-
if (!props.autograph || !props.wordbook)
|
|
28
|
-
return;
|
|
29
|
-
lastSearch.value = content || "";
|
|
30
|
-
try {
|
|
31
|
-
remoteOptions.value = await asyncQueue.addAsync(
|
|
32
|
-
createParams(props.wordbook, props.autograph, fieldKey.value)
|
|
33
|
-
);
|
|
34
|
-
} catch (e) {
|
|
35
|
-
isString(e) && formRenderLog(e);
|
|
36
|
-
}
|
|
37
|
-
function createParams(wordbook, autograph, key) {
|
|
38
|
-
const params = {
|
|
39
|
-
autograph,
|
|
40
|
-
wordbookId: wordbook.id,
|
|
41
|
-
wordbookType: wordbook.type,
|
|
42
|
-
fieldKeys: wordbook.search_key,
|
|
43
|
-
keyword: "",
|
|
44
|
-
page: 1
|
|
45
|
-
};
|
|
46
|
-
return { ...getSearchRequestInfo(), params, key, cache: props.requestCache };
|
|
47
|
-
}
|
|
48
|
-
}, 300);
|
|
49
|
-
const options = computed(() => {
|
|
50
|
-
var _a;
|
|
51
|
-
return remoteOptions.value ? optionMatcherWithKeyword(remoteOptions.value, lastSearch.value, labelKey.value) : (_a = props.options) != null ? _a : [];
|
|
52
|
-
});
|
|
53
|
-
watch(
|
|
54
|
-
() => props.wordbook,
|
|
55
|
-
(wordbook, oldWordbook) => {
|
|
56
|
-
if (isEqual(wordbook, oldWordbook))
|
|
57
|
-
return;
|
|
58
|
-
remoteOptions.value = null;
|
|
59
|
-
if (!wordbook)
|
|
60
|
-
return;
|
|
61
|
-
(valueRef.value || !props.lazyRequest) && fetchData();
|
|
62
|
-
},
|
|
63
|
-
{ immediate: true }
|
|
64
|
-
);
|
|
65
|
-
return { valueRef, options, fetchData, labelKey, valueKey, lastSearch };
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { useAutographOptions };
|