cnhis-design-vue 3.1.17-beta.0 → 3.1.17-beta.1

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 (57) hide show
  1. package/es/packages/big-table/src/components/separate.js +1 -1
  2. package/es/packages/big-table/src/hooks/useSeparateRow.js +2 -2
  3. package/es/packages/fabric-chart/index.d.ts +2 -0
  4. package/es/packages/fabric-chart/src/FabricChart.js +20 -5
  5. package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +2 -0
  6. package/es/packages/fabric-chart/src/hooks/useCenter.js +19 -18
  7. package/es/packages/fabric-chart/src/hooks/useLeft.d.ts +3 -1
  8. package/es/packages/fabric-chart/src/hooks/useLeft.js +30 -12
  9. package/es/packages/fabric-chart/src/hooks/useRight.d.ts +1 -1
  10. package/es/packages/fabric-chart/src/hooks/useRight.js +11 -69
  11. package/es/packages/fabric-chart/src/interface.d.ts +3 -0
  12. package/es/packages/form-config/src/components/FormConfigCreator.js +2 -0
  13. package/es/packages/form-config/src/components/FormConfigEdit.js +1 -0
  14. package/es/packages/form-config/src/hooks/useConfigurationField.js +9 -9
  15. package/es/packages/form-render/index.js +1 -1
  16. package/es/packages/form-render/src/hooks/index.d.ts +1 -1
  17. package/es/packages/form-render/src/hooks/index.js +1 -1
  18. package/es/packages/form-render/src/hooks/useBusinessBinding.d.ts +5 -6
  19. package/es/packages/form-render/src/hooks/useBusinessBinding.js +22 -20
  20. package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +4 -4
  21. package/es/packages/form-render/src/hooks/useFieldNormalize.d.ts +5 -0
  22. package/es/packages/form-render/src/hooks/useFieldNormalize.js +58 -0
  23. package/es/packages/form-render/src/hooks/useFieldVisitor.js +1 -5
  24. package/es/packages/index.js +1 -1
  25. package/es/src/utils/tapable/AsyncParallelBailHook.d.ts +3 -0
  26. package/es/src/utils/tapable/AsyncParallelBailHook.js +78 -0
  27. package/es/src/utils/tapable/AsyncParallelHook.d.ts +3 -0
  28. package/es/src/utils/tapable/AsyncParallelHook.js +27 -0
  29. package/es/src/utils/tapable/AsyncSeriesBailHook.d.ts +3 -0
  30. package/es/src/utils/tapable/AsyncSeriesBailHook.js +33 -0
  31. package/es/src/utils/tapable/AsyncSeriesHook.d.ts +3 -0
  32. package/es/src/utils/tapable/AsyncSeriesHook.js +27 -0
  33. package/es/src/utils/tapable/AsyncSeriesLoopHook.d.ts +3 -0
  34. package/es/src/utils/tapable/AsyncSeriesLoopHook.js +27 -0
  35. package/es/src/utils/tapable/AsyncSeriesWaterfallHook.d.ts +3 -0
  36. package/es/src/utils/tapable/AsyncSeriesWaterfallHook.js +40 -0
  37. package/es/src/utils/tapable/Hook.d.ts +50 -0
  38. package/es/src/utils/tapable/Hook.js +140 -0
  39. package/es/src/utils/tapable/HookCodeFactory.d.ts +58 -0
  40. package/es/src/utils/tapable/HookCodeFactory.js +444 -0
  41. package/es/src/utils/tapable/HookMap.d.ts +11 -0
  42. package/es/src/utils/tapable/HookMap.js +32 -0
  43. package/es/src/utils/tapable/MultiHook.d.ts +12 -0
  44. package/es/src/utils/tapable/MultiHook.js +38 -0
  45. package/es/src/utils/tapable/SyncBailHook.d.ts +3 -0
  46. package/es/src/utils/tapable/SyncBailHook.js +40 -0
  47. package/es/src/utils/tapable/SyncHook.d.ts +3 -0
  48. package/es/src/utils/tapable/SyncHook.js +34 -0
  49. package/es/src/utils/tapable/SyncLoopHook.d.ts +3 -0
  50. package/es/src/utils/tapable/SyncLoopHook.js +34 -0
  51. package/es/src/utils/tapable/SyncWaterfallHook.d.ts +3 -0
  52. package/es/src/utils/tapable/SyncWaterfallHook.js +48 -0
  53. package/es/src/utils/tapable/index.d.ts +139 -0
  54. package/es/src/utils/tapable/index.js +12 -0
  55. package/package.json +1 -1
  56. package/es/packages/form-render/src/hooks/useTypeNormalize.d.ts +0 -4
  57. package/es/packages/form-render/src/hooks/useTypeNormalize.js +0 -46
