@king-design/intact 2.0.6 → 2.0.8
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/datepicker/time.ts +1 -1
- package/components/drawer/styles.ts +1 -0
- package/components/dropdown/useKeyboard.ts +1 -1
- package/components/layout/demos/asideFix.md +3 -1
- package/components/layout/demos/fix.md +3 -1
- package/components/menu/index.spec.ts +42 -1
- package/components/menu/item.ts +2 -1
- package/components/menu/useHighlight.ts +12 -2
- package/components/portal.ts +44 -58
- package/components/select/styles.ts +1 -0
- package/components/table/styles.ts +11 -0
- package/components/table/useFixedColumns.ts +2 -1
- package/components/tooltip/content.vdt +2 -1
- package/es/components/datepicker/time.d.ts +1 -1
- package/es/components/datepicker/time.js +1 -1
- package/es/components/drawer/styles.js +1 -1
- package/es/components/dropdown/useKeyboard.js +2 -2
- package/es/components/menu/index.spec.js +62 -0
- package/es/components/menu/item.js +2 -1
- package/es/components/menu/useHighlight.d.ts +2 -0
- package/es/components/menu/useHighlight.js +13 -2
- package/es/components/portal.d.ts +0 -3
- package/es/components/portal.js +39 -43
- package/es/components/select/styles.js +1 -1
- package/es/components/table/styles.js +5 -1
- package/es/components/table/useFixedColumns.d.ts +1 -1
- package/es/components/table/useFixedColumns.js +3 -2
- package/es/components/tooltip/content.vdt.js +2 -2
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/packages/kpc-react/__tests__/components/drawer.spec.d.ts +1 -0
- package/es/packages/kpc-react/__tests__/components/drawer.spec.js +46 -0
- package/es/packages/kpc-react/__tests__/index.js +1 -1
- package/es/site/data/components/layout/demos/asideFix/react.js +6 -4
- package/es/site/data/components/layout/demos/fix/react.js +6 -4
- package/es/site/src/pages/font/index.d.ts +1 -0
- package/es/site/src/pages/font/index.js +6 -0
- package/es/site/src/pages/font/styles.js +2 -4
- package/es/site/src/pages/index/styles.js +1 -1
- package/index.ts +2 -2
- package/package.json +3 -3
|
@@ -30,7 +30,7 @@ const defaultValue: Value = {
|
|
|
30
30
|
export class DatepickerTime extends Component<DatepickerTimeProps> {
|
|
31
31
|
static template = template;
|
|
32
32
|
|
|
33
|
-
public value = useState<Value
|
|
33
|
+
public value = useState<Value>(defaultValue);
|
|
34
34
|
public disabled = useDisable(this);
|
|
35
35
|
|
|
36
36
|
init() {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import {Component} from 'intact';
|
|
1
2
|
import CollapseDemo from '~/components/menu/demos/collapse';
|
|
2
3
|
import AccordionDemo from '~/components/menu/demos/accordion';
|
|
3
4
|
import {mount, unmount, dispatchEvent, getElement, wait} from '../../test/utils';
|
|
4
|
-
import {Menu} from './';
|
|
5
|
+
import {Menu, MenuItem} from './';
|
|
5
6
|
|
|
6
7
|
describe('Menu', () => {
|
|
7
8
|
afterEach(() => unmount());
|
|
@@ -120,4 +121,44 @@ describe('Menu', () => {
|
|
|
120
121
|
expect(element.innerHTML).to.matchSnapshot();
|
|
121
122
|
expect(instance.get('expandedKeys')).to.eql(['3-4', '3']);
|
|
122
123
|
});
|
|
124
|
+
|
|
125
|
+
it('expand when set selectedKey', async () => {
|
|
126
|
+
class Demo extends Component<{list: Array<string>}> {
|
|
127
|
+
static template = `
|
|
128
|
+
var Menu = this.Menu;
|
|
129
|
+
var MenuItem = this.MenuItem;
|
|
130
|
+
<Menu
|
|
131
|
+
v-model:expandedKeys="expandedKeys"
|
|
132
|
+
v-model:selectedKey="selectedKey"
|
|
133
|
+
>
|
|
134
|
+
<MenuItem key="1">
|
|
135
|
+
<Menu>
|
|
136
|
+
<MenuItem v-for={this.get('list')} key={$value}>{$value}</MenuItem>
|
|
137
|
+
</Menu>
|
|
138
|
+
</MenuItem>
|
|
139
|
+
</Menu>
|
|
140
|
+
`;
|
|
141
|
+
|
|
142
|
+
private Menu = Menu;
|
|
143
|
+
|
|
144
|
+
private MenuItem = MenuItem;
|
|
145
|
+
|
|
146
|
+
static defaults() {
|
|
147
|
+
return {
|
|
148
|
+
expandedKeys: [],
|
|
149
|
+
selectedKey: '1-3',
|
|
150
|
+
list: ['1-1', '1-2']
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const [instance] = mount(Demo);
|
|
155
|
+
|
|
156
|
+
await wait();
|
|
157
|
+
instance.set('list', ['1-1', '1-2', '1-3']);
|
|
158
|
+
|
|
159
|
+
await wait();
|
|
160
|
+
const expandedKeys = instance.get('expandedKeys') as Array<string>;
|
|
161
|
+
expect(expandedKeys.includes('1')).to.be.true;
|
|
162
|
+
|
|
163
|
+
})
|
|
123
164
|
});
|
package/components/menu/item.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {useExpanded} from './useExpanded';
|
|
|
8
8
|
import {useDropdown} from './useDropdown';
|
|
9
9
|
import {useRouter, navigate} from '../../hooks/useRouter';
|
|
10
10
|
import {useRecordItem} from '../../hooks/useRecordComponent';
|
|
11
|
-
import {MENU_RECORD_KEY} from './useHighlight';
|
|
11
|
+
import {MENU_RECORD_KEY, useHighlightItem} from './useHighlight';
|
|
12
12
|
|
|
13
13
|
export interface MenuItemProps {
|
|
14
14
|
key: Key
|
|
@@ -49,6 +49,7 @@ export class MenuItem extends Component<MenuItemProps, MenuItemEvents> {
|
|
|
49
49
|
init() {
|
|
50
50
|
provide(MENU_ITEM, this);
|
|
51
51
|
useRecordItem(MENU_RECORD_KEY);
|
|
52
|
+
useHighlightItem();
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
@bind
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useInstance, Key} from 'intact';
|
|
1
|
+
import { useInstance, Key, onMounted } from 'intact';
|
|
2
2
|
import type {Menu, MenuItem} from './';
|
|
3
3
|
import {useRecordParent} from '../../hooks/useRecordComponent';
|
|
4
4
|
import {inArray} from '../table/useChecked';
|
|
@@ -53,5 +53,15 @@ export function useHighlight() {
|
|
|
53
53
|
return instance.get('selectedKey') === key;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
return {isHighlighted, select, isSelected};
|
|
56
|
+
return {isHighlighted, select, isSelected, updateStatus};
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
export function useHighlightItem() {
|
|
60
|
+
const instance = useInstance() as MenuItem;
|
|
61
|
+
|
|
62
|
+
onMounted(() => {
|
|
63
|
+
if(instance.rootMenu.get('selectedKey') == instance.get('key')) {
|
|
64
|
+
instance.rootMenu.highlight?.updateStatus(instance.get('key'));
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
package/components/portal.ts
CHANGED
|
@@ -29,8 +29,6 @@ const typeDefs: Required<TypeDefs<PortalProps>> = {
|
|
|
29
29
|
container: [String, Function],
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
const PORTAL = 'Portal';
|
|
33
|
-
|
|
34
32
|
export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
|
|
35
33
|
static template(this: Portal) {
|
|
36
34
|
if (process.env.NODE_ENV === 'production') {
|
|
@@ -42,17 +40,9 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
|
|
|
42
40
|
|
|
43
41
|
private container: Element | null = null;
|
|
44
42
|
private dialog: Dialog | null = inject(DIALOG, null);
|
|
45
|
-
private portal: Portal | null = inject(PORTAL, null);
|
|
46
|
-
private rootPortal = inject<Portal | null>(PORTAL, null);
|
|
47
43
|
public mountedQueue?: Function[];
|
|
48
44
|
public mountedDone?: boolean;
|
|
49
45
|
|
|
50
|
-
init() {
|
|
51
|
-
if (!this.rootPortal) {
|
|
52
|
-
provide(PORTAL, this);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
46
|
$render(
|
|
57
47
|
lastVNode: VNodeComponentClass<this> | null,
|
|
58
48
|
nextVNode: VNodeComponentClass<this>,
|
|
@@ -60,59 +50,45 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
|
|
|
60
50
|
anchor: IntactDom | null,
|
|
61
51
|
mountedQueue: Function[]
|
|
62
52
|
) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
mountedQueue.push(() => {
|
|
54
|
+
const nextProps = nextVNode.props!;
|
|
55
|
+
const parentDom = this.$lastInput!.dom!.parentElement!;
|
|
56
|
+
/**
|
|
57
|
+
* initialize a new mountedQueue to place the callbacks of sub-components to it,
|
|
58
|
+
* so that we can call them before the sibling components of the Portal
|
|
59
|
+
*/
|
|
60
|
+
const mountedQueue: Function[] = [];
|
|
69
61
|
this.initContainer(nextProps.container, parentDom, anchor);
|
|
70
62
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
shouldTrigger = true;
|
|
81
|
-
rootPortal.mountedQueue = [];
|
|
82
|
-
}
|
|
63
|
+
/**
|
|
64
|
+
* Because we render real elements following parent has rendered.
|
|
65
|
+
* In React, the $promises have done. Then we cannot add any promise to it.
|
|
66
|
+
* We should find the parent component who holds the $promises object, and
|
|
67
|
+
* reset it to let remaining element children add promise to it.
|
|
68
|
+
*/
|
|
69
|
+
const parent = getParent(this) as any;
|
|
70
|
+
if (parent) {
|
|
71
|
+
parent.$promises.reset();
|
|
83
72
|
}
|
|
84
73
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
74
|
+
mount(
|
|
75
|
+
nextProps.children as VNode,
|
|
76
|
+
this.container!,
|
|
77
|
+
this,
|
|
78
|
+
this.$SVG,
|
|
79
|
+
null,
|
|
80
|
+
mountedQueue,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
// in react, we should wait for all promises to resolve
|
|
84
|
+
if (parent) {
|
|
85
|
+
(Component as any).FakePromise.all(parent.$promises).then(() => {
|
|
86
|
+
callAll(mountedQueue);
|
|
87
|
+
});
|
|
88
|
+
} else {
|
|
89
|
+
callAll(mountedQueue);
|
|
100
90
|
}
|
|
101
|
-
}
|
|
102
|
-
mountedQueue.push(() => {
|
|
103
|
-
const parentDom = this.$lastInput!.dom!.parentElement!;
|
|
104
|
-
this.initContainer(nextProps.container, parentDom, anchor);
|
|
105
|
-
|
|
106
|
-
mount(
|
|
107
|
-
nextProps.children as VNode,
|
|
108
|
-
this.container!,
|
|
109
|
-
this,
|
|
110
|
-
this.$SVG,
|
|
111
|
-
null,
|
|
112
|
-
mountedQueue,
|
|
113
|
-
);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
91
|
+
});
|
|
116
92
|
|
|
117
93
|
super.$render(lastVNode, nextVNode, parentDom, anchor, mountedQueue);
|
|
118
94
|
}
|
|
@@ -185,3 +161,13 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
|
|
|
185
161
|
}
|
|
186
162
|
}
|
|
187
163
|
}
|
|
164
|
+
|
|
165
|
+
function getParent($senior: Component): Component | null {
|
|
166
|
+
while ($senior = $senior.$senior as Component) {
|
|
167
|
+
if (($senior as any)._reactInternals) {
|
|
168
|
+
return $senior;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
|
|
@@ -63,6 +63,8 @@ const defaults = {
|
|
|
63
63
|
draggingOpacity: `.4`,
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
+
const aligns = ['left', 'right', 'center'];
|
|
67
|
+
|
|
66
68
|
let table: typeof defaults;
|
|
67
69
|
setDefault(() => {
|
|
68
70
|
table = deepDefaults(theme, {table: defaults}).table;
|
|
@@ -350,6 +352,15 @@ export function makeStyles() {
|
|
|
350
352
|
.k-table-scrollbar-inner {
|
|
351
353
|
height: 1px;
|
|
352
354
|
}
|
|
355
|
+
|
|
356
|
+
// align
|
|
357
|
+
${aligns.map(type => {
|
|
358
|
+
return css`
|
|
359
|
+
.k-align-${type} {
|
|
360
|
+
text-align: ${type};
|
|
361
|
+
}
|
|
362
|
+
`;
|
|
363
|
+
})}
|
|
353
364
|
`;
|
|
354
365
|
}
|
|
355
366
|
|
|
@@ -144,7 +144,7 @@ export function useFixedColumns(
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
export function getClassAndStyleForFixed(
|
|
147
|
-
{className, fixed}: Props<TableColumnProps>,
|
|
147
|
+
{className, fixed, align}: Props<TableColumnProps>,
|
|
148
148
|
offset: number,
|
|
149
149
|
checkType?: TableProps['checkType'],
|
|
150
150
|
) {
|
|
@@ -153,6 +153,7 @@ export function getClassAndStyleForFixed(
|
|
|
153
153
|
className: cx({
|
|
154
154
|
[className as string]: !!className,
|
|
155
155
|
[`k-fixed-${fixed}`]: !!fixed,
|
|
156
|
+
[`k-align-${align}`]: !!align,
|
|
156
157
|
}),
|
|
157
158
|
style: fixed ? {[fixed]: `${offset + extraOffset}px`} : null,
|
|
158
159
|
};
|
|
@@ -28,13 +28,14 @@ const classNameObj = {
|
|
|
28
28
|
<b:children>
|
|
29
29
|
{children}
|
|
30
30
|
<i v-if={showArrow}
|
|
31
|
+
key="tooltip-arrow"
|
|
31
32
|
class={{
|
|
32
33
|
"k-tooltip-arrow": true,
|
|
33
34
|
[`k-${arrowType.value}`]: arrowType.value,
|
|
34
35
|
}}
|
|
35
36
|
ref={arrowRef}
|
|
36
37
|
></i>
|
|
37
|
-
<div class="k-tooltip-buttons" v-if={confirm}>
|
|
38
|
+
<div class="k-tooltip-buttons" v-if={confirm} key="tooltip-buttons">
|
|
38
39
|
<b:buttons>
|
|
39
40
|
<Button type="primary" ev-click={this.ok} size="small">{okText}</Button>
|
|
40
41
|
<Button ev-click={this.cancel} size="small">{cancelText}</Button>
|
|
@@ -14,7 +14,7 @@ declare type Value = {
|
|
|
14
14
|
};
|
|
15
15
|
export declare class DatepickerTime extends Component<DatepickerTimeProps> {
|
|
16
16
|
static template: string | import("intact").Template<any>;
|
|
17
|
-
value: import("../../hooks/useState").State<Value
|
|
17
|
+
value: import("../../hooks/useState").State<Value>;
|
|
18
18
|
disabled: {
|
|
19
19
|
disableSeconds: import("../../hooks/useState").State<boolean>;
|
|
20
20
|
disableMinutes: import("../../hooks/useState").State<boolean>;
|
|
@@ -25,7 +25,7 @@ export var DatepickerTime = /*#__PURE__*/function (_Component) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
28
|
-
_this.value = useState(
|
|
28
|
+
_this.value = useState(defaultValue);
|
|
29
29
|
_this.disabled = useDisable(_assertThisInitialized(_this));
|
|
30
30
|
return _this;
|
|
31
31
|
}
|
|
@@ -21,7 +21,7 @@ setDefault(function () {
|
|
|
21
21
|
}).drawer;
|
|
22
22
|
});
|
|
23
23
|
export function makeStyles(overlay) {
|
|
24
|
-
return /*#__PURE__*/css("box-shadow:none;border-radius:0;position:fixed!important;background:transparent!important;box-shadow:none!important;&.transition-enter-active,&.transition-leave-active,&.transition-appear-active{transition:opacity ", drawer.transition, "!important;overflow:hidden;.k-drawer-content{transition:transform ", drawer.transition, ";}}.k-drawer-content{height:100%;display:flex;background:#fff;flex-direction:column;transform:translateX(0);box-shadow:", drawer.boxShadow, ";.k-dialog-body{flex-grow:1;}}", _mapInstanceProperty(placements).call(placements, function (placement) {
|
|
24
|
+
return /*#__PURE__*/css("box-shadow:none;border-radius:0;position:fixed!important;background:transparent!important;box-shadow:none!important;&.transition-enter-active,&.transition-leave-active,&.transition-appear-active{transition:opacity ", drawer.transition, "!important;overflow:hidden;.k-drawer-content{transition:transform ", drawer.transition, ";}}.k-drawer-content{height:100%;display:flex;background:#fff;flex-direction:column;transform:translateX(0);box-shadow:", drawer.boxShadow, ";.k-dialog-body{flex-grow:1;overflow:auto;}}", _mapInstanceProperty(placements).call(placements, function (placement) {
|
|
25
25
|
var positionValue = '';
|
|
26
26
|
var transformValue = '';
|
|
27
27
|
placements.forEach(function (p) {
|
|
@@ -123,8 +123,8 @@ export function useMenuKeyboard() {
|
|
|
123
123
|
reset: reset,
|
|
124
124
|
focus: function focus(item) {
|
|
125
125
|
// reset();
|
|
126
|
-
var index = items.indexOf(item);
|
|
127
|
-
|
|
126
|
+
var index = items.indexOf(item); // if (index === -1) debugger
|
|
127
|
+
|
|
128
128
|
focusIndex = index;
|
|
129
129
|
focusItem(item);
|
|
130
130
|
}
|
|
@@ -1,8 +1,13 @@
|
|
|
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";
|
|
4
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
2
5
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
6
|
+
import { Component } from 'intact';
|
|
3
7
|
import CollapseDemo from '~/components/menu/demos/collapse';
|
|
4
8
|
import AccordionDemo from '~/components/menu/demos/accordion';
|
|
5
9
|
import { mount, unmount, dispatchEvent, getElement, wait } from '../../test/utils';
|
|
10
|
+
import { Menu, MenuItem } from './';
|
|
6
11
|
describe('Menu', function () {
|
|
7
12
|
afterEach(function () {
|
|
8
13
|
return unmount();
|
|
@@ -220,4 +225,61 @@ describe('Menu', function () {
|
|
|
220
225
|
}
|
|
221
226
|
}, _callee5);
|
|
222
227
|
})));
|
|
228
|
+
it('expand when set selectedKey', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
229
|
+
var Demo, _mount6, instance, expandedKeys;
|
|
230
|
+
|
|
231
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context7) {
|
|
232
|
+
while (1) {
|
|
233
|
+
switch (_context7.prev = _context7.next) {
|
|
234
|
+
case 0:
|
|
235
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
236
|
+
_inheritsLoose(Demo, _Component);
|
|
237
|
+
|
|
238
|
+
function Demo() {
|
|
239
|
+
var _context6;
|
|
240
|
+
|
|
241
|
+
var _this;
|
|
242
|
+
|
|
243
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
244
|
+
args[_key] = arguments[_key];
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context6 = [this]).call(_context6, args)) || this;
|
|
248
|
+
_this.Menu = Menu;
|
|
249
|
+
_this.MenuItem = MenuItem;
|
|
250
|
+
return _this;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
Demo.defaults = function defaults() {
|
|
254
|
+
return {
|
|
255
|
+
expandedKeys: [],
|
|
256
|
+
selectedKey: '1-3',
|
|
257
|
+
list: ['1-1', '1-2']
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
return Demo;
|
|
262
|
+
}(Component);
|
|
263
|
+
|
|
264
|
+
Demo.template = "\n var Menu = this.Menu;\n var MenuItem = this.MenuItem;\n <Menu\n v-model:expandedKeys=\"expandedKeys\"\n v-model:selectedKey=\"selectedKey\"\n >\n <MenuItem key=\"1\">\n <Menu>\n <MenuItem v-for={this.get('list')} key={$value}>{$value}</MenuItem>\n </Menu>\n </MenuItem>\n </Menu>\n ";
|
|
265
|
+
_mount6 = mount(Demo), instance = _mount6[0];
|
|
266
|
+
_context7.next = 5;
|
|
267
|
+
return wait();
|
|
268
|
+
|
|
269
|
+
case 5:
|
|
270
|
+
instance.set('list', ['1-1', '1-2', '1-3']);
|
|
271
|
+
_context7.next = 8;
|
|
272
|
+
return wait();
|
|
273
|
+
|
|
274
|
+
case 8:
|
|
275
|
+
expandedKeys = instance.get('expandedKeys');
|
|
276
|
+
expect(_includesInstanceProperty(expandedKeys).call(expandedKeys, '1')).to.be.true;
|
|
277
|
+
|
|
278
|
+
case 10:
|
|
279
|
+
case "end":
|
|
280
|
+
return _context7.stop();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}, _callee6);
|
|
284
|
+
})));
|
|
223
285
|
});
|
|
@@ -9,7 +9,7 @@ import { useExpanded } from './useExpanded';
|
|
|
9
9
|
import { useDropdown } from './useDropdown';
|
|
10
10
|
import { useRouter, navigate } from '../../hooks/useRouter';
|
|
11
11
|
import { useRecordItem } from '../../hooks/useRecordComponent';
|
|
12
|
-
import { MENU_RECORD_KEY } from './useHighlight';
|
|
12
|
+
import { MENU_RECORD_KEY, useHighlightItem } from './useHighlight';
|
|
13
13
|
var typeDefs = {
|
|
14
14
|
key: {
|
|
15
15
|
type: [String, Number],
|
|
@@ -47,6 +47,7 @@ export var MenuItem = /*#__PURE__*/function (_Component) {
|
|
|
47
47
|
_proto.init = function init() {
|
|
48
48
|
provide(MENU_ITEM, this);
|
|
49
49
|
useRecordItem(MENU_RECORD_KEY);
|
|
50
|
+
useHighlightItem();
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
_proto.onClick = function onClick(hasSubMenu, e) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _Set from "@babel/runtime-corejs3/core-js/set";
|
|
2
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
3
3
|
import _Array$from from "@babel/runtime-corejs3/core-js/array/from";
|
|
4
|
-
import { useInstance } from 'intact';
|
|
4
|
+
import { useInstance, onMounted } from 'intact';
|
|
5
5
|
import { useRecordParent } from '../../hooks/useRecordComponent';
|
|
6
6
|
import { inArray } from '../table/useChecked';
|
|
7
7
|
import { useState } from '../../hooks/useState';
|
|
@@ -64,6 +64,17 @@ export function useHighlight() {
|
|
|
64
64
|
return {
|
|
65
65
|
isHighlighted: isHighlighted,
|
|
66
66
|
select: select,
|
|
67
|
-
isSelected: isSelected
|
|
67
|
+
isSelected: isSelected,
|
|
68
|
+
updateStatus: updateStatus
|
|
68
69
|
};
|
|
70
|
+
}
|
|
71
|
+
export function useHighlightItem() {
|
|
72
|
+
var instance = useInstance();
|
|
73
|
+
onMounted(function () {
|
|
74
|
+
if (instance.rootMenu.get('selectedKey') == instance.get('key')) {
|
|
75
|
+
var _instance$rootMenu$hi;
|
|
76
|
+
|
|
77
|
+
(_instance$rootMenu$hi = instance.rootMenu.highlight) == null ? void 0 : _instance$rootMenu$hi.updateStatus(instance.get('key'));
|
|
78
|
+
}
|
|
79
|
+
});
|
|
69
80
|
}
|
|
@@ -8,11 +8,8 @@ export declare class Portal<T extends PortalProps = PortalProps> extends Compone
|
|
|
8
8
|
static typeDefs: Required<TypeDefs<PortalProps>>;
|
|
9
9
|
private container;
|
|
10
10
|
private dialog;
|
|
11
|
-
private portal;
|
|
12
|
-
private rootPortal;
|
|
13
11
|
mountedQueue?: Function[];
|
|
14
12
|
mountedDone?: boolean;
|
|
15
|
-
init(): void;
|
|
16
13
|
$render(lastVNode: VNodeComponentClass<this> | null, nextVNode: VNodeComponentClass<this>, parentDom: Element, anchor: IntactDom | null, mountedQueue: Function[]): void;
|
|
17
14
|
$update(lastVNode: VNodeComponentClass<this>, nextVNode: VNodeComponentClass<this>, parentDom: Element, anchor: IntactDom | null, mountedQueue: Function[], force: boolean): void;
|
|
18
15
|
$unmount(vNode: VNodeComponentClass<this>, nextVNode: VNodeComponentClass<this> | null): void;
|
package/es/components/portal.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
-
import { Component, createCommentVNode, createTextVNode, mount, patch, remove,
|
|
3
|
+
import { Component, createCommentVNode, createTextVNode, mount, patch, remove, inject, callAll } from 'intact';
|
|
4
4
|
import { isString } from 'intact-shared';
|
|
5
5
|
import { DIALOG } from './dialog/constants';
|
|
6
6
|
var typeDefs = {
|
|
7
7
|
container: [String, Function]
|
|
8
8
|
};
|
|
9
|
-
var PORTAL = 'Portal';
|
|
10
9
|
export var Portal = /*#__PURE__*/function (_Component) {
|
|
11
10
|
_inheritsLoose(Portal, _Component);
|
|
12
11
|
|
|
@@ -22,8 +21,6 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
22
21
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
23
22
|
_this.container = null;
|
|
24
23
|
_this.dialog = inject(DIALOG, null);
|
|
25
|
-
_this.portal = inject(PORTAL, null);
|
|
26
|
-
_this.rootPortal = inject(PORTAL, null);
|
|
27
24
|
_this.mountedQueue = void 0;
|
|
28
25
|
_this.mountedDone = void 0;
|
|
29
26
|
return _this;
|
|
@@ -39,55 +36,44 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
39
36
|
|
|
40
37
|
var _proto = Portal.prototype;
|
|
41
38
|
|
|
42
|
-
_proto.init = function init() {
|
|
43
|
-
if (!this.rootPortal) {
|
|
44
|
-
provide(PORTAL, this);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
39
|
_proto.$render = function $render(lastVNode, nextVNode, parentDom, anchor, mountedQueue) {
|
|
49
40
|
var _this2 = this;
|
|
50
41
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
mountedQueue.push(function () {
|
|
43
|
+
var nextProps = nextVNode.props;
|
|
44
|
+
var parentDom = _this2.$lastInput.dom.parentElement;
|
|
45
|
+
/**
|
|
46
|
+
* initialize a new mountedQueue to place the callbacks of sub-components to it,
|
|
47
|
+
* so that we can call them before the sibling components of the Portal
|
|
48
|
+
*/
|
|
54
49
|
|
|
55
|
-
|
|
56
|
-
this.initContainer(nextProps.container, parentDom, anchor);
|
|
57
|
-
var rootPortal;
|
|
58
|
-
var shouldTrigger = false;
|
|
50
|
+
var mountedQueue = [];
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
_this2.initContainer(nextProps.container, parentDom, anchor);
|
|
53
|
+
/**
|
|
54
|
+
* Because we render real elements following parent has rendered.
|
|
55
|
+
* In React, the $promises have done. Then we cannot add any promise to it.
|
|
56
|
+
* We should find the parent component who holds the $promises object, and
|
|
57
|
+
* reset it to let remaining element children add promise to it.
|
|
58
|
+
*/
|
|
66
59
|
|
|
67
|
-
if (rootPortal.mountedDone) {
|
|
68
|
-
shouldTrigger = true;
|
|
69
|
-
rootPortal.mountedQueue = [];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
60
|
|
|
73
|
-
var
|
|
74
|
-
selfMountedQueue.push(function () {
|
|
75
|
-
mount(nextProps.children, _this2.container, _this2, _this2.$SVG, null, mountedQueue);
|
|
76
|
-
});
|
|
61
|
+
var parent = getParent(_this2);
|
|
77
62
|
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
rootPortal.mountedDone = true;
|
|
63
|
+
if (parent) {
|
|
64
|
+
parent.$promises.reset();
|
|
81
65
|
}
|
|
82
|
-
} else {
|
|
83
|
-
mountedQueue.push(function () {
|
|
84
|
-
var parentDom = _this2.$lastInput.dom.parentElement;
|
|
85
66
|
|
|
86
|
-
|
|
67
|
+
mount(nextProps.children, _this2.container, _this2, _this2.$SVG, null, mountedQueue); // in react, we should wait for all promises to resolve
|
|
87
68
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
69
|
+
if (parent) {
|
|
70
|
+
Component.FakePromise.all(parent.$promises).then(function () {
|
|
71
|
+
callAll(mountedQueue);
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
callAll(mountedQueue);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
91
77
|
|
|
92
78
|
_Component.prototype.$render.call(this, lastVNode, nextVNode, parentDom, anchor, mountedQueue);
|
|
93
79
|
};
|
|
@@ -143,4 +129,14 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
143
129
|
|
|
144
130
|
return Portal;
|
|
145
131
|
}(Component);
|
|
146
|
-
Portal.typeDefs = typeDefs;
|
|
132
|
+
Portal.typeDefs = typeDefs;
|
|
133
|
+
|
|
134
|
+
function getParent($senior) {
|
|
135
|
+
while ($senior = $senior.$senior) {
|
|
136
|
+
if ($senior._reactInternals) {
|
|
137
|
+
return $senior;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
@@ -188,7 +188,7 @@ setDefault(function () {
|
|
|
188
188
|
}).select;
|
|
189
189
|
});
|
|
190
190
|
export default function makeStyles() {
|
|
191
|
-
return /*#__PURE__*/css("display:inline-flex;align-items:center;vertical-align:middle;position:relative;width:", select.width, ";cursor:pointer;outline:none;border:", select.border, ";background:", select.bgColor, ";transition:border ", select.transition, ",background ", select.transition, ",box-shadow ", select.transition, ";border-radius:", select.borderRadius, ";.k-select-main{flex:1;}.k-select-prefix,.k-select-suffix{color:", select.iconColor, ";position:relative;}.k-select-suffix{margin-left:", select.suffixGap, ";}.k-select-placeholder{color:", select.placeholderColor, ";user-select:none;}&.k-fluid{width:100%;}.k-select-clear{opacity:0;transition:opacity ", select.transition, ",color ", select.transition, "!important;pointer-events:none;position:absolute;z-index:1;top:50%;left:50%;transform:translate(-50%, -50%);}&:hover{border:", select.hoverBorder, ";.k-select-clear.k-show{opacity:1;pointer-events:all;+.k-select-suffix-icon{opacity:0;}}}.k-select-suffix-icon{display:inline-block;transition:opacity ", select.transition, ";}.k-select-arrow{display:inline-block;transition:transform ", select.transition, ";&.k-disabled{color:", select.disabledArrowColor, ";}}&.k-dropdown-open{border:", select.focusBorder, ";.k-select-arrow{transform:rotateX(180deg);}}&:focus{outline:none;border:", select.focusBorder, ";}&.k-disabled{color:", select.disabled.color, ";cursor:not-allowed;background:", select.disabled.bgColor, ";border-color:", select.disabled.borderColor, ";.k-select-tag{background:", select.tag.disabledBgColor, ";}}.k-select-values{display:inline-block;margin-right:-", getRight(select.tag.margin), ";&.k-with-values{margin:0;}}.k-select-tag{display:inline-flex;align-items:center;padding:", select.tag.padding, ";background:", select.tag.bgColor, ";border-radius:", select.tag.borderRadius, ";margin:", select.tag.margin, ";line-height:1;}.k-select-close{margin-left:", select.tag.delete.gap, ";font-size:", select.tag.delete.fontSize, ";color:", select.tag.delete.color, ";}.k-select-input{margin-right:", getRight(select.tag.margin), ";}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
191
|
+
return /*#__PURE__*/css("display:inline-flex;align-items:center;vertical-align:middle;position:relative;width:", select.width, ";cursor:pointer;outline:none;border:", select.border, ";background:", select.bgColor, ";transition:border ", select.transition, ",background ", select.transition, ",box-shadow ", select.transition, ";border-radius:", select.borderRadius, ";.k-select-main{flex:1;min-width:0;}.k-select-prefix,.k-select-suffix{color:", select.iconColor, ";position:relative;}.k-select-suffix{margin-left:", select.suffixGap, ";}.k-select-placeholder{color:", select.placeholderColor, ";user-select:none;}&.k-fluid{width:100%;}.k-select-clear{opacity:0;transition:opacity ", select.transition, ",color ", select.transition, "!important;pointer-events:none;position:absolute;z-index:1;top:50%;left:50%;transform:translate(-50%, -50%);}&:hover{border:", select.hoverBorder, ";.k-select-clear.k-show{opacity:1;pointer-events:all;+.k-select-suffix-icon{opacity:0;}}}.k-select-suffix-icon{display:inline-block;transition:opacity ", select.transition, ";}.k-select-arrow{display:inline-block;transition:transform ", select.transition, ";&.k-disabled{color:", select.disabledArrowColor, ";}}&.k-dropdown-open{border:", select.focusBorder, ";.k-select-arrow{transform:rotateX(180deg);}}&:focus{outline:none;border:", select.focusBorder, ";}&.k-disabled{color:", select.disabled.color, ";cursor:not-allowed;background:", select.disabled.bgColor, ";border-color:", select.disabled.borderColor, ";.k-select-tag{background:", select.tag.disabledBgColor, ";}}.k-select-values{display:inline-block;margin-right:-", getRight(select.tag.margin), ";&.k-with-values{margin:0;}}.k-select-tag{display:inline-flex;align-items:center;padding:", select.tag.padding, ";background:", select.tag.bgColor, ";border-radius:", select.tag.borderRadius, ";margin:", select.tag.margin, ";line-height:1;}.k-select-close{margin-left:", select.tag.delete.gap, ";font-size:", select.tag.delete.fontSize, ";color:", select.tag.delete.color, ";}.k-select-input{margin-right:", getRight(select.tag.margin), ";}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
192
192
|
var styles = select[size];
|
|
193
193
|
var className = /*#__PURE__*/css("font-size:", styles.fontSize, ";min-height:", styles.height, ";padding:", styles.padding, ";");
|
|
194
194
|
if (size === 'default') return className;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _sortInstanceProperty from "@babel/runtime-corejs3/core-js/instance/sort";
|
|
2
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
2
3
|
import { css } from '@emotion/css';
|
|
3
4
|
import { theme, setDefault } from '../../styles/theme';
|
|
4
5
|
import { deepDefaults, palette } from '../../styles/utils';
|
|
@@ -75,6 +76,7 @@ var defaults = {
|
|
|
75
76
|
resizeWidth: "5px",
|
|
76
77
|
draggingOpacity: ".4"
|
|
77
78
|
};
|
|
79
|
+
var aligns = ['left', 'right', 'center'];
|
|
78
80
|
var table;
|
|
79
81
|
setDefault(function () {
|
|
80
82
|
table = deepDefaults(theme, {
|
|
@@ -82,7 +84,9 @@ setDefault(function () {
|
|
|
82
84
|
}).table;
|
|
83
85
|
});
|
|
84
86
|
export function makeStyles() {
|
|
85
|
-
return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";border-top:", table.border, ";position:relative;z-index:0;.k-table-wrapper{border-bottom:", table.border, ";overflow:auto;}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, ";}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";border-bottom:", table.border, ";&: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%;}.k-table-title-text{flex:1;}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-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{width:", table.group.width, "!important;height:", table.group.width, "!important;margin-left:", table.group.gap, ";position:relative;color:", table.group.color, ";&:hover{color:", theme.color.primary, ";}.k-icon{transition:transform ", table.transition, ";}&.k-dropdown-open .k-icon{transform:rotate(180deg);}}.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-left:", _sortInstanceProperty(table).gap, ";color:", _sortInstanceProperty(table).color, ";}&.k-asc .k-icon.k-desc,&.k-desc .k-icon.k-asc{color:", _sortInstanceProperty(table).disabledColor, ";}}.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;}")
|
|
87
|
+
return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";border-top:", table.border, ";position:relative;z-index:0;.k-table-wrapper{border-bottom:", table.border, ";overflow:auto;}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, ";}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";border-bottom:", table.border, ";&: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%;}.k-table-title-text{flex:1;}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-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{width:", table.group.width, "!important;height:", table.group.width, "!important;margin-left:", table.group.gap, ";position:relative;color:", table.group.color, ";&:hover{color:", theme.color.primary, ";}.k-icon{transition:transform ", table.transition, ";}&.k-dropdown-open .k-icon{transform:rotate(180deg);}}.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-left:", _sortInstanceProperty(table).gap, ";color:", _sortInstanceProperty(table).color, ";}&.k-asc .k-icon.k-desc,&.k-desc .k-icon.k-asc{color:", _sortInstanceProperty(table).disabledColor, ";}}.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) {
|
|
88
|
+
return /*#__PURE__*/css(".k-align-", type, "{text-align:", type, ";}");
|
|
89
|
+
}), ";");
|
|
86
90
|
}
|
|
87
91
|
export function makeGroupMenuStyles() {
|
|
88
92
|
return /*#__PURE__*/css("max-height:", table.group.menuMaxHeight, ";overflow:auto;.k-dropdown-item.k-active{color:", table.group.activeColor, ";}");
|
|
@@ -15,7 +15,7 @@ export declare function useFixedColumns(getColumns: () => VNodeComponentClass<Ta
|
|
|
15
15
|
getHasFixedLeft: () => boolean;
|
|
16
16
|
getOffsetMap: () => Record<Key, number>;
|
|
17
17
|
};
|
|
18
|
-
export declare function getClassAndStyleForFixed({ className, fixed }: Props<TableColumnProps>, offset: number, checkType?: TableProps['checkType']): {
|
|
18
|
+
export declare function getClassAndStyleForFixed({ className, fixed, align }: Props<TableColumnProps>, offset: number, checkType?: TableProps['checkType']): {
|
|
19
19
|
className: string;
|
|
20
20
|
style: {
|
|
21
21
|
[x: string]: string;
|
|
@@ -125,10 +125,11 @@ export function getClassAndStyleForFixed(_ref2, offset, checkType) {
|
|
|
125
125
|
var _cx, _ref3;
|
|
126
126
|
|
|
127
127
|
var className = _ref2.className,
|
|
128
|
-
fixed = _ref2.fixed
|
|
128
|
+
fixed = _ref2.fixed,
|
|
129
|
+
align = _ref2.align;
|
|
129
130
|
var extraOffset = checkType && checkType !== 'none' && fixed === 'left' ? 40 : 0;
|
|
130
131
|
return {
|
|
131
|
-
className: cx((_cx = {}, _cx[className] = !!className, _cx["k-fixed-" + fixed] = !!fixed, _cx)),
|
|
132
|
+
className: cx((_cx = {}, _cx[className] = !!className, _cx["k-fixed-" + fixed] = !!fixed, _cx["k-align-" + align] = !!align, _cx)),
|
|
132
133
|
style: fixed ? (_ref3 = {}, _ref3[fixed] = offset + extraOffset + "px", _ref3) : null
|
|
133
134
|
};
|
|
134
135
|
}
|
|
@@ -50,7 +50,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
50
50
|
|
|
51
51
|
return [children, showArrow ? _$ce(2, 'i', null, 1, _$cn((_$cn2 = {
|
|
52
52
|
"k-tooltip-arrow": true
|
|
53
|
-
}, _$cn2["k-" + arrowType.value] = arrowType.value, _$cn2)), null,
|
|
53
|
+
}, _$cn2["k-" + arrowType.value] = arrowType.value, _$cn2)), null, 'tooltip-arrow', arrowRef) : undefined, confirm ? _$ce(2, 'div', (_$blocks['buttons'] = function ($super) {
|
|
54
54
|
return [_$cc(Button, {
|
|
55
55
|
'type': 'primary',
|
|
56
56
|
'ev-click': this.ok,
|
|
@@ -69,7 +69,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
72
|
-
}, __$blocks['buttons'](_$no)), 0, 'k-tooltip-buttons') : undefined];
|
|
72
|
+
}, __$blocks['buttons'](_$no)), 0, 'k-tooltip-buttons', null, 'tooltip-buttons') : undefined];
|
|
73
73
|
}, __$blocks['children'] = function ($super, data) {
|
|
74
74
|
var block = $blocks['children'];
|
|
75
75
|
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.8
|
|
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.8";
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.8
|
|
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.8';
|
|
63
63
|
/* generate end */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import * as ReactDOM from 'react-dom';
|
|
6
|
+
import { Drawer, Card } from '../../';
|
|
7
|
+
import { Component } from 'intact-react';
|
|
8
|
+
describe('Drawer', function () {
|
|
9
|
+
it('should render react element correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
10
|
+
var container, Test;
|
|
11
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
12
|
+
while (1) {
|
|
13
|
+
switch (_context.prev = _context.next) {
|
|
14
|
+
case 0:
|
|
15
|
+
container = document.createElement('div');
|
|
16
|
+
document.body.appendChild(container);
|
|
17
|
+
|
|
18
|
+
Test = /*#__PURE__*/function (_Component) {
|
|
19
|
+
_inheritsLoose(Test, _Component);
|
|
20
|
+
|
|
21
|
+
function Test() {
|
|
22
|
+
return _Component.apply(this, arguments) || this;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var _proto = Test.prototype;
|
|
26
|
+
|
|
27
|
+
_proto.mounted = function mounted() {
|
|
28
|
+
expect(document.body.contains(this.refs.a));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return Test;
|
|
32
|
+
}(Component);
|
|
33
|
+
|
|
34
|
+
Test.template = "<div ref=\"a\">test</div>";
|
|
35
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Drawer, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Test, null)))), container);
|
|
36
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
37
|
+
document.body.removeChild(container);
|
|
38
|
+
|
|
39
|
+
case 7:
|
|
40
|
+
case "end":
|
|
41
|
+
return _context.stop();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, _callee);
|
|
45
|
+
})));
|
|
46
|
+
});
|
|
@@ -18,7 +18,7 @@ var testsContext = require.context('./components/', true, /.*\.spec\.tsx?/);
|
|
|
18
18
|
_keysInstanceProperty(testsContext).call(testsContext).forEach(testsContext); // const reactReq = require.context('~/components/', true, /^((?!(affix|code|layout)).)*\/demos\/.*react\.tsx$/);
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var reactReq = require.context('~/components/', true, /^((?!(affix|code)).)*\/demos\/.*react\.tsx$/); // const reactReq = require.context('~/components/', true, /
|
|
21
|
+
var reactReq = require.context('~/components/', true, /^((?!(affix|code)).)*\/demos\/.*react\.tsx$/); // const reactReq = require.context('~/components/', true, /layout\/demos\/.*react\.tsx$/);
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
describe('React Demos', function () {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
3
4
|
import { __decorate } from "tslib";
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import { Layout, Header, Aside, Body, Menu, MenuItem, Icon, Breadcrumb, BreadcrumbItem, Button } from '@king-design/react';
|
|
@@ -39,7 +40,8 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
_proto.render = function render() {
|
|
42
|
-
var _this2 = this
|
|
43
|
+
var _this2 = this,
|
|
44
|
+
_context2;
|
|
43
45
|
|
|
44
46
|
return /*#__PURE__*/React.createElement(Layout, {
|
|
45
47
|
className: "layout"
|
|
@@ -112,9 +114,9 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
112
114
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
113
115
|
className: "ion-navicon",
|
|
114
116
|
size: "30"
|
|
115
|
-
}))), /*#__PURE__*/React.createElement(Body, null, /*#__PURE__*/React.createElement(Breadcrumb, null, /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Home"), /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Detail")),
|
|
116
|
-
"
|
|
117
|
-
}
|
|
117
|
+
}))), /*#__PURE__*/React.createElement(Body, null, /*#__PURE__*/React.createElement(Breadcrumb, null, /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Home"), /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Detail")), _mapInstanceProperty(_context2 = this.state.data).call(_context2, function ($value, $key) {
|
|
118
|
+
return /*#__PURE__*/React.createElement("div", null, "content");
|
|
119
|
+
}))));
|
|
118
120
|
};
|
|
119
121
|
|
|
120
122
|
return Demo;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { Layout, Header, Aside, Body, Menu, MenuItem, Icon, Breadcrumb, BreadcrumbItem } from '@king-design/react';
|
|
5
6
|
import './index.styl';
|
|
@@ -30,7 +31,8 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
30
31
|
var _proto = Demo.prototype;
|
|
31
32
|
|
|
32
33
|
_proto.render = function render() {
|
|
33
|
-
var _this2 = this
|
|
34
|
+
var _this2 = this,
|
|
35
|
+
_context2;
|
|
34
36
|
|
|
35
37
|
return /*#__PURE__*/React.createElement(Layout, {
|
|
36
38
|
className: "layout"
|
|
@@ -114,9 +116,9 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
114
116
|
key: "4"
|
|
115
117
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
116
118
|
className: "ion-gear-b"
|
|
117
|
-
}), "menu 4"))), /*#__PURE__*/React.createElement(Body, null, /*#__PURE__*/React.createElement(Breadcrumb, null, /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Home"), /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Detail")),
|
|
118
|
-
"
|
|
119
|
-
}
|
|
119
|
+
}), "menu 4"))), /*#__PURE__*/React.createElement(Body, null, /*#__PURE__*/React.createElement(Breadcrumb, null, /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Home"), /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Detail")), _mapInstanceProperty(_context2 = this.state.data).call(_context2, function ($value, $key) {
|
|
120
|
+
return /*#__PURE__*/React.createElement("div", null, "content");
|
|
121
|
+
}))));
|
|
120
122
|
};
|
|
121
123
|
|
|
122
124
|
return Demo;
|
|
@@ -10,6 +10,12 @@ var Index = /*#__PURE__*/function (_Layout) {
|
|
|
10
10
|
return _Layout.apply(this, arguments) || this;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
var _proto = Index.prototype;
|
|
14
|
+
|
|
15
|
+
_proto.handleDownLoad = function handleDownLoad() {
|
|
16
|
+
location.href = 'https://damife.ks3-cn-beijing.ksyuncs.com/kpc/Kingsoft_Cloud_Font.ttf';
|
|
17
|
+
};
|
|
18
|
+
|
|
13
19
|
return Index;
|
|
14
20
|
}(Layout);
|
|
15
21
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { css } from '@emotion/css';
|
|
2
|
-
import source_nav_web from '../../imgs/font/banner-
|
|
3
|
-
import source_nav_h5 from '../../imgs/font/banner-h5.jpg';
|
|
4
|
-
import title_web from "../../imgs/font/title-web.png";
|
|
2
|
+
import source_nav_web from '../../imgs/font/banner-font.jpg';
|
|
5
3
|
import text_web from "../../imgs/font/text-web.png";
|
|
6
4
|
import text_h5 from "../../imgs/font/text-h5.png";
|
|
7
5
|
export function makeStyles() {
|
|
8
|
-
return /*#__PURE__*/css(".
|
|
6
|
+
return /*#__PURE__*/css(".font-nav{height:600px;margin-top:-64px;background-image:url(", source_nav_web, ");background-size:cover;background-position:center;background-repeat:no-repeat;display:flex;justify-content:center;.bg-img{display:none;}.font-nav-content{height:536px;margin-top:64px;width:1200px;display:flex;align-items:center;.nav-content-img{img{width:380px;}.nav-btn-download{margin-top:30px;width:380px;height:60px;border:none;background:#006FFF;border-radius:14px;font-family:PingFangSC-Regular;font-size:18px;color:#FFFFFF;font-weight:400;cursor:pointer;transition:all .25s ease-in;outline:none;&:hover{background-color:#3D91FF;}&:active{background-color:#3D91FF;}}}}@media (max-width: 768px){background-image:none;height:900px;position:relative;height:auto;.bg-img{display:block;width:100%;}.font-nav-content{position:absolute;left:0;top:10px;width:100%;height:40%;justify-content:center;.nav-content-img{width:100%;text-align:center;img{width:65%;}.nav-btn-download{height:50px;width:65%;}}}}}.source-intro{margin:100px auto;background-image:url(", text_web, ");width:800px;height:590px;background-repeat:no-repeat;background-position:right bottom;background-size:cover;@media (max-width:768px){margin:13% auto;width:64%;background-image:url(", text_h5, ");background-size:contain;background-position:center;}}.font-info{background:#F7F8F9;margin-bottom:60px;padding:80px 0;text-align:center;img{width:400px;}@media (max-width:768px){margin-bottom:40px;padding:60px 0;img{width:80%;height:auto;}}}.designer-box{background:#F7F8F9;padding-top:40px;}.designer-part{width:1200px;margin:0 auto;.designer-title{display:flex;margin-bottom:60px;img{width:90px;}&>div:last-child{flex-grow:1;margin-left:24px;border-bottom:1px solid rgba(151, 151, 151, .3);}@media (max-width:768px){margin-bottom:40px;img{width:60px;height:auto;}}}.designer-list{width:100%;display:flex;flex-wrap:wrap;@media (max-width: 768px){justify-content:space-between;}.designer-item{img{width:200px;border-radius:16px;}&>div:last-child{text-align:center;font-size:18px;color:#000000;padding:20px 0 40px 0;font-family:PingFangSC-Regular;}@media (max-width: 768px){img{border-radius:8px;}&>div:last-child{font-size:12px;padding:10px 0 25px 0;}}}.designer-item:not(:nth-child(5n)){margin-right:50px;}}@media (max-width: 768px){width:90%;.designer-list{.designer-item{width:22%;img{width:100%!important;}}.designer-item:not(:nth-child(5n)){margin-right:0;}}}}.icon-list-box{/* padding-top: 60px;\n @media (max-width: 768px) {\n padding-top: 30px;\n } */}.icon-list{width:1200px;margin:0 auto;@media (max-width: 768px){width:98%;}.icon-box{margin-top:20px;.icon-box-title{margin-bottom:60px;display:flex;&>div{border-bottom:1px solid rgba(151, 151, 151, .3);}&>div:first-child{display:none;}img{height:30px;}&>div:last-child{width:100%;margin-left:24px;}@media (max-width: 768px){margin-bottom:40px;&>div:first-child{display:block;width:45%;margin-right:24px;}&>div:last-child{width:45%;margin-left:24px;}img{height:20px;}}}.icon-wrapper{display:flex;flex-wrap:wrap;img{width:60px;height:60px;}.icon-item{width:240px;display:flex;align-items:center;margin-bottom:60px;display:flex;&>div:last-child{margin-left:20px;font-family:PingFangSC-Regular;font-size:16px;color:#000000;}@media (max-width: 768px){text-align:center;display:block;margin-bottom:30px;width:33.33%;&>div:last-child{font-size:14px!important;margin-left:0px;margin-top:5px;}img{width:45%;height:auto;}}}}}}");
|
|
9
7
|
}
|
|
@@ -3,5 +3,5 @@ import global from '../../styles/default';
|
|
|
3
3
|
import banner from '../../imgs/banner.jpg';
|
|
4
4
|
import h5banner from '../../imgs/h5banner.jpg';
|
|
5
5
|
export function makeStyles() {
|
|
6
|
-
return /*#__PURE__*/css("font-family:", global.fontFamily, ";.nav{height:460px;position:relative;margin-top:-64px;.nav-bg,.nav-content-box{width:100%;height:100%;position:absolute;left:0;top:0;}.nav-bg{z-index:1;background-image:url(", banner, ");background-repeat:no-repeat;background-size:cover;}.nav-video-box{width:100%;height:100%;overflow:hidden;position:absolute;left:0;top:0;.nav-video-bg{width:1920px;height:460px;}}.nav-content-box{z-index:10;background:linear-gradient(270deg, rgba(248,252,255,0) 32%, rgba(244,249,255,0.96) 73%);display:flex;align-items:center;justify-content:center;padding:0 20px;}.nav-content{width:", global.contentWidth, "px;color:#000000;height:100%;position:relative;.main-title.h5-title{font-size:
|
|
6
|
+
return /*#__PURE__*/css("font-family:", global.fontFamily, ";.nav{height:460px;position:relative;margin-top:-64px;.nav-bg,.nav-content-box{width:100%;height:100%;position:absolute;left:0;top:0;}.nav-bg{z-index:1;background-image:url(", banner, ");background-repeat:no-repeat;background-size:cover;}.nav-video-box{width:100%;height:100%;overflow:hidden;position:absolute;left:0;top:0;.nav-video-bg{width:1920px;height:460px;}}.nav-content-box{z-index:10;background:linear-gradient(270deg, rgba(248,252,255,0) 32%, rgba(244,249,255,0.96) 73%);display:flex;align-items:center;justify-content:center;padding:0 20px;}.nav-content{width:", global.contentWidth, "px;color:#000000;height:100%;position:relative;.main-title.h5-title{font-size:36px;}.h5-title{display:none;}.web-title{display:block;}.h5-title{width:100%;text-align:center;}&>div{position:absolute;}.main-title{font-size:45px;font-weight:500;top:164px;}.sub-title{font-size:22px;top:237px;}&>div:last-child{top:340px;.k-btn{margin-right:16px;}}}}@media (min-width: 1920px){.nav{.nav-video-box{.nav-video-bg{width:100%;height:auto;}}}}@media (max-width: 768px){.nav{.nav-content{width:100%;.h5-title{display:block;}.web-title{display:none;}.sub-title{margin-top:10px;}&>div:last-child{width:100%;text-align:center;}}.nav-bg{background-image:url(", h5banner, ");background-size:cover;background-position:center;}.nav-video-box{&,& video{display:none;}}}}");
|
|
7
7
|
}
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.8
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -62,6 +62,6 @@ export * from './components/treeSelect';
|
|
|
62
62
|
export * from './components/upload';
|
|
63
63
|
export * from './components/wave';
|
|
64
64
|
|
|
65
|
-
export const version = '2.0.
|
|
65
|
+
export const version = '2.0.8';
|
|
66
66
|
|
|
67
67
|
/* generate end */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@king-design/intact",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "A component library written in Intact for Intact, Vue, React and Angular",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"highlight.js": "^10.4.1",
|
|
117
117
|
"history": "^5.0.0",
|
|
118
118
|
"html-webpack-plugin": "5.3.1",
|
|
119
|
-
"intact-react": "^3.0.
|
|
119
|
+
"intact-react": "^3.0.9",
|
|
120
120
|
"istanbul-instrumenter-loader": "^3.0.0",
|
|
121
121
|
"js-yaml": "^4.1.0",
|
|
122
122
|
"karma": "^6.3.2",
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"dayjs": "^1.10.7",
|
|
179
179
|
"downloadjs": "^1.4.7",
|
|
180
180
|
"enquire.js": "^2.1.6",
|
|
181
|
-
"intact": "^3.0.
|
|
181
|
+
"intact": "^3.0.9",
|
|
182
182
|
"monaco-editor": "^0.26.1",
|
|
183
183
|
"mxgraphx": "^4.0.7",
|
|
184
184
|
"resize-observer-polyfill": "^1.5.1",
|