@king-design/intact 3.6.0 → 3.6.1

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.
Files changed (45) hide show
  1. package/components/button/demos/basic.md +0 -1
  2. package/components/copy/index.spec.ts +9 -14
  3. package/components/datepicker/index.spec.ts +55 -28
  4. package/components/datepicker/useValueBase.ts +5 -2
  5. package/components/form/form.ts +4 -0
  6. package/components/form/index.md +2 -1
  7. package/components/form/index.spec.ts +2 -0
  8. package/components/menu/demos/horizontal.md +7 -1
  9. package/components/menu/index.spec.ts +19 -0
  10. package/components/menu/styles.ts +2 -1
  11. package/components/select/index.spec.ts +35 -2
  12. package/components/select/menu.ts +1 -1
  13. package/components/select/useCard.ts +22 -4
  14. package/components/spinner/index.spec.ts +18 -0
  15. package/components/spinner/useValue.ts +2 -1
  16. package/es/components/copy/index.spec.js +14 -31
  17. package/es/components/datepicker/index.spec.js +646 -608
  18. package/es/components/datepicker/useValueBase.js +5 -2
  19. package/es/components/form/form.d.ts +1 -0
  20. package/es/components/form/form.js +7 -0
  21. package/es/components/form/index.spec.js +10 -8
  22. package/es/components/menu/index.spec.js +28 -0
  23. package/es/components/menu/styles.js +2 -2
  24. package/es/components/select/index.spec.js +231 -177
  25. package/es/components/select/menu.js +1 -1
  26. package/es/components/select/useCard.d.ts +4 -3
  27. package/es/components/select/useCard.js +15 -4
  28. package/es/components/spinner/index.spec.js +82 -44
  29. package/es/components/spinner/useValue.js +2 -1
  30. package/es/index.d.ts +2 -2
  31. package/es/index.js +2 -2
  32. package/es/site/data/components/button/demos/basic/react.js +0 -2
  33. package/es/site/data/components/menu/demos/horizontal/react.js +5 -1
  34. package/es/test/demos.js +1 -1
  35. package/index.ts +2 -2
  36. package/package.json +2 -2
  37. package/components/.DS_Store +0 -0
  38. package/components/descriptions/.DS_Store +0 -0
  39. package/components/menu/.DS_Store +0 -0
  40. package/components/menu/demos/.DS_Store +0 -0
  41. package/components/table/.DS_Store +0 -0
  42. package/components/tour/.DS_Store +0 -0
  43. package/components/virtualList/.DS_Store +0 -0
  44. package/components/virtualList/demos/.DS_Store +0 -0
  45. package/styles/.DS_Store +0 -0
@@ -16,7 +16,7 @@ export var SelectMenu = /*#__PURE__*/function (_Component) {
16
16
  }
17
17
  _this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
18
18
  _this.select = inject(SELECT);
19
- _this.card = useCard(_this.select.label.activeIndices);
19
+ _this.card = useCard(_this.select.label.activeIndices, _this.select.input.keywords);
20
20
  _this.searchable = useSearchable();
21
21
  _this.config = useConfigContext();
22
22
  return _this;
@@ -1,8 +1,9 @@
1
1
  import { Children, NonNullableRefObject } from 'intact';
