cnhis-design-vue 3.1.39 → 3.1.40-release.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.
Files changed (38) hide show
  1. package/es/components/button-print/index.d.ts +1 -16
  2. package/es/components/button-print/src/ButtonPrint.vue.d.ts +1 -16
  3. package/es/components/button-print/src/ButtonPrint.vue2.js +6 -37
  4. package/es/components/button-print/src/utils/print.d.ts +0 -1
  5. package/es/components/button-print/src/utils/print.js +0 -10
  6. package/es/components/form-render/index.js +2 -2
  7. package/es/components/form-render/src/components/renderer/lineBar/FormCollapse.vue.d.ts +0 -3
  8. package/es/components/form-render/src/components/renderer/lineBar/FormCollapse.vue.js +4 -9
  9. package/es/components/form-render/src/components/renderer/lineBar/index.d.ts +0 -3
  10. package/es/components/form-render/src/components/renderer/select.js +8 -26
  11. package/es/components/form-render/src/hooks/index.js +1 -1
  12. package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +3 -4
  13. package/es/components/form-render/src/hooks/useFormRenderOptions.js +13 -53
  14. package/es/components/form-render/src/utils/index.d.ts +4 -2
  15. package/es/components/form-render/src/utils/index.js +15 -1
  16. package/es/components/form-render/style/index.css +1 -1
  17. package/es/components/iho-table/index.d.ts +119 -119
  18. package/es/components/iho-table/src/IhoTable.vue.d.ts +119 -119
  19. package/es/components/iho-table/src/IhoTable.vue.js +6 -6
  20. package/es/components/iho-table/src/hooks/tapHooks/index.d.ts +62 -60
  21. package/es/components/iho-table/src/hooks/tapHooks/index.js +6 -2
  22. package/es/components/iho-table/src/hooks/tapHooks/useEventHooks.d.ts +1 -1
  23. package/es/components/iho-table/src/hooks/tapHooks/useEventHooks.js +2 -2
  24. package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +0 -1
  25. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/index.js +1 -4
  26. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +1 -1
  27. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +5 -6
  28. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin.js +1 -1
  29. package/es/components/iho-table/src/types/index.d.ts +0 -1
  30. package/es/components/index.css +1 -1
  31. package/es/components/index.js +2 -2
  32. package/es/components/keyboard/index.d.ts +0 -4
  33. package/es/components/keyboard/src/Keyboard.vue.d.ts +0 -4
  34. package/es/components/keyboard/src/Keyboard.vue.js +2 -10
  35. package/es/components/keyboard/src/components/InputNumber.vue.d.ts +1 -3
  36. package/es/components/keyboard/src/components/InputNumber.vue.js +1 -13
  37. package/es/components/keyboard/src/components/NumberPanel.vue.d.ts +0 -2
  38. package/package.json +2 -2
@@ -64,10 +64,6 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
64
64
  type: StringConstructor;
65
65
  default: string;
66
66
  };
67
- directPrint: {
68
- type: BooleanConstructor;
69
- default: boolean;
70
- };
71
67
  }, {
72
68
  $message: import("naive-ui").MessageApi;
73
69
  printInstance: import("./src/utils").Print | null;
@@ -134,10 +130,6 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
134
130
  type: StringConstructor;
135
131
  default: string;
136
132
  };
137
- directPrint: {
138
- type: BooleanConstructor;
139
- default: boolean;
140
- };
141
133
  }>> & {
142
134
  onError?: ((...args: any[]) => any) | undefined;
143
135
  onSuccess?: ((...args: any[]) => any) | undefined;
@@ -162,7 +154,6 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
162
154
  currentFormatItem: import("vue").ComputedRef<{} | undefined>;
163
155
  formatTitle: import("vue").ComputedRef<any>;
164
156
  getTemplateIdByFormatId: import("vue").ComputedRef<any>;
165
- buttonClick: (origin: string) => Promise<false | undefined>;
166
157
  renderLabel: (option: import("naive-ui").MenuOption) => JSX.Element;
167
158
  callLocalServicesSuccessCb: (res: any, type: any) => void;
168
159
  callLocalServicesErrorCb: (res: unknown) => void;
@@ -188,10 +179,9 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
188
179
  }, params?: any[]) => any;
189
180
  initCRM: (formatListResult: any) => Promise<boolean | undefined>;
190
181
  init: () => Promise<boolean>;
