cnhis-design-vue 3.1.15-beta.0 → 3.1.15-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.
Files changed (46) hide show
  1. package/es/packages/annotation-edit/src/AnnotationEdit.js +2 -1
  2. package/es/packages/big-table/index.d.ts +12 -11
  3. package/es/packages/big-table/src/BigTable.vue.d.ts +28 -19
  4. package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +16 -11
  5. package/es/packages/big-table/src/bigTableProps.d.ts +5 -3
  6. package/es/packages/big-table/src/bigTableProps.js +1 -1
  7. package/es/packages/big-table/src/components/edit-form/edit-separate.js +18 -9
  8. package/es/packages/big-table/src/components/edit-form/edit-separate.vue.d.ts +3 -1
  9. package/es/packages/big-table/src/hooks/useAnnotation.d.ts +4 -0
  10. package/es/packages/big-table/src/hooks/useAnnotation.js +21 -0
  11. package/es/packages/big-table/src/hooks/useEdit.d.ts +3 -1
  12. package/es/packages/big-table/style/index.css +27 -1
  13. package/es/packages/button-print/src/utils/print.d.ts +1 -1
  14. package/es/packages/button-print/src/utils/print.js +1 -1
  15. package/es/packages/fabric-chart/index.d.ts +1 -0
  16. package/es/packages/fabric-chart/src/FabricChart.js +12 -16
  17. package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +5 -4
  18. package/es/packages/fabric-chart/src/hooks/useCenter.js +29 -71
  19. package/es/packages/fabric-chart/src/hooks/useCumputedPoint.js +4 -2
  20. package/es/packages/form-render/src/components/renderer/cascader.js +7 -7
  21. package/es/packages/form-render/src/components/renderer/combination.js +11 -8
  22. package/es/packages/form-render/src/components/renderer/complex.d.ts +2 -0
  23. package/es/packages/form-render/src/components/renderer/complex.js +2 -5
  24. package/es/packages/form-render/src/components/renderer/date.d.ts +29 -0
  25. package/es/packages/form-render/src/components/renderer/date.js +63 -56
  26. package/es/packages/form-render/src/components/renderer/select.js +7 -7
  27. package/es/packages/form-render/src/hooks/useCommonInjection.d.ts +6 -0
  28. package/es/packages/form-render/src/hooks/useCommonInjection.js +19 -0
  29. package/es/packages/form-render/src/types/fieldItem.d.ts +15 -2
  30. package/es/packages/form-render/src/utils/index.d.ts +1 -0
  31. package/es/packages/form-render/src/utils/index.js +30 -2
  32. package/es/packages/form-render/style/index.css +11 -10
  33. package/es/packages/index.css +38 -11
  34. package/es/packages/shortcut-provider/index.d.ts +2 -11
  35. package/es/packages/shortcut-provider/src/ShortcutProvider.js +1 -5
  36. package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +2 -11
  37. package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +11 -8
  38. package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +44 -28
  39. package/es/packages/shortcut-provider/src/types/index.d.ts +32 -4
  40. package/es/packages/shortcut-provider/src/utils/index.d.ts +3 -0
  41. package/es/packages/shortcut-provider/src/utils/index.js +15 -5
  42. package/es/packages/shortcut-setter/index.d.ts +6 -4
  43. package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +6 -4
  44. package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +6 -4
  45. package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +6 -4
  46. package/package.json +1 -1
@@ -8,6 +8,18 @@ import { TEMPERATURE_MENU, PAIN_MENU } from './constant.js';
8
8
  function isEffectiveNode(node) {
9
9
  return (node == null ? void 0 : node.time) && ((node == null ? void 0 : node.value) || (node == null ? void 0 : node.value) === 0);
10
10
  }
11
+ function getPointArr(arr) {
12
+ let _arr = [];
13
+ return arr.reduce((pre, cur, index) => {
14
+ var _a, _b;
15
+ _arr.push([cur.left, cur.top]);
16
+ if (((_b = (_a = cur.origin) == null ? void 0 : _a.data) == null ? void 0 : _b.breakpoint) || arr.length - 1 === index) {
17
+ pre.push(_arr);
18
+ _arr = [];
19
+ }
20
+ return pre;
21
+ }, []);
22
+ }
11
23
  function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, getYValue, addRenderItem) {
12
24
  useGrid(canvas, propItems);
13
25
  const {
@@ -36,6 +48,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
36
48
  target: null
37
49
  });
