sykj 0.1.1 → 0.1.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.
package/README.md CHANGED
@@ -41,19 +41,6 @@ app.mount("#app");
41
41
  <SyKeyboard />
42
42
  </div>
43
43
  </template>
44
-
45
- <script setup>
46
- import { SyKeyboard } from "sykj";
47
- </script>
48
-
49
- <style lang="scss" scoped>
50
- .app {
51
- height: 100vh;
52
- display: flex;
53
- justify-content: center;
54
- align-items: center;
55
- }
56
- </style>
57
44
  ```
58
45
 
59
46
  ```vue
package/lib/common.ts CHANGED
@@ -1,9 +1,9 @@
1
- import "/lib/store";
1
+ import "./store";
2
2
 
3
- import "/lib/focus";
3
+ import "./focus";
4
4
 
5
- import SyKeyboard from "/packages/keyboard/index.ts"; // 引入封装好的组件
6
- import SyLoading from "/packages/loading/index.ts";
5
+ import SyKeyboard from "../packages/keyboard/index.ts"; // 引入封装好的组件
6
+ import SyLoading from "../packages/loading/index.ts";
7
7
 
8
8
  // export { SyKeyboard as default };
9
9
  // export { SyLoading };
package/lib/focus.ts CHANGED
@@ -7,18 +7,10 @@ let st = null;
7
7
  document.addEventListener("focusin", (event) => {
8
8
  const target = event.target as HTMLElement;
9
9
  if (target?.tagName === "INPUT" || target?.tagName === "TEXTAREA") {
10
- console.log(
11
- "🚀 ~ file: focus.js:15 ~ document.addEventListener ~ event.target:",
12
- event.target
13
- );
14
-
10
+ if (!isEditableFormComponent(event.target)) return;
15
11
  clearTimeout(st);
16
12
  globalKey.open();
17
13
  globalKey.currentElement = event.target;
18
- console.log(
19
- "🚀 ~ file: focus.ts:18 ~ document.addEventListener ~ globalKey:",
20
- globalKey
21
- );
22
14
  }
23
15
  });
24
16
  document.addEventListener("focusout", (event) => {
@@ -30,6 +22,20 @@ document.addEventListener("focusout", (event) => {
30
22
  if (target?.tagName === "INPUT" || target?.tagName === "TEXTAREA") {
31
23
  // window.showKeyboard()
32
24
  //
33
- console.log(2);
34
25
  }
35
26
  });
27
+
28
+ // 是否展示输入法
29
+ const isEditableFormComponent = (el: EventTarget): Boolean => {
30
+ const notType = ["checkbox"];
31
+
32
+ if (
33
+ el instanceof HTMLInputElement &&
34
+ el.readOnly &&
35
+ !notType.includes(el.type)
36
+ ) {
37
+ return false;
38
+ } else {
39
+ return true;
40
+ }
41
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sykj",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "rem adaptation🚀",
5
5
  "main": "lib/common.ts",
6
6
  "files": [