cnhis-design-vue 3.1.23-beta.13 → 3.1.23-beta.14

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.
@@ -1,7 +1,7 @@
1
- import { defineComponent, ref, computed, provide, nextTick, openBlock, createBlock, unref, normalizeStyle, withCtx, createVNode, isRef, createElementVNode, renderSlot } from 'vue';
1
+ import { defineComponent, computed, ref, provide, nextTick, openBlock, createBlock, unref, isRef, normalizeStyle, withCtx, createVNode, createElementVNode, renderSlot } from 'vue';
2
2
  import { uuidGenerator } from '../../../shared/utils/index2.js';
3
3
  import { onClickOutside, useDebounceFn } from '@vueuse/core';
4
- import { isString, isArray, isFunction } from 'lodash-es';
4
+ import { isString, isArray, isFunction, isObject } from 'lodash-es';
5
5
  import { NPopover, NInput } from 'naive-ui';
6
6
  import { InjectionSearchCascaderLoadingNode } from './constants/index2.js';
7
7
  import { useCssVariable } from './hooks/useCssVariable2.js';
@@ -13,6 +13,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
13
13
  __name: "SearchCascader",
14
14
  props: {
15
15
  value: { type: [String, Array] },
16
+ show: { type: Boolean, default: false },
16
17
  clearable: { type: Boolean, default: false },
17
18
  childKey: { type: String, default: "children" },
18
19
  placeholder: { type: String, default: "\u8BF7\u9009\u62E9" },
@@ -23,7 +24,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23
24
  valueKey: { type: String, default: "value" },
24
25
  beforeSetValue: { type: Function }
25
26
  },
