@varlet/ui 2.4.1 → 2.4.3-alpha.1671108240429

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "2.4.0",
4
+ "version": "2.4.2",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -251,20 +251,25 @@ var _default = (0, _vue.defineComponent)({
251
251
  };
252
252
 
253
253
  var handleInput = e => {
254
+ var target = e.target;
254
255
  var {
255
256
  value
256
- } = e.target;
257
- value = withTrim(value);
257
+ } = target;
258
+ value = withMaxlength(withTrim(value));
259
+ target.value = value;
258
260
  (0, _components.call)(props['onUpdate:modelValue'], value);
259
261
  (0, _components.call)(props.onInput, value, e);
260
262
  validateWithTrigger('onInput');
261
263
  };
262
264
 
263
265
  var handleChange = e => {
266
+ var target = e.target;
264
267
  var {
265
268
  value
266
- } = e.target;
267
- (0, _components.call)(props.onChange, withTrim(value), e);
269
+ } = target;
270
+ value = withMaxlength(withTrim(value));
271
+ target.value = value;
272
+ (0, _components.call)(props.onChange, value, e);
268
273
  validateWithTrigger('onChange');
269
274
  };
270
275
 
@@ -301,6 +306,8 @@ var _default = (0, _vue.defineComponent)({
301
306
 
302
307
  var withTrim = value => props.modelModifiers.trim ? value.trim() : value;
303
308
 
309
+ var withMaxlength = value => props.maxlength ? value.slice(0, (0, _shared.toNumber)(props.maxlength)) : value;
310
+
304
311
  var handleTouchstart = e => {
305
312
  var {
306
313
  disabled,
@@ -1,8 +1,8 @@
1
1
  require('../../styles/common.css')
2
- require('../SnackbarSfc.css')
3
2
  require('../../styles/elevation.css')
4
3
  require('../../loading/loading.css')
5
4
  require('../../button/button.css')
6
5
  require('../../icon/icon.css')
7
6
  require('../snackbar.css')
8
7
  require('../coreSfc.css')
8
+ require('../SnackbarSfc.css')
@@ -17,16 +17,12 @@ var _shared = require("@varlet/shared");
17
17
 
18
18
  var _components = require("../utils/components");
19
19
 
20
+ var _context = require("./context");
21
+
20
22
  var {
21
23
  n,
22
24
  classes
23
25
  } = (0, _components.createNamespace)('space');
24
- var internalSizes = {
25
- mini: [4, 4],
26
- small: [6, 6],
27
- normal: [8, 12],
28
- large: [12, 20]
29
- };
30
26
 
31
27
  var _default = (0, _vue.defineComponent)({
32
28
  name: 'VarSpace',
@@ -36,6 +32,11 @@ var _default = (0, _vue.defineComponent)({
36
32
  var {
37
33
  slots
38
34
  } = _ref;
35
+ var internalSizes = {};
36
+ Object.keys(_context.spacePluginOptions).forEach(key => {
37
+ var size = _context.spacePluginOptions[key];
38
+ internalSizes[key] = (0, _shared.isArray)(size) ? size.map(_elements.toPxNum) : [(0, _elements.toPxNum)(size), (0, _elements.toPxNum)(size)];
39
+ });
39
40
 
40
41
  var getSize = (size, isInternalSize) => {
41
42
  return isInternalSize ? internalSizes[size] : (0, _shared.isArray)(size) ? size.map(_elements.toPxNum) : [(0, _elements.toPxNum)(size), (0, _elements.toPxNum)(size)];
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.spacePluginOptions = exports.mergeSpacePluginOptions = void 0;
5
+ var spacePluginOptions = {
6
+ mini: [4, 4],
7
+ small: [6, 6],
8
+ normal: [8, 12],
9
+ large: [12, 20]
10
+ };
11
+ exports.spacePluginOptions = spacePluginOptions;
12
+
13
+ var mergeSpacePluginOptions = options => {
14
+ Object.assign(spacePluginOptions, options);
15
+ };
16
+
17
+ exports.mergeSpacePluginOptions = mergeSpacePluginOptions;
@@ -5,9 +5,12 @@ exports.default = exports._SpaceComponent = void 0;
5
5
 
6
6
  var _Space = _interopRequireDefault(require("./Space"));
7
7
 
8
+ var _context = require("./context");
9
+
8
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
11
 
10
- _Space.default.install = function (app) {
12
+ _Space.default.install = function (app, spacePluginOptions) {
13
+ (0, _context.mergeSpacePluginOptions)(spacePluginOptions);
11
14
  app.component(_Space.default.name, _Space.default);
12
15
  };
13
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.4.1",
3
+ "version": "2.4.3-alpha.1671108240429",
4
4
  "description": "A material like components library",
5
5
  "module": "es/index.js",
6
6
  "main": "lib/index.js",
@@ -47,8 +47,8 @@
47
47
  "@popperjs/core": "^2.11.6",
48
48
  "dayjs": "^1.10.4",
49
49
  "decimal.js": "^10.2.1",
50
- "@varlet/icons": "2.4.1",
51
- "@varlet/shared": "2.4.1"
50
+ "@varlet/shared": "2.4.3-alpha.1671108240429",
51
+ "@varlet/icons": "2.4.3-alpha.1671108240429"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/jest": "^26.0.15",
@@ -63,8 +63,8 @@
63
63
  "typescript": "^4.4.4",
64
64
  "vue": "3.2.25",
65
65
  "vue-router": "4.0.12",
66
- "@varlet/cli": "2.4.1",
67
- "@varlet/touch-emulator": "2.4.1"
66
+ "@varlet/touch-emulator": "2.4.3-alpha.1671108240429",
67
+ "@varlet/cli": "2.4.3-alpha.1671108240429"
68
68
  },
69
69
  "browserslist": [
70
70
  "Chrome >= 54",
package/types/space.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VarComponent, BasicAttributes } from './varComponent'
2
- import { VNode } from 'vue'
2
+ import { App, VNode } from 'vue'
3
3
 
4
4
  export type SpaceAlign = 'stretch' | 'center' | 'start' | 'end' | 'baseline' | 'initial' | 'inherit'
5
5
 
@@ -11,6 +11,15 @@ export type SpaceInternalSize = 'mini' | 'small' | 'normal' | 'large'
11
11
 
12
12
  export type SpaceSize = SpaceInternalSize | number | string | [number | string, number | string]
13
13
 
14
+ export interface SpacePluginOptions {
15
+ mini?: SpacePluginOptionsSize
16
+ small?: SpacePluginOptionsSize
17
+ normal?: SpacePluginOptionsSize
18
+ large?: SpacePluginOptionsSize
19
+ }
20
+
21
+ export type SpacePluginOptionsSize = number | string | [number | string, number | string]
22
+
14
23
  export interface SpaceProps extends BasicAttributes {
15
24
  align?: SpaceAlign
16
25
  size?: SpaceSize
@@ -21,6 +30,8 @@ export interface SpaceProps extends BasicAttributes {
21
30
  }
22
31
 
23
32
  export class Space extends VarComponent {
33
+ static install(app: App, options: SpacePluginOptions): void
34
+
24
35
  $props: SpaceProps
25
36
 
26
37
  $slots: {