@fangzhongya/fang-ui 0.1.56 → 0.1.57

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.
@@ -23,19 +23,19 @@
23
23
  }
24
24
 
25
25
  .edit {
26
- display: inline-flex;
26
+ display: inline-block;
27
27
  align-items: center;
28
+ height: 100%;
28
29
  }
29
30
  .edit-value {
30
31
  display: inline-block;
32
+ height: 100%;
31
33
  min-width: 3px;
32
34
  }
33
35
  .edit-icon {
34
- display: inline-flex;
35
- align-items: center;
36
+ box-sizing: border-box;
36
37
  height: 100%;
37
- min-width: 3px;
38
38
  font-size: 16px;
39
- margin: 0 4px;
39
+ margin: 2px;
40
40
  cursor: pointer;
41
41
  }
@@ -2,19 +2,19 @@
2
2
 
3
3
  $edit: 'edit';
4
4
  @include b($edit) {
5
- display: inline-flex;
5
+ display: inline-block;
6
6
  align-items: center;
7
+ height: 100%;
7
8
  &-value {
8
9
  display: inline-block;
10
+ height: 100%;
9
11
  min-width: 3px;
10
12
  }
11
13
  &-icon {
12
- display: inline-flex;
13
- align-items: center;
14
+ box-sizing: border-box;
14
15
  height: 100%;
15
- min-width: 3px;
16
16
  font-size: 16px;
17
- margin: 0 4px;
17
+ margin: 2px;
18
18
  cursor: pointer;
19
19
  }
20
20
  }
@@ -15,12 +15,13 @@ const dataProps = {
15
15
  },
16
16
  textarea: Boolean,
17
17
  /**
18
- * @props { Boolean } noEmpty= ( )
18
+ * @props { Boolean } isEmpty= ( )
19
19
  * 不能为空
20
20
  */
21
21
  isEmpty: {
22
22
  type: Boolean
23
- }
23
+ },
24
+ type: { type: String, default: "icon" }
24
25
  };
25
26
  const dataEmits = ["update:modelValue"];
26
27
  const dataSlot = {
@@ -17,12 +17,16 @@ export declare const dataProps: {
17
17
  };
18
18
  textarea: BooleanConstructor;
19
19
  /**
20
- * @props { Boolean } noEmpty= ( )
20
+ * @props { Boolean } isEmpty= ( )
21
21
  * 不能为空
22
22
  */
23
23
  isEmpty: {
24
24
  type: BooleanConstructor;
25
25
  };
26
+ type: {
27
+ type: () => "icon" | "input";
28
+ default: string;
29
+ };
26
30
  };
27
31
  export type DataProps = ExtractPropTypes<typeof dataProps>;
28
32
  /**
@@ -13,12 +13,13 @@ const dataProps = {
13
13
  },
14
14
  textarea: Boolean,
15
15
  /**
16
- * @props { Boolean } noEmpty= ( )
16
+ * @props { Boolean } isEmpty= ( )
17
17
  * 不能为空
18
18
  */
19
19
  isEmpty: {
20
20
  type: Boolean
21
- }
21
+ },
22
+ type: { type: String, default: "icon" }
22
23
  };
23
24
  const dataEmits = ["update:modelValue"];
24
25
  const dataSlot = {
@@ -20,11 +20,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
20
20
  const isInput = vue.ref(false);
21
21
  const isIcon = vue.ref(false);
22
22
  const refEditInput = vue.ref();
23
- const refEdit = vue.ref();
23
+ const refDom = vue.ref();
24
24
  const width = vue.ref("");
25
- const display = vue.ref("");
26
25
  const getWidth = () => {
27
- const dom = refEdit.value;
26
+ const dom = refDom.value;
28
27
  if (dom) {
29
28
  width.value = (dom.clientWidth || dom.offsetWidth) + 40 + "px";
30
29
  }
@@ -49,13 +48,19 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
49
48
  }
50
49
  function onBlur() {
51
50
  setIsIcon();
52
- isInput.value = false;
53
51
  }
54
52
  function setIsIcon() {
55
- if (!value.value && props.isEmpty) {
56
- isIcon.value = true;
53
+ if (!value.value && !props.isEmpty) {
54
+ if (props.type == "input") {
55
+ isInput.value = true;
56
+ isIcon.value = false;
57
+ } else {
58
+ isInput.value = false;
59
+ isIcon.value = true;
60
+ }
57
61
  } else {
58
62
  isIcon.value = false;
63
+ isInput.value = false;
59
64
  }
60
65
  }
61
66
  function onClick() {
@@ -65,17 +70,18 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
65
70
  refEditInput.value.focus();
66
71
  });
67
72
  }
