x-star-design 0.0.68 → 0.0.70
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/dist/aliplayer/index.d.ts +4 -2
- package/dist/aliplayer/index.js +9 -6
- package/dist/micro-app/index.d.ts +2 -1
- package/dist/micro-app/index.js +4 -3
- package/dist/sort-table/index.d.ts +2 -2
- package/dist/sort-table/index.js +94 -81
- package/dist/virtual-table/index.d.ts +1 -1
- package/package.json +6 -3
|
@@ -5,8 +5,10 @@ import React from 'react';
|
|
|
5
5
|
export interface AliplayerConfig {
|
|
6
6
|
vid: string;
|
|
7
7
|
playauth: string;
|
|
8
|
-
autoplay
|
|
9
|
-
language
|
|
8
|
+
autoplay?: boolean;
|
|
9
|
+
language?: string;
|
|
10
|
+
encryptType?: number;
|
|
11
|
+
keyShortCuts?: boolean;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Aliplayer 实例
|
package/dist/aliplayer/index.js
CHANGED
|
@@ -23,13 +23,13 @@ var Aliplayer = function Aliplayer(_ref) {
|
|
|
23
23
|
var importAliPlayer = function importAliPlayer() {
|
|
24
24
|
var link = window.document.createElement('link');
|
|
25
25
|
link.rel = 'stylesheet';
|
|
26
|
-
link.href = 'https://g.alicdn.com/
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
link.href = 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/skins/default/aliplayer-min.css';
|
|
27
|
+
var script = window.document.createElement('script');
|
|
28
|
+
script.type = 'text/javascript';
|
|
29
|
+
script.src = 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/aliplayer-h5-min.js';
|
|
30
30
|
var head = window.document.querySelector('head');
|
|
31
31
|
head === null || head === void 0 ? void 0 : head.append(link);
|
|
32
|
-
head === null || head === void 0 ? void 0 : head.append(
|
|
32
|
+
head === null || head === void 0 ? void 0 : head.append(script);
|
|
33
33
|
};
|
|
34
34
|
if (!window.Aliplayer) {
|
|
35
35
|
importAliPlayer();
|
|
@@ -48,7 +48,10 @@ var Aliplayer = function Aliplayer(_ref) {
|
|
|
48
48
|
var Aliplayer = window.Aliplayer;
|
|
49
49
|
if (Aliplayer) {
|
|
50
50
|
// 创建 Aliplayer 实例
|
|
51
|
-
player.current = new Aliplayer(_objectSpread(_objectSpread({
|
|
51
|
+
player.current = new Aliplayer(_objectSpread(_objectSpread({
|
|
52
|
+
encryptType: 1,
|
|
53
|
+
keyShortCuts: true
|
|
54
|
+
}, config), {}, {
|
|
52
55
|
id: id
|
|
53
56
|
}), function (player) {
|
|
54
57
|
return onCreate === null || onCreate === void 0 ? void 0 : onCreate(player);
|
|
@@ -7,9 +7,10 @@ interface MicroAppProps {
|
|
|
7
7
|
entry: string;
|
|
8
8
|
pathname: string;
|
|
9
9
|
microProps?: Record<string, unknown>;
|
|
10
|
+
fallback?: React.ReactNode;
|
|
10
11
|
}
|
|
11
12
|
declare const MicroApp: {
|
|
12
|
-
({ className, style, name, entry, pathname, microProps, }: MicroAppProps): React.JSX.Element;
|
|
13
|
+
({ className, style, name, entry, pathname, microProps, fallback, }: MicroAppProps): React.JSX.Element;
|
|
13
14
|
useGlobalState({ lang, setLang, }: {
|
|
14
15
|
lang: 'zh' | 'en';
|
|
15
16
|
setLang: (lang?: 'zh' | 'en') => void;
|
package/dist/micro-app/index.js
CHANGED
|
@@ -13,7 +13,8 @@ var MicroApp = function MicroApp(_ref) {
|
|
|
13
13
|
name = _ref.name,
|
|
14
14
|
entry = _ref.entry,
|
|
15
15
|
pathname = _ref.pathname,
|
|
16
|
-
microProps = _ref.microProps
|
|
16
|
+
microProps = _ref.microProps,
|
|
17
|
+
fallback = _ref.fallback;
|
|
17
18
|
var microAppId = useMemo(function () {
|
|
18
19
|
return "microapp-".concat(randomString(8));
|
|
19
20
|
}, []);
|
|
@@ -79,9 +80,9 @@ var MicroApp = function MicroApp(_ref) {
|
|
|
79
80
|
position: 'relative',
|
|
80
81
|
minHeight: 600
|
|
81
82
|
}, style)
|
|
82
|
-
}, loading && /*#__PURE__*/React.createElement(RainbowCat, {
|
|
83
|
+
}, loading && (fallback !== undefined ? fallback : /*#__PURE__*/React.createElement(RainbowCat, {
|
|
83
84
|
text: t('Loading')
|
|
84
|
-
}));
|
|
85
|
+
})));
|
|
85
86
|
};
|
|
86
87
|
MicroApp.useGlobalState = function (_ref2) {
|
|
87
88
|
var lang = _ref2.lang,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TableProps } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
interface SortTableProps<RecordType> extends TableProps<RecordType> {
|
|
4
|
-
onSortEnd?: (
|
|
4
|
+
onSortEnd?: (data: RecordType[]) => void;
|
|
5
5
|
}
|
|
6
|
-
declare const SortTable: <RecordType extends Record<string,
|
|
6
|
+
declare const SortTable: <RecordType extends Record<string | number | symbol, any>>(props: SortTableProps<RecordType>) => React.JSX.Element;
|
|
7
7
|
export default SortTable;
|
package/dist/sort-table/index.js
CHANGED
|
@@ -1,95 +1,108 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import { HolderOutlined } from '@ant-design/icons';
|
|
5
|
+
import { DndContext } from '@dnd-kit/core';
|
|
6
|
+
import { restrictToVerticalAxis } from '@dnd-kit/modifiers';
|
|
7
|
+
import { SortableContext, arrayMove, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
8
|
+
import { CSS } from '@dnd-kit/utilities';
|
|
9
|
+
import { Button, Table } from 'antd';
|
|
10
|
+
import React, { useContext, useMemo } from 'react';
|
|
11
|
+
var RowContext = /*#__PURE__*/React.createContext({});
|
|
12
|
+
var DragHandle = function DragHandle() {
|
|
13
|
+
var _useContext = useContext(RowContext),
|
|
14
|
+
setActivatorNodeRef = _useContext.setActivatorNodeRef,
|
|
15
|
+
listeners = _useContext.listeners;
|
|
16
|
+
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
17
|
+
"data-testid": "dragHandle",
|
|
18
|
+
ref: setActivatorNodeRef,
|
|
19
|
+
style: {
|
|
20
|
+
cursor: 'move'
|
|
21
|
+
},
|
|
22
|
+
type: "text",
|
|
23
|
+
size: "small",
|
|
24
|
+
icon: /*#__PURE__*/React.createElement(HolderOutlined, null)
|
|
25
|
+
}, listeners));
|
|
26
|
+
};
|
|
27
|
+
var Row = function Row(props) {
|
|
28
|
+
var _useSortable = useSortable({
|
|
29
|
+
id: props['data-row-key']
|
|
30
|
+
}),
|
|
31
|
+
attributes = _useSortable.attributes,
|
|
32
|
+
listeners = _useSortable.listeners,
|
|
33
|
+
setNodeRef = _useSortable.setNodeRef,
|
|
34
|
+
setActivatorNodeRef = _useSortable.setActivatorNodeRef,
|
|
35
|
+
transform = _useSortable.transform,
|
|
36
|
+
transition = _useSortable.transition,
|
|
37
|
+
isDragging = _useSortable.isDragging;
|
|
38
|
+
var style = _objectSpread(_objectSpread({}, props.style), {}, {
|
|
39
|
+
transform: CSS.Translate.toString(transform),
|
|
40
|
+
transition: transition
|
|
41
|
+
}, isDragging ? {
|
|
42
|
+
position: 'relative',
|
|
43
|
+
zIndex: 9999
|
|
44
|
+
} : {});
|
|
45
|
+
var contextValue = useMemo(function () {
|
|
46
|
+
return {
|
|
47
|
+
setActivatorNodeRef: setActivatorNodeRef,
|
|
48
|
+
listeners: listeners
|
|
49
|
+
};
|
|
50
|
+
}, [setActivatorNodeRef, listeners]);
|
|
51
|
+
return /*#__PURE__*/React.createElement(RowContext.Provider, {
|
|
52
|
+
value: contextValue
|
|
53
|
+
}, /*#__PURE__*/React.createElement("tr", _extends({
|
|
54
|
+
"data-testid": "tableRow"
|
|
55
|
+
}, props, {
|
|
56
|
+
ref: setNodeRef,
|
|
57
|
+
style: style
|
|
58
|
+
}, attributes)));
|
|
59
|
+
};
|
|
9
60
|
var SortTable = function SortTable(props) {
|
|
10
61
|
var _props$columns;
|
|
11
|
-
var _props$
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
62
|
+
var _props$rowKey = props.rowKey,
|
|
63
|
+
rowKey = _props$rowKey === void 0 ? 'key' : _props$rowKey,
|
|
64
|
+
_props$dataSource = props.dataSource,
|
|
65
|
+
dataSource = _props$dataSource === void 0 ? [] : _props$dataSource;
|
|
66
|
+
var getKey = function getKey(record) {
|
|
67
|
+
return typeof rowKey === 'function' ? rowKey(record) : record[rowKey];
|
|
68
|
+
};
|
|
69
|
+
var onDragEnd = function onDragEnd(_ref) {
|
|
70
|
+
var active = _ref.active,
|
|
71
|
+
over = _ref.over;
|
|
72
|
+
if (over && active.id !== over.id) {
|
|
73
|
+
var _props$onSortEnd;
|
|
74
|
+
var activeIndex = dataSource.findIndex(function (record) {
|
|
75
|
+
return getKey(record) === active.id;
|
|
76
|
+
});
|
|
77
|
+
var overIndex = dataSource.findIndex(function (record) {
|
|
78
|
+
return getKey(record) === over.id;
|
|
79
|
+
});
|
|
80
|
+
(_props$onSortEnd = props.onSortEnd) === null || _props$onSortEnd === void 0 ? void 0 : _props$onSortEnd.call(props, arrayMove(dataSource, activeIndex, overIndex));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var columns = [{
|
|
84
|
+
key: 'sort',
|
|
27
85
|
align: 'center',
|
|
28
86
|
width: 80,
|
|
29
|
-
ellipsis: true,
|
|
30
|
-
className: 'drag-visible',
|
|
31
87
|
render: function render() {
|
|
32
88
|
return /*#__PURE__*/React.createElement(DragHandle, null);
|
|
33
89
|
}
|
|
34
90
|
}].concat(_toConsumableArray((_props$columns = props.columns) !== null && _props$columns !== void 0 ? _props$columns : []));
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}));
|
|
45
|
-
});
|
|
46
|
-
var onSortEnd = function onSortEnd(sortEnd) {
|
|
47
|
-
var oldIndex = sortEnd.oldIndex,
|
|
48
|
-
newIndex = sortEnd.newIndex;
|
|
49
|
-
if (oldIndex !== newIndex) {
|
|
50
|
-
var newData = _toConsumableArray(dataSource); // 创建 dataSource 的副本
|
|
51
|
-
// 移除旧位置的元素,并将其插入新位置
|
|
52
|
-
var _newData$splice = newData.splice(oldIndex, 1),
|
|
53
|
-
_newData$splice2 = _slicedToArray(_newData$splice, 1),
|
|
54
|
-
removedItem = _newData$splice2[0];
|
|
55
|
-
newData.splice(newIndex, 0, removedItem);
|
|
56
|
-
var filteredData = newData.filter(function (el) {
|
|
57
|
-
return !!el;
|
|
58
|
-
}); // 过滤掉空元素
|
|
59
|
-
onEnd === null || onEnd === void 0 ? void 0 : onEnd(filteredData);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
var DraggableContainer = function DraggableContainer(props) {
|
|
63
|
-
return /*#__PURE__*/React.createElement(SortableBody, _extends({}, props, {
|
|
64
|
-
useDragHandle: true,
|
|
65
|
-
disableAutoscroll: true,
|
|
66
|
-
helperClass: "row-dragging",
|
|
67
|
-
helperContainer: function helperContainer() {
|
|
68
|
-
return bodyRef.current;
|
|
69
|
-
},
|
|
70
|
-
onSortEnd: onSortEnd
|
|
71
|
-
}));
|
|
72
|
-
};
|
|
73
|
-
var DraggableBodyRow = function DraggableBodyRow(props) {
|
|
74
|
-
// function findIndex base on Table rowKey props and should always be a right array index
|
|
75
|
-
var index = dataSource.findIndex(function (x) {
|
|
76
|
-
return typeof rowKey === 'string' && x[rowKey] === props['data-row-key'];
|
|
77
|
-
});
|
|
78
|
-
return /*#__PURE__*/React.createElement(SortableItem, _extends({}, props, {
|
|
79
|
-
key: index,
|
|
80
|
-
index: index
|
|
81
|
-
}));
|
|
82
|
-
};
|
|
83
|
-
return /*#__PURE__*/React.createElement(ConfigProviderWrapper, null, /*#__PURE__*/React.createElement(Table, _extends({}, props, {
|
|
84
|
-
columns: newColumns,
|
|
85
|
-
dataSource: dataSource,
|
|
86
|
-
rowKey: rowKey,
|
|
91
|
+
return /*#__PURE__*/React.createElement(DndContext, {
|
|
92
|
+
modifiers: [restrictToVerticalAxis],
|
|
93
|
+
onDragEnd: onDragEnd
|
|
94
|
+
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
95
|
+
items: dataSource.map(function (record) {
|
|
96
|
+
return getKey(record);
|
|
97
|
+
}),
|
|
98
|
+
strategy: verticalListSortingStrategy
|
|
99
|
+
}, /*#__PURE__*/React.createElement(Table, _extends({}, props, {
|
|
87
100
|
components: {
|
|
88
101
|
body: {
|
|
89
|
-
|
|
90
|
-
row: DraggableBodyRow
|
|
102
|
+
row: Row
|
|
91
103
|
}
|
|
92
|
-
}
|
|
93
|
-
|
|
104
|
+
},
|
|
105
|
+
columns: columns
|
|
106
|
+
}))));
|
|
94
107
|
};
|
|
95
108
|
export default SortTable;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { TableProps } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
declare const VirtualTable: <RecordType extends Record<string,
|
|
3
|
+
declare const VirtualTable: <RecordType extends Record<string | number | symbol, any>>(props: TableProps<RecordType>) => React.JSX.Element;
|
|
4
4
|
export default VirtualTable;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-star-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.70",
|
|
4
4
|
"description": "A react component library developed by turingstar",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -52,6 +52,10 @@
|
|
|
52
52
|
"@codemirror/lang-python": "^6.1.3",
|
|
53
53
|
"@codemirror/language": "^6.9.0",
|
|
54
54
|
"@codemirror/lint": "^6.4.0",
|
|
55
|
+
"@dnd-kit/core": "^6.1.0",
|
|
56
|
+
"@dnd-kit/modifiers": "^7.0.0",
|
|
57
|
+
"@dnd-kit/sortable": "^8.0.0",
|
|
58
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
55
59
|
"@uiw/codemirror-theme-bbedit": "^4.21.9",
|
|
56
60
|
"@uiw/codemirror-theme-eclipse": "^4.21.9",
|
|
57
61
|
"@uiw/codemirror-theme-okaidia": "^4.21.9",
|
|
@@ -62,9 +66,8 @@
|
|
|
62
66
|
"qiankun": "^2.10.16",
|
|
63
67
|
"randomcolor": "^0.6.2",
|
|
64
68
|
"react-error-boundary": "^4.0.13",
|
|
65
|
-
"react-sortable-hoc": "^2.0.0",
|
|
66
69
|
"react-window": "^1.8.9",
|
|
67
|
-
"x-star-utils": "^0.0.
|
|
70
|
+
"x-star-utils": "^0.0.21"
|
|
68
71
|
},
|
|
69
72
|
"devDependencies": {
|
|
70
73
|
"@ant-design/icons": "^5.3.7",
|