38
50
  const shadowLinesCache = /* @__PURE__ */ new Set();
51
+ let shadowPointCache = [];
39
52
  const maiboPoints = /* @__PURE__ */ new Set();
40
53
  const otherPoints = /* @__PURE__ */ new Set();
41
54
  const prevLines = /* @__PURE__ */ new Set();
@@ -45,7 +58,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
45
58
  });
46
59
  });
47
60
  function init() {
48
- drawShaDow();
61
+ shadowPointCache = [];
49
62
  maiboPoints.clear();
50
63
  otherPoints.clear();
51
64
  prevLines.clear();
@@ -55,6 +68,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
55
68
  drawPolyLine(item, dataIndex, scaleValue);
56
69
  });
57
70
  });
71
+ drawShaDow();
58
72
  drawOverlapPoint();
59
73
  setCanvasEvent();
60
74
  }
@@ -67,89 +81,34 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
67
81
  canvas.value.renderAll();
68
82
  }
69
83
  function drawShaDow(target) {
70
- var _a, _b;
84
+ var _a;
71
85
  const pulseObj = left.yScaleValue.find((item) => item.type === "pulse");
72
86
  if (!pulseObj || !((_a = pulseObj.dataList) == null ? void 0 : _a.length))
73
87
  return;
74
88
  if (shadowLinesCache.size)
75
89
  canvas.value.remove(...shadowLinesCache);
76
90
  shadowLinesCache.clear();
77
- const data = [];
78
- if (((_b = pulseObj.dataList) == null ? void 0 : _b.length) > 1) {
79
- let points1 = [];
80
- let points2 = [];
81
- const copyDataList = JSON.parse(JSON.stringify(pulseObj.dataList));
91
+ if (shadowPointCache.length > 1) {
82
92
  if (target) {
83
93
  const { type, dataIndex, index } = target.origin || {};
84
94
  if (type === "pulse") {
85
- Object.assign(copyDataList[dataIndex].list[index], {
86
- x: target.left,
87
- y: target.top
88
- });
95
+ shadowPointCache[dataIndex].splice(index, 1, target);
89
96
  }
90
97
  }
91
- const [data1, data2] = copyDataList;
92
- const getPoint = (item) => {
93
- if (item.x && item.y) {
94
- return {
95
- x: item.x,
96
- y: item.y
97
- };
98
- }
99
- const point = getPointer(item, pulseObj);
100
- if (point == null ? void 0 : point.length) {
101
- return {
102
- x: point[0],
103
- y: point[1]
104
- };
105
- }
106
- };
107
- data1.list.forEach((item, index) => {
108
- const point1 = getPoint(item);
109
- const item2 = data2.list[index];
110
- const point2 = item2 ? getPoint(item2) : null;
111
- if (point1 && point2 && point1.x === point2.x && point1.y !== point2.y) {
112
- points1.push(point1);
113
- points2.push(point2);
114
- const itemPrev = data1.list[index - 1];
115
- const itemNext = data1.list[index + 1];
116
- const itemNext2 = data2.list[index + 1];
117
- if (itemPrev && points1.length === 1) {
118
- const point = getPoint(itemPrev);
119
- point && points1.unshift(point);
120
- }
121
- if (itemNext && itemNext2) {
122
- const pointNext = getPoint(itemNext);
123
- const pointNext2 = getPoint(itemNext2);
124
- if (pointNext && pointNext2 && pointNext.x === pointNext2.x && pointNext.y === pointNext2.y) {
125
- points1.push(pointNext);
126
- }
127
- } else {
128
- data.push({ points1, points2 });
129
- }
130
- } else {
131
- if (points1.length && points2.length) {
132
- data.push({ points1, points2 });
133
- points1 = [];
134
- points2 = [];
135
- }
136
- }
137
- });
138
- }
139
- if (data.length) {
140
- const newData = data.reduce((pre, cur) => {
141
- const arr1 = cur.points1.map((v) => [v.x, v.y]);
142
- const arr2 = cur.points2.map((v) => [v.x, v.y]);
143
- return pre.concat([[...arr1, ...arr2.reverse()]]);
144
- }, []);
98
+ const [data1, data2] = shadowPointCache;
99
+ if (!data1.length || !data2.length)
100
+ return;
101
+ const points1 = getPointArr(data1);
102
+ const points2 = getPointArr(data2);
103
+ const data = points1.reduce((pre, cur, index) => pre.concat([[...cur, ...points2[index].reverse()]]), []);
145
104
  const { createShadowLines } = useShadow();
146
- newData.forEach((item) => {
147
- var _a2, _b2, _c, _d;
105
+ data.forEach((item) => {
106
+ var _a2, _b, _c, _d;
148
107
  if (((_a2 = pulseObj.shadow) == null ? void 0 : _a2.mode) == "color") {
149
108
  const points = item.map((v) => ({ x: v[0], y: v[1] }));
150
109
  const polygon = new fabric.Polygon(points, {
151
110
  ...defaultStyle,
152
- ...((_b2 = pulseObj.shadow) == null ? void 0 : _b2.style) || {}
111
+ ...((_b = pulseObj.shadow) == null ? void 0 : _b.style) || {}
153
112
  });
154
113
  shadowLinesCache.add(polygon);
155
114
  canvas.value.add(polygon);
@@ -414,6 +373,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
414
373
  pointList.push(point);
415
374
  }
416
375
  });
376
+ scaleValue.type === "pulse" && shadowPointCache.push(pointList);
417
377
  Promise.all(pointList).then((res) => {
418
378
  const lineListFilter = lineList.filter((v) => v);
419
379
  let prevPoint = null;
@@ -528,14 +488,12 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
528
488
  return getTime >= minMinute && getTime <= maxMinute;
529
489
  }
530
490
  function getPointer(v, scaleValue) {
531
- let points;
532
491
  const objOriginY = scaleValue.type === "pain" ? painOriginY : vitalSignsOriginY;
533
492
  if (isEffectiveNode(v) && isLimit(v.time)) {
534
493
  const x = cumputedX(v.time);
535
494
  const y = cumputedY(scaleValue.type, scaleValue.list, v.value);
536
- points = [x, y < objOriginY.originY ? objOriginY.originY : y > objOriginY.endY ? objOriginY.endY : y];
495
+ return [x, y < objOriginY.originY ? objOriginY.originY : y > objOriginY.endY ? objOriginY.endY : y];
537
496
  }
538
- return points;
539
497
  }
540
498
  function clickMenu({ item, target }) {
541
499
  if (!target) {
@@ -31,10 +31,12 @@ function useCumputedPoint(propItems) {
31
31
  const residueX = pointX - item.left;
32
32
  const residueTime = item.scaleCell * residueX;
33
33
  const time = item.start + residueTime;
34
- let d = new Date(time);
34
+ const d = new Date(time);
35
35
  const month = `00${d.getMonth() + 1}`.slice(-2);
36
36
  const day = `00${d.getDate()}`.slice(-2);
37
- const date = `${d.getFullYear()}-${month}-${day} ${d.getHours()}:${d.getMinutes()}`;
37
+ const hours = `00${d.getHours()}`.slice(-2);
38
+ const minutes = `00${d.getMinutes()}`.slice(-2);
39
+ const date = `${d.getFullYear()}-${month}-${day} ${hours}:${minutes}`;
38
40
  return date;
39
41
  }
40
42
  }
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, ref, computed, inject, watch, createVNode } from 'vue';
2
2
  import { isField } from '@formily/core';
3
3
  import { isEqual } from 'lodash-es';
4
+ import { useCommonInjection } from '../../../../../packages/form-render/src/hooks/useCommonInjection';
4
5
  import { InjectAsyncQueue } from '../../constants/index.js';
5
6
  import { assignUpdateValue, traverseDependKey } from '../../utils/index.js';
6
7
  import { connect, mapProps } from '@formily/vue';
@@ -123,13 +124,12 @@ const script = defineComponent({
123
124
  return (_a = target == null ? void 0 : target.depth) != null ? _a : -1;
124
125
  }
125
126
  }
126
- watch(() => props.value, (n, o) => {
127
- var _a, _b;
128
- n != null && o == null && fetchData();
129
- isField(field.value) && field.value.visited && ((_b = (_a = field.value).validate) == null ? void 0 : _b.call(_a));
130
- }, {
131
- immediate: true
132
- });
127
+ const {
128
+ injectValueValidate,
129
+ injectValueWatchFromEmpty
130
+ } = useCommonInjection();
131
+ injectValueWatchFromEmpty(() => props.value, fetchData);
132
+ injectValueValidate(() => props.value);
133
133
  watch(() => props.urlConfig, async (config, oldConfig) => {
134
134
  if (isEqual(config, oldConfig))
135
135
  return;
@@ -3,7 +3,7 @@ import { isField } from '@formily/core';
3
3
  import { Path } from '../../../../../node_modules/@formily/path/esm/index.js';
4
4
  import { flatten, isNumber } from 'lodash-es';
5
5
  import { useFormField } from '../../../../../packages/form-render';
6
- import { arrayed, assignUpdateValue, formRenderLog } from '../../utils/index.js';
6
+ import { arrayed, assignUpdateValue, mergeDeepProperties, formRenderLog } from '../../utils/index.js';
7
7
  import { connect, mapProps } from '@formily/vue';
8
8
  import { useDebounceFn, isObject } from '@vueuse/core';
9
9
  import { NButton } from 'naive-ui';
@@ -64,7 +64,7 @@ const script = defineComponent({
64
64
  });
65
65
  function add() {
66
66
  groupNum.value++;
67
- _values.value.push({});
67
+ _values.value.push(mergeDeepProperties({}, props.getProperties()));
68
68
  emitChange();
69
69
  }
70
70
  function remove(idx) {
@@ -82,7 +82,7 @@ const script = defineComponent({
82
82
  immediate: true
83
83
  });
84
84
  const _values = ref([{}]);
85
- function initValues(data) {
85
+ function initValues(data, withInitialData = false) {
86
86
  if (!data)
87
87
  return;
88
88
  try {
@@ -92,10 +92,10 @@ const script = defineComponent({
92
92
  parsed.forEach((v, idx) => {
93
93
  if (idx > maxGroupNum.value - 1)
94
94
  return;
95
- if (isObject(v))
96
- return _values.value[idx] = v;
97
- _values.value[idx] = {};
98
- formRenderLog(`invalid Object value ${v} in COMBINATION => ${props.title}[${idx}]`, "warn");
95
+ if (isObject(v)) {
96
+ _values.value[idx] = v;
97
+ withInitialData && mergeDeepProperties(v, props.getProperties());
98
+ }
99
99
  });
100
100
  groupNum.value = Math.min(_values.value.length, maxGroupNum.value);
101
101
  } catch (e) {
@@ -115,7 +115,10 @@ const script = defineComponent({
115
115
  }
116
116
  }
117
117
  watch(() => props.value, (value) => initValues(value));
118
- onMounted(() => initValues(props.value));
118
+ onMounted(() => {
119
+ initValues(props.value || "[{}]", true);
120
+ emitChange();
121
+ });
119
122
  function stop(event) {
120
123
  event.stopPropagation();
121
124
  }
@@ -1,5 +1,6 @@
1
1
  import { CSSProperties, PropType } from 'vue';
2
2
  export declare const COMPLEX: import("vue").DefineComponent<{
3
+ onChange: {};
3
4
  span: {
4
5
  type: NumberConstructor;
5
6
  default: number;
@@ -13,6 +14,7 @@ export declare const COMPLEX: import("vue").DefineComponent<{
13
14
  default: () => {};
14
15
  };
15
16
  }, () => 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<{
17
+ onChange: {};
16
18
  span: {
17
19
  type: NumberConstructor;
18
20
  default: number;
@@ -4,6 +4,7 @@ import { assignUpdateValue } from '../../utils/index.js';
4
4
 
5
5
  const script = defineComponent({
6
6
  props: {
7
+ onChange: {},
7
8
  span: {
8
9
  type: Number,
9
10
  default: 6
@@ -20,16 +21,12 @@ const script = defineComponent({
20
21
  setup(props, {
21
22
  slots
22
23
  }) {
23
- function onChange(e) {
24
- e.stopPropagation();
25
- }
26
24
  return () => {
27
25
  return createVNode("section", {
28
26
  "class": "form-render__complex"
29
27
  }, [createVNode("section", {
30
28
  "class": `form-render__complexContent--${props.display}`,
31
- "style": props.wrapperStyle,
32
- "onChange": onChange
29
+ "style": props.wrapperStyle
33
30
  }, [slots.default && slots.default()])]);
34
31
  };
35
32
  }
@@ -1,7 +1,36 @@
1
+ import { PropType } from 'vue';
1
2
  export declare const DATE: import("vue").DefineComponent<{
2
3
  onChange: {};
3
4
  value: {};
5
+ validate: {
6
+ type: PropType<Partial<{
7
+ [key: string]: any;
8
+ obj_type: "password" | "sex" | "age" | "email" | "birthday" | "id_card" | "age_unit" | "mobile" | "telephone" | "bank_card" | "website" | "gestational_weeks" | "gestational_stage" | "customer_name";
9
+ vali_obj: string;
10
+ max_value: string | number;
11
+ min_value: string | number;
12
+ min_length: string | number;
13
+ max_length: string | number;
14
+ decimal_length: string | number;
15
+ regular_expression: string | RegExp;
16
+ regular_error_tip: string;
17
+ }>>;
18
+ };
4
19
  }, () => 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<{
5
20
  onChange: {};
6
21
  value: {};
22
+ validate: {
23
+ type: PropType<Partial<{
24
+ [key: string]: any;
25
+ obj_type: "password" | "sex" | "age" | "email" | "birthday" | "id_card" | "age_unit" | "mobile" | "telephone" | "bank_card" | "website" | "gestational_weeks" | "gestational_stage" | "customer_name";
26
+ vali_obj: string;
27
+ max_value: string | number;
28
+ min_value: string | number;
29
+ min_length: string | number;
30
+ max_length: string | number;
31
+ decimal_length: string | number;
32
+ regular_expression: string | RegExp;
33
+ regular_error_tip: string;
34
+ }>>;
35
+ };
7
36
  }>>, {}>;
@@ -1,18 +1,75 @@
1
- import { defineComponent, createVNode } from 'vue';
1
+ import { defineComponent, computed, createVNode } from 'vue';
2
2
  import { isField } from '@formily/core';
3
3
  import { connect, mapProps } from '@formily/vue';
4
4
  import { isObject } from '@vueuse/core';
5
5
  import { NDatePicker } from 'naive-ui';
6
+ import { useCommonInjection } from '../../../../../packages/form-render/src/hooks/useCommonInjection';
6
7
 
7
8
  const script = defineComponent({
8
9
  props: {
9
10
  onChange: {},
10
- value: {}
11
+ value: {},
12
+ validate: {
13
+ type: Object
14
+ }
11
15
  },
12
- setup(_) {
13
- return () => {
14
- return createVNode(NDatePicker, null, null);
15
- };
16
+ setup(props) {
17
+ useCommonInjection().injectValueValidate(() => props.value);
18
+ function minCurrentDate() {
19
+ var _a;
20
+ return ((_a = props.validate) == null ? void 0 : _a.min_date) === "currTime";
21
+ }
22
+ function maxCurrentDate() {
23
+ var _a;
24
+ return ((_a = props.validate) == null ? void 0 : _a.max_date) === "currTime";
25
+ }
26
+ function isDateDisabled(time) {
27
+ return minCurrentDate() && time < yesterday() || maxCurrentDate() && time > Date.now();
28
+ function yesterday() {
29
+ return Date.now() - 24 * 60 * 60 * 1e3;
30
+ }
31
+ }
32
+ function isTimeDisabled(time) {
33
+ const checkDate = new Date(time);
34
+ const currentDate = new Date();
35
+ return {
36
+ isHourDisabled,
37
+ isMinuteDisabled
38
+ };
39
+ function checkHour() {
40
+ return checkDate.getHours();
41
+ }
42
+ function currentHour() {
43
+ return currentDate.getHours();
44
+ }
45
+ function currentMinute() {
46
+ return currentDate.getMinutes();
47
+ }
48
+ function isHourDisabled(hour) {
49
+ return minCurrentDate() && hour < currentHour() || maxCurrentDate() && hour > currentHour();
50
+ }
51
+ function isMinuteDisabled(minute) {
52
+ if (checkHour() === currentHour()) {
53
+ return minCurrentDate() && minute < currentMinute() || maxCurrentDate() && minute > currentMinute();
54
+ }
55
+ return minCurrentDate() && checkHour() < currentHour() || maxCurrentDate() && checkHour() > currentHour();
56
+ }
57
+ }
58
+ const validateConfig = computed(() => {
59
+ const result = {};
60
+ if (isObject(props.validate)) {
61
+ const {
62
+ min_date,
63
+ max_date
64
+ } = props.validate;
65
+ if (min_date || max_date) {
66
+ result.isDateDisabled = isDateDisabled;
67
+ result.isTimeDisabled = isTimeDisabled;
68
+ }
69
+ }
70
+ return result;
71
+ });
72
+ return () => createVNode(NDatePicker, validateConfig.value, null);
16
73
  }
17
74
  });
18
75
  const DATE = connect(script, mapProps((props, field) => {
@@ -26,58 +83,8 @@ const DATE = connect(script, mapProps((props, field) => {
26
83
  field.setValue(v);
27
84
  }
28
85
  });
29
- if (isObject(props.validate)) {
30
- const {
31
- min_date,
32
- max_date
33
- } = props.validate;
34
- if (min_date || max_date) {
35
- _props.isDateDisabled = isDateDisabled;
36
- _props.isTimeDisabled = isTimeDisabled;
37
- }
38
- }
39
86
  }
40
87
  return _props;
41
- function minCurrentDate() {
42
- var _a;
43
- return ((_a = props.validate) == null ? void 0 : _a.min_date) === "currTime";
44
- }
45
- function maxCurrentDate() {
46
- var _a;
47
- return ((_a = props.validate) == null ? void 0 : _a.max_date) === "currTime";
48
- }
49
- function isDateDisabled(time) {
50
- return minCurrentDate() && time < yesterday() || maxCurrentDate() && time > Date.now();
51
- function yesterday() {
52
- return Date.now() - 24 * 60 * 60 * 1e3;
53
- }
54
- }
55
- function isTimeDisabled(time) {
56
- const checkDate = new Date(time);
57
- const currentDate = new Date();
58
- return {
59
- isHourDisabled,
60
- isMinuteDisabled
61
- };
62
- function checkHour() {
63
- return checkDate.getHours();
64
- }
65
- function currentHour() {
66
- return currentDate.getHours();
67
- }
68
- function currentMinute() {
69
- return currentDate.getMinutes();
70
- }
71
- function isHourDisabled(hour) {
72
- return minCurrentDate() && hour < currentHour() || maxCurrentDate() && hour > currentHour();
73
- }
74
- function isMinuteDisabled(minute) {
75
- if (checkHour() === currentHour()) {
76
- return minCurrentDate() && minute < currentMinute() || maxCurrentDate() && minute > currentMinute();
77
- }
78
- return minCurrentDate() && checkHour() < currentHour() || maxCurrentDate() && checkHour() > currentHour();
79
- }
80
- }
81
88
  }));
82
89
 
83
90
  export { DATE };
@@ -1,6 +1,7 @@
1
1
  import { defineComponent, ref, computed, inject, watch, createVNode } from 'vue';
2
2
  import { isField } from '@formily/core';
3
3
  import { isEqual, cloneDeep } from 'lodash-es';
4
+ import { useCommonInjection } from '../../../../../packages/form-render/src/hooks/useCommonInjection';
4
5
  import { InjectionChangeContextCollector, InjectAsyncQueue, InjectionFormItemDepsCollector } from '../../constants/index.js';
5
6
  import { assignUpdateValue, traverseDependKey } from '../../utils/index.js';
6
7
  import { connect, mapProps } from '@formily/vue';
@@ -106,13 +107,12 @@ const script = defineComponent({
106
107
  }, {
107
108
  immediate: true
108
109
  });
109
- watch(() => props.value, (n, o) => {
110
- var _a, _b;
111
- o == null && n != null && fetchData();
112
- isField(field.value) && field.value.visited && ((_b = (_a = field.value).validate) == null ? void 0 : _b.call(_a));
113
- }, {
114
- immediate: true
115
- });
110
+ const {
111
+ injectValueValidate,
112
+ injectValueWatchFromEmpty
113
+ } = useCommonInjection();
114
+ injectValueWatchFromEmpty(() => props.value, fetchData);
115
+ injectValueValidate(() => props.value);
116
116
  function focusDecorator(onFocus) {
117
117
  return (...args) => {
118
118
  if (isField(field.value)) {
@@ -0,0 +1,6 @@
1
+ import { Func } from '../../../../../es/src/types';
2
+ import { WatchSource } from '@vue/runtime-core';
3
+ export declare function useCommonInjection(): {
4
+ injectValueValidate: (traverser: WatchSource) => void;
5
+ injectValueWatchFromEmpty: (traverser: WatchSource, trigger: Func) => void;
6
+ };
@@ -0,0 +1,19 @@
1
+ import { isField } from '@formily/core';
2
+ import { watch } from 'vue';
3
+ import { useFormField } from '../../../../packages/form-render';
4
+
5
+ function useCommonInjection() {
6
+ function injectValueValidate(traverser) {
7
+ const { field } = useFormField();
8
+ watch(traverser, () => {
9
+ var _a, _b;
10
+ return isField(field.value) && field.value.visited && ((_b = (_a = field.value).validate) == null ? void 0 : _b.call(_a));
11
+ });
12
+ }
13
+ function injectValueWatchFromEmpty(traverser, trigger) {
14
+ watch(traverser, (n, o) => n != null && o == null && trigger(), { immediate: true });
15
+ }
16
+ return { injectValueValidate, injectValueWatchFromEmpty };
17
+ }
18
+
19
+ export { useCommonInjection };
@@ -1,5 +1,4 @@
1
1
  import { AnyObject, ArrayAble } from '../../../../../es/src/types';
2
- import { SchemaReaction } from '@formily/json-schema/esm/types';
3
2
  import { SchemaTypes } from '@formily/vue';
4
3
  import { CSSProperties, VNode } from 'vue';
5
4
  import { DependKeyType, FormCommonState } from '../../../../../es/packages/form-render';
@@ -41,6 +40,20 @@ interface SwitchProperty {
41
40
  value?: any;
42
41
  describe?: string;
43
42
  }
43
+ interface ReactionType {
44
+ dependencies?: string[];
45
+ target?: string;
46
+ when?: string | boolean;
47
+ fulfill?: {
48
+ state?: AnyObject;
49
+ run?: string;
50
+ };
51
+ otherwise?: {
52
+ state?: AnyObject;
53
+ run?: string;
54
+ };
55
+ [key: string]: any;
56
+ }
44
57
  export declare type FieldItem = {
45
58
  /**
46
59
  * 字段的key
@@ -181,7 +194,7 @@ export declare type FieldItem = {
181
194
  /**
182
195
  * 表单联动配置
183
196
  */
184
- reactions: ArrayAble<SchemaReaction>;
197
+ reactions: ArrayAble<ReactionType>;
185
198
  [key: string]: any;
186
199
  }>;
187
200
  export {};
@@ -12,6 +12,7 @@ export declare function transformDateFormat(format?: string): "date" | "datetime
12
12
  export declare function isIdCard(idCardNo: string): boolean;
13
13
  export declare function isMobile(mobile: string): boolean;
14
14
  export declare function parseBirthday(birthday: string): AgeContext;
15
+ export declare function mergeDeepProperties(target: AnyObject, fieldList: FieldItem[], traverseProperties?: string[], property?: string, targetProperty?: string): AnyObject;
15
16
  export declare function parseIdCard(idCardNo: string): IdCardParseInfo;
16
17
  export declare function injectOrProvide<T>(key: InjectionKey<T>, creator: () => T): T;
17
18
  export declare function traverseDependKey(dependKeys: DependKeyType, handler: {
@@ -1,5 +1,6 @@
1
1
  import { inject, provide, computed, createVNode, Fragment } from 'vue';
2
- import { isArray, isObject, isString, isFunction } from 'lodash-es';
2
+ import { isObject } from '@vue/shared';
3
+ import { isArray, isString, isFunction } from 'lodash-es';
3
4
  import { FIELD_SEX_VALUE } from '../constants/index.js';
4
5
  import { isField } from '@formily/core';
5
6
  import differenceInDays from '../../../../node_modules/date-fns/esm/differenceInDays/index.js';
@@ -46,6 +47,33 @@ function parseBirthday(birthday) {
46
47
  result.age = result.year = differenceInYears(d, birthDate);
47
48
  return result;
48
49
  }
50
+ function mergeDeepProperties(target, fieldList, traverseProperties = ["children", "properties", "suffixConfig"], property = "val_key", targetProperty = "default_val") {
51
+ function traverse(_target, _fieldList) {
52
+ _fieldList.forEach((field) => {
53
+ if (!isObject(field))
54
+ return;
55
+ if (targetPropertyFor(field) != null && _target[propertyFor(field)] == null) {
56
+ _target[propertyFor(field)] = targetPropertyFor(field);
57
+ }
58
+ traverseProperties.forEach((p) => {
59
+ if (!field[p])
60
+ return;
61
+ if (!_target[propertyFor(field)]) {
62
+ _target[propertyFor(field)] = {};
63
+ }
64
+ traverse(_target[propertyFor(field)], arrayed(field[p]));
65
+ });
66
+ });
67
+ }
68
+ traverse(target, fieldList);
69
+ return target;
70
+ function propertyFor(field) {
71
+ return field[property];
72
+ }
73
+ function targetPropertyFor(field) {
74
+ return field[targetProperty];
75
+ }
76
+ }
49
77
  function parseIdCard(idCardNo) {
50
78
  const parseInner = (certificateNo, idxSexStart, birthYearSpan) => {
51
79
  const res = {};
@@ -172,4 +200,4 @@ function createInputSlot(props) {
172
200
  });
173
201
  }
174
202
 
175
- export { arrayed, assignUpdateValue, createInputSlot, createLinebarId, createSlot, elementIdEscape, fieldKeyEscape, formRenderLog, getParentLinebar, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, queryDecorator, queryInput, transformDateFormat, traverseDependKey, traverseSchema, uuidGenerator };
203
+ export { arrayed, assignUpdateValue, createInputSlot, createLinebarId, createSlot, elementIdEscape, fieldKeyEscape, formRenderLog, getParentLinebar, injectOrProvide, isIdCard, isMobile, mergeDeepProperties, parseBirthday, parseIdCard, queryDecorator, queryInput, transformDateFormat, traverseDependKey, traverseSchema, uuidGenerator };
@@ -25,7 +25,8 @@
25
25
  .form-render__formItem {
26
26
  grid-column: span var(--form-item-column) / span var(--form-item-column);
27
27
  }
28
- .form-render__formItem .n-date-picker {
28
+ .form-render__formItem .n-date-picker,
29
+ .form-render__formItem .n-input-number {
29
30
  width: 100%;
30
31
  }
31
32
  .form-render__formItemLabel {
@@ -42,6 +43,15 @@
42
43
  transform: translateY(-50%);
43
44
  right: calc(var(--icon-right) * 1px);
44
45
  }
46
+ .form-render__formItem .n-form-item-label {
47
+ display: inline-flex;
48
+ }
49
+ .form-render__formItem .n-form-item-label [annotation-hover-show='true'] {
50
+ visibility: hidden;
51
+ }
52
+ .form-render__formItem .n-form-item-label:hover [annotation-hover-show='true'] {
53
+ visibility: visible;
54
+ }
45
55
  .form-render__linebar {
46
56
  grid-column: span var(--column) / span var(--column);
47
57
  }
@@ -131,12 +141,3 @@
131
141
  display: flex !important;
132
142
  gap: 0 8px;
133
143
  }
134
- .form-render .n-form-item-label {
135
- display: inline-flex;
136
- }
137
- .form-render .n-form-item-label [annotation-hover-show='true'] {
138
- visibility: hidden;
139
- }
140
- .form-render .n-form-item-label:hover [annotation-hover-show='true'] {
141
- visibility: visible;
142
- }