191
- handleClickBtn: (visible?: boolean) => Promise<false | undefined>;
182
+ handleClickBtn: () => Promise<false | undefined>;
192
183
  reformatPrintParams: () => void;
193
184
  verifiySuccess: (token: string) => void;
194
- directPrint: () => Promise<void>;
195
185
  NDropdown: any;
196
186
  NButton: any;
197
187
  NIcon: any;
@@ -1888,10 +1878,6 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1888
1878
  type: StringConstructor;
1889
1879
  default: string;
1890
1880
  };
1891
- directPrint: {
1892
- type: BooleanConstructor;
1893
- default: boolean;
1894
- };
1895
1881
  }>> & {
1896
1882
  onError?: ((...args: any[]) => any) | undefined;
1897
1883
  onSuccess?: ((...args: any[]) => any) | undefined;
@@ -1911,6 +1897,5 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
1911
1897
  noDataMsg: string;
1912
1898
  printdlgshow: string;
1913
1899
  btnprint: string;
1914
- directPrint: boolean;
1915
1900
  }>>;
1916
1901
  export default ButtonPrint;
@@ -69,10 +69,6 @@ declare const _default: import("vue").DefineComponent<{
69
69
  type: StringConstructor;
70
70
  default: string;
71
71
  };
72
- directPrint: {
73
- type: BooleanConstructor;
74
- default: boolean;
75
- };
76
72
  }, {
77
73
  $message: import("naive-ui").MessageApi;
78
74
  printInstance: Print | null;
@@ -142,10 +138,6 @@ declare const _default: import("vue").DefineComponent<{
142
138
  type: StringConstructor;
143
139
  default: string;
144
140
  };
145
- directPrint: {
146
- type: BooleanConstructor;
147
- default: boolean;
148
- };
149
141
  }>> & {
150
142
  onError?: ((...args: any[]) => any) | undefined;
151
143
  onSuccess?: ((...args: any[]) => any) | undefined;
@@ -170,7 +162,6 @@ declare const _default: import("vue").DefineComponent<{
170
162
  currentFormatItem: import("vue").ComputedRef<{} | undefined>;
171
163
  formatTitle: import("vue").ComputedRef<any>;
172
164
  getTemplateIdByFormatId: import("vue").ComputedRef<any>;
173
- buttonClick: (origin: string) => Promise<false | undefined>;
174
165
  renderLabel: (option: DropdownOption) => JSX.Element;
175
166
  callLocalServicesSuccessCb: (res: any, type: any) => void;
176
167
  callLocalServicesErrorCb: (res: unknown) => void;
@@ -196,10 +187,9 @@ declare const _default: import("vue").DefineComponent<{
196
187
  }, params?: any[]) => any;
197
188
  initCRM: (formatListResult: any) => Promise<boolean | undefined>;
198
189
  init: () => Promise<boolean>;
199
- handleClickBtn: (visible?: boolean) => Promise<false | undefined>;
190
+ handleClickBtn: () => Promise<false | undefined>;
200
191
  reformatPrintParams: () => void;
201
192
  verifiySuccess: (token: string) => void;
202
- directPrint: () => Promise<void>;
203
193
  NDropdown: any;
204
194
  NButton: any;
205
195
  NIcon: any;
@@ -1899,10 +1889,6 @@ declare const _default: import("vue").DefineComponent<{
1899
1889
  type: StringConstructor;
1900
1890
  default: string;
1901
1891
  };
1902
- directPrint: {
1903
- type: BooleanConstructor;
1904
- default: boolean;
1905
- };
1906
1892
  }>> & {
1907
1893
  onError?: ((...args: any[]) => any) | undefined;
1908
1894
  onSuccess?: ((...args: any[]) => any) | undefined;
@@ -1922,6 +1908,5 @@ declare const _default: import("vue").DefineComponent<{
1922
1908
  noDataMsg: string;
1923
1909
  printdlgshow: string;
1924
1910
  btnprint: string;
1925
- directPrint: boolean;
1926
1911
  }>;
1927
1912
  export default _default;
@@ -71,15 +71,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
71
71
  btnprint: {
72
72
  type: String,
73
73
  default: "1"
74
- },
75
- directPrint: {
76
- type: Boolean,
77
- default: false
78
74
  }
79
75
  },
80
76
  emits: ["success", "error", "clickoutside"],
