@taole/dev-helper 0.0.9 → 0.0.11

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/Tdiv/index.js CHANGED
@@ -42,7 +42,7 @@ class Tdiv extends HTMLElement {
42
42
  return [
43
43
  '_class', 'usePx', '_style', 'src', 'width', 'height', 'absolute',
44
44
  'top', 'left', 'right', 'bottom', 'zIndex', 'pointer', 'flex', 'column', 'center',
45
- 'text', 'color', 'srcMode', 'onClick', 'debug', 'viewportWidth', 'viewportUnit'
45
+ 'text', 'color','radius','border','borderColor', 'srcMode', 'onClick', 'debug', 'viewportWidth', 'viewportUnit'
46
46
  ];
47
47
  }
48
48
 
@@ -118,6 +118,9 @@ class Tdiv extends HTMLElement {
118
118
  const center = this._getAttr('center', 'boolean');
119
119
  const text = this._getAttr('text');
120
120
  const color = this._getAttr('color');
121
+ const radius = this._getAttr('radius');
122
+ const border = this._getAttr('border');
123
+ const borderColor = this._getAttr('borderColor');
121
124
  const srcMode = this._getAttr('srcMode') || 'auto';
122
125
  const debug = this._getAttr('debug', 'boolean');
123
126
  const viewportWidth = this._getAttr('viewportWidth', 'number');
@@ -151,6 +154,12 @@ class Tdiv extends HTMLElement {
151
154
  if (hasValue(right)) layoutStyle += `margin-right: ${calc(right, calcOpt)};`;
152
155
  if (hasValue(bottom)) layoutStyle += `margin-bottom: ${calc(bottom, calcOpt)};`;
153
156
  }
157
+ if (hasValue(radius)) layoutStyle += `border-radius: ${calc(radius, calcOpt)};`;
158
+ if (hasValue(border)) {
159
+ layoutStyle += `border: ${calc(border, calcOpt)} solid ${borderColor || "#000"};`;
160
+ } else if (hasValue(borderColor)) {
161
+ layoutStyle += `border-color: ${borderColor};`;
162
+ }
154
163
  if (hasValue(zIndex)) layoutStyle += `z-index: ${zIndex};`;
155
164
  if (pointer === true) {
156
165
  layoutStyle += 'cursor: pointer;';
package/Tdiv/index.svelte CHANGED
@@ -97,6 +97,26 @@
97
97
  * 内部文本的颜色
98
98
  */
99
99
  export let color = "";
100
+
101
+ /**
102
+ * @type {number|string}
103
+ * 圆角大小
104
+ */
105
+ export let radius = null;
106
+
107
+ /**
108
+ * @type {string}
109
+ * 边框宽度
110
+ */
111
+ export let border = null;
112
+
113
+ /**
114
+ * @type {string}
115
+ * 边框颜色
116
+ */
117
+ export let borderColor = null;
118
+
119
+
100
120
  /**
101
121
  * @type {'auto'|'fill'|'cover'|'contain'}
102
122
  * src传入时有效, 图片的填充模式: 默认auto
@@ -208,6 +228,15 @@
208
228
  ret += `margin-bottom: ${calc(bottom)};`;
209
229
  }
210
230
  }
231
+ if(hasValue(radius)){
232
+ ret += `border-radius: ${calc(radius)};`;
233
+ }
234
+ if(hasValue(border)){
235
+ ret += `border: ${calc(border)} solid ${borderColor || "#000"};`;
236
+ } else if(hasValue(borderColor)){
237
+ ret += `border-color: ${borderColor};`;
238
+ }
239
+
211
240
  if (hasValue(zIndex)) {
212
241
  ret += `z-index: ${zIndex};`;
213
242
  }
@@ -278,10 +307,8 @@
278
307
  background-size: 100% auto;
279
308
  flex: none;
280
309
  }
281
- .click-effect {
282
- &:active {
283
- opacity: 0.85;
284
- transform: translateY(1px);
285
- }
310
+ .click-effect:active {
311
+ opacity: 0.85;
312
+ transform: translateY(1px);
286
313
  }
287
314
  </style>
package/Tdiv/index.vue CHANGED
@@ -28,6 +28,9 @@ export default {
28
28
  center: { type: Boolean, default: false },
29
29
  text: { type: [Number, String], default: null },
30
30
  color: { type: String, default: '' },
31
+ radius: { type: [Number, String], default: null },
32
+ border: { type: [Number, String], default: null },
33
+ borderColor: { type: String, default: null },
31
34
  srcMode: { type: String, default: 'auto' },
32
35
  onClick: { type: Function, default: null },
33
36
  debug: { type: Boolean, default: false },
@@ -80,6 +83,12 @@ export default {
80
83
  if (hasValue(this.right)) ret += `margin-right: ${calc(this.right)};`;
81
84
  if (hasValue(this.bottom)) ret += `margin-bottom: ${calc(this.bottom)};`;
82
85
  }
86
+ if (hasValue(this.radius)) ret += `border-radius: ${calc(this.radius)};`;
87
+ if (hasValue(this.border)) {
88
+ ret += `border: ${calc(this.border)} solid ${this.borderColor || "#000"};`;
89
+ } else if(hasValue(this.borderColor)){
90
+ ret += `border-color: ${this.borderColor};`;
91
+ }
83
92
  if (hasValue(this.zIndex)) ret += `z-index: ${this.zIndex};`;
84
93
  if (this.pointer === true) {
85
94
  ret += 'cursor: pointer;';
@@ -134,10 +143,8 @@ export default {
134
143
  flex: none;
135
144
  }
136
145
 
137
- .click-effect {
138
- &:active {
146
+ .click-effect:active {
139
147
  opacity: 0.85;
140
148
  transform: translateY(1px);
141
149
  }
142
- }
143
150
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/dev-helper",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "npx -y rimraf dist && rollup -c",