cnhis-design-vue 3.1.12 → 3.1.13-beta.2

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.
@@ -1173,7 +1173,10 @@ declare const _default: import("vue").DefineComponent<{
1173
1173
  }, any>>;
1174
1174
  readonly themeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Button", {
1175
1175
  heightTiny: string;
1176
- heightSmall: string;
1176
+ heightSmall: string; /**
1177
+ * 单个form提交失败
1178
+ * @param {*} obj
1179
+ */
1177
1180
  heightMedium: string;
1178
1181
  heightLarge: string;
1179
1182
  borderRadiusTiny: string;
@@ -1183,10 +1186,7 @@ declare const _default: import("vue").DefineComponent<{
1183
1186
  fontSizeTiny: string;
1184
1187
  fontSizeSmall: string;
1185
1188
  fontSizeMedium: string;
1186
- fontSizeLarge: string; /**
1187
- * 避免每次点击都查询
1188
- * 初始化查一次 行编辑 表单search用
1189
- */
1189
+ fontSizeLarge: string;
1190
1190
  opacityDisabled: string;
1191
1191
  colorOpacitySecondary: string;
1192
1192
  colorOpacitySecondaryHover: string;
@@ -1209,9 +1209,7 @@ declare const _default: import("vue").DefineComponent<{
1209
1209
  textColorTertiary: string;
1210
1210
  textColorHover: string;
1211
1211
  textColorPressed: string;
1212
- textColorFocus: string; /**
1213
- * tsx渲染表格
1214
- */
1212
+ textColorFocus: string;
1215
1213
  textColorDisabled: string;
1216
1214
  textColorText: string;
1217
1215
  textColorTextHover: string;
@@ -1292,7 +1290,7 @@ declare const _default: import("vue").DefineComponent<{
1292
1290
  textColorFocusSuccess: string;
1293
1291
  textColorDisabledSuccess: string;
1294
1292
  textColorTextSuccess: string;
1295
- textColorTextHoverSuccess: string; /** string */
1293
+ textColorTextHoverSuccess: string;
1296
1294
  textColorTextPressedSuccess: string;
1297
1295
  textColorTextFocusSuccess: string;
1298
1296
  textColorTextDisabledSuccess: string;
@@ -349,7 +349,7 @@ var script = /* @__PURE__ */ defineComponent({
349
349
  state.editConfig = Object.assign(state.editConfig, editConfig);
350
350
  state.rowConfig.height = 48;
351
351
  }
352
- state.rowConfig.height = Object.assign(state.rowConfig.height, rowConfig);
352
+ state.rowConfig = Object.assign(state.rowConfig, rowConfig);
353
353
  state.rowConfig.keyField = handleRowId.value;
354
354
  if (selectType) {
355
355
  isBatchSelect = 1;
@@ -1107,6 +1107,7 @@ var script = /* @__PURE__ */ defineComponent({
1107
1107
  _rowIndex,
1108
1108
  _columnIndex
1109
1109
  }) => {
1110
+ var _a;
1110
1111
  if (state.isTree != 3) {
1111
1112
  return {
1112
1113
  rowspan: 1,
@@ -1120,7 +1121,7 @@ var script = /* @__PURE__ */ defineComponent({
1120
1121
  let colspan = xTree.getTableColumn().tableColumn.length - fristKeyIndex;
1121
1122
  if (xTree) {
1122
1123
  const isOldVxeTree = row.childrenList && row.childrenList.length;
1123
- const isTransformVxeTree = !row.qianduan_parent_id;
1124
+ const isTransformVxeTree = ((_a = props.tableParams) == null ? void 0 : _a.isTransform) && !row.qianduan_parent_id;
1124
1125
  if (isOldVxeTree || isTransformVxeTree) {
1125
1126
  if (column.treeNode) {
1126
1127
  return {
@@ -95,13 +95,15 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
95
95
  if (itemPrev && points1.length === 1) {
96
96
  const point = getPoint(itemPrev);
97
97
  points1.unshift(point);
98
- points2.unshift(point);
99
98
  }
100
- const pointNext = getPoint(itemNext);
101
- const pointNext2 = itemNext2 ? getPoint(itemNext2) : null;
102
- if (itemNext && pointNext2 && pointNext.x === pointNext2.x && pointNext.y === pointNext2.y) {
103
- points1.push(pointNext);
104
- points2.push(pointNext);
99
+ if (itemNext && itemNext2) {
100
+ const pointNext = getPoint(itemNext);
101
+ const pointNext2 = getPoint(itemNext2);
102
+ if (pointNext.x === pointNext2.x && pointNext.y === pointNext2.y) {
103
+ points1.push(pointNext);
104
+ }
105
+ } else {
106
+ data.push({ points1, points2 });
105
107
  }
106
108
  } else {
107
109
  if (points1.length && points2.length) {
@@ -116,8 +118,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
116
118
  const newData = data.reduce((pre, cur) => {
117
119
  const arr1 = cur.points1.map((v) => [v.x, v.y]);
118
120
  const arr2 = cur.points2.map((v) => [v.x, v.y]);
119
- const [, ...newArr2] = arr2;
120
- return pre.concat([[...arr1, ...newArr2.reverse()]]);
121
+ return pre.concat([[...arr1, ...arr2.reverse()]]);
121
122
  }, []);
122
123
  const { createShadowLines } = useShadow();
123
124
  newData.forEach((item) => {
@@ -46,7 +46,11 @@ function drawTextGroup(rectStyle, fontStyle, groupStyle) {
46
46
  });
47
47
  const texts = new fabric.Text(String(fontStyle.value), {
48
48
  ...defaultTextStyle,
49
- ...fontStyle
49
+ ...fontStyle,
50
+ ...fontStyle.textAlign == "left" ? {
51
+ originX: "left",
52
+ left: -(rectStyle.width / 2)
53
+ } : {}
50
54
  });
51
55
  return new fabric.Group([rect, texts], {
52
56
  ...groupStyle
@@ -101,7 +101,7 @@ function useShadow() {
101
101
  let counter = 0;
102
102
  let xinters;
103
103
  let p1, p2;
104
- let pointCount = polygonPoints.length;
104
+ const pointCount = polygonPoints.length;
105
105
  p1 = polygonPoints[0];
106
106
  for (let i = 1; i <= pointCount; i++) {
107
107
  p2 = polygonPoints[i % pointCount];
@@ -35,7 +35,7 @@ function useTop(canvas, propItems) {
35
35
  }
36
36
  if (item.key == "xScalevalue") {
37
37
  drawDay(list, topY);
38
- drawTime(list, topY);
38
+ drawTime(item, list, topY);
39
39
  } else {
40
40
  propItems[`${item.key}Height`] && drawDate(item, list, topY);
41
41
  }
@@ -44,7 +44,7 @@ function useTop(canvas, propItems) {
44
44
  group && group.sendToBack();
45
45
  group && canvas.value.add(group);
46
46
  }
47
- function drawTime(list, topY) {
47
+ function drawTime(item, list, topY) {
48
48
  var _a;
49
49
  const dayHeight = top.xScalevalue.show ? top.dayHeight || 0 : 0;
50
50
  const height = xScalevalueHeight - dayHeight;
@@ -55,7 +55,8 @@ function useTop(canvas, propItems) {
55
55
  }, {
56
56
  value: top.xScalevalue.title,
57
57
  ...defaultTextStyle,
58
- ...((_a = top.date) == null ? void 0 : _a.style) || {}
58
+ ...((_a = top.date) == null ? void 0 : _a.style) || {},
59
+ ...item.titleStyle || {}
59
60
  }, {
60
61
  left: iconsWidth,
61
62
  top: topY
@@ -115,7 +116,8 @@ function useTop(canvas, propItems) {
115
116
  }, {
116
117
  value: item.title,
117
118
  ...defaultTextStyle,
118
- ...(item == null ? void 0 : item.style) || {}
119
+ ...(item == null ? void 0 : item.style) || {},
120
+ ...item.titleStyle || {}
119
121
  }, {
120
122
  left: iconsWidth,
121
123
  top: topY
@@ -1,4 +1,4 @@
1
- import { AnyObject, ArrayAble } from '../../../../../../es/src/types';
1
+ import { AnyObject, ArrayAble, Func } from '../../../../../../es/src/types';
2
2
  import { FormRequestType } from '../../types';
3
3
  import { PropType } from 'vue';
4
4
  declare type DependKeyObj = {
@@ -24,6 +24,9 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
24
24
  urlConfig: {
25
25
  type: PropType<UrlConfig>;
26
26
  };
27
+ onFocus: {
28
+ type: PropType<Func<any[], any>>;
29
+ };
27
30
  onChange: {};
28
31
  value: {};
29
32
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -38,6 +41,9 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
38
41
  urlConfig: {
39
42
  type: PropType<UrlConfig>;
40
43
  };
44
+ onFocus: {
45
+ type: PropType<Func<any[], any>>;
46
+ };
41
47
  onChange: {};
42
48
  value: {};
43
49
  }>> & {
@@ -21,6 +21,9 @@ const script = defineComponent({
21
21
  urlConfig: {
22
22
  type: Object
23
23
  },
24
+ onFocus: {
25
+ type: Function
26
+ },
24
27
  onChange: {},
25
28
  value: {}
26
29
  },
@@ -30,15 +33,12 @@ const script = defineComponent({
30
33
  emit
31
34
  }) {
32
35
  const _options = ref(null);
33
- const {
34
- title
35
- } = useFormField();
36
36
  const asyncQueue = inject(InjectAsyncQueue);
37
37
  const {
38
- field
38
+ field,
39
+ title
39
40
  } = useFormField();
40
41
  async function fetchData(option) {
41
- var _a;
42
42
  if (!option && _options.value)
43
43
  return;
44
44
  const config = props.urlConfig;
@@ -48,56 +48,63 @@ const script = defineComponent({
48
48
  formRenderLog(`invalid urlConfig (${config}) in CASCADER => ${title.value}`, "warn");
49
49
  return;
50
50
  }
51
- if ((option == null ? void 0 : option.depth) + 1 >= props.deep)
51
+ if (deepFor(option) + 1 >= props.deep)
52
52
  return;
53
- const parentDepth = (_a = option == null ? void 0 : option.depth) != null ? _a : -1;
54
- const params = {
55
- lvlnr: parentDepth + 1 + ""
56
- };
57
- if (option) {
58
- if (!config.dependKey) {
59
- formRenderLog(`invalid urlConfig.dependKey ${config.dependKey} in CASCADER => ${title.value}`, "warn");
60
- return;
61
- }
62
- arrayed(config.dependKey).forEach((key) => {
63
- if (isString(key)) {
64
- params[key] = option[valueKey.value];
65
- } else if (isObject(key)) {
66
- params[key.paramName] = option[key.paramValue];
67
- }
68
- });
69
- }
70
53
  let data = await asyncQueue.addAsync({
71
- ...config,
72
- key: title.value,
73
- params
54
+ ...createRequestParams(deepFor(option), config, option),
55
+ key: title.value
74
56
  });
75
57
  if (!Array.isArray(data)) {
76
58
  data = [];
77
59
  }
78
60
  if (!data.length && isObject(option)) {
79
61
  option.isLeaf = true;
80
- let currentOption = option;
81
- const result2 = [option];
62
+ updateValue(null, null, getOptionChain(option));
63
+ show.value = false;
64
+ return;
65
+ }
66
+ const result = data.map((item) => optionNormalize(item, deepFor(option)));
67
+ option ? option.children = result : _options.value = result;
68
+ function deepFor(option2) {
69
+ var _a;
70
+ return (_a = option2 == null ? void 0 : option2.depth) != null ? _a : -1;
71
+ }
72
+ function createRequestParams(deep, config2, option2) {
73
+ const params = {
74
+ lvlnr: deep + 1 + ""
75
+ };
76
+ if (option2 && config2.dependKey) {
77
+ arrayed(config2.dependKey).forEach((key) => {
78
+ if (isString(key)) {
79
+ params[key] = option2[valueKey.value];
80
+ } else if (isObject(key)) {
81
+ params[key.paramName] = option2[key.paramValue];
82
+ }
83
+ });
84
+ }
85
+ return {
86
+ params,
87
+ ...config2
88
+ };
89
+ }
90
+ function getOptionChain(option2) {
91
+ let currentOption = option2;
92
+ const result2 = [option2];
82
93
  while (currentOption.parent) {
83
94
  result2.unshift(currentOption.parent);
84
95
  currentOption = currentOption.parent;
85
96
  }
86
- updateValue(null, null, result2);
87
- show.value = false;
88
- return;
97
+ return result2;
89
98
  }
90
- const result = data.reduce((res, d) => {
91
- res.push({
92
- [labelKey.value]: d[labelKey.value],
93
- [valueKey.value]: d[valueKey.value],
94
- depth: parentDepth + 1,
99
+ function optionNormalize(data2, deep) {
100
+ return {
101
+ [labelKey.value]: data2[labelKey.value],
102
+ [valueKey.value]: data2[valueKey.value],
103
+ depth: deep + 1,
95
104
  parent: option,
96
- isLeaf: parentDepth + 2 >= props.deep
97
- });
98
- return res;
99
- }, []);
100
- option ? option.children = result : _options.value = result;
105
+ isLeaf: deep + 2 >= props.deep
106
+ };
107
+ }
101
108
  }
102
109
  const renderOptions = computed(() => {
103
110
  return _options.value || props.options || [];
@@ -134,23 +141,28 @@ const script = defineComponent({
134
141
  }
135
142
  });
136
143
  function updateValue(_, __, options) {
137
- const payload = Array.isArray(options) ? options.map((option) => ({
138
- ...option,
139
- label: option[labelKey.value],
140
- children: void 0,
141
- parent: void 0
142
- })) : options;
143
- emit("update:value", payload);
144
+ emit("update:value", options.map(optionSimplify));
145
+ function optionSimplify(option) {
146
+ return {
147
+ ...option,
148
+ label: option[labelKey.value],
149
+ children: void 0,
150
+ parent: void 0
151
+ };
152
+ }
144
153
  }
145
154
  const show = ref(false);
146
155
  function updateShow(v) {
147
156
  show.value = !!v;
148
157
  v && fetchData();
149
158
  }
150
- function onFocus() {
151
- if (isField(field.value)) {
152
- field.value.visited = true;
153
- }
159
+ function focusDecorator(onFocus) {
160
+ return (...args) => {
161
+ if (isField(field.value)) {
162
+ field.value.visited = true;
163
+ }
164
+ onFocus == null ? void 0 : onFocus(...args);
165
+ };
154
166
  }
155
167
  return () => {
156
168
  return createVNode(NCascader, {
@@ -163,7 +175,7 @@ const script = defineComponent({
163
175
  "options": renderOptions.value,
164
176
  "checkStrategy": "child",
165
177
  "onLoad": fetchData,
166
- "onFocus": onFocus,
178
+ "onFocus": focusDecorator(props.onFocus),
167
179
  "onUpdate:show": updateShow
168
180
  }, slots);
169
181
  };
@@ -1,4 +1,4 @@
1
- import { AnyObject } from '../../../../../../es/src/types';
1
+ import { AnyObject, Func } from '../../../../../../es/src/types';
2
2
  import { FormRequestType } from '../../types';
3
3
  import { PropType } from 'vue';
4
4
  declare type UrlConfig = {
@@ -20,9 +20,10 @@ export declare const SELECT: import("vue").DefineComponent<{
20
20
  urlConfig: {
21
21
  type: PropType<UrlConfig>;
22
22
  };
23
- onChange: {
24
- type: FunctionConstructor;
23
+ onFocus: {
24
+ type: PropType<Func<any[], any>>;
25
25
  };
26
+ onChange: {};
26
27
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
27
28
  value: {
28
29
  type: StringConstructor;
@@ -34,9 +35,10 @@ export declare const SELECT: import("vue").DefineComponent<{
34
35
  urlConfig: {
35
36
  type: PropType<UrlConfig>;
36
37
  };
37
- onChange: {
38
- type: FunctionConstructor;
38
+ onFocus: {
39
+ type: PropType<Func<any[], any>>;
39
40
  };
41
+ onChange: {};
40
42
  }>> & {
41
43
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
42
44
  }, {
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, inject, computed, watch, createVNode } from 'vue';
1
+ import { defineComponent, ref, inject, computed, watch, nextTick, createVNode } from 'vue';
2
2
  import { isField } from '@formily/core';
3
3
  import { cloneDeep } from 'lodash-es';
4
4
  import { InjectAsyncQueue, InjectionFormItemDepsCollector, InjectionChangeContextCollector } from '../../constants/index.js';
@@ -21,17 +21,17 @@ const script = defineComponent({
21
21
  urlConfig: {
22
22
  type: Object
23
23
  },
24
- onChange: {
24
+ onFocus: {
25
25
  type: Function
26
- }
26
+ },
27
+ onChange: {}
27
28
  },
28
29
  emits: ["update:value"],
29
30
  setup(props, {
30
31
  slots,
31
32
  emit
32
33
  }) {
33
- const _options = ref(null);
34
- let cachedOptions = null;
34
+ const remoteOptions = ref(null);
35
35
  const lastSearch = ref("");
36
36
  const asyncQueue = inject(InjectAsyncQueue);
37
37
  const {
@@ -45,54 +45,46 @@ const script = defineComponent({
45
45
  });
46
46
  }
47
47
  async function fetchData(content) {
48
- if (content === lastSearch.value) {
49
- if (cachedOptions)
50
- return;
51
- } else {
52
- lastSearch.value = content || "";
53
- }
48
+ lastSearch.value = content || "";
49
+ if (remoteOptions.value)
50
+ return;
54
51
  const config = props.urlConfig;
55
52
  if (!config) {
56
- return cachedOptions = _options.value = null;
53
+ return remoteOptions.value = null;
57
54
  }
58
55
  if (!isObject(config)) {
59
56
  formRenderLog(`invalid urlConfig (${config}) in SELECT => ${title.value}`, "warn");
60
- return cachedOptions = _options.value = null;
61
- }
62
- if (cachedOptions) {
63
- return _options.value = filterOption(cachedOptions, content);
57
+ return remoteOptions.value = null;
64
58
  }
65
59
  try {
66
- const data = await asyncQueue.addAsync({
67
- ...config,
68
- key: title.value,
69
- params: Object.assign({}, config.params, generateUrlParams(field.value, config.dependKey))
60
+ remoteOptions.value = await asyncQueue.addAsync({
61
+ ...createParams(config, field.value),
62
+ key: title.value
70
63
  });
71
- _options.value = data.reduce((res, d) => {
72
- var _a;
73
- if (((_a = d[labelKey.value]) == null ? void 0 : _a.includes(content)) || !content) {
74
- res.push(d);
75
- }
76
- return res;
77
- }, []);
78
- cachedOptions = _options.value;
79
64
  } catch (e) {
80
- _options.value = null;
65
+ remoteOptions.value = null;
66
+ }
67
+ function createParams(config2, field2) {
68
+ return {
69
+ ...config2,
70
+ params: Object.assign({}, config2.params, generateUrlParams(field2, config2.dependKey))
71
+ };
81
72
  }
82
73
  }
83
74
  const parsedOptions = computed(() => {
84
- if (_options.value)
85
- return _options.value;
75
+ if (remoteOptions.value)
76
+ return filterOption(remoteOptions.value, lastSearch.value);
86
77
  if (!Array.isArray(props.options))
87
78
  return [];
88
79
  return filterOption(props.options, lastSearch.value);
89
80
  });
90
81
  const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
91
82
  watch(() => props.urlConfig, (config) => {
92
- cachedOptions = null;
93
- config && formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], () => {
94
- cachedOptions = null;
95
- props.value && fetchData();
83
+ remoteOptions.value = null;
84
+ config && formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], async () => {
85
+ remoteOptions.value = null;
86
+ await nextTick();
87
+ props.value != null && await fetchData();
96
88
  });
97
89
  }, {
98
90
  immediate: true
@@ -121,10 +113,13 @@ const script = defineComponent({
121
113
  var _a, _b;
122
114
  return (_b = (_a = props.urlConfig) == null ? void 0 : _a.valueKey) != null ? _b : "value";
123
115
  });
124
- function onFocus() {
125
- if (isField(field.value)) {
126
- field.value.visited = true;
127
- }
116
+ function focusDecorator(onFocus) {
117
+ return (...args) => {
118
+ if (isField(field.value)) {
119
+ field.value.visited = true;
120
+ }
121
+ return onFocus == null ? void 0 : onFocus(...args);
122
+ };
128
123
  }
129
124
  return () => createVNode(NSelect, {
130
125
  "value": props.value,
@@ -135,7 +130,7 @@ const script = defineComponent({
135
130
  "valueField": valueKey.value,
136
131
  "onSearch": fetchData,
137
132
  "onUpdate:show": (show) => show && fetchData(),
138
- "onFocus": onFocus,
133
+ "onFocus": focusDecorator(props.onFocus),
139
134
  "options": parsedOptions.value
140
135
  }, slots);
141
136
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
3
  "private": false,
4
- "version": "3.1.12",
4
+ "version": "3.1.13-beta.2",
5
5
  "license": "ISC",
6
6
  "module": "es/packages/index.js",
7
7
  "main": "es/packages/index.js",