cnhis-design-vue 3.1.17-beta.4 → 3.1.17-beta.7
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/index.d.ts +6 -0
- package/es/packages/big-table/src/BigTable.vue.d.ts +35 -8
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +6 -2
- package/es/packages/big-table/src/components/edit-form/edit-separate.js +12 -11
- package/es/packages/big-table/src/components/edit-form/edit-separate.vue.d.ts +13 -1
- package/es/packages/big-table/src/hooks/useEdit.d.ts +13 -1
- package/es/packages/button-print/index.d.ts +1 -1
- package/es/packages/button-print/src/ButtonPrint.vue.d.ts +1 -1
- package/es/packages/button-print/src/ButtonPrint.vue_vue_type_script_setup_true_lang.js +13 -17
- package/es/packages/fabric-chart/src/hooks/useLeft.js +3 -1
- package/es/packages/fabric-chart/src/hooks/useRight.js +8 -2
- package/es/packages/form-render/src/components/renderer/inputNumber.d.ts +16 -2
- package/es/packages/form-render/src/components/renderer/inputNumber.js +31 -4
- package/es/packages/form-render/src/hooks/useCommonInjection.js +4 -1
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +4 -6
- package/es/packages/form-render/src/hooks/useFormValidator.js +20 -5
- package/es/packages/form-render/style/index.css +1 -1
- package/es/packages/index.css +1 -1
- package/es/src/utils/colorLog.d.ts +31 -0
- package/es/src/utils/colorLog.js +44 -0
- package/package.json +3 -1
|
@@ -2941,6 +2941,12 @@ declare const BigTable: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
2941
2941
|
} | null;
|
|
2942
2942
|
showOverflow: boolean;
|
|
2943
2943
|
})[];
|
|
2944
|
+
getRowData: (row: import("../../../es/src/types").AnyObject) => {
|
|
2945
|
+
separateData: Record<string, string>;
|
|
2946
|
+
index: number;
|
|
2947
|
+
rawRow: import("../../../es/src/types").AnyObject;
|
|
2948
|
+
row: import("../../../es/src/types").AnyObject;
|
|
2949
|
+
} | undefined;
|
|
2944
2950
|
formatterEdit: (params: any, col: any) => any;
|
|
2945
2951
|
getEditBtn: (row: any, col: any, index: any) => any;
|
|
2946
2952
|
formatter: (params: any, col: any, _isEdit: any) => any;
|
|
@@ -1126,12 +1126,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1126
1126
|
textColorGhostHoverWarning: string;
|
|
1127
1127
|
textColorGhostPressedWarning: string;
|
|
1128
1128
|
textColorGhostFocusWarning: string;
|
|
1129
|
-
textColorGhostDisabledWarning: string;
|
|
1130
|
-
* 判断是否渲染EditForm
|
|
1131
|
-
* @param {*} row
|
|
1132
|
-
* @param {*} column
|
|
1133
|
-
* @returns
|
|
1134
|
-
*/
|
|
1129
|
+
textColorGhostDisabledWarning: string;
|
|
1135
1130
|
borderWarning: string;
|
|
1136
1131
|
borderHoverWarning: string;
|
|
1137
1132
|
borderPressedWarning: string;
|
|
@@ -1158,7 +1153,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1158
1153
|
textColorGhostPressedError: string;
|
|
1159
1154
|
textColorGhostFocusError: string;
|
|
1160
1155
|
textColorGhostDisabledError: string;
|
|
1161
|
-
borderError: string;
|
|
1156
|
+
borderError: string; /**
|
|
1157
|
+
* 初始化props
|
|
1158
|
+
* @param {*} unionItem
|
|
1159
|
+
* @param {*} row
|
|
1160
|
+
* @param {*} column
|
|
1161
|
+
* @param {*} $rowIndex
|
|
1162
|
+
* @returns
|
|
1163
|
+
*/
|
|
1162
1164
|
borderHoverError: string;
|
|
1163
1165
|
borderPressedError: string;
|
|
1164
1166
|
borderFocusError: string;
|
|
@@ -1210,6 +1212,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1210
1212
|
colorTertiaryPressed: string;
|
|
1211
1213
|
colorQuaternary: string;
|
|
1212
1214
|
colorQuaternaryHover: string;
|
|
1215
|
+
/**
|
|
1216
|
+
* 单个form提交成功数据
|
|
1217
|
+
* @param {*} obj formData
|
|
1218
|
+
*/
|
|
1213
1219
|
colorQuaternaryPressed: string;
|
|
1214
1220
|
color: string;
|
|
1215
1221
|
colorHover: string;
|
|
@@ -2945,6 +2951,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2945
2951
|
} | null;
|
|
2946
2952
|
showOverflow: boolean;
|
|
2947
2953
|
})[];
|
|
2954
|
+
getRowData: (row: import("../../../src/types").AnyObject) => {
|
|
2955
|
+
separateData: Record<string, string>;
|
|
2956
|
+
index: number;
|
|
2957
|
+
rawRow: import("../../../src/types").AnyObject;
|
|
2958
|
+
row: import("../../../src/types").AnyObject;
|
|
2959
|
+
} | undefined;
|
|
2948
2960
|
formatterEdit: (params: any, col: any) => any;
|
|
2949
2961
|
getEditBtn: (row: any, col: any, index: any) => any;
|
|
2950
2962
|
formatter: (params: any, col: any, _isEdit: any) => any;
|
|
@@ -3287,7 +3299,22 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3287
3299
|
errorColor: string;
|
|
3288
3300
|
errorColorHover: string;
|
|
3289
3301
|
errorColorPressed: string;
|
|
3290
|
-
errorColorSuppl: string;
|
|
3302
|
+
errorColorSuppl: string; /**
|
|
3303
|
+
* 针对 bigTable 的设置列
|
|
3304
|
+
* type: 列的类型
|
|
3305
|
+
* field: 列字段名(注:属性层级越深,渲染性能将直线下降)
|
|
3306
|
+
* title: 列标题(支持开启国际化)
|
|
3307
|
+
* width: 列宽度(如果为空则均匀分配剩余宽度,如果全部列固定了,可能会存在宽屏下不会铺满,可以配合 "%" 或者 "min-width" 布局)
|
|
3308
|
+
* minWidth: 最小列宽度;会自动将剩余空间按比例分配
|
|
3309
|
+
* resizable: 列是否允许拖动列宽调整大小
|
|
3310
|
+
* visible: 列是否显示
|
|
3311
|
+
* fixed: 将列固定在左侧或者右侧(注意:固定列应该放在左右两侧的位置)
|
|
3312
|
+
* align: 列对齐方式
|
|
3313
|
+
* headerAlign: 表头列的对齐方式
|
|
3314
|
+
* footerAlign: 表尾列的对齐方式
|
|
3315
|
+
* formatter: 格式化显示内容 Function({cellValue, row, column})
|
|
3316
|
+
* sortable: 是否允许列排序
|
|
3317
|
+
*/
|
|
3291
3318
|
textColorBase: string;
|
|
3292
3319
|
textColor1: string;
|
|
3293
3320
|
textColor2: string;
|
|
@@ -19,7 +19,7 @@ import { useBatchEditing } from './hooks/useBatchEditing.js';
|
|
|
19
19
|
import { useNestTable } from './hooks/useNestTable.js';
|
|
20
20
|
import { useAnchor } from './hooks/useAnchor.js';
|
|
21
21
|
import { useEvent } from './hooks/useEvent.js';
|
|
22
|
-
import { useSeparateRow } from './hooks/useSeparateRow.js';
|
|
22
|
+
import { useSeparateRow, useSeparateMap } from './hooks/useSeparateRow.js';
|
|
23
23
|
import { useFormat } from './hooks/useFormat.js';
|
|
24
24
|
import { useTableParse } from './hooks/useTableParse.js';
|
|
25
25
|
import { useEdit, comps } from './hooks/useEdit.js';
|
|
@@ -506,7 +506,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
506
506
|
state.columnLen = currentColumns.filter((item) => item.visible).length;
|
|
507
507
|
return columns;
|
|
508
508
|
};
|
|
509
|
+
const {
|
|
510
|
+
getRowData
|
|
511
|
+
} = useSeparateMap();
|
|
509
512
|
const formatterEdit = (params, col) => {
|
|
513
|
+
var _a, _b;
|
|
510
514
|
let {
|
|
511
515
|
row,
|
|
512
516
|
column,
|
|
@@ -526,7 +530,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
526
530
|
const propsData = {
|
|
527
531
|
col,
|
|
528
532
|
row,
|
|
529
|
-
index: $rowIndex,
|
|
533
|
+
index: (_b = (_a = getRowData(row)) == null ? void 0 : _a.index) != null ? _b : $rowIndex,
|
|
530
534
|
type: formType,
|
|
531
535
|
...col.componentProps || {},
|
|
532
536
|
onFormChange,
|
|
@@ -24,32 +24,33 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
24
24
|
watch(show, updateShow);
|
|
25
25
|
const editContent = ref();
|
|
26
26
|
const { getRowData } = useSeparateMap();
|
|
27
|
-
async function
|
|
27
|
+
async function onShow(target) {
|
|
28
28
|
var _a;
|
|
29
|
-
const target = getRowData(props.row);
|
|
30
29
|
if (!target)
|
|
31
30
|
return;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const old = target.row[props.col.field];
|
|
31
|
+
editContent.value = cloneDeep(target.row[props.col.field]);
|
|
32
|
+
await new Promise((resolve) => setTimeout(resolve));
|
|
33
|
+
(_a = popoverRef.value) == null ? void 0 : _a.syncPosition();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
async function onClose(target) {
|
|
39
37
|
if (!target)
|
|
40
38
|
return;
|
|
39
|
+
const old = target.row[props.col.field];
|
|
41
40
|
if (!isObject(editContent.value) && !isArray(editContent.value)) {
|
|
42
41
|
if (old === editContent.value)
|
|
43
42
|
return;
|
|
44
43
|
}
|
|
45
|
-
target.rawRow[props.col.field] = editContent.value;
|
|
46
44
|
emit("formChange", {
|
|
47
45
|
value: editContent.value,
|
|
48
|
-
row:
|
|
46
|
+
row: props.row,
|
|
49
47
|
column: props.col,
|
|
50
48
|
index: target.index
|
|
51
49
|
});
|
|
52
50
|
}
|
|
51
|
+
function updateShow(show2) {
|
|
52
|
+
show2 ? onShow(getRowData(props.row)) : onClose(getRowData(props.row));
|
|
53
|
+
}
|
|
53
54
|
const style = {
|
|
54
55
|
border: "1px solid #f5f5f5",
|
|
55
56
|
padding: "4px 0 4px 4px",
|
|
@@ -41,7 +41,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
41
41
|
rawRow: AnyObject;
|
|
42
42
|
row: AnyObject;
|
|
43
43
|
} | undefined;
|
|
44
|
-
|
|
44
|
+
onShow: (target: {
|
|
45
|
+
separateData: Record<string, string>;
|
|
46
|
+
index: number;
|
|
47
|
+
rawRow: AnyObject;
|
|
48
|
+
row: AnyObject;
|
|
49
|
+
} | undefined) => Promise<void>;
|
|
50
|
+
onClose: (target: {
|
|
51
|
+
separateData: Record<string, string>;
|
|
52
|
+
index: number;
|
|
53
|
+
rawRow: AnyObject;
|
|
54
|
+
row: AnyObject;
|
|
55
|
+
} | undefined) => Promise<void>;
|
|
56
|
+
updateShow: (show: boolean) => void;
|
|
45
57
|
style: CSSProperties;
|
|
46
58
|
SlotRender: import("vue").DefineComponent<{
|
|
47
59
|
renderer: {
|
|
@@ -233,7 +233,19 @@ export declare const comps: {
|
|
|
233
233
|
rawRow: import("../../../../src/types").AnyObject;
|
|
234
234
|
row: import("../../../../src/types").AnyObject;
|
|
235
235
|
} | undefined;
|
|
236
|
-
|
|
236
|
+
onShow: (target: {
|
|
237
|
+
separateData: Record<string, string>;
|
|
238
|
+
index: number;
|
|
239
|
+
rawRow: import("../../../../src/types").AnyObject;
|
|
240
|
+
row: import("../../../../src/types").AnyObject;
|
|
241
|
+
} | undefined) => Promise<void>;
|
|
242
|
+
onClose: (target: {
|
|
243
|
+
separateData: Record<string, string>;
|
|
244
|
+
index: number;
|
|
245
|
+
rawRow: import("../../../../src/types").AnyObject;
|
|
246
|
+
row: import("../../../../src/types").AnyObject;
|
|
247
|
+
} | undefined) => Promise<void>;
|
|
248
|
+
updateShow: (show: boolean) => void;
|
|
237
249
|
style: import("vue").CSSProperties;
|
|
238
250
|
SlotRender: import("vue").DefineComponent<{
|
|
239
251
|
renderer: {
|
|
@@ -133,8 +133,8 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
133
133
|
}[];
|
|
134
134
|
currentFormatItem: import("vue").ComputedRef<{} | undefined>;
|
|
135
135
|
formatTitle: import("vue").ComputedRef<any>;
|
|
136
|
+
getTemplateIdByFormatId: import("vue").ComputedRef<any>;
|
|
136
137
|
renderLabel: (option: any) => any;
|
|
137
|
-
getTemplateIdByFormatId: (id: any) => any;
|
|
138
138
|
callLocalServicesSuccessCb: (res: any, type: any) => void;
|
|
139
139
|
callLocalServicesErrorCb: (res: any) => void;
|
|
140
140
|
prevFnError: () => void;
|
|
@@ -137,8 +137,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
137
137
|
}[];
|
|
138
138
|
currentFormatItem: import("vue").ComputedRef<{} | undefined>;
|
|
139
139
|
formatTitle: import("vue").ComputedRef<any>;
|
|
140
|
+
getTemplateIdByFormatId: import("vue").ComputedRef<any>;
|
|
140
141
|
renderLabel: (option: any) => any;
|
|
141
|
-
getTemplateIdByFormatId: (id: any) => any;
|
|
142
142
|
callLocalServicesSuccessCb: (res: any, type: any) => void;
|
|
143
143
|
callLocalServicesErrorCb: (res: any) => void;
|
|
144
144
|
prevFnError: () => void;
|
|
@@ -102,6 +102,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
102
102
|
return state.formatList.find((item) => item.id === id);
|
|
103
103
|
});
|
|
104
104
|
const formatTitle = computed(() => currentFormatItem.value.name || "\u683C\u5F0F\u9009\u62E9");
|
|
105
|
+
const getTemplateIdByFormatId = computed(() => {
|
|
106
|
+
let find = state.formatList.find((item) => item.id === state.currentFormatId);
|
|
107
|
+
return find == null ? void 0 : find.templateId;
|
|
108
|
+
});
|
|
105
109
|
const renderLabel = (option) => {
|
|
106
110
|
return createVNode("span", {
|
|
107
111
|
"class": {
|
|
@@ -109,15 +113,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
109
113
|
}
|
|
110
114
|
}, [option.label]);
|
|
111
115
|
};
|
|
112
|
-
const getTemplateIdByFormatId = (id) => {
|
|
113
|
-
let find = state.formatList.find((item) => item.id === id);
|
|
114
|
-
return find.templateId;
|
|
115
|
-
};
|
|
116
116
|
const callLocalServicesSuccessCb = (res, type) => {
|
|
117
117
|
let info = {
|
|
118
118
|
type,
|
|
119
119
|
formatId: state.currentFormatId,
|
|
120
|
-
templateId: getTemplateIdByFormatId
|
|
120
|
+
templateId: getTemplateIdByFormatId.value
|
|
121
121
|
};
|
|
122
122
|
emit("success", res, info);
|
|
123
123
|
};
|
|
@@ -180,7 +180,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
180
180
|
for (let i = 0; i < state.printParams.length; i++) {
|
|
181
181
|
const queryParams = {
|
|
182
182
|
formatId: state.currentFormatId,
|
|
183
|
-
templateId: getTemplateIdByFormatId
|
|
183
|
+
templateId: getTemplateIdByFormatId.value,
|
|
184
184
|
params: getPrintParams(i)
|
|
185
185
|
};
|
|
186
186
|
printInstance.printDirect(queryParams, callLocalServicesSuccessCbTmp, callLocalServicesErrorCb);
|
|
@@ -188,7 +188,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
188
188
|
} else {
|
|
189
189
|
const queryParams = {
|
|
190
190
|
formatId: state.currentFormatId,
|
|
191
|
-
templateId: getTemplateIdByFormatId
|
|
191
|
+
templateId: getTemplateIdByFormatId.value,
|
|
192
192
|
params: getOnceParams()
|
|
193
193
|
};
|
|
194
194
|
printInstance.printDirect(queryParams, (res) => {
|
|
@@ -207,7 +207,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
207
207
|
const params = props.strategy === "MULTI" ? getPrintParams() : getOnceParams();
|
|
208
208
|
const queryParams = {
|
|
209
209
|
formatId: state.currentFormatId,
|
|
210
|
-
templateId: getTemplateIdByFormatId
|
|
210
|
+
templateId: getTemplateIdByFormatId.value,
|
|
211
211
|
params
|
|
212
212
|
};
|
|
213
213
|
printInstance.preview(queryParams, (res) => {
|
|
@@ -225,7 +225,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
225
225
|
const params = props.strategy === "MULTI" ? getPrintParams() : getOnceParams();
|
|
226
226
|
const queryParams = {
|
|
227
227
|
formatId: state.currentFormatId,
|
|
228
|
-
templateId: getTemplateIdByFormatId
|
|
228
|
+
templateId: getTemplateIdByFormatId.value,
|
|
229
229
|
print: {
|
|
230
230
|
print: "1",
|
|
231
231
|
type: "1",
|
|
@@ -357,7 +357,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
357
357
|
};
|
|
358
358
|
const initCRM = async (formatListResult) => {
|
|
359
359
|
var _a;
|
|
360
|
-
console.log("formatListResult", formatListResult);
|
|
361
360
|
state.formatList = formatListResult ? formatFormatList(formatListResult.obj) : [];
|
|
362
361
|
state.currentFormatId = getDefaultFormatId(state.formatList, "defaultFlag");
|
|
363
362
|
if (!state.currentFormatId) {
|
|
@@ -365,14 +364,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
365
364
|
return requestError();
|
|
366
365
|
}
|
|
367
366
|
setOptions();
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
let templateParamsResult = ((_a = await props.queryTemplateParams()) == null ? void 0 : _a.obj) || {};
|
|
373
|
-
if (templateParamsResult) {
|
|
367
|
+
let templateParamsResult = (_a = await props.queryTemplateParams()) == null ? void 0 : _a.obj;
|
|
368
|
+
if (templateParamsResult && getTemplateIdByFormatId.value) {
|
|
374
369
|
state.templateParams = templateParamsResult;
|
|
375
370
|
} else {
|
|
371
|
+
$message.error("\u83B7\u53D6\u6253\u5370\u6A21\u677F\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\uFF01");
|
|
376
372
|
return requestError();
|
|
377
373
|
}
|
|
378
374
|
state.printParams = formatParams(state.templateParams, props.params);
|
|
@@ -420,7 +416,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
420
416
|
state.identityVerification.visible = false;
|
|
421
417
|
const queryParams = {
|
|
422
418
|
formatId: state.currentFormatId,
|
|
423
|
-
templateId: getTemplateIdByFormatId
|
|
419
|
+
templateId: getTemplateIdByFormatId.value,
|
|
424
420
|
params: getPrintParams(),
|
|
425
421
|
token
|
|
426
422
|
};
|
|
@@ -261,10 +261,12 @@ function useLeft(canvas, propItems, emits, setPopup, pointTipProps, getXValue, g
|
|
|
261
261
|
nextTick(() => {
|
|
262
262
|
var _a;
|
|
263
263
|
iconsWidth && drawIcons();
|
|
264
|
-
const yScaleValueList = left.yScaleValue.filter((v) => v.layout === "left"
|
|
264
|
+
const yScaleValueList = left.yScaleValue.filter((v) => v.layout === "left" && v.type !== "pain");
|
|
265
265
|
if ((right == null ? void 0 : right.width) && ((_a = right == null ? void 0 : right.yScaleValue) == null ? void 0 : _a.layout) === "left") {
|
|
266
266
|
yScaleValueList.push(getRightInfo);
|
|
267
267
|
}
|
|
268
|
+
painIndex == 0 && yScaleValueList.unshift(left.yScaleValue[painIndex]);
|
|
269
|
+
painIndex == left.yScaleValue.length - 1 && yScaleValueList.push(left.yScaleValue[painIndex]);
|
|
268
270
|
drawScaleValue(yScaleValueList);
|
|
269
271
|
canvas.value.renderAll();
|
|
270
272
|
});
|
|
@@ -3,15 +3,21 @@ import { fabric } from '../utils/index.js';
|
|
|
3
3
|
import { defaultBorderStyle } from './useDraw.js';
|
|
4
4
|
|
|
5
5
|
function useRight(canvas, propItems, drawScaleValue) {
|
|
6
|
-
const { left, right, getRightInfo, canvasWidth, endY } = propItems;
|
|
6
|
+
const { left, right, getRightInfo, canvasWidth, endY, endX, originY } = propItems;
|
|
7
7
|
onMounted(() => {
|
|
8
8
|
nextTick(() => {
|
|
9
9
|
var _a;
|
|
10
10
|
const yScaleValueList = left.yScaleValue.filter((v) => v.layout === "right");
|
|
11
11
|
if ((right == null ? void 0 : right.width) && ((_a = right == null ? void 0 : right.yScaleValue) == null ? void 0 : _a.layout) === "right") {
|
|
12
12
|
yScaleValueList.push(getRightInfo);
|
|
13
|
+
}
|
|
14
|
+
if ((right == null ? void 0 : right.width) || yScaleValueList.length > 0) {
|
|
13
15
|
const rightBorderLine = new fabric.Line([canvasWidth - 1, 0, canvasWidth - 1, endY], defaultBorderStyle);
|
|
14
|
-
|
|
16
|
+
const rightBorderLine2 = new fabric.Line([endX + 1, originY, canvasWidth - 1, originY], {
|
|
17
|
+
...defaultBorderStyle,
|
|
18
|
+
stroke: "#fff"
|
|
19
|
+
});
|
|
20
|
+
canvas.value.add(rightBorderLine, rightBorderLine2);
|
|
15
21
|
}
|
|
16
22
|
drawScaleValue(yScaleValueList);
|
|
17
23
|
});
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import { Func } from '../../../../../../es/src/types';
|
|
2
|
+
import { PropType } from 'vue';
|
|
1
3
|
export declare const INPUT_NUMBER: import("vue").DefineComponent<{
|
|
2
|
-
|
|
4
|
+
value: {
|
|
5
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
6
|
+
};
|
|
7
|
+
onChange: {
|
|
8
|
+
type: PropType<Func<any[], any>>;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
3
11
|
prefix: {
|
|
4
12
|
type: StringConstructor;
|
|
5
13
|
};
|
|
@@ -7,7 +15,13 @@ export declare const INPUT_NUMBER: import("vue").DefineComponent<{
|
|
|
7
15
|
type: StringConstructor;
|
|
8
16
|
};
|
|
9
17
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
-
|
|
18
|
+
value: {
|
|
19
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
20
|
+
};
|
|
21
|
+
onChange: {
|
|
22
|
+
type: PropType<Func<any[], any>>;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
11
25
|
prefix: {
|
|
12
26
|
type: StringConstructor;
|
|
13
27
|
};
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import { defineComponent, createVNode } from 'vue';
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent, watch, computed, createVNode } from 'vue';
|
|
2
|
+
import { isString, isNumber } from 'lodash-es';
|
|
3
|
+
import { useCommonInjection } from '../../../../../packages/form-render/src/hooks/useCommonInjection';
|
|
4
|
+
import { createInputSlot, parseNumberFromMaybeString } from '../../utils/index.js';
|
|
3
5
|
import { connect, mapProps } from '@formily/vue';
|
|
4
6
|
import { NInputNumber } from 'naive-ui';
|
|
5
7
|
import { assignUpdateValue } from '../../utils/schema.js';
|
|
6
8
|
|
|
7
9
|
const script = defineComponent({
|
|
8
10
|
props: {
|
|
9
|
-
|
|
11
|
+
value: {
|
|
12
|
+
type: [Number, String]
|
|
13
|
+
},
|
|
14
|
+
onChange: {
|
|
15
|
+
type: Function,
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
10
18
|
prefix: {
|
|
11
19
|
type: String
|
|
12
20
|
},
|
|
@@ -16,8 +24,27 @@ const script = defineComponent({
|
|
|
16
24
|
},
|
|
17
25
|
setup(props) {
|
|
18
26
|
const _slots = createInputSlot(props);
|
|
27
|
+
useCommonInjection().injectValueValidate(() => props.value);
|
|
28
|
+
watch(() => props.value, (value) => {
|
|
29
|
+
if (value == null)
|
|
30
|
+
return;
|
|
31
|
+
if (!isString(value) && !isNumber(value) || Number.isNaN(+value))
|
|
32
|
+
return props.onChange(null);
|
|
33
|
+
props.onChange(+value);
|
|
34
|
+
});
|
|
35
|
+
const valueRef = computed({
|
|
36
|
+
get: () => parseNumberFromMaybeString(props.value),
|
|
37
|
+
set: (v) => {
|
|
38
|
+
var _a;
|
|
39
|
+
return (_a = props.onChange) == null ? void 0 : _a.call(props, v);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
19
42
|
return () => {
|
|
20
|
-
return createVNode(NInputNumber,
|
|
43
|
+
return createVNode(NInputNumber, {
|
|
44
|
+
"value": valueRef.value,
|
|
45
|
+
"onUpdate:value": ($event) => valueRef.value = $event,
|
|
46
|
+
"show-button": false
|
|
47
|
+
}, _slots.value);
|
|
21
48
|
};
|
|
22
49
|
}
|
|
23
50
|
});
|
|
@@ -7,7 +7,10 @@ function useCommonInjection() {
|
|
|
7
7
|
const { field } = useFormField();
|
|
8
8
|
watch(traverser, () => {
|
|
9
9
|
var _a, _b;
|
|
10
|
-
|
|
10
|
+
try {
|
|
11
|
+
isField(field.value) && field.value.visited && ((_b = (_a = field.value).validate) == null ? void 0 : _b.call(_a));
|
|
12
|
+
} catch (e) {
|
|
13
|
+
}
|
|
11
14
|
});
|
|
12
15
|
}
|
|
13
16
|
function injectValueWatchFromEmpty(traverser, trigger) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isObject } from '@vueuse/core';
|
|
2
|
-
import { cloneDeep, pick } from 'lodash-es';
|
|
2
|
+
import { cloneDeep, omit, pick } from 'lodash-es';
|
|
3
3
|
import { useFormValidator, useFieldNormalize } from '../../../../packages/form-render';
|
|
4
4
|
import { arrayed, parseNumberFromMaybeString, formRenderLog } from '../utils/index.js';
|
|
5
5
|
import { fieldKeyEscape, createLinebarId } from '../utils/schema.js';
|
|
@@ -20,9 +20,9 @@ function useFieldListAdaptor(collector) {
|
|
|
20
20
|
clearable: item.is_empty === "0",
|
|
21
21
|
...item.componentProps || {},
|
|
22
22
|
onBlur(...args) {
|
|
23
|
-
var _a2;
|
|
23
|
+
var _a2, _b;
|
|
24
24
|
collector.trigger(item.val_key, "blur");
|
|
25
|
-
(_a2 = item.componentProps) == null ? void 0 : _a2.onBlur(...args);
|
|
25
|
+
(_b = (_a2 = item.componentProps) == null ? void 0 : _a2.onBlur) == null ? void 0 : _b.call(_a2, ...args);
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"x-display": item.is_show === "0" ? "hidden" : "visible",
|
|
@@ -122,8 +122,6 @@ function useFieldListAdaptor(collector) {
|
|
|
122
122
|
const { decimal_length, validate } = item;
|
|
123
123
|
Object.assign(schema["x-component-props"], {
|
|
124
124
|
precision: decimal_length || (validate == null ? void 0 : validate.decimal_length),
|
|
125
|
-
max: validate == null ? void 0 : validate.max_value,
|
|
126
|
-
min: validate == null ? void 0 : validate.min_value,
|
|
127
125
|
prefix: item.prefix,
|
|
128
126
|
suffix: item.suffix
|
|
129
127
|
});
|
|
@@ -142,7 +140,7 @@ function useFieldListAdaptor(collector) {
|
|
|
142
140
|
const createCustomSchema = (item) => {
|
|
143
141
|
const schema = createStandardSchema(item);
|
|
144
142
|
Object.assign(schema["x-component-props"], {
|
|
145
|
-
fieldItem: item
|
|
143
|
+
fieldItem: omit(item, ["reactions"])
|
|
146
144
|
});
|
|
147
145
|
return schema;
|
|
148
146
|
};
|
|
@@ -13,6 +13,8 @@ function useFormValidator() {
|
|
|
13
13
|
({ validate }) => ({
|
|
14
14
|
validator(value) {
|
|
15
15
|
var _a;
|
|
16
|
+
if (value == null)
|
|
17
|
+
return;
|
|
16
18
|
if (!isString(value) || !isIdCard(value))
|
|
17
19
|
return (_a = validate == null ? void 0 : validate.message) != null ? _a : "\u8BE5\u5B57\u6BB5\u4E0D\u662F\u5408\u6CD5\u7684\u8EAB\u4EFD\u8BC1\u683C\u5F0F";
|
|
18
20
|
}
|
|
@@ -28,20 +30,33 @@ function useFormValidator() {
|
|
|
28
30
|
]
|
|
29
31
|
]);
|
|
30
32
|
const commonValidateConfig = { triggerType: "onBlur" };
|
|
33
|
+
const createDecimalValidator = (decimal, message) => {
|
|
34
|
+
const errorMessage = message != null ? message : `\u5C0F\u6570\u4F4D\u6570\u6700\u591A${decimal}\u4F4D`;
|
|
35
|
+
return {
|
|
36
|
+
validator(value) {
|
|
37
|
+
var _a;
|
|
38
|
+
return ((_a = String(value).split(".")[1]) == null ? void 0 : _a.length) > decimal ? errorMessage : "";
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
31
42
|
function createValidatorSchema(fieldItem) {
|
|
32
43
|
const rules = [];
|
|
33
|
-
const { validate: { vali_obj, max_length, message } = {}, validator } = fieldItem;
|
|
44
|
+
const { validate: { vali_obj, max_length, message, max_value, min_value, decimal_length } = {}, validator } = fieldItem;
|
|
34
45
|
if (validator) {
|
|
35
|
-
|
|
36
|
-
_validator.forEach((f) => {
|
|
46
|
+
arrayed(validator).forEach((f) => {
|
|
37
47
|
if (!isFunction(f))
|
|
38
48
|
return;
|
|
39
49
|
rules.push({ validator: (value) => f(value, fieldItem) });
|
|
40
50
|
});
|
|
41
51
|
}
|
|
42
|
-
if (max_length)
|
|
52
|
+
if (max_length)
|
|
43
53
|
rules.push({ max: max_length, message });
|
|
44
|
-
|
|
54
|
+
if (max_value)
|
|
55
|
+
rules.push({ maximum: max_value, message });
|
|
56
|
+
if (min_value)
|
|
57
|
+
rules.push({ minimum: min_value, message });
|
|
58
|
+
if (decimal_length != null)
|
|
59
|
+
rules.push(createDecimalValidator(+decimal_length, message));
|
|
45
60
|
const ruleCreator = vali_obj && validateMap.get(vali_obj);
|
|
46
61
|
ruleCreator && rules.push(Object.assign({}, commonValidateConfig, ruleCreator(fieldItem)));
|
|
47
62
|
return rules;
|
package/es/packages/index.css
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare enum LogsType {
|
|
2
|
+
DEFAULT = "default",
|
|
3
|
+
PRIMARY = "primary",
|
|
4
|
+
SUCCESS = "success",
|
|
5
|
+
WARNING = "warning",
|
|
6
|
+
DANGER = "danger"
|
|
7
|
+
}
|
|
8
|
+
declare class Log {
|
|
9
|
+
/**
|
|
10
|
+
* @description 打印一个 [ title | text ] 样式的信息
|
|
11
|
+
* @param {String} title title text
|
|
12
|
+
* @param {String} info info text
|
|
13
|
+
* @param {String} type style
|
|
14
|
+
* @param {any[]} appendInfo
|
|
15
|
+
*/
|
|
16
|
+
capsule(title: string, info: any, type?: LogsType, ...appendInfo: any[]): void;
|
|
17
|
+
/**
|
|
18
|
+
* @description 打印彩色文字
|
|
19
|
+
*/
|
|
20
|
+
colorful(textArr: {
|
|
21
|
+
text: any;
|
|
22
|
+
type: LogsType;
|
|
23
|
+
}[]): void;
|
|
24
|
+
text(text: any): void;
|
|
25
|
+
primary(text: any): void;
|
|
26
|
+
success(text: any): void;
|
|
27
|
+
warning(text: any): void;
|
|
28
|
+
danger(text: any): void;
|
|
29
|
+
}
|
|
30
|
+
declare const log: Log;
|
|
31
|
+
export default log;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var LogsType = /* @__PURE__ */ ((LogsType2) => {
|
|
2
|
+
LogsType2["DEFAULT"] = "default";
|
|
3
|
+
LogsType2["PRIMARY"] = "primary";
|
|
4
|
+
LogsType2["SUCCESS"] = "success";
|
|
5
|
+
LogsType2["WARNING"] = "warning";
|
|
6
|
+
LogsType2["DANGER"] = "danger";
|
|
7
|
+
return LogsType2;
|
|
8
|
+
})(LogsType || {});
|
|
9
|
+
function typeColor(type = "primary" /* PRIMARY */) {
|
|
10
|
+
const colorMap = {
|
|
11
|
+
["default" /* DEFAULT */]: "#f5f5f5",
|
|
12
|
+
["primary" /* PRIMARY */]: "#409EFF",
|
|
13
|
+
["success" /* SUCCESS */]: "#67C23A",
|
|
14
|
+
["warning" /* WARNING */]: "#E6A23C",
|
|
15
|
+
["danger" /* DANGER */]: "#F56C6C"
|
|
16
|
+
};
|
|
17
|
+
return colorMap[type];
|
|
18
|
+
}
|
|
19
|
+
class Log {
|
|
20
|
+
capsule(title, info, type = "primary" /* PRIMARY */, ...appendInfo) {
|
|
21
|
+
console.log(`%c ${title} %c ${info} %c`, "background:#35495E; padding: 1px; border-radius: 3px 0 0 3px; color: #fff;", `background:${typeColor(type)}; padding: 1px; border-radius: 0 3px 3px 0; color: #fff;`, "background:transparent", ...appendInfo);
|
|
22
|
+
}
|
|
23
|
+
colorful(textArr) {
|
|
24
|
+
console.log(`%c${textArr.map((t) => t.text || "").join("%c")}`, ...textArr.map((t) => `color: ${typeColor(t.type)};`));
|
|
25
|
+
}
|
|
26
|
+
text(text) {
|
|
27
|
+
this.colorful([{ text, type: "default" /* DEFAULT */ }]);
|
|
28
|
+
}
|
|
29
|
+
primary(text) {
|
|
30
|
+
this.colorful([{ text, type: "primary" /* PRIMARY */ }]);
|
|
31
|
+
}
|
|
32
|
+
success(text) {
|
|
33
|
+
this.colorful([{ text, type: "success" /* SUCCESS */ }]);
|
|
34
|
+
}
|
|
35
|
+
warning(text) {
|
|
36
|
+
this.colorful([{ text, type: "warning" /* WARNING */ }]);
|
|
37
|
+
}
|
|
38
|
+
danger(text) {
|
|
39
|
+
this.colorful([{ text, type: "danger" /* DANGER */ }]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const log = new Log();
|
|
43
|
+
|
|
44
|
+
export { LogsType, log as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.1.17-beta.
|
|
4
|
+
"version": "3.1.17-beta.7",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"module": "es/packages/index.js",
|
|
7
7
|
"main": "es/packages/index.js",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"min-dom": "^3.2.1",
|
|
57
57
|
"moment": "^2.29.1",
|
|
58
58
|
"naive-ui": "^2.29.0",
|
|
59
|
+
"ramda": "^0.28.0",
|
|
59
60
|
"rimraf": "^3.0.2",
|
|
60
61
|
"spark-md5": "^3.0.2",
|
|
61
62
|
"tiny-svg": "^2.2.4",
|
|
@@ -89,6 +90,7 @@
|
|
|
89
90
|
"@types/lodash-es": "^4.17.6",
|
|
90
91
|
"@types/markdown-it": "^12.2.3",
|
|
91
92
|
"@types/node": "^17.0.38",
|
|
93
|
+
"@types/ramda": "^0.28.15",
|
|
92
94
|
"@types/replacestream": "^4.0.1",
|
|
93
95
|
"@types/sortablejs": "^1.13.0",
|
|
94
96
|
"@types/vue-router": "^2.0.0",
|