@@ -0,0 +1,48 @@
1
+ import Hook from './Hook.js';
2
+ import HookCodeFactory from './HookCodeFactory.js';
3
+
4
+ class SyncWaterfallHookCodeFactory extends HookCodeFactory {
5
+ content({ onError, onResult, resultReturns, rethrowIfPossible }) {
6
+ return this.callTapsSeries({
7
+ onError: (i, err) => onError(err),
8
+ onResult: (i, result, next) => {
9
+ let code = "";
10
+ code += `if(${result} !== undefined) {
11
+ `;
12
+ code += `${this._args[0]} = ${result};
13
+ `;
14
+ code += `}
15
+ `;
16
+ code += next();
17
+ return code;
18
+ },
19
+ onDone: () => onResult(this._args[0]),
20
+ doneReturns: resultReturns,
21
+ rethrowIfPossible
22
+ });
23
+ }
24
+ }
25
+ const factory = new SyncWaterfallHookCodeFactory();
26
+ const TAP_ASYNC = () => {
27
+ throw new Error("tapAsync is not supported on a SyncWaterfallHook");
28
+ };
29
+ const TAP_PROMISE = () => {
30
+ throw new Error("tapPromise is not supported on a SyncWaterfallHook");
31
+ };
32
+ const COMPILE = function(options) {
33
+ factory.setup(this, options);
34
+ return factory.create(options);
35
+ };
36
+ function SyncWaterfallHook(args = [], name = void 0) {
37
+ if (args.length < 1)
38
+ throw new Error("Waterfall hooks must have at least one argument");
39
+ const hook = new Hook(args, name);
40
+ hook.constructor = SyncWaterfallHook;
41
+ hook.tapAsync = TAP_ASYNC;
42
+ hook.tapPromise = TAP_PROMISE;
43
+ hook.compile = COMPILE;
44
+ return hook;
45
+ }
46
+ SyncWaterfallHook.prototype = null;
47
+
48
+ export { SyncWaterfallHook as default };
@@ -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
+ }
@@ -0,0 +1,12 @@
1
+ export { default as SyncHook } from './SyncHook.js';
2
+ export { default as SyncBailHook } from './SyncBailHook.js';
3
+ export { default as SyncWaterfallHook } from './SyncWaterfallHook.js';
4
+ export { default as SyncLoopHook } from './SyncLoopHook.js';
5
+ export { default as AsyncParallelHook } from './AsyncParallelHook.js';
6
+ export { default as AsyncParallelBailHook } from './AsyncParallelBailHook.js';
7
+ export { default as AsyncSeriesHook } from './AsyncSeriesHook.js';
8
+ export { default as MultiHook } from './MultiHook.js';
9
+ export { default as AsyncSeriesBailHook } from './AsyncSeriesBailHook.js';
10
+ export { default as AsyncSeriesLoopHook } from './AsyncSeriesLoopHook.js';
11
+ export { default as AsyncSeriesWaterfallHook } from './AsyncSeriesWaterfallHook.js';
12
+ export { default as HookMap } from './HookMap.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
3
  "private": false,
4
- "version": "3.1.17-beta.0",
4
+ "version": "3.1.17-beta.1",
5
5
  "license": "ISC",
6
6
  "module": "es/packages/index.js",
7
7
  "main": "es/packages/index.js",
@@ -1,4 +0,0 @@
1
- import { FieldItem } from '../types';
2
- export declare function useTypeNormalize(): {
3
- normalize: (item: FieldItem) => void;
4
- };
@@ -1,46 +0,0 @@
1
- import { FIELD_BUSINESS_TYPE } from '../../../../packages/form-render/src/constants';
2
-
3
- function useTypeNormalize() {
4
- function normalizeAgeField(item) {
5
- item.html_type = "INPUT_NUMBER";
6
- item.suffixConfig = [
7
- {
8
- validate: { obj_type: FIELD_BUSINESS_TYPE.AGE_UNIT },
9
- val_key: item.val_key_unit,
10
- html_type: "SELECT",
11
- option: item.option,
12
- urlConfig: item.urlConfig
13
- }
14
- ];
15
- }
16
- const types = [
17
- [["SEARCH", "PHONE_TYPE", "IDCARD_TYPE"], "SELECT"],
18
- ["DIGITAL", "INPUT_NUMBER"],
19
- ["CHECKBOX_BLOCK", "CHECKBOX"],
20
- ["RADIO_BLOCK", "RADIO"],
21
- [["DATE-INPUT", "DATETIME-INPUT"], "DATE"],
22
- ["SWITCH_COMPONENT", "SWITCH"],
23
- ["SLIDER_COMPONENT", "SLIDER"],
24
- ["LINE_BREAKS", "LINEBAR"]
25
- ];
26
- function normalize(item) {
27
- const type = item.html_type;
28
- if (["CHECKBOX_BLOCK", "RADIO_BLOCK"].includes(type)) {
29
- item.__vertical = true;
30
- }
31
- if (["LINE_BREAKS"].includes(type)) {
32
- item.__line = true;
33
- item.is_show = "1";
34
- }
35
- if (item.html_type === "AGE") {
36
- normalizeAgeField(item);
37
- }
38
- types.some(([rule, target]) => {
39
- const match = Array.isArray(rule) ? rule.includes(type) : rule === type;
40
- return match && (item.html_type = target);
41
- });
42
- }
43
- return { normalize };
44
- }
45
-
46
- export { useTypeNormalize };