68
- vue.onMounted(() => {
69
- let dom = refEdit.value;
70
- dom.onmouseenter = (event) => {
73
+ const onmouseenter = (event) => {
74
+ if (props.type == "input") {
75
+ isInput.value = true;
76
+ } else {
71
77
  isIcon.value = true;
72
- getWidth();
73
- };
74
- dom.onmouseleave = (event) => {
75
- setIsIcon();
76
- isInput.value = false;
77
- };
78
- display.value = dom.style.display || "inline";
78
+ }
79
+ getWidth();
80
+ };
81
+ const onmouseleave = (event) => {
82
+ setIsIcon();
83
+ };
84
+ vue.onMounted(() => {
79
85
  getWidth();
80
86
  });
81
87
  __expose({
@@ -83,13 +89,15 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
83
89
  });
84
90
  return (_ctx, _cache) => {
85
91
  return vue.openBlock(), vue.createElementBlock("span", {
86
- ref_key: "refEdit",
87
- ref: refEdit,
92
+ onMouseenter: onmouseenter,
93
+ onMouseleave: onmouseleave,
94
+ ref_key: "refDom",
95
+ ref: refDom,
88
96
  class: vue.normalizeClass(vue.unref(cs).z())
89
97
  }, [
90
98
  isInput.value ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.Inputs), {
91
99
  key: 0,
92
- style: vue.normalizeStyle({ width: width.value, display: display.value }),
100
+ style: vue.normalizeStyle({ width: width.value }),
93
101
  modelValue: value.value,
94
102
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
95
103
  ref_key: "refEditInput",
@@ -103,7 +111,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
103
111
  onDblclick: vue.withModifiers(onDblclick, ["stop"]),
104
112
  class: vue.normalizeClass(vue.unref(cs).z("value"))
105
113
  }, vue.toDisplayString(value.value), 35)),
106
- isIcon.value && !isInput.value ? (vue.openBlock(), vue.createBlock(vue.unref(index$3.Icon), {
114
+ vue.unref(props).type == "icon" && isIcon.value && !isInput.value ? (vue.openBlock(), vue.createBlock(vue.unref(index$3.Icon), {
107
115
  key: 2,
108
116
  onClick,
109
117
  class: vue.normalizeClass(vue.unref(cs).z("icon"))
@@ -113,7 +121,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
113
121
  ]),
114
122
  _: 1
115
123
  }, 8, ["class"])) : vue.createCommentVNode("", true)
116
- ], 2);
124
+ ], 34);
117
125
  };
118
126
  }
119
127
  });
@@ -18,11 +18,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
18
18
  const isInput = ref(false);
19
19
  const isIcon = ref(false);
20
20
  const refEditInput = ref();
21
- const refEdit = ref();
21
+ const refDom = ref();
22
22
  const width = ref("");
23
- const display = ref("");
24
23
  const getWidth = () => {
25
- const dom = refEdit.value;
24
+ const dom = refDom.value;
26
25
  if (dom) {
27
26
  width.value = (dom.clientWidth || dom.offsetWidth) + 40 + "px";
28
27
  }
@@ -47,13 +46,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
47
46
  }
48
47
  function onBlur() {
49
48
  setIsIcon();
50
- isInput.value = false;
51
49
  }
52
50
  function setIsIcon() {
53
- if (!value.value && props.isEmpty) {
54
- isIcon.value = true;
51
+ if (!value.value && !props.isEmpty) {
52
+ if (props.type == "input") {
53
+ isInput.value = true;
54
+ isIcon.value = false;
55
+ } else {
56
+ isInput.value = false;
57
+ isIcon.value = true;
58
+ }
55
59
  } else {
56
60
  isIcon.value = false;
61
+ isInput.value = false;
57
62
  }
58
63
  }
59
64
  function onClick() {
@@ -63,17 +68,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
63
68
  refEditInput.value.focus();
64
69
  });
65
70
  }
66
- onMounted(() => {
67
- let dom = refEdit.value;
68
- dom.onmouseenter = (event) => {
71
+ const onmouseenter = (event) => {
72
+ if (props.type == "input") {
73
+ isInput.value = true;
74
+ } else {
69
75
  isIcon.value = true;
70
- getWidth();
71
- };
72
- dom.onmouseleave = (event) => {
73
- setIsIcon();
74
- isInput.value = false;
75
- };
76
- display.value = dom.style.display || "inline";
76
+ }
77
+ getWidth();
78
+ };
79
+ const onmouseleave = (event) => {
80
+ setIsIcon();
81
+ };
82
+ onMounted(() => {
77
83
  getWidth();
78
84
  });
79
85
  __expose({
@@ -81,13 +87,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
81
87
  });
82
88
  return (_ctx, _cache) => {
83
89
  return openBlock(), createElementBlock("span", {
84
- ref_key: "refEdit",
85
- ref: refEdit,
90
+ onMouseenter: onmouseenter,
91
+ onMouseleave: onmouseleave,
92
+ ref_key: "refDom",
93
+ ref: refDom,
86
94
  class: normalizeClass(unref(cs).z())
87
95
  }, [
88
96
  isInput.value ? (openBlock(), createBlock(unref(Inputs), {
89
97
  key: 0,
90
- style: normalizeStyle({ width: width.value, display: display.value }),
98
+ style: normalizeStyle({ width: width.value }),
91
99
  modelValue: value.value,
92
100
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
93
101
  ref_key: "refEditInput",
@@ -101,7 +109,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
101
109
  onDblclick: withModifiers(onDblclick, ["stop"]),
102
110
  class: normalizeClass(unref(cs).z("value"))
103
111
  }, toDisplayString(value.value), 35)),
104
- isIcon.value && !isInput.value ? (openBlock(), createBlock(unref(Icon), {
112
+ unref(props).type == "icon" && isIcon.value && !isInput.value ? (openBlock(), createBlock(unref(Icon), {
105
113
  key: 2,
106
114
  onClick,
107
115
  class: normalizeClass(unref(cs).z("icon"))
@@ -111,7 +119,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
111
119
  ]),
112
120
  _: 1
113
121
  }, 8, ["class"])) : createCommentVNode("", true)
114
- ], 2);
122
+ ], 34);
115
123
  };
116
124
  }
