@king-design/intact 3.1.2 → 3.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.
@@ -21,7 +21,7 @@ const classNameObj = {
21
21
 
22
22
  <div class={classNameObj} {...getRestProps(this)}>
23
23
  <div class={`${k}-collapse-title`} ev-click={this.toggle}>
24
- <b:title>{title}</b:title>
24
+ <div class={`${k}-collapse-title-wrapper`}><b:title>{title}</b:title></div>
25
25
  <Icon
26
26
  class={{[`${k}-collapse-arrow`]: true, [`${k}-icon-right`]: true}}
27
27
  hoverable
@@ -7,7 +7,6 @@ import { cache } from '../utils';
7
7
  const defaults = {
8
8
  get transition() { return theme.transition.large },
9
9
  fontSize: '12px',
10
- titleMarginRight: '8px',
11
10
  borderPadding: '0 24px',
12
11
  collBorder: '1px solid #eee',
13
12
  get borderRadius() {
@@ -17,6 +16,7 @@ const defaults = {
17
16
  item: {
18
17
  borderBottom: '1px solid #e5e5e5',
19
18
  titleHeight: '40px',
19
+ titleGap: '8px',
20
20
  }
21
21
  };
22
22
 
@@ -32,9 +32,8 @@ export const makeStyles = cache(function makeStyles(k: string) {
32
32
  font-size: ${collapse.fontSize};
33
33
 
34
34
  &.${k}-left {
35
- .${k}-collapse-arrow {
36
- float: left;
37
- margin-right: ${collapse.titleMarginRight};
35
+ > .${k}-collapse-item > .${k}-collapse-title {
36
+ flex-direction: row-reverse;
38
37
  }
39
38
  }
40
39
 
@@ -58,13 +57,15 @@ export const makeItemStyles = cache(function makeItemStyles(k: string) {
58
57
  cursor: pointer;
59
58
  font-weight: bold;
60
59
  height: ${collapseItem.titleHeight};
61
- line-height: ${collapseItem.titleHeight};
62
60
  transition: color ${collapse.transition};
61
+ display: flex;
62
+ align-items: center;
63
+ gap: ${collapseItem.titleGap};
64
+ .${k}-collapse-title-wrapper {
65
+ flex: 1;
66
+ }
63
67
  .${k}-collapse-arrow {
64
- float: right;
65
68
  transition: transform ${collapse.transition};
66
- line-height: ${collapseItem.titleHeight};
67
- height: ${collapseItem.titleHeight};
68
69
  }
69
70
  }
70
71
 
@@ -337,6 +337,36 @@ describe('Dialog', () => {
337
337
  expect(dialog2.querySelector('.k-dialog-body')!.textContent).to.eql('test');
338
338
  });
339
339
 
340
+ it('should update position when change container', async () => {
341
+ class Demo extends Component<{show: boolean, container: any}> {
342
+ static template = `
343
+ var Dialog = this.Dialog;
344
+ <Dialog value={true} container={this.get('container')} ref="dialog">test</Dialog>
345
+ `;
346
+
347
+ private Dialog = Dialog;
348
+
349
+ static defaults() {
350
+ return {
351
+ container: (parentDom: HTMLElement) => parentDom,
352
+ };
353
+ }
354
+ }
355
+
356
+ const [instance, element] = mount(Demo);
357
+
358
+ await wait();
359
+ instance.set('container', undefined);
360
+ await wait();
361
+ const dialogDom = instance.refs.dialog.dialogRef.value;
362
+ const style = dialogDom.style;
363
+ expect(style.left).not.eql('');
364
+ expect(style.top).not.eql('');
365
+
366
+ // should append to body
367
+ expect(dialogDom.closest('.k-dialog-wrapper').parentElement).to.eql(document.body);
368
+ });
369
+
340
370
  // it('should handle v-if and v-model at the same time correctly in Vue', async () => {
341
371
  // const Test = {
342
372
  // template: `<Dialog v-model="show" v-if="show" ref="dialog">test</Dialog>`,
@@ -8,6 +8,10 @@ export function usePosition(elementRef: RefObject<HTMLDivElement>) {
8
8
 
9
9
  instance.on(SHOW, center);
10
10
  instance.on('afterClose', onAfterLeave);
11
+ instance.watch('container', () => {
12
+ if (!instance.get('value')) return;
13
+ center();
14
+ }, { presented: true, inited: true });
11
15
 
12
16
  function center() {
13
17
  position(elementRef.value!, {
@@ -1,8 +1,7 @@
1
1
  import {useInstance, findDomFromVNode} from 'intact';
2
2
  import type {Dropdown} from './';
3
3
  import {Options, position, Feedback} from '../position';
4
- import {noop} from 'intact-shared';
5
- import {isObject} from 'intact-shared';
4
+ import {noop, isObject, isFunction} from 'intact-shared';
6
5
  import { isEqualObject } from '../utils';
7
6
 
8
7
  export type FeedbackCallback = (feedback: Feedback) => void;
@@ -19,21 +18,32 @@ export function usePosition() {
19
18
 
20
19
  (['of', 'position'] as const).forEach(item => {
21
20
  instance.watch(item, (newValue, oldValue) => {
22
- // return if object is the same
23
21
  if (
22
+ !instance.get('value') ||
23
+ // return if object is the same
24
24
  isObject(newValue) && isObject(oldValue) &&
25
25
  // is not event object
26
26
  !(newValue instanceof Event) &&
27
27
  isEqualObject(newValue, oldValue)
28
- ) {
29
- return;
30
- }
31
- if (instance.get('value')) {
32
- handle(noop);
33
- }
28
+ ) return;
29
+
30
+ handle(noop);
34
31
  }, {presented: true, inited: true});
35
32
  });
36
33
 
34
+ // watch container, it is not commonly used
35
+ instance.watch('container', (newValue, oldValue) => {
36
+ if (
37
+ !instance.get('value') ||
38
+ // return if function is the same. Not rigorous!
39
+ isFunction(newValue) &&
40
+ isFunction(oldValue) &&
41
+ newValue.toString() === oldValue.toString()
42
+ ) return;
43
+
44
+ handle(noop);
45
+ }, { presented: true, inited: true });
46
+
37
47
  // if the dropdown is nested, we must show child after parent has positioned
38
48
  function p(
39
49
  ofElement: HTMLElement | MouseEvent | undefined,
@@ -10,6 +10,8 @@ import {
10
10
  remove,
11
11
  TypeDefs,
12
12
  inject,
13
+ unmount,
14
+ removeVNodeDom,
13
15
  } from 'intact';
14
16
  import {isString} from 'intact-shared';
15
17
  import {DIALOG} from './dialog/constants';
@@ -59,7 +61,9 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
59
61
  const fakeContainer = document.createDocumentFragment();
60
62
 
61
63
  (mountedQueue.priority || mountedQueue).push(() => {
62
- const parentDom = this.$lastInput!.dom!.parentElement!;
64
+ const parentDom = this.$lastInput!.dom!.parentElement;
65
+ // maybe the <!-- portal --> has been removed by react, #938
66
+ if (!parentDom) return;
63
67
  this.initContainer(nextProps.container, parentDom, anchor);
64
68
  this.container!.appendChild(fakeContainer);
65
69
  });
@@ -130,8 +134,13 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
130
134
  }
131
135
 
132
136
  $unmount(vNode: VNodeComponentClass<this>, nextVNode: VNodeComponentClass<this> | null) {
133
- remove(vNode.props!.children as VNode, this.container!, false);
134
- // removeVNodeDom(vNode.props!.children as VNode, this.container!);
137
+ const children = vNode.props!.children as VNode;
138
+ unmount(children, null);
139
+ if (this.container) {
140
+ // maybe the <!-- portal --> has been removed by react, #938
141
+ // remove(children, this.container, false);
142
+ removeVNodeDom(children, this.container);
143
+ }
135
144
  super.$unmount(vNode, nextVNode);
136
145
  }
137
146
 
@@ -142,7 +151,11 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
142
151
  } else {
143
152
  this.container = container(parentDom, anchor);
144
153
  }
154
+ } else {
155
+ // let below logic to set container to default if container does not exist.
156
+ this.container = null;
145
157
  }
158
+
146
159
  if (!this.container) {
147
160
  if (this.$senior instanceof BaseDialog) {
148
161
  // Dialog and Drawer must be inserted into document.body
@@ -2,6 +2,7 @@ import {useInstance} from 'intact';
2
2
  import {Upload, UploadFile} from './';
3
3
  import {_$} from '../../i18n';
4
4
  import {UploadFileStatus} from './useUpload';
5
+ import { isEqualArray } from '../utils';
5
6
 
6
7
  let uid = 0;
7
8
 
@@ -28,8 +29,8 @@ export function useFiles(
28
29
  }
29
30
  }
30
31
 
31
- instance.on(`$receive:files`, (files) => {
32
- if (!files) return;
32
+ instance.on(`$receive:files`, (files, oldFiles) => {
33
+ if (!files || isEqualArray(files, oldFiles)) return;
33
34
  instance.set('files', files.map(normalizeFile));
34
35
  });
35
36
 
@@ -27,7 +27,7 @@ export default function ($props, $blocks, $__proto__) {
27
27
  var classNameObj = (_classNameObj = {}, _classNameObj[k + "-collapse-item"] = true, _classNameObj[makeItemStyles(k)] = true, _classNameObj[className] = className, _classNameObj[k + "-active"] = isActive, _classNameObj[k + "-disabled"] = disabled, _classNameObj);
28
28
  return _$cv('div', _extends({
29
29
  'className': _$cn(classNameObj)
30
- }, getRestProps(this)), [_$ce(2, 'div', [(_$blocks['title'] = function ($super) {
30
+ }, getRestProps(this)), [_$ce(2, 'div', [_$ce(2, 'div', (_$blocks['title'] = function ($super) {
31
31
  return title;
32
32
  }, __$blocks['title'] = function ($super, data) {
33
33
  var block = $blocks['title'];
@@ -37,11 +37,11 @@ export default function ($props, $blocks, $__proto__) {
37
37
  };
38
38
 
39
39
  return block ? block.call($this, callBlock, data) : callBlock();
40
- }, __$blocks['title'](_$no)), _$cc(Icon, {
40
+ }, __$blocks['title'](_$no)), 0, _$cn(k + "-collapse-title-wrapper")), _$cc(Icon, {
41
41
  'className': _$cn((_$cn2 = {}, _$cn2[k + "-collapse-arrow"] = true, _$cn2[k + "-icon-right"] = true, _$cn2)),
42
42
  'hoverable': true,
43
43
  'disabled': disabled
44
- })], 0, _$cn(k + "-collapse-title"), {
44
+ })], 4, _$cn(k + "-collapse-title"), {
45
45
  'ev-click': this.toggle
46
46
  }), _$cc(Transition, _extends({
47
47
  'show': isActive
@@ -9,7 +9,6 @@ var defaults = {
9
9
  },
10
10
 
11
11
  fontSize: '12px',
12
- titleMarginRight: '8px',
13
12
  borderPadding: '0 24px',
14
13
  collBorder: '1px solid #eee',
15
14
 
@@ -19,7 +18,8 @@ var defaults = {
19
18
 
20
19
  item: {
21
20
  borderBottom: '1px solid #e5e5e5',
22
- titleHeight: '40px'
21
+ titleHeight: '40px',
22
+ titleGap: '8px'
23
23
  }
24
24
  };
25
25
  var collapse;
@@ -31,9 +31,9 @@ setDefault(function () {
31
31
  makeItemStyles == null ? void 0 : makeItemStyles.clearCache();
32
32
  });
33
33
  export var makeStyles = cache(function makeStyles(k) {
34
- return /*#__PURE__*/css("font-size:", collapse.fontSize, ";&.", k, "-left{.", k, "-collapse-arrow{float:left;margin-right:", collapse.titleMarginRight, ";}}&.", k, "-border{border-radius:", collapse.borderRadius, ";padding:", collapse.borderPadding, ";border:", collapse.collBorder, ";}");
34
+ return /*#__PURE__*/css("font-size:", collapse.fontSize, ";&.", k, "-left{>.", k, "-collapse-item>.", k, "-collapse-title{flex-direction:row-reverse;}}&.", k, "-border{border-radius:", collapse.borderRadius, ";padding:", collapse.borderPadding, ";border:", collapse.collBorder, ";}");
35
35
  });
36
36
  export var makeItemStyles = cache(function makeItemStyles(k) {
37
37
  var collapseItem = collapse.item;
38
- return /*#__PURE__*/css("border-bottom:", collapseItem.borderBottom, ";&:last-of-type{border-bottom-color:transparent;}>.", k, "-collapse-title{cursor:pointer;font-weight:bold;height:", collapseItem.titleHeight, ";line-height:", collapseItem.titleHeight, ";transition:color ", collapse.transition, ";.", k, "-collapse-arrow{float:right;transition:transform ", collapse.transition, ";line-height:", collapseItem.titleHeight, ";height:", collapseItem.titleHeight, ";}}&:not(.", k, "-disabled){>.", k, "-collapse-title{&:hover{color:", theme.color.primary, ";}}}&.", k, "-active{>.", k, "-collapse-title .", k, "-collapse-arrow{transform:rotate(90deg);}}&.", k, "-disabled{color:", theme.color.disabledBorder, ";>.", k, "-collapse-title{cursor:not-allowed;}}");
38
+ return /*#__PURE__*/css("border-bottom:", collapseItem.borderBottom, ";&:last-of-type{border-bottom-color:transparent;}>.", k, "-collapse-title{cursor:pointer;font-weight:bold;height:", collapseItem.titleHeight, ";transition:color ", collapse.transition, ";display:flex;align-items:center;gap:", collapseItem.titleGap, ";.", k, "-collapse-title-wrapper{flex:1;}.", k, "-collapse-arrow{transition:transform ", collapse.transition, ";}}&:not(.", k, "-disabled){>.", k, "-collapse-title{&:hover{color:", theme.color.primary, ";}}}&.", k, "-active{>.", k, "-collapse-title .", k, "-collapse-arrow{transform:rotate(90deg);}}&.", k, "-disabled{color:", theme.color.disabledBorder, ";>.", k, "-collapse-title{cursor:not-allowed;}}");
39
39
  });
@@ -7,7 +7,7 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
7
7
 
8
8
  function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
9
 
10
- function _unsupportedIterableToArray(o, minLen) { var _context21; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context21 = Object.prototype.toString.call(o)).call(_context21, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _unsupportedIterableToArray(o, minLen) { var _context23; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context23 = Object.prototype.toString.call(o)).call(_context23, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
11
 
12
12
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
13
13
 
@@ -732,6 +732,66 @@ describe('Dialog', function () {
732
732
  }
733
733
  }
734
734
  }, _callee14);
735
+ })));
736
+ it('should update position when change container', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
737
+ var Demo, _mount15, instance, element, dialogDom, style;
738
+
739
+ return _regeneratorRuntime.wrap(function _callee15$(_context22) {
740
+ while (1) {
741
+ switch (_context22.prev = _context22.next) {
742
+ case 0:
743
+ Demo = /*#__PURE__*/function (_Component7) {
744
+ _inheritsLoose(Demo, _Component7);
745
+
746
+ function Demo() {
747
+ var _context21;
748
+
749
+ var _this7;
750
+
751
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
752
+ args[_key7] = arguments[_key7];
753
+ }
754
+
755
+ _this7 = _Component7.call.apply(_Component7, _concatInstanceProperty(_context21 = [this]).call(_context21, args)) || this;
756
+ _this7.Dialog = Dialog;
757
+ return _this7;
758
+ }
759
+
760
+ Demo.defaults = function defaults() {
761
+ return {
762
+ container: function container(parentDom) {
763
+ return parentDom;
764
+ }
765
+ };
766
+ };
767
+
768
+ return Demo;
769
+ }(Component);
770
+
771
+ Demo.template = "\n var Dialog = this.Dialog;\n <Dialog value={true} container={this.get('container')} ref=\"dialog\">test</Dialog>\n ";
772
+ _mount15 = mount(Demo), instance = _mount15[0], element = _mount15[1];
773
+ _context22.next = 5;
774
+ return wait();
775
+
776
+ case 5:
777
+ instance.set('container', undefined);
778
+ _context22.next = 8;
779
+ return wait();
780
+
781
+ case 8:
782
+ dialogDom = instance.refs.dialog.dialogRef.value;
783
+ style = dialogDom.style;
784
+ expect(style.left).not.eql('');
785
+ expect(style.top).not.eql(''); // should append to body
786
+
787
+ expect(dialogDom.closest('.k-dialog-wrapper').parentElement).to.eql(document.body);
788
+
789
+ case 13:
790
+ case "end":
791
+ return _context22.stop();
792
+ }
793
+ }
794
+ }, _callee15);
735
795
  }))); // it('should handle v-if and v-model at the same time correctly in Vue', async () => {
736
796
  // const Test = {
737
797
  // template: `<Dialog v-model="show" v-if="show" ref="dialog">test</Dialog>`,
@@ -5,6 +5,13 @@ export function usePosition(elementRef) {
5
5
  var instance = useInstance();
6
6
  instance.on(SHOW, center);
7
7
  instance.on('afterClose', onAfterLeave);
8
+ instance.watch('container', function () {
9
+ if (!instance.get('value')) return;
10
+ center();
11
+ }, {
12
+ presented: true,
13
+ inited: true
14
+ });
8
15
 
9
16
  function center() {
10
17
  position(elementRef.value, {
@@ -1,8 +1,7 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
2
  import { useInstance, findDomFromVNode } from 'intact';
3
3
  import { position } from '../position';
4
- import { noop } from 'intact-shared';
5
- import { isObject } from 'intact-shared';
4
+ import { noop, isObject, isFunction } from 'intact-shared';
6
5
  import { isEqualObject } from '../utils';
7
6
  export function usePosition() {
8
7
  var instance = useInstance();
@@ -16,19 +15,23 @@ export function usePosition() {
16
15
  });
17
16
  ['of', 'position'].forEach(function (item) {
18
17
  instance.watch(item, function (newValue, oldValue) {
19
- // return if object is the same
20
- if (isObject(newValue) && isObject(oldValue) && // is not event object
21
- !(newValue instanceof Event) && isEqualObject(newValue, oldValue)) {
22
- return;
23
- }
24
-
25
- if (instance.get('value')) {
26
- handle(noop);
27
- }
18
+ if (!instance.get('value') || // return if object is the same
19
+ isObject(newValue) && isObject(oldValue) && // is not event object
20
+ !(newValue instanceof Event) && isEqualObject(newValue, oldValue)) return;
21
+ handle(noop);
28
22
  }, {
29
23
  presented: true,
30
24
  inited: true
31
25
  });
26
+ }); // watch container, it is not commonly used
27
+
28
+ instance.watch('container', function (newValue, oldValue) {
29
+ if (!instance.get('value') || // return if function is the same. Not rigorous!
30
+ isFunction(newValue) && isFunction(oldValue) && newValue.toString() === oldValue.toString()) return;
31
+ handle(noop);
32
+ }, {
33
+ presented: true,
34
+ inited: true
32
35
  }); // if the dropdown is nested, we must show child after parent has positioned
33
36
 
34
37
  function p(ofElement, parentFeedback) {
@@ -1,6 +1,6 @@
1
1
  import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
2
2
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
3
- import { Component, createCommentVNode, createTextVNode, mount, patch, remove, inject } from 'intact';
3
+ import { Component, createCommentVNode, createTextVNode, mount, patch, remove, inject, unmount, removeVNodeDom } from 'intact';
4
4
  import { isString } from 'intact-shared';
5
5
  import { DIALOG } from './dialog/constants';
6
6
  import { BaseDialog } from './dialog/base';
@@ -51,7 +51,9 @@ export var Portal = /*#__PURE__*/function (_Component) {
51
51
  var nextProps = nextVNode.props;
52
52
  var fakeContainer = document.createDocumentFragment();
53
53
  (mountedQueue.priority || mountedQueue).push(function () {
54
- var parentDom = _this2.$lastInput.dom.parentElement;
54
+ var parentDom = _this2.$lastInput.dom.parentElement; // maybe the <!-- portal --> has been removed by react, #938
55
+
56
+ if (!parentDom) return;
55
57
 
56
58
  _this2.initContainer(nextProps.container, parentDom, anchor);
57
59
 
@@ -97,7 +99,14 @@ export var Portal = /*#__PURE__*/function (_Component) {
97
99
  };
98
100
 
99
101
  _proto.$unmount = function $unmount(vNode, nextVNode) {
100
- remove(vNode.props.children, this.container, false); // removeVNodeDom(vNode.props!.children as VNode, this.container!);
102
+ var children = vNode.props.children;
103
+ unmount(children, null);
104
+
105
+ if (this.container) {
106
+ // maybe the <!-- portal --> has been removed by react, #938
107
+ // remove(children, this.container, false);
108
+ removeVNodeDom(children, this.container);
109
+ }
101
110
 
102
111
  _Component.prototype.$unmount.call(this, vNode, nextVNode);
103
112
  };
@@ -109,6 +118,9 @@ export var Portal = /*#__PURE__*/function (_Component) {
109
118
  } else {
110
119
  this.container = container(parentDom, anchor);
111
120
  }
121
+ } else {
122
+ // let below logic to set container to default if container does not exist.
123
+ this.container = null;
112
124
  }
113
125
 
114
126
  if (!this.container) {
@@ -9,6 +9,7 @@ import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/spl
9
9
  import { useInstance } from 'intact';
10
10
  import { _$ } from '../../i18n';
11
11
  import { UploadFileStatus } from './useUpload';
12
+ import { isEqualArray } from '../utils';
12
13
  var uid = 0;
13
14
  export function useFiles(isValidType, upload) {
14
15
  var instance = useInstance();
@@ -33,8 +34,8 @@ export function useFiles(isValidType, upload) {
33
34
  }
34
35
  }
35
36
 
36
- instance.on("$receive:files", function (files) {
37
- if (!files) return;
37
+ instance.on("$receive:files", function (files, oldFiles) {
38
+ if (!files || isEqualArray(files, oldFiles)) return;
38
39
  instance.set('files', _mapInstanceProperty(files).call(files, normalizeFile));
39
40
  });
40
41
 
package/es/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v3.1.2
2
+ * @king-design v3.1.3
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -60,4 +60,4 @@ export * from './components/tree';
60
60
  export * from './components/treeSelect';
61
61
  export * from './components/upload';
62
62
  export * from './components/wave';
63
- export declare const version = "3.1.2";
63
+ export declare const version = "3.1.3";
package/es/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v3.1.2
2
+ * @king-design v3.1.3
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -62,5 +62,5 @@ export * from './components/tree';
62
62
  export * from './components/treeSelect';
63
63
  export * from './components/upload';
64
64
  export * from './components/wave';
65
- export var version = '3.1.2';
65
+ export var version = '3.1.3';
66
66
  /* generate end */
@@ -36,7 +36,6 @@ describe('Cascader', function () {
36
36
  }]
37
37
  }],
38
38
  value: value,
39
- multiple: true,
40
39
  filterable: true,
41
40
  onChangeValue: function onChangeValue(v) {
42
41
  setValue(v);
@@ -10,8 +10,13 @@ var slideDirections = {
10
10
  up: 'center bottom 0',
11
11
  left: 'right center 0',
12
12
  right: 'left center 0'
13
- }; // TODO: update global when theme changed
13
+ };
14
14
 
15
- injectGlobal("html{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,SF Pro SC,SF Pro Text,Helvetica Neue,Helvetica,PingFang SC,Segoe UI,Roboto,Hiragino Sans GB,arial,microsoft yahei ui,Microsoft YaHei,sans-serif;}body{font-size:", theme.fontSize, ";line-height:", theme.lineHeight, ";margin:0;padding:0;color:", theme.color.text, ";}*,*:before,*:after{box-sizing:inherit;}::-webkit-scrollbar{width:10px;height:10px;background-color:#fff;}::-webkit-scrollbar-track{background-color:#fff;}::-webkit-scrollbar-thumb{background-color:#babac0;border-radius:16px;border:2px solid #fff;&:hover{background-color:#a0a0a5;}}::-webkit-scroll-button{display:none;}", _mapInstanceProperty(_context = _Object$keys(slideDirections)).call(_context, function (direction) {
15
+ if (!/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)) {
16
+ document.body.classList.add('k-customize-scrollbar');
17
+ } // TODO: update global when theme changed
18
+
19
+
20
+ injectGlobal("html{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,SF Pro SC,SF Pro Text,Helvetica Neue,Helvetica,PingFang SC,Segoe UI,Roboto,Hiragino Sans GB,arial,microsoft yahei ui,Microsoft YaHei,sans-serif;}body{font-size:", theme.fontSize, ";line-height:", theme.lineHeight, ";margin:0;padding:0;color:", theme.color.text, ";}*,*:before,*:after{box-sizing:inherit;}.k-customize-scrollbar{&::-webkit-scrollbar,*::-webkit-scrollbar{width:10px;height:10px;background-color:#fff;}&::-webkit-scrollbar-track,*::-webkit-scrollbar-track{background-color:#fff;}&::-webkit-scrollbar-thumb,*::-webkit-scrollbar-thumb{background-color:#babac0;border-radius:16px;border:2px solid #fff;&:hover{background-color:#a0a0a5;}}&::-webkit-scroll-button,*::-webkit-scroll-button{display:none;}}", _mapInstanceProperty(_context = _Object$keys(slideDirections)).call(_context, function (direction) {
16
21
  return /*#__PURE__*/css(".k-slide", direction, "-enter-from,.k-slide", direction, "-leave-to{transform-origin:", slideDirections[direction], ";opacity:0;transform:", direction === 'down' || direction === 'up' ? "scaleY(.8)" : 'scaleX(.8)', ";}.k-slide", direction, "-enter-active,.k-slide", direction, "-leave-active{transform-origin:", slideDirections[direction], ";transition:opacity ", theme.transition.large, ",transform ", theme.transition.large, "!important;}.k-slide", direction, "-leave-active{pointer-events:none;}");
17
22
  }), " .k-fade-enter-from,.k-fade-leave-to{opacity:0!important;}.k-fade-enter-active,.k-fade-leave-active{transition:opacity ", theme.transition.large, "!important;}.k-fade-leave-active:not(tr){position:absolute;}.k-fade-move{transition:transform ", theme.transition.large, "!important;}.k-scale-enter-from,.k-scale-leave-to{transform:scale(0);}.k-scale-enter-active,.k-scale-leave-active{transition:transform ", theme.transition.large, ";}.k-expand-enter-from,.k-expand-leave-to{opacity:0;overflow:hidden;}.k-expand-enter-active,.k-expand-leave-active{transition:all ", theme.transition.large, "!important;overflow:hidden;}.k-expand-move{transition:transform ", theme.transition.large, ";}.k-dropdown-enter-from,.k-dropdown-leave-to{opacity:0;transform:translateY(-20px);}.k-dropdown-enter-active,.k-dropdown-leave-active,.k-dropdown-move{transition:all ", theme.transition.large, ";}.k-dropdown-leave-active{position:absolute!important;}.k-dropdown-move{transition:transform ", theme.transition.large, ";}.k-fade-in-left-enter-from,.k-fade-in-left-leave-to{opacity:0;transform:translate3d(-15px, 0, 0);}.k-fade-in-left-enter-active,.k-fade-in-left-leave-active{transition:all ", theme.transition.large, ";}.k-fade-in-left-move{transition:transform ", theme.transition.large, ";}.k-fade-expand-enter-from,.k-fade-expand-leave-to{opacity:0;}.k-fade-expand-enter-active,.k-fade-expand-leave-active{transition:all ", theme.transition.large, ";}.c-ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.c-hidden{display:none!important;}.c-middle{display:inline-block;vertical-align:middle;}");
package/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @king-design v3.1.2
2
+ * @king-design v3.1.3
3
3
  *
4
4
  * Copyright (c) Kingsoft Cloud
5
5
  * Released under the MIT License
@@ -65,6 +65,6 @@ export * from './components/treeSelect';
65
65
  export * from './components/upload';
66
66
  export * from './components/wave';
67
67
 
68
- export const version = '3.1.2';
68
+ export const version = '3.1.3';
69
69
 
70
70
  /* generate end */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@king-design/intact",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "description": "A component library written in Intact for Intact, Vue, React and Angular",
5
5
  "main": "es/index.js",
6
6
  "engines": {
@@ -120,7 +120,7 @@
120
120
  "highlight.js": "^10.4.1",
121
121
  "history": "^5.0.0",
122
122
  "html-webpack-plugin": "5.3.1",
123
- "intact-react": "^3.0.23",
123
+ "intact-react": "^3.0.24",
124
124
  "istanbul-instrumenter-loader": "^3.0.0",
125
125
  "js-yaml": "^4.1.0",
126
126
  "karma": "^6.3.2",
@@ -179,7 +179,7 @@
179
179
  "dependencies": {
180
180
  "@babel/runtime-corejs3": "^7.16.0",
181
181
  "@emotion/css": "^11.5.0",
182
- "@king-design/react": "^3.1.2",
182
+ "@king-design/react": "^3.1.3",
183
183
  "dayjs": "^1.10.7",
184
184
  "enquire.js": "^2.1.6",
185
185
  "intact": "^3.0.19",
package/styles/global.ts CHANGED
@@ -9,6 +9,10 @@ const slideDirections = {
9
9
  right: 'left center 0',
10
10
  };
11
11
 
12
+ if (!/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)) {
13
+ document.body.classList.add('k-customize-scrollbar');
14
+ }
15
+
12
16
  // TODO: update global when theme changed
13
17
  injectGlobal`
14
18
  html {
@@ -27,25 +31,31 @@ injectGlobal`
27
31
  }
28
32
 
29
33
  // scollbar
30
- ::-webkit-scrollbar {
31
- width: 10px;
32
- height: 10px;
33
- background-color: #fff;
34
- }
35
- ::-webkit-scrollbar-track {
36
- background-color: #fff;
37
- }
38
- ::-webkit-scrollbar-thumb {
39
- background-color: #babac0;
40
- border-radius: 16px;
41
- border: 2px solid #fff;
42
- &:hover {
43
- background-color: #a0a0a5;
44
- // border-width: 1px;
34
+ .k-customize-scrollbar {
35
+ &::-webkit-scrollbar,
36
+ *::-webkit-scrollbar {
37
+ width: 10px;
38
+ height: 10px;
39
+ background-color: #fff;
40
+ }
41
+ &::-webkit-scrollbar-track,
42
+ *::-webkit-scrollbar-track {
43
+ background-color: #fff;
44
+ }
45
+ &::-webkit-scrollbar-thumb,
46
+ *::-webkit-scrollbar-thumb {
47
+ background-color: #babac0;
48
+ border-radius: 16px;
49
+ border: 2px solid #fff;
50
+ &:hover {
51
+ background-color: #a0a0a5;
52
+ // border-width: 1px;
53
+ }
54
+ }
55
+ &::-webkit-scroll-button,
56
+ *::-webkit-scroll-button {
57
+ display: none;
45
58
  }
46
- }
47
- ::-webkit-scroll-button {
48
- display: none;
49
59
  }
50
60
 
51
61
  // animation