@pisell/materials 1.0.351 → 1.0.352
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +2 -2
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +2 -2
- package/es/components/drag-sort-tree/TreeItem/index.js +29 -11
- package/es/components/drag-sort-tree/TreeItem/index.less +9 -2
- package/lib/components/drag-sort-tree/TreeItem/index.js +43 -17
- package/lib/components/drag-sort-tree/TreeItem/index.less +9 -2
- package/lowcode/drag-sort-tree/meta.ts +1 -1
- package/package.json +2 -2
|
@@ -4,18 +4,18 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
|
4
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
6
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
+
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; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
12
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
13
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
14
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
15
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
16
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
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; }
|
|
16
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
17
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
18
|
-
import React, { useMemo } from 'react';
|
|
18
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
19
19
|
import { useSortable } from '@dnd-kit/sortable';
|
|
20
20
|
import { DndContext } from '@dnd-kit/core';
|
|
21
21
|
import { Tooltip } from 'antd';
|
|
@@ -46,6 +46,10 @@ var TreeItem = function TreeItem(props) {
|
|
|
46
46
|
transform = _useSortable.transform,
|
|
47
47
|
transition = _useSortable.transition,
|
|
48
48
|
isDragging = _useSortable.isDragging;
|
|
49
|
+
var _useState = useState(window.innerWidth < 600),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
isMobile = _useState2[0],
|
|
52
|
+
setIsMobile = _useState2[1];
|
|
49
53
|
var style = {
|
|
50
54
|
transform: CSS.Transform.toString(transform && _objectSpread(_objectSpread({}, transform), {}, {
|
|
51
55
|
scaleY: 1
|
|
@@ -167,6 +171,17 @@ var TreeItem = function TreeItem(props) {
|
|
|
167
171
|
}
|
|
168
172
|
}))) : null;
|
|
169
173
|
}, [childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.hiddenWarningIcon, item === null || item === void 0 ? void 0 : item.is_available]);
|
|
174
|
+
var handleWindowResize = function handleWindowResize() {
|
|
175
|
+
// 获取当前窗口的宽度
|
|
176
|
+
var windowWidth = window.innerWidth;
|
|
177
|
+
setIsMobile(windowWidth < 600);
|
|
178
|
+
};
|
|
179
|
+
useEffect(function () {
|
|
180
|
+
window.addEventListener('resize', handleWindowResize);
|
|
181
|
+
return function () {
|
|
182
|
+
window.removeEventListener('resize', handleWindowResize);
|
|
183
|
+
};
|
|
184
|
+
}, []);
|
|
170
185
|
return /*#__PURE__*/React.createElement(DndContext, {
|
|
171
186
|
sensors: sensors,
|
|
172
187
|
modifiers: [restrictToVerticalAxis, restrictToParentElement],
|
|
@@ -174,8 +189,8 @@ var TreeItem = function TreeItem(props) {
|
|
|
174
189
|
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
175
190
|
ref: setNodeRef,
|
|
176
191
|
style: style
|
|
177
|
-
}, attributes, listeners), /*#__PURE__*/React.createElement("div", {
|
|
178
|
-
className: classNames("".concat(prefix, "-drag-sort-tree"), childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.className),
|
|
192
|
+
}, attributes, !isMobile ? listeners : {}), /*#__PURE__*/React.createElement("div", {
|
|
193
|
+
className: classNames("".concat(prefix, "-drag-sort-tree"), childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.className, isMobile ? "".concat(prefix, "-drag-sort-phone-tree") : ''),
|
|
179
194
|
style: {
|
|
180
195
|
paddingLeft: !depth ? '10px' : "".concat(depth * 40, "px"),
|
|
181
196
|
cursor: isDragging ? 'grabbing' : 'grab'
|
|
@@ -183,9 +198,12 @@ var TreeItem = function TreeItem(props) {
|
|
|
183
198
|
onClick: onSelect
|
|
184
199
|
}, /*#__PURE__*/React.createElement("div", {
|
|
185
200
|
className: classNames("".concat(prefix, "-drag-sort-tree-item"))
|
|
186
|
-
}, !(childrenProps !== null && childrenProps !== void 0 && childrenProps.hiddenDraggableIcon) ? /*#__PURE__*/React.createElement(DotsSix, {
|
|
187
|
-
className: classNames("".concat(prefix, "-drag-sort-tree-item-dot-icon"))
|
|
188
|
-
|
|
201
|
+
}, !(childrenProps !== null && childrenProps !== void 0 && childrenProps.hiddenDraggableIcon) ? /*#__PURE__*/React.createElement(DotsSix, _extends({}, isMobile ? listeners : {}, {
|
|
202
|
+
className: classNames("".concat(prefix, "-drag-sort-tree-item-dot-icon")),
|
|
203
|
+
style: {
|
|
204
|
+
left: isMobile ? !depth ? '-14px' : '12px' : 0
|
|
205
|
+
}
|
|
206
|
+
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
189
207
|
className: "".concat(prefix, "-drag-sort-tree-title")
|
|
190
208
|
}, (childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.titleRender) || (item === null || item === void 0 ? void 0 : item.title))), !depth ? rightIcon : warningIcon), renderChildren));
|
|
191
209
|
};
|
|
@@ -64,6 +64,7 @@ var TreeItem = (props) => {
|
|
|
64
64
|
transition,
|
|
65
65
|
isDragging
|
|
66
66
|
} = (0, import_sortable.useSortable)({ id });
|
|
67
|
+
const [isMobile, setIsMobile] = (0, import_react.useState)(window.innerWidth < 600);
|
|
67
68
|
const style = {
|
|
68
69
|
transform: import_utilities.CSS.Transform.toString(transform && { ...transform, scaleY: 1 }),
|
|
69
70
|
transition
|
|
@@ -181,6 +182,16 @@ var TreeItem = (props) => {
|
|
|
181
182
|
/* @__PURE__ */ import_react.default.createElement(import_icons.WarningOutlined, { style: { color: "#FF2020" } })
|
|
182
183
|
)) : null;
|
|
183
184
|
}, [childrenProps == null ? void 0 : childrenProps.hiddenWarningIcon, item == null ? void 0 : item.is_available]);
|
|
185
|
+
const handleWindowResize = () => {
|
|
186
|
+
let windowWidth = window.innerWidth;
|
|
187
|
+
setIsMobile(windowWidth < 600);
|
|
188
|
+
};
|
|
189
|
+
(0, import_react.useEffect)(() => {
|
|
190
|
+
window.addEventListener("resize", handleWindowResize);
|
|
191
|
+
return () => {
|
|
192
|
+
window.removeEventListener("resize", handleWindowResize);
|
|
193
|
+
};
|
|
194
|
+
}, []);
|
|
184
195
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
185
196
|
import_core.DndContext,
|
|
186
197
|
{
|
|
@@ -188,27 +199,42 @@ var TreeItem = (props) => {
|
|
|
188
199
|
modifiers: [import_modifiers.restrictToVerticalAxis, import_modifiers.restrictToParentElement],
|
|
189
200
|
onDragEnd: handleDragEnd
|
|
190
201
|
},
|
|
191
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
202
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
192
203
|
"div",
|
|
193
204
|
{
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
style: {
|
|
199
|
-
paddingLeft: !depth ? "10px" : `${depth * 40}px`,
|
|
200
|
-
cursor: isDragging ? "grabbing" : "grab"
|
|
201
|
-
},
|
|
202
|
-
onClick: onSelect
|
|
205
|
+
ref: setNodeRef,
|
|
206
|
+
style,
|
|
207
|
+
...attributes,
|
|
208
|
+
...!isMobile ? listeners : {}
|
|
203
209
|
},
|
|
204
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
205
|
-
|
|
210
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
211
|
+
"div",
|
|
206
212
|
{
|
|
207
|
-
className: (0, import_classnames.default)(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
213
|
+
className: (0, import_classnames.default)(
|
|
214
|
+
`${prefix}-drag-sort-tree`,
|
|
215
|
+
childrenProps == null ? void 0 : childrenProps.className,
|
|
216
|
+
isMobile ? `${prefix}-drag-sort-phone-tree` : ""
|
|
217
|
+
),
|
|
218
|
+
style: {
|
|
219
|
+
paddingLeft: !depth ? "10px" : `${depth * 40}px`,
|
|
220
|
+
cursor: isDragging ? "grabbing" : "grab"
|
|
221
|
+
},
|
|
222
|
+
onClick: onSelect
|
|
223
|
+
},
|
|
224
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(`${prefix}-drag-sort-tree-item`) }, !(childrenProps == null ? void 0 : childrenProps.hiddenDraggableIcon) ? /* @__PURE__ */ import_react.default.createElement(
|
|
225
|
+
import_DotsSix.default,
|
|
226
|
+
{
|
|
227
|
+
...isMobile ? listeners : {},
|
|
228
|
+
className: (0, import_classnames.default)(`${prefix}-drag-sort-tree-item-dot-icon`),
|
|
229
|
+
style: {
|
|
230
|
+
left: isMobile ? !depth ? "-14px" : "12px" : 0
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}-drag-sort-tree-title` }, (childrenProps == null ? void 0 : childrenProps.titleRender) || (item == null ? void 0 : item.title))),
|
|
234
|
+
!depth ? rightIcon : warningIcon
|
|
235
|
+
),
|
|
236
|
+
renderChildren
|
|
237
|
+
)
|
|
212
238
|
);
|
|
213
239
|
};
|
|
214
240
|
var TreeItem_default = TreeItem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/materials",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.352",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"crypto-js": "^4.2.0",
|
|
65
65
|
"@pisell/utils": "1.0.27",
|
|
66
66
|
"@pisell/icon": "0.0.10",
|
|
67
|
-
"@pisell/date-picker": "1.0.
|
|
67
|
+
"@pisell/date-picker": "1.0.86"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"react": "^18.0.0",
|