cnhis-design-vue 3.1.14-beta.4 → 3.1.14-beta.5

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.
@@ -1,7 +1,8 @@
1
1
  import { defineComponent, reactive, computed, onMounted, onUnmounted, watch, openBlock, createElementBlock, Fragment, createVNode, unref, withCtx, renderSlot, withModifiers, createCommentVNode, createTextVNode, toDisplayString, mergeProps } from 'vue';
2
+ import { isObject } from '@vue/shared';
2
3
  import { useMessage, NDropdown, NButton, NIcon } from 'naive-ui';
3
4
  import { ChevronDown } from '@vicons/ionicons5';
4
- import Print from './utils/print.js';
5
+ import { Print } from './utils/print.js';
5
6
  import './components/IdentityVerification.js';
6
7
  import moment from 'moment';
7
8
  import script$1 from './components/IdentityVerification.vue_vue_type_script_setup_true_lang.js';
@@ -123,6 +124,9 @@ var script = /* @__PURE__ */ defineComponent({
123
124
  };
124
125
  const callLocalServicesErrorCb = (res) => {
125
126
  emit("error", res);
127
+ if (isObject(res) && res.type === "notInstalledApp") {
128
+ $message.error(res.message);
129
+ }
126
130
  };
127
131
  const prevFnError = () => {
128
132
  let error = {
@@ -0,0 +1 @@
1
+ export * from './print';
@@ -0,0 +1 @@
1
+ export { Print } from './print.js';
@@ -1,5 +1,5 @@
1
1
  import { AnyObject, Func } from '../../../../../es/src/types';
2
- export default class Print {
2
+ export declare class Print {
3
3
  private readonly webview;
4
4
  private currentMessageHandler?;
5
5
  constructor();
@@ -322,4 +322,4 @@ class Print {
322
322
  }
323
323
  }
324
324
 
325
- export { Print as default };
325
+ export { Print };
@@ -14,7 +14,8 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
14
14
  data: import("./src/interface").IData;
15
15
  addRenderItem?: Function | undefined;
16
16
  };
17
- emits: (event: "change" | "add", ...args: any[]) => void;
17
+ emits: (event: "select" | "change" | "add", ...args: any[]) => void;
18
+ select: import("vue").Ref<any>;
18
19
  canvasRef: any;
19
20
  canvas: import("vue").Ref<any>;
20
21
  dateHeight: import("vue").ComputedRef<number>;
@@ -48,6 +49,7 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
48
49
  originY: number;
49
50
  endY: number;
50
51
  }>;
52
+ topList: import("vue").ComputedRef<import("./src/interface").IDate[]>;
51
53
  propItems: any;
52
54
  cumputedX: (value: string | number) => any;
53
55
  cumputedY: (type: import("./src/interface").IPointType, scaleValueList: number[], value: string | number) => number;
@@ -180,7 +182,7 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
180
182
  show: boolean;
181
183
  list: unknown[];
182
184
  }>;
183
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "add")[], "change" | "add", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
185
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "change" | "add")[], "select" | "change" | "add", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
184
186
  data: {
185
187
  type: null;
186
188
  required: true;
@@ -191,6 +193,7 @@ declare const FabricChart: SFCWithInstall<import("vue").DefineComponent<{
191
193
  };
192
194
  }>> & {
193
195
  onChange?: ((...args: any[]) => any) | undefined;
196
+ onSelect?: ((...args: any[]) => any) | undefined;
194
197
  onAdd?: ((...args: any[]) => any) | undefined;
195
198
  }, {}>>;
196
199
  export default FabricChart;
@@ -1,4 +1,4 @@
1
- import { IData } from './interface';
1
+ import { IData, IDate } from './interface';
2
2
  declare const _default: import("vue").DefineComponent<{
3
3
  data: {
4
4
  type: null;
@@ -14,7 +14,8 @@ declare const _default: import("vue").DefineComponent<{
14
14
  data: IData;
15
15
  addRenderItem?: Function | undefined;
16
16
  };
17
- emits: (event: "change" | "add", ...args: any[]) => void;
17
+ emits: (event: "select" | "change" | "add", ...args: any[]) => void;
18
+ select: import("vue").Ref<any>;
18
19
  canvasRef: any;
19
20
  canvas: import("vue").Ref<any>;
20
21
  dateHeight: import("vue").ComputedRef<number>;
@@ -48,6 +49,7 @@ declare const _default: import("vue").DefineComponent<{
48
49
  originY: number;
49
50
  endY: number;
50
51
  }>;
52
+ topList: import("vue").ComputedRef<IDate[]>;
51
53
  propItems: any;
52
54
  cumputedX: (value: string | number) => any;
53
55
  cumputedY: (type: import("./interface").IPointType, scaleValueList: number[], value: string | number) => number;
@@ -180,7 +182,7 @@ declare const _default: import("vue").DefineComponent<{
180
182
  show: boolean;
181
183
  list: unknown[];
182
184
  }>;
183
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "add")[], "change" | "add", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
185
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "change" | "add")[], "select" | "change" | "add", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
184
186
  data: {
185
187
  type: null;
186
188
  required: true;
@@ -191,6 +193,7 @@ declare const _default: import("vue").DefineComponent<{
191
193
  };
192
194
  }>> & {
193
195
  onChange?: ((...args: any[]) => any) | undefined;
196
+ onSelect?: ((...args: any[]) => any) | undefined;
194
197
  onAdd?: ((...args: any[]) => any) | undefined;
195
198
  }, {}>;
