cnhis-design-vue 3.3.3-beta.57 → 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.
- package/README.md +87 -87
- package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
- package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
- package/es/components/index.d.ts +1 -0
- package/es/components/keyboard/index.d.ts +8 -0
- package/es/components/keyboard/src/Keyboard.vue.d.ts +8 -0
- package/es/components/keyboard/src/Keyboard.vue2.js +33 -9
- package/es/components/keyboard/src/components/NumberPanel.vue.d.ts +3 -0
- package/es/components/keyboard/src/components/NumberPanel.vue2.js +27 -7
- package/es/components/keyboard/src/types.d.ts +17 -0
- package/es/components/keyboard/src/types.js +1 -0
- package/es/env.d.ts +25 -25
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
@@ -1,87 +1,87 @@
|
|
1
|
-
# 安装
|
2
|
-
|
3
|
-
```shell
|
4
|
-
npm i cnhis-design-vue@[版本号]
|
5
|
-
# or
|
6
|
-
yarn add cnhis-design-vue@[版本号] #推荐
|
7
|
-
```
|
8
|
-
|
9
|
-
## 1.全局引入
|
10
|
-
|
11
|
-
```typescript
|
12
|
-
// main.ts
|
13
|
-
import { createApp } from 'vue';
|
14
|
-
import App from './App.vue';
|
15
|
-
import 'cnhis-design-vue/es/packages/index.css';
|
16
|
-
import cui from 'cnhis-design-vue';
|
17
|
-
|
18
|
-
const app = createApp(App);
|
19
|
-
app.use(cui).mount('#app');
|
20
|
-
```
|
21
|
-
|
22
|
-
## 2. 按需引入
|
23
|
-
|
24
|
-
组件现在支持了自动按需引入, 但是样式文件需要额外的处理
|
25
|
-
|
26
|
-
### 2.1 样式处理方式1 (按需引入样式)
|
27
|
-
|
28
|
-
```shell
|
29
|
-
# 安装自动导入样式的插件
|
30
|
-
npm i -d vite-plugin-style-import
|
31
|
-
```
|
32
|
-
|
33
|
-
```typescript
|
34
|
-
// vite.config.ts
|
35
|
-
import { defineConfig } from 'vite';
|
36
|
-
import { createStyleImportPlugin } from 'vite-plugin-style-import';
|
37
|
-
|
38
|
-
export default defineConfig({
|
39
|
-
plugins: [
|
40
|
-
// ...otherPlugins
|
41
|
-
createStyleImportPlugin({
|
42
|
-
libs: [
|
43
|
-
{
|
44
|
-
libraryName: 'cnhis-design-vue',
|
45
|
-
esModule: true,
|
46
|
-
ensureStyleFile: true,
|
47
|
-
resolveStyle: name => {
|
48
|
-
return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
]
|
52
|
-
})
|
53
|
-
]
|
54
|
-
});
|
55
|
-
```
|
56
|
-
|
57
|
-
### 2.2 样式处理方式2 (全局引入样式)
|
58
|
-
|
59
|
-
```typescript
|
60
|
-
// main.ts
|
61
|
-
import 'cnhis-design-vue/es/components/index.css';
|
62
|
-
```
|
63
|
-
|
64
|
-
## 3.FAQ
|
65
|
-
|
66
|
-
### 3.1 项目打包后样式丢失
|
67
|
-
|
68
|
-
处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
|
69
|
-
|
70
|
-
```typescript
|
71
|
-
// vite.config.ts
|
72
|
-
import { defineConfig } from 'vite';
|
73
|
-
|
74
|
-
export default defineConfig({
|
75
|
-
build: {
|
76
|
-
rollupOptions: {
|
77
|
-
// ..otherOptions
|
78
|
-
output: {
|
79
|
-
dir: './dist',
|
80
|
-
manualChunks: {
|
81
|
-
'cnhis-vendor': ['cnhis-design-vue']
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}
|
85
|
-
}
|
86
|
-
});
|
87
|
-
```
|
1
|
+
# 安装
|
2
|
+
|
3
|
+
```shell
|
4
|
+
npm i cnhis-design-vue@[版本号]
|
5
|
+
# or
|
6
|
+
yarn add cnhis-design-vue@[版本号] #推荐
|
7
|
+
```
|
8
|
+
|
9
|
+
## 1.全局引入
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
// main.ts
|
13
|
+
import { createApp } from 'vue';
|
14
|
+
import App from './App.vue';
|
15
|
+
import 'cnhis-design-vue/es/packages/index.css';
|
16
|
+
import cui from 'cnhis-design-vue';
|
17
|
+
|
18
|
+
const app = createApp(App);
|
19
|
+
app.use(cui).mount('#app');
|
20
|
+
```
|
21
|
+
|
22
|
+
## 2. 按需引入
|
23
|
+
|
24
|
+
组件现在支持了自动按需引入, 但是样式文件需要额外的处理
|
25
|
+
|
26
|
+
### 2.1 样式处理方式1 (按需引入样式)
|
27
|
+
|
28
|
+
```shell
|
29
|
+
# 安装自动导入样式的插件
|
30
|
+
npm i -d vite-plugin-style-import
|
31
|
+
```
|
32
|
+
|
33
|
+
```typescript
|
34
|
+
// vite.config.ts
|
35
|
+
import { defineConfig } from 'vite';
|
36
|
+
import { createStyleImportPlugin } from 'vite-plugin-style-import';
|
37
|
+
|
38
|
+
export default defineConfig({
|
39
|
+
plugins: [
|
40
|
+
// ...otherPlugins
|
41
|
+
createStyleImportPlugin({
|
42
|
+
libs: [
|
43
|
+
{
|
44
|
+
libraryName: 'cnhis-design-vue',
|
45
|
+
esModule: true,
|
46
|
+
ensureStyleFile: true,
|
47
|
+
resolveStyle: name => {
|
48
|
+
return `cnhis-design-vue/es/components/${ name.slice(2) }/style/index.css`;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
]
|
52
|
+
})
|
53
|
+
]
|
54
|
+
});
|
55
|
+
```
|
56
|
+
|
57
|
+
### 2.2 样式处理方式2 (全局引入样式)
|
58
|
+
|
59
|
+
```typescript
|
60
|
+
// main.ts
|
61
|
+
import 'cnhis-design-vue/es/components/index.css';
|
62
|
+
```
|
63
|
+
|
64
|
+
## 3.FAQ
|
65
|
+
|
66
|
+
### 3.1 项目打包后样式丢失
|
67
|
+
|
68
|
+
处理方法, 将 cnhis-design-vue 从 vendor 包中移除 (没有出现此问题则不需要)
|
69
|
+
|
70
|
+
```typescript
|
71
|
+
// vite.config.ts
|
72
|
+
import { defineConfig } from 'vite';
|
73
|
+
|
74
|
+
export default defineConfig({
|
75
|
+
build: {
|
76
|
+
rollupOptions: {
|
77
|
+
// ..otherOptions
|
78
|
+
output: {
|
79
|
+
dir: './dist',
|
80
|
+
manualChunks: {
|
81
|
+
'cnhis-vendor': ['cnhis-design-vue']
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
});
|
87
|
+
```
|
@@ -603,7 +603,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
603
603
|
}, {
|
604
604
|
default: withCtx(() => [!unref(isAudioOrVideoMessage)(item.content) ? (openBlock(), createElementBlock(Fragment, {
|
605
605
|
key: 0
|
606
|
-
}, [createCommentVNode(' <n-button\n quaternary\n size="tiny"\n @click="(event: MouseEvent) => handleSelectLabel(event, item.id)"\n >\n <template #icon>\n <n-icon size="17" :component="HappyOutline" />\n </template>\n </n-button> '), createVNode(unref(NButton), {
|
606
|
+
}, [createCommentVNode(' <n-button\r\n quaternary\r\n size="tiny"\r\n @click="(event: MouseEvent) => handleSelectLabel(event, item.id)"\r\n >\r\n <template #icon>\r\n <n-icon size="17" :component="HappyOutline" />\r\n </template>\r\n </n-button> '), createVNode(unref(NButton), {
|
607
607
|
quaternary: "",
|
608
608
|
size: "tiny",
|
609
609
|
onClick: () => setReferenceMsg(item)
|
@@ -225,7 +225,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
225
225
|
round: "",
|
226
226
|
size: 100,
|
227
227
|
onClickCapture: _cache[0] || (_cache[0] = ($event) => showLargeAvatar.value = true)
|
228
|
-
}, null, 8, ["src"]), createCommentVNode(' <n-upload abstract accept="image/*" @change="onChange">\n <n-upload-trigger #="{ handleClick }" abstract>\n <n-button\n circle\n secondary\n class="edit-avatar"\n v-show="userDetail.id === state.userInfo.id"\n @click="handleClick"\n >\n <template #icon>\n <n-icon size="16" color="#666666" :component="Camera" />\n </template>\n </n-button>\n </n-upload-trigger>\n </n-upload> '), createElementVNode("div", _hoisted_4, [createElementVNode("h4", null, [createElementVNode("label", _hoisted_5, toDisplayString(userDetail.name), 1), withDirectives(createElementVNode("label", {
|
228
|
+
}, null, 8, ["src"]), createCommentVNode(' <n-upload abstract accept="image/*" @change="onChange">\r\n <n-upload-trigger #="{ handleClick }" abstract>\r\n <n-button\r\n circle\r\n secondary\r\n class="edit-avatar"\r\n v-show="userDetail.id === state.userInfo.id"\r\n @click="handleClick"\r\n >\r\n <template #icon>\r\n <n-icon size="16" color="#666666" :component="Camera" />\r\n </template>\r\n </n-button>\r\n </n-upload-trigger>\r\n </n-upload> '), createElementVNode("div", _hoisted_4, [createElementVNode("h4", null, [createElementVNode("label", _hoisted_5, toDisplayString(userDetail.name), 1), withDirectives(createElementVNode("label", {
|
229
229
|
class: normalizeClass(["iho-chatRole", unref(isDoctorRole)(userDetail.roleInfo) ? "isDoctor" : ""])
|
230
230
|
}, toDisplayString(unref(getRoleName)(userDetail.roleInfo)), 3), [[vShow, unref(getRoleName)(userDetail.roleInfo)]])]), createElementVNode("p", null, toDisplayString(userDetail.orgName), 1)]), createVNode(unref(NButton), {
|
231
231
|
strong: "",
|
package/es/components/index.d.ts
CHANGED
@@ -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
|
-
|
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
|
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
|
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
|
-
|
86
|
-
x,
|
87
|
-
y,
|
88
|
-
style: style2
|
89
|
-
} = useDraggable(keyboardRef, {
|
87
|
+
draggableInstance = useDraggable(keyboardRef, {
|
90
88
|
initialValue: props.positionInitialValue,
|
91
|
-
onMove: (position
|
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
|
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
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
|
package/es/env.d.ts
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
/// <reference types="vite/client" />
|
2
|
-
|
3
|
-
interface ImportMetaEnv {
|
4
|
-
readonly VITE_APP_TYPE: string;
|
5
|
-
// 更多环境变量...
|
6
|
-
}
|
7
|
-
|
8
|
-
interface ImportMeta {
|
9
|
-
readonly env: ImportMetaEnv;
|
10
|
-
}
|
11
|
-
|
12
|
-
declare module '*.vue' {
|
13
|
-
// @ts-ignore
|
14
|
-
import type { App, defineComponent } from 'vue';
|
15
|
-
// // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
16
|
-
// // const component: DefineComponent<{}, {}, any>
|
17
|
-
const component: ReturnType<typeof defineComponent> & {
|
18
|
-
install(app: App): void;
|
19
|
-
};
|
20
|
-
// @ts-ignore
|
21
|
-
export default component;
|
22
|
-
}
|
23
|
-
|
24
|
-
declare module '*.js';
|
25
|
-
|
1
|
+
/// <reference types="vite/client" />
|
2
|
+
|
3
|
+
interface ImportMetaEnv {
|
4
|
+
readonly VITE_APP_TYPE: string;
|
5
|
+
// 更多环境变量...
|
6
|
+
}
|
7
|
+
|
8
|
+
interface ImportMeta {
|
9
|
+
readonly env: ImportMetaEnv;
|
10
|
+
}
|
11
|
+
|
12
|
+
declare module '*.vue' {
|
13
|
+
// @ts-ignore
|
14
|
+
import type { App, defineComponent } from 'vue';
|
15
|
+
// // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
16
|
+
// // const component: DefineComponent<{}, {}, any>
|
17
|
+
const component: ReturnType<typeof defineComponent> & {
|
18
|
+
install(app: App): void;
|
19
|
+
};
|
20
|
+
// @ts-ignore
|
21
|
+
export default component;
|
22
|
+
}
|
23
|
+
|
24
|
+
declare module '*.js';
|
25
|
+
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cnhis-design-vue",
|
3
|
-
"version": "3.3.3-beta.
|
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": "
|
77
|
+
"gitHead": "d8756c9927608bbe0e59f0e2ed4c2d5790119bb1"
|
78
78
|
}
|