@king-design/react 3.0.0-beta.0 → 3.0.0-beta.2
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/__tests__/__snapshots__/Dialog.md +1 -1
- package/__tests__/__snapshots__/React Demos.md +468 -309
- package/__tests__/components/cascader.spec.tsx +53 -0
- package/__tests__/components/drawer.spec.tsx +67 -5
- package/components/button/index.d.ts +1 -1
- package/components/button/index.js +1 -1
- package/components/button/styles.d.ts +1 -1
- package/components/button/styles.js +3 -5
- package/components/carousel/index.vdt.js +2 -2
- package/components/cascader/index.d.ts +22 -11
- package/components/cascader/index.js +9 -12
- package/components/cascader/index.spec.js +81 -0
- package/components/cascader/index.vdt.js +11 -9
- package/components/cascader/styles.js +1 -1
- package/components/cascader/useFields.d.ts +2 -0
- package/components/cascader/useFields.js +18 -0
- package/components/cascader/useFilterable.d.ts +2 -1
- package/components/cascader/useFilterable.js +17 -6
- package/components/cascader/useLabel.d.ts +2 -1
- package/components/cascader/useLabel.js +4 -4
- package/components/cascader/useLoad.d.ts +2 -1
- package/components/cascader/useLoad.js +9 -7
- package/components/collapse/item.vdt.js +1 -1
- package/components/colorpicker/index.d.ts +2 -0
- package/components/colorpicker/index.js +7 -2
- package/components/colorpicker/index.vdt.js +3 -6
- package/components/copy/index.d.ts +17 -0
- package/components/copy/index.js +43 -0
- package/components/copy/index.spec.d.ts +1 -0
- package/components/copy/index.spec.js +52 -0
- package/components/copy/index.vdt.js +45 -0
- package/components/copy/styles.d.ts +2 -0
- package/components/copy/styles.js +14 -0
- package/components/copy/useCopy.d.ts +4 -0
- package/components/copy/useCopy.js +90 -0
- package/components/datepicker/calendar.vdt.js +6 -6
- package/components/datepicker/index.spec.js +171 -153
- package/components/datepicker/index.vdt.js +1 -1
- package/components/datepicker/styles.js +1 -1
- package/components/datepicker/useValue.d.ts +3 -3
- package/components/datepicker/useValue.js +38 -9
- package/components/diagram/shapes/callout.d.ts +1 -1
- package/components/diagram/shapes/circle.d.ts +1 -1
- package/components/diagram/shapes/document.d.ts +1 -1
- package/components/diagram/shapes/ellipse.d.ts +1 -1
- package/components/diagram/shapes/hexagon.d.ts +1 -1
- package/components/diagram/shapes/image.d.ts +1 -1
- package/components/diagram/shapes/parallelogram.d.ts +1 -1
- package/components/diagram/shapes/rectangle.d.ts +1 -1
- package/components/diagram/shapes/square.d.ts +1 -1
- package/components/diagram/shapes/text.d.ts +1 -1
- package/components/dialog/alert.vdt.js +6 -5
- package/components/dialog/index.spec.js +6 -6
- package/components/dialog/styles.js +1 -1
- package/components/dropdown/dropdown.d.ts +6 -6
- package/components/dropdown/dropdown.js +58 -75
- package/components/dropdown/index.spec.js +96 -17
- package/components/dropdown/item.d.ts +1 -1
- package/components/dropdown/item.js +19 -7
- package/components/dropdown/menu.js +1 -1
- package/components/dropdown/usePosition.js +11 -2
- package/components/editable/index.d.ts +1 -0
- package/components/editable/index.js +20 -6
- package/components/editable/index.vdt.js +2 -1
- package/components/form/index.spec.js +4 -2
- package/components/form/item.vdt.js +2 -1
- package/components/form/styles.js +4 -4
- package/components/grid/useGutter.js +8 -8
- package/components/icon/styles.js +1 -1
- package/components/input/index.d.ts +13 -2
- package/components/input/index.js +16 -13
- package/components/input/index.spec.js +169 -1
- package/components/input/index.vdt.js +44 -12
- package/components/input/search.vdt.js +2 -4
- package/components/input/styles.js +30 -6
- package/components/input/useAutoRows.d.ts +2 -0
- package/components/input/useAutoRows.js +79 -0
- package/components/input/useAutoWidth.js +13 -3
- package/components/input/useFocus.d.ts +4 -0
- package/components/input/useFocus.js +21 -0
- package/components/input/useShowPassword.d.ts +7 -0
- package/components/input/useShowPassword.js +31 -0
- package/components/menu/index.spec.js +26 -15
- package/components/menu/item.d.ts +2 -0
- package/components/menu/item.js +5 -0
- package/components/menu/item.vdt.js +4 -1
- package/components/pagination/index.d.ts +1 -1
- package/components/pagination/index.js +3 -2
- package/components/pagination/index.spec.js +49 -0
- package/components/pagination/index.vdt.js +10 -12
- package/components/pagination/styles.js +1 -1
- package/components/popover/content.d.ts +19 -0
- package/components/popover/content.js +31 -0
- package/components/popover/content.vdt.js +68 -0
- package/components/popover/index.d.ts +16 -0
- package/components/popover/index.js +44 -0
- package/components/popover/index.spec.d.ts +1 -0
- package/components/popover/index.spec.js +195 -0
- package/components/popover/styles.d.ts +1 -0
- package/components/popover/styles.js +22 -0
- package/components/portal.d.ts +6 -2
- package/components/portal.js +4 -3
- package/components/position.js +2 -1
- package/components/progress/index.js +1 -1
- package/components/progress/index.vdt.js +46 -8
- package/components/progress/styles.js +19 -13
- package/components/rate/styles.js +1 -1
- package/components/select/base.d.ts +7 -3
- package/components/select/base.js +9 -3
- package/components/select/base.vdt.js +75 -47
- package/components/select/index.spec.js +25 -13
- package/components/select/menu.vdt.js +6 -6
- package/components/select/option.vdt.js +2 -1
- package/components/select/styles.js +11 -5
- package/components/select/useDraggble.d.ts +2 -0
- package/components/select/useDraggble.js +11 -0
- package/components/slider/index.spec.js +48 -9
- package/components/slider/index.vdt.js +23 -12
- package/components/slider/styles.js +23 -14
- package/components/slider/useValue.d.ts +3 -1
- package/components/slider/useValue.js +12 -0
- package/components/spinner/index.d.ts +0 -1
- package/components/spinner/index.js +1 -19
- package/components/spinner/index.vdt.js +13 -8
- package/components/spinner/styles.js +2 -2
- package/components/spinner/useChange.d.ts +1 -1
- package/components/spinner/useChange.js +2 -2
- package/components/spinner/useValue.d.ts +1 -0
- package/components/spinner/useValue.js +16 -1
- package/components/split/index.vdt.js +32 -20
- package/components/split/memo.d.ts +9 -0
- package/components/split/memo.js +26 -0
- package/components/steps/index.d.ts +1 -0
- package/components/steps/index.js +2 -1
- package/components/steps/index.spec.js +1 -1
- package/components/steps/index.vdt.js +7 -4
- package/components/steps/step.vdt.js +2 -3
- package/components/steps/styles.d.ts +1 -0
- package/components/steps/styles.js +50 -17
- package/components/switch/index.spec.js +82 -65
- package/components/table/cell.js +1 -6
- package/components/table/cell.vdt.js +1 -1
- package/components/table/column.vdt.js +40 -24
- package/components/table/index.spec.js +162 -20
- package/components/table/row.d.ts +1 -1
- package/components/table/row.js +2 -1
- package/components/table/styles.js +16 -9
- package/components/table/table.d.ts +15 -0
- package/components/table/table.js +16 -7
- package/components/table/table.vdt.js +20 -6
- package/components/table/useChecked.d.ts +3 -2
- package/components/table/useChecked.js +23 -12
- package/components/table/useDisableRow.d.ts +2 -1
- package/components/table/useDisableRow.js +4 -4
- package/components/table/useDraggable.d.ts +3 -2
- package/components/table/useDraggable.js +11 -15
- package/components/table/useGroup.d.ts +9 -3
- package/components/table/useGroup.js +48 -37
- package/components/table/useMerge.d.ts +2 -1
- package/components/table/useMerge.js +5 -4
- package/components/table/usePagination.d.ts +8 -0
- package/components/table/usePagination.js +81 -0
- package/components/table/useStickyScrollbar.js +2 -2
- package/components/table/useTree.d.ts +2 -1
- package/components/table/useTree.js +3 -4
- package/components/table/useWidth.js +2 -2
- package/components/tabs/index.d.ts +1 -1
- package/components/tabs/index.js +1 -1
- package/components/tabs/index.spec.js +67 -0
- package/components/tabs/index.vdt.js +9 -4
- package/components/tabs/styles.js +32 -34
- package/components/tabs/useScroll.d.ts +1 -1
- package/components/tabs/useScroll.js +75 -48
- package/components/tag/base.d.ts +1 -0
- package/components/tag/base.js +1 -1
- package/components/tag/index.d.ts +1 -0
- package/components/tag/index.js +2 -1
- package/components/tag/index.spec.js +147 -4
- package/components/tag/styles.d.ts +67 -0
- package/components/tag/styles.js +33 -8
- package/components/tag/tags.d.ts +27 -0
- package/components/tag/tags.js +51 -0
- package/components/tag/tags.vdt.js +91 -0
- package/components/tag/useChildren.d.ts +2 -0
- package/components/tag/useChildren.js +39 -0
- package/components/tag/useDraggable.d.ts +3 -0
- package/components/tag/useDraggable.js +89 -0
- package/components/tag/useNowrap.d.ts +7 -0
- package/components/tag/useNowrap.js +115 -0
- package/components/timepicker/index.spec.js +1 -1
- package/components/tooltip/content.d.ts +3 -2
- package/components/tooltip/content.js +18 -1
- package/components/tooltip/content.vdt.js +22 -10
- package/components/tooltip/index.spec.js +147 -92
- package/components/tooltip/styles.d.ts +23 -0
- package/components/tooltip/styles.js +2 -2
- package/components/tooltip/tooltip.d.ts +1 -1
- package/components/tooltip/tooltip.js +11 -11
- package/components/transfer/index.vdt.js +14 -3
- package/components/types.d.ts +1 -0
- package/components/upload/index.spec.js +5 -6
- package/components/upload/index.vdt.js +7 -5
- package/components/utils.d.ts +2 -0
- package/components/utils.js +24 -3
- package/components/virtual.d.ts +8 -0
- package/components/virtual.js +126 -0
- package/hooks/useResizeObserver.d.ts +1 -1
- package/hooks/useResizeObserver.js +19 -6
- package/i18n/en-US.d.ts +4 -1
- package/i18n/en-US.js +6 -2
- package/index.d.ts +5 -3
- package/index.js +5 -3
- package/package.json +2 -2
- package/styles/fonts/iconfont.eot +0 -0
- package/styles/fonts/iconfont.js +2 -2
- package/styles/fonts/iconfont.svg +35 -35
- package/styles/fonts/iconfont.ttf +0 -0
- package/styles/fonts/iconfont.woff +0 -0
- package/styles/fonts/ionicons.js +3 -3
- package/styles/global.js +1 -1
- package/yarn-error.log +41 -43
- package/components/table/useResizeObserver.d.ts +0 -2
- package/components/table/useResizeObserver.js +0 -20
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
3
|
import { useInstance } from 'intact-react';
|
|
4
|
-
export function useLoad() {
|
|
4
|
+
export function useLoad(getField) {
|
|
5
5
|
var instance = useInstance();
|
|
6
6
|
|
|
7
7
|
function loadData(_x) {
|
|
@@ -10,7 +10,7 @@ export function useLoad() {
|
|
|
10
10
|
|
|
11
11
|
function _loadData() {
|
|
12
12
|
_loadData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(item) {
|
|
13
|
-
var _instance$get, loadData;
|
|
13
|
+
var _instance$get, loadData, children;
|
|
14
14
|
|
|
15
15
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
16
16
|
while (1) {
|
|
@@ -26,19 +26,21 @@ export function useLoad() {
|
|
|
26
26
|
return _context.abrupt("return");
|
|
27
27
|
|
|
28
28
|
case 3:
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
children = getField(item, 'children');
|
|
30
|
+
|
|
31
|
+
if (!(children && !children.length && !item.loaded)) {
|
|
32
|
+
_context.next = 9;
|
|
31
33
|
break;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
_context.next =
|
|
36
|
+
_context.next = 7;
|
|
35
37
|
return loadData(item);
|
|
36
38
|
|
|
37
|
-
case
|
|
39
|
+
case 7:
|
|
38
40
|
item.loaded = true;
|
|
39
41
|
instance.forceUpdate();
|
|
40
42
|
|
|
41
|
-
case
|
|
43
|
+
case 9:
|
|
42
44
|
case "end":
|
|
43
45
|
return _context.stop();
|
|
44
46
|
}
|
|
@@ -39,7 +39,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
39
39
|
|
|
40
40
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
41
41
|
}, __$blocks['title'](_$no)), _$cc(Icon, {
|
|
42
|
-
'className': _$cn((_$cn2 = {}, _$cn2[kls('arrow')] = true, _$cn2['
|
|
42
|
+
'className': _$cn((_$cn2 = {}, _$cn2[kls('arrow')] = true, _$cn2['k-icon-right'] = true, _$cn2)),
|
|
43
43
|
'hoverable': !disabled
|
|
44
44
|
})], 0, _$cn(kls('title')), {
|
|
45
45
|
'ev-click': this.toggle
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component, TypeDefs } from 'intact-react';
|
|
2
2
|
import { Sizes } from '../../styles/utils';
|
|
3
3
|
import { Container } from '../portal';
|
|
4
|
+
import { DropdownProps } from '../dropdown';
|
|
4
5
|
export interface ColorpickerProps {
|
|
5
6
|
value: string;
|
|
6
7
|
presets?: string[];
|
|
@@ -8,6 +9,7 @@ export interface ColorpickerProps {
|
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
container?: Container;
|
|
10
11
|
show?: boolean;
|
|
12
|
+
position?: DropdownProps['position'];
|
|
11
13
|
}
|
|
12
14
|
export interface ColorpickerEvents {
|
|
13
15
|
}
|
|
@@ -2,6 +2,7 @@ import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
|
2
2
|
import { Component } from 'intact-react';
|
|
3
3
|
import template from './index.vdt';
|
|
4
4
|
import { sizes } from '../../styles/utils';
|
|
5
|
+
import { Dropdown } from '../dropdown';
|
|
5
6
|
var typeDefs = {
|
|
6
7
|
value: {
|
|
7
8
|
type: String,
|
|
@@ -11,13 +12,17 @@ var typeDefs = {
|
|
|
11
12
|
size: sizes,
|
|
12
13
|
disabled: Boolean,
|
|
13
14
|
container: [Function, String],
|
|
14
|
-
show: Boolean
|
|
15
|
+
show: Boolean,
|
|
16
|
+
position: Dropdown.typeDefs.position
|
|
15
17
|
};
|
|
16
18
|
|
|
17
19
|
var defaults = function defaults() {
|
|
18
20
|
return {
|
|
19
21
|
presets: ['#D0021B', '#F5A623', '#F8E71C', '#8B572A', '#7ED321', '#417505', '#BD10E0', '#9013FE', '#4A90E2', '#50E3C2', '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF'],
|
|
20
|
-
size: 'default'
|
|
22
|
+
size: 'default',
|
|
23
|
+
position: {
|
|
24
|
+
collision: 'fit'
|
|
25
|
+
}
|
|
21
26
|
};
|
|
22
27
|
};
|
|
23
28
|
|
|
@@ -19,7 +19,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
19
19
|
value = _this$get.value,
|
|
20
20
|
size = _this$get.size,
|
|
21
21
|
disabled = _this$get.disabled,
|
|
22
|
-
container = _this$get.container
|
|
22
|
+
container = _this$get.container,
|
|
23
|
+
position = _this$get.position;
|
|
23
24
|
|
|
24
25
|
var classNameObj = (_classNameObj = {
|
|
25
26
|
'k-colorpicker': true
|
|
@@ -27,11 +28,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
27
28
|
return _$cv('div', _extends({
|
|
28
29
|
'className': _$cn(classNameObj)
|
|
29
30
|
}, getRestProps(this)), _$cc(Dropdown, {
|
|
30
|
-
'position':
|
|
31
|
-
my: 'left top+8',
|
|
32
|
-
at: 'left bottom',
|
|
33
|
-
collision: 'flip'
|
|
34
|
-
},
|
|
31
|
+
'position': position,
|
|
35
32
|
'trigger': 'click',
|
|
36
33
|
'disabled': disabled,
|
|
37
34
|
'container': container,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component, TypeDefs } from 'intact-react';
|
|
2
|
+
import { Events } from '../types';
|
|
3
|
+
export interface CopyProps {
|
|
4
|
+
text: string;
|
|
5
|
+
showMessage?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface CopyEvents {
|
|
8
|
+
success: [string];
|
|
9
|
+
error: [];
|
|
10
|
+
}
|
|
11
|
+
export declare class Copy extends Component<CopyProps, CopyEvents> {
|
|
12
|
+
static template: string | import("intact").Template<any>;
|
|
13
|
+
static typeDefs: Required<TypeDefs<CopyProps>>;
|
|
14
|
+
static defaults: () => Partial<CopyProps>;
|
|
15
|
+
static events: Events<CopyEvents>;
|
|
16
|
+
private copy;
|
|
17
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import { Component } from 'intact-react';
|
|
4
|
+
import template from './index.vdt';
|
|
5
|
+
import { useCopy } from './useCopy';
|
|
6
|
+
var typeDefs = {
|
|
7
|
+
text: String,
|
|
8
|
+
showMessage: Boolean
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
var defaults = function defaults() {
|
|
12
|
+
return {
|
|
13
|
+
showMessage: true
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var events = {
|
|
18
|
+
success: true,
|
|
19
|
+
error: true
|
|
20
|
+
};
|
|
21
|
+
export var Copy = /*#__PURE__*/function (_Component) {
|
|
22
|
+
_inheritsLoose(Copy, _Component);
|
|
23
|
+
|
|
24
|
+
function Copy() {
|
|
25
|
+
var _context;
|
|
26
|
+
|
|
27
|
+
var _this;
|
|
28
|
+
|
|
29
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
30
|
+
args[_key] = arguments[_key];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
34
|
+
_this.copy = useCopy();
|
|
35
|
+
return _this;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return Copy;
|
|
39
|
+
}(Component);
|
|
40
|
+
Copy.template = template;
|
|
41
|
+
Copy.typeDefs = typeDefs;
|
|
42
|
+
Copy.defaults = defaults;
|
|
43
|
+
Copy.events = events;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
|
+
import BasicDemo from '~/components/copy/demos/basic';
|
|
4
|
+
import { mount, unmount } from '../../test/utils';
|
|
5
|
+
describe('Copy', function () {
|
|
6
|
+
afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
7
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
8
|
+
while (1) {
|
|
9
|
+
switch (_context.prev = _context.next) {
|
|
10
|
+
case 0:
|
|
11
|
+
unmount();
|
|
12
|
+
|
|
13
|
+
case 1:
|
|
14
|
+
case "end":
|
|
15
|
+
return _context.stop();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}, _callee);
|
|
19
|
+
})));
|
|
20
|
+
it('should copy', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
21
|
+
var _mount, instance, element, text;
|
|
22
|
+
|
|
23
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
24
|
+
while (1) {
|
|
25
|
+
switch (_context2.prev = _context2.next) {
|
|
26
|
+
case 0:
|
|
27
|
+
_mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
|
|
28
|
+
element.click();
|
|
29
|
+
_context2.prev = 2;
|
|
30
|
+
_context2.next = 5;
|
|
31
|
+
return navigator.clipboard.readText();
|
|
32
|
+
|
|
33
|
+
case 5:
|
|
34
|
+
text = _context2.sent;
|
|
35
|
+
expect(text).to.eql('Hello King Desgin!');
|
|
36
|
+
_context2.next = 12;
|
|
37
|
+
break;
|
|
38
|
+
|
|
39
|
+
case 9:
|
|
40
|
+
_context2.prev = 9;
|
|
41
|
+
_context2.t0 = _context2["catch"](2);
|
|
42
|
+
// Read permisson denied
|
|
43
|
+
console.log(_context2.t0);
|
|
44
|
+
|
|
45
|
+
case 12:
|
|
46
|
+
case "end":
|
|
47
|
+
return _context2.stop();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, _callee2, null, [[2, 9]]);
|
|
51
|
+
})));
|
|
52
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import { createUnknownComponentVNode as _$cc, className as _$cn } from 'intact-react';
|
|
3
|
+
import { Icon } from '../icon';
|
|
4
|
+
import { getRestProps } from '../utils';
|
|
5
|
+
import { Virtual } from '../virtual';
|
|
6
|
+
import { Transition } from 'intact';
|
|
7
|
+
import { makeStyles } from './styles';
|
|
8
|
+
import { _$ } from '../../i18n';
|
|
9
|
+
var _$tmp0 = {
|
|
10
|
+
'key': '2',
|
|
11
|
+
'className': 'k-icon-check',
|
|
12
|
+
'hoverable': true,
|
|
13
|
+
'color': 'success'
|
|
14
|
+
};
|
|
15
|
+
export default function ($props, $blocks, $__proto__) {
|
|
16
|
+
var _classNameObj;
|
|
17
|
+
|
|
18
|
+
$blocks || ($blocks = {});
|
|
19
|
+
$props || ($props = {});
|
|
20
|
+
var $this = this;
|
|
21
|
+
|
|
22
|
+
var _this$get = this.get(),
|
|
23
|
+
children = _this$get.children,
|
|
24
|
+
className = _this$get.className;
|
|
25
|
+
|
|
26
|
+
var _this$copy = this.copy,
|
|
27
|
+
startCopy = _this$copy.startCopy,
|
|
28
|
+
success = _this$copy.success;
|
|
29
|
+
var classNameObj = (_classNameObj = {}, _classNameObj["k-copy"] = true, _classNameObj[makeStyles()] = true, _classNameObj[className] = className, _classNameObj);
|
|
30
|
+
return _$cc(Transition, {
|
|
31
|
+
'name': 'k-fade',
|
|
32
|
+
'children': _$cc(Virtual, _extends({
|
|
33
|
+
'ev-click': startCopy,
|
|
34
|
+
'className': _$cn(classNameObj)
|
|
35
|
+
}, getRestProps(this), {
|
|
36
|
+
'children': children ? children : !success.value ? _$cc(Icon, {
|
|
37
|
+
'key': '1',
|
|
38
|
+
'className': 'k-icon-clone',
|
|
39
|
+
'hoverable': true,
|
|
40
|
+
'title': _$('复制')
|
|
41
|
+
}, '1') : _$cc(Icon, _$tmp0, '2')
|
|
42
|
+
}))
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
+
|
|
3
|
+
import { css } from '@emotion/css';
|
|
4
|
+
import '../../styles/global';
|
|
5
|
+
export function makeStyles() {
|
|
6
|
+
return /*#__PURE__*/css(process.env.NODE_ENV === "production" ? {
|
|
7
|
+
name: "t3aops",
|
|
8
|
+
styles: "cursor:pointer;vertical-align:middle"
|
|
9
|
+
} : {
|
|
10
|
+
name: "t3aops",
|
|
11
|
+
styles: "cursor:pointer;vertical-align:middle",
|
|
12
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Message } from '../message';
|
|
2
|
+
import { useInstance } from 'intact-react';
|
|
3
|
+
import { selectValue } from '../utils';
|
|
4
|
+
import { useState } from '../../hooks/useState';
|
|
5
|
+
import { _$ } from '../../i18n';
|
|
6
|
+
export function useCopy() {
|
|
7
|
+
var instance = useInstance();
|
|
8
|
+
var success = useState(false);
|
|
9
|
+
var timer;
|
|
10
|
+
return {
|
|
11
|
+
startCopy: function startCopy() {
|
|
12
|
+
var _instance$get = instance.get(),
|
|
13
|
+
text = _instance$get.text,
|
|
14
|
+
showMessage = _instance$get.showMessage;
|
|
15
|
+
|
|
16
|
+
if (clipboardCopy(text) || commandCopy(text)) {
|
|
17
|
+
showMessage && Message.success({
|
|
18
|
+
content: _$('复制成功')
|
|
19
|
+
});
|
|
20
|
+
success.set(true);
|
|
21
|
+
clearTimeout(timer);
|
|
22
|
+
timer = window.setTimeout(function () {
|
|
23
|
+
success.set(false);
|
|
24
|
+
}, 1000);
|
|
25
|
+
instance.trigger('success', text);
|
|
26
|
+
} else {
|
|
27
|
+
showMessage && Message.error({
|
|
28
|
+
content: _$('复制失败')
|
|
29
|
+
});
|
|
30
|
+
success.set(false);
|
|
31
|
+
instance.trigger('error');
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
success: success
|
|
35
|
+
};
|
|
36
|
+
} // @reference: https://github.com/zenorocha/clipboard.js/blob/master/src/common/create-fake-element.js
|
|
37
|
+
|
|
38
|
+
function createFakeElement(value) {
|
|
39
|
+
var isRTL = document.documentElement.getAttribute('dir') === 'rtl';
|
|
40
|
+
var fakeElement = document.createElement('textarea'); // Prevent zooming on iOS
|
|
41
|
+
|
|
42
|
+
fakeElement.style.fontSize = '12pt'; // Reset box model
|
|
43
|
+
|
|
44
|
+
fakeElement.style.border = '0';
|
|
45
|
+
fakeElement.style.padding = '0';
|
|
46
|
+
fakeElement.style.margin = '0'; // Move element out of screen horizontally
|
|
47
|
+
|
|
48
|
+
fakeElement.style.position = 'absolute';
|
|
49
|
+
fakeElement.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically
|
|
50
|
+
|
|
51
|
+
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
|
52
|
+
fakeElement.style.top = yPosition + "px";
|
|
53
|
+
fakeElement.setAttribute('readonly', '');
|
|
54
|
+
fakeElement.value = value;
|
|
55
|
+
return fakeElement;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function clipboardCopy(text) {
|
|
59
|
+
try {
|
|
60
|
+
navigator.clipboard.writeText(text);
|
|
61
|
+
return true;
|
|
62
|
+
} catch (e) {
|
|
63
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
64
|
+
console.log(e);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function commandCopy(text) {
|
|
72
|
+
var fakeElement = createFakeElement(text);
|
|
73
|
+
document.body.appendChild(fakeElement);
|
|
74
|
+
selectValue(fakeElement);
|
|
75
|
+
var result;
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
document.execCommand('copy');
|
|
79
|
+
result = true;
|
|
80
|
+
} catch (e) {
|
|
81
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
82
|
+
console.log(e);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
result = false;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
document.body.removeChild(fakeElement);
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
@@ -6,27 +6,27 @@ import { _$ } from '../../i18n';
|
|
|
6
6
|
import { makeCalendarStyles } from './styles';
|
|
7
7
|
import { getNowDate } from './helpers';
|
|
8
8
|
var _$tmp0 = {
|
|
9
|
-
'className': '
|
|
9
|
+
'className': 'k-icon-left',
|
|
10
10
|
'size': 'small'
|
|
11
11
|
};
|
|
12
12
|
var _$tmp1 = {
|
|
13
|
-
'className': '
|
|
13
|
+
'className': 'k-icon-left',
|
|
14
14
|
'size': 'small'
|
|
15
15
|
};
|
|
16
16
|
var _$tmp2 = {
|
|
17
|
-
'className': '
|
|
17
|
+
'className': 'k-icon-left',
|
|
18
18
|
'size': 'small'
|
|
19
19
|
};
|
|
20
20
|
var _$tmp3 = {
|
|
21
|
-
'className': '
|
|
21
|
+
'className': 'k-icon-right',
|
|
22
22
|
'size': 'small'
|
|
23
23
|
};
|
|
24
24
|
var _$tmp4 = {
|
|
25
|
-
'className': '
|
|
25
|
+
'className': 'k-icon-right',
|
|
26
26
|
'size': 'small'
|
|
27
27
|
};
|
|
28
28
|
var _$tmp5 = {
|
|
29
|
-
'className': '
|
|
29
|
+
'className': 'k-icon-right',
|
|
30
30
|
'size': 'small'
|
|
31
31
|
};
|
|
32
32
|
export default function ($props, $blocks, $__proto__) {
|