81
77
  setup(__props, {
82
- expose,
83
78
  emit
84
79
  }) {
85
80
  const props = __props;
@@ -123,19 +118,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
123
118
  let find = state.formatList.find((item) => item.id === state.currentFormatId);
124
119
  return find == null ? void 0 : find.templateId;
125
120
  });
126
- const buttonClick = async (origin) => {
127
- if (props.directPrint) {
128
- if (state.spinning)
129
- return;
130
- if (origin === "button") {
131
- await directPrint();
132
- return;
133
- } else {
134
- return handleClickBtn();
135
- }
136
- }
137
- return handleClickBtn();
138
- };
139
121
  const renderLabel = (option) => {
140
122
  return createVNode("span", {
141
123
  "class": {
@@ -420,7 +402,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
420
402
  state.spinning = false;
421
403
  return true;
422
404
  };
423
- const handleClickBtn = async (visible = true) => {
405
+ const handleClickBtn = async () => {
424
406
  var _a;
425
407
  const status = await props.clickPrevFn();
426
408
  if (!status)
@@ -434,9 +416,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
434
416
  if (!result)
435
417
  return false;
436
418
  }
437
- if (visible) {
438
- state.visible = !state.visible;
439
- }
419
+ state.visible = !state.visible;
440
420
  };
441
421
  const reformatPrintParams = () => {
442
422
  state.watchPrintParamsReformatFn && state.watchPrintParamsReformatFn();
@@ -477,13 +457,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
477
457
  }, {
478
458
  deep: true
479
459
  });
480
- async function directPrint() {
481
- await handleClickBtn(false);
482
- handleClickPrint();
483
- }
484
- expose({
485
- directPrint
486
- });
487
460
  return (_ctx, _cache) => {
488
461
  return openBlock(), createElementBlock(Fragment, null, [createVNode(unref(NDropdown), {
489
462
  class: "c-dropdown",
@@ -502,21 +475,17 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
502
475
  printVisible: state.visible
503
476
  }, () => [createVNode(unref(NButton), {
504
477
  class: "dropdown-button",
505
- onClick: _cache[1] || (_cache[1] = withModifiers(() => buttonClick("button"), ["stop"]))
478
+ onClick: withModifiers(handleClickBtn, ["stop"])
506
479
  }, {
507
480
  default: withCtx(() => [createCommentVNode(' <n-spin v-show="state.spinning" size="small"></n-spin> '), createTextVNode(toDisplayString(__props.btnText) + " ", 1), createVNode(unref(NIcon), {
508
- component: unref(ChevronDown),
509
- style: {
510
- "margin-left": "5px"
511
- },
512
- onClick: _cache[0] || (_cache[0] = withModifiers(() => buttonClick("icon"), ["stop"]))
481
+ component: unref(ChevronDown)
513
482
  }, null, 8, ["component"])]),
514
483
  _: 1
515
- })])]),
484
+ }, 8, ["onClick"])])]),
516
485
  _: 3
