cnhis-design-vue 3.1.26-beta.2 → 3.1.26-beta.3
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/components/form-config/index.d.ts +1 -0
- package/es/components/form-config/src/FormConfig.vue.d.ts +1 -0
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +1 -0
- package/es/components/form-render/src/FormRender.js +6 -3
- package/es/components/form-render/src/types/fieldItem.d.ts +4 -0
- package/es/components/form-render/src/utils/index.d.ts +1 -0
- package/es/components/form-render/src/utils/index.js +25 -1
- package/es/components/iho-table/src/constants/index.d.ts +2 -2
- package/es/components/iho-table/src/constants/index.js +1 -1
- package/es/components/iho-table/src/plugins/defaultConfigPlugin/index.js +5 -1
- package/es/components/iho-table/src/plugins/index.js +2 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.d.ts +1 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js +62 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin.js +11 -11
- package/es/components/shortcut-setter/index.d.ts +1 -0
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -0
- package/es/shared/types/index.d.ts +8 -0
- package/package.json +2 -2
|
@@ -971,6 +971,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
971
971
|
suffixConfig?: any | any[] | undefined;
|
|
972
972
|
autograph?: string | undefined;
|
|
973
973
|
defined_error_msg?: string | undefined;
|
|
974
|
+
extendKey?: string | undefined;
|
|
974
975
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
975
976
|
content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
|
|
976
977
|
lazyRequest?: boolean | undefined;
|
|
@@ -973,6 +973,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
973
973
|
suffixConfig?: any | any[] | undefined;
|
|
974
974
|
autograph?: string | undefined;
|
|
975
975
|
defined_error_msg?: string | undefined;
|
|
976
|
+
extendKey?: string | undefined;
|
|
976
977
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
977
978
|
content?: string | import("../..").FormRenderer | Record<string, import("../..").FormRenderer> | undefined;
|
|
978
979
|
lazyRequest?: boolean | undefined;
|
|
@@ -102,6 +102,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
102
102
|
suffixConfig?: any | any[] | undefined;
|
|
103
103
|
autograph?: string | undefined;
|
|
104
104
|
defined_error_msg?: string | undefined;
|
|
105
|
+
extendKey?: string | undefined;
|
|
105
106
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
106
107
|
content?: string | import("../../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../../es/components/form-render").FormRenderer> | undefined;
|
|
107
108
|
lazyRequest?: boolean | undefined;
|
|
@@ -8,7 +8,7 @@ import { NForm, NTabs, NTabPane, NConfigProvider } from 'naive-ui';
|
|
|
8
8
|
import { FormItemLineBarDepKeyPrepend } from './constants/index.js';
|
|
9
9
|
import { useFormRenderLifeCycle } from './hooks/useFormRenderLifeCycle.js';
|
|
10
10
|
import { useNuiThemeOverrides } from './hooks/useNuiThemeOverrides.js';
|
|
11
|
-
import { validateMessageParser } from './utils/index.js';
|
|
11
|
+
import { validateMessageParser, transformExtendKey } from './utils/index.js';
|
|
12
12
|
import { useFieldListAdaptor } from './hooks/useFieldListAdaptor.js';
|
|
13
13
|
import '../index.js';
|
|
14
14
|
import { useFieldVisitor } from './hooks/useFieldVisitor.js';
|
|
@@ -157,8 +157,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
157
157
|
return validateMessageParser(message, decoratorProps.fieldItem);
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
|
-
getFormValues() {
|
|
161
|
-
|
|
160
|
+
getFormValues(needTransformExtendKey = true) {
|
|
161
|
+
const result = formModel.getFormState().values;
|
|
162
|
+
if (!needTransformExtendKey)
|
|
163
|
+
return result;
|
|
164
|
+
return transformExtendKey(props.fieldList || [], result);
|
|
162
165
|
},
|
|
163
166
|
setFieldState(path, handler) {
|
|
164
167
|
formModel.setFieldState(path, handler);
|
|
@@ -17,3 +17,4 @@ export declare function optionMatcher(options: AnyObject[], input: Nullable<stri
|
|
|
17
17
|
keyword?: string;
|
|
18
18
|
}): AnyObject[];
|
|
19
19
|
export declare function validateMessageParser(message: string, fieldItem: Omit<FieldItem, 'reactions'>): string;
|
|
20
|
+
export declare function transformExtendKey(fieldList: FieldItem[], values: AnyObject): AnyObject;
|
|
@@ -133,5 +133,29 @@ function validateMessageParser(message, fieldItem) {
|
|
|
133
133
|
return (_a = fieldItem[property.trim()]) != null ? _a : "";
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
+
function transformExtendKey(fieldList, values) {
|
|
137
|
+
const fieldListWithExtendKey = fieldList.filter((field) => isString(field.extendKey) && field.extendKey);
|
|
138
|
+
if (!fieldListWithExtendKey.length)
|
|
139
|
+
return values;
|
|
140
|
+
const result = {};
|
|
141
|
+
const extendKeyMap = /* @__PURE__ */ new Map();
|
|
142
|
+
Object.entries(values).forEach(([k, v]) => {
|
|
143
|
+
const field = fieldListWithExtendKey.find((field2) => field2.val_key === k);
|
|
144
|
+
if (!field) {
|
|
145
|
+
return result[k] = v;
|
|
146
|
+
}
|
|
147
|
+
const {
|
|
148
|
+
val_key,
|
|
149
|
+
extendKey
|
|
150
|
+
} = field;
|
|
151
|
+
const extendKeyObject = extendKeyMap.get(extendKey) || {};
|
|
152
|
+
extendKeyMap.set(extendKey, extendKeyObject);
|
|
153
|
+
extendKeyObject[val_key] = values[val_key];
|
|
154
|
+
});
|
|
155
|
+
[...extendKeyMap.entries()].forEach(([k, v]) => {
|
|
156
|
+
result[k] = JSON.stringify(v);
|
|
157
|
+
});
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
136
160
|
|
|
137
|
-
export { createInputSlot, createSlot, formRenderLog, injectOrProvide, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, validateMessageParser };
|
|
161
|
+
export { createInputSlot, createSlot, formRenderLog, injectOrProvide, mergeDeepProperties, optionMatcher, parseNumberFromMaybeString, presetRequestHandler, transformExtendKey, validateMessageParser };
|
|
@@ -24,7 +24,6 @@ export declare enum WIDGET_TYPE {
|
|
|
24
24
|
TASKDATE = "TASKDATE",
|
|
25
25
|
AGE = "AGE",
|
|
26
26
|
STATUS = "STATUS",
|
|
27
|
-
NUMBER = "NUMBER",
|
|
28
27
|
WEBSITE = "WEBSITE",
|
|
29
28
|
IDCARD = "IDCARD",
|
|
30
29
|
COUNTDOWN = "COUNTDOWN",
|
|
@@ -44,7 +43,8 @@ export declare enum EDITABLE_WIDGET_TYPE {
|
|
|
44
43
|
SEPARATE = "SEPARATE",
|
|
45
44
|
SELECT = "SELECT",
|
|
46
45
|
DATE = "DATE",
|
|
47
|
-
TIME = "TIME"
|
|
46
|
+
TIME = "TIME",
|
|
47
|
+
NUMBER = "NUMBER"
|
|
48
48
|
}
|
|
49
49
|
export declare const InjectionIhoTableConfig: InjectionKey<Ref<Nullable<IhoTableConfig>>>;
|
|
50
50
|
export declare const InjectionIhoTableEmits: InjectionKey<(event: string, ...args: unknown[]) => void>;
|
|
@@ -20,7 +20,6 @@ var WIDGET_TYPE = /* @__PURE__ */ ((WIDGET_TYPE2) => {
|
|
|
20
20
|
WIDGET_TYPE2["TASKDATE"] = "TASKDATE";
|
|
21
21
|
WIDGET_TYPE2["AGE"] = "AGE";
|
|
22
22
|
WIDGET_TYPE2["STATUS"] = "STATUS";
|
|
23
|
-
WIDGET_TYPE2["NUMBER"] = "NUMBER";
|
|
24
23
|
WIDGET_TYPE2["WEBSITE"] = "WEBSITE";
|
|
25
24
|
WIDGET_TYPE2["IDCARD"] = "IDCARD";
|
|
26
25
|
WIDGET_TYPE2["COUNTDOWN"] = "COUNTDOWN";
|
|
@@ -113,6 +112,7 @@ var EDITABLE_WIDGET_TYPE = /* @__PURE__ */ ((EDITABLE_WIDGET_TYPE2) => {
|
|
|
113
112
|
EDITABLE_WIDGET_TYPE2["SELECT"] = "SELECT";
|
|
114
113
|
EDITABLE_WIDGET_TYPE2["DATE"] = "DATE";
|
|
115
114
|
EDITABLE_WIDGET_TYPE2["TIME"] = "TIME";
|
|
115
|
+
EDITABLE_WIDGET_TYPE2["NUMBER"] = "NUMBER";
|
|
116
116
|
return EDITABLE_WIDGET_TYPE2;
|
|
117
117
|
})(EDITABLE_WIDGET_TYPE || {});
|
|
118
118
|
const InjectionIhoTableConfig = Symbol("injectionIhoTableConfig");
|
|
@@ -19,7 +19,11 @@ function defaultConfigPlugin() {
|
|
|
19
19
|
mouseConfig: { selected: true },
|
|
20
20
|
editConfig: {
|
|
21
21
|
trigger: "click",
|
|
22
|
-
mode: "cell"
|
|
22
|
+
mode: "cell",
|
|
23
|
+
autoClear: false,
|
|
24
|
+
activeMethod({ row }) {
|
|
25
|
+
return !row.$__SEPARATE;
|
|
26
|
+
}
|
|
23
27
|
},
|
|
24
28
|
keyboardConfig: { isArrow: true, isDel: true, isEnter: true, isTab: true, isEdit: true, isChecked: true }
|
|
25
29
|
},
|
|
@@ -2,6 +2,7 @@ import * as index from './defaultConfigPlugin/index.js';
|
|
|
2
2
|
import * as index$1 from './lowCodeFieldAdaptorPlugin/index.js';
|
|
3
3
|
import * as index$2 from './rendererPlugins/editableWidgets/dateRendererPlugin/index.js';
|
|
4
4
|
import * as inputRendererPlugin from './rendererPlugins/editableWidgets/inputRendererPlugin.js';
|
|
5
|
+
import * as numberRendererPlugin from './rendererPlugins/editableWidgets/numberRendererPlugin.js';
|
|
5
6
|
import * as index$3 from './rendererPlugins/editableWidgets/selectRendererPlugin/index.js';
|
|
6
7
|
import * as index$4 from './rendererPlugins/editableWidgets/separateRendererPlugin/index.js';
|
|
7
8
|
import * as timeRendererPlugin from './rendererPlugins/editableWidgets/timeRendererPlugin.js';
|
|
@@ -20,6 +21,7 @@ const modules = Object.assign({
|
|
|
20
21
|
"./lowCodeFieldAdaptorPlugin/index.ts": index$1,
|
|
21
22
|
"./rendererPlugins/editableWidgets/dateRendererPlugin/index.tsx": index$2,
|
|
22
23
|
"./rendererPlugins/editableWidgets/inputRendererPlugin.tsx": inputRendererPlugin,
|
|
24
|
+
"./rendererPlugins/editableWidgets/numberRendererPlugin.tsx": numberRendererPlugin,
|
|
23
25
|
"./rendererPlugins/editableWidgets/selectRendererPlugin/index.tsx": index$3,
|
|
24
26
|
"./rendererPlugins/editableWidgets/separateRendererPlugin/index.tsx": index$4,
|
|
25
27
|
"./rendererPlugins/editableWidgets/timeRendererPlugin.tsx": timeRendererPlugin,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function numberRendererPlugin(): import("../../../../../../../es/components/iho-table").TablePlugin;
|
package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/numberRendererPlugin.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { createVNode, inject, mergeProps } from 'vue';
|
|
2
|
+
import { NInputNumber } from 'naive-ui';
|
|
3
|
+
import '../../../../index.js';
|
|
4
|
+
import { EDITABLE_WIDGET_TYPE, InjectionIhoTableEmits } from '../../../constants/index.js';
|
|
5
|
+
import { defineTablePlugin } from '../../../hooks/useTablePlugin.js';
|
|
6
|
+
|
|
7
|
+
function numberRendererPlugin() {
|
|
8
|
+
const pluginName = "numberRendererPlugin";
|
|
9
|
+
return defineTablePlugin({
|
|
10
|
+
name: pluginName,
|
|
11
|
+
vxe(instance) {
|
|
12
|
+
instance.renderer.add(EDITABLE_WIDGET_TYPE.NUMBER, {
|
|
13
|
+
renderCell(renderOpts, {
|
|
14
|
+
row,
|
|
15
|
+
column
|
|
16
|
+
}) {
|
|
17
|
+
return [createVNode("span", null, [row[column.field]])];
|
|
18
|
+
},
|
|
19
|
+
renderEdit({
|
|
20
|
+
props
|
|
21
|
+
}, {
|
|
22
|
+
row,
|
|
23
|
+
column,
|
|
24
|
+
$rowIndex
|
|
25
|
+
}) {
|
|
26
|
+
const emit = inject(InjectionIhoTableEmits);
|
|
27
|
+
const {
|
|
28
|
+
placeholder = "\u8BF7\u8F93\u5165"
|
|
29
|
+
} = (props == null ? void 0 : props.componentProps) || {};
|
|
30
|
+
const config = {
|
|
31
|
+
...(props == null ? void 0 : props.componentProps) || {},
|
|
32
|
+
clearable: true,
|
|
33
|
+
placeholder,
|
|
34
|
+
onBlur,
|
|
35
|
+
onUpdateValue
|
|
36
|
+
};
|
|
37
|
+
const common = {
|
|
38
|
+
value: row[column.field],
|
|
39
|
+
row,
|
|
40
|
+
column,
|
|
41
|
+
index: $rowIndex
|
|
42
|
+
};
|
|
43
|
+
function onBlur() {
|
|
44
|
+
emit("formChange", {
|
|
45
|
+
...common,
|
|
46
|
+
type: "blur"
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function onUpdateValue() {
|
|
50
|
+
emit("formChange", common);
|
|
51
|
+
}
|
|
52
|
+
return [createVNode(NInputNumber, mergeProps({
|
|
53
|
+
"value": row[column.field],
|
|
54
|
+
"onUpdate:value": ($event) => row[column.field] = $event
|
|
55
|
+
}, config), null)];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { numberRendererPlugin };
|
package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin.js
CHANGED
|
@@ -24,29 +24,29 @@ function timeRendererPlugin() {
|
|
|
24
24
|
$rowIndex
|
|
25
25
|
}) {
|
|
26
26
|
const emit = inject(InjectionIhoTableEmits);
|
|
27
|
-
function onUpdateValue() {
|
|
28
|
-
emit("formChange", {
|
|
29
|
-
value: row[column.field],
|
|
30
|
-
row,
|
|
31
|
-
column,
|
|
32
|
-
index: $rowIndex
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
27
|
const {
|
|
36
28
|
placeholder = "\u8BF7\u9009\u62E9",
|
|
37
29
|
valueFormat = "HH:mm"
|
|
38
30
|
} = (props == null ? void 0 : props.componentProps) || {};
|
|
39
|
-
const
|
|
31
|
+
const config = {
|
|
32
|
+
...(props == null ? void 0 : props.componentProps) || {},
|
|
40
33
|
placeholder,
|
|
41
34
|
valueFormat,
|
|
42
35
|
format: valueFormat || "yyyy-MM-dd HH:mm:ss",
|
|
43
|
-
...(props == null ? void 0 : props.componentProps) || {},
|
|
44
36
|
onUpdateFormattedValue: onUpdateValue
|
|
45
37
|
};
|
|
38
|
+
function onUpdateValue() {
|
|
39
|
+
emit("formChange", {
|
|
40
|
+
value: row[column.field],
|
|
41
|
+
row,
|
|
42
|
+
column,
|
|
43
|
+
index: $rowIndex
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
46
|
return [createVNode(NTimePicker, mergeProps({
|
|
47
47
|
"formattedValue": row[column.field],
|
|
48
48
|
"onUpdate:formattedValue": ($event) => row[column.field] = $event
|
|
49
|
-
},
|
|
49
|
+
}, config), null)];
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
}
|
|
@@ -133,6 +133,7 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
133
133
|
suffixConfig?: any | any[] | undefined;
|
|
134
134
|
autograph?: string | undefined;
|
|
135
135
|
defined_error_msg?: string | undefined;
|
|
136
|
+
extendKey?: string | undefined;
|
|
136
137
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
137
138
|
content?: string | import("..").FormRenderer | Record<string, import("..").FormRenderer> | undefined;
|
|
138
139
|
lazyRequest?: boolean | undefined;
|
|
@@ -135,6 +135,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
135
135
|
suffixConfig?: any | any[] | undefined;
|
|
136
136
|
autograph?: string | undefined;
|
|
137
137
|
defined_error_msg?: string | undefined;
|
|
138
|
+
extendKey?: string | undefined;
|
|
138
139
|
fieldType?: import("@formily/json-schema").SchemaTypes | undefined;
|
|
139
140
|
content?: string | import("../../../../es/components/form-render").FormRenderer | Record<string, import("../../../../es/components/form-render").FormRenderer> | undefined;
|
|
140
141
|
lazyRequest?: boolean | undefined;
|
|
@@ -9,3 +9,11 @@ export declare type UndefinedAble<T> = T | undefined;
|
|
|
9
9
|
export declare type ArrayAble<T> = T | T[];
|
|
10
10
|
export declare type MapValue<T> = T extends Map<any, infer P> ? P : any;
|
|
11
11
|
export declare type NotNull<T> = T extends null | undefined ? never : T;
|
|
12
|
+
export declare type Merge<T> = {
|
|
13
|
+
[K in keyof T]: T[K];
|
|
14
|
+
};
|
|
15
|
+
export declare type PropertyRequired<T, K extends keyof T> = Merge<{
|
|
16
|
+
[KEY in keyof T as KEY extends K ? never : KEY]: T[KEY];
|
|
17
|
+
} & {
|
|
18
|
+
[KEY in K]-?: T[KEY];
|
|
19
|
+
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.26-beta.
|
|
3
|
+
"version": "3.1.26-beta.3",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "./es/components/index.js",
|
|
6
6
|
"main": "./es/components/index.js",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"iOS 7",
|
|
62
62
|
"last 3 iOS versions"
|
|
63
63
|
],
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "e67ff47bb324aa06f04761ae2c23991b72a7d07a"
|
|
65
65
|
}
|