cnhis-design-vue 3.1.15-beta.7 → 3.1.15-beta.8
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/form-config/index.d.ts +12109 -0
- package/es/packages/form-config/index.js +10 -0
- package/es/packages/form-config/src/FormConfig.js +113 -0
- package/es/packages/form-config/src/FormConfig.vue.d.ts +12110 -0
- package/es/packages/form-config/src/components/FormConfigCreator.js +97 -0
- package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +5094 -0
- package/es/packages/form-config/src/components/FormConfigEdit.js +81 -0
- package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +3591 -0
- package/es/packages/form-config/src/constants/index.d.ts +28 -0
- package/es/packages/form-config/src/constants/index.js +28 -0
- package/es/packages/form-config/src/hooks/index.d.ts +2 -0
- package/es/packages/form-config/src/hooks/index.js +2 -0
- package/es/packages/form-config/src/hooks/useConfigurationField.d.ts +6 -0
- package/es/packages/form-config/src/hooks/useConfigurationField.js +101 -0
- package/es/packages/form-config/src/hooks/usePresetRenderer.d.ts +5 -0
- package/es/packages/form-config/src/hooks/usePresetRenderer.js +117 -0
- package/es/packages/form-config/src/hooks/useSortable.d.ts +11 -0
- package/es/packages/form-config/src/hooks/useSortable.js +31 -0
- package/es/packages/form-config/src/types/index.d.ts +18 -0
- package/es/packages/form-config/src/types/index.js +1 -0
- package/es/packages/form-config/style/index.css +108 -0
- package/es/packages/form-render/src/components/renderer/date.d.ts +2 -2
- package/es/packages/form-render/src/components/renderer/formItem.js +2 -1
- package/es/packages/form-render/src/components/renderer/select.js +1 -1
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +2 -1
- package/es/packages/form-render/src/utils/index.d.ts +1 -1
- package/es/packages/form-render/src/utils/index.js +5 -0
- package/es/packages/index.css +108 -0
- package/es/packages/index.d.ts +3 -1
- package/es/packages/index.js +4 -1
- package/es/packages/shortcut-setter/index.d.ts +2 -2
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +2 -2
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +1 -1
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +2 -2
- package/es/src/utils/state.d.ts +29 -0
- package/es/src/utils/state.js +44 -0
- package/package.json +2 -1
package/es/packages/index.d.ts
CHANGED
|
@@ -19,12 +19,14 @@ import CFormRender from './form-render';
|
|
|
19
19
|
import CFabricChart from './fabric-chart';
|
|
20
20
|
import CShortcutProvider from './shortcut-provider';
|
|
21
21
|
import CShortcutSetter from './shortcut-setter';
|
|
22
|
+
import CFormConfig from './form-config';
|
|
22
23
|
export * from './form-render';
|
|
23
24
|
export * from './shortcut-provider';
|
|
24
25
|
export * from './big-table';
|
|
25
26
|
export * from './button-print';
|
|
27
|
+
export * from './form-config';
|
|
26
28
|
declare function install(app: App): void;
|
|
27
|
-
export { CGrid, CBigTable, CFieldSet, CDragLayout, CButtonPrint, CSelectPerson, CSelectLabel, CLabelFormContent, CScaleView, CMap, CVodChunkUpload, CRadio, CCheckbox, CSelect, CDatetime, CFormTable, CInfoHeader, CTimeLine, CBpmnWorkflow, CStepsWheel, Editor, CFormRender, CFabricChart, CShortcutProvider, CShortcutSetter };
|
|
29
|
+
export { CGrid, CBigTable, CFieldSet, CDragLayout, CButtonPrint, CSelectPerson, CSelectLabel, CLabelFormContent, CScaleView, CMap, CVodChunkUpload, CRadio, CCheckbox, CSelect, CDatetime, CFormTable, CInfoHeader, CTimeLine, CBpmnWorkflow, CStepsWheel, Editor, CFormRender, CFabricChart, CShortcutProvider, CShortcutSetter, CFormConfig };
|
|
28
30
|
declare const _default: {
|
|
29
31
|
install: typeof install;
|
|
30
32
|
};
|
package/es/packages/index.js
CHANGED
|
@@ -38,6 +38,8 @@ import ShortcutProvider from './shortcut-provider/index.js';
|
|
|
38
38
|
export { default as CShortcutProvider } from './shortcut-provider/index.js';
|
|
39
39
|
import ShortcutSetter from './shortcut-setter/index.js';
|
|
40
40
|
export { default as CShortcutSetter } from './shortcut-setter/index.js';
|
|
41
|
+
import FormConfig from './form-config/index.js';
|
|
42
|
+
export { default as CFormConfig } from './form-config/index.js';
|
|
41
43
|
export { useFieldListAdaptor } from './form-render/src/hooks/useFieldListAdaptor.js';
|
|
42
44
|
export { useFormRequest } from './form-render/src/hooks/useFormRequest.js';
|
|
43
45
|
export { useCommonLog } from './form-render/src/hooks/useCommonLog.js';
|
|
@@ -82,7 +84,8 @@ const components = {
|
|
|
82
84
|
CFormRender: FormRender,
|
|
83
85
|
CFabricChart: FabricChart,
|
|
84
86
|
CShortcutProvider: ShortcutProvider,
|
|
85
|
-
CShortcutSetter: ShortcutSetter
|
|
87
|
+
CShortcutSetter: ShortcutSetter,
|
|
88
|
+
CFormConfig: FormConfig
|
|
86
89
|
};
|
|
87
90
|
function install(app) {
|
|
88
91
|
Object.values(components).forEach((component) => {
|
|
@@ -57,7 +57,7 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
57
57
|
fieldItem: import("..").FieldItem;
|
|
58
58
|
placeholder: string;
|
|
59
59
|
editPlaceholder: string;
|
|
60
|
-
operation: ("
|
|
60
|
+
operation: ("reset" | "state")[];
|
|
61
61
|
};
|
|
62
62
|
query: (key: string) => Omit<import("..").ShortcutItem, "callback">;
|
|
63
63
|
update: (key: string, info: KeyboardEvent | Partial<import("..").ShortcutSignatureInfo>) => void;
|
|
@@ -69,7 +69,7 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
69
69
|
currentSetShortcut: import("vue").ComputedRef<string>;
|
|
70
70
|
state: import("vue").Ref<import("./constant").ShortcutInputState>;
|
|
71
71
|
isEditState: import("vue").ComputedRef<boolean>;
|
|
72
|
-
hasOperation: (operation: "
|
|
72
|
+
hasOperation: (operation: "reset" | "state") => boolean;
|
|
73
73
|
currentEditShortcut: import("vue").Ref<string>;
|
|
74
74
|
showContent: import("vue").ComputedRef<string>;
|
|
75
75
|
placeholder: import("vue").ComputedRef<string>;
|
|
@@ -57,7 +57,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
57
57
|
fieldItem: FieldItem;
|
|
58
58
|
placeholder: string;
|
|
59
59
|
editPlaceholder: string;
|
|
60
|
-
operation: ("
|
|
60
|
+
operation: ("reset" | "state")[];
|
|
61
61
|
};
|
|
62
62
|
query: (key: string) => Omit<import("../../../../es/packages/shortcut-provider").ShortcutItem, "callback">;
|
|
63
63
|
update: (key: string, info: KeyboardEvent | Partial<import("../../../../es/packages/shortcut-provider").ShortcutSignatureInfo>) => void;
|
|
@@ -69,7 +69,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
69
69
|
currentSetShortcut: import("vue").ComputedRef<string>;
|
|
70
70
|
state: import("vue").Ref<import("../constant").ShortcutInputState>;
|
|
71
71
|
isEditState: import("vue").ComputedRef<boolean>;
|
|
72
|
-
hasOperation: (operation: "
|
|
72
|
+
hasOperation: (operation: "reset" | "state") => boolean;
|
|
73
73
|
currentEditShortcut: import("vue").Ref<string>;
|
|
74
74
|
showContent: import("vue").ComputedRef<string>;
|
|
75
75
|
placeholder: import("vue").ComputedRef<string>;
|
|
@@ -99,7 +99,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
99
99
|
onKeyup: withModifiers(unref(onInputKeyUp), ["prevent", "stop"])
|
|
100
100
|
}, null, 8, ["disabled", "value", "placeholder", "onKeydown", "onKeyup"]),
|
|
101
101
|
createElementVNode("section", _hoisted_2, [
|
|
102
|
-
hasOperation("
|
|
102
|
+
hasOperation("state") ? (openBlock(), createBlock(unref(NButton), {
|
|
103
103
|
key: 0,
|
|
104
104
|
text: "",
|
|
105
105
|
onClick: onStop,
|
|
@@ -47,7 +47,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
47
47
|
fieldItem: FieldItem;
|
|
48
48
|
placeholder: string;
|
|
49
49
|
editPlaceholder: string;
|
|
50
|
-
operation: Array<'
|
|
50
|
+
operation: Array<'state' | 'reset'>;
|
|
51
51
|
};
|
|
52
52
|
query: (key: string) => Omit<import("../../../../es/packages/shortcut-provider").ShortcutItem, "callback">;
|
|
53
53
|
update: (key: string, info: KeyboardEvent | Partial<import("../../../../es/packages/shortcut-provider").ShortcutSignatureInfo>) => void;
|
|
@@ -59,7 +59,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
59
59
|
currentSetShortcut: import("vue").ComputedRef<string>;
|
|
60
60
|
state: import("vue").Ref<ShortcutInputState>;
|
|
61
61
|
isEditState: import("vue").ComputedRef<boolean>;
|
|
62
|
-
hasOperation: (operation: '
|
|
62
|
+
hasOperation: (operation: 'state' | 'reset') => boolean;
|
|
63
63
|
currentEditShortcut: import("vue").Ref<string>;
|
|
64
64
|
showContent: import("vue").ComputedRef<string>;
|
|
65
65
|
placeholder: import("vue").ComputedRef<string>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Ref, UnwrapRef, WritableComputedOptions, WritableComputedRef, ComputedRef } from 'vue';
|
|
2
|
+
interface GetState<T> {
|
|
3
|
+
(isRef: true): Ref<UnwrapRef<T>>;
|
|
4
|
+
(isRef?: false): UnwrapRef<T>;
|
|
5
|
+
}
|
|
6
|
+
export declare function useState<T>(initValue?: T): [GetState<T>, (val: UnwrapRef<T>) => UnwrapRef<T>];
|
|
7
|
+
export declare function useRef<T>(): GetState<T | null>;
|
|
8
|
+
/**
|
|
9
|
+
* v-for的ref引用
|
|
10
|
+
*/
|
|
11
|
+
export declare function useRefs<T>(): [Set<T>, (el: T) => void];
|
|
12
|
+
/**
|
|
13
|
+
* v-for的ref引用
|
|
14
|
+
* @return 数组
|
|
15
|
+
*/
|
|
16
|
+
export declare function useRefsArray<T>(): [T[], (el: T) => void];
|
|
17
|
+
interface GetComputed<T, R> {
|
|
18
|
+
(isRef: true): R;
|
|
19
|
+
(isRef: false): T;
|
|
20
|
+
(): T;
|
|
21
|
+
}
|
|
22
|
+
export declare function useComputed<T>(getter: WritableComputedOptions<T>['get']): GetComputed<T, ComputedRef<T>>;
|
|
23
|
+
export declare function useComputed<T>(options: WritableComputedOptions<T>): [GetComputed<T, WritableComputedRef<T>>, (val: T) => void];
|
|
24
|
+
/**
|
|
25
|
+
* 返回{ [key]: Ref }
|
|
26
|
+
* @params obj { [变量名]: useState或useComputed返回的getter函数 }
|
|
27
|
+
*/
|
|
28
|
+
export declare function getRefs(obj: Record<string, GetState<any> | GetComputed<any, any>>): Record<string, Ref<any>>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ref, onBeforeUpdate, computed, unref } from 'vue';
|
|
2
|
+
|
|
3
|
+
function useState(initValue) {
|
|
4
|
+
const state = ref(initValue);
|
|
5
|
+
const getState = (isRef) => isRef ? state : unref(state);
|
|
6
|
+
return [getState, (val) => state.value = val];
|
|
7
|
+
}
|
|
8
|
+
function useRef() {
|
|
9
|
+
return useState(null)[0];
|
|
10
|
+
}
|
|
11
|
+
function useRefs() {
|
|
12
|
+
const itemRefs = /* @__PURE__ */ new Set();
|
|
13
|
+
const setItemRef = (el) => el && itemRefs.add(el);
|
|
14
|
+
onBeforeUpdate(() => itemRefs.clear());
|
|
15
|
+
return [itemRefs, setItemRef];
|
|
16
|
+
}
|
|
17
|
+
function useRefsArray() {
|
|
18
|
+
let itemRefs = [];
|
|
19
|
+
const setItemRef = (el) => {
|
|
20
|
+
itemRefs.push(el);
|
|
21
|
+
};
|
|
22
|
+
onBeforeUpdate(() => {
|
|
23
|
+
itemRefs = [];
|
|
24
|
+
});
|
|
25
|
+
return [itemRefs, setItemRef];
|
|
26
|
+
}
|
|
27
|
+
function isWritableComputedOptions(arg) {
|
|
28
|
+
return typeof arg === "object" && Reflect.has(arg || {}, "set");
|
|
29
|
+
}
|
|
30
|
+
function useComputed(arg) {
|
|
31
|
+
const data = isWritableComputedOptions(arg) ? computed(arg) : computed(arg);
|
|
32
|
+
const getData = (isRef) => isRef ? data : data.value;
|
|
33
|
+
if (!isWritableComputedOptions(arg)) {
|
|
34
|
+
return getData;
|
|
35
|
+
}
|
|
36
|
+
return [getData, (val) => data.value = val];
|
|
37
|
+
}
|
|
38
|
+
function getRefs(obj) {
|
|
39
|
+
const result = {};
|
|
40
|
+
Object.entries(obj).forEach(([k, fn]) => result[k] = fn(true));
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { getRefs, useComputed, useRef, useRefs, useRefsArray, useState };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.1.15-beta.
|
|
4
|
+
"version": "3.1.15-beta.8",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"module": "es/packages/index.js",
|
|
7
7
|
"main": "es/packages/index.js",
|
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
"@types/markdown-it": "^12.2.3",
|
|
91
91
|
"@types/node": "^17.0.38",
|
|
92
92
|
"@types/replacestream": "^4.0.1",
|
|
93
|
+
"@types/sortablejs": "^1.13.0",
|
|
93
94
|
"@types/vue-router": "^2.0.0",
|
|
94
95
|
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
|
95
96
|
"@typescript-eslint/parser": "^5.30.7",
|