@univerjs/design 0.1.0-alpha.1 → 0.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +178 -0
- package/lib/cjs/index.js +48 -2170
- package/lib/es/index.js +11986 -0
- package/lib/index.css +1 -1833
- package/lib/types/components/avatar/Avatar.d.ts +15 -1
- package/lib/types/components/avatar/Avatar.stories.d.ts +29 -0
- package/lib/types/components/avatar/__tests__/index.spec.d.ts +15 -1
- package/lib/types/components/avatar/index.d.ts +15 -1
- package/lib/types/components/button/Button.d.ts +15 -1
- package/lib/types/components/button/Button.stories.d.ts +32 -0
- package/lib/types/components/button/__tests__/index.spec.d.ts +15 -1
- package/lib/types/components/button/index.d.ts +15 -1
- package/lib/types/components/cascader-list/CascaderList.d.ts +15 -1
- package/lib/types/components/cascader-list/CascaderList.stories.d.ts +23 -0
- package/lib/types/components/cascader-list/index.d.ts +15 -1
- package/lib/types/components/checkbox/Checkbox.d.ts +15 -1
- package/lib/types/components/checkbox/Checkbox.stories.d.ts +26 -0
- package/lib/types/components/checkbox/__tests__/index.spec.d.ts +15 -1
- package/lib/types/components/checkbox/index.d.ts +15 -1
- package/lib/types/components/checkbox-group/CheckboxGroup.d.ts +15 -1
- package/lib/types/components/checkbox-group/CheckboxGroup.stories.d.ts +23 -0
- package/lib/types/components/checkbox-group/__tests__/index.spec.d.ts +15 -1
- package/lib/types/components/checkbox-group/index.d.ts +15 -1
- package/lib/types/components/color-picker/ColorPicker.d.ts +15 -1
- package/lib/types/components/color-picker/ColorPicker.stories.d.ts +23 -0
- package/lib/types/components/color-picker/index.d.ts +15 -1
- package/lib/types/components/color-picker/presets.d.ts +15 -1
- package/lib/types/components/config-provider/ConfigProvider.d.ts +15 -1
- package/lib/types/components/config-provider/ConfigProvider.stories.d.ts +23 -0
- package/lib/types/components/config-provider/__tests__/index.spec.d.ts +15 -1
- package/lib/types/components/config-provider/index.d.ts +15 -1
- package/lib/types/components/confirm/Confirm.d.ts +23 -1
- package/lib/types/components/confirm/Confirm.stories.d.ts +23 -0
- package/lib/types/components/confirm/index.d.ts +15 -1
- package/lib/types/components/container/Container.d.ts +15 -1
- package/lib/types/components/container/Container.stories.d.ts +23 -0
- package/lib/types/components/container/__tests__/index.spec.d.ts +15 -1
- package/lib/types/components/container/index.d.ts +15 -1
- package/lib/types/components/design-token/Palette.d.ts +15 -1
- package/lib/types/components/design-token/Palette.stories.d.ts +19 -0
- package/lib/types/components/dialog/Dialog.d.ts +15 -1
- package/lib/types/components/dialog/Dialog.stories.d.ts +23 -0
- package/lib/types/components/dialog/index.d.ts +15 -1
- package/lib/types/components/dropdown/Dropdown.d.ts +15 -1
- package/lib/types/components/dropdown/Dropdown.stories.d.ts +23 -0
- package/lib/types/components/dropdown/index.d.ts +15 -1
- package/lib/types/components/icon/Icon.stories.d.ts +22 -0
- package/lib/types/components/input/Input.d.ts +15 -1
- package/lib/types/components/input/Input.stories.d.ts +29 -0
- package/lib/types/components/input/index.d.ts +15 -1
- package/lib/types/components/input-number/InputNumber.d.ts +15 -1
- package/lib/types/components/input-number/InputNumber.stories.d.ts +29 -0
- package/lib/types/components/input-number/index.d.ts +15 -1
- package/lib/types/components/menu/Menu.d.ts +15 -1
- package/lib/types/components/menu/index.d.ts +15 -1
- package/lib/types/components/message/Message.d.ts +15 -1
- package/lib/types/components/message/Message.stories.d.ts +22 -0
- package/lib/types/components/message/__tests__/index.spec.d.ts +15 -1
- package/lib/types/components/message/index.d.ts +15 -1
- package/lib/types/components/popup/Popup.d.ts +15 -1
- package/lib/types/components/popup/Popup.stories.d.ts +23 -0
- package/lib/types/components/popup/index.d.ts +15 -1
- package/lib/types/components/radio/Radio.d.ts +15 -1
- package/lib/types/components/radio/Radio.stories.d.ts +26 -0
- package/lib/types/components/radio/__tests__/index.spec.d.ts +15 -1
- package/lib/types/components/radio/index.d.ts +15 -1
- package/lib/types/components/radio-group/RadioGroup.d.ts +15 -1
- package/lib/types/components/radio-group/RadioGroup.stories.d.ts +23 -0
- package/lib/types/components/radio-group/__tests__/index.spec.d.ts +15 -1
- package/lib/types/components/radio-group/index.d.ts +15 -1
- package/lib/types/components/scrollbar/Scrollbar.d.ts +15 -1
- package/lib/types/components/scrollbar/Scrollbar.stories.d.ts +20 -0
- package/lib/types/components/scrollbar/__tests__/index.spec.d.ts +15 -1
- package/lib/types/components/scrollbar/index.d.ts +15 -1
- package/lib/types/components/select/Select.d.ts +15 -1
- package/lib/types/components/select/Select.stories.d.ts +26 -0
- package/lib/types/components/select/index.d.ts +15 -1
- package/lib/types/components/select-list/SelectList.d.ts +15 -1
- package/lib/types/components/select-list/SelectList.stories.d.ts +23 -0
- package/lib/types/components/select-list/index.d.ts +15 -1
- package/lib/types/components/slider/Slider.d.ts +15 -1
- package/lib/types/components/slider/Slider.stories.d.ts +23 -0
- package/lib/types/components/slider/__test__/index.spec.d.ts +15 -1
- package/lib/types/components/slider/index.d.ts +15 -1
- package/lib/types/components/tooltip/Tooltip.d.ts +15 -1
- package/lib/types/components/tooltip/Tooltip.stories.d.ts +23 -0
- package/lib/types/components/tooltip/index.d.ts +15 -1
- package/lib/types/components/tooltip/placements.d.ts +15 -1
- package/lib/types/components/tree/Tree.d.ts +54 -0
- package/lib/types/components/tree/Tree.stories.d.ts +23 -0
- package/lib/types/components/tree/__tests__/index.spec.d.ts +16 -0
- package/lib/types/components/tree/index.d.ts +16 -0
- package/lib/types/index.d.ts +17 -1
- package/lib/types/locale/en-US.d.ts +15 -1
- package/lib/types/locale/index.d.ts +15 -1
- package/lib/types/locale/interface.d.ts +15 -1
- package/lib/types/locale/zh-CN.d.ts +15 -1
- package/lib/types/themes/index.d.ts +15 -1
- package/lib/types/themes/theme.d.ts +15 -1
- package/lib/umd/index.js +48 -0
- package/package.json +21 -20
- package/LICENSE +0 -21
- package/lib/cjs/locale/en-US.js +0 -37
- package/lib/cjs/locale/zh-CN.js +0 -37
- package/lib/esm/index.js +0 -2016
- package/lib/esm/locale/en-US.js +0 -16
- package/lib/esm/locale/zh-CN.js +0 -16
- package/lib/types/components/avatar/Avatar.d.ts.map +0 -1
- package/lib/types/components/avatar/__tests__/index.spec.d.ts.map +0 -1
- package/lib/types/components/avatar/index.d.ts.map +0 -1
- package/lib/types/components/button/Button.d.ts.map +0 -1
- package/lib/types/components/button/__tests__/index.spec.d.ts.map +0 -1
- package/lib/types/components/button/index.d.ts.map +0 -1
- package/lib/types/components/cascader-list/CascaderList.d.ts.map +0 -1
- package/lib/types/components/cascader-list/index.d.ts.map +0 -1
- package/lib/types/components/checkbox/Checkbox.d.ts.map +0 -1
- package/lib/types/components/checkbox/__tests__/index.spec.d.ts.map +0 -1
- package/lib/types/components/checkbox/index.d.ts.map +0 -1
- package/lib/types/components/checkbox-group/CheckboxGroup.d.ts.map +0 -1
- package/lib/types/components/checkbox-group/__tests__/index.spec.d.ts.map +0 -1
- package/lib/types/components/checkbox-group/index.d.ts.map +0 -1
- package/lib/types/components/color-picker/ColorPicker.d.ts.map +0 -1
- package/lib/types/components/color-picker/index.d.ts.map +0 -1
- package/lib/types/components/color-picker/presets.d.ts.map +0 -1
- package/lib/types/components/config-provider/ConfigProvider.d.ts.map +0 -1
- package/lib/types/components/config-provider/__tests__/index.spec.d.ts.map +0 -1
- package/lib/types/components/config-provider/index.d.ts.map +0 -1
- package/lib/types/components/confirm/Confirm.d.ts.map +0 -1
- package/lib/types/components/confirm/index.d.ts.map +0 -1
- package/lib/types/components/container/Container.d.ts.map +0 -1
- package/lib/types/components/container/__tests__/index.spec.d.ts.map +0 -1
- package/lib/types/components/container/index.d.ts.map +0 -1
- package/lib/types/components/design-token/Palette.d.ts.map +0 -1
- package/lib/types/components/dialog/Dialog.d.ts.map +0 -1
- package/lib/types/components/dialog/index.d.ts.map +0 -1
- package/lib/types/components/dropdown/Dropdown.d.ts.map +0 -1
- package/lib/types/components/dropdown/index.d.ts.map +0 -1
- package/lib/types/components/input/Input.d.ts.map +0 -1
- package/lib/types/components/input/index.d.ts.map +0 -1
- package/lib/types/components/input-number/InputNumber.d.ts.map +0 -1
- package/lib/types/components/input-number/index.d.ts.map +0 -1
- package/lib/types/components/menu/Menu.d.ts.map +0 -1
- package/lib/types/components/menu/index.d.ts.map +0 -1
- package/lib/types/components/message/Message.d.ts.map +0 -1
- package/lib/types/components/message/__tests__/index.spec.d.ts.map +0 -1
- package/lib/types/components/message/index.d.ts.map +0 -1
- package/lib/types/components/popup/Popup.d.ts.map +0 -1
- package/lib/types/components/popup/index.d.ts.map +0 -1
- package/lib/types/components/radio/Radio.d.ts.map +0 -1
- package/lib/types/components/radio/__tests__/index.spec.d.ts.map +0 -1
- package/lib/types/components/radio/index.d.ts.map +0 -1
- package/lib/types/components/radio-group/RadioGroup.d.ts.map +0 -1
- package/lib/types/components/radio-group/__tests__/index.spec.d.ts.map +0 -1
- package/lib/types/components/radio-group/index.d.ts.map +0 -1
- package/lib/types/components/scrollbar/Scrollbar.d.ts.map +0 -1
- package/lib/types/components/scrollbar/__tests__/index.spec.d.ts.map +0 -1
- package/lib/types/components/scrollbar/index.d.ts.map +0 -1
- package/lib/types/components/select/Select.d.ts.map +0 -1
- package/lib/types/components/select/index.d.ts.map +0 -1
- package/lib/types/components/select-list/SelectList.d.ts.map +0 -1
- package/lib/types/components/select-list/index.d.ts.map +0 -1
- package/lib/types/components/slider/Slider.d.ts.map +0 -1
- package/lib/types/components/slider/__test__/index.spec.d.ts.map +0 -1
- package/lib/types/components/slider/index.d.ts.map +0 -1
- package/lib/types/components/tooltip/Tooltip.d.ts.map +0 -1
- package/lib/types/components/tooltip/index.d.ts.map +0 -1
- package/lib/types/components/tooltip/placements.d.ts.map +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/locale/en-US.d.ts.map +0 -1
- package/lib/types/locale/index.d.ts.map +0 -1
- package/lib/types/locale/interface.d.ts.map +0 -1
- package/lib/types/locale/zh-CN.d.ts.map +0 -1
- package/lib/types/themes/index.d.ts.map +0 -1
- package/lib/types/themes/theme.d.ts.map +0 -1
package/lib/esm/index.js
DELETED
|
@@ -1,2016 +0,0 @@
|
|
|
1
|
-
// src/components/avatar/Avatar.tsx
|
|
2
|
-
function _array_like_to_array(arr, len) {
|
|
3
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
4
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5
|
-
return arr2;
|
|
6
|
-
}
|
|
7
|
-
function _array_with_holes(arr) {
|
|
8
|
-
if (Array.isArray(arr)) return arr;
|
|
9
|
-
}
|
|
10
|
-
function _array_without_holes(arr) {
|
|
11
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
12
|
-
}
|
|
13
|
-
function _class_call_check(instance, Constructor) {
|
|
14
|
-
if (!(instance instanceof Constructor)) {
|
|
15
|
-
throw new TypeError("Cannot call a class as a function");
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function _defineProperties(target, props) {
|
|
19
|
-
for(var i = 0; i < props.length; i++){
|
|
20
|
-
var descriptor = props[i];
|
|
21
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
22
|
-
descriptor.configurable = true;
|
|
23
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
24
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
28
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
29
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
30
|
-
return Constructor;
|
|
31
|
-
}
|
|
32
|
-
function _define_property(obj, key, value) {
|
|
33
|
-
if (key in obj) {
|
|
34
|
-
Object.defineProperty(obj, key, {
|
|
35
|
-
value: value,
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true
|
|
39
|
-
});
|
|
40
|
-
} else {
|
|
41
|
-
obj[key] = value;
|
|
42
|
-
}
|
|
43
|
-
return obj;
|
|
44
|
-
}
|
|
45
|
-
function _iterable_to_array(iter) {
|
|
46
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
47
|
-
}
|
|
48
|
-
function _iterable_to_array_limit(arr, i) {
|
|
49
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
50
|
-
if (_i == null) return;
|
|
51
|
-
var _arr = [];
|
|
52
|
-
var _n = true;
|
|
53
|
-
var _d = false;
|
|
54
|
-
var _s, _e;
|
|
55
|
-
try {
|
|
56
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
57
|
-
_arr.push(_s.value);
|
|
58
|
-
if (i && _arr.length === i) break;
|
|
59
|
-
}
|
|
60
|
-
} catch (err) {
|
|
61
|
-
_d = true;
|
|
62
|
-
_e = err;
|
|
63
|
-
} finally{
|
|
64
|
-
try {
|
|
65
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
66
|
-
} finally{
|
|
67
|
-
if (_d) throw _e;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return _arr;
|
|
71
|
-
}
|
|
72
|
-
function _non_iterable_rest() {
|
|
73
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
74
|
-
}
|
|
75
|
-
function _non_iterable_spread() {
|
|
76
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
77
|
-
}
|
|
78
|
-
function _object_spread(target) {
|
|
79
|
-
for(var i = 1; i < arguments.length; i++){
|
|
80
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
81
|
-
var ownKeys = Object.keys(source);
|
|
82
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
83
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
84
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
87
|
-
ownKeys.forEach(function(key) {
|
|
88
|
-
_define_property(target, key, source[key]);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return target;
|
|
92
|
-
}
|
|
93
|
-
function ownKeys(object, enumerableOnly) {
|
|
94
|
-
var keys = Object.keys(object);
|
|
95
|
-
if (Object.getOwnPropertySymbols) {
|
|
96
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
97
|
-
if (enumerableOnly) {
|
|
98
|
-
symbols = symbols.filter(function(sym) {
|
|
99
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
keys.push.apply(keys, symbols);
|
|
103
|
-
}
|
|
104
|
-
return keys;
|
|
105
|
-
}
|
|
106
|
-
function _object_spread_props(target, source) {
|
|
107
|
-
source = source != null ? source : {};
|
|
108
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
109
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
110
|
-
} else {
|
|
111
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
112
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
return target;
|
|
116
|
-
}
|
|
117
|
-
function _object_without_properties(source, excluded) {
|
|
118
|
-
if (source == null) return {};
|
|
119
|
-
var target = _object_without_properties_loose(source, excluded);
|
|
120
|
-
var key, i;
|
|
121
|
-
if (Object.getOwnPropertySymbols) {
|
|
122
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
123
|
-
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
124
|
-
key = sourceSymbolKeys[i];
|
|
125
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
126
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
127
|
-
target[key] = source[key];
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return target;
|
|
131
|
-
}
|
|
132
|
-
function _object_without_properties_loose(source, excluded) {
|
|
133
|
-
if (source == null) return {};
|
|
134
|
-
var target = {};
|
|
135
|
-
var sourceKeys = Object.keys(source);
|
|
136
|
-
var key, i;
|
|
137
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
138
|
-
key = sourceKeys[i];
|
|
139
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
140
|
-
target[key] = source[key];
|
|
141
|
-
}
|
|
142
|
-
return target;
|
|
143
|
-
}
|
|
144
|
-
function _sliced_to_array(arr, i) {
|
|
145
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
146
|
-
}
|
|
147
|
-
function _to_consumable_array(arr) {
|
|
148
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
149
|
-
}
|
|
150
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
151
|
-
if (!o) return;
|
|
152
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
153
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
154
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
155
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
156
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
157
|
-
}
|
|
158
|
-
import clsx from "clsx";
|
|
159
|
-
import React from "react";
|
|
160
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/avatar/index.module.less
|
|
161
|
-
var index_module_default = {
|
|
162
|
-
"avatar": "univer-avatar",
|
|
163
|
-
"avatarSquare": "univer-avatar-square",
|
|
164
|
-
"avatarCircle": "univer-avatar-circle",
|
|
165
|
-
"avatarMiddle": "univer-avatar-middle",
|
|
166
|
-
"avatarSmall": "univer-avatar-small",
|
|
167
|
-
"avatarImage": "univer-avatar-image"
|
|
168
|
-
};
|
|
169
|
-
// src/components/avatar/Avatar.tsx
|
|
170
|
-
function Avatar(props) {
|
|
171
|
-
var children = props.children, style = props.style, title = props.title, alt = props.alt, _props_shape = props.shape, shape = _props_shape === void 0 ? "circle" : _props_shape, _props_size = props.size, size = _props_size === void 0 ? "middle" : _props_size, src = props.src, _props_fit = props.fit, fit = _props_fit === void 0 ? "fill" : _props_fit, onError = props.onError, onLoad = props.onLoad;
|
|
172
|
-
var sizeStyle = typeof size === "number" ? {
|
|
173
|
-
width: size,
|
|
174
|
-
height: size,
|
|
175
|
-
lineHeight: "".concat(size, "px")
|
|
176
|
-
} : {};
|
|
177
|
-
var _obj;
|
|
178
|
-
var _className = clsx(index_module_default.avatar, (_obj = {}, _define_property(_obj, index_module_default.avatarCircle, shape === "circle"), _define_property(_obj, index_module_default.avatarSquare, shape === "square"), _define_property(_obj, index_module_default.avatarImage, src), _define_property(_obj, index_module_default.avatarMiddle, size === "middle"), _define_property(_obj, index_module_default.avatarSmall, size === "small"), _obj));
|
|
179
|
-
var fitStyle = fit ? {
|
|
180
|
-
objectFit: fit
|
|
181
|
-
} : {};
|
|
182
|
-
if (src) {
|
|
183
|
-
return /* @__PURE__ */ React.createElement("span", {
|
|
184
|
-
className: _className,
|
|
185
|
-
style: _object_spread({}, sizeStyle, style, fitStyle)
|
|
186
|
-
}, /* @__PURE__ */ React.createElement("img", {
|
|
187
|
-
src: src,
|
|
188
|
-
title: title,
|
|
189
|
-
alt: alt,
|
|
190
|
-
onError: onError,
|
|
191
|
-
onLoad: onLoad
|
|
192
|
-
}), children);
|
|
193
|
-
}
|
|
194
|
-
return /* @__PURE__ */ React.createElement("span", {
|
|
195
|
-
className: _className,
|
|
196
|
-
style: _object_spread({}, sizeStyle, style)
|
|
197
|
-
}, children);
|
|
198
|
-
}
|
|
199
|
-
// src/components/button/Button.tsx
|
|
200
|
-
import clsx2 from "clsx";
|
|
201
|
-
import React2 from "react";
|
|
202
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/button/index.module.less
|
|
203
|
-
var index_module_default2 = {
|
|
204
|
-
"button": "univer-button",
|
|
205
|
-
"buttonDefault": "univer-button-default",
|
|
206
|
-
"buttonPrimary": "univer-button-primary",
|
|
207
|
-
"buttonText": "univer-button-text",
|
|
208
|
-
"buttonLink": "univer-button-link",
|
|
209
|
-
"buttonSmall": "univer-button-small",
|
|
210
|
-
"buttonMiddle": "univer-button-middle",
|
|
211
|
-
"buttonLarge": "univer-button-large",
|
|
212
|
-
"buttonBlock": "univer-button-block"
|
|
213
|
-
};
|
|
214
|
-
// src/components/button/Button.tsx
|
|
215
|
-
function Button(props) {
|
|
216
|
-
var children = props.children, className = props.className, style = props.style, _props_type = props.type, type = _props_type === void 0 ? "default" : _props_type, _props_size = props.size, size = _props_size === void 0 ? "middle" : _props_size, block = props.block, htmlType = props.htmlType, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, onClick = props.onClick, restProps = _object_without_properties(props, [
|
|
217
|
-
"children",
|
|
218
|
-
"className",
|
|
219
|
-
"style",
|
|
220
|
-
"type",
|
|
221
|
-
"size",
|
|
222
|
-
"block",
|
|
223
|
-
"htmlType",
|
|
224
|
-
"disabled",
|
|
225
|
-
"onClick"
|
|
226
|
-
]);
|
|
227
|
-
var _obj;
|
|
228
|
-
var _className = clsx2(index_module_default2.button, (_obj = {}, _define_property(_obj, index_module_default2.buttonPrimary, type === "primary"), _define_property(_obj, index_module_default2.buttonDefault, type === "default"), _define_property(_obj, index_module_default2.buttonText, type === "text"), _define_property(_obj, index_module_default2.buttonLink, type === "link"), _define_property(_obj, index_module_default2.buttonSmall, size === "small"), _define_property(_obj, index_module_default2.buttonMiddle, size === "middle"), _define_property(_obj, index_module_default2.buttonLarge, size === "large"), _define_property(_obj, index_module_default2.buttonBlock, block), _obj), className);
|
|
229
|
-
return /* @__PURE__ */ React2.createElement("button", _object_spread({
|
|
230
|
-
className: _className,
|
|
231
|
-
style: style,
|
|
232
|
-
type: htmlType,
|
|
233
|
-
onClick: onClick,
|
|
234
|
-
disabled: disabled
|
|
235
|
-
}, restProps), children);
|
|
236
|
-
}
|
|
237
|
-
// src/components/cascader-list/CascaderList.tsx
|
|
238
|
-
import { CheckMarkSingle } from "@univerjs/icons";
|
|
239
|
-
import clsx3 from "clsx";
|
|
240
|
-
import React3, { useMemo } from "react";
|
|
241
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/cascader-list/index.module.less
|
|
242
|
-
var index_module_default3 = {
|
|
243
|
-
"cascaderList": "univer-cascader-list",
|
|
244
|
-
"cascaderListBoard": "univer-cascader-list-board",
|
|
245
|
-
"cascaderListItemActive": "univer-cascader-list-item-active",
|
|
246
|
-
"cascaderListOption": "univer-cascader-list-option",
|
|
247
|
-
"cascaderListCheckMark": "univer-cascader-list-check-mark",
|
|
248
|
-
"cascaderListItem": "univer-cascader-list-item",
|
|
249
|
-
"cascaderListEmpty": "univer-cascader-list-empty"
|
|
250
|
-
};
|
|
251
|
-
// src/components/cascader-list/CascaderList.tsx
|
|
252
|
-
function CascaderList(props) {
|
|
253
|
-
var value = props.value, _props_options = props.options, options = _props_options === void 0 ? [] : _props_options, onChange = props.onChange;
|
|
254
|
-
var activeOptions = useMemo(function() {
|
|
255
|
-
var activeOptions2 = [
|
|
256
|
-
options
|
|
257
|
-
];
|
|
258
|
-
value.forEach(function(item, index) {
|
|
259
|
-
var option = activeOptions2[index].find(function(option2) {
|
|
260
|
-
return option2.value === item;
|
|
261
|
-
});
|
|
262
|
-
if (option === null || option === void 0 ? void 0 : option.children) {
|
|
263
|
-
activeOptions2.push(option.children);
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
return activeOptions2;
|
|
267
|
-
}, [
|
|
268
|
-
value
|
|
269
|
-
]);
|
|
270
|
-
function handleChange(index, v) {
|
|
271
|
-
if (v === props.value[index]) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
if (props.value[index + 1]) {
|
|
275
|
-
var newValue2 = props.value.slice(0, index + 1);
|
|
276
|
-
newValue2[index] = v;
|
|
277
|
-
onChange(newValue2);
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
var newValue = _to_consumable_array(props.value);
|
|
281
|
-
newValue[index] = v;
|
|
282
|
-
onChange(newValue);
|
|
283
|
-
}
|
|
284
|
-
return /* @__PURE__ */ React3.createElement("section", {
|
|
285
|
-
className: index_module_default3.cascaderList
|
|
286
|
-
}, activeOptions.map(function(options2, index) {
|
|
287
|
-
return options2.length ? /* @__PURE__ */ React3.createElement("ul", {
|
|
288
|
-
key: index,
|
|
289
|
-
className: index_module_default3.cascaderListBoard
|
|
290
|
-
}, options2.map(function(option) {
|
|
291
|
-
return /* @__PURE__ */ React3.createElement("li", {
|
|
292
|
-
key: option.value,
|
|
293
|
-
className: clsx3(index_module_default3.cascaderListItem, _define_property({}, index_module_default3.cascaderListItemActive, option.value === value[index]))
|
|
294
|
-
}, /* @__PURE__ */ React3.createElement("a", {
|
|
295
|
-
className: index_module_default3.cascaderListOption,
|
|
296
|
-
onClick: function() {
|
|
297
|
-
return handleChange(index, option.value);
|
|
298
|
-
}
|
|
299
|
-
}, /* @__PURE__ */ React3.createElement("span", {
|
|
300
|
-
className: index_module_default3.cascaderListCheckMark
|
|
301
|
-
}, option.value === value[index] && /* @__PURE__ */ React3.createElement(CheckMarkSingle, null)), /* @__PURE__ */ React3.createElement("span", null, option.label)));
|
|
302
|
-
})) : /* @__PURE__ */ React3.createElement("section", {
|
|
303
|
-
key: index,
|
|
304
|
-
className: index_module_default3.cascaderListEmpty
|
|
305
|
-
}, "无");
|
|
306
|
-
}), value.length <= 0 && /* @__PURE__ */ React3.createElement("section", {
|
|
307
|
-
className: index_module_default3.cascaderListEmpty
|
|
308
|
-
}, "无"));
|
|
309
|
-
}
|
|
310
|
-
// src/components/checkbox/Checkbox.tsx
|
|
311
|
-
import clsx4 from "clsx";
|
|
312
|
-
import React4, { useRef } from "react";
|
|
313
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/checkbox/index.module.less
|
|
314
|
-
var index_module_default4 = {
|
|
315
|
-
"checkbox": "univer-checkbox",
|
|
316
|
-
"checkboxTargetInput": "univer-checkbox-target-input",
|
|
317
|
-
"checkboxTargetInner": "univer-checkbox-target-inner",
|
|
318
|
-
"checkboxDisabled": "univer-checkbox-disabled",
|
|
319
|
-
"checkboxTarget": "univer-checkbox-target"
|
|
320
|
-
};
|
|
321
|
-
// src/components/checkbox/Checkbox.tsx
|
|
322
|
-
function Checkbox(props) {
|
|
323
|
-
var children = props.children, checked = props.checked, value = props.value, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, onChange = props.onChange;
|
|
324
|
-
var inputRef = useRef(null);
|
|
325
|
-
function handleChange(e) {
|
|
326
|
-
e.stopPropagation();
|
|
327
|
-
if (!onChange || disabled) return;
|
|
328
|
-
if (typeof value !== "undefined") {
|
|
329
|
-
onChange && onChange(value);
|
|
330
|
-
} else {
|
|
331
|
-
var _inputRef_current;
|
|
332
|
-
var checked2 = inputRef === null || inputRef === void 0 ? void 0 : (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.checked;
|
|
333
|
-
onChange && onChange(checked2);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
var _className = clsx4(index_module_default4.checkbox, _define_property({}, index_module_default4.checkboxDisabled, disabled));
|
|
337
|
-
return /* @__PURE__ */ React4.createElement("label", {
|
|
338
|
-
className: _className
|
|
339
|
-
}, /* @__PURE__ */ React4.createElement("span", {
|
|
340
|
-
className: index_module_default4.checkboxTarget
|
|
341
|
-
}, /* @__PURE__ */ React4.createElement("input", {
|
|
342
|
-
ref: inputRef,
|
|
343
|
-
className: index_module_default4.checkboxTargetInput,
|
|
344
|
-
type: "checkbox",
|
|
345
|
-
checked: checked,
|
|
346
|
-
disabled: disabled,
|
|
347
|
-
onChange: handleChange
|
|
348
|
-
}), /* @__PURE__ */ React4.createElement("span", {
|
|
349
|
-
className: index_module_default4.checkboxTargetInner
|
|
350
|
-
})), /* @__PURE__ */ React4.createElement("span", null, children));
|
|
351
|
-
}
|
|
352
|
-
// src/components/checkbox-group/CheckboxGroup.tsx
|
|
353
|
-
import React5 from "react";
|
|
354
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/checkbox-group/index.module.less
|
|
355
|
-
var index_module_default5 = {
|
|
356
|
-
"checkboxGroup": "univer-checkbox-group"
|
|
357
|
-
};
|
|
358
|
-
// src/components/checkbox-group/CheckboxGroup.tsx
|
|
359
|
-
function CheckboxGroup(props) {
|
|
360
|
-
var children = props.children, value = props.value, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, onChange = props.onChange;
|
|
361
|
-
var handleChange = function(item) {
|
|
362
|
-
if (value.includes(item)) {
|
|
363
|
-
onChange(value.filter(function(i) {
|
|
364
|
-
return i !== item;
|
|
365
|
-
}));
|
|
366
|
-
} else {
|
|
367
|
-
onChange(_to_consumable_array(value).concat([
|
|
368
|
-
item
|
|
369
|
-
]));
|
|
370
|
-
}
|
|
371
|
-
};
|
|
372
|
-
return /* @__PURE__ */ React5.createElement("div", {
|
|
373
|
-
className: index_module_default5.checkboxGroup
|
|
374
|
-
}, React5.Children.map(children, function(child, index) {
|
|
375
|
-
if (React5.isValidElement(child)) {
|
|
376
|
-
return React5.cloneElement(child, {
|
|
377
|
-
key: index,
|
|
378
|
-
children: child.props.children,
|
|
379
|
-
value: child.props.value,
|
|
380
|
-
checked: value.includes(child.props.value),
|
|
381
|
-
disabled: disabled !== null && disabled !== void 0 ? disabled : child.props.disabled,
|
|
382
|
-
onChange: handleChange
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
return child;
|
|
386
|
-
}));
|
|
387
|
-
}
|
|
388
|
-
// src/components/color-picker/ColorPicker.tsx
|
|
389
|
-
import RcColorPicker, { ColorBlock } from "@rc-component/color-picker";
|
|
390
|
-
import React6 from "react";
|
|
391
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/color-picker/index.module.less
|
|
392
|
-
var index_module_default6 = {
|
|
393
|
-
"colorPicker": "univer-color-picker",
|
|
394
|
-
"colorPickerHidden": "univer-color-picker-hidden",
|
|
395
|
-
"colorPickerPanel": "univer-color-picker-panel",
|
|
396
|
-
"colorPickerPanelDisabled": "univer-color-picker-panel-disabled",
|
|
397
|
-
"colorPickerSelect": "univer-color-picker-select",
|
|
398
|
-
"colorPickerPalette": "univer-color-picker-palette",
|
|
399
|
-
"colorPickerGradient": "univer-color-picker-gradient",
|
|
400
|
-
"colorPickerSaturation": "univer-color-picker-saturation",
|
|
401
|
-
"colorPickerHandler": "univer-color-picker-handler",
|
|
402
|
-
"colorPickerSlider": "univer-color-picker-slider",
|
|
403
|
-
"colorPickerColorBlocks": "univer-color-picker-color-blocks",
|
|
404
|
-
"colorPickerColorBlock": "univer-color-picker-color-block",
|
|
405
|
-
"colorPickerColorBlockInner": "univer-color-picker-color-block-inner",
|
|
406
|
-
"colorPickerSliderContainer": "univer-color-picker-slider-container",
|
|
407
|
-
"colorPickerSliderGroup": "univer-color-picker-slider-group",
|
|
408
|
-
"colorPickerSliderGroupDisabledAlpha": "univer-color-picker-slider-group-disabled-alpha"
|
|
409
|
-
};
|
|
410
|
-
// src/components/color-picker/presets.ts
|
|
411
|
-
var colorPresets = [
|
|
412
|
-
"#35322B",
|
|
413
|
-
"#505050",
|
|
414
|
-
"#606060",
|
|
415
|
-
"#6F6F6F",
|
|
416
|
-
"#8B8B8B",
|
|
417
|
-
"#B2B2B2",
|
|
418
|
-
"#CCCCCC",
|
|
419
|
-
"#E5E5E5",
|
|
420
|
-
"#F5F5F5",
|
|
421
|
-
"#FFFFFF",
|
|
422
|
-
"#9D0000",
|
|
423
|
-
"#B20000",
|
|
424
|
-
"#CD0F0F",
|
|
425
|
-
"#E30909",
|
|
426
|
-
"#F30B0B",
|
|
427
|
-
"#FE4B4B",
|
|
428
|
-
"#FA7979",
|
|
429
|
-
"#FB9D9D",
|
|
430
|
-
"#FDCECE",
|
|
431
|
-
"#FEE7E7",
|
|
432
|
-
"#B24000",
|
|
433
|
-
"#CC4F10",
|
|
434
|
-
"#DF5D00",
|
|
435
|
-
"#F96800",
|
|
436
|
-
"#FB8937",
|
|
437
|
-
"#FF8C51",
|
|
438
|
-
"#FCA669",
|
|
439
|
-
"#FDC49B",
|
|
440
|
-
"#FEE1CD",
|
|
441
|
-
"#FEF0E6",
|
|
442
|
-
"#B19401",
|
|
443
|
-
"#C5A300",
|
|
444
|
-
"#D8B300",
|
|
445
|
-
"#EBC301",
|
|
446
|
-
"#F9D700",
|
|
447
|
-
"#FBE137",
|
|
448
|
-
"#FCE869",
|
|
449
|
-
"#FDF09B",
|
|
450
|
-
"#FEF7CD",
|
|
451
|
-
"#FEFBE6",
|
|
452
|
-
"#58770A",
|
|
453
|
-
"#688C0D",
|
|
454
|
-
"#7AA017",
|
|
455
|
-
"#8BBB11",
|
|
456
|
-
"#A4DC16",
|
|
457
|
-
"#BEEE44",
|
|
458
|
-
"#CEF273",
|
|
459
|
-
"#DEF6A2",
|
|
460
|
-
"#EFFBD0",
|
|
461
|
-
"#F7FDE8",
|
|
462
|
-
"#007676",
|
|
463
|
-
"#008A8A",
|
|
464
|
-
"#009E9E",
|
|
465
|
-
"#00BBBB",
|
|
466
|
-
"#1CD8D8",
|
|
467
|
-
"#2AEAEA",
|
|
468
|
-
"#76EFEF",
|
|
469
|
-
"#A3F5F5",
|
|
470
|
-
"#D1FAFA",
|
|
471
|
-
"#E8FCFC",
|
|
472
|
-
"#001F9C",
|
|
473
|
-
"#0025B7",
|
|
474
|
-
"#012BD2",
|
|
475
|
-
"#133DE3",
|
|
476
|
-
"#2F55EB",
|
|
477
|
-
"#4567ED",
|
|
478
|
-
"#738DF2",
|
|
479
|
-
"#A2B3F6",
|
|
480
|
-
"#D0D9FB",
|
|
481
|
-
"#E8ECFD",
|
|
482
|
-
"#3F0198",
|
|
483
|
-
"#510EB0",
|
|
484
|
-
"#6721CB",
|
|
485
|
-
"#7735D4",
|
|
486
|
-
"#894EDE",
|
|
487
|
-
"#9E6DE3",
|
|
488
|
-
"#AA82E3",
|
|
489
|
-
"#C7ABED",
|
|
490
|
-
"#E3D5F6",
|
|
491
|
-
"#F1EAFA",
|
|
492
|
-
"#8F0550",
|
|
493
|
-
"#A1095C",
|
|
494
|
-
"#C1026B",
|
|
495
|
-
"#D4157E",
|
|
496
|
-
"#E7258F",
|
|
497
|
-
"#F248A6",
|
|
498
|
-
"#F273B9",
|
|
499
|
-
"#F6A2D0",
|
|
500
|
-
"#FBD0E8",
|
|
501
|
-
"#FDE8F3"
|
|
502
|
-
];
|
|
503
|
-
// src/components/color-picker/ColorPicker.tsx
|
|
504
|
-
function ColorPicker(props) {
|
|
505
|
-
var onChange = props.onChange;
|
|
506
|
-
function handleStopPropagation(e) {
|
|
507
|
-
e.stopPropagation();
|
|
508
|
-
}
|
|
509
|
-
function handleChange(color) {
|
|
510
|
-
var _ref;
|
|
511
|
-
var value = (_ref = typeof color === "string" ? color : color.toHexString()) !== null && _ref !== void 0 ? _ref : "";
|
|
512
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
513
|
-
}
|
|
514
|
-
return /* @__PURE__ */ React6.createElement("section", null, /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement("div", {
|
|
515
|
-
className: index_module_default6.colorPickerColorBlocks
|
|
516
|
-
}, colorPresets.map(function(color) {
|
|
517
|
-
return /* @__PURE__ */ React6.createElement(ColorBlock, {
|
|
518
|
-
key: color,
|
|
519
|
-
prefixCls: index_module_default6.colorPicker,
|
|
520
|
-
color: color,
|
|
521
|
-
onClick: function() {
|
|
522
|
-
return handleChange(color);
|
|
523
|
-
}
|
|
524
|
-
});
|
|
525
|
-
}))), /* @__PURE__ */ React6.createElement("section", {
|
|
526
|
-
onClick: handleStopPropagation
|
|
527
|
-
}, /* @__PURE__ */ React6.createElement(RcColorPicker, {
|
|
528
|
-
prefixCls: index_module_default6.colorPicker,
|
|
529
|
-
disabledAlpha: true,
|
|
530
|
-
onChangeComplete: handleChange
|
|
531
|
-
})));
|
|
532
|
-
}
|
|
533
|
-
// src/components/config-provider/ConfigProvider.tsx
|
|
534
|
-
import React7, { createContext } from "react";
|
|
535
|
-
// src/locale/en-US.ts
|
|
536
|
-
var locale = {
|
|
537
|
-
design: {
|
|
538
|
-
Confirm: {
|
|
539
|
-
cancel: "cancel",
|
|
540
|
-
confirm: "ok"
|
|
541
|
-
},
|
|
542
|
-
Slider: {
|
|
543
|
-
resetTo: "Reset to"
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
var en_US_default = locale;
|
|
548
|
-
// src/components/config-provider/ConfigProvider.tsx
|
|
549
|
-
var ConfigContext = createContext({
|
|
550
|
-
locale: en_US_default,
|
|
551
|
-
mountContainer: document.body
|
|
552
|
-
});
|
|
553
|
-
function ConfigProvider(props) {
|
|
554
|
-
var children = props.children, locale2 = props.locale, mountContainer = props.mountContainer;
|
|
555
|
-
var _locale;
|
|
556
|
-
if (Object.prototype.hasOwnProperty.call(locale2, "design")) {
|
|
557
|
-
_locale = locale2;
|
|
558
|
-
} else {
|
|
559
|
-
_locale = en_US_default;
|
|
560
|
-
}
|
|
561
|
-
return /* @__PURE__ */ React7.createElement(ConfigContext.Provider, {
|
|
562
|
-
value: {
|
|
563
|
-
locale: _locale,
|
|
564
|
-
mountContainer: mountContainer
|
|
565
|
-
}
|
|
566
|
-
}, children);
|
|
567
|
-
}
|
|
568
|
-
// src/components/confirm/Confirm.tsx
|
|
569
|
-
import React9, { useContext as useContext2 } from "react";
|
|
570
|
-
// src/components/dialog/Dialog.tsx
|
|
571
|
-
import RcDialog from "rc-dialog";
|
|
572
|
-
import React8, { useContext, useState } from "react";
|
|
573
|
-
import Draggable from "react-draggable";
|
|
574
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/dialog/index.module.less
|
|
575
|
-
var index_module_default7 = {
|
|
576
|
-
"dialog": "univer-dialog",
|
|
577
|
-
"dialogWrap": "univer-dialog-wrap",
|
|
578
|
-
"dialogTitle": "univer-dialog-title",
|
|
579
|
-
"dialogContent": "univer-dialog-content",
|
|
580
|
-
"dialogClose": "univer-dialog-close",
|
|
581
|
-
"dialogHeader": "univer-dialog-header",
|
|
582
|
-
"dialogBody": "univer-dialog-body",
|
|
583
|
-
"dialogFooter": "univer-dialog-footer",
|
|
584
|
-
"dialogZoomEnter": "univer-dialog-zoom-enter",
|
|
585
|
-
"dialogZoomAppear": "univer-dialog-zoom-appear",
|
|
586
|
-
"dialogZoomLeave": "univer-dialog-zoom-leave",
|
|
587
|
-
"dialogZoomEnterActive": "univer-dialog-zoom-enter-active",
|
|
588
|
-
"dialogZoomAppearActive": "univer-dialog-zoom-appear-active",
|
|
589
|
-
"dialogZoomIn": "univer-dialog-zoom-in",
|
|
590
|
-
"dialogZoomLeaveActive": "univer-dialog-zoom-leave-active",
|
|
591
|
-
"dialogZoomOut": "univer-dialog-zoom-out",
|
|
592
|
-
"dialogMask": "univer-dialog-mask",
|
|
593
|
-
"dialogMaskHidden": "univer-dialog-mask-hidden",
|
|
594
|
-
"dialogFadeEnter": "univer-dialog-fade-enter",
|
|
595
|
-
"dialogFadeAppear": "univer-dialog-fade-appear",
|
|
596
|
-
"dialogFadeLeave": "univer-dialog-fade-leave",
|
|
597
|
-
"dialogFadeEnterActive": "univer-dialog-fade-enter-active",
|
|
598
|
-
"dialogFadeAppearActive": "univer-dialog-fade-appear-active",
|
|
599
|
-
"dialogFadeIn": "univer-dialog-fade-in",
|
|
600
|
-
"dialogFadeLeaveActive": "univer-dialog-fade-leave-active",
|
|
601
|
-
"dialogFadeOut": "univer-dialog-fade-out"
|
|
602
|
-
};
|
|
603
|
-
// src/components/dialog/Dialog.tsx
|
|
604
|
-
function Dialog(props) {
|
|
605
|
-
var children = props.children, _props_visible = props.visible, visible = _props_visible === void 0 ? false : _props_visible, title = props.title, _props_draggable = props.draggable, draggable = _props_draggable === void 0 ? false : _props_draggable, closeIcon = props.closeIcon, footer = props.footer, onClose = props.onClose;
|
|
606
|
-
var _useState = _sliced_to_array(useState(false), 2), dragDisabled = _useState[0], setDragDisabled = _useState[1];
|
|
607
|
-
var mountContainer = useContext(ConfigContext).mountContainer;
|
|
608
|
-
var TitleIfDraggable = draggable ? /* @__PURE__ */ React8.createElement("div", {
|
|
609
|
-
style: {
|
|
610
|
-
width: "100%",
|
|
611
|
-
cursor: "pointer"
|
|
612
|
-
},
|
|
613
|
-
onMouseOver: function() {
|
|
614
|
-
if (dragDisabled) {
|
|
615
|
-
setDragDisabled(false);
|
|
616
|
-
}
|
|
617
|
-
},
|
|
618
|
-
onMouseOut: function() {
|
|
619
|
-
setDragDisabled(true);
|
|
620
|
-
},
|
|
621
|
-
onFocus: function() {},
|
|
622
|
-
onBlur: function() {}
|
|
623
|
-
}, title) : title;
|
|
624
|
-
var modalRender = function(modal) {
|
|
625
|
-
return draggable ? /* @__PURE__ */ React8.createElement(Draggable, {
|
|
626
|
-
disabled: dragDisabled
|
|
627
|
-
}, modal) : modal;
|
|
628
|
-
};
|
|
629
|
-
return /* @__PURE__ */ React8.createElement(RcDialog, {
|
|
630
|
-
prefixCls: index_module_default7.dialog,
|
|
631
|
-
getContainer: function() {
|
|
632
|
-
return mountContainer;
|
|
633
|
-
},
|
|
634
|
-
visible: visible,
|
|
635
|
-
title: TitleIfDraggable,
|
|
636
|
-
modalRender: modalRender,
|
|
637
|
-
closeIcon: closeIcon,
|
|
638
|
-
footer: footer,
|
|
639
|
-
onClose: onClose
|
|
640
|
-
}, children);
|
|
641
|
-
}
|
|
642
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/confirm/index.module.less
|
|
643
|
-
var index_module_default8 = {
|
|
644
|
-
"confirmFooter": "univer-confirm-footer"
|
|
645
|
-
};
|
|
646
|
-
// src/components/confirm/Confirm.tsx
|
|
647
|
-
function Confirm(props) {
|
|
648
|
-
var children = props.children, _props_visible = props.visible, visible = _props_visible === void 0 ? false : _props_visible, title = props.title, onClose = props.onClose, onConfirm = props.onConfirm;
|
|
649
|
-
var _useContext2 = useContext2(ConfigContext), locale2 = _useContext2.locale;
|
|
650
|
-
function Footer() {
|
|
651
|
-
return /* @__PURE__ */ React9.createElement("footer", {
|
|
652
|
-
className: index_module_default8.confirmFooter
|
|
653
|
-
}, /* @__PURE__ */ React9.createElement(Button, {
|
|
654
|
-
onClick: onClose
|
|
655
|
-
}, locale2.design.Confirm.cancel), /* @__PURE__ */ React9.createElement(Button, {
|
|
656
|
-
type: "primary",
|
|
657
|
-
onClick: onConfirm
|
|
658
|
-
}, locale2.design.Confirm.confirm));
|
|
659
|
-
}
|
|
660
|
-
return /* @__PURE__ */ React9.createElement(Dialog, {
|
|
661
|
-
visible: visible,
|
|
662
|
-
title: title,
|
|
663
|
-
footer: /* @__PURE__ */ React9.createElement(Footer, null),
|
|
664
|
-
onClose: onClose
|
|
665
|
-
}, children);
|
|
666
|
-
}
|
|
667
|
-
// src/components/container/Container.tsx
|
|
668
|
-
import React10, { forwardRef } from "react";
|
|
669
|
-
var Container = forwardRef(function(props, ref) {
|
|
670
|
-
var children = props.children, className = props.className, style = props.style, onClick = props.onClick, onContextMenu = props.onContextMenu;
|
|
671
|
-
return /* @__PURE__ */ React10.createElement("section", {
|
|
672
|
-
ref: ref,
|
|
673
|
-
className: className,
|
|
674
|
-
style: style,
|
|
675
|
-
onClick: onClick,
|
|
676
|
-
onContextMenu: onContextMenu
|
|
677
|
-
}, children);
|
|
678
|
-
});
|
|
679
|
-
// src/components/dropdown/Dropdown.tsx
|
|
680
|
-
import RcDropdown from "rc-dropdown";
|
|
681
|
-
import React11, { useContext as useContext3 } from "react";
|
|
682
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/dropdown/index.module.less
|
|
683
|
-
var index_module_default9 = {
|
|
684
|
-
"dropdown": "univer-dropdown",
|
|
685
|
-
"dropdownHidden": "univer-dropdown-hidden",
|
|
686
|
-
"dropdownSlideUpEnter": "univer-dropdown-slide-up-enter",
|
|
687
|
-
"dropdownSlideUpAppear": "univer-dropdown-slide-up-appear",
|
|
688
|
-
"dropdownSlideUpLeave": "univer-dropdown-slide-up-leave",
|
|
689
|
-
"dropdownSlideUpEnterActive": "univer-dropdown-slide-up-enter-active",
|
|
690
|
-
"dropdownPlacementBottomLeft": "univer-dropdown-placement-bottomLeft",
|
|
691
|
-
"dropdownSlideUpAppearActive": "univer-dropdown-slide-up-appear-active",
|
|
692
|
-
"dropdownPlacementBottomCenter": "univer-dropdown-placement-bottomCenter",
|
|
693
|
-
"dropdownPlacementBottomRight": "univer-dropdown-placement-bottomRight",
|
|
694
|
-
"dropdownSlideUpIn": "univer-dropdown-slide-up-in",
|
|
695
|
-
"dropdownPlacementTopLeft": "univer-dropdown-placement-topLeft",
|
|
696
|
-
"dropdownPlacementTopCenter": "univer-dropdown-placement-topCenter",
|
|
697
|
-
"dropdownPlacementTopRight": "univer-dropdown-placement-topRight",
|
|
698
|
-
"dropdownSlideDownIn": "univer-dropdown-slide-down-in",
|
|
699
|
-
"dropdownSlideUpLeaveActive": "univer-dropdown-slide-up-leave-active",
|
|
700
|
-
"dropdownSlideUpOut": "univer-dropdown-slide-up-out",
|
|
701
|
-
"dropdownSlideDownOut": "univer-dropdown-slide-down-out"
|
|
702
|
-
};
|
|
703
|
-
// src/components/dropdown/Dropdown.tsx
|
|
704
|
-
function Dropdown(props) {
|
|
705
|
-
var _props_trigger = props.trigger, trigger = _props_trigger === void 0 ? [
|
|
706
|
-
"click"
|
|
707
|
-
] : _props_trigger, placement = props.placement, children = props.children, overlay = props.overlay, _props_alignPoint = props.alignPoint, alignPoint = _props_alignPoint === void 0 ? false : _props_alignPoint, align = props.align, onVisibleChange = props.onVisibleChange;
|
|
708
|
-
var mountContainer = useContext3(ConfigContext).mountContainer;
|
|
709
|
-
return /* @__PURE__ */ React11.createElement(RcDropdown, _object_spread_props(_object_spread({}, props), {
|
|
710
|
-
prefixCls: index_module_default9.dropdown,
|
|
711
|
-
getPopupContainer: function() {
|
|
712
|
-
return mountContainer;
|
|
713
|
-
},
|
|
714
|
-
trigger: trigger,
|
|
715
|
-
animation: "slide-up",
|
|
716
|
-
placement: placement,
|
|
717
|
-
overlay: overlay,
|
|
718
|
-
alignPoint: alignPoint,
|
|
719
|
-
align: align,
|
|
720
|
-
onVisibleChange: onVisibleChange
|
|
721
|
-
}), children);
|
|
722
|
-
}
|
|
723
|
-
// src/components/input/Input.tsx
|
|
724
|
-
import { CloseSingle } from "@univerjs/icons";
|
|
725
|
-
import clsx5 from "clsx";
|
|
726
|
-
import RcInput from "rc-input";
|
|
727
|
-
import React12 from "react";
|
|
728
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/input/index.module.less
|
|
729
|
-
var index_module_default10 = {
|
|
730
|
-
"input": "univer-input",
|
|
731
|
-
"inputAffixWrapper": "univer-input-affix-wrapper",
|
|
732
|
-
"inputAffixWrapperMini": "univer-input-affix-wrapper-mini",
|
|
733
|
-
"inputAffixWrapperSmall": "univer-input-affix-wrapper-small",
|
|
734
|
-
"inputAffixWrapperMiddle": "univer-input-affix-wrapper-middle",
|
|
735
|
-
"inputAffixWrapperLarge": "univer-input-affix-wrapper-large",
|
|
736
|
-
"inputAffixWrapperDisabled": "univer-input-affix-wrapper-disabled",
|
|
737
|
-
"inputSuffix": "univer-input-suffix",
|
|
738
|
-
"inputClearIcon": "univer-input-clear-icon",
|
|
739
|
-
"inputClearIconHidden": "univer-input-clear-icon-hidden"
|
|
740
|
-
};
|
|
741
|
-
// src/components/input/Input.tsx
|
|
742
|
-
function Input(props) {
|
|
743
|
-
var affixWrapperStyle = props.affixWrapperStyle, _props_type = props.type, type = _props_type === void 0 ? "text" : _props_type, placeholder = props.placeholder, value = props.value, _props_size = props.size, size = _props_size === void 0 ? "middle" : _props_size, allowClear = props.allowClear, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, onClick = props.onClick, onKeyDown = props.onKeyDown, onChange = props.onChange;
|
|
744
|
-
function handleChange(e) {
|
|
745
|
-
var _e_target = e.target, value2 = _e_target.value;
|
|
746
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(value2);
|
|
747
|
-
}
|
|
748
|
-
var _obj;
|
|
749
|
-
var _className = clsx5((_obj = {}, _define_property(_obj, index_module_default10.inputAffixWrapperMini, size === "mini"), _define_property(_obj, index_module_default10.inputAffixWrapperSmall, size === "small"), _define_property(_obj, index_module_default10.inputAffixWrapperMiddle, size === "middle"), _define_property(_obj, index_module_default10.inputAffixWrapperLarge, size === "large"), _obj));
|
|
750
|
-
return /* @__PURE__ */ React12.createElement(RcInput, {
|
|
751
|
-
prefixCls: index_module_default10.input,
|
|
752
|
-
classNames: {
|
|
753
|
-
affixWrapper: _className
|
|
754
|
-
},
|
|
755
|
-
styles: {
|
|
756
|
-
affixWrapper: affixWrapperStyle
|
|
757
|
-
},
|
|
758
|
-
type: type,
|
|
759
|
-
placeholder: placeholder,
|
|
760
|
-
value: value,
|
|
761
|
-
disabled: disabled,
|
|
762
|
-
onClick: onClick,
|
|
763
|
-
onKeyDown: onKeyDown,
|
|
764
|
-
onChange: handleChange,
|
|
765
|
-
allowClear: {
|
|
766
|
-
clearIcon: allowClear ? /* @__PURE__ */ React12.createElement(CloseSingle, null) : /* @__PURE__ */ React12.createElement(React12.Fragment, null)
|
|
767
|
-
}
|
|
768
|
-
});
|
|
769
|
-
}
|
|
770
|
-
// src/components/input-number/InputNumber.tsx
|
|
771
|
-
import RcInputNumber from "rc-input-number";
|
|
772
|
-
import React13 from "react";
|
|
773
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/input-number/index.module.less
|
|
774
|
-
var index_module_default11 = {
|
|
775
|
-
"inputNumber": "univer-input-number",
|
|
776
|
-
"inputNumberFocused": "univer-input-number-focused",
|
|
777
|
-
"inputNumberHandlerUp": "univer-input-number-handler-up",
|
|
778
|
-
"inputNumberHandlerWrap": "univer-input-number-handler-wrap",
|
|
779
|
-
"inputNumberHandler": "univer-input-number-handler",
|
|
780
|
-
"inputNumberHandlerUpInner": "univer-input-number-handler-up-inner",
|
|
781
|
-
"inputNumberHandlerDownInner": "univer-input-number-handler-down-inner",
|
|
782
|
-
"inputNumberDisabled": "univer-input-number-disabled",
|
|
783
|
-
"inputNumberInputWrap": "univer-input-number-input-wrap",
|
|
784
|
-
"inputNumberInput": "univer-input-number-input",
|
|
785
|
-
"inputNumberHandlerDown": "univer-input-number-handler-down",
|
|
786
|
-
"inputNumberHandlerDownDisabled": "univer-input-number-handler-down-disabled",
|
|
787
|
-
"inputNumberHandlerUpDisabled": "univer-input-number-handler-up-disabled"
|
|
788
|
-
};
|
|
789
|
-
// src/components/input-number/InputNumber.tsx
|
|
790
|
-
function InputNumber(props) {
|
|
791
|
-
var className = props.className, value = props.value, max = props.max, min = props.min, _props_step = props.step, step = _props_step === void 0 ? 1 : _props_step, precision = props.precision, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, _props_controls = props.controls, controls = _props_controls === void 0 ? true : _props_controls, onClick = props.onClick, onKeyDown = props.onKeyDown, onChange = props.onChange, onPressEnter = props.onPressEnter;
|
|
792
|
-
function handleChange(value2) {
|
|
793
|
-
if (value2 !== null) {
|
|
794
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(value2);
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
return /* @__PURE__ */ React13.createElement(RcInputNumber, {
|
|
798
|
-
prefixCls: index_module_default11.inputNumber,
|
|
799
|
-
className: className,
|
|
800
|
-
value: value,
|
|
801
|
-
max: max,
|
|
802
|
-
min: min,
|
|
803
|
-
step: step,
|
|
804
|
-
precision: precision,
|
|
805
|
-
disabled: disabled,
|
|
806
|
-
controls: controls,
|
|
807
|
-
onClick: onClick,
|
|
808
|
-
onKeyDown: onKeyDown,
|
|
809
|
-
onChange: handleChange,
|
|
810
|
-
onPressEnter: onPressEnter
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
// src/components/menu/Menu.tsx
|
|
814
|
-
import RcMenu, { MenuItem as RcMenuItem, MenuItemGroup as RcMenuItemGroup, SubMenu as RcSubMenu } from "rc-menu";
|
|
815
|
-
import React14, { useContext as useContext4 } from "react";
|
|
816
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/menu/index.module.less
|
|
817
|
-
var index_module_default12 = {
|
|
818
|
-
"menu": "univer-menu",
|
|
819
|
-
"menuVertical": "univer-menu-vertical",
|
|
820
|
-
"menuHidden": "univer-menu-hidden",
|
|
821
|
-
"menuSubmenuHidden": "univer-menu-submenu-hidden",
|
|
822
|
-
"menuItemGroup": "univer-menu-item-group",
|
|
823
|
-
"menuItemGroupList": "univer-menu-item-group-list",
|
|
824
|
-
"menuItemGroupTitle": "univer-menu-item-group-title",
|
|
825
|
-
"menuItemActive": "univer-menu-item-active",
|
|
826
|
-
"menuSubmenuActive": "univer-menu-submenu-active",
|
|
827
|
-
"menuItemSelected": "univer-menu-item-selected",
|
|
828
|
-
"menuSubmenuSelected": "univer-menu-submenu-selected",
|
|
829
|
-
"menuSubmenu": "univer-menu-submenu",
|
|
830
|
-
"menuHorizontal": "univer-menu-horizontal",
|
|
831
|
-
"menuSub": "univer-menu-sub",
|
|
832
|
-
"menuVerticalLeft": "univer-menu-vertical-left",
|
|
833
|
-
"menuVerticalRight": "univer-menu-vertical-right",
|
|
834
|
-
"menuItem": "univer-menu-item",
|
|
835
|
-
"menuItemDisabled": "univer-menu-item-disabled",
|
|
836
|
-
"menuSubmenuDisabled": "univer-menu-submenu-disabled",
|
|
837
|
-
"menuSubmenuPopup": "univer-menu-submenu-popup",
|
|
838
|
-
"submenuTitleWrapper": "univer-submenu-title-wrapper",
|
|
839
|
-
"menuSubmenuTitle": "univer-menu-submenu-title",
|
|
840
|
-
"menuSubmenuTitleMoreIcon": "univer-menu-submenu-title-more-icon",
|
|
841
|
-
"menuItemMoreIcon": "univer-menu-item-more-icon",
|
|
842
|
-
"menuInline": "univer-menu-inline",
|
|
843
|
-
"menuSubmenuArrow": "univer-menu-submenu-arrow",
|
|
844
|
-
"menuOpenSlideUpEnter": "univer-menu-open-slide-up-enter",
|
|
845
|
-
"menuOpenSlideUpAppear": "univer-menu-open-slide-up-appear",
|
|
846
|
-
"menuOpenSlideUpLeave": "univer-menu-open-slide-up-leave",
|
|
847
|
-
"menuOpenSlideUpEnterActive": "univer-menu-open-slide-up-enter-active",
|
|
848
|
-
"menuOpenSlideUpAppearActive": "univer-menu-open-slide-up-appear-active",
|
|
849
|
-
"menuOpenSlideUpIn": "univer-menu-open-slide-up-in",
|
|
850
|
-
"menuOpenSlideUpLeaveActive": "univer-menu-open-slide-up-leave-active",
|
|
851
|
-
"menuOpenSlideUpOut": "univer-menu-open-slide-up-out",
|
|
852
|
-
"menuOpenZoomEnter": "univer-menu-open-zoom-enter",
|
|
853
|
-
"menuOpenZoomAppear": "univer-menu-open-zoom-appear",
|
|
854
|
-
"menuOpenZoomLeave": "univer-menu-open-zoom-leave",
|
|
855
|
-
"menuOpenZoomEnterActive": "univer-menu-open-zoom-enter-active",
|
|
856
|
-
"menuOpenZoomAppearActive": "univer-menu-open-zoom-appear-active",
|
|
857
|
-
"menuOpenZoomIn": "univer-menu-open-zoom-in",
|
|
858
|
-
"menuOpenZoomLeaveActive": "univer-menu-open-zoom-leave-active",
|
|
859
|
-
"menuOpenZoomOut": "univer-menu-open-zoom-out"
|
|
860
|
-
};
|
|
861
|
-
// src/components/menu/Menu.tsx
|
|
862
|
-
function Menu(props) {
|
|
863
|
-
var mountContainer = useContext4(ConfigContext).mountContainer;
|
|
864
|
-
return React14.cloneElement(/* @__PURE__ */ React14.createElement(RcMenu, {
|
|
865
|
-
prefixCls: index_module_default12.menu,
|
|
866
|
-
getPopupContainer: function() {
|
|
867
|
-
return mountContainer;
|
|
868
|
-
}
|
|
869
|
-
}), _object_spread({}, props));
|
|
870
|
-
}
|
|
871
|
-
function MenuItem(props) {
|
|
872
|
-
return React14.cloneElement(/* @__PURE__ */ React14.createElement(RcMenuItem, null), _object_spread({}, props));
|
|
873
|
-
}
|
|
874
|
-
function SubMenu(props) {
|
|
875
|
-
return React14.cloneElement(/* @__PURE__ */ React14.createElement(RcSubMenu, null), _object_spread({}, props));
|
|
876
|
-
}
|
|
877
|
-
function MenuItemGroup(props) {
|
|
878
|
-
return React14.cloneElement(/* @__PURE__ */ React14.createElement(RcMenuItemGroup, null), _object_spread({}, props));
|
|
879
|
-
}
|
|
880
|
-
// src/components/message/Message.tsx
|
|
881
|
-
import { ErrorSingle, SuccessSingle, WarningSingle } from "@univerjs/icons";
|
|
882
|
-
import { render } from "rc-util/lib/React/render";
|
|
883
|
-
import React15 from "react";
|
|
884
|
-
import { CSSTransition, TransitionGroup } from "react-transition-group";
|
|
885
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/message/index.module.less
|
|
886
|
-
var index_module_default13 = {
|
|
887
|
-
"message": "univer-message",
|
|
888
|
-
"messageItem": "univer-message-item",
|
|
889
|
-
"enterActive": "univer-enter-active",
|
|
890
|
-
"enterDone": "univer-enter-done",
|
|
891
|
-
"exit": "univer-exit",
|
|
892
|
-
"exitActive": "univer-exit-active",
|
|
893
|
-
"messageIcon": "univer-message-icon",
|
|
894
|
-
"messageIconSuccess": "univer-message-icon-success",
|
|
895
|
-
"messageIconWarning": "univer-message-icon-warning",
|
|
896
|
-
"messageIconError": "univer-message-icon-error",
|
|
897
|
-
"messageContent": "univer-message-content"
|
|
898
|
-
};
|
|
899
|
-
// src/components/message/Message.tsx
|
|
900
|
-
var MessageType = /* @__PURE__ */ function(MessageType2) {
|
|
901
|
-
MessageType2["Success"] = "success";
|
|
902
|
-
MessageType2["Warning"] = "warning";
|
|
903
|
-
MessageType2["Error"] = "error";
|
|
904
|
-
return MessageType2;
|
|
905
|
-
}(MessageType || {});
|
|
906
|
-
var _obj;
|
|
907
|
-
var iconMap = (_obj = {}, _define_property(_obj, "success" /* Success */ , /* @__PURE__ */ React15.createElement(SuccessSingle, {
|
|
908
|
-
className: index_module_default13.messageIconSuccess
|
|
909
|
-
})), _define_property(_obj, "warning" /* Warning */ , /* @__PURE__ */ React15.createElement(WarningSingle, {
|
|
910
|
-
className: index_module_default13.messageIconWarning
|
|
911
|
-
})), _define_property(_obj, "error" /* Error */ , /* @__PURE__ */ React15.createElement(ErrorSingle, {
|
|
912
|
-
className: index_module_default13.messageIconError
|
|
913
|
-
})), _obj);
|
|
914
|
-
var MessageItem = function(props) {
|
|
915
|
-
var type = props.type, content = props.content;
|
|
916
|
-
var messageElement = /* @__PURE__ */ React15.createElement("div", {
|
|
917
|
-
className: index_module_default13.messageItem
|
|
918
|
-
}, /* @__PURE__ */ React15.createElement("div", {
|
|
919
|
-
className: index_module_default13.messageContent
|
|
920
|
-
}, /* @__PURE__ */ React15.createElement("span", {
|
|
921
|
-
className: index_module_default13.messageIcon
|
|
922
|
-
}, iconMap[type]), /* @__PURE__ */ React15.createElement("span", null, content)));
|
|
923
|
-
return messageElement;
|
|
924
|
-
};
|
|
925
|
-
var MessageContainer = function(props) {
|
|
926
|
-
var messages = props.messages;
|
|
927
|
-
return /* @__PURE__ */ React15.createElement(TransitionGroup, {
|
|
928
|
-
className: index_module_default13.message
|
|
929
|
-
}, messages.map(function(message) {
|
|
930
|
-
return /* @__PURE__ */ React15.createElement(CSSTransition, {
|
|
931
|
-
key: message.key,
|
|
932
|
-
timeout: 200,
|
|
933
|
-
classNames: {
|
|
934
|
-
enterActive: index_module_default13.enterActive,
|
|
935
|
-
enterDone: index_module_default13.enterDone,
|
|
936
|
-
exitActive: index_module_default13.exit,
|
|
937
|
-
exitDone: index_module_default13.exitActive
|
|
938
|
-
}
|
|
939
|
-
}, /* @__PURE__ */ React15.createElement(MessageItem, _object_spread({}, message)));
|
|
940
|
-
}));
|
|
941
|
-
};
|
|
942
|
-
var Message = /*#__PURE__*/ function() {
|
|
943
|
-
"use strict";
|
|
944
|
-
function Message(container) {
|
|
945
|
-
_class_call_check(this, Message);
|
|
946
|
-
_define_property(this, "_div", void 0);
|
|
947
|
-
_define_property(this, "_messages", []);
|
|
948
|
-
this._div = document.createElement("div");
|
|
949
|
-
container.appendChild(this._div);
|
|
950
|
-
this.render();
|
|
951
|
-
}
|
|
952
|
-
_create_class(Message, [
|
|
953
|
-
{
|
|
954
|
-
key: "append",
|
|
955
|
-
value: function append(type, options) {
|
|
956
|
-
var _this = this;
|
|
957
|
-
var content = options.content, _options_delay = options.delay, delay = _options_delay === void 0 ? 3e3 : _options_delay;
|
|
958
|
-
var key = Date.now();
|
|
959
|
-
this._messages.push({
|
|
960
|
-
key: key,
|
|
961
|
-
type: type,
|
|
962
|
-
content: content
|
|
963
|
-
});
|
|
964
|
-
setTimeout(function() {
|
|
965
|
-
_this.teardown(key);
|
|
966
|
-
}, delay);
|
|
967
|
-
this.render();
|
|
968
|
-
}
|
|
969
|
-
},
|
|
970
|
-
{
|
|
971
|
-
key: "teardown",
|
|
972
|
-
value: function teardown(key) {
|
|
973
|
-
this._messages = this._messages.filter(function(message) {
|
|
974
|
-
return message.key !== key;
|
|
975
|
-
});
|
|
976
|
-
this.render();
|
|
977
|
-
}
|
|
978
|
-
},
|
|
979
|
-
{
|
|
980
|
-
key: "render",
|
|
981
|
-
value: function render1() {
|
|
982
|
-
render(/* @__PURE__ */ React15.createElement(MessageContainer, {
|
|
983
|
-
messages: this._messages
|
|
984
|
-
}), this._div);
|
|
985
|
-
}
|
|
986
|
-
},
|
|
987
|
-
{
|
|
988
|
-
key: "success",
|
|
989
|
-
value: function success(options) {
|
|
990
|
-
this.append("success" /* Success */ , options);
|
|
991
|
-
}
|
|
992
|
-
},
|
|
993
|
-
{
|
|
994
|
-
key: "warning",
|
|
995
|
-
value: function warning(options) {
|
|
996
|
-
this.append("warning" /* Warning */ , options);
|
|
997
|
-
}
|
|
998
|
-
},
|
|
999
|
-
{
|
|
1000
|
-
key: "error",
|
|
1001
|
-
value: function error(options) {
|
|
1002
|
-
this.append("error" /* Error */ , options);
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
]);
|
|
1006
|
-
return Message;
|
|
1007
|
-
}();
|
|
1008
|
-
// src/components/popup/Popup.tsx
|
|
1009
|
-
import React16, { useEffect, useRef as useRef2, useState as useState2 } from "react";
|
|
1010
|
-
import { CSSTransition as CSSTransition2 } from "react-transition-group";
|
|
1011
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/popup/index.module.less
|
|
1012
|
-
var index_module_default14 = {
|
|
1013
|
-
"popup": "univer-popup",
|
|
1014
|
-
"popupEnter": "univer-popup-enter",
|
|
1015
|
-
"popupEnterActive": "univer-popup-enter-active",
|
|
1016
|
-
"popupSlideUpIn": "univer-popup-slide-up-in",
|
|
1017
|
-
"popupExit": "univer-popup-exit",
|
|
1018
|
-
"popupSlideUpOut": "univer-popup-slide-up-out",
|
|
1019
|
-
"popupExitActive": "univer-popup-exit-active"
|
|
1020
|
-
};
|
|
1021
|
-
// src/components/popup/Popup.tsx
|
|
1022
|
-
function Popup(props) {
|
|
1023
|
-
var children = props.children, _props_visible = props.visible, visible = _props_visible === void 0 ? false : _props_visible, _props_offset = props.offset, offset = _props_offset === void 0 ? [
|
|
1024
|
-
0,
|
|
1025
|
-
0
|
|
1026
|
-
] : _props_offset;
|
|
1027
|
-
var nodeRef = useRef2(null);
|
|
1028
|
-
var _useState2 = _sliced_to_array(useState2(offset), 2), realoffset = _useState2[0], setRealOffset = _useState2[1];
|
|
1029
|
-
useEffect(function() {
|
|
1030
|
-
if (!visible) {
|
|
1031
|
-
setRealOffset([
|
|
1032
|
-
-9999,
|
|
1033
|
-
-9999
|
|
1034
|
-
]);
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
var _offset = _sliced_to_array(offset, 2), left = _offset[0], top = _offset[1];
|
|
1038
|
-
var _nodeRef_current = nodeRef.current, clientWidth = _nodeRef_current.clientWidth, clientHeight = _nodeRef_current.clientHeight;
|
|
1039
|
-
var innerWidth = window.innerWidth, innerHeight = window.innerHeight;
|
|
1040
|
-
var x = left + clientWidth > innerWidth ? innerWidth - clientWidth : left;
|
|
1041
|
-
var y = top + clientHeight > innerHeight ? innerHeight - clientHeight : top;
|
|
1042
|
-
setRealOffset([
|
|
1043
|
-
x,
|
|
1044
|
-
y
|
|
1045
|
-
]);
|
|
1046
|
-
}, [
|
|
1047
|
-
offset,
|
|
1048
|
-
visible
|
|
1049
|
-
]);
|
|
1050
|
-
function preventDefault(event) {
|
|
1051
|
-
event.preventDefault();
|
|
1052
|
-
}
|
|
1053
|
-
return /* @__PURE__ */ React16.createElement(CSSTransition2, {
|
|
1054
|
-
in: visible,
|
|
1055
|
-
nodeRef: nodeRef,
|
|
1056
|
-
timeout: 300,
|
|
1057
|
-
classNames: {
|
|
1058
|
-
enter: index_module_default14.popupEnter,
|
|
1059
|
-
enterActive: index_module_default14.popupEnterActive,
|
|
1060
|
-
enterDone: index_module_default14.popupEnterDone,
|
|
1061
|
-
exitActive: index_module_default14.popupExit,
|
|
1062
|
-
exitDone: index_module_default14.popupExitActive
|
|
1063
|
-
}
|
|
1064
|
-
}, /* @__PURE__ */ React16.createElement("section", {
|
|
1065
|
-
ref: nodeRef,
|
|
1066
|
-
className: index_module_default14.popup,
|
|
1067
|
-
style: {
|
|
1068
|
-
left: realoffset[0],
|
|
1069
|
-
top: realoffset[1]
|
|
1070
|
-
},
|
|
1071
|
-
onContextMenu: preventDefault
|
|
1072
|
-
}, children));
|
|
1073
|
-
}
|
|
1074
|
-
// src/components/radio/Radio.tsx
|
|
1075
|
-
import clsx6 from "clsx";
|
|
1076
|
-
import React17, { useRef as useRef3 } from "react";
|
|
1077
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/radio/index.module.less
|
|
1078
|
-
var index_module_default15 = {
|
|
1079
|
-
"radio": "univer-radio",
|
|
1080
|
-
"radioTargetInput": "univer-radio-target-input",
|
|
1081
|
-
"radioTargetInner": "univer-radio-target-inner",
|
|
1082
|
-
"radioDisabled": "univer-radio-disabled",
|
|
1083
|
-
"radioTarget": "univer-radio-target"
|
|
1084
|
-
};
|
|
1085
|
-
// src/components/radio/Radio.tsx
|
|
1086
|
-
function Radio(props) {
|
|
1087
|
-
var children = props.children, checked = props.checked, value = props.value, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, onChange = props.onChange;
|
|
1088
|
-
var inputRef = useRef3(null);
|
|
1089
|
-
function handleChange(e) {
|
|
1090
|
-
e.stopPropagation();
|
|
1091
|
-
if (!onChange || disabled) return;
|
|
1092
|
-
if (typeof value !== "undefined") {
|
|
1093
|
-
onChange && onChange(value);
|
|
1094
|
-
} else {
|
|
1095
|
-
var _inputRef_current;
|
|
1096
|
-
var checked2 = inputRef === null || inputRef === void 0 ? void 0 : (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.checked;
|
|
1097
|
-
onChange && onChange(checked2);
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
var _className = clsx6(index_module_default15.radio, _define_property({}, index_module_default15.radioDisabled, disabled));
|
|
1101
|
-
return /* @__PURE__ */ React17.createElement("label", {
|
|
1102
|
-
className: _className
|
|
1103
|
-
}, /* @__PURE__ */ React17.createElement("span", {
|
|
1104
|
-
className: index_module_default15.radioTarget
|
|
1105
|
-
}, /* @__PURE__ */ React17.createElement("input", {
|
|
1106
|
-
ref: inputRef,
|
|
1107
|
-
className: index_module_default15.radioTargetInput,
|
|
1108
|
-
type: "radio",
|
|
1109
|
-
checked: checked,
|
|
1110
|
-
disabled: disabled,
|
|
1111
|
-
onChange: handleChange
|
|
1112
|
-
}), /* @__PURE__ */ React17.createElement("span", {
|
|
1113
|
-
className: index_module_default15.radioTargetInner
|
|
1114
|
-
})), /* @__PURE__ */ React17.createElement("span", null, children));
|
|
1115
|
-
}
|
|
1116
|
-
// src/components/radio-group/RadioGroup.tsx
|
|
1117
|
-
import React18 from "react";
|
|
1118
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/radio-group/index.module.less
|
|
1119
|
-
var index_module_default16 = {
|
|
1120
|
-
"radioGroup": "univer-radio-group"
|
|
1121
|
-
};
|
|
1122
|
-
// src/components/radio-group/RadioGroup.tsx
|
|
1123
|
-
function RadioGroup(props) {
|
|
1124
|
-
var children = props.children, value = props.value, _props_disabled = props.disabled, disabled = _props_disabled === void 0 ? false : _props_disabled, onChange = props.onChange;
|
|
1125
|
-
var handleChange = function(value2) {
|
|
1126
|
-
onChange(value2);
|
|
1127
|
-
};
|
|
1128
|
-
return /* @__PURE__ */ React18.createElement("div", {
|
|
1129
|
-
className: index_module_default16.radioGroup
|
|
1130
|
-
}, React18.Children.map(children, function(child, index) {
|
|
1131
|
-
if (React18.isValidElement(child)) {
|
|
1132
|
-
return React18.cloneElement(child, {
|
|
1133
|
-
key: index,
|
|
1134
|
-
children: child.props.children,
|
|
1135
|
-
value: child.props.value,
|
|
1136
|
-
checked: value === child.props.value,
|
|
1137
|
-
disabled: disabled !== null && disabled !== void 0 ? disabled : child.props.disabled,
|
|
1138
|
-
onChange: handleChange
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
return child;
|
|
1142
|
-
}));
|
|
1143
|
-
}
|
|
1144
|
-
// src/components/scrollbar/Scrollbar.tsx
|
|
1145
|
-
import React19, { useCallback, useEffect as useEffect2, useRef as useRef4, useState as useState3 } from "react";
|
|
1146
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/scrollbar/index.module.less
|
|
1147
|
-
var index_module_default17 = {
|
|
1148
|
-
"scrollbarContainer": "univer-scrollbar-container",
|
|
1149
|
-
"scrollbarBar": "univer-scrollbar-bar",
|
|
1150
|
-
"scrollbarBarThumb": "univer-scrollbar-bar-thumb",
|
|
1151
|
-
"scrollbarContent": "univer-scrollbar-content"
|
|
1152
|
-
};
|
|
1153
|
-
// src/components/scrollbar/Scrollbar.tsx
|
|
1154
|
-
function Scrollbar(props) {
|
|
1155
|
-
var children = props.children;
|
|
1156
|
-
var _useState3 = _sliced_to_array(useState3(false), 2), isDragging = _useState3[0], setIsDragging = _useState3[1];
|
|
1157
|
-
var _useState31 = _sliced_to_array(useState3(0), 2), initialScrollTop = _useState31[0], setInitialScrollTop = _useState31[1];
|
|
1158
|
-
var _useState32 = _sliced_to_array(useState3(0), 2), scrollPositionY = _useState32[0], setScrollPositionY = _useState32[1];
|
|
1159
|
-
var handleThumbMousedown = useCallback(function(e) {
|
|
1160
|
-
e.preventDefault();
|
|
1161
|
-
e.stopPropagation();
|
|
1162
|
-
setIsDragging(true);
|
|
1163
|
-
setScrollPositionY(e.clientY);
|
|
1164
|
-
setInitialScrollTop(contentRef.current.scrollTop);
|
|
1165
|
-
}, []);
|
|
1166
|
-
var handleThumbMouseup = useCallback(function(e) {
|
|
1167
|
-
e.preventDefault();
|
|
1168
|
-
e.stopPropagation();
|
|
1169
|
-
if (isDragging) {
|
|
1170
|
-
setIsDragging(false);
|
|
1171
|
-
}
|
|
1172
|
-
}, [
|
|
1173
|
-
isDragging
|
|
1174
|
-
]);
|
|
1175
|
-
var handleThumbMousemove = useCallback(function(e) {
|
|
1176
|
-
e.preventDefault();
|
|
1177
|
-
e.stopPropagation();
|
|
1178
|
-
if (isDragging) {
|
|
1179
|
-
var _contentRef_current = contentRef.current, contentScrollHeight = _contentRef_current.scrollHeight, contentOffsetHeight = _contentRef_current.offsetHeight;
|
|
1180
|
-
var thumbHeight2 = contentOffsetHeight * (contentOffsetHeight / contentScrollHeight);
|
|
1181
|
-
var deltaY = (e.clientY - scrollPositionY) * (contentOffsetHeight / thumbHeight2);
|
|
1182
|
-
var scrollTop = Math.min(initialScrollTop + deltaY, contentScrollHeight - contentOffsetHeight);
|
|
1183
|
-
contentRef.current.scrollTop = scrollTop;
|
|
1184
|
-
}
|
|
1185
|
-
}, [
|
|
1186
|
-
isDragging
|
|
1187
|
-
]);
|
|
1188
|
-
useEffect2(function() {
|
|
1189
|
-
document.addEventListener("mousemove", handleThumbMousemove);
|
|
1190
|
-
document.addEventListener("mouseup", handleThumbMouseup);
|
|
1191
|
-
document.addEventListener("mouseleave", handleThumbMouseup);
|
|
1192
|
-
return function() {
|
|
1193
|
-
document.removeEventListener("mousemove", handleThumbMousemove);
|
|
1194
|
-
document.removeEventListener("mouseup", handleThumbMouseup);
|
|
1195
|
-
document.removeEventListener("mouseleave", handleThumbMouseup);
|
|
1196
|
-
};
|
|
1197
|
-
}, [
|
|
1198
|
-
handleThumbMousemove,
|
|
1199
|
-
handleThumbMouseup
|
|
1200
|
-
]);
|
|
1201
|
-
var containerRef = useRef4(null);
|
|
1202
|
-
var contentRef = useRef4(null);
|
|
1203
|
-
var _useState33 = _sliced_to_array(useState3(0), 2), thumbHeight = _useState33[0], setThumbHeight = _useState33[1];
|
|
1204
|
-
var _useState34 = _sliced_to_array(useState3(0), 2), thumbTop = _useState34[0], setThumbTop = _useState34[1];
|
|
1205
|
-
useEffect2(function() {
|
|
1206
|
-
var observer = new ResizeObserver(function() {
|
|
1207
|
-
var timer = requestIdleCallback(function() {
|
|
1208
|
-
if (!timer) return;
|
|
1209
|
-
var _containerRef_current_getBoundingClientRect = containerRef.current.getBoundingClientRect(), containerHeight = _containerRef_current_getBoundingClientRect.height;
|
|
1210
|
-
var scrollHeight = contentRef.current.scrollHeight;
|
|
1211
|
-
setThumbHeight(containerHeight / scrollHeight * 100);
|
|
1212
|
-
timer = void 0;
|
|
1213
|
-
});
|
|
1214
|
-
});
|
|
1215
|
-
observer.observe(document.body);
|
|
1216
|
-
contentRef.current.addEventListener("scroll", function(e) {
|
|
1217
|
-
var _e_target = e.target, scrollTop = _e_target.scrollTop, scrollHeight = _e_target.scrollHeight;
|
|
1218
|
-
var thumbTop2 = scrollTop / scrollHeight * 100;
|
|
1219
|
-
setThumbTop(thumbTop2);
|
|
1220
|
-
});
|
|
1221
|
-
return function() {
|
|
1222
|
-
observer.unobserve(document.body);
|
|
1223
|
-
};
|
|
1224
|
-
}, []);
|
|
1225
|
-
function handleJumpPosition(e) {
|
|
1226
|
-
var _contentRef_current = contentRef.current, contentScrollHeight = _contentRef_current.scrollHeight, contentOffsetHeight = _contentRef_current.offsetHeight;
|
|
1227
|
-
var thumbHeight2 = contentOffsetHeight * (contentOffsetHeight / contentScrollHeight);
|
|
1228
|
-
var deltaY = (e.clientY - scrollPositionY) * (contentOffsetHeight / thumbHeight2);
|
|
1229
|
-
var scrollTop = Math.min(initialScrollTop + deltaY, contentScrollHeight - contentOffsetHeight);
|
|
1230
|
-
contentRef.current.scrollTo({
|
|
1231
|
-
top: scrollTop,
|
|
1232
|
-
behavior: "smooth"
|
|
1233
|
-
});
|
|
1234
|
-
}
|
|
1235
|
-
return /* @__PURE__ */ React19.createElement("div", {
|
|
1236
|
-
ref: containerRef,
|
|
1237
|
-
className: index_module_default17.scrollbarContainer
|
|
1238
|
-
}, /* @__PURE__ */ React19.createElement("div", _object_spread({
|
|
1239
|
-
className: index_module_default17.scrollbarContent,
|
|
1240
|
-
ref: contentRef
|
|
1241
|
-
}, props), children), thumbHeight < 100 && thumbHeight > 0 && /* @__PURE__ */ React19.createElement("div", {
|
|
1242
|
-
className: index_module_default17.scrollbarBar,
|
|
1243
|
-
role: "scrollbar",
|
|
1244
|
-
onClick: handleJumpPosition
|
|
1245
|
-
}, /* @__PURE__ */ React19.createElement("div", {
|
|
1246
|
-
className: index_module_default17.scrollbarBarThumb,
|
|
1247
|
-
style: {
|
|
1248
|
-
height: "".concat(thumbHeight, "%"),
|
|
1249
|
-
top: "".concat(thumbTop, "%")
|
|
1250
|
-
},
|
|
1251
|
-
onMouseDown: handleThumbMousedown
|
|
1252
|
-
})));
|
|
1253
|
-
}
|
|
1254
|
-
// src/components/select/Select.tsx
|
|
1255
|
-
import { MoreDownSingle } from "@univerjs/icons";
|
|
1256
|
-
import RcSelect from "rc-select";
|
|
1257
|
-
import React20, { useContext as useContext5 } from "react";
|
|
1258
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/select/index.module.less
|
|
1259
|
-
var index_module_default18 = {
|
|
1260
|
-
"select": "univer-select",
|
|
1261
|
-
"selectDisabled": "univer-select-disabled",
|
|
1262
|
-
"selectSelector": "univer-select-selector",
|
|
1263
|
-
"selectShowArrow": "univer-select-show-arrow",
|
|
1264
|
-
"selectLoading": "univer-select-loading",
|
|
1265
|
-
"selectArrowIcon": "univer-select-arrow-icon",
|
|
1266
|
-
"selectLoadingIcon": "univer-select-loading-icon",
|
|
1267
|
-
"selectSelectionPlaceholder": "univer-select-selection-placeholder",
|
|
1268
|
-
"selectSelectionSearchInput": "univer-select-selection-search-input",
|
|
1269
|
-
"selectSingle": "univer-select-single",
|
|
1270
|
-
"selectSelectionSearch": "univer-select-selection-search",
|
|
1271
|
-
"selectSelectionItem": "univer-select-selection-item",
|
|
1272
|
-
"selectCustomizeInput": "univer-select-customize-input",
|
|
1273
|
-
"selectMultiple": "univer-select-multiple",
|
|
1274
|
-
"selectSelectionItemDisabled": "univer-select-selection-item-disabled",
|
|
1275
|
-
"selectSelectionOverflow": "univer-select-selection-overflow",
|
|
1276
|
-
"selectSelectionOverflowItem": "univer-select-selection-overflow-item",
|
|
1277
|
-
"selectSelectionSearchMirror": "univer-select-selection-search-mirror",
|
|
1278
|
-
"selectAllowClear": "univer-select-allow-clear",
|
|
1279
|
-
"selectClear": "univer-select-clear",
|
|
1280
|
-
"selectArrow": "univer-select-arrow",
|
|
1281
|
-
"selectFocused": "univer-select-focused",
|
|
1282
|
-
"selectDropdown": "univer-select-dropdown",
|
|
1283
|
-
"selectDropdownHidden": "univer-select-dropdown-hidden",
|
|
1284
|
-
"selectItem": "univer-select-item",
|
|
1285
|
-
"selectItemGroup": "univer-select-item-group",
|
|
1286
|
-
"selectItemOption": "univer-select-item-option",
|
|
1287
|
-
"selectItemOptionState": "univer-select-item-option-state",
|
|
1288
|
-
"selectItemOptionActive": "univer-select-item-option-active",
|
|
1289
|
-
"selectItemOptionDisabled": "univer-select-item-option-disabled",
|
|
1290
|
-
"selectItemEmpty": "univer-select-item-empty",
|
|
1291
|
-
"selectSelectionChoiceZoom": "univer-select-selection__choice-zoom",
|
|
1292
|
-
"selectSelectionChoiceZoomAppear": "univer-select-selection__choice-zoom-appear",
|
|
1293
|
-
"selectSelectionChoiceZoomAppearActive": "univer-select-selection__choice-zoom-appear-active",
|
|
1294
|
-
"selectSelectionChoiceZoomLeave": "univer-select-selection__choice-zoom-leave",
|
|
1295
|
-
"selectSelectionChoiceZoomLeaveActive": "univer-select-selection__choice-zoom-leave-active",
|
|
1296
|
-
"selectDropdownSlideUpEnter": "univer-select-dropdown-slide-up-enter",
|
|
1297
|
-
"selectDropdownSlideUpAppear": "univer-select-dropdown-slide-up-appear",
|
|
1298
|
-
"selectDropdownSlideUpLeave": "univer-select-dropdown-slide-up-leave",
|
|
1299
|
-
"selectDropdownSlideUpEnterActive": "univer-select-dropdown-slide-up-enter-active",
|
|
1300
|
-
"selectDropdownPlacementBottomLeft": "univer-select-dropdown-placement-bottomLeft",
|
|
1301
|
-
"selectDropdownSlideUpAppearActive": "univer-select-dropdown-slide-up-appear-active",
|
|
1302
|
-
"selectDropdownPlacementBottomRight": "univer-select-dropdown-placement-bottomRight",
|
|
1303
|
-
"selectDropdownSlideUpIn": "univer-select-dropdown-slide-up-in",
|
|
1304
|
-
"selectDropdownSlideUpLeaveActive": "univer-select-dropdown-slide-up-leave-active",
|
|
1305
|
-
"selectDropdownSlideUpOut": "univer-select-dropdown-slide-up-out",
|
|
1306
|
-
"selectDropdownPlacementTopLeft": "univer-select-dropdown-placement-topLeft",
|
|
1307
|
-
"selectDropdownPlacementTopRight": "univer-select-dropdown-placement-topRight",
|
|
1308
|
-
"selectDropdownSlideDownIn": "univer-select-dropdown-slide-down-in",
|
|
1309
|
-
"selectDropdownSlideDownOut": "univer-select-dropdown-slide-down-out"
|
|
1310
|
-
};
|
|
1311
|
-
// src/components/select/Select.tsx
|
|
1312
|
-
function Select(props) {
|
|
1313
|
-
var value = props.value, _props_options = props.options, options = _props_options === void 0 ? [] : _props_options, onChange = props.onChange;
|
|
1314
|
-
var mountContainer = useContext5(ConfigContext).mountContainer;
|
|
1315
|
-
return /* @__PURE__ */ React20.createElement(RcSelect, {
|
|
1316
|
-
prefixCls: index_module_default18.select,
|
|
1317
|
-
getPopupContainer: function() {
|
|
1318
|
-
return mountContainer;
|
|
1319
|
-
},
|
|
1320
|
-
options: options,
|
|
1321
|
-
value: value,
|
|
1322
|
-
menuItemSelectedIcon: null,
|
|
1323
|
-
suffixIcon: /* @__PURE__ */ React20.createElement(MoreDownSingle, null),
|
|
1324
|
-
onChange: onChange
|
|
1325
|
-
});
|
|
1326
|
-
}
|
|
1327
|
-
// src/components/select-list/SelectList.tsx
|
|
1328
|
-
import { CheckMarkSingle as CheckMarkSingle2 } from "@univerjs/icons";
|
|
1329
|
-
import clsx7 from "clsx";
|
|
1330
|
-
import React21 from "react";
|
|
1331
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/select-list/index.module.less
|
|
1332
|
-
var index_module_default19 = {
|
|
1333
|
-
"selectList": "univer-select-list",
|
|
1334
|
-
"selectListItem": "univer-select-list-item",
|
|
1335
|
-
"selectListItemIcon": "univer-select-list-item-icon",
|
|
1336
|
-
"selectListItemSelect": "univer-select-list-item-select"
|
|
1337
|
-
};
|
|
1338
|
-
// src/components/select-list/SelectList.tsx
|
|
1339
|
-
function SelectList(props) {
|
|
1340
|
-
var value = props.value, _props_options = props.options, options = _props_options === void 0 ? [] : _props_options, _props_hideCheckMark = props.hideCheckMark, hideCheckMark = _props_hideCheckMark === void 0 ? false : _props_hideCheckMark, onChange = props.onChange;
|
|
1341
|
-
function handleSelect(value2) {
|
|
1342
|
-
onChange(value2);
|
|
1343
|
-
}
|
|
1344
|
-
return /* @__PURE__ */ React21.createElement("ul", {
|
|
1345
|
-
className: index_module_default19.selectList
|
|
1346
|
-
}, options.map(function(option, index) {
|
|
1347
|
-
return /* @__PURE__ */ React21.createElement("li", {
|
|
1348
|
-
key: index,
|
|
1349
|
-
className: clsx7(index_module_default19.selectListItem, _define_property({}, index_module_default19.selectListItemSelect, value === option.value))
|
|
1350
|
-
}, /* @__PURE__ */ React21.createElement("a", {
|
|
1351
|
-
onClick: function() {
|
|
1352
|
-
return handleSelect(option.value);
|
|
1353
|
-
}
|
|
1354
|
-
}, !hideCheckMark && /* @__PURE__ */ React21.createElement("span", {
|
|
1355
|
-
className: index_module_default19.selectListItemIcon
|
|
1356
|
-
}, value === option.value && /* @__PURE__ */ React21.createElement(CheckMarkSingle2, null)), /* @__PURE__ */ React21.createElement("span", {
|
|
1357
|
-
style: {
|
|
1358
|
-
color: option.color
|
|
1359
|
-
}
|
|
1360
|
-
}, option.label)));
|
|
1361
|
-
}));
|
|
1362
|
-
}
|
|
1363
|
-
// src/components/slider/Slider.tsx
|
|
1364
|
-
import { IncreaseSingle, ReduceSingle } from "@univerjs/icons";
|
|
1365
|
-
import clsx8 from "clsx";
|
|
1366
|
-
import React23, { useContext as useContext7, useMemo as useMemo2, useRef as useRef5 } from "react";
|
|
1367
|
-
// src/components/tooltip/Tooltip.tsx
|
|
1368
|
-
import RcTooltip from "rc-tooltip";
|
|
1369
|
-
import React22, { useContext as useContext6 } from "react";
|
|
1370
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/tooltip/index.module.less
|
|
1371
|
-
var index_module_default20 = {
|
|
1372
|
-
"tooltip": "univer-tooltip",
|
|
1373
|
-
"tooltipHidden": "univer-tooltip-hidden",
|
|
1374
|
-
"tooltipPlacementTop": "univer-tooltip-placement-top",
|
|
1375
|
-
"tooltipPlacementRight": "univer-tooltip-placement-right",
|
|
1376
|
-
"tooltipPlacementBottom": "univer-tooltip-placement-bottom",
|
|
1377
|
-
"tooltipPlacementLeft": "univer-tooltip-placement-left",
|
|
1378
|
-
"tooltipArrow": "univer-tooltip-arrow",
|
|
1379
|
-
"tooltipPlacementTopLeft": "univer-tooltip-placement-topLeft",
|
|
1380
|
-
"tooltipPlacementTopRight": "univer-tooltip-placement-topRight",
|
|
1381
|
-
"tooltipInner": "univer-tooltip-inner"
|
|
1382
|
-
};
|
|
1383
|
-
// src/components/tooltip/placements.tsx
|
|
1384
|
-
var autoAdjustOverflowTopBottom = {
|
|
1385
|
-
shiftX: 0,
|
|
1386
|
-
adjustY: 1
|
|
1387
|
-
};
|
|
1388
|
-
var autoAdjustOverflowLeftRight = {
|
|
1389
|
-
adjustX: 1,
|
|
1390
|
-
shiftY: true
|
|
1391
|
-
};
|
|
1392
|
-
var targetOffset = [
|
|
1393
|
-
0,
|
|
1394
|
-
0
|
|
1395
|
-
];
|
|
1396
|
-
var placements = {
|
|
1397
|
-
left: {
|
|
1398
|
-
points: [
|
|
1399
|
-
"cr",
|
|
1400
|
-
"cl"
|
|
1401
|
-
],
|
|
1402
|
-
overflow: autoAdjustOverflowLeftRight,
|
|
1403
|
-
offset: [
|
|
1404
|
-
-4,
|
|
1405
|
-
0
|
|
1406
|
-
],
|
|
1407
|
-
targetOffset: targetOffset
|
|
1408
|
-
},
|
|
1409
|
-
right: {
|
|
1410
|
-
points: [
|
|
1411
|
-
"cl",
|
|
1412
|
-
"cr"
|
|
1413
|
-
],
|
|
1414
|
-
overflow: autoAdjustOverflowLeftRight,
|
|
1415
|
-
offset: [
|
|
1416
|
-
4,
|
|
1417
|
-
0
|
|
1418
|
-
],
|
|
1419
|
-
targetOffset: targetOffset
|
|
1420
|
-
},
|
|
1421
|
-
top: {
|
|
1422
|
-
points: [
|
|
1423
|
-
"bc",
|
|
1424
|
-
"tc"
|
|
1425
|
-
],
|
|
1426
|
-
overflow: autoAdjustOverflowTopBottom,
|
|
1427
|
-
offset: [
|
|
1428
|
-
0,
|
|
1429
|
-
-4
|
|
1430
|
-
],
|
|
1431
|
-
targetOffset: targetOffset
|
|
1432
|
-
},
|
|
1433
|
-
bottom: {
|
|
1434
|
-
points: [
|
|
1435
|
-
"tc",
|
|
1436
|
-
"bc"
|
|
1437
|
-
],
|
|
1438
|
-
overflow: autoAdjustOverflowTopBottom,
|
|
1439
|
-
offset: [
|
|
1440
|
-
0,
|
|
1441
|
-
4
|
|
1442
|
-
],
|
|
1443
|
-
targetOffset: targetOffset
|
|
1444
|
-
}
|
|
1445
|
-
};
|
|
1446
|
-
// src/components/tooltip/Tooltip.tsx
|
|
1447
|
-
var Tooltip = function(props) {
|
|
1448
|
-
var children = props.children, _props_placement = props.placement, placement = _props_placement === void 0 ? "top" : _props_placement, title = props.title;
|
|
1449
|
-
var mountContainer = useContext6(ConfigContext).mountContainer;
|
|
1450
|
-
return /* @__PURE__ */ React22.createElement(RcTooltip, {
|
|
1451
|
-
prefixCls: index_module_default20.tooltip,
|
|
1452
|
-
getTooltipContainer: function() {
|
|
1453
|
-
return mountContainer;
|
|
1454
|
-
},
|
|
1455
|
-
overlay: /* @__PURE__ */ React22.createElement("div", {
|
|
1456
|
-
className: index_module_default20.tooltipContent
|
|
1457
|
-
}, typeof title === "function" ? title() : title),
|
|
1458
|
-
builtinPlacements: placements,
|
|
1459
|
-
placement: placement,
|
|
1460
|
-
mouseEnterDelay: 0.2,
|
|
1461
|
-
showArrow: true,
|
|
1462
|
-
destroyTooltipOnHide: true
|
|
1463
|
-
}, children);
|
|
1464
|
-
};
|
|
1465
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/components/slider/index.module.less
|
|
1466
|
-
var index_module_default21 = {
|
|
1467
|
-
"sliderWidth": "116",
|
|
1468
|
-
"sliderHandleSize": "12",
|
|
1469
|
-
"slider": "univer-slider",
|
|
1470
|
-
"sliderRail": "univer-slider-rail",
|
|
1471
|
-
"sliderInnerRail": "univer-slider-inner-rail",
|
|
1472
|
-
"sliderHandle": "univer-slider-handle",
|
|
1473
|
-
"sliderResetPoint": "univer-slider-reset-point",
|
|
1474
|
-
"sliderValue": "univer-slider-value",
|
|
1475
|
-
"dropdownOpen": "univer-dropdown-open",
|
|
1476
|
-
"sliderShortcuts": "univer-slider-shortcuts",
|
|
1477
|
-
"sliderShortcut": "univer-slider-shortcut",
|
|
1478
|
-
"sliderShortcutIcon": "univer-slider-shortcut-icon",
|
|
1479
|
-
"sliderShortcutActive": "univer-slider-shortcut-active"
|
|
1480
|
-
};
|
|
1481
|
-
// src/components/slider/Slider.tsx
|
|
1482
|
-
function Slider(props) {
|
|
1483
|
-
var value = props.value, _props_min = props.min, min = _props_min === void 0 ? 0 : _props_min, _props_max = props.max, max = _props_max === void 0 ? 400 : _props_max, _props_resetPoint = props.resetPoint, resetPoint = _props_resetPoint === void 0 ? 100 : _props_resetPoint, shortcuts = props.shortcuts, onChange = props.onChange;
|
|
1484
|
-
var sliderInnerRailRef = useRef5(null);
|
|
1485
|
-
var _useContext7 = useContext7(ConfigContext), locale2 = _useContext7.locale;
|
|
1486
|
-
function handleReset() {
|
|
1487
|
-
onChange && onChange(resetPoint);
|
|
1488
|
-
}
|
|
1489
|
-
function handleStep(offset2) {
|
|
1490
|
-
var result = value + offset2;
|
|
1491
|
-
if (value + offset2 <= min) {
|
|
1492
|
-
result = min;
|
|
1493
|
-
} else if (value + offset2 >= max) {
|
|
1494
|
-
result = max;
|
|
1495
|
-
}
|
|
1496
|
-
onChange && onChange(result);
|
|
1497
|
-
}
|
|
1498
|
-
var offset = useMemo2(function() {
|
|
1499
|
-
if (value <= resetPoint) {
|
|
1500
|
-
var ratio = 50 / (resetPoint - min);
|
|
1501
|
-
return (value - min) * ratio;
|
|
1502
|
-
}
|
|
1503
|
-
if (value <= max) {
|
|
1504
|
-
return resetPoint * 0.5 + (value - resetPoint) / (max - resetPoint) * 50;
|
|
1505
|
-
}
|
|
1506
|
-
}, [
|
|
1507
|
-
min,
|
|
1508
|
-
max,
|
|
1509
|
-
resetPoint,
|
|
1510
|
-
value
|
|
1511
|
-
]);
|
|
1512
|
-
function handleMouseDown(e) {
|
|
1513
|
-
e.preventDefault();
|
|
1514
|
-
var rail = sliderInnerRailRef.current;
|
|
1515
|
-
var isDragging = true;
|
|
1516
|
-
function onMouseMove(e2) {
|
|
1517
|
-
if (isDragging) {
|
|
1518
|
-
var pureOffsetX = e2.clientX - rail.getBoundingClientRect().x;
|
|
1519
|
-
var offsetX = pureOffsetX;
|
|
1520
|
-
if (offsetX <= 0) {
|
|
1521
|
-
offsetX = 0;
|
|
1522
|
-
} else if (offsetX >= index_module_default21.sliderWidth) {
|
|
1523
|
-
offsetX = index_module_default21.sliderWidth;
|
|
1524
|
-
}
|
|
1525
|
-
var ratio = offsetX / index_module_default21.sliderWidth;
|
|
1526
|
-
var result = 0;
|
|
1527
|
-
if (ratio <= 0.5) {
|
|
1528
|
-
result = min + ratio * (resetPoint - min) * 2;
|
|
1529
|
-
} else {
|
|
1530
|
-
result = resetPoint + (ratio - 0.5) * (max - resetPoint) * 2;
|
|
1531
|
-
}
|
|
1532
|
-
onChange && onChange(Math.ceil(result));
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
function onMouseUp() {
|
|
1536
|
-
isDragging = false;
|
|
1537
|
-
document.removeEventListener("mousemove", onMouseMove);
|
|
1538
|
-
window.removeEventListener("mouseup", onMouseUp);
|
|
1539
|
-
}
|
|
1540
|
-
function onMouseOut(e2) {
|
|
1541
|
-
e2.relatedTarget === null && onMouseUp();
|
|
1542
|
-
}
|
|
1543
|
-
document.addEventListener("mousemove", onMouseMove);
|
|
1544
|
-
window.addEventListener("mouseup", onMouseUp);
|
|
1545
|
-
window.addEventListener("mouseout", onMouseOut);
|
|
1546
|
-
}
|
|
1547
|
-
return /* @__PURE__ */ React23.createElement("div", {
|
|
1548
|
-
className: index_module_default21.slider
|
|
1549
|
-
}, /* @__PURE__ */ React23.createElement(Button, {
|
|
1550
|
-
type: "text",
|
|
1551
|
-
size: "small",
|
|
1552
|
-
disabled: value <= min,
|
|
1553
|
-
onClick: function() {
|
|
1554
|
-
return handleStep(-10);
|
|
1555
|
-
}
|
|
1556
|
-
}, /* @__PURE__ */ React23.createElement(ReduceSingle, null)), /* @__PURE__ */ React23.createElement("div", {
|
|
1557
|
-
className: index_module_default21.sliderRail
|
|
1558
|
-
}, /* @__PURE__ */ React23.createElement("div", {
|
|
1559
|
-
ref: sliderInnerRailRef,
|
|
1560
|
-
role: "track",
|
|
1561
|
-
className: index_module_default21.sliderInnerRail
|
|
1562
|
-
}, /* @__PURE__ */ React23.createElement(Tooltip, {
|
|
1563
|
-
title: "".concat(locale2.design.Slider.resetTo, " ").concat(resetPoint, "%")
|
|
1564
|
-
}, /* @__PURE__ */ React23.createElement("a", {
|
|
1565
|
-
className: index_module_default21.sliderResetPoint,
|
|
1566
|
-
role: "reset button",
|
|
1567
|
-
onClick: handleReset
|
|
1568
|
-
})), /* @__PURE__ */ React23.createElement("div", {
|
|
1569
|
-
className: index_module_default21.sliderHandle,
|
|
1570
|
-
role: "handle",
|
|
1571
|
-
style: {
|
|
1572
|
-
left: "".concat(offset, "%")
|
|
1573
|
-
},
|
|
1574
|
-
onMouseDown: handleMouseDown
|
|
1575
|
-
}))), /* @__PURE__ */ React23.createElement(Button, {
|
|
1576
|
-
type: "text",
|
|
1577
|
-
size: "small",
|
|
1578
|
-
disabled: value >= max,
|
|
1579
|
-
onClick: function() {
|
|
1580
|
-
return handleStep(10);
|
|
1581
|
-
}
|
|
1582
|
-
}, /* @__PURE__ */ React23.createElement(IncreaseSingle, null)), /* @__PURE__ */ React23.createElement(Dropdown, {
|
|
1583
|
-
placement: "topLeft",
|
|
1584
|
-
overlay: /* @__PURE__ */ React23.createElement("div", {
|
|
1585
|
-
className: index_module_default21.sliderShortcuts
|
|
1586
|
-
}, shortcuts === null || shortcuts === void 0 ? void 0 : shortcuts.map(function(item) {
|
|
1587
|
-
return /* @__PURE__ */ React23.createElement("a", {
|
|
1588
|
-
key: item,
|
|
1589
|
-
className: clsx8(index_module_default21.sliderShortcut, item === value ? index_module_default21.sliderShortcutActive : ""),
|
|
1590
|
-
onClick: function() {
|
|
1591
|
-
return onChange && onChange(item);
|
|
1592
|
-
}
|
|
1593
|
-
}, item === value && /* @__PURE__ */ React23.createElement("span", {
|
|
1594
|
-
className: index_module_default21.sliderShortcutIcon
|
|
1595
|
-
}, "✔"), /* @__PURE__ */ React23.createElement("span", null, item, "%"));
|
|
1596
|
-
}))
|
|
1597
|
-
}, /* @__PURE__ */ React23.createElement("a", {
|
|
1598
|
-
className: index_module_default21.sliderValue
|
|
1599
|
-
}, value, "%")));
|
|
1600
|
-
}
|
|
1601
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/themes/default.module.less
|
|
1602
|
-
var default_module_default = {
|
|
1603
|
-
"red50": "#fee7e7",
|
|
1604
|
-
"red100": "#fdcece",
|
|
1605
|
-
"red200": "#fb9d9d",
|
|
1606
|
-
"red300": "#fa7979",
|
|
1607
|
-
"red400": "#fe4b4b",
|
|
1608
|
-
"red500": "#f30b0b",
|
|
1609
|
-
"red600": "#e30909",
|
|
1610
|
-
"red700": "#cd0f0f",
|
|
1611
|
-
"red800": "#b20000",
|
|
1612
|
-
"red900": "#9d0000",
|
|
1613
|
-
"orange50": "#fef0e6",
|
|
1614
|
-
"orange100": "#fee1cd",
|
|
1615
|
-
"orange200": "#fdc49b",
|
|
1616
|
-
"orange300": "#fca669",
|
|
1617
|
-
"orange400": "#ff8c51",
|
|
1618
|
-
"orange500": "#fb8937",
|
|
1619
|
-
"orange600": "#f96800",
|
|
1620
|
-
"orange700": "#df5d00",
|
|
1621
|
-
"orange800": "#cc4f10",
|
|
1622
|
-
"orange900": "#b24000",
|
|
1623
|
-
"gold50": "#fef6e6",
|
|
1624
|
-
"gold100": "#feeecd",
|
|
1625
|
-
"gold200": "#fddc9b",
|
|
1626
|
-
"gold300": "#fccb69",
|
|
1627
|
-
"gold400": "#ffbd37",
|
|
1628
|
-
"gold500": "#faad14",
|
|
1629
|
-
"gold600": "#e59b07",
|
|
1630
|
-
"gold700": "#c68400",
|
|
1631
|
-
"gold800": "#a97100",
|
|
1632
|
-
"gold900": "#8f5f00",
|
|
1633
|
-
"yellow50": "#fefbe6",
|
|
1634
|
-
"yellow100": "#fef7cd",
|
|
1635
|
-
"yellow200": "#fdf09b",
|
|
1636
|
-
"yellow300": "#fce869",
|
|
1637
|
-
"yellow400": "#fbe137",
|
|
1638
|
-
"yellow500": "#f9d700",
|
|
1639
|
-
"yellow600": "#ebc301",
|
|
1640
|
-
"yellow700": "#d8b300",
|
|
1641
|
-
"yellow800": "#c5a300",
|
|
1642
|
-
"yellow900": "#b19401",
|
|
1643
|
-
"verdancy50": "#f7fde8",
|
|
1644
|
-
"verdancy100": "#effbd0",
|
|
1645
|
-
"verdancy200": "#def6a2",
|
|
1646
|
-
"verdancy300": "#cef273",
|
|
1647
|
-
"verdancy400": "#beee44",
|
|
1648
|
-
"verdancy500": "#a4dc16",
|
|
1649
|
-
"verdancy600": "#8bbb11",
|
|
1650
|
-
"verdancy700": "#7aa017",
|
|
1651
|
-
"verdancy800": "#688c0d",
|
|
1652
|
-
"verdancy900": "#58770a",
|
|
1653
|
-
"green50": "#effce8",
|
|
1654
|
-
"green100": "#dff9d2",
|
|
1655
|
-
"green200": "#bff3a5",
|
|
1656
|
-
"green300": "#9fed78",
|
|
1657
|
-
"green400": "#7fe74b",
|
|
1658
|
-
"green500": "#59d01e",
|
|
1659
|
-
"green600": "#49b811",
|
|
1660
|
-
"green700": "#409f11",
|
|
1661
|
-
"green800": "#398712",
|
|
1662
|
-
"green900": "#317310",
|
|
1663
|
-
"jiqing50": "#e8fcfc",
|
|
1664
|
-
"jiqing100": "#d1fafa",
|
|
1665
|
-
"jiqing200": "#a3f5f5",
|
|
1666
|
-
"jiqing300": "#76efef",
|
|
1667
|
-
"jiqing400": "#2aeaea",
|
|
1668
|
-
"jiqing500": "#1cd8d8",
|
|
1669
|
-
"jiqing600": "#00bbbb",
|
|
1670
|
-
"jiqing700": "#009e9e",
|
|
1671
|
-
"jiqing800": "#008a8a",
|
|
1672
|
-
"jiqing900": "#007676",
|
|
1673
|
-
"blue50": "#e5f3ff",
|
|
1674
|
-
"blue100": "#cce6ff",
|
|
1675
|
-
"blue200": "#99ceff",
|
|
1676
|
-
"blue300": "#66b5ff",
|
|
1677
|
-
"blue400": "#339cff",
|
|
1678
|
-
"blue500": "#188fff",
|
|
1679
|
-
"blue600": "#0081fa",
|
|
1680
|
-
"blue700": "#0072de",
|
|
1681
|
-
"blue800": "#0063c0",
|
|
1682
|
-
"blue900": "#0053a0",
|
|
1683
|
-
"hyacinth50": "#e8ecfd",
|
|
1684
|
-
"hyacinth100": "#d0d9fb",
|
|
1685
|
-
"hyacinth200": "#a2b3f6",
|
|
1686
|
-
"hyacinth300": "#738df2",
|
|
1687
|
-
"hyacinth400": "#4567ed",
|
|
1688
|
-
"hyacinth500": "#2f55eb",
|
|
1689
|
-
"hyacinth600": "#133de3",
|
|
1690
|
-
"hyacinth700": "#012bd2",
|
|
1691
|
-
"hyacinth800": "#0025b7",
|
|
1692
|
-
"hyacinth900": "#001f9c",
|
|
1693
|
-
"purple50": "#f1eafa",
|
|
1694
|
-
"purple100": "#e3d5f6",
|
|
1695
|
-
"purple200": "#c7abed",
|
|
1696
|
-
"purple300": "#aa82e3",
|
|
1697
|
-
"purple400": "#9e6de3",
|
|
1698
|
-
"purple500": "#894ede",
|
|
1699
|
-
"purple600": "#7735d4",
|
|
1700
|
-
"purple700": "#6721cb",
|
|
1701
|
-
"purple800": "#510eb0",
|
|
1702
|
-
"purple900": "#3f0198",
|
|
1703
|
-
"magenta50": "#fde8f3",
|
|
1704
|
-
"magenta100": "#fbd0e8",
|
|
1705
|
-
"magenta200": "#f6a2d0",
|
|
1706
|
-
"magenta300": "#f273b9",
|
|
1707
|
-
"magenta400": "#f248a6",
|
|
1708
|
-
"magenta500": "#e7258f",
|
|
1709
|
-
"magenta600": "#d4157e",
|
|
1710
|
-
"magenta700": "#c1026b",
|
|
1711
|
-
"magenta800": "#a1095c",
|
|
1712
|
-
"magenta900": "#8f0550",
|
|
1713
|
-
"grey50": "#f9f9f9",
|
|
1714
|
-
"grey100": "#f5f5f5",
|
|
1715
|
-
"grey200": "#e5e5e5",
|
|
1716
|
-
"grey300": "#e8e8e8",
|
|
1717
|
-
"grey400": "#cccccc",
|
|
1718
|
-
"grey500": "#b2b2b2",
|
|
1719
|
-
"grey600": "#999999",
|
|
1720
|
-
"grey700": "#8b8b8b",
|
|
1721
|
-
"grey800": "#7d7d7d",
|
|
1722
|
-
"grey900": "#6f6f6f",
|
|
1723
|
-
"grey950": "#606060",
|
|
1724
|
-
"grey1000": "#505050",
|
|
1725
|
-
"colorBlack": "#35322b",
|
|
1726
|
-
"colorWhite": "#ffffff",
|
|
1727
|
-
"boxShadowBase": "0 4px 12px rgba(53, 50, 43, 0.08)",
|
|
1728
|
-
"boxShadowLg": "0 4px 24px 0 rgba(53, 50, 43, 0.08)",
|
|
1729
|
-
"bgColor": "#f5f5f5",
|
|
1730
|
-
"bgColorHover": "#e8e8e8",
|
|
1731
|
-
"bgColorSecondary": "#ffffff",
|
|
1732
|
-
"textColor": "#35322b",
|
|
1733
|
-
"textColorSecondary": "#999999",
|
|
1734
|
-
"textColorTertiary": "#e5e5e5",
|
|
1735
|
-
"borderColor": "#e5e5e5",
|
|
1736
|
-
"scrollbarColor": "#cccccc",
|
|
1737
|
-
"scrollbarColorHover": "#b2b2b2",
|
|
1738
|
-
"scrollbarColorActive": "#999999",
|
|
1739
|
-
"borderRadiusBase": "4px",
|
|
1740
|
-
"borderRadiusLg": "8px",
|
|
1741
|
-
"borderRadiusXl": "12px",
|
|
1742
|
-
"marginXl": "24px",
|
|
1743
|
-
"marginLg": "20px",
|
|
1744
|
-
"marginBase": "16px",
|
|
1745
|
-
"marginSm": "12px",
|
|
1746
|
-
"marginXs": "8px",
|
|
1747
|
-
"marginXxs": "4px",
|
|
1748
|
-
"paddingXl": "20px",
|
|
1749
|
-
"paddingLg": "16px",
|
|
1750
|
-
"paddingBase": "12px",
|
|
1751
|
-
"paddingSm": "8px",
|
|
1752
|
-
"paddingXs": "4px",
|
|
1753
|
-
"fontSizeXxl": "20px",
|
|
1754
|
-
"fontSizeXl": "18px",
|
|
1755
|
-
"fontSizeLg": "16px",
|
|
1756
|
-
"fontSizeBase": "15px",
|
|
1757
|
-
"fontSizeSm": "14px",
|
|
1758
|
-
"fontSizeXs": "13px",
|
|
1759
|
-
"fontSizeXxs": "12px",
|
|
1760
|
-
"breakpointXs": "768px",
|
|
1761
|
-
"breakpointSm": "1024px",
|
|
1762
|
-
"breakpointBase": "1280px",
|
|
1763
|
-
"breakpointLg": "1536px",
|
|
1764
|
-
"infoColor": "#339cff",
|
|
1765
|
-
"successColor": "#59d01e",
|
|
1766
|
-
"warningColor": "#ffbd37",
|
|
1767
|
-
"errorColor": "#fe4b4b",
|
|
1768
|
-
"primaryColor": "#0072de",
|
|
1769
|
-
"primaryColorHover": "#0081fa",
|
|
1770
|
-
"linkColor": "#188fff",
|
|
1771
|
-
"loopColor1": "#9e6de3",
|
|
1772
|
-
"loopColor2": "#49b811",
|
|
1773
|
-
"loopColor3": "#188fff",
|
|
1774
|
-
"loopColor4": "#ffbd37",
|
|
1775
|
-
"loopColor5": "#f273b9",
|
|
1776
|
-
"loopColor6": "#00bbbb",
|
|
1777
|
-
"loopColor7": "#ff8c51",
|
|
1778
|
-
"loopColor8": "#7d7d7d",
|
|
1779
|
-
"loopColor9": "#2f55eb",
|
|
1780
|
-
"loopColor10": "#fa7979",
|
|
1781
|
-
"loopColor11": "#8bbb11",
|
|
1782
|
-
"loopColor12": "#d8b300"
|
|
1783
|
-
};
|
|
1784
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/themes/green.module.less
|
|
1785
|
-
var green_module_default = {
|
|
1786
|
-
"red50": "#fee7e7",
|
|
1787
|
-
"red100": "#fdcece",
|
|
1788
|
-
"red200": "#fb9d9d",
|
|
1789
|
-
"red300": "#fa7979",
|
|
1790
|
-
"red400": "#fe4b4b",
|
|
1791
|
-
"red500": "#f30b0b",
|
|
1792
|
-
"red600": "#e30909",
|
|
1793
|
-
"red700": "#cd0f0f",
|
|
1794
|
-
"red800": "#b20000",
|
|
1795
|
-
"red900": "#9d0000",
|
|
1796
|
-
"orange50": "#fef0e6",
|
|
1797
|
-
"orange100": "#fee1cd",
|
|
1798
|
-
"orange200": "#fdc49b",
|
|
1799
|
-
"orange300": "#fca669",
|
|
1800
|
-
"orange400": "#ff8c51",
|
|
1801
|
-
"orange500": "#fb8937",
|
|
1802
|
-
"orange600": "#f96800",
|
|
1803
|
-
"orange700": "#df5d00",
|
|
1804
|
-
"orange800": "#cc4f10",
|
|
1805
|
-
"orange900": "#b24000",
|
|
1806
|
-
"gold50": "#fef6e6",
|
|
1807
|
-
"gold100": "#feeecd",
|
|
1808
|
-
"gold200": "#fddc9b",
|
|
1809
|
-
"gold300": "#fccb69",
|
|
1810
|
-
"gold400": "#ffbd37",
|
|
1811
|
-
"gold500": "#faad14",
|
|
1812
|
-
"gold600": "#e59b07",
|
|
1813
|
-
"gold700": "#c68400",
|
|
1814
|
-
"gold800": "#a97100",
|
|
1815
|
-
"gold900": "#8f5f00",
|
|
1816
|
-
"yellow50": "#fefbe6",
|
|
1817
|
-
"yellow100": "#fef7cd",
|
|
1818
|
-
"yellow200": "#fdf09b",
|
|
1819
|
-
"yellow300": "#fce869",
|
|
1820
|
-
"yellow400": "#fbe137",
|
|
1821
|
-
"yellow500": "#f9d700",
|
|
1822
|
-
"yellow600": "#ebc301",
|
|
1823
|
-
"yellow700": "#d8b300",
|
|
1824
|
-
"yellow800": "#c5a300",
|
|
1825
|
-
"yellow900": "#b19401",
|
|
1826
|
-
"verdancy50": "#f7fde8",
|
|
1827
|
-
"verdancy100": "#effbd0",
|
|
1828
|
-
"verdancy200": "#def6a2",
|
|
1829
|
-
"verdancy300": "#cef273",
|
|
1830
|
-
"verdancy400": "#beee44",
|
|
1831
|
-
"verdancy500": "#a4dc16",
|
|
1832
|
-
"verdancy600": "#8bbb11",
|
|
1833
|
-
"verdancy700": "#7aa017",
|
|
1834
|
-
"verdancy800": "#688c0d",
|
|
1835
|
-
"verdancy900": "#58770a",
|
|
1836
|
-
"green50": "#effce8",
|
|
1837
|
-
"green100": "#dff9d2",
|
|
1838
|
-
"green200": "#bff3a5",
|
|
1839
|
-
"green300": "#9fed78",
|
|
1840
|
-
"green400": "#7fe74b",
|
|
1841
|
-
"green500": "#59d01e",
|
|
1842
|
-
"green600": "#49b811",
|
|
1843
|
-
"green700": "#409f11",
|
|
1844
|
-
"green800": "#398712",
|
|
1845
|
-
"green900": "#317310",
|
|
1846
|
-
"jiqing50": "#e8fcfc",
|
|
1847
|
-
"jiqing100": "#d1fafa",
|
|
1848
|
-
"jiqing200": "#a3f5f5",
|
|
1849
|
-
"jiqing300": "#76efef",
|
|
1850
|
-
"jiqing400": "#2aeaea",
|
|
1851
|
-
"jiqing500": "#1cd8d8",
|
|
1852
|
-
"jiqing600": "#00bbbb",
|
|
1853
|
-
"jiqing700": "#009e9e",
|
|
1854
|
-
"jiqing800": "#008a8a",
|
|
1855
|
-
"jiqing900": "#007676",
|
|
1856
|
-
"blue50": "#e5f3ff",
|
|
1857
|
-
"blue100": "#cce6ff",
|
|
1858
|
-
"blue200": "#99ceff",
|
|
1859
|
-
"blue300": "#66b5ff",
|
|
1860
|
-
"blue400": "#339cff",
|
|
1861
|
-
"blue500": "#188fff",
|
|
1862
|
-
"blue600": "#0081fa",
|
|
1863
|
-
"blue700": "#0072de",
|
|
1864
|
-
"blue800": "#0063c0",
|
|
1865
|
-
"blue900": "#0053a0",
|
|
1866
|
-
"hyacinth50": "#e8ecfd",
|
|
1867
|
-
"hyacinth100": "#d0d9fb",
|
|
1868
|
-
"hyacinth200": "#a2b3f6",
|
|
1869
|
-
"hyacinth300": "#738df2",
|
|
1870
|
-
"hyacinth400": "#4567ed",
|
|
1871
|
-
"hyacinth500": "#2f55eb",
|
|
1872
|
-
"hyacinth600": "#133de3",
|
|
1873
|
-
"hyacinth700": "#012bd2",
|
|
1874
|
-
"hyacinth800": "#0025b7",
|
|
1875
|
-
"hyacinth900": "#001f9c",
|
|
1876
|
-
"purple50": "#f1eafa",
|
|
1877
|
-
"purple100": "#e3d5f6",
|
|
1878
|
-
"purple200": "#c7abed",
|
|
1879
|
-
"purple300": "#aa82e3",
|
|
1880
|
-
"purple400": "#9e6de3",
|
|
1881
|
-
"purple500": "#894ede",
|
|
1882
|
-
"purple600": "#7735d4",
|
|
1883
|
-
"purple700": "#6721cb",
|
|
1884
|
-
"purple800": "#510eb0",
|
|
1885
|
-
"purple900": "#3f0198",
|
|
1886
|
-
"magenta50": "#fde8f3",
|
|
1887
|
-
"magenta100": "#fbd0e8",
|
|
1888
|
-
"magenta200": "#f6a2d0",
|
|
1889
|
-
"magenta300": "#f273b9",
|
|
1890
|
-
"magenta400": "#f248a6",
|
|
1891
|
-
"magenta500": "#e7258f",
|
|
1892
|
-
"magenta600": "#d4157e",
|
|
1893
|
-
"magenta700": "#c1026b",
|
|
1894
|
-
"magenta800": "#a1095c",
|
|
1895
|
-
"magenta900": "#8f0550",
|
|
1896
|
-
"grey50": "#f9f9f9",
|
|
1897
|
-
"grey100": "#f5f5f5",
|
|
1898
|
-
"grey200": "#e5e5e5",
|
|
1899
|
-
"grey300": "#e8e8e8",
|
|
1900
|
-
"grey400": "#cccccc",
|
|
1901
|
-
"grey500": "#b2b2b2",
|
|
1902
|
-
"grey600": "#999999",
|
|
1903
|
-
"grey700": "#8b8b8b",
|
|
1904
|
-
"grey800": "#7d7d7d",
|
|
1905
|
-
"grey900": "#6f6f6f",
|
|
1906
|
-
"grey950": "#606060",
|
|
1907
|
-
"grey1000": "#505050",
|
|
1908
|
-
"colorBlack": "#35322b",
|
|
1909
|
-
"colorWhite": "#ffffff",
|
|
1910
|
-
"boxShadowBase": "0 4px 12px rgba(53, 50, 43, 0.08)",
|
|
1911
|
-
"boxShadowLg": "0 4px 24px 0 rgba(53, 50, 43, 0.08)",
|
|
1912
|
-
"bgColor": "#f5f5f5",
|
|
1913
|
-
"bgColorHover": "#e8e8e8",
|
|
1914
|
-
"bgColorSecondary": "#ffffff",
|
|
1915
|
-
"textColor": "#35322b",
|
|
1916
|
-
"textColorSecondary": "#999999",
|
|
1917
|
-
"textColorTertiary": "#e5e5e5",
|
|
1918
|
-
"borderColor": "#e5e5e5",
|
|
1919
|
-
"scrollbarColor": "#cccccc",
|
|
1920
|
-
"scrollbarColorHover": "#b2b2b2",
|
|
1921
|
-
"scrollbarColorActive": "#999999",
|
|
1922
|
-
"borderRadiusBase": "4px",
|
|
1923
|
-
"borderRadiusLg": "8px",
|
|
1924
|
-
"borderRadiusXl": "12px",
|
|
1925
|
-
"marginXl": "24px",
|
|
1926
|
-
"marginLg": "20px",
|
|
1927
|
-
"marginBase": "16px",
|
|
1928
|
-
"marginSm": "12px",
|
|
1929
|
-
"marginXs": "8px",
|
|
1930
|
-
"marginXxs": "4px",
|
|
1931
|
-
"paddingXl": "20px",
|
|
1932
|
-
"paddingLg": "16px",
|
|
1933
|
-
"paddingBase": "12px",
|
|
1934
|
-
"paddingSm": "8px",
|
|
1935
|
-
"paddingXs": "4px",
|
|
1936
|
-
"fontSizeXxl": "20px",
|
|
1937
|
-
"fontSizeXl": "18px",
|
|
1938
|
-
"fontSizeLg": "16px",
|
|
1939
|
-
"fontSizeBase": "15px",
|
|
1940
|
-
"fontSizeSm": "14px",
|
|
1941
|
-
"fontSizeXs": "13px",
|
|
1942
|
-
"fontSizeXxs": "12px",
|
|
1943
|
-
"breakpointXs": "768px",
|
|
1944
|
-
"breakpointSm": "1024px",
|
|
1945
|
-
"breakpointBase": "1280px",
|
|
1946
|
-
"breakpointLg": "1536px",
|
|
1947
|
-
"infoColor": "#339cff",
|
|
1948
|
-
"successColor": "#59d01e",
|
|
1949
|
-
"warningColor": "#ffbd37",
|
|
1950
|
-
"errorColor": "#fe4b4b",
|
|
1951
|
-
"primaryColor": "#409f11",
|
|
1952
|
-
"primaryColorHover": "#49b811",
|
|
1953
|
-
"linkColor": "#188fff",
|
|
1954
|
-
"loopColor1": "#9e6de3",
|
|
1955
|
-
"loopColor2": "#49b811",
|
|
1956
|
-
"loopColor3": "#188fff",
|
|
1957
|
-
"loopColor4": "#ffbd37",
|
|
1958
|
-
"loopColor5": "#f273b9",
|
|
1959
|
-
"loopColor6": "#00bbbb",
|
|
1960
|
-
"loopColor7": "#ff8c51",
|
|
1961
|
-
"loopColor8": "#7d7d7d",
|
|
1962
|
-
"loopColor9": "#2f55eb",
|
|
1963
|
-
"loopColor10": "#fa7979",
|
|
1964
|
-
"loopColor11": "#8bbb11",
|
|
1965
|
-
"loopColor12": "#d8b300"
|
|
1966
|
-
};
|
|
1967
|
-
// stylePlugin:/Users/jikkaixiao/dev/univer/packages/design/src/themes/theme-root.module.less
|
|
1968
|
-
var theme_root_module_default = {
|
|
1969
|
-
"theme": "univer-theme"
|
|
1970
|
-
};
|
|
1971
|
-
// src/themes/theme.ts
|
|
1972
|
-
function convertToDashCase(input) {
|
|
1973
|
-
var dashCase = input.replace(/([A-Z])/g, function(match) {
|
|
1974
|
-
return "-".concat(match.toLowerCase());
|
|
1975
|
-
}).replace(/(\d+)/g, "-$1");
|
|
1976
|
-
return "--".concat(dashCase);
|
|
1977
|
-
}
|
|
1978
|
-
function convertHexToRgb(input) {
|
|
1979
|
-
if (input.startsWith("#")) {
|
|
1980
|
-
var hex = input.replace("#", "");
|
|
1981
|
-
var r = parseInt(hex.substring(0, 2), 16);
|
|
1982
|
-
var g = parseInt(hex.substring(2, 4), 16);
|
|
1983
|
-
var b = parseInt(hex.substring(4, 6), 16);
|
|
1984
|
-
return "".concat(r, ", ").concat(g, ", ").concat(b);
|
|
1985
|
-
}
|
|
1986
|
-
return input;
|
|
1987
|
-
}
|
|
1988
|
-
var Theme = /*#__PURE__*/ function() {
|
|
1989
|
-
"use strict";
|
|
1990
|
-
function Theme() {
|
|
1991
|
-
_class_call_check(this, Theme);
|
|
1992
|
-
_define_property(this, "_styleSheet", null);
|
|
1993
|
-
_define_property(this, "_themeRootName", theme_root_module_default.theme);
|
|
1994
|
-
var $style = document.createElement("style");
|
|
1995
|
-
$style.id = this._themeRootName;
|
|
1996
|
-
document.head.appendChild($style);
|
|
1997
|
-
this._styleSheet = $style;
|
|
1998
|
-
}
|
|
1999
|
-
_create_class(Theme, [
|
|
2000
|
-
{
|
|
2001
|
-
key: "setTheme",
|
|
2002
|
-
value: function setTheme(root, theme) {
|
|
2003
|
-
if (!this._styleSheet) return;
|
|
2004
|
-
root.classList.remove(this._themeRootName);
|
|
2005
|
-
root.classList.add(this._themeRootName);
|
|
2006
|
-
this._styleSheet.innerHTML = "";
|
|
2007
|
-
this._styleSheet.innerHTML = ".".concat(this._themeRootName, " {").concat(Object.keys(theme).map(function(key) {
|
|
2008
|
-
return "".concat(convertToDashCase(key), ": ").concat(convertHexToRgb(theme[key]), ";");
|
|
2009
|
-
}).join(""), "}");
|
|
2010
|
-
}
|
|
2011
|
-
}
|
|
2012
|
-
]);
|
|
2013
|
-
return Theme;
|
|
2014
|
-
}();
|
|
2015
|
-
var themeInstance = new Theme();
|
|
2016
|
-
export { Avatar, Button, CascaderList, Checkbox, CheckboxGroup, ColorPicker, ConfigContext, ConfigProvider, Confirm, Container, Dialog, Dropdown, Input, InputNumber, Menu, MenuItem, MenuItemGroup, Message, MessageType, Popup, Radio, RadioGroup, Scrollbar, Select, SelectList, Slider, SubMenu, Tooltip, default_module_default as defaultTheme, green_module_default as greenTheme, themeInstance };
|