517
486
  }, 8, ["show", "options"]), createVNode(IdentityVerification, mergeProps(_ctx.$attrs, {
518
487
  modelValue: state.identityVerification.visible,
519
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => state.identityVerification.visible = $event),
488
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => state.identityVerification.visible = $event),
520
489
  formatId: state.currentFormatId,
521
490
  templateId: unref(getTemplateIdByFormatId),
522
491
  onSuccess: verifiySuccess
@@ -6,7 +6,6 @@ export declare class Print {
6
6
  private dialog;
7
7
  private dialogPreview;
8
8
  private instance;
9
- private downloadPath;
10
9
  constructor();
11
10
  private readonly messageHandlerQueue;
12
11
  private messageHandler;
@@ -27,7 +27,6 @@ class Print {
27
27
  this.dialog = new IdentityVerificationDialog();
28
28
  this.dialogPreview = new PreviewDialog();
29
29
  this.instance = null;
30
- this.downloadPath = "";
31
30
  this.messageHandlerQueue = [];
32
31
  var _a;
33
32
  const _window = window;
@@ -36,19 +35,13 @@ class Print {
36
35
  return;
37
36
  this.currentMessageHandler = this.messageHandler.bind(this);
38
37
  this.webview.addEventListener("message", this.currentMessageHandler);
39
- this.postMessage({ exec: "config", data: "" });
40
38
  }
41
39
  messageHandler(e) {
42
- var _a;
43
40
  const handler = this.messageHandlerQueue.pop();
44
41
  if (!handler)
45
42
  return console.log("\u5F53\u524D\u56DE\u6267", e, "\u6CA1\u6709\u53EF\u7528\u7684handler");
46
43
  const { resolve, reject } = handler;
47
44
  try {
48
- const { exec } = JSON.parse(e.data);
49
- if (exec === "config") {
50
- this.downloadPath = ((_a = JSON.parse(e.data).res) == null ? void 0 : _a.downloadpath) || "";
51
- }
52
45
  console.log(e);
53
46
  resolve(JSON.parse(e.data).res);
54
47
  } catch (e2) {
@@ -318,9 +311,6 @@ class Print {
318
311
  return httpFn.get(PDF_URL, { params: { inputData } }).then(({ data }) => data);
319
312
  }
320
313
  downloadPDF(params, onResolve, onReject) {
321
- if (this.webview && this.downloadPath) {
322
- params.print.filename = this.downloadPath.replace(/\\/g, "/");
323
- }
324
314
  this.printDirect(
325
315
  params,
326
316
  async (res) => {
@@ -15,8 +15,8 @@ export { FormItemDepsCollector, useFormItemDeps } from './src/hooks/useFormItemD
15
15
  export { useAnchor } from './src/hooks/useAnchor.js';
16
16
  export { useFormContext } from './src/hooks/useFormContext.js';
17
17
  export { useCommonInjection, useSelectOptionProps } from './src/hooks/useCommonInjection.js';
18
- export { optionMatcherCache, useAutographOptions, useRecommendOptions, useUrlConfigOptions } from './src/hooks/useFormRenderOptions.js';
19
- export { combineExtendKey, createInputSlot, createSlot, createUrlConfigParams, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, keywordMatcher, mergeDeepProperties, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser } from './src/utils/index.js';
18
+ export { useAutographOptions, useRecommendOptions, useUrlConfigOptions } from './src/hooks/useFormRenderOptions.js';
19
+ export { combineExtendKey, createInputSlot, createSlot, createUrlConfigParams, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcherWithKeyword, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser } from './src/utils/index.js';
20
20
  export * from '@formily/core';
21
21
  export { businessDateParser, isIdCard, isMobile, parseAge2Birthday, parseAgeFromContext, parseBirthday, parseIdCard, transformDateFormat } from './src/utils/business.js';
22
22
  export { findNextWidget, queryDecorator, queryInput } from './src/utils/dom.js';
@@ -30,9 +30,6 @@ declare const _default: import("vue").DefineComponent<{
30
30
  }>> & {}>>;
31
31
  _show: import("vue").Ref<boolean>;
32
32
  toggleShow: () => void;
33
- headerClass: import("vue").ComputedRef<(string | {
34
- 'form-render__linebarHeader--disabled': boolean;
35
- })[]>;
36
33
  fieldKey: import("vue").ComputedRef<string>;
37
34
  formItemDepsCollector: import("../../../../../../../es/components/form-render").FormItemDepsCollector;
38
35
  TooltipMessage: import("vue").DefineComponent<{
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, computed, inject, openBlock, createElementBlock, createElementVNode, normalizeClass, unref, createTextVNode, toDisplayString, createBlock, createCommentVNode, Fragment, createVNode, withCtx, renderSlot } from 'vue';
1
+ import { defineComponent, ref, inject, openBlock, createElementBlock, createElementVNode, createTextVNode, toDisplayString, createBlock, createCommentVNode, unref, createVNode, withCtx, renderSlot } from 'vue';
2
2
  import '../../../../index.js';
3
3
  import TooltipMessage from '../../tooltipMessage.vue.js';
4
4
  import { InjectionFormItemDepsCollector, FormItemLineBarDepKeyPrepend } from '../../../constants/index.js';
@@ -28,9 +28,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
28
28
  return;
29
29
  _show.value = !_show.value;
30
30
  }
31
- const headerClass = computed(() => {
32
- return ["form-render__linebarHeader", { "form-render__linebarHeader--disabled": !!props.disabled }];
33
- });
34
31
  const { fieldKey } = useFormField();
35
32
  const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
36
33
  formItemDepsCollector.setDeps(fieldKey.value, FormItemLineBarDepKeyPrepend + fieldKey.value, (v = true) => {
@@ -39,7 +36,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
39
36
  return (_ctx, _cache) => {
40
37
  return openBlock(), createElementBlock("section", _hoisted_1, [
41
38
  createElementVNode("header", {
42
- class: normalizeClass(unref(headerClass)),
39
+ class: "form-render__linebarHeader",
43
40
  onClick: toggleShow
44
41
  }, [
45
42
  createElementVNode("div", _hoisted_2, [
@@ -49,10 +46,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49
46
  message: __props.remark
50
47
  }, null, 8, ["message"])) : createCommentVNode("v-if", true)
51
48
  ]),
52
- !__props.disabled ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
53
- _show.value ? (openBlock(), createBlock(unref(ChevronDown), { key: 0 })) : (openBlock(), createBlock(unref(ChevronUp), { key: 1 }))
54
- ], 64)) : createCommentVNode("v-if", true)
55
- ], 2),
49
+ _show.value ? (openBlock(), createBlock(unref(ChevronDown), { key: 0 })) : (openBlock(), createBlock(unref(ChevronUp), { key: 1 }))
50
+ ]),
56
51
  createVNode(unref(NCollapseTransition), {
57
52
  class: "form-render__linebarItem",
58
53
  show: _show.value
@@ -30,9 +30,6 @@ export declare const LINEBAR: import("vue").DefineComponent<{
30
30
  }>> & {}>>;
31
31
  _show: import("vue").Ref<boolean>;
32
32
  toggleShow: () => void;
33
- headerClass: import("vue").ComputedRef<(string | {
34
- 'form-render__linebarHeader--disabled': boolean;
35
- })[]>;
36
33
  fieldKey: import("vue").ComputedRef<string>;
37
34
  formItemDepsCollector: import("../../../hooks").FormItemDepsCollector;
38
35
  TooltipMessage: import("vue").DefineComponent<{
@@ -1,12 +1,12 @@
1
1
  import { defineComponent, computed, inject, createVNode } from 'vue';
2
- import { useDebounceFn } from '@vueuse/core';
3
- import { cloneDeep, isString } from 'lodash-es';
2
+ import { cloneDeep } from 'lodash-es';
4
3
  import { useCommonInjection, useSelectOptionProps } from '../../hooks/useCommonInjection.js';
5
4
  import { InjectionChangeContextCollector } from '../../constants/index.js';
6
5
  import '../../../../../shared/utils/index.js';
7
6
  import '../../../index.js';
8
7
  import '../../utils/index.js';
9
8
  import { useFormField } from '../../hooks/useFormField.js';
9
+ import '@vueuse/core';
10
10
  import '../../../../../shared/utils/tapable/SyncHook.js';
11
11
  import '../../../../../shared/utils/tapable/SyncBailHook.js';
12
12
  import '../../../../../shared/utils/tapable/SyncWaterfallHook.js';
@@ -23,7 +23,7 @@ import 'date-fns';
23
23
  import { connect, mapProps } from '@formily/vue';
24
24
  import '@vue/shared';
25
25
  import './index.js';
26
- import { useUrlConfigOptions, useAutographOptions, useRecommendOptions, optionMatcherCache } from '../../hooks/useFormRenderOptions.js';
26
+ import { useUrlConfigOptions, useAutographOptions, useRecommendOptions } from '../../hooks/useFormRenderOptions.js';
27
27
  import { NSelect } from 'naive-ui';
28
28
  import { createVisitedSetter, assignUpdateValue, assignClearBindVisited } from '../../utils/schema.js';
29
29
 
@@ -101,7 +101,7 @@ const script = defineComponent({
101
101
  getRecommend,
102
102
  postRecommend,
103
103
  sortedOptions
104
- } = useRecommendOptions(props, options, emit, labelKey, valueKey);
104
+ } = useRecommendOptions(props, options, emit, valueKey);
105
105
  const {
106
106
  field,
107
107
  fieldKey
@@ -115,10 +115,10 @@ const script = defineComponent({
115
115
  return sortedOptions.value.find((option) => option[valueKey.value] === v2);
116
116
  }
117
117
  });
118
- const fetchData = useDebounceFn(async (content = "") => {
118
+ async function fetchData(content = "") {
119
119
  fetchOptions(content);
120
- getRecommend(content);
121
- }, 400);
120
+ getRecommend();
121
+ }
122
122
  const {
123
123
  injectValueValidate,
124
124
  injectValueWatchFromEmpty,
@@ -131,23 +131,6 @@ const script = defineComponent({
131
131
  menuProps,
132
132
  nodeProps
133
133
  } = useSelectOptionProps();
134
- function renderLabel(option) {
135
- const label = option[labelKey.value];
136
- if (!label || !isString(label))
137
- return "";
138
- const renderLabels = optionMatcherCache.get(option);
139
- if (!renderLabels)
140
- return label;
141
- return createVNode("section", null, [renderLabels.map((chars, idx) => {
142
- if (idx === 0 || !chars)
143
- return null;
144
- return createVNode("span", {
145
- "style": {
146
- color: idx % 2 === 0 ? "var(--n-option-text-color-active)" : ""
147
- }
148
- }, [chars]);
149
- })]);
150
- }
151
134
  return () => createVNode(NSelect, {
152
135
  "key": key.value,
153
136
  "remote": true,
@@ -161,8 +144,7 @@ const script = defineComponent({
161
144
  "options": sortedOptions.value,
162
145
  "onSearch": fetchData,
163
146
  "onUpdate:show": (show) => show && fetchData(),
164
- "onFocus": createVisitedSetter(field),
165
- "renderLabel": renderLabel
147
+ "onFocus": createVisitedSetter(field)
166
148
  }, slots);
167
149
  }
168
150
  });
@@ -12,4 +12,4 @@ export { FormItemDepsCollector, useFormItemDeps } from './useFormItemDeps.js';
12
12
  export { useAnchor } from './useAnchor.js';
13
13
  export { useFormContext } from './useFormContext.js';
14
14
  export { useCommonInjection, useSelectOptionProps } from './useCommonInjection.js';
15
- export { optionMatcherCache, useAutographOptions, useRecommendOptions, useUrlConfigOptions } from './useFormRenderOptions.js';
15
+ export { useAutographOptions, useRecommendOptions, useUrlConfigOptions } from './useFormRenderOptions.js';
@@ -2,7 +2,6 @@ import { AnyObject, Func } from '../../../../../es/shared/types';
2
2
  import { Ref } from 'vue';
3
3
  import { FormWordbook, RecommendIds, UrlConfig } from '../../../../../es/components/form-render';
4
4
  import { RecommendItem } from '../../../../../es/components/recommend-search/src/types';
5
- export declare const optionMatcherCache: WeakMap<AnyObject, string[]>;
6
5
  export declare function useRecommendOptions(props: {
7
6
  recommend: boolean;
8
7
  commonList?: RecommendItem[];
@@ -10,10 +9,10 @@ export declare function useRecommendOptions(props: {
10
9
  getRecommendInfo?: () => RecommendIds;
11
10
  recommendCache: boolean;
12
11
  recommendNum: number;
13
- }, options: Ref<AnyObject[]>, emit: Func, labelKey: Ref<string>, valueKey: Ref<string>): {
12
+ }, options: Ref<AnyObject[]>, emit: Func, valueKey: Ref<string>): {
14
13
  postRecommend: (value: unknown) => Promise<void>;
15
- getRecommend: (content?: string) => Promise<void>;
16
- sortedOptions: import("vue").ComputedRef<AnyObject[]>;
14
+ getRecommend: () => Promise<void>;
15
+ sortedOptions: import("vue").ComputedRef<any[]>;
17
16
  };
18
17
  export declare function useUrlConfigOptions(props: {
19
18
  urlConfig?: UrlConfig;
@@ -4,7 +4,7 @@ import { isString, isEqual, omit, isFunction } from 'lodash-es';
4
4
  import { computed, inject, ref, watch } from 'vue';
5
5
  import '../../index.js';
6
6
  import { InjectionAsyncQueue, InjectionFormItemDepsCollector } from '../constants/index.js';
7
- import { createUrlConfigParams, formRenderLog, keywordMatcher } from '../utils/index.js';
7
+ import { createUrlConfigParams, formRenderLog, optionMatcherWithKeyword } from '../utils/index.js';
8
8
  import { useFormField } from './useFormField.js';
9
9
  import { useFormRequest } from './useFormRequest.js';
10
10
 
@@ -21,44 +21,9 @@ function createPropRef(props, key) {
21
21
  }
22
22
  });
23
23
  }
24
- const optionMatcherCache = /* @__PURE__ */ new WeakMap();
25
- const searchContentMatcherCache = /* @__PURE__ */ new Map();
26
- function useSearchContent() {
27
- const searchContent = ref();
28
- const searchContentMatcher = computed(() => {
29
- if (!searchContent.value)
30
- return /./;
31
- return new RegExp(
32
- `(.*)${searchContent.value.split("").map((char) => `(${char})`).join("(.*)")}(.*)`
33
- );
34
- });
35
- function filter(option, labelKey) {
36
- if (!searchContent.value)
37
- return true;
38
- const label = option ? option[labelKey] : "";
39
- if (!isString(label))
40
- return false;
41
- const cacheObj = searchContentMatcherCache.get(searchContent.value) || {};
42
- const matched = Reflect.has(cacheObj, label) ? cacheObj[label] : label.match(searchContentMatcher.value);
43
- cacheObj[label] = matched;
44
- searchContentMatcherCache.set(searchContent.value, cacheObj);
45
- if (matched) {
46
- optionMatcherCache.set(option, matched);
47
- return true;
48
- }
49
- return keywordMatcher(label, option.keyword);
50
- }
51
- function optionSearchFilter(options, _labelKey) {
52
- if (!searchContent.value)
53
- return options;
54
- return options.filter((option) => filter(option, _labelKey));
55
- }
56
- return { searchContent, searchContentMatcher, optionSearchFilter };
57
- }
58
- function useRecommendOptions(props, options, emit, labelKey, valueKey) {
24
+ function useRecommendOptions(props, options, emit, valueKey) {
59
25
  const commonListRef = createPropRef(props, "commonList");
60
26
  const recentListRef = createPropRef(props, "recentList");
61
- const { searchContent, optionSearchFilter } = useSearchContent();
62
27
  function getRecommendOption(item) {
63
28
  return jsonParse(item.itemObj);
64
29
  }
@@ -79,11 +44,7 @@ function useRecommendOptions(props, options, emit, labelKey, valueKey) {
79
44
  return item[valueKey.value] !== option[valueKey.value];
80
45
  }
81
46
  });
82
- return [
83
- ...optionSearchFilter(commonOptions.value, labelKey.value),
84
- ...optionSearchFilter(recentOptions.value, labelKey.value),
85
- ...optionWithoutRecommend
86
- ];
47
+ return [...commonOptions.value, ...recentOptions.value, ...optionWithoutRecommend];
87
48
  });
88
49
  const { getRecommendRequestInfo, getHttpInstance } = useFormRequest();
89
50
  function getRecommendConfig(type) {
@@ -94,10 +55,9 @@ function useRecommendOptions(props, options, emit, labelKey, valueKey) {
94
55
  }
95
56
  const { fieldKey } = useFormField();
96
57
  const asyncQueue = inject(InjectionAsyncQueue);
97
- async function getRecommend(content) {
58
+ async function getRecommend() {
98
59
  if (!props.recommend)
99
60
  return;
100
- searchContent.value = content;
101
61
  if (commonListRef.value && recentListRef.value && props.recommendCache)
102
62
  return;
103
63
  const list = await asyncQueue.addAsync(createParams(fieldKey.value, props.recommendCache));
@@ -165,11 +125,11 @@ function useUrlConfigOptions(props, valueRef) {
165
125
  var _a, _b;
166
126
  return (_b = (_a = props.urlConfig) == null ? void 0 : _a.valueKey) != null ? _b : "value";
167
127
  });
168
- const { searchContent, optionSearchFilter } = useSearchContent();
169
128
  const remoteOptions = ref(null);
129
+ const lastSearch = ref("");
170
130
  const { field, fieldKey } = useFormField();
171
131
  const fetchData = useDebounceFn(async function(content) {
172
- searchContent.value = content || "";
132
+ lastSearch.value = content || "";
173
133
  if (!props.urlConfig) {
174
134
  return remoteOptions.value = null;
175
135
  }
@@ -187,10 +147,10 @@ function useUrlConfigOptions(props, valueRef) {
187
147
  }, 300);
188
148
  const options = computed(() => {
189
149
  if (remoteOptions.value)
190
- return optionSearchFilter(remoteOptions.value, labelKey.value);
150
+ return optionMatcherWithKeyword(remoteOptions.value, lastSearch.value, labelKey.value);
191
151
  if (!Array.isArray(props.options))
192
152
  return [];
193
- return optionSearchFilter(props.options, labelKey.value);
153
+ return optionMatcherWithKeyword(props.options, lastSearch.value, labelKey.value);
194
154
  });
195
155
  const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
196
156
  watch(
@@ -223,12 +183,12 @@ function useAutographOptions(props, valueRef) {
223
183
  var _a, _b;
224
184
  return (_b = (_a = props.wordbook) == null ? void 0 : _a.value_key) != null ? _b : "value";
225
185
  });
226
- const { searchContent, optionSearchFilter } = useSearchContent();
227
186
  const remoteOptions = ref(null);
187
+ const lastSearch = ref("");
228
188
  const { fieldKey } = useFormField();
229
189
  const { getSearchRequestInfo } = useFormRequest();
230
190
  const fetchData = useDebounceFn(async function(content) {
231
- searchContent.value = content || "";
191
+ lastSearch.value = content || "";
232
192
  if (!props.autograph || !props.wordbook) {
233
193
  return remoteOptions.value = null;
234
194
  }
@@ -251,10 +211,10 @@ function useAutographOptions(props, valueRef) {
251
211
  }, 300);
252
212
  const options = computed(() => {
253
213
  if (remoteOptions.value)
254
- return optionSearchFilter(remoteOptions.value, labelKey.value);
214
+ return optionMatcherWithKeyword(remoteOptions.value, lastSearch.value, labelKey.value);
255
215
  if (!Array.isArray(props.options))
256
216
  return [];
257
- return optionSearchFilter(props.options, labelKey.value);
217
+ return optionMatcherWithKeyword(props.options, lastSearch.value, labelKey.value);
258
218
  });
259
219
  watch(
260
220
  () => props.wordbook,
@@ -271,4 +231,4 @@ function useAutographOptions(props, valueRef) {
271
231
  return { labelKey, valueKey, options, fetchData };
272
232
  }
273
233
 
274
- export { optionMatcherCache, useAutographOptions, useRecommendOptions, useUrlConfigOptions };
234
+ export { useAutographOptions, useRecommendOptions, useUrlConfigOptions };
@@ -1,4 +1,4 @@
1
- import { AnyObject, ArrayAble } from '../../../../../es/shared/types';
1
+ import { AnyObject, ArrayAble, Nullable } from '../../../../../es/shared/types';
2
2
  import { GeneralField } from '@formily/core';
3
3
  import { FunctionalComponent, InjectionKey, VNode } from 'vue';
4
4
  import { FieldItem, UrlConfig } from '../types';
@@ -14,7 +14,9 @@ export declare function createSlot(renderer: unknown, props: AnyObject, defaultR
14
14
  };
15
15
  export declare function createInputSlot(props: AnyObject, defaultRenderer?: (v: unknown) => unknown[]): import("vue").ComputedRef<Record<string, FunctionalComponent<{}, {}>>>;
16
16
  export declare function presetRequestHandler(res: unknown): AnyObject[];
17
- export declare const keywordMatcher: import("@vueuse/core").UseMemoizedFn<boolean, [text: unknown, keyword: unknown]>;
17
+ export declare function optionMatcherWithKeyword(options: AnyObject[], input: Nullable<string>, key: string, matcherOption?: {
18
+ keyword?: string;
19
+ }): AnyObject[];
18
20
  export declare function validateMessageParser(message: string, fieldItem: Omit<FieldItem, 'reactions'>): string;
19
21
  export declare function combineExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
20
22
  export declare function splitExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
@@ -138,6 +138,20 @@ const keywordMatcher = useMemoize(function(text, keyword) {
138
138
  }, "");
139
139
  }
140
140
  });
141
+ function optionMatcherWithKeyword(options, input, key, matcherOption = {
142
+ keyword: "keyword"
143
+ }) {
144
+ if (!input)
145
+ return options;
146
+ return options.filter((option) => {
147
+ if (!isString(keyFor(option)))
148
+ return;
149
+ return keyFor(option).includes(input) || matcherOption.keyword && keywordMatcher(input, option[matcherOption.keyword]);
150
+ });
151
+ function keyFor(option) {
152
+ return option[key];
153
+ }
154
+ }
141
155
  function validateMessageParser(message, fieldItem) {
142
156
  if (!isString(message) || !message)
143
157
  return "";
@@ -238,4 +252,4 @@ async function createUrlConfigParams({
238
252
  };
239
253
  }
240
254
 
241
- export { combineExtendKey, createInputSlot, createSlot, createUrlConfigParams, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, keywordMatcher, mergeDeepProperties, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser };
255
+ export { combineExtendKey, createInputSlot, createSlot, createUrlConfigParams, formRenderLog, injectOrProvide, isNestedFieldType, isNestedType, mergeDeepProperties, optionMatcherWithKeyword, parseNumberFromMaybeString, presetRequestHandler, splitExtendKey, validateMessageParser };