196
199
  export default _default;
@@ -9,7 +9,7 @@ import { useLeft } from './hooks/useLeft.js';
9
9
  import { useRight } from './hooks/useRight.js';
10
10
  import { useBottom } from './hooks/useBottom.js';
11
11
  import { useOther } from './hooks/useOther.js';
12
- import { useEvent } from './hooks/useEvent.js';
12
+ import { useEvent, useCanvasEvent } from './hooks/useEvent.js';
13
13
  import script$1 from './components/PopupTip.vue_vue_type_script_setup_true_lang.js';
14
14
  import { useCumputedPoint } from './hooks/useCumputedPoint.js';
15
15
 
@@ -19,10 +19,11 @@ var script = /* @__PURE__ */ defineComponent({
19
19
  data: { type: null, required: true },
20
20
  addRenderItem: { type: Function, required: false }
21
21
  },
22
- emits: ["change", "add"],
23
- setup(__props, { emit: emits }) {
22
+ emits: ["change", "add", "select"],
23
+ setup(__props, { expose, emit: emits }) {
24
24
  const props = __props;
25
25
  const defaultHeight = 15;
26
+ let select = ref();
26
27
  const canvasRef = ref(null);
27
28
  let canvas = ref();
28
29
  const dateHeight = computed(() => {
@@ -200,14 +201,29 @@ var script = /* @__PURE__ */ defineComponent({
200
201
  }
201
202
  return obj;
202
203
  });
204
+ const topList = computed(() => {
205
+ const { top } = props.data;
206
+ let topList2 = [];
207
+ for (let i in top) {
208
+ if (top[i].show) {
209
+ topList2.push({
210
+ ...top[i],
211
+ key: i
212
+ });
213
+ }
214
+ }
215
+ return topList2.sort((a, b) => a.seq - b.seq);
216
+ });
203
217
  const propItems = reactive({
204
218
  canvasWidth: props.data.width,
205
219
  canvasHeight: props.data.height,
206
220
  borderStyle: props.data.borderStyle || defaultBorderStyle,
221
+ selectionStyle: props.data.selectionStyle || {},
207
222
  dateHeight: dateHeight.value,
208
223
  hospitalDaysHeight: hospitalDaysHeight.value,
209
224
  operationDaysHeight: operationDaysHeight.value,
210
225
  xScalevalueHeight: xScalevalueHeight.value,
226
+ topList: topList.value,
211
227
  breathingHeight: breathingHeight.value,
212
228
  grid: props.data.grid,
213
229
  top: props.data.top,
@@ -253,11 +269,16 @@ var script = /* @__PURE__ */ defineComponent({
253
269
  fireRightClick: true
254
270
  });
255
271
  useEvent(canvasRef.value);
272
+ const { select: selectFunc } = useCanvasEvent(canvas, propItems, emits);
273
+ select.value = selectFunc;
256
274
  });
257
275
  onBeforeUnmount(() => {
258
276
  canvas.value.clear();
259
277
  canvas.value = null;
260
278
  });
279
+ expose({
280
+ select
281
+ });
261
282
  return (_ctx, _cache) => {
262
283
  return openBlock(), createElementBlock(Fragment, null, [
263
284
  createElementVNode("canvas", {
@@ -1,4 +1,4 @@
1
- export { defaultBorderStyle } from './useDraw';
1
+ export * from './useDraw';
2
2
  export * from './useCumputedPoint';
3
3
  export * from './useTop';
4
4
  export * from './useLeft';
@@ -1,4 +1,4 @@
1
- export { defaultBorderStyle } from './useDraw.js';
1
+ export { defaultBorderStyle, defaultLineStyle, defaultRectStyle, defaultStyle, defaultTextStyle, drawLine, drawPoint, drawTextGroup } from './useDraw.js';
2
2
  export { useCumputedPoint } from './useCumputedPoint.js';
3
3
  export { useTop } from './useTop.js';
4
4
  export { useLeft } from './useLeft.js';
@@ -6,4 +6,4 @@ export { useRight } from './useRight.js';
6
6
  export { useCenter } from './useCenter.js';
7
7
  export { useBottom } from './useBottom.js';
8
8
  export { useOther } from './useOther.js';
9
- export { useEvent } from './useEvent.js';
9
+ export { useCanvasEvent, useEvent } from './useEvent.js';
@@ -1 +1,7 @@
1
+ import { Ref } from 'vue';
2
+ import { fabric } from '../utils';
3
+ import { IPropItems } from '../interface';
1
4
  export declare function useEvent(element: HTMLCanvasElement | any): void;
5
+ export declare function useCanvasEvent(canvas: Ref<fabric.Canvas>, propItems: IPropItems, emits: any): {
6
+ select: (key: string) => void;
7
+ };
@@ -1,4 +1,5 @@
1
1
  import { useEventListener } from '@vueuse/core';
2
+ import { fabric } from '../utils/index.js';
2
3
 
3
4
  function useEvent(element) {
4
5
  useEventListener(element.nextSibling, "contextmenu", (e) => {
@@ -6,5 +7,69 @@ function useEvent(element) {
6
7
  return false;
7
8
  });
8
9
  }
10
+ function useCanvasEvent(canvas, propItems, emits) {
11
+ const { originY, originX, endX, endY, iconsWidth, selectionStyle, topList } = propItems;
12
+ function drawRect(options, key) {
13
+ const { left, top, width, height } = options;
14
+ const rect = new fabric.Rect({
15
+ key,
16
+ left: left != null ? left : 0,
17
+ top: top != null ? top : 0,
18
+ width,
19
+ height,
20
+ stroke: "transparent",
21
+ strokeWidth: 1,
22
+ fill: "transparent",
23
+ lockMovementX: true,
24
+ lockMovementY: true,
25
+ transparentCorners: false,
26
+ ...selectionStyle
27
+ });
28
+ canvas.value.add(rect);
29
+ rect.on("mousedown", () => {
30
+ emits("select", key);
31
+ });
32
+ return rect;
33
+ }
34
+ function initSelection() {
35
+ if (typeof (selectionStyle == null ? void 0 : selectionStyle.evented) === "boolean" && !(selectionStyle == null ? void 0 : selectionStyle.evented))
36
+ return;
37
+ const selections2 = [];
38
+ selections2.push(drawRect({
39
+ left: iconsWidth,
40
+ top: originY,
41
+ width: originX - iconsWidth,
42
+ height: endY
43
+ }, "left"));
44
+ let topY = 0;
45
+ topList.forEach((item, index) => {
46
+ if (index > 0) {
47
+ topY += propItems[`${topList[index - 1].key}Height`];
48
+ }
49
+ selections2.push(drawRect({
50
+ left: iconsWidth,
51
+ top: topY,
52
+ width: endX - iconsWidth,
53
+ height: propItems[`${item.key}Height`]
54
+ }, item.key));
55
+ });
56
+ selections2.push(drawRect({
57
+ left: originX,
58
+ top: originY,
59
+ width: endX - originX,
60
+ height: endY - originY
61
+ }, "grid"));
62
+ canvas.value.renderAll();
63
+ return selections2;
64
+ }
65
+ const selections = initSelection();
66
+ function select(key) {
67
+ canvas.value.discardActiveObject();
68
+ const obj = selections == null ? void 0 : selections.find((obj2) => obj2.key === key);
69
+ obj && obj.bringToFront();
70
+ obj && canvas.value.setActiveObject(obj);
71
+ }
72
+ return { select };
73
+ }
9
74
 
10
- export { useEvent };
75
+ export { useCanvasEvent, useEvent };
@@ -14,21 +14,12 @@ function useTop(canvas, propItems) {
14
14
  hospitalDaysHeight,
15
15
  operationDaysHeight,
16
16
  xScalevalueHeight,
17
- iconsWidth
17
+ iconsWidth,
18
+ topList
18
19
  } = propItems;
19
20
  function drawTop() {
20
21
  let list = [];
21
22
  let topY = 0;
22
- let topList = [];
23
- for (let i in top) {
24
- if (top[i].show) {
25
- topList.push({
26
- ...top[i],
27
- key: i
28
- });
29
- }
30
- }
31
- topList.sort((a, b) => a.seq - b.seq);
32
23
  topList.forEach((item, index) => {
33
24
  if (index > 0) {
34
25
  topY += propItems[`${topList[index - 1].key}Height`];
@@ -23,10 +23,12 @@ export interface IPropItems {
23
23
  canvasWidth: number;
24
24
  canvasHeight: number;
25
25
  borderStyle: fabric.ILineOptions;
26
+ selectionStyle: any;
26
27
  dateHeight: number;
27
28
  hospitalDaysHeight: number;
28
29
  operationDaysHeight: number;
29
30
  xScalevalueHeight: number;
31
+ topList: IDate[];
30
32
  breathingHeight: number;
31
33
  grid: IGrid;
32
34
  top: ITop;
@@ -96,6 +98,7 @@ export interface IData {
96
98
  width: number;
97
99
  height: number;
98
100
  borderStyle?: fabric.ILineOptions;
101
+ selectionStyle?: any;
99
102
  grid: IGrid;
100
103
  other?: IOther;
101
104
  top: ITop;
@@ -1,7 +1,7 @@
1
1
  import { isObject } from '@vueuse/core';
2
2
  import { isArray, pick } from 'lodash-es';
3
3
  import { useFormValidator, useTypeNormalize } from '../../../../packages/form-render';
4
- import { createLinebarId, arrayed, transformDateFormat } from '../utils/index.js';
4
+ import { fieldKeyEscape, createLinebarId, arrayed, transformDateFormat } from '../utils/index.js';
5
5
 
6
6
  function useFieldListAdaptor(collector, uuid) {
7
7
  const { createValidatorSchema } = useFormValidator();
@@ -174,13 +174,15 @@ function useFieldListAdaptor(collector, uuid) {
174
174
  return creator(item);
175
175
  };
176
176
  const createWidgetCombinationSchema = (item) => {
177
+ if (!item.suffixConfig)
178
+ return createWidgetSchema(item);
177
179
  const suffixList = arrayed(item.suffixConfig);
178
180
  const fieldList = [{ ...item, suffixConfig: void 0 }].concat(suffixList.map((suffix) => {
179
181
  return { ...suffix, is_show: item.is_show, alias: " " };
180
182
  }));
181
183
  return {
182
184
  type: "void",
183
- name: fieldList.map((f) => f.val_key).join("-"),
185
+ name: fieldKeyEscape(fieldList),
184
186
  title: item.alias || item.name,
185
187
  "x-component": "INPUT_GROUP",
186
188
  "x-component-props": { span: item.elem_width },
@@ -212,7 +214,7 @@ function useFieldListAdaptor(collector, uuid) {
212
214
  }
213
215
  function createFieldName(fieldItem) {
214
216
  if (isArray(fieldItem.suffixConfig)) {
215
- return [fieldItem.val_key, fieldItem.suffixConfig.map((f) => f.val_key)].join("-");
217
+ return fieldKeyEscape([fieldItem, ...fieldItem.suffixConfig]);
216
218
  }
217
219
  return fieldItem.val_key;
218
220
  }
@@ -69,6 +69,7 @@ export declare type FieldItem = {
69
69
  nameKey: string;
70
70
  valueKey: string;
71
71
  }>;
72
+ suffixConfig: FieldItem[];
72
73
  fieldType: 'string' | 'object' | 'array' | 'number' | 'void' | 'boolean' | 'datetime';
73
74
  content: string | FormRenderer | Record<string, FormRenderer>;
74
75
  properties: FieldItem[];
@@ -27,3 +27,4 @@ export declare function queryInput(decoratorElement?: HTMLElement | null): {
27
27
  };
28
28
  export declare function getParentLinebar(key: string, fieldList: FieldItem[]): string | null;
29
29
  export declare function createLinebarId(id: string): string;
30
+ export declare function fieldKeyEscape(fieldList: FieldItem[]): string;
@@ -139,5 +139,8 @@ function getParentLinebar(key, fieldList) {
139
139
  function createLinebarId(id) {
140
140
  return `id-${id}`;
141
141
  }
142
+ function fieldKeyEscape(fieldList) {
143
+ return fieldList.map((f) => f.val_key).join("-").replace(/[.]/g, "_");
144
+ }
142
145
 
143
- export { arrayed, assignUpdateValue, createLinebarId, createSlot, formRenderLog, generateUrlParams, getParentLinebar, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, queryDecorator, queryInput, transformDateFormat, traverseSchema, uuidGenerator };
146
+ export { arrayed, assignUpdateValue, createLinebarId, createSlot, fieldKeyEscape, formRenderLog, generateUrlParams, getParentLinebar, injectOrProvide, isIdCard, isMobile, parseBirthday, parseIdCard, queryDecorator, queryInput, transformDateFormat, traverseSchema, uuidGenerator };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
3
  "private": false,
4
- "version": "3.1.14-beta.4",
4
+ "version": "3.1.14-beta.5",
5
5
  "license": "ISC",
6
6
  "module": "es/packages/index.js",
7
7
  "main": "es/packages/index.js",