2
- export declare function useCard(defaultActiveIndex: NonNullableRefObject<number[]>): {
3
- process: (children: Children) => {
2
+ import { State } from '../../hooks/useState';
3
+ export declare function useCard(defaultActiveIndex: NonNullableRefObject<number[]>, keywords: State<string>): {
4
+ process: (children: Children, isSearching: boolean) => {
4
5
  labels: Children[] | import("intact").Block<any>[];
5
6
  group: Children[];
6
7
  };
7
- activeIndex: import("../../hooks/useState").State<number>;
8
+ activeIndex: State<number>;
8
9
  };
@@ -2,11 +2,22 @@ import { useInstance } from 'intact';
2
2
  import { eachChildren, isComponentVNode, last } from '../utils';
3
3
  import { EMPTY_OBJ } from 'intact-shared';
4
4
  import { OptionGroup } from './group';
5
- import { useState } from '../../hooks/useState';
6
- export function useCard(defaultActiveIndex) {
7
- var children = useInstance().get('children');
5
+ import { useState, watchState } from '../../hooks/useState';
6
+ export function useCard(defaultActiveIndex, keywords) {
7
+ var instance = useInstance();
8
8
  var activeIndex = useState(last(defaultActiveIndex.value) || 0);
9
- function process(children) {
9
+ watchState(keywords, function (keywords) {
10
+ if (keywords) {
11
+ activeIndex.set(0);
12
+ } else {
13
+ setDefaultActiveIndex();
14
+ }
15
+ });
16
+ instance.select.on('show', setDefaultActiveIndex);
17
+ function setDefaultActiveIndex() {
18
+ activeIndex.set(last(defaultActiveIndex.value) || 0);
19
+ }
20
+ function process(children, isSearching) {
10
21
  var groupLabels = [];
11
22
  var _children = [];
12
23
  var index = 0;
@@ -321,100 +321,138 @@ describe('Spinner', function () {
321
321
  }
322
322
  }, _callee6);
323
323
  })));
324
- it('dynamic step', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
325
- var _mount8, instance, element, btns, test, _test;
326
- return _regeneratorRuntime.wrap(function _callee8$(_context11) {
327
- while (1) switch (_context11.prev = _context11.next) {
324
+ it('forceStep without min value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
325
+ var Demo, _mount8, instance, element;
326
+ return _regeneratorRuntime.wrap(function _callee7$(_context10) {
327
+ while (1) switch (_context10.prev = _context10.next) {
328
328
  case 0:
329
- _test = function _test3() {
330
- _test = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(index) {
329
+ Demo = /*#__PURE__*/function (_Component3) {
330
+ _inheritsLoose(Demo, _Component3);
331
+ function Demo() {
331
332
  var _context9;
332
- var _ref8, prev, next, model;
333
- return _regeneratorRuntime.wrap(function _callee7$(_context10) {
334
- while (1) switch (_context10.prev = _context10.next) {
333
+ var _this3;
334
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
335
+ args[_key3] = arguments[_key3];
336
+ }
337
+ _this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context9 = [this]).call(_context9, args)) || this;
338
+ _this3.Spinner = Spinner;
339
+ return _this3;
340
+ }
341
+ Demo.defaults = function defaults() {
342
+ return {
343
+ value: 1
344
+ };
345
+ };
346
+ return Demo;
347
+ }(Component);
348
+ Demo.template = "const {Spinner} = this;\n <Spinner step={1} v-model=\"value\" forceStep />\n ";
349
+ _mount8 = mount(Demo), instance = _mount8[0], element = _mount8[1];
350
+ expect(instance.get('value')).to.eql(1);
351
+ instance.set('value', -1);
352
+ _context10.next = 7;
353
+ return wait();
354
+ case 7:
355
+ expect(instance.get('value')).to.eql(-1);
356
+ case 8:
357
+ case "end":
358
+ return _context10.stop();
359
+ }
360
+ }, _callee7);
361
+ })));
362
+ it('dynamic step', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
363
+ var _mount9, instance, element, btns, test, _test;
364
+ return _regeneratorRuntime.wrap(function _callee9$(_context13) {
365
+ while (1) switch (_context13.prev = _context13.next) {
366
+ case 0:
367
+ _test = function _test3() {
368
+ _test = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(index) {
369
+ var _context11;
370
+ var _ref9, prev, next, model;
371
+ return _regeneratorRuntime.wrap(function _callee8$(_context12) {
372
+ while (1) switch (_context12.prev = _context12.next) {
335
373
  case 0:
336
- _ref8 = index === 1 ? btns : _sliceInstanceProperty(_context9 = _Array$from(btns)).call(_context9, 2), prev = _ref8[0], next = _ref8[1];
374
+ _ref9 = index === 1 ? btns : _sliceInstanceProperty(_context11 = _Array$from(btns)).call(_context11, 2), prev = _ref9[0], next = _ref9[1];
337
375
  model = "value" + index;
338
376
  prev.click();
339
- _context10.next = 5;
377
+ _context12.next = 5;
340
378
  return wait();
341
379
  case 5:
342
380
  expect(instance.get(model)).to.eql(-1);
343
381
  instance.set(model, -5);
344
- _context10.next = 9;
382
+ _context12.next = 9;
345
383
  return wait();
346
384
  case 9:
347
385
  prev.click();
348
- _context10.next = 12;
386
+ _context12.next = 12;
349
387
  return wait();
350
388
  case 12:
351
389
  expect(instance.get(model)).to.eql(-10);
352
390
  next.click();
353
- _context10.next = 16;
391
+ _context12.next = 16;
354
392
  return wait();
355
393
  case 16:
356
394
  expect(instance.get(model)).to.eql(-5);
357
395
  next.click();
358
- _context10.next = 20;
396
+ _context12.next = 20;
359
397
  return wait();
360
398
  case 20:
361
399
  expect(instance.get(model)).to.eql(-4);
362
400
  instance.set(model, 5);
363
- _context10.next = 24;
401
+ _context12.next = 24;
364
402
  return wait();
365
403
  case 24:
366
404
  next.click();
367
- _context10.next = 27;
405
+ _context12.next = 27;
368
406
  return wait();
369
407
  case 27:
370
408
  expect(instance.get(model)).to.eql(10);
371
409
  prev.click();
372
- _context10.next = 31;
410
+ _context12.next = 31;
373
411
  return wait();
374
412
  case 31:
375
413
  expect(instance.get(model)).to.eql(5);
376
414
  prev.click();
377
- _context10.next = 35;
415
+ _context12.next = 35;
378
416
  return wait();
379
417
  case 35:
380
418
  expect(instance.get(model)).to.eql(4);
381
419
  case 36:
382
420
  case "end":
383
- return _context10.stop();
421
+ return _context12.stop();
384
422
  }
385
- }, _callee7);
423
+ }, _callee8);
386
424
  }));
387
425
  return _test.apply(this, arguments);
388
426
  };
389
427
  test = function _test2(_x) {
390
428
  return _test.apply(this, arguments);
391
429
  };
392
- _mount8 = mount(DynamicStepDemo), instance = _mount8[0], element = _mount8[1];
430
+ _mount9 = mount(DynamicStepDemo), instance = _mount9[0], element = _mount9[1];
393
431
  btns = element.querySelectorAll('.k-btn');
394
- _context11.next = 6;
432
+ _context13.next = 6;
395
433
  return test(1);
396
434
  case 6:
397
435
  case "end":
398
- return _context11.stop();
436
+ return _context13.stop();
399
437
  }
400
- }, _callee8);
438
+ }, _callee9);
401
439
  })));
