@king-design/intact 3.1.0-beta.2 → 3.1.0
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/cascader/index.vdt +1 -0
- package/components/config/demos/basic.md +19 -0
- package/components/config/index.md +20 -0
- package/components/config/index.ts +8 -4
- package/components/copy/index.spec.ts +28 -0
- package/components/copy/index.ts +2 -0
- package/components/copy/useCopy.ts +3 -1
- package/components/dialog/base.ts +1 -1
- package/components/dialog/base.vdt +2 -2
- package/components/dialog/index.spec.ts +41 -2
- package/components/dialog/styles.ts +1 -0
- package/components/drawer/index.spec.ts +4 -2
- package/components/icon/demos/icons.md +20 -9
- package/components/input/demos/blocks.md +16 -1
- package/components/input/styles.ts +2 -1
- package/components/menu/demos/basic.md +1 -1
- package/components/menu/item.vdt +17 -2
- package/components/menu/menu.ts +4 -0
- package/components/menu/menu.vdt +1 -1
- package/components/menu/styles.ts +19 -15
- package/components/menu/useDropdown.ts +3 -6
- package/components/portal.ts +6 -1
- package/components/table/row.vdt +2 -2
- package/components/table/styles.ts +2 -0
- package/components/table/table.vdt +1 -1
- package/components/tree/demos/draggable.md +63 -48
- package/components/tree/demos/expandAll.md +36 -8
- package/components/tree/index.md +3 -2
- package/components/tree/index.spec.ts +39 -40
- package/components/tree/index.ts +8 -3
- package/components/tree/styles.ts +2 -0
- package/components/tree/useDraggable.ts +5 -5
- package/components/tree/useExpanded.ts +15 -3
- package/components/tree/useNodes.ts +1 -0
- package/components/treeSelect/index.md +7 -1
- package/components/treeSelect/index.ts +4 -0
- package/components/upload/demos/files.md +14 -12
- package/components/upload/index.md +5 -5
- package/components/upload/index.ts +6 -5
- package/components/upload/useFiles.ts +19 -8
- package/es/components/cascader/index.vdt.js +1 -0
- package/es/components/config/index.d.ts +9 -2
- package/es/components/config/index.js +4 -3
- package/es/components/copy/index.d.ts +1 -0
- package/es/components/copy/index.js +2 -1
- package/es/components/copy/index.spec.js +64 -1
- package/es/components/copy/useCopy.d.ts +1 -1
- package/es/components/copy/useCopy.js +3 -1
- package/es/components/dialog/base.js +1 -1
- package/es/components/dialog/base.vdt.js +3 -3
- package/es/components/dialog/index.spec.js +87 -5
- package/es/components/dialog/styles.js +1 -1
- package/es/components/drawer/index.spec.js +6 -4
- package/es/components/input/styles.js +1 -1
- package/es/components/menu/item.vdt.js +22 -2
- package/es/components/menu/menu.d.ts +1 -0
- package/es/components/menu/menu.js +2 -1
- package/es/components/menu/menu.vdt.js +1 -1
- package/es/components/menu/styles.d.ts +1 -0
- package/es/components/menu/styles.js +10 -2
- package/es/components/menu/useDropdown.js +3 -6
- package/es/components/portal.js +7 -1
- package/es/components/table/row.vdt.js +1 -1
- package/es/components/table/styles.js +3 -2
- package/es/components/table/table.vdt.js +1 -1
- package/es/components/tree/index.d.ts +5 -3
- package/es/components/tree/index.js +5 -0
- package/es/components/tree/index.spec.js +60 -39
- package/es/components/tree/styles.js +1 -1
- package/es/components/tree/useDraggable.js +12 -12
- package/es/components/tree/useExpanded.d.ts +1 -0
- package/es/components/tree/useExpanded.js +23 -7
- package/es/components/tree/useNodes.d.ts +1 -0
- package/es/components/treeSelect/index.d.ts +1 -0
- package/es/components/treeSelect/index.js +4 -0
- package/es/components/upload/index.d.ts +6 -5
- package/es/components/upload/index.js +1 -0
- package/es/components/upload/useFiles.js +21 -8
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/config/demos/basic/index.d.ts +5 -0
- package/es/site/data/components/config/demos/basic/index.js +17 -0
- package/es/site/data/components/config/demos/basic/react.d.ts +4 -0
- package/es/site/data/components/config/demos/basic/react.js +29 -0
- package/es/site/data/components/config/index.d.ts +57 -0
- package/es/site/data/components/config/index.js +42 -0
- package/es/site/data/components/icon/demos/icons/index.js +3 -2
- package/es/site/data/components/input/demos/blocks/react.js +11 -1
- package/es/site/data/components/menu/demos/basic/react.js +2 -2
- package/es/site/data/components/tree/demos/draggable/index.d.ts +23 -17
- package/es/site/data/components/tree/demos/draggable/index.js +45 -35
- package/es/site/data/components/tree/demos/draggable/react.d.ts +23 -17
- package/es/site/data/components/tree/demos/draggable/react.js +55 -36
- package/es/site/data/components/tree/demos/expandAll/index.d.ts +9 -1
- package/es/site/data/components/tree/demos/expandAll/index.js +14 -2
- package/es/site/data/components/tree/demos/expandAll/react.d.ts +10 -1
- package/es/site/data/components/tree/demos/expandAll/react.js +24 -5
- package/es/site/data/components/upload/demos/files/index.d.ts +2 -5
- package/es/site/data/components/upload/demos/files/index.js +5 -1
- package/es/site/data/components/upload/demos/files/react.d.ts +2 -5
- package/es/site/data/components/upload/demos/files/react.js +13 -2
- package/es/site/src/pages/document/styles.js +1 -1
- package/index.ts +2 -2
- package/package.json +2 -2
- package/es/site/data/components/icon/demos/icons/react.d.ts +0 -15
- package/es/site/data/components/icon/demos/icons/react.js +0 -107
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { ProviderProps } from '../context';
|
|
2
|
+
import { Component } from 'intact';
|
|
2
3
|
export interface ConfigProps {
|
|
3
4
|
classNamePrefix?: string;
|
|
4
5
|
}
|
|
5
|
-
declare const
|
|
6
|
+
declare const ConfigConsumer: import("intact").ComponentConstructor<Component<import("../context").ConsumerProps<ConfigProps>, {}, {}, {}>>;
|
|
6
7
|
declare function useConfigContext(): {
|
|
7
8
|
cls: (name: string) => string;
|
|
8
9
|
readonly k: string;
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
+
/**
|
|
12
|
+
* for vue/react type checking
|
|
13
|
+
*/
|
|
14
|
+
export declare class _ConfigProvider extends Component<ProviderProps<ConfigProps>> {
|
|
15
|
+
}
|
|
16
|
+
export declare const ConfigProvider: typeof _ConfigProvider;
|
|
17
|
+
export { ConfigConsumer, useConfigContext, };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createContext } from '../context';
|
|
2
|
-
import { EMPTY_OBJ } from 'intact';
|
|
2
|
+
import { EMPTY_OBJ, Component } from 'intact';
|
|
3
3
|
|
|
4
4
|
var _createContext = createContext(EMPTY_OBJ),
|
|
5
|
-
|
|
5
|
+
Provider = _createContext.Provider,
|
|
6
6
|
ConfigConsumer = _createContext.Consumer,
|
|
7
7
|
useContext = _createContext.useContext;
|
|
8
8
|
|
|
@@ -20,4 +20,5 @@ function useConfigContext() {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export
|
|
23
|
+
export var ConfigProvider = Provider;
|
|
24
|
+
export { ConfigConsumer, useConfigContext };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
2
4
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
5
|
import BasicDemo from '~/components/copy/demos/basic';
|
|
4
|
-
import { mount, unmount } from '../../test/utils';
|
|
6
|
+
import { mount, unmount, wait } from '../../test/utils';
|
|
7
|
+
import { Tooltip } from '../tooltip';
|
|
8
|
+
import { Component } from 'intact';
|
|
9
|
+
import { Copy } from '.';
|
|
5
10
|
describe('Copy', function () {
|
|
6
11
|
afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
7
12
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -49,4 +54,62 @@ describe('Copy', function () {
|
|
|
49
54
|
}
|
|
50
55
|
}, _callee2, null, [[2, 9]]);
|
|
51
56
|
})));
|
|
57
|
+
it('wrap copy with tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
58
|
+
var Demo, _mount2, instance, element, text;
|
|
59
|
+
|
|
60
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context4) {
|
|
61
|
+
while (1) {
|
|
62
|
+
switch (_context4.prev = _context4.next) {
|
|
63
|
+
case 0:
|
|
64
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
65
|
+
_inheritsLoose(Demo, _Component);
|
|
66
|
+
|
|
67
|
+
function Demo() {
|
|
68
|
+
var _context3;
|
|
69
|
+
|
|
70
|
+
var _this;
|
|
71
|
+
|
|
72
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
73
|
+
args[_key] = arguments[_key];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context3 = [this]).call(_context3, args)) || this;
|
|
77
|
+
_this.Tooltip = Tooltip;
|
|
78
|
+
_this.Copy = Copy;
|
|
79
|
+
return _this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return Demo;
|
|
83
|
+
}(Component);
|
|
84
|
+
|
|
85
|
+
Demo.template = "\n const { Tooltip, Copy } = this;\n <Tooltip content=\"test\">\n <Copy text=\"test\" />\n </Tooltip>\n ";
|
|
86
|
+
_mount2 = mount(Demo), instance = _mount2[0], element = _mount2[1];
|
|
87
|
+
element.click();
|
|
88
|
+
_context4.next = 6;
|
|
89
|
+
return wait();
|
|
90
|
+
|
|
91
|
+
case 6:
|
|
92
|
+
_context4.prev = 6;
|
|
93
|
+
_context4.next = 9;
|
|
94
|
+
return navigator.clipboard.readText();
|
|
95
|
+
|
|
96
|
+
case 9:
|
|
97
|
+
text = _context4.sent;
|
|
98
|
+
expect(text).to.eql('test');
|
|
99
|
+
_context4.next = 16;
|
|
100
|
+
break;
|
|
101
|
+
|
|
102
|
+
case 13:
|
|
103
|
+
_context4.prev = 13;
|
|
104
|
+
_context4.t0 = _context4["catch"](6);
|
|
105
|
+
// Read permisson denied
|
|
106
|
+
console.log(_context4.t0);
|
|
107
|
+
|
|
108
|
+
case 16:
|
|
109
|
+
case "end":
|
|
110
|
+
return _context4.stop();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}, _callee3, null, [[6, 13]]);
|
|
114
|
+
})));
|
|
52
115
|
});
|
|
@@ -8,7 +8,7 @@ export function useCopy() {
|
|
|
8
8
|
var success = useState(false);
|
|
9
9
|
var timer;
|
|
10
10
|
return {
|
|
11
|
-
startCopy: function startCopy() {
|
|
11
|
+
startCopy: function startCopy(e) {
|
|
12
12
|
var _instance$get = instance.get(),
|
|
13
13
|
text = _instance$get.text,
|
|
14
14
|
showMessage = _instance$get.showMessage;
|
|
@@ -30,6 +30,8 @@ export function useCopy() {
|
|
|
30
30
|
success.set(false);
|
|
31
31
|
instance.trigger('error');
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
instance.trigger('click', e);
|
|
33
35
|
},
|
|
34
36
|
success: success
|
|
35
37
|
};
|
|
@@ -142,7 +142,7 @@ export var BaseDialog = /*#__PURE__*/function (_Component) {
|
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
_proto.onClickWrapper = function onClickWrapper(e) {
|
|
145
|
-
if (this.get('closable')) {
|
|
145
|
+
if (this.get('closable') && e.target === this.overlayRef.value) {
|
|
146
146
|
this.terminate();
|
|
147
147
|
}
|
|
148
148
|
};
|
|
@@ -123,15 +123,15 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
123
123
|
|
|
124
124
|
return _$cc(Portal, {
|
|
125
125
|
'container': container,
|
|
126
|
-
'children': _$ce(2, 'div',
|
|
126
|
+
'children': _$ce(2, 'div', overlay ? _$cc(Transition, {
|
|
127
127
|
'key': 'overlay',
|
|
128
128
|
'show': overlay ? value : false,
|
|
129
129
|
'appear': value,
|
|
130
130
|
'name': 'k-fade',
|
|
131
|
-
'children': _$ce(2, 'div',
|
|
131
|
+
'children': _$ce(2, 'div', dialog, 0, _$cn(k + "-dialog-overlay"), {
|
|
132
132
|
'ev-click': this.onClickWrapper
|
|
133
133
|
}, null, this.overlayRef)
|
|
134
|
-
}, 'overlay') :
|
|
134
|
+
}, 'overlay') : dialog, 0, _$cn((_$cn2 = {}, _$cn2[k + "-dialog-wrapper"] = true, _$cn2[k + "-open"] = value, _$cn2[makeWrapperStyles(k)] = true, _$cn2)))
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
;
|
|
@@ -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 _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); }
|
|
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
|
|
|
@@ -19,7 +19,7 @@ import { __decorate } from "tslib";
|
|
|
19
19
|
import { Component } from 'intact';
|
|
20
20
|
import { Dialog, BaseDialog } from './';
|
|
21
21
|
import { bind } from '../utils';
|
|
22
|
-
import { getElement, mount, unmount, dispatchEvent, wait } from '../../test/utils';
|
|
22
|
+
import { getElement, mount, unmount, dispatchEvent, wait, getElements } from '../../test/utils';
|
|
23
23
|
import BasicDemo from '~/components/dialog/demos/basic';
|
|
24
24
|
import AsyncCloseDemo from '~/components/dialog/demos/asyncClose';
|
|
25
25
|
import TerminateDemo from '~/components/dialog/demos/terminate';
|
|
@@ -594,7 +594,7 @@ describe('Dialog', function () {
|
|
|
594
594
|
}, _callee12);
|
|
595
595
|
})));
|
|
596
596
|
it('should remove body style when destroy', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
|
|
597
|
-
var Demo, _mount13, instance, element;
|
|
597
|
+
var Demo, _mount13, instance, element, style;
|
|
598
598
|
|
|
599
599
|
return _regeneratorRuntime.wrap(function _callee13$(_context17) {
|
|
600
600
|
while (1) {
|
|
@@ -642,14 +642,96 @@ describe('Dialog', function () {
|
|
|
642
642
|
return wait();
|
|
643
643
|
|
|
644
644
|
case 7:
|
|
645
|
-
|
|
645
|
+
style = document.body.getAttribute('style');
|
|
646
|
+
expect(style === null || style === '').to.be.true;
|
|
646
647
|
|
|
647
|
-
case
|
|
648
|
+
case 9:
|
|
648
649
|
case "end":
|
|
649
650
|
return _context17.stop();
|
|
650
651
|
}
|
|
651
652
|
}
|
|
652
653
|
}, _callee13);
|
|
654
|
+
})));
|
|
655
|
+
it('show nested dialog', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
|
|
656
|
+
var Test, Demo, _mount14, instance, element, _getElements, dialog1, dialog2;
|
|
657
|
+
|
|
658
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context20) {
|
|
659
|
+
while (1) {
|
|
660
|
+
switch (_context20.prev = _context20.next) {
|
|
661
|
+
case 0:
|
|
662
|
+
Test = /*#__PURE__*/function (_Component5) {
|
|
663
|
+
_inheritsLoose(Test, _Component5);
|
|
664
|
+
|
|
665
|
+
function Test() {
|
|
666
|
+
var _context18;
|
|
667
|
+
|
|
668
|
+
var _this5;
|
|
669
|
+
|
|
670
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
671
|
+
args[_key5] = arguments[_key5];
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
_this5 = _Component5.call.apply(_Component5, _concatInstanceProperty(_context18 = [this]).call(_context18, args)) || this;
|
|
675
|
+
_this5.Dialog = Dialog;
|
|
676
|
+
return _this5;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
return Test;
|
|
680
|
+
}(Component);
|
|
681
|
+
|
|
682
|
+
Test.template = "\n const { Dialog } = this;\n <Dialog v-model=\"value\">test</Dialog>\n ";
|
|
683
|
+
|
|
684
|
+
Demo = /*#__PURE__*/function (_Component6) {
|
|
685
|
+
_inheritsLoose(Demo, _Component6);
|
|
686
|
+
|
|
687
|
+
function Demo() {
|
|
688
|
+
var _context19;
|
|
689
|
+
|
|
690
|
+
var _this6;
|
|
691
|
+
|
|
692
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
693
|
+
args[_key6] = arguments[_key6];
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
_this6 = _Component6.call.apply(_Component6, _concatInstanceProperty(_context19 = [this]).call(_context19, args)) || this;
|
|
697
|
+
_this6.Test = Test;
|
|
698
|
+
_this6.Dialog = Dialog;
|
|
699
|
+
return _this6;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
var _proto2 = Demo.prototype;
|
|
703
|
+
|
|
704
|
+
_proto2.showTest = function showTest() {
|
|
705
|
+
this.set('testShow', true);
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
return Demo;
|
|
709
|
+
}(Component);
|
|
710
|
+
|
|
711
|
+
Demo.template = "\n const { Test, Dialog } = this;\n <Dialog v-model=\"show\">\n <div ev-click={this.showTest}>click</div>\n <Test v-model=\"testShow\" /> \n </Dialog>\n ";
|
|
712
|
+
|
|
713
|
+
__decorate([bind], Demo.prototype, "showTest", null);
|
|
714
|
+
|
|
715
|
+
_mount14 = mount(Demo), instance = _mount14[0], element = _mount14[1];
|
|
716
|
+
instance.set('show', true);
|
|
717
|
+
_context20.next = 9;
|
|
718
|
+
return wait();
|
|
719
|
+
|
|
720
|
+
case 9:
|
|
721
|
+
instance.showTest();
|
|
722
|
+
_context20.next = 12;
|
|
723
|
+
return wait();
|
|
724
|
+
|
|
725
|
+
case 12:
|
|
726
|
+
_getElements = getElements('.k-dialog'), dialog1 = _getElements[0], dialog2 = _getElements[1];
|
|
727
|
+
expect(dialog2.querySelector('.k-dialog-body').textContent).to.eql('test');
|
|
728
|
+
|
|
729
|
+
case 14:
|
|
730
|
+
case "end":
|
|
731
|
+
return _context20.stop();
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}, _callee14);
|
|
653
735
|
}))); // it('should handle v-if and v-model at the same time correctly in Vue', async () => {
|
|
654
736
|
// const Test = {
|
|
655
737
|
// template: `<Dialog v-model="show" v-if="show" ref="dialog">test</Dialog>`,
|
|
@@ -92,7 +92,7 @@ export function makeDialogStyles(k) {
|
|
|
92
92
|
export function makeWrapperStyles(k) {
|
|
93
93
|
//.${k}-fade-leave-active will add position absolute to the styles
|
|
94
94
|
// so we must set fixed with important to .${k}-dialog-overlay
|
|
95
|
-
return /*#__PURE__*/css("position:absolute;z-index:", theme.maxZIndex, ";top:0;left:0;width:100%;.", k, "-dialog-overlay{position:fixed!important;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, .5);}");
|
|
95
|
+
return /*#__PURE__*/css("position:absolute;z-index:", theme.maxZIndex, ";top:0;left:0;width:100%;.", k, "-dialog-overlay{position:fixed!important;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, .5);overflow:auto;}");
|
|
96
96
|
}
|
|
97
97
|
export function makeAlertStyles(k) {
|
|
98
98
|
var _context2;
|
|
@@ -5,7 +5,7 @@ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
|
5
5
|
import BasicDemo from '~/components/drawer/demos/basic';
|
|
6
6
|
import PlacementDemo from '~/components/drawer/demos/placement';
|
|
7
7
|
import overlayDemo from '~/components/drawer/demos/overlay';
|
|
8
|
-
import { mount, unmount, dispatchEvent, getElement, wait } from '../../test/utils';
|
|
8
|
+
import { mount, unmount, dispatchEvent, getElement, wait, getElements } from '../../test/utils';
|
|
9
9
|
import { Component } from 'intact';
|
|
10
10
|
import { Drawer } from '.';
|
|
11
11
|
import { Dialog } from '../dialog';
|
|
@@ -165,7 +165,7 @@ describe('Drawer', function () {
|
|
|
165
165
|
}, _callee4);
|
|
166
166
|
})));
|
|
167
167
|
it('nested dialog', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
168
|
-
var Demo, _mount4, instance, element;
|
|
168
|
+
var Demo, _mount4, instance, element, _getElements, dialog1, dialog2;
|
|
169
169
|
|
|
170
170
|
return _regeneratorRuntime.wrap(function _callee5$(_context6) {
|
|
171
171
|
while (1) {
|
|
@@ -198,9 +198,11 @@ describe('Drawer', function () {
|
|
|
198
198
|
return wait();
|
|
199
199
|
|
|
200
200
|
case 5:
|
|
201
|
-
expect(instance.refs.dialog.dialogRef.value.parentElement.parentElement).to.eql(document.body);
|
|
201
|
+
// expect(instance.refs.dialog.dialogRef.value.parentElement.parentElement).to.eql(document.body);
|
|
202
|
+
_getElements = getElements('.k-dialog'), dialog1 = _getElements[0], dialog2 = _getElements[1];
|
|
203
|
+
expect(dialog2.querySelector('.k-dialog-body').textContent).to.eql('Dialog');
|
|
202
204
|
|
|
203
|
-
case
|
|
205
|
+
case 7:
|
|
204
206
|
case "end":
|
|
205
207
|
return _context6.stop();
|
|
206
208
|
}
|
|
@@ -132,7 +132,7 @@ setDefault(function () {
|
|
|
132
132
|
export function makeStyles(k) {
|
|
133
133
|
var _context;
|
|
134
134
|
|
|
135
|
-
return /*#__PURE__*/css("display:inline-block;width:", input.width, ";color:", input.color, ";vertical-align:middle;.", k, "-input-wrapper{display:inline-flex;align-items:center;width:100%;position:relative;border:", input.border, ";background-color:", input.bgColor, ";transition:border ", input.transition, ",background ", input.transition, ",box-shadow ", input.transition, ";border-radius:", input.borderRadius, ";&:hover{border:", input.hoverBorder, ";z-index:1;}}&.", k, "-focus .", k, "-input-wrapper{border:", input.focusBorder, ";z-index:1;}.", k, "-input-inner{flex:1;outline:none;color:inherit;font-size:inherit;border:none;background:transparent;padding:0;width:0;&::placeholder{color:", input.placeholderColor, ";}}&.", k, "-fluid{width:100%;}.", k, "-input-prefix,.", k, "-input-suffix{display:flex;align-items:center;gap:", input.clearIconGap, ";color:", theme.color.lightBlack, ";position:relative;}.", k, "-input-prefix{margin-right:", input.clearIconGap, ";}.", k, "-input-suffix{margin-left:", input.clearIconGap, ";}.", k, "-input-clear{opacity:0;transition:opacity ", input.transition, ";pointer-events:none;color:", input.clearIconColor, ";}&:hover .", k, "-input-clear.", k, "-input-show{opacity:1;pointer-events:all;}.", k, "-input-show-password{color:", input.clearIconColor, ";}&.", k, "-stack-clear{.", k, "-input-clear{position:absolute;z-index:1;right:0;&.", k, "-input-show+*{transition:opacity ", input.transition, ";}}&:hover{.", k, "-input-clear.", k, "-input-show+*{opacity:0;}}}&.", k, "-group{display:inline-flex;.", k, "-input-wrapper{border-radius:0;}.", k, "-input-wrapper:first-child{border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";}.", k, "-input-wrapper:last-child{border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;}}.", k, "-input-prepend,.", k, "-input-append{display:inline-flex;align-items:center;background-color:", input.groupBgColor, ";border:", input.border, ";white-space:nowrap;.", k, "-btn{margin:-1px
|
|
135
|
+
return /*#__PURE__*/css("display:inline-block;width:", input.width, ";color:", input.color, ";vertical-align:middle;.", k, "-input-wrapper{display:inline-flex;align-items:center;width:100%;position:relative;border:", input.border, ";background-color:", input.bgColor, ";transition:border ", input.transition, ",background ", input.transition, ",box-shadow ", input.transition, ";border-radius:", input.borderRadius, ";&:hover{border:", input.hoverBorder, ";z-index:1;}}&.", k, "-focus .", k, "-input-wrapper{border:", input.focusBorder, ";z-index:1;}.", k, "-input-inner{flex:1;outline:none;color:inherit;font-size:inherit;border:none;background:transparent;padding:0;width:0;&::placeholder{color:", input.placeholderColor, ";}}&.", k, "-fluid{width:100%;}.", k, "-input-prefix,.", k, "-input-suffix{display:flex;align-items:center;gap:", input.clearIconGap, ";color:", theme.color.lightBlack, ";position:relative;}.", k, "-input-prefix{margin-right:", input.clearIconGap, ";}.", k, "-input-suffix{margin-left:", input.clearIconGap, ";}.", k, "-input-clear{opacity:0;transition:opacity ", input.transition, ";pointer-events:none;color:", input.clearIconColor, ";}&:hover .", k, "-input-clear.", k, "-input-show{opacity:1;pointer-events:all;}.", k, "-input-show-password{color:", input.clearIconColor, ";}&.", k, "-stack-clear{.", k, "-input-clear{position:absolute;z-index:1;right:0;&.", k, "-input-show+*{transition:opacity ", input.transition, ";}}&:hover{.", k, "-input-clear.", k, "-input-show+*{opacity:0;}}}&.", k, "-group{display:inline-flex;.", k, "-input-wrapper{border-radius:0;flex:1;}.", k, "-input-wrapper:first-child{border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";}.", k, "-input-wrapper:last-child{border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;}}.", k, "-input-prepend,.", k, "-input-append{display:inline-flex;align-items:center;background-color:", input.groupBgColor, ";border:", input.border, ";white-space:nowrap;.", k, "-btn{margin:-1px;&.", k, "-none:hover{background:transparent;}}.", k, "-select{margin:-1px;text-align:left;}}.", k, "-input-prepend{&,.", k, "-btn,.", k, "-select{z-index:1;border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";}}.", k, "-input-append{&,.", k, "-btn,.", k, "-select{z-index:1;border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;}}.", k, "-input-padding{padding:0 ", input.groupPaddingGap, ";}.", k, "-input-prepend{border-right:none;}.", k, "-input-append{border-left:none;}&.", k, "-flat{color:", _flatInstanceProperty(input).color, ";.", k, "-input-wrapper{border:none;background:", _flatInstanceProperty(input).bgColor, ";}}&.", k, "-disabled{color:", input.disabledColor, ";cursor:not-allowed;.", k, "-input-wrapper{border-color:", input.disabledBorderColor, ";background:", input.disabledBgColor, ";}.", k, "-input-inner{cursor:not-allowed;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
136
136
|
var styles = input[size];
|
|
137
137
|
var sizeClassName = /*#__PURE__*/css("font-size:", styles.fontSize, ";.", k, "-input-wrapper{height:", styles.height, ";padding:0 ", styles.paddingGap, ";}");
|
|
138
138
|
if (size === 'default') return sizeClassName;
|
|
@@ -7,7 +7,7 @@ import { Icon } from '../icon';
|
|
|
7
7
|
import { Menu } from './menu';
|
|
8
8
|
import { getRestProps, expandAnimationCallbacks } from '../utils';
|
|
9
9
|
import { isNullOrUndefined } from 'intact-shared';
|
|
10
|
-
import { makeItemStyles, makeTitleStyles } from './styles';
|
|
10
|
+
import { makeItemStyles, makeTitleStyles, makeNestedMenuStyles } from './styles';
|
|
11
11
|
export default function ($props, $blocks, $__proto__) {
|
|
12
12
|
var _classNameObj,
|
|
13
13
|
_this = this;
|
|
@@ -67,7 +67,27 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
67
67
|
'show': isExpanded,
|
|
68
68
|
'key': 'subMenu'
|
|
69
69
|
}, expandAnimationCallbacks, {
|
|
70
|
-
'children':
|
|
70
|
+
'children': function () {
|
|
71
|
+
if (subMenuVNode) {
|
|
72
|
+
var _$cn3;
|
|
73
|
+
|
|
74
|
+
var paddingLeft = _this.parentMenu.get('_paddingLeft');
|
|
75
|
+
|
|
76
|
+
var _makeNestedMenuStyles = makeNestedMenuStyles(k, showDot || !!iconVNode, paddingLeft),
|
|
77
|
+
_classname = _makeNestedMenuStyles[0],
|
|
78
|
+
_paddingLeft = _makeNestedMenuStyles[1];
|
|
79
|
+
|
|
80
|
+
var _className = _$cn((_$cn3 = {}, _$cn3[_classname] = true, _$cn3[subMenuVNode.className] = subMenuVNode.className, _$cn3));
|
|
81
|
+
|
|
82
|
+
var clonedVNode = directClone(subMenuVNode);
|
|
83
|
+
clonedVNode.props = _extends({}, clonedVNode.props, {
|
|
84
|
+
className: _className,
|
|
85
|
+
_paddingLeft: _paddingLeft
|
|
86
|
+
});
|
|
87
|
+
clonedVNode.className = _className;
|
|
88
|
+
return clonedVNode;
|
|
89
|
+
}
|
|
90
|
+
}()
|
|
71
91
|
}), 'subMenu')] : !subMenuVNode ? isTopItem && isCollapse ? _$cc(Tooltip, {
|
|
72
92
|
'position': rootMenu.get('type') !== 'horizontal' ? 'right' : 'bottom',
|
|
73
93
|
'theme': rootMenu.get('theme') === 'dark' ? 'dark' : 'light',
|
|
@@ -44,7 +44,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
44
44
|
}), 0, _$cn((_$cn2 = {}, _$cn2[k + "-menu-header"] = true, _$cn2[makeTitleStyles(k)] = true, _$cn2))) : undefined, children];
|
|
45
45
|
return !isDropdownMenu ? _$cv('div', _extends({}, getRestProps(this), {
|
|
46
46
|
'className': _$cn(classNameObj)
|
|
47
|
-
}),
|
|
47
|
+
}), content) : _$cc(DropdownMenu, _extends({}, getRestProps(this), {
|
|
48
48
|
'className': _$cn(classNameObj),
|
|
49
49
|
'children': content
|
|
50
50
|
}));
|
|
@@ -65,3 +65,4 @@ export { menu };
|
|
|
65
65
|
export declare function makeMenuStyles(k: string): string;
|
|
66
66
|
export declare function makeTitleStyles(k: string): string;
|
|
67
67
|
export declare function makeItemStyles(k: string): string;
|
|
68
|
+
export declare function makeNestedMenuStyles(k: string, hasIcon: boolean, parentPaddingLeft?: string): string[];
|
|
@@ -122,7 +122,7 @@ export function makeMenuStyles(k) {
|
|
|
122
122
|
|
|
123
123
|
// we must increase the priority by adding &.${k}-menu
|
|
124
124
|
// to override the css of dropdownMenu
|
|
125
|
-
return /*#__PURE__*/css("&.", k, "-menu{width:", menu.width, ";transition:width ", menu.transition, ";background:", menu.bgColor, ";font-size:", menu.fontSize, ";}
|
|
125
|
+
return /*#__PURE__*/css("&.", k, "-menu{width:", menu.width, ";transition:width ", menu.transition, ";background:", menu.bgColor, ";font-size:", menu.fontSize, ";}.", k, "-icon{width:", menu.icon.width, ";margin-right:", menu.icon.gap, ";text-align:center;flex-shrink:0;}.", k, "-menu-header{height:", menu.header.height, ";font-size:", menu.header.fontSize, ";font-weight:bold;border-bottom:", menu.header.borderBottom, ";}", _mapInstanceProperty(_context = ['light', 'white']).call(_context, function (theme) {
|
|
126
126
|
var styles = menu[theme];
|
|
127
127
|
return /*#__PURE__*/css("&.", k, "-", theme, "{background:", styles.bgColor, ";.", k, "-menu-header{color:", styles.item.color, ";border-bottom:", styles.border, ";}.", k, "-menu-item{.", k, "-menu-title{color:", styles.item.color, ";&:hover{color:", styles.item.hoverColor, ";}}&.", k, "-highlighted{>.", k, "-menu-title{color:", styles.item.hoverColor, ";}}&.", k, "-disabled{>.", k, "-menu-title{color:", styles.item.disabledColor, "!important;}}}.", k, "-menu:not(.", k, "-dropdown-menu){background:", styles.subBgColor, ";}&.", k, "-horizontal{.", k, "-menu-header{border-right:", styles.border, ";}}}");
|
|
128
128
|
}), " &.", k, "-white{.", k, "-menu-item.", k, "-active{>.", k, "-menu-title{color:", menu.white.active.color, "!important;background:", menu.white.active.bgColor, ";}}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
@@ -136,5 +136,13 @@ export function makeTitleStyles(k) {
|
|
|
136
136
|
}
|
|
137
137
|
export function makeItemStyles(k) {
|
|
138
138
|
var item = menu.item;
|
|
139
|
-
return /*#__PURE__*/css(".", k, "-menu-title{cursor:pointer;height:", menu.item.height, "
|
|
139
|
+
return /*#__PURE__*/css(".", k, "-menu-title{cursor:pointer;height:", menu.item.height, ";&:hover{color:", menu.item.hoverColor, ";}}.", k, "-menu-name{flex:1;display:flex;align-items:center;min-width:0;span{overflow:hidden;text-overflow:ellipsis;min-width:0;}.", k, "-icon{color:inherit;}}.", k, "-menu-arrow{transition:transform ", menu.transition, ";margin:0 0 0 ", menu.icon.gap, ";}&.", k, "-expanded{>.", k, "-menu-title{color:", menu.item.hoverColor, ";.", k, "-menu-arrow{transform:rotateX(180deg);}}}&.", k, "-highlighted{>.", k, "-menu-title{color:", menu.item.hoverColor, ";}}&.", k, "-active{>.", k, "-menu-title{color:", menu.item.hoverColor, "!important;background:", menu.item.activeBgColor, ";}}&.", k, "-disabled{>.", k, "-menu-title{color:", menu.item.disabledColor, "!important;cursor:not-allowed;}}.", k, "-menu-dot{font-size:", menu.item.dotFontSize, ";transform:scale(.4);}");
|
|
140
|
+
}
|
|
141
|
+
export function makeNestedMenuStyles(k, hasIcon, parentPaddingLeft) {
|
|
142
|
+
if (parentPaddingLeft === void 0) {
|
|
143
|
+
parentPaddingLeft = getLeft(menu.item.padding);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
var paddingLeft = "" + parentPaddingLeft + (hasIcon ? ' + ' + menu.icon.width : '') + " + " + menu.icon.gap;
|
|
147
|
+
return [/*#__PURE__*/css("&.", k, "-menu{width:auto;background:", menu.subBgColor, ";.", k, "-menu-title{padding-left:calc(", paddingLeft, ");}}"), paddingLeft];
|
|
140
148
|
}
|
|
@@ -31,16 +31,13 @@ export function useDropdown(rootMenu, parentMenu) {
|
|
|
31
31
|
eachChildren(children, function (vNode) {
|
|
32
32
|
if (isComponentVNode(vNode, Menu)) {
|
|
33
33
|
subMenuVNode = vNode;
|
|
34
|
-
} else if (isTopItem && isCollapse) {
|
|
35
|
-
if (isStringOrNumberNotEmpty(vNode) || isTextVNode(vNode)) {
|
|
36
|
-
tooltipContents.push(vNode);
|
|
37
|
-
} else if (!iconVNode && isComponentVNode(vNode, Icon)) {
|
|
38
|
-
iconVNode = vNode;
|
|
39
|
-
}
|
|
40
34
|
} else {
|
|
41
35
|
if (isStringOrNumberNotEmpty(vNode) || isTextVNode(vNode)) {
|
|
42
36
|
// wrap with span for showing text ellipsis
|
|
43
37
|
vNode = createVNode('span', null, vNode);
|
|
38
|
+
tooltipContents.push(vNode);
|
|
39
|
+
} else if (!iconVNode && isComponentVNode(vNode, Icon)) {
|
|
40
|
+
iconVNode = vNode;
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
titleVNodes.push(vNode);
|
package/es/components/portal.js
CHANGED
|
@@ -114,7 +114,13 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
114
114
|
if (!this.container) {
|
|
115
115
|
if (this.$senior instanceof BaseDialog) {
|
|
116
116
|
// Dialog and Drawer must be inserted into document.body
|
|
117
|
-
this.container = document.body;
|
|
117
|
+
// this.container = document.body;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @Modify https://github.com/ksc-fe/kpc/issues/915
|
|
121
|
+
* shoud insert to parent .k-dialog-wrapper to show nested dialog in Vue
|
|
122
|
+
*/
|
|
123
|
+
this.container = parentDom.closest("." + this.config.k + "-dialog-wrapper") || document.body;
|
|
118
124
|
} else {
|
|
119
125
|
// find the closest dialog if exists
|
|
120
126
|
this.container = parentDom.closest("." + this.config.k + "-dialog") || document.body;
|
|
@@ -62,7 +62,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
62
62
|
}, getClassAndStyleForFixed({
|
|
63
63
|
fixed: hasFixedLeft ? 'left' : false,
|
|
64
64
|
className: [k + "-table-check"]
|
|
65
|
-
}, 0), spans), children));
|
|
65
|
+
}, 0, k), spans), children));
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
if (checkType === 'checkbox') {
|
|
@@ -89,7 +89,8 @@ var defaults = {
|
|
|
89
89
|
|
|
90
90
|
// tree
|
|
91
91
|
arrow: {
|
|
92
|
-
gap: "4px"
|
|
92
|
+
gap: "4px",
|
|
93
|
+
width: "16px"
|
|
93
94
|
},
|
|
94
95
|
resizeWidth: "5px",
|
|
95
96
|
draggingOpacity: ".4"
|
|
@@ -102,7 +103,7 @@ setDefault(function () {
|
|
|
102
103
|
}).table;
|
|
103
104
|
});
|
|
104
105
|
export function makeStyles(k) {
|
|
105
|
-
return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-spacing:0;table-layout:fixed;td,th{transition:all ", table.transition, ";}}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&:first-of-type:before{display:none;}}.", k, "-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.", k, "-table-title-text{flex:1;display:inline-flex;line-height:1.4;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.", k, "-fixed-left,.", k, "-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.", k, "-fixed-left:after{right:-11px;}.", k, "-fixed-right:after{left:-11px;}&.", k, "-scroll-left .", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.", k, "-scroll-right .", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.", k, "-scroll-middle{.", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.", k, "-fixed-right+.", k, "-fixed-right:after{display:none;}.", k, "-table-affix-header{position:sticky;top:0;left:0;.", k, "-affix-wrapper{overflow:hidden;}&.", k, "-fixed{position:relative;}}&.", k, "-border,&.", k, "-grid{.", k, "-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.", k, "-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.", k, "-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.", k, "-table-group{margin-left:", table.group.gap, ";}.", k, "-table-check{.", k, "-checkbox,.", k, "-radio{position:relative;top:-1px;}}.", k, "-column-sortable{cursor:pointer;}.", k, "-column-sort{.", k, "-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.", k, "-desc .", k, "-icon.", k, "-desc,&.", k, "-asc .", k, "-icon.", k, "-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.", k, "-table-spin.", k, "-overlay{z-index:2;}.", k, "-table-empty{text-align:center;}tr.", k, "-expand{td{padding:0;background:#fdfcff;}}&.", k, "-with-expand{tr:not(.", k, "-expand){td{border-bottom:none;}}}.", k, "-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.", k, "-selected td{background:", table.selectedBgColor, ";}.", k, "-table-arrow{margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.", k, "-spreaded{.", k, "-table-arrow{transform:rotate(90deg);}}.", k, "-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.", k, "-dragging{opacity:", table.draggingOpacity, ";}.", k, "-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.", k, "-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
|
|
106
|
+
return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-spacing:0;table-layout:fixed;td,th{transition:all ", table.transition, ";}}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&:first-of-type:before{display:none;}}.", k, "-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.", k, "-table-title-text{flex:1;display:inline-flex;line-height:1.4;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.", k, "-fixed-left,.", k, "-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.", k, "-fixed-left:after{right:-11px;}.", k, "-fixed-right:after{left:-11px;}&.", k, "-scroll-left .", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.", k, "-scroll-right .", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.", k, "-scroll-middle{.", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.", k, "-fixed-right+.", k, "-fixed-right:after{display:none;}.", k, "-table-affix-header{position:sticky;top:0;left:0;.", k, "-affix-wrapper{overflow:hidden;}&.", k, "-fixed{position:relative;}}&.", k, "-border,&.", k, "-grid{.", k, "-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.", k, "-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.", k, "-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.", k, "-table-group{margin-left:", table.group.gap, ";}.", k, "-table-check{.", k, "-checkbox,.", k, "-radio{position:relative;top:-1px;}}.", k, "-column-sortable{cursor:pointer;}.", k, "-column-sort{.", k, "-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.", k, "-desc .", k, "-icon.", k, "-desc,&.", k, "-asc .", k, "-icon.", k, "-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.", k, "-table-spin.", k, "-overlay{z-index:2;}.", k, "-table-empty{text-align:center;}tr.", k, "-expand{td{padding:0;background:#fdfcff;}}&.", k, "-with-expand{tr:not(.", k, "-expand){td{border-bottom:none;}}}.", k, "-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.", k, "-selected td{background:", table.selectedBgColor, ";}.", k, "-table-arrow{width:", table.arrow.width, "!important;margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.", k, "-spreaded{.", k, "-table-arrow{transform:rotate(90deg);}}.", k, "-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.", k, "-dragging{opacity:", table.draggingOpacity, ";}.", k, "-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.", k, "-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
|
|
106
107
|
return /*#__PURE__*/css(".", k, "-align-", type, "{text-align:", type, ";}");
|
|
107
108
|
}), ">.", k, "-pagination{margin:16px 0;}");
|
|
108
109
|
}
|
|
@@ -131,7 +131,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
131
131
|
return _$ce(2, 'tr', function () {
|
|
132
132
|
var ths = [$key === 0 && checkType !== 'none' ? _$cv('th', _extends({}, getClassAndStyleForFixed({
|
|
133
133
|
fixed: hasFixedLeft ? 'left' : false
|
|
134
|
-
}, 0), {
|
|
134
|
+
}, 0, k), {
|
|
135
135
|
'rowspan': maxRows,
|
|
136
136
|
'key': '$checktype'
|
|
137
137
|
}), checkType === 'checkbox' ? _$cc(Checkbox, {
|
|
@@ -2,7 +2,8 @@ import { Component, Key, TypeDefs } from 'intact';
|
|
|
2
2
|
import { DataItem, Node } from './useNodes';
|
|
3
3
|
import { Mode } from './useDraggable';
|
|
4
4
|
import type { Events } from '../types';
|
|
5
|
-
export type { Node as TreeNode, DataItem as TreeDataItem,
|
|
5
|
+
export type { Node as TreeNode, DataItem as TreeDataItem, };
|
|
6
|
+
export { Mode as TreeMode };
|
|
6
7
|
export interface TreeProps<K extends Key = Key> {
|
|
7
8
|
data?: DataItem<K>[];
|
|
8
9
|
filter?: Filter<K>;
|
|
@@ -18,11 +19,11 @@ export interface TreeProps<K extends Key = Key> {
|
|
|
18
19
|
showLine?: boolean;
|
|
19
20
|
draggable?: boolean;
|
|
20
21
|
allowDrag?: (node: Node<K>) => boolean;
|
|
21
|
-
allowDrop?: (node: Node<K
|
|
22
|
+
allowDrop?: (node: Node<K>, srcNode: Node<K>, mode: Mode) => boolean;
|
|
22
23
|
}
|
|
23
24
|
export interface TreeEvents<K extends Key> {
|
|
24
25
|
denydrag: [Node<K>];
|
|
25
|
-
denydrop: [Node<K
|
|
26
|
+
denydrop: [Node<K>, Node<K>, Mode];
|
|
26
27
|
dragend: [DragEndData<K>];
|
|
27
28
|
transitionEnd: [];
|
|
28
29
|
}
|
|
@@ -54,5 +55,6 @@ export declare class Tree<K extends Key = Key> extends Component<TreeProps<K>, T
|
|
|
54
55
|
expand(key: K): void;
|
|
55
56
|
shrink(key: K): void;
|
|
56
57
|
getNodes(): Node<K>[];
|
|
58
|
+
expandAll(): void;
|
|
57
59
|
private onClick;
|
|
58
60
|
}
|