cnhis-design-vue 3.1.14 → 3.1.15-beta.0
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/big-table/src/components/edit-form/edit-date.js +11 -3
- package/es/packages/big-table/src/hooks/useColumnConfigAdaptor.js +44 -34
- package/es/packages/big-table/src/hooks/useFormat.js +8 -1
- package/es/packages/big-table/style/index.css +11 -0
- package/es/packages/form-render/src/FormRender.js +18 -3
- package/es/packages/form-render/src/components/renderer/combination.js +24 -4
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +6 -3
- package/es/packages/form-render/src/types/fieldItem.d.ts +2 -2
- package/es/packages/form-render/src/utils/index.d.ts +1 -0
- package/es/packages/form-render/src/utils/index.js +6 -3
- package/es/packages/index.css +11 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, createVNode, mergeProps } from 'vue';
|
|
2
|
+
import { isFunction } from 'lodash-es';
|
|
2
3
|
import { NDatePicker } from 'naive-ui';
|
|
3
4
|
|
|
4
5
|
var EditDate = defineComponent({
|
|
@@ -94,16 +95,23 @@ var EditDate = defineComponent({
|
|
|
94
95
|
}
|
|
95
96
|
};
|
|
96
97
|
};
|
|
98
|
+
function customDateDisabledDecorator(customDateDisabled) {
|
|
99
|
+
if (!isFunction(customDateDisabled))
|
|
100
|
+
return null;
|
|
101
|
+
return (ts) => {
|
|
102
|
+
return customDateDisabled(ts, props.row);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
97
105
|
const config = {
|
|
98
|
-
type: props.col.type || "datetime",
|
|
106
|
+
type: props.col.type || props.col.dateType || "datetime",
|
|
99
107
|
clearable: props.col.clearable || true,
|
|
100
108
|
disabled: props.col.disabled || false,
|
|
101
109
|
valueFormat: props.col.valueFormat || "yyyy-MM-dd HH:mm:ss",
|
|
102
|
-
isDateDisabled: props.col.isDateDisabled || isDateDisabled,
|
|
110
|
+
isDateDisabled: customDateDisabledDecorator(props.col.isDateDisabled) || isDateDisabled,
|
|
103
111
|
placeholder: props.col.placeholder || "\u8BF7\u9009\u62E9"
|
|
104
112
|
};
|
|
105
113
|
if (config.type.includes("time")) {
|
|
106
|
-
config.isTimeDisabled = props.col.isTimeDisabled || isTimeDisabled;
|
|
114
|
+
config.isTimeDisabled = customDateDisabledDecorator(props.col.isTimeDisabled) || isTimeDisabled;
|
|
107
115
|
}
|
|
108
116
|
return () => createVNode(NDatePicker, mergeProps(attrs, config, {
|
|
109
117
|
"onUpdateFormattedValue": onConfirm
|
|
@@ -31,42 +31,52 @@ function useColumnConfigAdaptor() {
|
|
|
31
31
|
...["INPUT"].map((type) => [type, "input"]),
|
|
32
32
|
...["DIGITAL"].map((type) => [type, "number"])
|
|
33
33
|
]);
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
const isNullHandler = (value, result, _fieldItem, _editRules) => {
|
|
35
|
+
if (value === "1")
|
|
36
|
+
return;
|
|
37
|
+
if (value === "0")
|
|
38
|
+
_editRules[_fieldItem.val_key] = [{ required: true, message: "\u5FC5\u586B" }];
|
|
39
|
+
};
|
|
40
|
+
const validateHandler = (value, result) => {
|
|
41
|
+
if (!isObject(value))
|
|
42
|
+
return;
|
|
43
|
+
result.componentProps = Object.assign({}, result.comonentProps, {
|
|
44
|
+
maxlength: value.max_length,
|
|
45
|
+
minlength: value.min_length,
|
|
46
|
+
max: value.max_value,
|
|
47
|
+
min: value.min_value,
|
|
48
|
+
precision: value.decimal_length
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
const dateRangeValidate = (value, result) => {
|
|
52
|
+
if (!isObject(value))
|
|
53
|
+
return;
|
|
54
|
+
result.isDateDisabled = (ts, row) => {
|
|
55
|
+
if (!isObject(row))
|
|
56
|
+
return;
|
|
57
|
+
const { startDate, endDate } = value;
|
|
58
|
+
let invalid = false;
|
|
59
|
+
if (startDate) {
|
|
60
|
+
invalid = new Date(row[startDate]).getTime() > ts;
|
|
43
61
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"validate",
|
|
47
|
-
(value, result) => {
|
|
48
|
-
if (!isObject(value))
|
|
49
|
-
return;
|
|
50
|
-
result.componentProps = Object.assign({}, result.comonentProps, {
|
|
51
|
-
maxlength: value.max_length,
|
|
52
|
-
minlength: value.min_length,
|
|
53
|
-
max: value.max_value,
|
|
54
|
-
min: value.min_value,
|
|
55
|
-
precision: value.decimal_length
|
|
56
|
-
});
|
|
62
|
+
if (endDate) {
|
|
63
|
+
invalid = invalid || new Date(row[endDate]).getTime() < ts;
|
|
57
64
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
return invalid;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
const switchOptionHandler = (value, result) => {
|
|
69
|
+
if (!isObject(value))
|
|
70
|
+
return;
|
|
71
|
+
const option = { label: value.describe, ...value };
|
|
72
|
+
result.options = isArray(result.options) ? [...result.options, option] : [option];
|
|
73
|
+
};
|
|
74
|
+
const settingMap = new Map([
|
|
75
|
+
["multi_select_value", { property: "multiple", valueMap: multipleValueMap }],
|
|
76
|
+
["is_null", isNullHandler],
|
|
77
|
+
["validate", validateHandler],
|
|
78
|
+
["dateValidate", dateRangeValidate],
|
|
79
|
+
...["open", "close"].map((key) => [key, switchOptionHandler]),
|
|
70
80
|
["is_edit", { property: "isEdit", valueMap: isEditValueMap }],
|
|
71
81
|
["html_type", { property: "formType", valueMap: htmlTypeValueMap }],
|
|
72
82
|
["option", { property: "options", fieldMap: /* @__PURE__ */ new Map([["text", "label"]]) }]
|
|
@@ -133,7 +133,14 @@ const useFormat = (state) => {
|
|
|
133
133
|
item[key] = temp.change_text;
|
|
134
134
|
} else {
|
|
135
135
|
if (temp.background != "#ffffff") {
|
|
136
|
-
|
|
136
|
+
const reg = /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/;
|
|
137
|
+
let color = temp.background;
|
|
138
|
+
let iconHtml = `<span class="${temp.icon}"></span>`;
|
|
139
|
+
if (reg.test(temp.icon)) {
|
|
140
|
+
color = temp.icon;
|
|
141
|
+
iconHtml = `<span class="icon-dot-custom" style="--table-icon-color:${temp.icon};--table-icon-shadow:${temp.icon}80"></span>`;
|
|
142
|
+
}
|
|
143
|
+
item[key] = `<span class="field-span" style="color:${color}">${iconHtml}${temp.change_text || ""}</span>`;
|
|
137
144
|
} else {
|
|
138
145
|
item[key] = temp.change_text;
|
|
139
146
|
}
|
|
@@ -396,6 +396,17 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
396
396
|
height: var(--tableImageHeight);
|
|
397
397
|
width: var(--tableImageWidth);
|
|
398
398
|
}
|
|
399
|
+
.custom-big-table .domPropsInnerHTML-span .icon-dot-custom {
|
|
400
|
+
width: 8px;
|
|
401
|
+
height: 8px;
|
|
402
|
+
-webkit-border-radius: 50%;
|
|
403
|
+
-moz-border-radius: 50%;
|
|
404
|
+
border-radius: 50%;
|
|
405
|
+
background: var(--table-icon-color);
|
|
406
|
+
display: inline-block;
|
|
407
|
+
margin-right: 6px;
|
|
408
|
+
box-shadow: 0px 2px 4px 0px var(--table-icon-shadow);
|
|
409
|
+
}
|
|
399
410
|
.custom-big-table .domPropsInnerHTML-span .icon-dot-red {
|
|
400
411
|
width: 8px;
|
|
401
412
|
height: 8px;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent, computed, watch, openBlock, createBlock, unref, withCtx, createElementBlock, createVNode, isRef, Fragment, renderList, createCommentVNode, createElementVNode, normalizeStyle, renderSlot, toDisplayString, nextTick } from 'vue';
|
|
2
2
|
import { createForm, onFieldValueChange, isField } from '@formily/core';
|
|
3
3
|
import { FormProvider, FormConsumer } from '@formily/vue';
|
|
4
|
-
import { cloneDeep } from 'lodash-es';
|
|
4
|
+
import { cloneDeep, isArray, isObject } from 'lodash-es';
|
|
5
5
|
import { NForm, NTabs, NTabPane, NConfigProvider } from 'naive-ui';
|
|
6
6
|
import { FormItemLineBarDepKeyPrepend } from '../../../packages/form-render/src/constants';
|
|
7
|
-
import { queryDecorator, queryInput, getParentLinebar } from '../../../packages/form-render/src/utils';
|
|
7
|
+
import { arrayed, queryDecorator, queryInput, getParentLinebar } from '../../../packages/form-render/src/utils';
|
|
8
8
|
import { useNuiThemeOverrides } from '../../../packages/form-table/src/hooks/useNuiThemeOverrides';
|
|
9
9
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
|
|
10
10
|
import { useFormContext } from './hooks/useFormContext.js';
|
|
@@ -95,9 +95,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
95
95
|
expose({
|
|
96
96
|
validate(path = "*") {
|
|
97
97
|
return formModel.validate(path).catch((err) => {
|
|
98
|
-
return Promise.reject(Array.isArray(err) ? err.
|
|
98
|
+
return Promise.reject(Array.isArray(err) ? err.reduce(errInfoNormalize, []) : err);
|
|
99
99
|
});
|
|
100
|
+
function errInfoNormalize(result, error) {
|
|
101
|
+
let childMessageNum = 0;
|
|
102
|
+
if (isArray(error.messages)) {
|
|
103
|
+
error.messages.forEach((message) => {
|
|
104
|
+
if (!isObject(message))
|
|
105
|
+
return;
|
|
106
|
+
result.push(...arrayed(message).map(bindInfo));
|
|
107
|
+
childMessageNum++;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
!childMessageNum && result.push(bindInfo(error));
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
100
113
|
function bindInfo(info) {
|
|
114
|
+
if (info.decoratorElement)
|
|
115
|
+
return info;
|
|
101
116
|
info.title = formModel.query(info.path).get("title");
|
|
102
117
|
info.decoratorElement = queryDecorator(info.path, scrollbarRef.value, formUUID);
|
|
103
118
|
Object.assign(info, queryInput(info.decoratorElement));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch,
|
|
1
|
+
import { defineComponent, onMounted, ref, computed, watch, createVNode, createTextVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
3
|
import { Path } from '../../../../../node_modules/@formily/path/esm/index.js';
|
|
4
|
-
import { isNumber } from 'lodash-es';
|
|
5
|
-
import {
|
|
4
|
+
import { flatten, isNumber } from 'lodash-es';
|
|
5
|
+
import { useFormField } from '../../../../../packages/form-render';
|
|
6
|
+
import { arrayed, assignUpdateValue, formRenderLog } from '../../utils/index.js';
|
|
6
7
|
import { connect, mapProps } from '@formily/vue';
|
|
7
8
|
import { useDebounceFn, isObject } from '@vueuse/core';
|
|
8
9
|
import { NButton } from 'naive-ui';
|
|
@@ -32,7 +33,26 @@ const script = defineComponent({
|
|
|
32
33
|
}) {
|
|
33
34
|
const emitChange = useDebounceFn(function emitChange2() {
|
|
34
35
|
emit("update:value", JSON.stringify(_values.value));
|
|
36
|
+
formRenderRefs.value.splice(groupNum.value);
|
|
35
37
|
}, 300);
|
|
38
|
+
const {
|
|
39
|
+
field
|
|
40
|
+
} = useFormField();
|
|
41
|
+
onMounted(() => {
|
|
42
|
+
if (!isField(field.value))
|
|
43
|
+
return;
|
|
44
|
+
const tempValidator = field.value.validator;
|
|
45
|
+
field.value.validator = [{
|
|
46
|
+
async validator() {
|
|
47
|
+
return Promise.allSettled(formRenderRefs.value.map((formRenderRef) => formRenderRef.validate())).then((resultList) => {
|
|
48
|
+
const rejected = resultList.filter((res) => res.status === "rejected");
|
|
49
|
+
if (!rejected.length)
|
|
50
|
+
return "";
|
|
51
|
+
return flatten(rejected.map((res) => res.reason));
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}, ...tempValidator ? arrayed(tempValidator) : []];
|
|
55
|
+
});
|
|
36
56
|
const formRenderRefs = ref([]);
|
|
37
57
|
const groupNum = ref(1);
|
|
38
58
|
const maxGroupNum = computed(() => {
|
|
@@ -56,7 +76,7 @@ const script = defineComponent({
|
|
|
56
76
|
if (groupNum.value <= value)
|
|
57
77
|
return;
|
|
58
78
|
groupNum.value = value;
|
|
59
|
-
_values.value.splice(
|
|
79
|
+
_values.value.splice(value);
|
|
60
80
|
emitChange();
|
|
61
81
|
}, {
|
|
62
82
|
immediate: true
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isObject } from '@vueuse/core';
|
|
2
2
|
import { pick } from 'lodash-es';
|
|
3
3
|
import { useFormValidator, useTypeNormalize } from '../../../../packages/form-render';
|
|
4
|
-
import { fieldKeyEscape, arrayed, createLinebarId, transformDateFormat } from '../utils/index.js';
|
|
4
|
+
import { fieldKeyEscape, arrayed, createLinebarId, elementIdEscape, transformDateFormat } from '../utils/index.js';
|
|
5
5
|
|
|
6
6
|
function useFieldListAdaptor(collector, uuid) {
|
|
7
7
|
const { createValidatorSchema } = useFormValidator();
|
|
@@ -31,7 +31,7 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
31
31
|
showLabel: item.hide_title !== "1",
|
|
32
32
|
propertyKey: item.val_key,
|
|
33
33
|
annotation: item.annotation,
|
|
34
|
-
id: `${uuid}-${item.val_key}
|
|
34
|
+
id: elementIdEscape(`${uuid}-${item.val_key}`),
|
|
35
35
|
...item.decoratorProps || {}
|
|
36
36
|
}
|
|
37
37
|
});
|
|
@@ -96,7 +96,10 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
96
96
|
};
|
|
97
97
|
const createCombinationSchema = (item) => {
|
|
98
98
|
const schema = createStandardSchema(item);
|
|
99
|
-
schema["x-decorator-props"]
|
|
99
|
+
Object.assign(schema["x-decorator-props"], {
|
|
100
|
+
showLabel: false,
|
|
101
|
+
showFeedback: false
|
|
102
|
+
});
|
|
100
103
|
Object.assign(schema["x-component-props"], {
|
|
101
104
|
title: item.alias || item.name,
|
|
102
105
|
maxGroupNum: item.maxGroupNum,
|
|
@@ -3,12 +3,12 @@ import { SchemaReaction } from '@formily/json-schema/esm/types';
|
|
|
3
3
|
import { SchemaTypes } from '@formily/vue';
|
|
4
4
|
import { CSSProperties, VNode } from 'vue';
|
|
5
5
|
import { DependKeyType, FormCommonState } from '../../../../../es/packages/form-render';
|
|
6
|
-
|
|
6
|
+
declare type FieldBusinessType = 'password' | 'id_card' | 'age' | 'age_unit' | 'mobile' | 'telephone' | 'email' | 'sex' | 'birthday' | 'bank_card' | 'website' | 'gestational_weeks' | 'gestational_stage' | 'customer_name';
|
|
7
7
|
export declare type ValidateItem = Partial<{
|
|
8
8
|
/**
|
|
9
9
|
* 业务类型
|
|
10
10
|
*/
|
|
11
|
-
obj_type:
|
|
11
|
+
obj_type: FieldBusinessType;
|
|
12
12
|
/**
|
|
13
13
|
* 校验类型
|
|
14
14
|
*/
|
|
@@ -28,6 +28,7 @@ export declare function queryInput(decoratorElement?: HTMLElement | null): {
|
|
|
28
28
|
widgetElementList: HTMLInputElement[];
|
|
29
29
|
};
|
|
30
30
|
export declare function getParentLinebar(key: string, fieldList: FieldItem[]): string | null;
|
|
31
|
+
export declare function elementIdEscape(id: string): string;
|
|
31
32
|
export declare function createLinebarId(id: string): string;
|
|
32
33
|
export declare function fieldKeyEscape(fieldList: FieldItem[]): string;
|
|
33
34
|
export declare function createInputSlot(props: AnyObject): import("vue").ComputedRef<Record<string, FunctionalComponent<{}, {}>>>;
|
|
@@ -124,7 +124,7 @@ function createSlot(renderer, props) {
|
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
function queryDecorator(key, wrapperElement, formUUID) {
|
|
127
|
-
return wrapperElement.querySelector(`#${formUUID}-${key}`);
|
|
127
|
+
return wrapperElement.querySelector(elementIdEscape(`#${formUUID}-${key}`));
|
|
128
128
|
}
|
|
129
129
|
function queryInput(decoratorElement) {
|
|
130
130
|
var _a;
|
|
@@ -150,8 +150,11 @@ function getParentLinebar(key, fieldList) {
|
|
|
150
150
|
return field.html_type === "LINEBAR";
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
+
function elementIdEscape(id) {
|
|
154
|
+
return id.replace(".", "-");
|
|
155
|
+
}
|
|
153
156
|
function createLinebarId(id) {
|
|
154
|
-
return `id-${id}
|
|
157
|
+
return elementIdEscape(`id-${id}`);
|
|
155
158
|
}
|
|
156
159
|
function fieldKeyEscape(fieldList) {
|
|
157
160
|
return fieldList.map((f) => f.val_key).join("-").replace(/[.]/g, "_");
|
|
@@ -169,4 +172,4 @@ function createInputSlot(props) {
|
|
|
169
172
|
});
|
|
170
173
|
}
|
|
171
174
|
|
|
172
|
-
export { arrayed, assignUpdateValue, createInputSlot, createLinebarId, createSlot, fieldKeyEscape, formRenderLog, getParentLinebar, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, queryDecorator, queryInput, transformDateFormat, traverseDependKey, traverseSchema, uuidGenerator };
|
|
175
|
+
export { arrayed, assignUpdateValue, createInputSlot, createLinebarId, createSlot, elementIdEscape, fieldKeyEscape, formRenderLog, getParentLinebar, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, queryDecorator, queryInput, transformDateFormat, traverseDependKey, traverseSchema, uuidGenerator };
|
package/es/packages/index.css
CHANGED
|
@@ -396,6 +396,17 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
396
396
|
height: var(--tableImageHeight);
|
|
397
397
|
width: var(--tableImageWidth);
|
|
398
398
|
}
|
|
399
|
+
.custom-big-table .domPropsInnerHTML-span .icon-dot-custom {
|
|
400
|
+
width: 8px;
|
|
401
|
+
height: 8px;
|
|
402
|
+
-webkit-border-radius: 50%;
|
|
403
|
+
-moz-border-radius: 50%;
|
|
404
|
+
border-radius: 50%;
|
|
405
|
+
background: var(--table-icon-color);
|
|
406
|
+
display: inline-block;
|
|
407
|
+
margin-right: 6px;
|
|
408
|
+
box-shadow: 0px 2px 4px 0px var(--table-icon-shadow);
|
|
409
|
+
}
|
|
399
410
|
.custom-big-table .domPropsInnerHTML-span .icon-dot-red {
|
|
400
411
|
width: 8px;
|
|
401
412
|
height: 8px;
|