402
- it('should set correct value with dynamic step when min is not equal 0', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
403
- var Demo, _mount9, instance, element, _element$querySelecto5, prev, next;
404
- return _regeneratorRuntime.wrap(function _callee9$(_context13) {
405
- while (1) switch (_context13.prev = _context13.next) {
440
+ it('should set correct value with dynamic step when min is not equal 0', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
441
+ var Demo, _mount10, instance, element, _element$querySelecto5, prev, next;
442
+ return _regeneratorRuntime.wrap(function _callee10$(_context15) {
443
+ while (1) switch (_context15.prev = _context15.next) {
406
444
  case 0:
407
- Demo = /*#__PURE__*/function (_Component3) {
408
- _inheritsLoose(Demo, _Component3);
445
+ Demo = /*#__PURE__*/function (_Component4) {
446
+ _inheritsLoose(Demo, _Component4);
409
447
  function Demo() {
410
- var _context12;
411
- var _this3;
412
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
413
- args[_key3] = arguments[_key3];
448
+ var _context14;
449
+ var _this4;
450
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
451
+ args[_key4] = arguments[_key4];
414
452
  }
415
- _this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context12 = [this]).call(_context12, args)) || this;
416
- _this3.Spinner = Spinner;
417
- return _this3;
453
+ _this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context14 = [this]).call(_context14, args)) || this;
454
+ _this4.Spinner = Spinner;
455
+ return _this4;
418
456
  }
419
457
  Demo.defaults = function defaults() {
420
458
  return {
@@ -424,27 +462,27 @@ describe('Spinner', function () {
424
462
  return Demo;
425
463
  }(Component);
426
464
  Demo.template = "const {Spinner} = this; <Spinner min={30}\n max={500}\n step={{100: 10, 500: 50}}\n v-model=\"value\"\n forceStep\n />";
427
- _mount9 = mount(Demo), instance = _mount9[0], element = _mount9[1];
465
+ _mount10 = mount(Demo), instance = _mount10[0], element = _mount10[1];
428
466
  _element$querySelecto5 = element.querySelectorAll('.k-btn'), prev = _element$querySelecto5[0], next = _element$querySelecto5[1];
429
467
  next.click();
430
- _context13.next = 7;
468
+ _context15.next = 7;
431
469
  return wait();
432
470
  case 7:
433
471
  expect(instance.get('value')).to.eql(150);
434
472
  prev.click();
435
- _context13.next = 11;
473
+ _context15.next = 11;
436
474
  return wait();
437
475
  case 11:
438
476
  expect(instance.get('value')).to.eql(100);
439
477
  prev.click();
440
- _context13.next = 15;
478
+ _context15.next = 15;
441
479
  return wait();
442
480
  case 15:
443
481
  expect(instance.get('value')).to.eql(90);
444
482
  case 16:
445
483
  case "end":
446
- return _context13.stop();
484
+ return _context15.stop();
447
485
  }
448
- }, _callee9);
486
+ }, _callee10);
449
487
  })));
