cnhis-design-vue 3.3.3-beta.56 → 3.3.3-beta.58

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.
@@ -20,10 +20,12 @@ export declare class Print {
20
20
  private _successCallbackFn;
21
21
  private _errorCallbackFn;
22
22
  private _cancelCallbackFn;
23
+ private _notifyPrintQueueMap;
23
24
  constructor();
24
25
  private readonly messageHandlerQueue;
25
26
  private messageHandler;
26
27
  private _initDomesticSystem;
28
+ private createQueueProgressNotifyCss;
27
29
  getPicAndUpload(obj: any): Promise<void>;
28
30
  private postMessage;
29
31
  messageCollect(id: string, data: AnyObject): Promise<unknown>;
@@ -55,7 +57,7 @@ export declare class Print {
55
57
  pageCount: any;
56
58
  formatId: string;
57
59
  };
58
- _handleEventDirect({ templateId, formatId, number, svrUpdateIp, apptype, uuid, hideButtons, params, paramsArr, cmdid, print, signature, copies, printdlgshow, nobillnode, btnprint, messageTimeout }: AnyObject): Promise<any>;
60
+ _handleEventDirect({ templateId, formatId, number, svrUpdateIp, apptype, printname, uuid, priority, hideButtons, params, paramsArr, cmdid, print, signature, copies, printdlgshow, nobillnode, btnprint, messageTimeout }: AnyObject): Promise<any>;
59
61
  _handleEventEditFormat({ templateId, formatId, number, params, token, messageTimeout }: AnyObject): Promise<any>;
60
62
  _queryProxyOrigin(): Promise<void>;
61
63
  _queryPrintFile(formatId: string, params?: string): Promise<any>;
@@ -68,7 +70,7 @@ export declare class Print {
68
70
  _base64ToBlob(fileBase64: string, fileType: string): Blob;
69
71
  preview({ iReportExecuteMode, hideButtons, templateId, number, formatId: originFormatId, formatItem, params, paramsArr, authorizationKey, signature, btnprint, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<any>;
70
72
  printSync(data: AnyObject[], successCallbackFn: AnyFn, errorCallbackFn: AnyFn): Promise<void>;
71
- printDirect({ iReportExecuteMode, templateId, number, formatId: originFormatId, formatItem, params, paramsArr, authorizationKey, print, signature, printdlgshow, nobillnode, copies, svrUpdateIp, apptype, uuid, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, cancelCallbackFn?: AnyFn, mode?: string): Promise<false | undefined>;
73
+ printDirect({ iReportExecuteMode, templateId, number, formatId: originFormatId, formatItem, params, paramsArr, authorizationKey, print, signature, printdlgshow, nobillnode, copies, svrUpdateIp, apptype, uuid, printname, priority, isShowQueueProgressNotify, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, cancelCallbackFn?: AnyFn, printQueueCallbackFn?: AnyFn, mode?: string): Promise<false | undefined>;
72
74
  printToHiPrint({ templateId, formatId, params, authorizationKey }: any, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, cancelCallbackFn?: AnyFn): Promise<any>;
73
75
  private _downloadPDF;
74
76
  /**
@@ -2,7 +2,9 @@ import axios from 'axios';
2
2
  import { cloneDeep, isArray } from 'lodash-es';
3
3
  import { IdentityVerificationDialog, PreviewDialog } from './dialog.js';
4
4
  import { isIReport, getFileUrl, useBrowserPrint } from './browserPrint.js';
5
- import { getCurrentInstance } from 'vue';
5
+ import { h, getCurrentInstance } from 'vue';
6
+ import { createDiscreteApi, NIcon, NProgress } from 'naive-ui';
7
+ import { ReloadOutline } from '@vicons/ionicons5';
6
8
  import { uuidGenerator } from '../../../../shared/utils/index.js';
7
9
  import { format } from 'date-fns';
8
10
  import { io } from 'socket.io-client';
@@ -30,6 +32,13 @@ const PREVIEWIREPOR = `${REMOTEPRINTORIGIN}/bi-api/reprot/print/open/client/prev
30
32
  const ERRORMSG = "\u83B7\u53D6\u6587\u4EF6\u5931\u8D25\uFF01";
31
33
  const QUERYPRINTORIGIN = `${REMOTEPRINTORIGIN}/bi-api/reprot/print/open/client/getRemote`;
32
34
  const FILEURL = `${REMOTEPRINTORIGIN}/printService/file`;
35
+ const {
36
+ notification
37
+ } = createDiscreteApi(["notification"], {
38
+ notificationProviderProps: {
39
+ placement: "bottom-right"
40
+ }
41
+ });
33
42
  let printInstance = null;
34
43
  class Print {
35
44
  constructor() {
@@ -51,6 +60,7 @@ class Print {
51
60
  this._successCallbackFn = null;
52
61
  this._errorCallbackFn = null;
53
62
  this._cancelCallbackFn = null;
63
+ this._notifyPrintQueueMap = null;
54
64
  this.messageHandlerQueue = [];
55
65
  this.getIReportFormatId = (isIReport2, formatId) => {
56
66
  return isIReport2 ? formatId.split("_")[1] : formatId;
@@ -61,6 +71,10 @@ class Print {
61
71
  printInstance = this;
62
72
  const _window = window;
63
73
  this.CMonitor = _window.$CMonitor;
74
+ this._notifyPrintQueueMap = {
75
+ data: /* @__PURE__ */ new Map(),
76
+ callback: /* @__PURE__ */ new Map()
77
+ };
64
78
  try {
65
79
  this.webview = _window.top ? (_a = _window.top.chrome) == null ? void 0 : _a.webview : (_b = _window.chrome) == null ? void 0 : _b.webview;
66
80
  } catch (error) {
@@ -110,8 +124,63 @@ class Print {
110
124
  console.log("\u89E3\u6790e.data\u5931\u8D25\uFF0C" + _e);
111
125
  this._handleMonitorNotify("\u89E3\u6790e.data\u5931\u8D25\uFF0C" + e);
112
126
  }
113
- if (["print", "pdf", "resetprint"].includes(data == null ? void 0 : data.cmd)) {
114
- console.log("\u6253\u5370\u547D\u4EE4\u6267\u884C\u4E86", data);
127
+ if (["print", "pdf", "resetprint", "printback"].includes(data == null ? void 0 : data.cmd)) {
128
+ if ((data == null ? void 0 : data.cmd) === "printback") {
129
+ const {
130
+ ext = {}
131
+ } = (data == null ? void 0 : data.data) || {};
132
+ const curUidDom = this._notifyPrintQueueMap.data.get(ext == null ? void 0 : ext.uuid);
133
+ const curUidCallback = this._notifyPrintQueueMap.callback.get(ext == null ? void 0 : ext.uuid);
134
+ const currentV = (ext == null ? void 0 : ext.currentcount) || 0;
135
+ const totalV = (ext == null ? void 0 : ext.totalcount) || 0;
136
+ if (curUidDom) {
137
+ const value = totalV ? parseInt((100 * currentV / totalV).toString()) : 0;
138
+ curUidDom.content = () => h("div", {}, [h("div", {
139
+ style: {
140
+ display: "flex",
141
+ alignItems: "center",
142
+ fontSize: "12px",
143
+ marginBottom: "8px"
144
+ }
145
+ }, [h(NIcon, {
146
+ color: "#0e7a0d",
147
+ size: 12,
148
+ component: ReloadOutline,
149
+ style: {
150
+ animation: "rotateQueueProgressNotify 1s linear infinite",
151
+ willChange: "transform",
152
+ backfaceVisibility: "hidden"
153
+ }
154
+ }), h("span", {
155
+ style: {
156
+ color: "#0e7a0d",
157
+ marginLeft: "4px",
158
+ marginRight: "8px"
159
+ }
160
+ }, "\u6B63\u5728\u6253\u5370\u4E2D..."), h("span", {}, `${value}%`)]), h(NProgress, {
161
+ type: "line",
162
+ strokeWidth: 2,
163
+ percentage: value,
164
+ showIndicator: false,
165
+ processing: value < 100 ? true : false
166
+ }), h("div", {
167
+ style: {
168
+ marginTop: "6px",
169
+ fontSize: "12px"
170
+ }
171
+ }, `\u5DF2\u5B8C\u6210${currentV}\u6761\uFF0C\u5171${totalV}\u6761`)]);
172
+ if (value >= 100) {
173
+ this._notifyPrintQueueMap.data.delete(ext == null ? void 0 : ext.uuid);
174
+ setTimeout(() => {
175
+ curUidDom == null ? void 0 : curUidDom.destroy();
176
+ }, 800);
177
+ }
178
+ }
179
+ if (curUidCallback) {
180
+ curUidCallback((data == null ? void 0 : data.data) || {});
181
+ currentV >= totalV && this._notifyPrintQueueMap.callback.delete(ext == null ? void 0 : ext.uuid);
182
+ }
183
+ }
115
184
  const handler = this.messageHandlerQueue.shift();
116
185
  if (!handler)
117
186
  return console.log("\u5F53\u524D\u56DE\u6267", e, "\u6CA1\u6709\u53EF\u7528\u7684handler");
@@ -190,6 +259,24 @@ class Print {
190
259
  cb && cb(false);
191
260
  }
192
261
  }
262
+ createQueueProgressNotifyCss() {
263
+ const notifyStyleDom = document.getElementById("queueProgressNotifyCss");
264
+ if (notifyStyleDom)
265
+ return;
266
+ const style = document.createElement("style");
267
+ style.textContent = `
268
+ @keyframes rotateQueueProgressNotify {
269
+ from {
270
+ transform: rotate(0deg);
271
+ }
272
+ to {
273
+ transform: rotate(360deg);
274
+ }
275
+ }
276
+ `;
277
+ style.id = "queueProgressNotifyCss";
278
+ document.head.appendChild(style);
279
+ }
193
280
  async getPicAndUpload(obj) {
194
281
  try {
195
282
  const isObject = (o) => Object.prototype.toString.call(o) === "[object Object]";
@@ -559,7 +646,9 @@ class Print {
559
646
  number,
560
647
  svrUpdateIp,
561
648
  apptype,
649
+ printname,
562
650
  uuid,
651
+ priority,
563
652
  hideButtons,
564
653
  params,
565
654
  paramsArr,
@@ -578,7 +667,9 @@ class Print {
578
667
  number,
579
668
  svrUpdateIp,
580
669
  apptype,
670
+ printname,
581
671
  uuid,
672
+ priority,
582
673
  hideButtons,
583
674
  params,
584
675
  cmdid,
@@ -924,9 +1015,12 @@ class Print {
924
1015
  svrUpdateIp,
925
1016
  apptype,
926
1017
  uuid,
1018
+ printname,
1019
+ priority,
1020
+ isShowQueueProgressNotify = false,
927
1021
  isDownloadFile = true,
928
1022
  messageTimeout = 0
929
- }, successCallbackFn, errorCallbackFn, cancelCallbackFn, mode = "printDirect") {
1023
+ }, successCallbackFn, errorCallbackFn, cancelCallbackFn, printQueueCallbackFn, mode = "printDirect") {
930
1024
  const isObject = (o) => Object.prototype.toString.call(o) === "[object Object]";
931
1025
  const iReportStatus = isIReport(originFormatId);
932
1026
  const formatId = this.getIReportFormatId(iReportStatus, originFormatId);
@@ -992,6 +1086,53 @@ class Print {
992
1086
  }];
993
1087
  params = "";
994
1088
  }
1089
+ if (uuid && printname) {
1090
+ if (isShowQueueProgressNotify) {
1091
+ this.createQueueProgressNotifyCss();
1092
+ const notifyDom = notification.create({
1093
+ title: `${printname}`,
1094
+ content: () => h("div", {}, [h("div", {
1095
+ style: {
1096
+ display: "flex",
1097
+ alignItems: "center",
1098
+ fontSize: "12px",
1099
+ marginBottom: "8px"
1100
+ }
1101
+ }, [h(NIcon, {
1102
+ color: "#0e7a0d",
1103
+ size: 12,
1104
+ component: ReloadOutline,
1105
+ style: {
1106
+ animation: "rotateQueueProgressNotify 1s linear infinite",
1107
+ willChange: "transform",
1108
+ backfaceVisibility: "hidden"
1109
+ }
1110
+ }), h("span", {
1111
+ style: {
1112
+ color: "#0e7a0d",
1113
+ marginLeft: "4px",
1114
+ marginRight: "8px"
1115
+ }
1116
+ }, "\u6B63\u5728\u6253\u5370\u4E2D..."), h("span", {}, "0%")]), h(NProgress, {
1117
+ type: "line",
1118
+ strokeWidth: 2,
1119
+ percentage: 0,
1120
+ showIndicator: false,
1121
+ processing: true
1122
+ }), h("div", {
1123
+ style: {
1124
+ marginTop: "6px",
1125
+ fontSize: "12px"
1126
+ }
1127
+ }, `\u5DF2\u5B8C\u62100\u6761\uFF0C\u5171${paramsArr.length}\u6761`)]),
1128
+ onClose: () => {
1129
+ this._notifyPrintQueueMap.data.delete(uuid);
1130
+ }
1131
+ });
1132
+ this._notifyPrintQueueMap.data.set(uuid, notifyDom);
1133
+ }
1134
+ this._notifyPrintQueueMap.callback.set(uuid, printQueueCallbackFn);
1135
+ }
995
1136
  const printdlgshowValue = printdlgshow != "0" ? printdlgshow : (formatItem == null ? void 0 : formatItem.showPrintDialog) ? "1" : "0";
996
1137
  const result = await this._handleEventDirect({
997
1138
  templateId,
@@ -1007,6 +1148,8 @@ class Print {
1007
1148
  copies,
1008
1149
  svrUpdateIp,
1009
1150
  apptype,
1151
+ printname,
1152
+ priority,
1010
1153
  uuid,
1011
1154
  messageTimeout
1012
1155
  });
@@ -1145,6 +1288,8 @@ class Print {
1145
1288
  }
1146
1289
  }, (err) => onReject(err), (err) => {
1147
1290
  console.log(err);
1291
+ }, (result) => {
1292
+ console.log(result);
1148
1293
  }, "downloadPDF");
1149
1294
  }
1150
1295
  async print({
@@ -65,6 +65,7 @@ export * from './audio-sdk';
65
65
  export * from './step-notice';
66
66
  export * from './info-header';
67
67
  export * from './vertify';
68
+ export * from './keyboard';
68
69
  declare function install(app: App): void;
69
70
  export { CGrid, CBigTable, CFieldSet, CButtonPrint, CSelectPerson, CSelectLabel, CLabelFormContent, CScaleView, CMap, CVodChunkUpload, CRadio, CCheckbox, CSelect, CDatetime, CInfoHeader, CTimeLine, CBaseSearch, CQuickSearch, CClassification, CBpmnWorkflow, CStepsWheel, CEditor, CFormRender, CFabricChart, CShortcutProvider, CShortcutSetter, CFormConfig, CIhoTable, CKeyboard, CSearchCascader, CRecommendSearch, CDatePicker, CTimePicker, CConfigProvider, CPictureClipper, CTableExportField, CExpandField, CIhoChat, CCallback, CSliderTree, CBodySelect, CDefaultPage, CStepNotice, CToothBitmap, CCardRender, CBranchNotice, CFieldEditor, CAudioSdk };
70
71
  declare const _default: {
@@ -92,12 +92,16 @@ declare const Keyboard: SFCWithInstall<import("vue").DefineComponent<{
92
92
  popoverRef: import("vue").Ref<any>;
93
93
  englishKeyboardRef: import("vue").Ref<HTMLDivElement | undefined>;
94
94
  keyboardDragRef: import("vue").Ref<HTMLElement | undefined>;
95
+ numberPanelRef: import("vue").Ref<import("./src/types").KeyboardInstance | undefined>;
95
96
  currentValue: import("vue").Ref<any>;
97
+ draggableInstance: null;
96
98
  _style: import("vue").ComputedRef<string> | undefined;
97
99
  init: () => import("vue").ComputedRef<string> | undefined;
98
100
  keydown: (key: string | number) => void;
99
101
  onChange: (value: number) => void;
100
102
  select: () => void;
103
+ setPosition: (position: import("@vueuse/core").Position) => void;
104
+ getPosition: () => import("@vueuse/core").Position;
101
105
  NPopover: any;
102
106
  NInputNumber: any;
103
107
  NIcon: any;
@@ -185,6 +189,7 @@ declare const Keyboard: SFCWithInstall<import("vue").DefineComponent<{
185
189
  denominatorValueStatus: import("vue").Ref<import("naive-ui/es/form/src/interface").FormValidationStatus>;
186
190
  keyboardRef: import("vue").Ref<HTMLElement | null>;
187
191
  inputRef: any;
192
+ draggableInstance: null;
188
193
  style: import("vue").ComputedRef<string> | undefined;
189
194
  init: () => import("vue").ComputedRef<string> | undefined;
190
195
  setFocus: () => Promise<void>;
@@ -196,6 +201,8 @@ declare const Keyboard: SFCWithInstall<import("vue").DefineComponent<{
196
201
  calculateFraction: () => void;
197
202
  setInputStatus: (valueRef: import("vue").Ref<string>, statusRef: import("vue").Ref<string>, isInteger?: boolean | undefined) => true | undefined;
198
203
  setInputValueStatus: () => void;
204
+ setPosition: (position: import("@vueuse/core").Position) => void;
205
+ getPosition: () => import("@vueuse/core").Position;
199
206
  NIcon: any;
200
207
  NSpace: any;
201
208
  ArrowUndoSharp: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
@@ -341,3 +348,4 @@ declare const Keyboard: SFCWithInstall<import("vue").DefineComponent<{
341
348
  moveOffset: import("@vueuse/core").Position;
342
349
  }>>;
343
350
  export default Keyboard;
351
+ export type { KeyboardInstance } from './src/types';
@@ -1,5 +1,6 @@
1
1
  import { PropType } from 'vue';
2
2
  import { Position } from '@vueuse/core';
3
+ import type { KeyboardInstance } from './types';
3
4
  declare const _default: import("vue").DefineComponent<{
4
5
  mode: {
5
6
  type: PropType<"number" | "day" | "dose" | "english">;
@@ -93,12 +94,16 @@ declare const _default: import("vue").DefineComponent<{
93
94
  popoverRef: import("vue").Ref<any>;
94
95
  englishKeyboardRef: import("vue").Ref<HTMLDivElement | undefined>;
95
96
  keyboardDragRef: import("vue").Ref<HTMLElement | undefined>;
97
+ numberPanelRef: import("vue").Ref<KeyboardInstance | undefined>;
96
98
  currentValue: import("vue").Ref<any>;
99
+ draggableInstance: null;
97
100
  _style: import("vue").ComputedRef<string> | undefined;
98
101
  init: () => import("vue").ComputedRef<string> | undefined;
99
102
  keydown: (key: string | number) => void;
100
103
  onChange: (value: number) => void;
101
104
  select: () => void;
105
+ setPosition: (position: Position) => void;
106
+ getPosition: () => Position;
102
107
  NPopover: any;
103
108
  NInputNumber: any;
104
109
  NIcon: any;
@@ -186,6 +191,7 @@ declare const _default: import("vue").DefineComponent<{
186
191
  denominatorValueStatus: import("vue").Ref<import("naive-ui/es/form/src/interface").FormValidationStatus>;
187
192
  keyboardRef: import("vue").Ref<HTMLElement | null>;
188
193
  inputRef: any;
194
+ draggableInstance: null;
189
195
  style: import("vue").ComputedRef<string> | undefined;
190
196
  init: () => import("vue").ComputedRef<string> | undefined;
191
197
  setFocus: () => Promise<void>;
@@ -197,6 +203,8 @@ declare const _default: import("vue").DefineComponent<{
197
203
  calculateFraction: () => void;
198
204
  setInputStatus: (valueRef: import("vue").Ref<string>, statusRef: import("vue").Ref<string>, isInteger?: boolean | undefined) => true | undefined;
199
205
  setInputValueStatus: () => void;
206
+ setPosition: (position: Position) => void;
207
+ getPosition: () => Position;
200
208
  NIcon: any;
201
209
  NSpace: any;
202
210
  ArrowUndoSharp: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
@@ -94,28 +94,26 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
94
94
  const popoverRef = ref();
95
95
  const englishKeyboardRef = ref();
96
96
  const keyboardDragRef = ref();
97
+ const numberPanelRef = ref();
97
98
  const currentValue = ref();
99
+ let draggableInstance = null;
98
100
  const _style = init();
99
101
  function init() {
100
102
  if (props.defaultValue) {
101
103
  currentValue.value = props.defaultValue;
102
104
  }
103
105
  if (isDefault.value && props.drag) {
104
- const {
105
- x,
106
- y,
107
- style: style2
108
- } = useDraggable(englishKeyboardRef, {
106
+ draggableInstance = useDraggable(englishKeyboardRef, {
109
107
  initialValue: props.positionInitialValue,
110
108
  preventDefault: true,
111
109
  handle: keyboardDragRef,
112
- onMove: (position, event) => {
110
+ onMove: (position) => {
113
111
  var _a, _b, _c, _d;
114
112
  position.x += (_b = (_a = props.moveOffset) == null ? void 0 : _a.x) != null ? _b : 0;
115
113
  position.y += (_d = (_c = props.moveOffset) == null ? void 0 : _c.y) != null ? _d : 0;
116
114
  }
117
115
  });
118
- return style2;
116
+ return draggableInstance.style;
119
117
  }
120
118
  }
121
119
  function keydown(key) {
@@ -134,8 +132,32 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
134
132
  function select() {
135
133
  toSelectInputContent.value = Date.now();
136
134
  }
135
+ function setPosition(position) {
136
+ if (draggableInstance) {
137
+ draggableInstance.x.value = position.x;
138
+ draggableInstance.y.value = position.y;
139
+ } else if (numberPanelRef.value) {
140
+ numberPanelRef.value.setPosition(position);
141
+ }
142
+ }
143
+ function getPosition() {
144
+ if (draggableInstance) {
145
+ return {
146
+ x: draggableInstance.x.value,
147
+ y: draggableInstance.y.value
148
+ };
149
+ } else if (numberPanelRef.value) {
150
+ return numberPanelRef.value.getPosition();
151
+ }
152
+ return {
153
+ x: 0,
154
+ y: 0
155
+ };
156
+ }
137
157
  expose({
138
- select
158
+ select,
159
+ setPosition,
160
+ getPosition
139
161
  });
140
162
  return (_ctx, _cache) => {
141
163
  return !unref(isDefault) && !__props.panel ? (openBlock(), createBlock(unref(NPopover), {
@@ -162,7 +184,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
162
184
  }, null, 8, ["mode", "defaultValue"])]),
163
185
  _: 1
164
186
  }, 8, ["style"])) : !unref(isDefault) && __props.panel ? (openBlock(), createBlock(NumberPanel, mergeProps({
165
- key: 1
187
+ key: 1,
188
+ ref_key: "numberPanelRef",
189
+ ref: numberPanelRef
166
190
  }, unref(moveNumberPaneOptions), {
167
191
  style: unref(cssVars)
168
192
  }), null, 16, ["style"])) : (openBlock(), createElementBlock("div", {
@@ -81,6 +81,7 @@ declare const _default: import("vue").DefineComponent<{
81
81
  denominatorValueStatus: Ref<FormValidationStatus>;
82
82
  keyboardRef: Ref<HTMLElement | null>;
83
83
  inputRef: any;
84
+ draggableInstance: null;
84
85
  style: import("vue").ComputedRef<string> | undefined;
85
86
  init: () => import("vue").ComputedRef<string> | undefined;
86
87
  setFocus: () => Promise<void>;
@@ -92,6 +93,8 @@ declare const _default: import("vue").DefineComponent<{
92
93
  calculateFraction: () => void;
93
94
  setInputStatus: (valueRef: Ref<string>, statusRef: Ref<string>, isInteger?: boolean) => true | undefined;
94
95
  setInputValueStatus: () => void;
96
+ setPosition: (position: Position) => void;
97
+ getPosition: () => Position;
95
98
  NIcon: any;
96
99
  NSpace: any;
97
100
  ArrowUndoSharp: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
@@ -54,6 +54,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
54
54
  },
55
55
  emits: ["change"],
56
56
  setup(__props, {
57
+ expose,
57
58
  emit
58
59
  }) {
59
60
  const props = __props;
@@ -76,25 +77,22 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
76
77
  const denominatorValueStatus = ref("success");
77
78
  const keyboardRef = ref(null);
78
79
  const inputRef = ref(null);
80
+ let draggableInstance = null;
79
81
  const style = init();
80
82
  function init() {
81
83
  if (props.defaultValue) {
82
84
  inputValue.value = props.defaultValue.toString();
83
85
  }
84
86
  if (props.drag) {
85
- const {
86
- x,
87
- y,
88
- style: style2
89
- } = useDraggable(keyboardRef, {
87
+ draggableInstance = useDraggable(keyboardRef, {
90
88
  initialValue: props.positionInitialValue,
91
- onMove: (position, event) => {
89
+ onMove: (position) => {
92
90
  var _a, _b, _c, _d;
93
91
  position.x += (_b = (_a = props.moveOffset) == null ? void 0 : _a.x) != null ? _b : 0;
94
92
  position.y += (_d = (_c = props.moveOffset) == null ? void 0 : _c.y) != null ? _d : 0;
95
93
  }
96
94
  });
97
- return style2;
95
+ return draggableInstance.style;
98
96
  }
99
97
  }
100
98
  async function setFocus() {
@@ -211,6 +209,28 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
211
209
  function setInputValueStatus() {
212
210
  inputValueStatus.value = !inputValue.value ? "error" : "success";
213
211
  }
212
+ function setPosition(position) {
213
+ if (draggableInstance) {
214
+ draggableInstance.x.value = position.x;
215
+ draggableInstance.y.value = position.y;
216
+ }
217
+ }
218
+ function getPosition() {
219
+ if (draggableInstance) {
220
+ return {
221
+ x: draggableInstance.x.value,
222
+ y: draggableInstance.y.value
223
+ };
224
+ }
225
+ return {
226
+ x: 0,
227
+ y: 0
228
+ };
229
+ }
230
+ expose({
231
+ setPosition,
232
+ getPosition
233
+ });
214
234
  watch(() => props.value, (value) => inputValue.value = (value || "").toString(), {
215
235
  immediate: true
216
236
  });
@@ -0,0 +1,17 @@
1
+ import type { Position } from '@vueuse/core';
2
+ export interface KeyboardInstance {
3
+ /**
4
+ * 选择输入内容
5
+ */
6
+ select: () => void;
7
+ /**
8
+ * 手动设置键盘位置
9
+ * @param position 目标位置 { x: number, y: number }
10
+ */
11
+ setPosition: (position: Position) => void;
12
+ /**
13
+ * 获取当前键盘位置
14
+ * @returns 当前位置 { x: number, y: number }
15
+ */
16
+ getPosition: () => Position;
17
+ }
@@ -1,5 +1,5 @@
1
1
  var name = "@cnhis-design-vue/shared";
2
- var version = "3.3.3-beta.56";
2
+ var version = "3.3.3-beta.58";
3
3
  var main = "index.ts";
4
4
  var peerDependencies = {
5
5
  "naive-ui": "^2.30.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.3.3-beta.56",
3
+ "version": "3.3.3-beta.58",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -74,5 +74,5 @@
74
74
  "iOS 7",
75
75
  "last 3 iOS versions"
76
76
  ],
77
- "gitHead": "baeb1685eb4f0f551b51d1669b3c11b50862d8f6"
77
+ "gitHead": "d8756c9927608bbe0e59f0e2ed4c2d5790119bb1"
78
78
  }