cnhis-design-vue 3.1.15-beta.5 → 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/index.d.ts +6 -6
- package/es/packages/form-render/src/FormRender.vue.d.ts +6 -6
- package/es/packages/form-render/src/components/renderer/formItem.js +2 -1
- package/es/packages/form-render/src/components/renderer/select.js +2 -2
- package/es/packages/form-render/src/hooks/useAsyncQueue.d.ts +2 -2
- package/es/packages/form-render/src/hooks/useAsyncQueue.js +3 -3
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +2 -1
- package/es/packages/form-render/src/hooks/useFormContext.js +4 -4
- package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.d.ts +4 -4
- package/es/packages/form-render/src/types/index.d.ts +2 -2
- 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 +109 -1
- package/es/packages/index.d.ts +3 -1
- package/es/packages/index.js +4 -1
- package/es/packages/info-header/style/index.css +1 -1
- package/es/packages/shortcut-setter/index.d.ts +8 -8
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +8 -8
- 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
|
@@ -3,11 +3,11 @@ import { FormRenderLifeCycle, FormRenderProps } from '../../../../../es/packages
|
|
|
3
3
|
export declare function useFormRenderLifeCycle(props: FormRenderProps): {
|
|
4
4
|
callLifeCycle: <T extends "onSetup" | "beforeRequest" | "afterRequest">(lifeCycleName: T, payload?: Parameters<Required<Partial<{
|
|
5
5
|
onSetup(): void;
|
|
6
|
-
beforeRequest(params?: import("../../../../../es/src/types").AnyObject | undefined): void | WithUndefined<import("../../../../../es/src/types").AnyObject>;
|
|
7
|
-
afterRequest(payload?: import("../../../../../es/src/types").AnyObject[] | undefined): void | WithUndefined<import("../../../../../es/src/types").AnyObject[]>;
|
|
6
|
+
beforeRequest(fieldKey: string, params?: import("../../../../../es/src/types").AnyObject | undefined): void | WithUndefined<import("../../../../../es/src/types").AnyObject>;
|
|
7
|
+
afterRequest(fieldKey: string, payload?: import("../../../../../es/src/types").AnyObject[] | undefined): void | WithUndefined<import("../../../../../es/src/types").AnyObject[]>;
|
|
8
8
|
}>>[T]> | undefined) => WithUndefined<ReturnType<Required<Partial<{
|
|
9
9
|
onSetup(): void;
|
|
10
|
-
beforeRequest(params?: import("../../../../../es/src/types").AnyObject | undefined): void | WithUndefined<import("../../../../../es/src/types").AnyObject>;
|
|
11
|
-
afterRequest(payload?: import("../../../../../es/src/types").AnyObject[] | undefined): void | WithUndefined<import("../../../../../es/src/types").AnyObject[]>;
|
|
10
|
+
beforeRequest(fieldKey: string, params?: import("../../../../../es/src/types").AnyObject | undefined): void | WithUndefined<import("../../../../../es/src/types").AnyObject>;
|
|
11
|
+
afterRequest(fieldKey: string, payload?: import("../../../../../es/src/types").AnyObject[] | undefined): void | WithUndefined<import("../../../../../es/src/types").AnyObject[]>;
|
|
12
12
|
}>>[T]>>;
|
|
13
13
|
};
|
|
@@ -54,8 +54,8 @@ export declare type FormBusinessFilter = (payload: {
|
|
|
54
54
|
export declare type DependKeyType = ArrayAble<string> | Record<string, string> | ArrayAble<Record<'paramName' | 'paramValue', string>>;
|
|
55
55
|
export declare type FormRenderLifeCycle = Partial<{
|
|
56
56
|
onSetup(): void;
|
|
57
|
-
beforeRequest(params?: AnyObject): WithUndefined<AnyObject> | void;
|
|
58
|
-
afterRequest(payload?: AnyObject[]): WithUndefined<AnyObject[]> | void;
|
|
57
|
+
beforeRequest(fieldKey: string, params?: AnyObject): WithUndefined<AnyObject> | void;
|
|
58
|
+
afterRequest(fieldKey: string, payload?: AnyObject[]): WithUndefined<AnyObject[]> | void;
|
|
59
59
|
}>;
|
|
60
60
|
export declare type FormRenderProps = Partial<{
|
|
61
61
|
fieldList: FieldItem[];
|
|
@@ -8,7 +8,7 @@ export declare function arrayed<T>(maybeArray: T): T extends Array<any> ? T : [T
|
|
|
8
8
|
export declare function assignUpdateValue(props: AnyObject, field: GeneralField): {
|
|
9
9
|
[x: string]: any;
|
|
10
10
|
};
|
|
11
|
-
export declare function transformDateFormat(format?: string): "date" | "datetime";
|
|
11
|
+
export declare function transformDateFormat(format?: string): "date" | "datetime" | "month";
|
|
12
12
|
export declare function isIdCard(idCardNo: string): boolean;
|
|
13
13
|
export declare function isMobile(mobile: string): boolean;
|
|
14
14
|
export declare function parseBirthday(birthday: string): AgeContext;
|
|
@@ -26,7 +26,12 @@ function assignUpdateValue(props, field) {
|
|
|
26
26
|
}
|
|
27
27
|
return _props;
|
|
28
28
|
}
|
|
29
|
+
function isMonthType(format) {
|
|
30
|
+
return format && format.replace(/yyyy-MM/gi, "YYYY-MM") === "YYYY-MM";
|
|
31
|
+
}
|
|
29
32
|
function transformDateFormat(format = "") {
|
|
33
|
+
if (isMonthType(format))
|
|
34
|
+
return "month";
|
|
30
35
|
return format.includes("HH") ? "datetime" : "date";
|
|
31
36
|
}
|
|
32
37
|
function isIdCard(idCardNo) {
|
package/es/packages/index.css
CHANGED
|
@@ -2711,7 +2711,7 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
2711
2711
|
@font-face {
|
|
2712
2712
|
font-family: 'iconfont';
|
|
2713
2713
|
/* Project id 3468756 */
|
|
2714
|
-
src: url('./iconfont.ttf
|
|
2714
|
+
src: url('./iconfont.ttf') format('truetype');
|
|
2715
2715
|
}
|
|
2716
2716
|
.c-info-header .iconfont {
|
|
2717
2717
|
font-family: 'iconfont' !important;
|
|
@@ -3178,3 +3178,111 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
3178
3178
|
.nodeTipContent li p {
|
|
3179
3179
|
margin: 0;
|
|
3180
3180
|
}
|
|
3181
|
+
.form-config {
|
|
3182
|
+
display: flex;
|
|
3183
|
+
justify-content: space-between;
|
|
3184
|
+
}
|
|
3185
|
+
.form-config__material {
|
|
3186
|
+
padding: 16px;
|
|
3187
|
+
box-sizing: border-box;
|
|
3188
|
+
width: 200px;
|
|
3189
|
+
min-height: 400px;
|
|
3190
|
+
background: white;
|
|
3191
|
+
}
|
|
3192
|
+
.form-config__materialHeader {
|
|
3193
|
+
display: flex;
|
|
3194
|
+
align-items: center;
|
|
3195
|
+
justify-content: space-between;
|
|
3196
|
+
height: 40px;
|
|
3197
|
+
}
|
|
3198
|
+
.form-config__materialContent {
|
|
3199
|
+
padding: 8px;
|
|
3200
|
+
display: flex;
|
|
3201
|
+
flex-direction: column;
|
|
3202
|
+
gap: 8px;
|
|
3203
|
+
}
|
|
3204
|
+
.form-config__materialContentItem {
|
|
3205
|
+
display: flex;
|
|
3206
|
+
align-items: center;
|
|
3207
|
+
padding: 8px;
|
|
3208
|
+
border: 1px dashed #d9d9d9;
|
|
3209
|
+
box-sizing: border-box;
|
|
3210
|
+
background-color: #fafafa;
|
|
3211
|
+
grid-column: span var(--item-column) / span var(--item-column);
|
|
3212
|
+
}
|
|
3213
|
+
.form-config__displayWrapper {
|
|
3214
|
+
padding: 16px;
|
|
3215
|
+
box-sizing: border-box;
|
|
3216
|
+
flex: 1;
|
|
3217
|
+
padding: 16px 0;
|
|
3218
|
+
}
|
|
3219
|
+
.form-config__displayHeader {
|
|
3220
|
+
display: flex;
|
|
3221
|
+
align-items: center;
|
|
3222
|
+
justify-content: space-between;
|
|
3223
|
+
height: 40px;
|
|
3224
|
+
}
|
|
3225
|
+
.form-config__displayContent {
|
|
3226
|
+
padding: 16px;
|
|
3227
|
+
box-sizing: border-box;
|
|
3228
|
+
height: fit-content;
|
|
3229
|
+
background: #eeeeee;
|
|
3230
|
+
display: grid !important;
|
|
3231
|
+
grid-template-columns: repeat(12, minmax(0px, 1fr));
|
|
3232
|
+
gap: 8px 16px;
|
|
3233
|
+
}
|
|
3234
|
+
.form-config__displayContentItem {
|
|
3235
|
+
grid-column: span var(--item-column) / span var(--item-column);
|
|
3236
|
+
position: relative;
|
|
3237
|
+
}
|
|
3238
|
+
.form-config__config {
|
|
3239
|
+
padding: 16px;
|
|
3240
|
+
box-sizing: border-box;
|
|
3241
|
+
width: 220px;
|
|
3242
|
+
background: white;
|
|
3243
|
+
}
|
|
3244
|
+
.form-config__renderer--default {
|
|
3245
|
+
display: flex;
|
|
3246
|
+
align-items: center;
|
|
3247
|
+
padding: 8px;
|
|
3248
|
+
border: 1px dashed #d9d9d9;
|
|
3249
|
+
box-sizing: border-box;
|
|
3250
|
+
background-color: #fafafa;
|
|
3251
|
+
user-select: none;
|
|
3252
|
+
position: relative;
|
|
3253
|
+
width: 100%;
|
|
3254
|
+
}
|
|
3255
|
+
.form-config__renderer--complex {
|
|
3256
|
+
border: 1px dashed lightblue;
|
|
3257
|
+
padding: 8px;
|
|
3258
|
+
}
|
|
3259
|
+
.form-config__renderer--complex--grid {
|
|
3260
|
+
display: grid !important;
|
|
3261
|
+
grid-template-columns: repeat(12, minmax(0px, 1fr));
|
|
3262
|
+
gap: 8px 16px;
|
|
3263
|
+
grid-column: span var(--item-column) / span var(--item-column);
|
|
3264
|
+
}
|
|
3265
|
+
.form-config__renderer--complex--flex {
|
|
3266
|
+
display: flex;
|
|
3267
|
+
}
|
|
3268
|
+
.form-config .is-disabled {
|
|
3269
|
+
background: #e5e5e5;
|
|
3270
|
+
}
|
|
3271
|
+
.form-config .is-required {
|
|
3272
|
+
padding-left: 16px !important;
|
|
3273
|
+
}
|
|
3274
|
+
.form-config .is-required::before {
|
|
3275
|
+
position: absolute;
|
|
3276
|
+
content: '*';
|
|
3277
|
+
left: 8px;
|
|
3278
|
+
color: red;
|
|
3279
|
+
}
|
|
3280
|
+
.form-config .is-active {
|
|
3281
|
+
color: #5585f5;
|
|
3282
|
+
}
|
|
3283
|
+
.form-config .is-choosing {
|
|
3284
|
+
box-shadow: #5585f5 0 0 0 2px !important;
|
|
3285
|
+
}
|
|
3286
|
+
.form-config .is-choosing-area {
|
|
3287
|
+
background: #f0f7ff;
|
|
3288
|
+
}
|
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) => {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
@font-face {
|
|
11
11
|
font-family: 'iconfont';
|
|
12
12
|
/* Project id 3468756 */
|
|
13
|
-
src: url('./iconfont.ttf
|
|
13
|
+
src: url('./iconfont.ttf') format('truetype');
|
|
14
14
|
}
|
|
15
15
|
.c-info-header .iconfont {
|
|
16
16
|
font-family: 'iconfont' !important;
|
|
@@ -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>;
|
|
@@ -4397,8 +4397,8 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
4397
4397
|
lifeCycle: {
|
|
4398
4398
|
type: import("vue").PropType<Partial<{
|
|
4399
4399
|
onSetup(): void;
|
|
4400
|
-
beforeRequest(params?: import("../../../es/src/types").AnyObject | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject>;
|
|
4401
|
-
afterRequest(payload?: import("../../../es/src/types").AnyObject[] | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject[]>;
|
|
4400
|
+
beforeRequest(fieldKey: string, params?: import("../../../es/src/types").AnyObject | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject>;
|
|
4401
|
+
afterRequest(fieldKey: string, payload?: import("../../../es/src/types").AnyObject[] | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject[]>;
|
|
4402
4402
|
}>>;
|
|
4403
4403
|
};
|
|
4404
4404
|
}, {
|
|
@@ -4512,8 +4512,8 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
4512
4512
|
lifeCycle: {
|
|
4513
4513
|
type: import("vue").PropType<Partial<{
|
|
4514
4514
|
onSetup(): void;
|
|
4515
|
-
beforeRequest(params?: import("../../../es/src/types").AnyObject | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject>;
|
|
4516
|
-
afterRequest(payload?: import("../../../es/src/types").AnyObject[] | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject[]>;
|
|
4515
|
+
beforeRequest(fieldKey: string, params?: import("../../../es/src/types").AnyObject | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject>;
|
|
4516
|
+
afterRequest(fieldKey: string, payload?: import("../../../es/src/types").AnyObject[] | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject[]>;
|
|
4517
4517
|
}>>;
|
|
4518
4518
|
};
|
|
4519
4519
|
}>> & {
|
|
@@ -6014,8 +6014,8 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
6014
6014
|
lifeCycle: {
|
|
6015
6015
|
type: import("vue").PropType<Partial<{
|
|
6016
6016
|
onSetup(): void;
|
|
6017
|
-
beforeRequest(params?: import("../../../es/src/types").AnyObject | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject>;
|
|
6018
|
-
afterRequest(payload?: import("../../../es/src/types").AnyObject[] | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject[]>;
|
|
6017
|
+
beforeRequest(fieldKey: string, params?: import("../../../es/src/types").AnyObject | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject>;
|
|
6018
|
+
afterRequest(fieldKey: string, payload?: import("../../../es/src/types").AnyObject[] | undefined): void | import("../../../es/src/types").WithUndefined<import("../../../es/src/types").AnyObject[]>;
|
|
6019
6019
|
}>>;
|
|
6020
6020
|
};
|
|
6021
6021
|
}>> & {
|
|
@@ -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>;
|
|
@@ -4397,8 +4397,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4397
4397
|
lifeCycle: {
|
|
4398
4398
|
type: import("vue").PropType<Partial<{
|
|
4399
4399
|
onSetup(): void;
|
|
4400
|
-
beforeRequest(params?: import("../../../src/types").AnyObject | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject>;
|
|
4401
|
-
afterRequest(payload?: import("../../../src/types").AnyObject[] | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject[]>;
|
|
4400
|
+
beforeRequest(fieldKey: string, params?: import("../../../src/types").AnyObject | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject>;
|
|
4401
|
+
afterRequest(fieldKey: string, payload?: import("../../../src/types").AnyObject[] | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject[]>;
|
|
4402
4402
|
}>>;
|
|
4403
4403
|
};
|
|
4404
4404
|
}, {
|
|
@@ -4512,8 +4512,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4512
4512
|
lifeCycle: {
|
|
4513
4513
|
type: import("vue").PropType<Partial<{
|
|
4514
4514
|
onSetup(): void;
|
|
4515
|
-
beforeRequest(params?: import("../../../src/types").AnyObject | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject>;
|
|
4516
|
-
afterRequest(payload?: import("../../../src/types").AnyObject[] | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject[]>;
|
|
4515
|
+
beforeRequest(fieldKey: string, params?: import("../../../src/types").AnyObject | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject>;
|
|
4516
|
+
afterRequest(fieldKey: string, payload?: import("../../../src/types").AnyObject[] | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject[]>;
|
|
4517
4517
|
}>>;
|
|
4518
4518
|
};
|
|
4519
4519
|
}>> & {
|
|
@@ -6014,8 +6014,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
6014
6014
|
lifeCycle: {
|
|
6015
6015
|
type: import("vue").PropType<Partial<{
|
|
6016
6016
|
onSetup(): void;
|
|
6017
|
-
beforeRequest(params?: import("../../../src/types").AnyObject | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject>;
|
|
6018
|
-
afterRequest(payload?: import("../../../src/types").AnyObject[] | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject[]>;
|
|
6017
|
+
beforeRequest(fieldKey: string, params?: import("../../../src/types").AnyObject | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject>;
|
|
6018
|
+
afterRequest(fieldKey: string, payload?: import("../../../src/types").AnyObject[] | undefined): void | import("../../../src/types").WithUndefined<import("../../../src/types").AnyObject[]>;
|
|
6019
6019
|
}>>;
|
|
6020
6020
|
};
|
|
6021
6021
|
}>> & {
|
|
@@ -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",
|