@kep-platform/basic-component 1.0.11 → 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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) lee-step-jss 1599925910@qq.com
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) lee-step-jss 1599925910@qq.com
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,43 +1,43 @@
1
- # @kep-platform/basic-component
2
-
3
- [![NPM version](https://img.shields.io/npm/v/@kep-platform/basic-component.svg?style=flat)](https://npmjs.org/package/@kep-platform/basic-component)
4
- [![NPM downloads](http://img.shields.io/npm/dm/@kep-platform/basic-component.svg?style=flat)](https://npmjs.org/package/@kep-platform/basic-component)
5
-
6
- A react library developed with dumi
7
-
8
- ## Usage
9
-
10
- TODO
11
-
12
- ## Options
13
-
14
- TODO
15
-
16
- ## Development
17
-
18
- ```bash
19
- # install dependencies
20
- $ npm install
21
-
22
- # develop library by docs demo
23
- $ npm start
24
-
25
- # build library source code
26
- $ npm run build
27
-
28
- # build library source code in watch mode
29
- $ npm run build:watch
30
-
31
- # build docs
32
- $ npm run docs:build
33
-
34
- # Locally preview the production build.
35
- $ npm run docs:preview
36
-
37
- # check your project for potential problems
38
- $ npm run doctor
39
- ```
40
-
41
- ## LICENSE
42
-
43
- MIT
1
+ # @kep-platform/basic-component
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/@kep-platform/basic-component.svg?style=flat)](https://npmjs.org/package/@kep-platform/basic-component)
4
+ [![NPM downloads](http://img.shields.io/npm/dm/@kep-platform/basic-component.svg?style=flat)](https://npmjs.org/package/@kep-platform/basic-component)
5
+
6
+ A react library developed with dumi
7
+
8
+ ## Usage
9
+
10
+ TODO
11
+
12
+ ## Options
13
+
14
+ TODO
15
+
16
+ ## Development
17
+
18
+ ```bash
19
+ # install dependencies
20
+ $ npm install
21
+
22
+ # develop library by docs demo
23
+ $ npm start
24
+
25
+ # build library source code
26
+ $ npm run build
27
+
28
+ # build library source code in watch mode
29
+ $ npm run build:watch
30
+
31
+ # build docs
32
+ $ npm run docs:build
33
+
34
+ # Locally preview the production build.
35
+ $ npm run docs:preview
36
+
37
+ # check your project for potential problems
38
+ $ npm run doctor
39
+ ```
40
+
41
+ ## LICENSE
42
+
43
+ MIT
@@ -1,9 +1,9 @@
1
- // styled.d.ts 文件
2
- import 'styled-components';
3
- import { ButtonTheme } from './theme';
4
-
5
- declare module 'styled-components' {
6
- export interface DefaultTheme {
7
- button?: ButtonTheme;
8
- }
9
- }
1
+ // styled.d.ts 文件
2
+ import 'styled-components';
3
+ import { ButtonTheme } from './theme';
4
+
5
+ declare module 'styled-components' {
6
+ export interface DefaultTheme {
7
+ button?: ButtonTheme;
8
+ }
9
+ }
@@ -1,38 +1,38 @@
1
- export type ButtonTheme = {
2
- /* all */
3
- fontWeight?: string;
4
- borderRadius?: string;
5
- borderWidth?: string;
6
- shadowAnimation?: Keyframes;
7
- /* Default */
8
- defaultTextColor?: string;
9
- defaultBorderColor?: string;
10
- defaultBackgroundColor?: string;
11
- defaultHoverBackgroundColor?: string;
12
- defaultHoverBorderColor: string;
13
- defaultHoverTextColor?: string;
14
- /* Danger */
15
- dangerTextColor?: string;
16
- dangerBorderColor?: string;
17
- dangerBackgroundColor?: string;
18
- dangerHoverBackgroundColor: string;
19
- dangerHoverTextColor?: string;
20
- dangerShadowAnimation?: Keyframes;
21
- /* Primary */
22
- primaryTextColor?: string;
23
- primaryBorderColor?: string;
24
- primaryBackgroundColor?: string;
25
- primaryHoverBackgroundColor: string;
26
- primaryHoverTextColor?: string;
27
- primaryShadowAnimation?: Keyframes;
28
- /* Small */
29
- smallPaddingTop?: string;
30
- smallPaddingLeft?: string;
31
- smallFontSize?: string;
32
- smallBorderRadius?: string;
33
- /* Large */
34
- bargePaddingTop?: string;
35
- bargePaddingLeft?: string;
36
- bargeFontSize?: string;
37
- bargeBorderRadius?: string;
38
- };
1
+ export type ButtonTheme = {
2
+ /* all */
3
+ fontWeight?: string;
4
+ borderRadius?: string;
5
+ borderWidth?: string;
6
+ shadowAnimation?: Keyframes;
7
+ /* Default */
8
+ defaultTextColor?: string;
9
+ defaultBorderColor?: string;
10
+ defaultBackgroundColor?: string;
11
+ defaultHoverBackgroundColor?: string;
12
+ defaultHoverBorderColor: string;
13
+ defaultHoverTextColor?: string;
14
+ /* Danger */
15
+ dangerTextColor?: string;
16
+ dangerBorderColor?: string;
17
+ dangerBackgroundColor?: string;
18
+ dangerHoverBackgroundColor: string;
19
+ dangerHoverTextColor?: string;
20
+ dangerShadowAnimation?: Keyframes;
21
+ /* Primary */
22
+ primaryTextColor?: string;
23
+ primaryBorderColor?: string;
24
+ primaryBackgroundColor?: string;
25
+ primaryHoverBackgroundColor: string;
26
+ primaryHoverTextColor?: string;
27
+ primaryShadowAnimation?: Keyframes;
28
+ /* Small */
29
+ smallPaddingTop?: string;
30
+ smallPaddingLeft?: string;
31
+ smallFontSize?: string;
32
+ smallBorderRadius?: string;
33
+ /* Large */
34
+ bargePaddingTop?: string;
35
+ bargePaddingLeft?: string;
36
+ bargeFontSize?: string;
37
+ bargeBorderRadius?: string;
38
+ };
@@ -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\tcursor: move;\n\t& > h5 {\n\t\tcolor: #000;\n\t}\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
- if (type === 'move') {
106
- this.isMoving = true;
107
- this.isResizing = false;
108
- } else {
109
- this.isMoving = false;
110
- this.isResizing = true;
111
- }
112
- if (type.includes('left')) {
113
- this.left = Math.round(this.left + offsetTransform.x);
114
- this.width = Math.round(this.width - offsetTransform.x);
115
- }
116
- if (type.includes('right')) {
117
- this.width = Math.round(this.width + offsetTransform.x);
118
- }
119
- if (type.includes('top')) {
120
- this.top = Math.round(this.top + offsetTransform.y);
121
- this.height = Math.round(this.height - offsetTransform.y);
122
- }
123
- if (type.includes('bottom')) {
124
- this.height = Math.round(this.height + offsetTransform.y);
125
- }
126
- if (type.includes('move')) {
127
- this.left = Math.round(this.left + offsetTransform.x);
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
- return {
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
- return {
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
- return {
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
- return {
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
- return {
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.11",
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": "24bd8f4141e73bce455a993625a05cb91b10fc25"
89
+ "gitHead": "cb302cb7c03530680e81816d3b178f98f4f0b299"
90
90
  }