450
488
  });
@@ -78,7 +78,8 @@ export function minMaxStep(value, min, max, step) {
78
78
  if (value >= max) return max;
79
79
  if (value <= min) return min;
80
80
  if (step) {
81
- value = Number((Math.round((value - min) / step) * step + min).toFixed(10));
81
+ var _min = min === -Infinity ? 0 : min;
82
+ value = Number((Math.round((value - _min) / step) * step + _min).toFixed(10));
82
83
  // value = Number((Math.round(value / step) * step).toFixed(10))
83
84
  return minMaxStep(value, min, max, null);
84
85
  }
package/es/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v3.6.0
2
+ * @king-design v3.6.1
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -66,4 +66,4 @@ export * from './components/upload';
66
66
  export * from './components/view';
67
67
  export * from './components/virtualList';
68
68
  export * from './components/wave';
69
- export declare const version = "3.6.0";
69
+ export declare const version = "3.6.1";
package/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v3.6.0
2
+ * @king-design v3.6.1
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -67,5 +67,5 @@ export * from './components/upload';
67
67
  export * from './components/view';
68
68
  export * from './components/virtualList';
69
69
  export * from './components/wave';
70
- export var version = '3.6.0';
70
+ export var version = '3.6.1';
71
71
  /* generate end */
@@ -29,8 +29,6 @@ var Demo = /*#__PURE__*/function (_React$Component) {
29
29
  color: "red"
30
30
  }, "custom"), /*#__PURE__*/React.createElement(Button, {
31
31
  color: "#0000ea"
32
- }, "custom"), /*#__PURE__*/React.createElement(Button, {
33
- color: "rgb(183, 18, 193)"
34
32
  }, "custom"));
35
33
  };
36
34
  return Demo;
@@ -52,7 +52,11 @@ var Demo = /*#__PURE__*/function (_React$Component) {
52
52
  key: "4"
53
53
  }, /*#__PURE__*/React.createElement(Icon, {
54
54
  className: "ion-gear-b"
55
- }), "menu 4")), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Switch, {
55
+ }), "menu 4", /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(MenuItem, {
56
+ key: "4-1"
57
+ }, "sub menu 1"), /*#__PURE__*/React.createElement(MenuItem, {
58
+ key: "4-2"
59
+ }, "sub menu 2")))), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Switch, {
56
60
  on: "light",
57
61
  off: "dark",
58
62
  value: this.state.theme,
package/es/test/demos.js CHANGED
@@ -2,7 +2,7 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
3
3
  import { mount, testDemos, unmount, nextFrame } from './utils';
4
4
  var req = require.context('~/components/', true, /^((?!(affix|code)).)*\/demos\/.*index\.ts$/);
5
- // const req = require.context('~/components/', true, /upload\/demos\/.*index\.ts$/);
5
+ // const req = require.context('~/components/', true, /button\/demos\/.*index\.ts$/);
6
6
  // const vueReq = require.context('~/components/', true, /^((?!(affix|code)).)*\/demos\/.*index\.vue$/);
7
7
  describe('Demos', function () {
8
8
  afterEach(function () {
package/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v3.6.0
2
+ * @king-design v3.6.1
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -71,6 +71,6 @@ export * from './components/view';
71
71
  export * from './components/virtualList';
72
72
  export * from './components/wave';
73
73
 
74
- export const version = '3.6.0';
74
+ export const version = '3.6.1';
75
75
 
76
76
  /* generate end */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@king-design/intact",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "A component library written in Intact for Intact, Vue, React and Angular",
5
5
  "main": "es/index.js",
6
6
  "engines": {
@@ -180,7 +180,7 @@
180
180
  "@emotion/css": "^11.5.0",
181
181
  "dayjs": "^1.10.7",
182
182
  "enquire.js": "^2.1.6",
183
- "intact": "^3.0.42-beta.1",
183
+ "intact": "^3.0.44",
184
184
  "monaco-editor": "^0.26.1",
185
185
  "mxgraphx": "^4.0.7",
186
186
  "resize-observer-polyfill": "^1.5.1",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/styles/.DS_Store DELETED
Binary file