@king-design/intact 2.0.14 → 2.0.15
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/components/colorpicker/index.md +1 -0
- package/components/colorpicker/index.ts +2 -0
- package/components/colorpicker/index.vdt +1 -0
- package/components/dialog/alert.vdt +5 -3
- package/components/dialog/index.md +3 -0
- package/components/dialog/index.spec.ts +35 -0
- package/components/dialog/staticMethods.ts +14 -1
- package/components/dialog/useFixBody.ts +3 -1
- package/components/icon/demos/icons.md +158 -0
- package/components/pagination/demos/disable.md +51 -0
- package/components/pagination/index.md +2 -0
- package/components/pagination/index.spec.ts +14 -0
- package/components/pagination/index.ts +8 -0
- package/components/pagination/index.vdt +13 -3
- package/components/pagination/styles.ts +3 -0
- package/components/portal.ts +38 -28
- package/es/components/colorpicker/index.d.ts +1 -0
- package/es/components/colorpicker/index.js +2 -1
- package/es/components/colorpicker/index.vdt.js +5 -1
- package/es/components/dialog/alert.vdt.js +6 -4
- package/es/components/dialog/index.spec.js +61 -1
- package/es/components/dialog/staticMethods.d.ts +4 -2
- package/es/components/dialog/staticMethods.js +16 -0
- package/es/components/dialog/useFixBody.js +3 -1
- package/es/components/pagination/index.d.ts +2 -0
- package/es/components/pagination/index.js +12 -1
- package/es/components/pagination/index.spec.js +28 -0
- package/es/components/pagination/index.vdt.js +18 -3
- package/es/components/pagination/styles.js +1 -1
- package/es/components/portal.js +23 -11
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/packages/kpc-react/__tests__/components/dialog.spec.d.ts +1 -0
- package/es/packages/kpc-react/__tests__/components/dialog.spec.js +45 -0
- package/es/packages/kpc-react/__tests__/components/drawer.spec.js +42 -2
- package/es/site/data/components/icon/demos/icons/index.d.ts +9 -0
- package/es/site/data/components/icon/demos/icons/index.js +24 -0
- package/es/site/data/components/icon/demos/icons/react.d.ts +9 -0
- package/es/site/data/components/icon/demos/icons/react.js +63 -0
- package/es/site/data/components/pagination/demos/disable/index.d.ts +16 -0
- package/es/site/data/components/pagination/demos/disable/index.js +35 -0
- package/es/site/data/components/pagination/demos/disable/react.d.ts +16 -0
- package/es/site/data/components/pagination/demos/disable/react.js +65 -0
- package/index.ts +2 -2
- package/package.json +2 -2
- package/styles/fonts/demo.css +370 -0
- package/styles/fonts/demo.html +29 -0
- package/styles/fonts/iconfont.css +477 -0
|
@@ -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
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { var _context18; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context18 = Object.prototype.toString.call(o)).call(_context18, 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
|
|
|
@@ -15,8 +15,10 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/con
|
|
|
15
15
|
import _keysInstanceProperty from "@babel/runtime-corejs3/core-js/instance/keys";
|
|
16
16
|
import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js/instance/starts-with";
|
|
17
17
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
18
|
+
import { __decorate } from "tslib";
|
|
18
19
|
import { Component } from 'intact';
|
|
19
20
|
import { Dialog, BaseDialog } from './';
|
|
21
|
+
import { bind } from '../utils';
|
|
20
22
|
import { getElement, mount, unmount, dispatchEvent, wait } from '../../test/utils';
|
|
21
23
|
import BasicDemo from '~/components/dialog/demos/basic';
|
|
22
24
|
import AsyncCloseDemo from '~/components/dialog/demos/asyncClose';
|
|
@@ -590,6 +592,64 @@ describe('Dialog', function () {
|
|
|
590
592
|
}
|
|
591
593
|
}
|
|
592
594
|
}, _callee12);
|
|
595
|
+
})));
|
|
596
|
+
it('should remove body style when destroy', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
|
597
|
+
var Demo, _mount13, instance, element;
|
|
598
|
+
|
|
599
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context17) {
|
|
600
|
+
while (1) {
|
|
601
|
+
switch (_context17.prev = _context17.next) {
|
|
602
|
+
case 0:
|
|
603
|
+
Demo = /*#__PURE__*/function (_Component4) {
|
|
604
|
+
_inheritsLoose(Demo, _Component4);
|
|
605
|
+
|
|
606
|
+
function Demo() {
|
|
607
|
+
var _context16;
|
|
608
|
+
|
|
609
|
+
var _this4;
|
|
610
|
+
|
|
611
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
612
|
+
args[_key4] = arguments[_key4];
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
_this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context16 = [this]).call(_context16, args)) || this;
|
|
616
|
+
_this4.Dialog = Dialog;
|
|
617
|
+
return _this4;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
Demo.defaults = function defaults() {
|
|
621
|
+
return {
|
|
622
|
+
show: true
|
|
623
|
+
};
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
var _proto = Demo.prototype;
|
|
627
|
+
|
|
628
|
+
_proto.onClose = function onClose() {
|
|
629
|
+
this.set('show', false);
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
return Demo;
|
|
633
|
+
}(Component);
|
|
634
|
+
|
|
635
|
+
Demo.template = "\n var Dialog = this.Dialog;\n <div>\n <Dialog v-if={this.get('show')}\n value={this.get('show')}\n ev-close={this.onClose}\n ref=\"dialog\"\n >test</Dialog>\n </div>\n ";
|
|
636
|
+
|
|
637
|
+
__decorate([bind], Demo.prototype, "onClose", null);
|
|
638
|
+
|
|
639
|
+
_mount13 = mount(Demo), instance = _mount13[0], element = _mount13[1];
|
|
640
|
+
instance.refs.dialog.close();
|
|
641
|
+
_context17.next = 7;
|
|
642
|
+
return wait();
|
|
643
|
+
|
|
644
|
+
case 7:
|
|
645
|
+
expect(document.body.getAttribute('style')).to.be.null;
|
|
646
|
+
|
|
647
|
+
case 8:
|
|
648
|
+
case "end":
|
|
649
|
+
return _context17.stop();
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
}, _callee13);
|
|
593
653
|
}))); // it('should handle v-if and v-model at the same time correctly in Vue', async () => {
|
|
594
654
|
// const Test = {
|
|
595
655
|
// template: `<Dialog v-model="show" v-if="show" ref="dialog">test</Dialog>`,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { VNode } from 'intact';
|
|
2
1
|
import type { Dialog, DialogProps } from './';
|
|
3
2
|
export interface AlertDialogProps extends DialogProps {
|
|
4
|
-
content?: string |
|
|
3
|
+
content?: string | object;
|
|
5
4
|
type?: 'success' | 'warning' | 'error' | 'confirm';
|
|
6
5
|
hideIcon?: boolean;
|
|
7
6
|
hideFooter?: boolean;
|
|
8
7
|
ref?: (i: Dialog) => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
iconClassName?: string;
|
|
10
|
+
icon?: object;
|
|
9
11
|
}
|
|
10
12
|
export declare type StaticMethod = (options?: AlertDialogProps) => Promise<void>;
|
|
11
13
|
export declare function addStaticMethods(Component: typeof Dialog): void;
|
|
@@ -29,6 +29,22 @@ export function addStaticMethods(Component) {
|
|
|
29
29
|
options = {};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
var normalize = Component.normalize;
|
|
33
|
+
|
|
34
|
+
if (normalize) {
|
|
35
|
+
if (options.content) {
|
|
36
|
+
options = _extends({}, options, {
|
|
37
|
+
content: normalize(options.content)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (options.icon) {
|
|
42
|
+
options = _extends({}, options, {
|
|
43
|
+
icon: normalize(options.icon)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
32
48
|
var dialog = new AlertDialog(options);
|
|
33
49
|
dialog.show();
|
|
34
50
|
if (options.ref) options.ref(dialog);
|
|
@@ -11,7 +11,9 @@ export function useFixBody(elementRef) {
|
|
|
11
11
|
instance.on(SHOW, onEnter);
|
|
12
12
|
instance.on('afterClose', onAfterLeave);
|
|
13
13
|
onBeforeUnmount(function () {
|
|
14
|
-
|
|
14
|
+
// should also remove body style when dialog is removed, #805
|
|
15
|
+
// if (fixedBody && instance.get('value')) {
|
|
16
|
+
if (fixedBody) {
|
|
15
17
|
// maybe HIDE event has not triggered
|
|
16
18
|
onClosed(instance);
|
|
17
19
|
}
|
|
@@ -13,6 +13,8 @@ export interface PaginationProps {
|
|
|
13
13
|
showTotal?: boolean;
|
|
14
14
|
showGoto?: boolean;
|
|
15
15
|
showLimits?: boolean;
|
|
16
|
+
disableBtn?: (page: number, limit: number) => boolean;
|
|
17
|
+
disablePage?: (page: number, limit: number) => boolean;
|
|
16
18
|
}
|
|
17
19
|
export interface PaginationEvents {
|
|
18
20
|
change: [PaginationChangeData];
|
|
@@ -16,7 +16,9 @@ var typeDefs = {
|
|
|
16
16
|
simple: Boolean,
|
|
17
17
|
showTotal: Boolean,
|
|
18
18
|
showGoto: Boolean,
|
|
19
|
-
showLimits: Boolean
|
|
19
|
+
showLimits: Boolean,
|
|
20
|
+
disableBtn: Function,
|
|
21
|
+
disablePage: Function
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
var defaults = function defaults() {
|
|
@@ -141,7 +143,16 @@ export var Pagination = /*#__PURE__*/function (_Component) {
|
|
|
141
143
|
};
|
|
142
144
|
|
|
143
145
|
_proto.goto = function goto(e) {
|
|
146
|
+
var _this$get4 = this.get(),
|
|
147
|
+
disablePage = _this$get4.disablePage,
|
|
148
|
+
limit = _this$get4.limit;
|
|
149
|
+
|
|
144
150
|
var value = parseInt(e.target.value) || 1;
|
|
151
|
+
|
|
152
|
+
if (disablePage && disablePage(value, limit)) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
145
156
|
this.changePage(value);
|
|
146
157
|
};
|
|
147
158
|
|
|
@@ -3,6 +3,7 @@ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
|
3
3
|
import BasicDemo from '~/components/pagination/demos/basic';
|
|
4
4
|
import GotoDemo from '~/components/pagination/demos/goto';
|
|
5
5
|
import CurrentDemo from '~/components/pagination/demos/current';
|
|
6
|
+
import DisableDemo from '~/components/pagination/demos/disable';
|
|
6
7
|
import { mount, unmount, dispatchEvent, wait } from '../../test/utils';
|
|
7
8
|
describe('Pagination', function () {
|
|
8
9
|
afterEach(function () {
|
|
@@ -141,4 +142,31 @@ describe('Pagination', function () {
|
|
|
141
142
|
}
|
|
142
143
|
}, _callee3);
|
|
143
144
|
})));
|
|
145
|
+
it('should not goto disabled page', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
146
|
+
var _mount4, instance, element, input;
|
|
147
|
+
|
|
148
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
149
|
+
while (1) {
|
|
150
|
+
switch (_context4.prev = _context4.next) {
|
|
151
|
+
case 0:
|
|
152
|
+
_mount4 = mount(DisableDemo), instance = _mount4[0], element = _mount4[1];
|
|
153
|
+
input = element.querySelector('.k-input-inner');
|
|
154
|
+
dispatchEvent(input, 'focus');
|
|
155
|
+
input.value = '11';
|
|
156
|
+
dispatchEvent(input, 'change');
|
|
157
|
+
dispatchEvent(input, 'blur');
|
|
158
|
+
_context4.next = 8;
|
|
159
|
+
return wait();
|
|
160
|
+
|
|
161
|
+
case 8:
|
|
162
|
+
expect(input.value).to.eql('10');
|
|
163
|
+
expect(instance.get('value2')).to.eql(10);
|
|
164
|
+
|
|
165
|
+
case 10:
|
|
166
|
+
case "end":
|
|
167
|
+
return _context4.stop();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}, _callee4);
|
|
171
|
+
})));
|
|
144
172
|
});
|
|
@@ -32,7 +32,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
32
32
|
value = _this$get.value,
|
|
33
33
|
limit = _this$get.limit,
|
|
34
34
|
limits = _this$get.limits,
|
|
35
|
-
showLimits = _this$get.showLimits
|
|
35
|
+
showLimits = _this$get.showLimits,
|
|
36
|
+
disableBtn = _this$get.disableBtn,
|
|
37
|
+
disablePage = _this$get.disablePage;
|
|
36
38
|
|
|
37
39
|
if (!total) return _$ccv(' pagination ');
|
|
38
40
|
var classNameObj = (_classNameObj = {
|
|
@@ -47,11 +49,24 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
47
49
|
var totalPages = Math.ceil(total / limit) || 0;
|
|
48
50
|
|
|
49
51
|
var paginationButton = function paginationButton(page) {
|
|
52
|
+
var disabled = false;
|
|
53
|
+
|
|
54
|
+
if (page !== value) {
|
|
55
|
+
if (disablePage) {
|
|
56
|
+
disabled || (disabled = !!disablePage(page, limit));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (disableBtn) {
|
|
60
|
+
disabled || (disabled = !!disableBtn(page, limit));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
50
64
|
return _$cc(Button, {
|
|
51
65
|
'type': type,
|
|
52
66
|
'size': size,
|
|
53
67
|
'icon': true,
|
|
54
68
|
'value': page,
|
|
69
|
+
'disabled': disabled,
|
|
55
70
|
'children': page
|
|
56
71
|
});
|
|
57
72
|
};
|
|
@@ -131,14 +146,14 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
131
146
|
'icon': true,
|
|
132
147
|
'size': size,
|
|
133
148
|
'type': type,
|
|
134
|
-
'disabled': value <= 1,
|
|
149
|
+
'disabled': value <= 1 || !!(disablePage && disablePage(value - 1, limit)),
|
|
135
150
|
'ev-click': this.prev,
|
|
136
151
|
'children': _$cc(Icon, _$tmp0)
|
|
137
152
|
}), paginationItems, _$cc(Button, {
|
|
138
153
|
'icon': true,
|
|
139
154
|
'size': size,
|
|
140
155
|
'type': type,
|
|
141
|
-
'disabled': value >= totalPages,
|
|
156
|
+
'disabled': value >= totalPages || !!(disablePage && disablePage(value + 1, limit)),
|
|
142
157
|
'ev-click': this.next,
|
|
143
158
|
'children': _$cc(Icon, _$tmp1)
|
|
144
159
|
})],
|
|
@@ -55,7 +55,7 @@ setDefault(function () {
|
|
|
55
55
|
}).pagination;
|
|
56
56
|
});
|
|
57
57
|
export function makeStyles() {
|
|
58
|
-
return /*#__PURE__*/css("font-size:", pagination.fontSize, ";.k-pagination-limits,.k-pagination-goto,.k-pagination-total{margin-left:", pagination.gap, ";display:inline-block;vertical-align:middle;}.k-pagination-ellipsis{background-color:transparent;border-color:transparent;}.k-btns{.k-btn{width:auto!important;min-width:", button.height, ";padding:", pagination.btn.padding, ";margin-right:", pagination.btn.gap, ";&:last-of-type{margin:0!important;}}.k-icon{font-size:18px;}}.k-pagination-goto{.k-input{font-size:inherit;width:", pagination.goto.width, ";margin:", pagination.goto.gap, ";}}.k-select{width:auto;}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
58
|
+
return /*#__PURE__*/css("font-size:", pagination.fontSize, ";.k-pagination-limits,.k-pagination-goto,.k-pagination-total{margin-left:", pagination.gap, ";display:inline-block;vertical-align:middle;}.k-pagination-ellipsis{background-color:transparent;border-color:transparent;}.k-btns{.k-btn{width:auto!important;min-width:", button.height, ";padding:", pagination.btn.padding, ";margin-right:", pagination.btn.gap, ";&:last-of-type{margin:0!important;}}.k-icon{font-size:18px;}}.k-pagination-goto{.k-input{font-size:inherit;width:", pagination.goto.width, ";margin:", pagination.goto.gap, ";}.k-input-inner{text-align:center;}}.k-select{width:auto;}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
59
59
|
var styles = pagination[size];
|
|
60
60
|
var btnStyles = button[size];
|
|
61
61
|
return /*#__PURE__*/css("&.k-", size, "{font-size:", styles.fontSize, ";.k-btn{margin-right:", styles.btnGap, ";min-width:", btnStyles.height, ";.k-icon{font-size:", styles.iconFontSize, ";}}}");
|
package/es/components/portal.js
CHANGED
|
@@ -60,25 +60,37 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
_proto.$update = function $update(lastVNode, nextVNode, parentDom, anchor, mountedQueue, force) {
|
|
63
|
+
var _this3 = this;
|
|
64
|
+
|
|
63
65
|
// update container if it has changed
|
|
64
66
|
var lastProps = lastVNode.props;
|
|
65
67
|
var nextProps = nextVNode.props;
|
|
66
|
-
var lastContainer = this.container;
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
var update = function update() {
|
|
70
|
+
var lastContainer = _this3.container;
|
|
71
|
+
|
|
72
|
+
if (lastProps.container !== nextProps.container) {
|
|
73
|
+
_this3.initContainer(nextProps.container, parentDom, anchor);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
var nextContainer = _this3.container;
|
|
71
77
|
|
|
72
|
-
|
|
78
|
+
if (lastContainer === nextContainer) {
|
|
79
|
+
patch(lastProps.children, nextProps.children, nextContainer, _this3, _this3.$SVG, anchor, mountedQueue, false);
|
|
80
|
+
} else {
|
|
81
|
+
remove(lastProps.children, lastContainer, false);
|
|
82
|
+
mount(nextProps.children, nextContainer, _this3, _this3.$SVG, anchor, mountedQueue);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
_Component.prototype.$update.call(_this3, lastVNode, nextVNode, parentDom, anchor, mountedQueue, force);
|
|
86
|
+
};
|
|
73
87
|
|
|
74
|
-
if (
|
|
75
|
-
|
|
88
|
+
if (!this.container) {
|
|
89
|
+
// in react, sometimes $update will be called before mountedQueue in $render
|
|
90
|
+
mountedQueue.push(update);
|
|
76
91
|
} else {
|
|
77
|
-
|
|
78
|
-
mount(nextProps.children, nextContainer, this, this.$SVG, anchor, mountedQueue);
|
|
92
|
+
update();
|
|
79
93
|
}
|
|
80
|
-
|
|
81
|
-
_Component.prototype.$update.call(this, lastVNode, nextVNode, parentDom, anchor, mountedQueue, force);
|
|
82
94
|
};
|
|
83
95
|
|
|
84
96
|
_proto.$unmount = function $unmount(vNode, nextVNode) {
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.15
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -57,4 +57,4 @@ export * from './components/tree';
|
|
|
57
57
|
export * from './components/treeSelect';
|
|
58
58
|
export * from './components/upload';
|
|
59
59
|
export * from './components/wave';
|
|
60
|
-
export declare const version = "2.0.
|
|
60
|
+
export declare const version = "2.0.15";
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.15
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -59,5 +59,5 @@ export * from './components/tree';
|
|
|
59
59
|
export * from './components/treeSelect';
|
|
60
60
|
export * from './components/upload';
|
|
61
61
|
export * from './components/wave';
|
|
62
|
-
export var version = '2.0.
|
|
62
|
+
export var version = '2.0.15';
|
|
63
63
|
/* generate end */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import * as ReactDOM from 'react-dom';
|
|
5
|
+
import { Dialog, Icon } from '../../';
|
|
6
|
+
import { getElement, wait } from '../../../../test/utils';
|
|
7
|
+
describe('Dialog', function () {
|
|
8
|
+
var container;
|
|
9
|
+
beforeEach(function () {
|
|
10
|
+
container = document.createElement('div');
|
|
11
|
+
document.body.appendChild(container);
|
|
12
|
+
});
|
|
13
|
+
afterEach(function () {
|
|
14
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
15
|
+
document.body.removeChild(container);
|
|
16
|
+
});
|
|
17
|
+
it('should render vNode as content', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
18
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
19
|
+
while (1) {
|
|
20
|
+
switch (_context.prev = _context.next) {
|
|
21
|
+
case 0:
|
|
22
|
+
Dialog.confirm({
|
|
23
|
+
content: /*#__PURE__*/React.createElement("div", null, "test"),
|
|
24
|
+
className: 'confirm-test',
|
|
25
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
26
|
+
className: "test"
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
_context.next = 3;
|
|
30
|
+
return wait(100);
|
|
31
|
+
|
|
32
|
+
case 3:
|
|
33
|
+
expect(getElement('.confirm-test').innerHTML).to.matchSnapshot();
|
|
34
|
+
getElement('.confirm-test .k-primary').click();
|
|
35
|
+
_context.next = 7;
|
|
36
|
+
return wait(600);
|
|
37
|
+
|
|
38
|
+
case 7:
|
|
39
|
+
case "end":
|
|
40
|
+
return _context.stop();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, _callee);
|
|
44
|
+
})));
|
|
45
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
4
|
-
import React, { useState } from 'react';
|
|
4
|
+
import React, { useState, useEffect } from 'react';
|
|
5
5
|
import * as ReactDOM from 'react-dom';
|
|
6
|
-
import { Drawer, Card, Button } from '../../';
|
|
6
|
+
import { Drawer, Card, Button, Select, Option } from '../../';
|
|
7
7
|
import { Component } from 'intact-react';
|
|
8
8
|
import { wait, dispatchEvent } from '../../../../test/utils';
|
|
9
9
|
describe('Drawer', function () {
|
|
@@ -134,4 +134,44 @@ describe('Drawer', function () {
|
|
|
134
134
|
}
|
|
135
135
|
}, _callee2);
|
|
136
136
|
})));
|
|
137
|
+
it('$update call before mountedQueue in $receive', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
138
|
+
var App;
|
|
139
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
140
|
+
while (1) {
|
|
141
|
+
switch (_context3.prev = _context3.next) {
|
|
142
|
+
case 0:
|
|
143
|
+
App = function _App2() {
|
|
144
|
+
var _useState2 = useState(false),
|
|
145
|
+
state = _useState2[0],
|
|
146
|
+
setState = _useState2[1];
|
|
147
|
+
|
|
148
|
+
useEffect(function () {
|
|
149
|
+
setState(true);
|
|
150
|
+
}, []);
|
|
151
|
+
return /*#__PURE__*/React.createElement(Drawer, {
|
|
152
|
+
value: true,
|
|
153
|
+
mode: "destroy"
|
|
154
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", null, "react element"), /*#__PURE__*/React.createElement(Select, {
|
|
155
|
+
container: function container(parentElement) {
|
|
156
|
+
return parentElement.closest('.k-dialog-body');
|
|
157
|
+
}
|
|
158
|
+
}, state ? /*#__PURE__*/React.createElement(Option, {
|
|
159
|
+
value: "1"
|
|
160
|
+
}, "1") : null))));
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(App, null), container);
|
|
164
|
+
_context3.next = 4;
|
|
165
|
+
return wait();
|
|
166
|
+
|
|
167
|
+
case 4:
|
|
168
|
+
expect(document.querySelector('.k-dialog-body .k-select-menu').textContent).to.eql('1');
|
|
169
|
+
|
|
170
|
+
case 5:
|
|
171
|
+
case "end":
|
|
172
|
+
return _context3.stop();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}, _callee3);
|
|
176
|
+
})));
|
|
137
177
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as data } from './index.json';
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
import './index.styl';
|
|
4
|
+
export default class extends Component {
|
|
5
|
+
static template: string | import("intact").Template<any>;
|
|
6
|
+
static defaults(): {
|
|
7
|
+
fonts: string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
export { default as data } from './index.json';
|
|
3
|
+
import { Component } from 'intact';
|
|
4
|
+
import template from './index.vdt';
|
|
5
|
+
import './index.styl';
|
|
6
|
+
|
|
7
|
+
var default_1 = /*#__PURE__*/function (_Component) {
|
|
8
|
+
_inheritsLoose(default_1, _Component);
|
|
9
|
+
|
|
10
|
+
function default_1() {
|
|
11
|
+
return _Component.apply(this, arguments) || this;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
default_1.defaults = function defaults() {
|
|
15
|
+
return {
|
|
16
|
+
fonts: ['alert', 'alarm', 'calendar', 'application', 'arrow-right', 'arrow-up', 'arrow-left', 'arrow-down', 'arrow-expand', 'arrow-left-circled', 'arrow-right-circled', 'close', 'bill', 'change', 'cloud-download', 'content-squared', 'cloud', 'arrow-move', 'code-download', 'cloud-server', 'arrow-shrink', 'clone', 'cloud-servers', 'cart', 'delete', 'fault-outline', 'calculate', 'arrow-swap', 'download', 'information', 'internet', 'edit', 'search', 'code-working', 'heart', 'content', 'cut', 'money-square', 'logout', 'cloud-upload', 'lock', 'corporate', 'truth-none', 'resize', 'protect', 'time', 'date', 'document-change', 'scanner', 'notification', 'notification-outline', 'silent', 'heart-outline', 'share', 'pay', 'picture', 'desktop', 'earphone', 'cube', 'user-verify', 'fault', 'location', 'down-squared', 'pay-dollar', 'paperclip', 'settings', 'home', 'more', 'phonecall', 'tag', 'truth-circled', 'refresh', 'watch', 'images', 'sort', 'money-circled', 'trade', 'star-outline', 'minus-circled', 'right', 'left', 'up', 'down', 'upward', 'up-circled', 'pin', 'hide', 'users', 'user', 'return-right', 'message', 'paper', 'phonecall-prohibit', 'speedometer', 'settings-horizontal', 'phone', 'star', 'play', 'refresh-lock', 'shield', 'panel', 'structure', 'settings-vertical', 'printer', 'stop', 'return-left', 'question', 'unlock', 'sound-off', 'up-squared', 'sound-on', 'upload', 'tool', 'visible', 'truth']
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return default_1;
|
|
21
|
+
}(Component);
|
|
22
|
+
|
|
23
|
+
default_1.template = template;
|
|
24
|
+
export { default_1 as default };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Icon } from '@king-design/react';
|
|
6
|
+
import './index.styl';
|
|
7
|
+
|
|
8
|
+
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
9
|
+
_inheritsLoose(Demo, _React$Component);
|
|
10
|
+
|
|
11
|
+
function Demo() {
|
|
12
|
+
var _context;
|
|
13
|
+
|
|
14
|
+
var _this;
|
|
15
|
+
|
|
16
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
17
|
+
args[_key] = arguments[_key];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
21
|
+
_this.state = {
|
|
22
|
+
fonts: ['alert', 'alarm', 'calendar', 'application', 'arrow-right', 'arrow-up', 'arrow-left', 'arrow-down', 'arrow-expand', 'arrow-left-circled', 'arrow-right-circled', 'close', 'bill', 'change', 'cloud-download', 'content-squared', 'cloud', 'arrow-move', 'code-download', 'cloud-server', 'arrow-shrink', 'clone', 'cloud-servers', 'cart', 'delete', 'fault-outline', 'calculate', 'arrow-swap', 'download', 'information', 'internet', 'edit', 'search', 'code-working', 'heart', 'content', 'cut', 'money-square', 'logout', 'cloud-upload', 'lock', 'corporate', 'truth-none', 'resize', 'protect', 'time', 'date', 'document-change', 'scanner', 'notification', 'notification-outline', 'silent', 'heart-outline', 'share', 'pay', 'picture', 'desktop', 'earphone', 'cube', 'user-verify', 'fault', 'location', 'down-squared', 'pay-dollar', 'paperclip', 'settings', 'home', 'more', 'phonecall', 'tag', 'truth-circled', 'refresh', 'watch', 'images', 'sort', 'money-circled', 'trade', 'star-outline', 'minus-circled', 'right', 'left', 'up', 'down', 'upward', 'up-circled', 'pin', 'hide', 'users', 'user', 'return-right', 'message', 'paper', 'phonecall-prohibit', 'speedometer', 'settings-horizontal', 'phone', 'star', 'play', 'refresh-lock', 'shield', 'panel', 'structure', 'settings-vertical', 'printer', 'stop', 'return-left', 'question', 'unlock', 'sound-off', 'up-squared', 'sound-on', 'upload', 'tool', 'visible', 'truth']
|
|
23
|
+
};
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var _proto = Demo.prototype;
|
|
28
|
+
|
|
29
|
+
_proto.classNames = function classNames(_classNames) {
|
|
30
|
+
if (typeof _classNames === 'string') return _classNames;
|
|
31
|
+
var ret = [];
|
|
32
|
+
|
|
33
|
+
for (var key in _classNames) {
|
|
34
|
+
var value = _classNames[key];
|
|
35
|
+
|
|
36
|
+
if (value) {
|
|
37
|
+
ret.push(key);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return ret.join(' ');
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
_proto.render = function render() {
|
|
45
|
+
var _context2,
|
|
46
|
+
_this2 = this;
|
|
47
|
+
|
|
48
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "icons"
|
|
50
|
+
}, _mapInstanceProperty(_context2 = this.state.fonts).call(_context2, function ($value, $key) {
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: "icon"
|
|
53
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
54
|
+
className: _this2.classNames('k-icon-' + $value),
|
|
55
|
+
size: "large"
|
|
56
|
+
}), /*#__PURE__*/React.createElement("div", null, 'k-icon-' + $value));
|
|
57
|
+
}));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return Demo;
|
|
61
|
+
}(React.Component);
|
|
62
|
+
|
|
63
|
+
export { Demo as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { default as data } from './index.json';
|
|
2
|
+
import { Component } from 'intact';
|
|
3
|
+
import './index.styl';
|
|
4
|
+
interface Props {
|
|
5
|
+
value1?: number;
|
|
6
|
+
value2?: number;
|
|
7
|
+
}
|
|
8
|
+
export default class extends Component<Props> {
|
|
9
|
+
static template: string | import("intact").Template<any>;
|
|
10
|
+
static defaults(): {
|
|
11
|
+
value1: number;
|
|
12
|
+
value2: number;
|
|
13
|
+
};
|
|
14
|
+
disableBtn(page: number, limit: number): boolean;
|
|
15
|
+
disablePage(page: number, limit: number): boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
export { default as data } from './index.json';
|
|
3
|
+
import { Component } from 'intact';
|
|
4
|
+
import template from './index.vdt';
|
|
5
|
+
import './index.styl';
|
|
6
|
+
|
|
7
|
+
var default_1 = /*#__PURE__*/function (_Component) {
|
|
8
|
+
_inheritsLoose(default_1, _Component);
|
|
9
|
+
|
|
10
|
+
function default_1() {
|
|
11
|
+
return _Component.apply(this, arguments) || this;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
default_1.defaults = function defaults() {
|
|
15
|
+
return {
|
|
16
|
+
value1: 10,
|
|
17
|
+
value2: 10
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
var _proto = default_1.prototype;
|
|
22
|
+
|
|
23
|
+
_proto.disableBtn = function disableBtn(page, limit) {
|
|
24
|
+
return page > 10;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
_proto.disablePage = function disablePage(page, limit) {
|
|
28
|
+
return page > 10;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return default_1;
|
|
32
|
+
}(Component);
|
|
33
|
+
|
|
34
|
+
default_1.template = template;
|
|
35
|
+
export { default_1 as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.styl';
|
|
3
|
+
interface Props {
|
|
4
|
+
value1?: number;
|
|
5
|
+
value2?: number;
|
|
6
|
+
}
|
|
7
|
+
export default class Demo extends React.Component<{}, Props> {
|
|
8
|
+
state: {
|
|
9
|
+
value1: number;
|
|
10
|
+
value2: number;
|
|
11
|
+
};
|
|
12
|
+
disableBtn(page: number, limit: number): boolean;
|
|
13
|
+
disablePage(page: number, limit: number): boolean;
|
|
14
|
+
render(): JSX.Element;
|
|
15
|
+
}
|
|
16
|
+
export {};
|