@kep-platform/basic-component 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Button/Button.d.ts
CHANGED
@@ -6,7 +6,7 @@ export type ButtonProps = {
|
|
6
6
|
children: ReactNode;
|
7
7
|
} & HtmlHTMLAttributes<HTMLButtonElement>;
|
8
8
|
declare const Button: React.ForwardRefExoticComponent<{
|
9
|
-
type?: "default" | "
|
9
|
+
type?: "default" | "danger" | "primary" | undefined;
|
10
10
|
size?: SizeType | undefined;
|
11
11
|
children: ReactNode;
|
12
12
|
} & React.HtmlHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { ReactNode } from 'react';
|
2
|
-
export declare const MainArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("../Flex").FlexItemProps
|
2
|
+
export declare const MainArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HtmlHTMLAttributes<HTMLDivElement> | keyof import("../Flex").FlexItemProps> & import("../Flex").FlexItemProps & React.HtmlHTMLAttributes<HTMLDivElement>, "ref"> & {
|
3
3
|
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
4
4
|
}, never>> & string;
|
5
5
|
type MainPropertyProps = {
|
package/dist/Window/Window.js
CHANGED
@@ -21,7 +21,7 @@ var WindowHeader = styled.div.withConfig({
|
|
21
21
|
shouldForwardProp: function shouldForwardProp(prop) {
|
22
22
|
return !['isDragging'].includes(prop);
|
23
23
|
}
|
24
|
-
})(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\theight: 40px;\n\tpadding: 6px 12px;\n\tline-height: 26px;\n\tfont-size: 16px;\n\tbackground-color: var(--kep-platform-color-bg-layout-header);\n\ttransition: margin 0.35s, opacity 0.7s, box-shadow 0.7s;\n\tposition: relative;\n\tcolor: #000;\n\
|
24
|
+
})(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\theight: 40px;\n\tpadding: 6px 12px;\n\tline-height: 26px;\n\tfont-size: 16px;\n\tbackground-color: var(--kep-platform-color-bg-layout-header);\n\ttransition: margin 0.35s, opacity 0.7s, box-shadow 0.7s;\n\tposition: relative;\n\tcolor: #000;\n\t& > h5 {\n\t\tcolor: #000;\n\t}\n"])));
|
25
25
|
var WindowHeaderOptions = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n\theight: 100%;\n\tdisplay: flex;\n\tz-index: 3;\n"])));
|
26
26
|
var WindowBody = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n\toverflow: auto;\n\tpadding: 12px;\n\tflex: 1;\n"])));
|
27
27
|
var WindowControllerLeft = styled(WindowController)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n\tposition: absolute;\n\twidth: 6px;\n\tleft: 0;\n\ttop: 0;\n\tbottom: 0;\n\tcursor: e-resize;\n\tz-index: 2;\n"])));
|
@@ -30,6 +30,8 @@ export default class WindowStore {
|
|
30
30
|
isMinimize: boolean;
|
31
31
|
isClosed: boolean;
|
32
32
|
onClosedHandler: ((id: string) => void) | undefined;
|
33
|
+
private cachedStyle?;
|
34
|
+
private lastStatus?;
|
33
35
|
constructor(id: string, onClosedHandler?: (id: string) => void);
|
34
36
|
fullscreenWindow(func?: () => void): void;
|
35
37
|
fullscreenExitWindow(): void;
|
@@ -1,11 +1,13 @@
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
2
4
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
5
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
4
6
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
5
7
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
7
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
8
|
-
import { action, computed, makeObservable, observable } from 'mobx';
|
10
|
+
import { action, computed, makeObservable, observable, runInAction } from 'mobx';
|
9
11
|
var WindowStore = /*#__PURE__*/function () {
|
10
12
|
function WindowStore(id, onClosedHandler) {
|
11
13
|
_classCallCheck(this, WindowStore);
|
@@ -33,6 +35,8 @@ var WindowStore = /*#__PURE__*/function () {
|
|
33
35
|
_defineProperty(this, "isMinimize", false);
|
34
36
|
_defineProperty(this, "isClosed", false);
|
35
37
|
_defineProperty(this, "onClosedHandler", void 0);
|
38
|
+
_defineProperty(this, "cachedStyle", void 0);
|
39
|
+
_defineProperty(this, "lastStatus", void 0);
|
36
40
|
makeObservable(this, {
|
37
41
|
width: observable,
|
38
42
|
height: observable,
|
@@ -101,33 +105,31 @@ var WindowStore = /*#__PURE__*/function () {
|
|
101
105
|
}, {
|
102
106
|
key: "controll",
|
103
107
|
value: function controll(transform, type) {
|
108
|
+
var _this = this;
|
104
109
|
var offsetTransform = this.calculateTransform(transform);
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
this.top = Math.round(this.top + offsetTransform.y);
|
129
|
-
}
|
130
|
-
this.transform = transform;
|
110
|
+
runInAction(function () {
|
111
|
+
_this.isMoving = type === 'move';
|
112
|
+
_this.isResizing = type !== 'move';
|
113
|
+
if (type.includes('left')) {
|
114
|
+
_this.left = Math.round(_this.left + offsetTransform.x);
|
115
|
+
_this.width = Math.round(_this.width - offsetTransform.x);
|
116
|
+
}
|
117
|
+
if (type.includes('right')) {
|
118
|
+
_this.width = Math.round(_this.width + offsetTransform.x);
|
119
|
+
}
|
120
|
+
if (type.includes('top')) {
|
121
|
+
_this.top = Math.round(_this.top + offsetTransform.y);
|
122
|
+
_this.height = Math.round(_this.height - offsetTransform.y);
|
123
|
+
}
|
124
|
+
if (type.includes('bottom')) {
|
125
|
+
_this.height = Math.round(_this.height + offsetTransform.y);
|
126
|
+
}
|
127
|
+
if (type.includes('move')) {
|
128
|
+
_this.left = Math.round(_this.left + offsetTransform.x);
|
129
|
+
_this.top = Math.round(_this.top + offsetTransform.y);
|
130
|
+
}
|
131
|
+
_this.transform = transform;
|
132
|
+
});
|
131
133
|
}
|
132
134
|
}, {
|
133
135
|
key: "endControll",
|
@@ -185,9 +187,14 @@ var WindowStore = /*#__PURE__*/function () {
|
|
185
187
|
}, {
|
186
188
|
key: "style",
|
187
189
|
get: function get() {
|
190
|
+
var currentStatus = this.status;
|
191
|
+
if (this.cachedStyle && this.lastStatus === currentStatus) {
|
192
|
+
return this.cachedStyle;
|
193
|
+
}
|
194
|
+
var newStyle;
|
188
195
|
switch (this.status) {
|
189
196
|
case 'closed':
|
190
|
-
|
197
|
+
newStyle = {
|
191
198
|
left: this.left + 'px',
|
192
199
|
top: this.top + 'px',
|
193
200
|
width: this.width + 'px',
|
@@ -198,7 +205,7 @@ var WindowStore = /*#__PURE__*/function () {
|
|
198
205
|
transition: 'all 0.3s ease-in-out'
|
199
206
|
};
|
200
207
|
case 'minimize':
|
201
|
-
|
208
|
+
newStyle = {
|
202
209
|
left: this.minimizePos.left + 'px',
|
203
210
|
top: this.minimizePos.top + 'px',
|
204
211
|
width: this.width + 'px',
|
@@ -209,7 +216,7 @@ var WindowStore = /*#__PURE__*/function () {
|
|
209
216
|
transition: 'all 0.3s ease-in-out'
|
210
217
|
};
|
211
218
|
case 'fullscreen':
|
212
|
-
|
219
|
+
newStyle = {
|
213
220
|
left: this.fullscreenPos.left + 'px',
|
214
221
|
top: this.fullscreenPos.top + 'px',
|
215
222
|
width: this.fullscreenPos.width + 'px',
|
@@ -221,7 +228,7 @@ var WindowStore = /*#__PURE__*/function () {
|
|
221
228
|
case 'normal':
|
222
229
|
default:
|
223
230
|
if (this.isMoving || this.isResizing) {
|
224
|
-
|
231
|
+
newStyle = {
|
225
232
|
left: this.left + 'px',
|
226
233
|
top: this.top + 'px',
|
227
234
|
width: this.width + 'px',
|
@@ -231,7 +238,7 @@ var WindowStore = /*#__PURE__*/function () {
|
|
231
238
|
transition: 'none'
|
232
239
|
};
|
233
240
|
} else {
|
234
|
-
|
241
|
+
newStyle = {
|
235
242
|
left: this.left + 'px',
|
236
243
|
top: this.top + 'px',
|
237
244
|
width: this.width + 'px',
|
@@ -242,6 +249,11 @@ var WindowStore = /*#__PURE__*/function () {
|
|
242
249
|
};
|
243
250
|
}
|
244
251
|
}
|
252
|
+
this.cachedStyle = _objectSpread(_objectSpread({}, newStyle), {}, {
|
253
|
+
willChange: 'transform, left, top, width, height'
|
254
|
+
});
|
255
|
+
this.lastStatus = currentStatus;
|
256
|
+
return this.cachedStyle;
|
245
257
|
}
|
246
258
|
}, {
|
247
259
|
key: "info",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@kep-platform/basic-component",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.13",
|
4
4
|
"description": "A react library developed with dumi",
|
5
5
|
"license": "MIT",
|
6
6
|
"module": "dist/index.js",
|
@@ -86,5 +86,5 @@
|
|
86
86
|
"authors": [
|
87
87
|
"less-step-jss 1599925910@qq.com"
|
88
88
|
],
|
89
|
-
"gitHead": "
|
89
|
+
"gitHead": "cb302cb7c03530680e81816d3b178f98f4f0b299"
|
90
90
|
}
|