@kep-platform/basic-component 1.0.12 → 1.0.14

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.
@@ -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" | "primary" | "danger" | undefined;
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 | keyof React.HtmlHTMLAttributes<HTMLDivElement>> & import("../Flex").FlexItemProps & React.HtmlHTMLAttributes<HTMLDivElement>, "ref"> & {
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 = {
@@ -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"])));
@@ -5,7 +5,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
5
5
  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
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
7
  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';
8
+ import { action, computed, makeObservable, observable, runInAction } from 'mobx';
9
9
  var WindowStore = /*#__PURE__*/function () {
10
10
  function WindowStore(id, onClosedHandler) {
11
11
  _classCallCheck(this, WindowStore);
@@ -101,33 +101,31 @@ var WindowStore = /*#__PURE__*/function () {
101
101
  }, {
102
102
  key: "controll",
103
103
  value: function controll(transform, type) {
104
+ var _this = this;
104
105
  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;
106
+ runInAction(function () {
107
+ _this.isMoving = type === 'move';
108
+ _this.isResizing = type !== 'move';
109
+ if (type.includes('left')) {
110
+ _this.left = Math.round(_this.left + offsetTransform.x);
111
+ _this.width = Math.round(_this.width - offsetTransform.x);
112
+ }
113
+ if (type.includes('right')) {
114
+ _this.width = Math.round(_this.width + offsetTransform.x);
115
+ }
116
+ if (type.includes('top')) {
117
+ _this.top = Math.round(_this.top + offsetTransform.y);
118
+ _this.height = Math.round(_this.height - offsetTransform.y);
119
+ }
120
+ if (type.includes('bottom')) {
121
+ _this.height = Math.round(_this.height + offsetTransform.y);
122
+ }
123
+ if (type.includes('move')) {
124
+ _this.left = Math.round(_this.left + offsetTransform.x);
125
+ _this.top = Math.round(_this.top + offsetTransform.y);
126
+ }
127
+ _this.transform = transform;
128
+ });
131
129
  }
132
130
  }, {
133
131
  key: "endControll",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kep-platform/basic-component",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
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": "7783ce84a532de38c3ecb9d0691425dccf9d7545"
89
+ "gitHead": "23573dedaa4b38b9321050a0f197781c90df88d3"
90
90
  }