117
125
  });
package/dist/css/edit.css CHANGED
@@ -23,19 +23,19 @@
23
23
  }
24
24
 
25
25
  .edit {
26
- display: inline-flex;
26
+ display: inline-block;
27
27
  align-items: center;
28
+ height: 100%;
28
29
  }
29
30
  .edit-value {
30
31
  display: inline-block;
32
+ height: 100%;
31
33
  min-width: 3px;
32
34
  }
33
35
  .edit-icon {
34
- display: inline-flex;
35
- align-items: center;
36
+ box-sizing: border-box;
36
37
  height: 100%;
37
- min-width: 3px;
38
38
  font-size: 16px;
39
- margin: 0 4px;
39
+ margin: 2px;
40
40
  cursor: pointer;
41
41
  }
@@ -1714,20 +1714,20 @@
1714
1714
  }
1715
1715
 
1716
1716
  .edit {
1717
- display: inline-flex;
1717
+ display: inline-block;
1718
1718
  align-items: center;
1719
+ height: 100%;
1719
1720
  }
1720
1721
  .edit-value {
1721
1722
  display: inline-block;
1723
+ height: 100%;
1722
1724
  min-width: 3px;
1723
1725
  }
1724
1726
  .edit-icon {
1725
- display: inline-flex;
1726
- align-items: center;
1727
+ box-sizing: border-box;
1727
1728
  height: 100%;
1728
- min-width: 3px;
1729
1729
  font-size: 16px;
1730
- margin: 0 4px;
1730
+ margin: 2px;
1731
1731
  cursor: pointer;
1732
1732
  }
1733
1733
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "prefix": "fang-ui",
3
3
  "info": {},
4
- "lastModified": 1767875434807,
4
+ "lastModified": 1768200877984,
5
5
  "icons": {
6
6
  "bar": {
7
7
  "body": " <path fill=\"currentColor\" d=\"M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z\" ></path> "
package/dist/index.css CHANGED
@@ -1714,20 +1714,20 @@
1714
1714
  }
1715
1715
 
1716
1716
  .edit {
1717
- display: inline-flex;
1717
+ display: inline-block;
1718
1718
  align-items: center;
1719
+ height: 100%;
1719
1720
  }
1720
1721
  .edit-value {
1721
1722
  display: inline-block;
1723
+ height: 100%;
1722
1724
  min-width: 3px;
1723
1725
  }
1724
1726
  .edit-icon {
1725
- display: inline-flex;
1726
- align-items: center;
1727
+ box-sizing: border-box;
1727
1728
  height: 100%;
1728
- min-width: 3px;
1729
1729
  font-size: 16px;
1730
- margin: 0 4px;
1730
+ margin: 2px;
1731
1731
  cursor: pointer;
1732
1732
  }
1733
1733
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/fang-ui",
3
3
  "private": false,
4
- "version": "0.1.56",
4
+ "version": "0.1.57",
5
5
  "type": "module",
6
6
  "description ": "fang-ui",
7
7
  "keywords": [
@@ -50,14 +50,14 @@
50
50
  "vue": "^3.5.26",
51
51
  "vue-tsc": "^3.2.2",
52
52
  "vxe-table": "4.6.20",
53
- "@fang-ui/hooks": "0.0.1-0",
54
- "@fang-ui/directives": "0.0.1-0",
55
53
  "@fang-ui/components": "0.0.1-0",
56
- "@fang-ui/locale": "0.0.1-0",
54
+ "@fang-ui/directives": "0.0.1-0",
55
+ "@fang-ui/hooks": "0.0.1-0",
57
56
  "@fang-ui/icons": "0.0.1-0",
57
+ "@fang-ui/locale": "0.0.1-0",
58
58
  "@fang-ui/theme": "0.0.1-0",
59
- "@fang-ui/types": "0.0.1-0",
60
- "@fang-ui/utils": "0.0.1-0"
59
+ "@fang-ui/utils": "0.0.1-0",
60
+ "@fang-ui/types": "0.0.1-0"
61
61
  },
62
62
  "main": "./dist/index.cjs",
63
63
  "module": "./dist/index.js",
File without changes
File without changes
File without changes