26
- emits: ["update:value", "focus"],
27
+ emits: ["update:value", "focus", "update:show"],
27
28
  setup(__props, { emit: emits }) {
28
29
  const props = __props;
29
30
  function emitValue(value) {
@@ -37,7 +38,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
37
38
  }
38
39
  const cssVariable = useCssVariable();
39
40
  const uuid = uuidGenerator();
40
- const show = ref(false);
41
+ const show = computed({
42
+ get() {
43
+ return props.show;
44
+ },
45
+ set(value) {
46
+ emits("update:show", value);
47
+ }
48
+ });
41
49
  const patternContent = ref("");
42
50
  const displayValue = computed({
43
51
  get() {
@@ -110,8 +118,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
110
118
  var _a;
111
119
  try {
112
120
  loadingNode.value = node;
113
- await (isFunction(props.search) && props.search(node, keyword));
114
- currentNode.value = node;
121
+ const result = await (isFunction(props.search) && props.search(node, keyword));
122
+ currentNode.value = isObject(result) ? result : node;
115
123
  } finally {
116
124
  loadingNode.value = null;
117
125
  await nextTick();
@@ -122,8 +130,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
122
130
  return openBlock(), createBlock(unref(NPopover), {
123
131
  class: "search-cascader",
124
132
  trigger: "manual",
125
- show: show.value,
126
- "onUpdate:show": _cache[1] || (_cache[1] = ($event) => show.value = $event),
133
+ show: unref(show),
134
+ "onUpdate:show": _cache[1] || (_cache[1] = ($event) => isRef(show) ? show.value = $event : null),
127
135
  "show-arrow": false,
128
136
  placement: "bottom-start",
129
137
  style: normalizeStyle(unref(cssVariable)),
@@ -133,7 +141,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
133
141
  }, {
134
142
  trigger: withCtx(() => [
135
143
  createVNode(unref(NInput), {
136
- placeholder: show.value ? __props.editPlaceholder : __props.placeholder,
144
+ placeholder: unref(show) ? __props.editPlaceholder : __props.placeholder,
137
145
  clearable: __props.clearable,
138
146
  onClear,
139
147
  value: unref(displayValue),
@@ -5,6 +5,10 @@ declare const _default: import("vue").DefineComponent<{
5
5
  value: {
6
6
  type: PropType<ValueType>;
7
7
  };
8
+ show: {
9
+ type: BooleanConstructor;
10
+ default: boolean;
11
+ };
8
12
  clearable: {
9
13
  type: BooleanConstructor;
10
14
  default: boolean;
@@ -44,6 +48,10 @@ declare const _default: import("vue").DefineComponent<{
44
48
  value: {
45
49
  type: PropType<ValueType>;
46
50
  };
51
+ show: {
52
+ type: BooleanConstructor;
53
+ default: boolean;
54
+ };
47
55
  clearable: {
48
56
  type: BooleanConstructor;
49
57
  default: boolean;
@@ -81,15 +89,16 @@ declare const _default: import("vue").DefineComponent<{
81
89
  }>> & {
82
90
  onFocus?: ((...args: any[]) => any) | undefined;
83
91
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
92
+ "onUpdate:show"?: ((...args: any[]) => any) | undefined;
84
93
  }>>;
85
- emits: (event: "update:value" | "focus", ...args: any[]) => void;
94
+ emits: (event: "update:value" | "update:show" | "focus", ...args: any[]) => void;
86
95
  emitValue: (value: ValueType) => void;
87
96
  onClear: () => void;
88
97
  cssVariable: {
89
98
  '--menu-width': number;
90
99
  };
91
100
  uuid: string;
92
- show: import("vue").Ref<boolean>;
101
+ show: import("vue").WritableComputedRef<boolean>;
93
102
  patternContent: import("vue").Ref<string>;
94
103
  displayValue: import("vue").WritableComputedRef<string>;
95
104
  onFocus: (focusEvt: Event) => void;
@@ -145,10 +154,14 @@ declare const _default: import("vue").DefineComponent<{
145
154
  childKey: string;
146
155
  labelKey: string;
147
156
  }>;
148
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "focus")[], "focus" | "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
157
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "update:show" | "focus")[], "focus" | "update:value" | "update:show", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
149
158
  value: {
150
159
  type: PropType<ValueType>;
151
160
  };
161
+ show: {
162
+ type: BooleanConstructor;
163
+ default: boolean;
164
+ };
152
165
  clearable: {
153
166
  type: BooleanConstructor;
154
167
  default: boolean;
@@ -186,7 +199,9 @@ declare const _default: import("vue").DefineComponent<{
186
199
  }>> & {
187
200
  onFocus?: ((...args: any[]) => any) | undefined;
188
201
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
202
+ "onUpdate:show"?: ((...args: any[]) => any) | undefined;
189
203
  }, {
204
+ show: boolean;
190
205
  options: AnyObject[];
191
206
  placeholder: string;
192
207
  valueKey: string;
@@ -0,0 +1,139 @@
1
+ type FixedSizeArray<T extends number, U> = T extends 0
2
+ ? void[]
3
+ : ReadonlyArray<U> & {
4
+ 0: U;
5
+ length: T;
6
+ };
7
+ type Measure<T extends number> = T extends 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ? T : never;
8
+ type Append<T extends any[], U> = {
9
+ 0: [U];
10
+ 1: [T[0], U];
11
+ 2: [T[0], T[1], U];
12
+ 3: [T[0], T[1], T[2], U];
13
+ 4: [T[0], T[1], T[2], T[3], U];
14
+ 5: [T[0], T[1], T[2], T[3], T[4], U];
15
+ 6: [T[0], T[1], T[2], T[3], T[4], T[5], U];
16
+ 7: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], U];
17
+ 8: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], U];
18
+ }[Measure<T['length']>];
19
+ type AsArray<T> = T extends any[] ? T : [T];
20
+
21
+ declare class UnsetAdditionalOptions {
22
+ _UnsetAdditionalOptions: true;
23
+ }
24
+ type IfSet<X> = X extends UnsetAdditionalOptions ? {} : X;
25
+
26
+ type Callback<E, T> = (error: E | null, result?: T) => void;
27
+ type InnerCallback<E, T> = (error?: E | null | false, result?: T) => void;
28
+
29
+ type FullTap = Tap & {
30
+ type: 'sync' | 'async' | 'promise';
31
+ fn: Function;
32
+ };
33
+
34
+ type Tap = TapOptions & {
35
+ name: string;
36
+ };
37
+
38
+ type TapOptions = {
39
+ before?: string;
40
+ stage?: number;
41
+ };
42
+
43
+ interface HookInterceptor<T, R, AdditionalOptions = UnsetAdditionalOptions> {
44
+ name?: string;
45
+ tap?: (tap: FullTap & IfSet<AdditionalOptions>) => void;
46
+ call?: (...args: any[]) => void;
47
+ loop?: (...args: any[]) => void;
48
+ error?: (err: Error) => void;
49
+ result?: (result: R) => void;
50
+ done?: () => void;
51
+ register?: (tap: FullTap & IfSet<AdditionalOptions>) => FullTap & IfSet<AdditionalOptions>;
52
+ }
53
+
54
+ type ArgumentNames<T extends any[]> = FixedSizeArray<T['length'], string>;
55
+
56
+ declare class Hook<T, R, AdditionalOptions = UnsetAdditionalOptions> {
57
+ constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
58
+ name: string | undefined;
59
+ taps: FullTap[];
60
+ intercept(interceptor: HookInterceptor<T, R, AdditionalOptions>): void;
61
+ isUsed(): boolean;
62
+ callAsync(...args: Append<AsArray<T>, Callback<Error, R>>): void;
63
+ promise(...args: AsArray<T>): Promise<R>;
64
+ tap(options: string | (Tap & IfSet<AdditionalOptions>), fn: (...args: AsArray<T>) => R): void;
65
+ withOptions(options: TapOptions & IfSet<AdditionalOptions>): Omit<this, 'call' | 'callAsync' | 'promise'>;
66
+ }
67
+
68
+ export class SyncHook<T, R = void, AdditionalOptions = UnsetAdditionalOptions> extends Hook<T, R, AdditionalOptions> {
69
+ call(...args: AsArray<T>): R;
70
+ }
71
+
72
+ export class SyncBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends SyncHook<T, R, AdditionalOptions> {}
73
+ export class SyncLoopHook<T, AdditionalOptions = UnsetAdditionalOptions> extends SyncHook<T, void, AdditionalOptions> {}
74
+ export class SyncWaterfallHook<T, AdditionalOptions = UnsetAdditionalOptions> extends SyncHook<
75
+ T,
76
+ AsArray<T>[0],
77
+ AdditionalOptions
78
+ > {}
79
+
80
+ declare class AsyncHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends Hook<T, R, AdditionalOptions> {
81
+ tapAsync(
82
+ options: string | (Tap & IfSet<AdditionalOptions>),
83
+ fn: (...args: Append<AsArray<T>, InnerCallback<Error, R>>) => void
84
+ ): void;
85
+ tapPromise(options: string | (Tap & IfSet<AdditionalOptions>), fn: (...args: AsArray<T>) => Promise<R>): void;
86
+ }
87
+
88
+ export class AsyncParallelHook<T, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<
89
+ T,
90
+ void,
91
+ AdditionalOptions
92
+ > {}
93
+ export class AsyncParallelBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<
94
+ T,
95
+ R,
96
+ AdditionalOptions
97
+ > {}
98
+ export class AsyncSeriesHook<T, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<
99
+ T,
100
+ void,
101
+ AdditionalOptions
102
+ > {}
103
+ export class AsyncSeriesBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<
104
+ T,
105
+ R,
106
+ AdditionalOptions
107
+ > {}
108
+ export class AsyncSeriesLoopHook<T, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<
109
+ T,
110
+ void,
111
+ AdditionalOptions
112
+ > {}
113
+ export class AsyncSeriesWaterfallHook<T, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<
114
+ T,
115
+ AsArray<T>[0],
116
+ AdditionalOptions
117
+ > {}
118
+
119
+ type HookFactory<H> = (key: any, hook?: H) => H;
120
+
121
+ interface HookMapInterceptor<H> {
122
+ factory?: HookFactory<H>;
123
+ }
124
+
125
+ export class HookMap<H> {
126
+ constructor(factory: HookFactory<H>, name?: string);
127
+ name: string | undefined;
128
+ get(key: any): H | undefined;
129
+ for(key: any): H;
130
+ intercept(interceptor: HookMapInterceptor<H>): void;
131
+ }
132
+
133
+ export class MultiHook<H> {
134
+ constructor(hooks: H[], name?: string);
135
+ name: string | undefined;
136
+ tap(options: string | Tap, fn?: Function): void;
137
+ tapAsync(options: string | Tap, fn?: Function): void;
138
+ tapPromise(options: string | Tap, fn?: Function): void;
139
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.23-beta.13",
3
+ "version": "3.1.23-beta.14",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -66,5 +66,5 @@
66
66
  "iOS 7",
67
67
  "last 3 iOS versions"
68
68
  ],
69
- "gitHead": "167f92da3f533240af1a598f58f70b85a365414f"
69
+ "gitHead": "112bf14c5aaabbb89b6c5d96e1d89bbbd4158e19"
70
70
  }