cnhis-design-vue 3.1.25-beta.3 → 3.1.25-beta.4
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/big-table/src/components/edit-form/edit-input.js +5 -3
- package/es/components/big-table/src/hooks/useEdit.js +1 -3
- package/es/components/big-table/src/hooks/useEvent.js +6 -9
- package/es/components/form-render/src/FormRender.js +14 -17
- package/es/components/form-render/src/components/renderer/simpleComponent.js +3 -3
- package/es/components/grid/src/hooks.js +1 -0
- package/es/shared/utils/index.js +2 -2
- package/package.json +2 -2
|
@@ -63,9 +63,11 @@ var EditInput = defineComponent({
|
|
|
63
63
|
};
|
|
64
64
|
function keyup(event) {
|
|
65
65
|
if (event.key == "Enter") {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
emit("formChange", {
|
|
67
|
+
value: __value.value,
|
|
68
|
+
...commData,
|
|
69
|
+
type: "enter"
|
|
70
|
+
});
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
watch(() => attrs.value, (value) => {
|
|
@@ -88,13 +88,11 @@ const useEdit = (props, state, emit, xGrid, loadData) => {
|
|
|
88
88
|
if (["separate"].includes(column == null ? void 0 : column.formType)) {
|
|
89
89
|
loadData(props.data);
|
|
90
90
|
}
|
|
91
|
-
const activeRow = xGrid.value.getCurrentRecord();
|
|
92
|
-
const rowIndex = xGrid.value.getRowIndex(activeRow);
|
|
93
91
|
emit("formChange", {
|
|
94
92
|
value,
|
|
95
93
|
row,
|
|
96
94
|
column,
|
|
97
|
-
index
|
|
95
|
+
index,
|
|
98
96
|
oldValue,
|
|
99
97
|
...type ? { type } : {}
|
|
100
98
|
});
|
|
@@ -17,15 +17,12 @@ const useEvent = (props, state, emit, xGrid, anchorEvent) => {
|
|
|
17
17
|
if (!activeRow && !isEdit)
|
|
18
18
|
return;
|
|
19
19
|
if (isEdit) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
column
|
|
27
|
-
});
|
|
28
|
-
["Tab", "Enter"].includes($event.key) && column && xGridRef.setEditCell(row, column);
|
|
20
|
+
const { row, $rowIndex, rowIndex, column } = xGridRef.getEditRecord() || {};
|
|
21
|
+
emit("keyboard", {
|
|
22
|
+
key: $event.key,
|
|
23
|
+
index: $rowIndex != null ? $rowIndex : rowIndex,
|
|
24
|
+
row,
|
|
25
|
+
column
|
|
29
26
|
});
|
|
30
27
|
return;
|
|
31
28
|
}
|
|
@@ -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 './utils/index.js';
|
|
11
|
+
import { validateMessageParser } 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';
|
|
@@ -143,28 +143,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
143
143
|
function bindEleInfo(info) {
|
|
144
144
|
if (info.decoratorElement)
|
|
145
145
|
return info;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
const pattern = formModel.query(info.path);
|
|
147
|
+
const title = pattern.get("title");
|
|
148
|
+
const messages = info.messages.map(
|
|
149
|
+
(message) => errMessageNormalize(message, pattern.get("decoratorProps"))
|
|
150
|
+
);
|
|
151
|
+
const decoratorElement = queryDecorator(info.path, scrollbarRef.value, formUUID);
|
|
152
|
+
return { ...info, messages, title, decoratorElement, ...queryInput(info.decoratorElement) };
|
|
153
|
+
}
|
|
154
|
+
function errMessageNormalize(message, decoratorProps) {
|
|
155
|
+
if (!decoratorProps || !decoratorProps.fieldItem)
|
|
156
|
+
return message;
|
|
157
|
+
return validateMessageParser(message, decoratorProps.fieldItem);
|
|
150
158
|
}
|
|
151
159
|
},
|
|
152
160
|
getFormValues() {
|
|
153
161
|
return formModel.getFormState().values;
|
|
154
162
|
},
|
|
155
163
|
setFieldState(path, handler) {
|
|
156
|
-
formModel.setFieldState(path,
|
|
157
|
-
handler(
|
|
158
|
-
new Proxy(state, {
|
|
159
|
-
get(target, key, receiver) {
|
|
160
|
-
return Reflect.get(target, key, receiver);
|
|
161
|
-
},
|
|
162
|
-
set(target, key, value, receiver) {
|
|
163
|
-
return Reflect.set(target, key, value, receiver);
|
|
164
|
-
}
|
|
165
|
-
})
|
|
166
|
-
);
|
|
167
|
-
});
|
|
164
|
+
formModel.setFieldState(path, handler);
|
|
168
165
|
},
|
|
169
166
|
resetFields(path = "*") {
|
|
170
167
|
formModel.reset(path);
|
|
@@ -4,7 +4,7 @@ import { isFunction } from 'lodash-es';
|
|
|
4
4
|
import { NButton } from 'naive-ui';
|
|
5
5
|
import { createSlot } from '../../utils/index.js';
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
function pathToFieldItem(props) {
|
|
8
8
|
return (property) => {
|
|
9
9
|
var _a;
|
|
10
10
|
return (_a = props.fieldItem) == null ? void 0 : _a[property];
|
|
@@ -27,10 +27,10 @@ const TEXT = connect(textScript, mapProps((props) => {
|
|
|
27
27
|
};
|
|
28
28
|
}));
|
|
29
29
|
const buttonScript = (props) => {
|
|
30
|
-
const
|
|
30
|
+
const fieldItem = pathToFieldItem(props);
|
|
31
31
|
function onClick() {
|
|
32
32
|
var _a;
|
|
33
|
-
const cb =
|
|
33
|
+
const cb = fieldItem("onClick") || ((_a = fieldItem("componentProps")) == null ? void 0 : _a.onClick);
|
|
34
34
|
return () => isFunction(cb) && cb(props.fieldItem);
|
|
35
35
|
}
|
|
36
36
|
return createVNode(NButton, {
|
package/es/shared/utils/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemoize } from '@vueuse/core';
|
|
2
|
-
import { isArray, isString, isObject } from 'lodash-es';
|
|
2
|
+
import { isArray, isString, isObject, isFunction } from 'lodash-es';
|
|
3
3
|
|
|
4
4
|
function traverse(target, handler, keys = "children", parent) {
|
|
5
5
|
function stop() {
|
|
@@ -101,7 +101,7 @@ function deepOmit(target, keys) {
|
|
|
101
101
|
return result;
|
|
102
102
|
if (isArray(v)) {
|
|
103
103
|
result[k] = v.map((child) => search(child, keys2));
|
|
104
|
-
} else if (isObject(v)) {
|
|
104
|
+
} else if (isObject(v) && !isFunction(v)) {
|
|
105
105
|
result[k] = search(v, keys2);
|
|
106
106
|
} else {
|
|
107
107
|
result[k] = v;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.25-beta.
|
|
3
|
+
"version": "3.1.25-beta.4",
|
|
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": "aa7ce9ac5ef2d3ef0f06718f1f95ee15f2615bfb"
|
|
65
65
|
}
|