@pisell/materials 3.0.7 → 3.0.8
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/preview.js +7 -7
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +17 -17
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +20 -20
- package/es/components/Pagination/index.js +4 -4
- package/es/components/drawer/index.js +64 -6
- package/es/components/drawer/index.less +3 -0
- package/es/components/filter/index.js +2 -3
- package/es/components/filter/types.d.ts +1 -0
- package/es/components/table/Actions/index.js +4 -3
- package/es/components/table/Table/utils.d.ts +1 -1
- package/es/components/table/hooks/useIsMobileTable.d.ts +2 -0
- package/es/components/table/hooks/useIsMobileTable.js +9 -0
- package/es/components/table/index.js +11 -0
- package/es/components/table/model.d.ts +1 -0
- package/es/components/table/model.js +7 -1
- package/lib/components/Pagination/index.js +4 -4
- package/lib/components/drawer/index.js +66 -5
- package/lib/components/drawer/index.less +3 -0
- package/lib/components/filter/index.js +1 -3
- package/lib/components/filter/types.d.ts +1 -0
- package/lib/components/table/Actions/index.js +4 -3
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/lib/components/table/hooks/useIsMobileTable.d.ts +2 -0
- package/lib/components/table/hooks/useIsMobileTable.js +32 -0
- package/lib/components/table/index.js +10 -0
- package/lib/components/table/model.d.ts +1 -0
- package/lib/components/table/model.js +5 -1
- package/lowcode/drawer/meta.ts +19 -0
- package/package.json +3 -3
|
@@ -14,9 +14,9 @@ import ArrowRight from "@pisell/icon/es/ArrowRight";
|
|
|
14
14
|
import ArrowLeft from "@pisell/icon/es/ArrowLeft";
|
|
15
15
|
import { Pagination as OriginPagination } from "antd";
|
|
16
16
|
import classNames from "classnames";
|
|
17
|
-
import { useResponsive } from "../../hooks";
|
|
18
17
|
import "./index.less";
|
|
19
18
|
import { getText } from "../../locales";
|
|
19
|
+
import useIsMobileTable from "../table/hooks/useIsMobileTable";
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @title: 自定义渲染
|
|
@@ -59,21 +59,21 @@ export var paginationConfig = {
|
|
|
59
59
|
size: "small"
|
|
60
60
|
};
|
|
61
61
|
var Pagination = function Pagination(props) {
|
|
62
|
-
var responsive = useResponsive();
|
|
63
62
|
var show = useMemo(function () {
|
|
64
63
|
return Object.keys(props).length;
|
|
65
64
|
}, [props]);
|
|
65
|
+
var isMiniPagination = useIsMobileTable();
|
|
66
66
|
var content = useMemo(function () {
|
|
67
67
|
if (!show) {
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
70
|
var Com = OriginPagination;
|
|
71
71
|
// 移动端使用简单分页
|
|
72
|
-
if (
|
|
72
|
+
if (isMiniPagination) {
|
|
73
73
|
Com = MiniPagination;
|
|
74
74
|
}
|
|
75
75
|
return /*#__PURE__*/React.createElement(Com, _extends({}, paginationConfig, props));
|
|
76
|
-
}, [show, paginationConfig, props,
|
|
76
|
+
}, [show, paginationConfig, props, isMiniPagination]);
|
|
77
77
|
return content;
|
|
78
78
|
};
|
|
79
79
|
export default Pagination;
|
|
@@ -1,21 +1,43 @@
|
|
|
1
1
|
var _excluded = ["others"];
|
|
2
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
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."); }
|
|
6
|
+
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); }
|
|
7
|
+
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; }
|
|
8
|
+
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; } }
|
|
9
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
3
10
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
11
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
-
|
|
12
|
+
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; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
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); }
|
|
15
|
+
import React, { useLayoutEffect, useMemo } from "react";
|
|
6
16
|
import { Drawer as OriginalDrawer } from "antd";
|
|
17
|
+
import { useControllableValue, useUpdateEffect } from "ahooks";
|
|
18
|
+
import classNames from "classnames";
|
|
19
|
+
import { isBoolean, isUndefined } from "@pisell/utils";
|
|
7
20
|
import XClose from "@pisell/icon/es/XClose";
|
|
21
|
+
import Pin02 from "@pisell/icon/es/Pin02";
|
|
8
22
|
import "./index.less";
|
|
9
23
|
var prefix = "pisell-lowcode-";
|
|
10
24
|
var Title = function Title(props) {
|
|
11
25
|
var placement = props.placement,
|
|
12
|
-
onClose = props.onClose
|
|
26
|
+
onClose = props.onClose,
|
|
27
|
+
showPin = props.showPin,
|
|
28
|
+
persistentState = props.persistentState,
|
|
29
|
+
setPersistentState = props.setPersistentState;
|
|
13
30
|
return /*#__PURE__*/React.createElement("div", {
|
|
14
31
|
className: "".concat(prefix, "drawer-outside-wrap ").concat(prefix, "drawer-outside-wrap-").concat(placement)
|
|
15
32
|
}, /*#__PURE__*/React.createElement("div", {
|
|
16
33
|
className: "".concat(prefix, "drawer-outside-action-wrap"),
|
|
17
34
|
onClick: onClose
|
|
18
|
-
}, /*#__PURE__*/React.createElement(XClose, null))
|
|
35
|
+
}, /*#__PURE__*/React.createElement(XClose, null)), showPin && /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: classNames("".concat(prefix, "drawer-outside-action-wrap"), _defineProperty({}, "".concat(prefix, "drawer-outside-action-active"), persistentState)),
|
|
37
|
+
onClick: function onClick() {
|
|
38
|
+
return setPersistentState(!persistentState);
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Pin02, null)));
|
|
19
41
|
};
|
|
20
42
|
var Drawer = function Drawer(props) {
|
|
21
43
|
var others = props.others,
|
|
@@ -23,12 +45,45 @@ var Drawer = function Drawer(props) {
|
|
|
23
45
|
var operateMode = props.operateMode,
|
|
24
46
|
headerStyle = props.headerStyle,
|
|
25
47
|
placement = props.placement,
|
|
26
|
-
onClose = props.onClose
|
|
48
|
+
onClose = props.onClose,
|
|
49
|
+
showPin = props.showPin,
|
|
50
|
+
width = props.width,
|
|
51
|
+
getContainer = props.getContainer,
|
|
52
|
+
open = props.open;
|
|
53
|
+
var _useControllableValue = useControllableValue(props, {
|
|
54
|
+
trigger: "onPersistentChange",
|
|
55
|
+
valuePropName: "persistent"
|
|
56
|
+
}),
|
|
57
|
+
_useControllableValue2 = _slicedToArray(_useControllableValue, 2),
|
|
58
|
+
persistentState = _useControllableValue2[0],
|
|
59
|
+
setPersistentState = _useControllableValue2[1];
|
|
60
|
+
var currentDrawerId = props.__id;
|
|
61
|
+
var storageKey = "drawer-".concat(currentDrawerId);
|
|
27
62
|
var innerProps = {};
|
|
28
63
|
if (props.__designMode === "design") {
|
|
29
64
|
// 低代码编辑态中强制显示,将控制权交给引擎侧
|
|
30
65
|
innerProps.open = true;
|
|
31
66
|
}
|
|
67
|
+
useLayoutEffect(function () {
|
|
68
|
+
if (isBoolean(persistentState) && isUndefined(getContainer) && showPin) {
|
|
69
|
+
document.body.style.transition = 'all 0.3s';
|
|
70
|
+
document.body.style["padding-".concat(placement)] = persistentState && open ? "".concat(width || 378, "px") : "0";
|
|
71
|
+
}
|
|
72
|
+
return function () {
|
|
73
|
+
document.body.style["padding-".concat(placement)] = "0";
|
|
74
|
+
document.body.style.transition = 'none';
|
|
75
|
+
};
|
|
76
|
+
}, [persistentState, width, showPin, placement, open]);
|
|
77
|
+
useUpdateEffect(function () {
|
|
78
|
+
if (isBoolean(persistentState) && showPin) {
|
|
79
|
+
localStorage.setItem(storageKey, "".concat(persistentState));
|
|
80
|
+
}
|
|
81
|
+
}, [persistentState, storageKey, showPin]);
|
|
82
|
+
useLayoutEffect(function () {
|
|
83
|
+
if (!isBoolean(persistentState) && showPin) {
|
|
84
|
+
setPersistentState(localStorage.getItem(storageKey) === "true");
|
|
85
|
+
}
|
|
86
|
+
}, [persistentState, storageKey, showPin]);
|
|
32
87
|
var otherProps = useMemo(function () {
|
|
33
88
|
if (operateMode === "outside") {
|
|
34
89
|
return {
|
|
@@ -39,12 +94,15 @@ var Drawer = function Drawer(props) {
|
|
|
39
94
|
},
|
|
40
95
|
title: /*#__PURE__*/React.createElement(Title, {
|
|
41
96
|
placement: placement,
|
|
42
|
-
onClose: onClose
|
|
97
|
+
onClose: onClose,
|
|
98
|
+
showPin: showPin,
|
|
99
|
+
persistentState: persistentState,
|
|
100
|
+
setPersistentState: setPersistentState
|
|
43
101
|
})
|
|
44
102
|
};
|
|
45
103
|
}
|
|
46
104
|
return headerStyle;
|
|
47
|
-
}, [operateMode, placement, onClose]);
|
|
105
|
+
}, [operateMode, placement, onClose, persistentState, setPersistentState]);
|
|
48
106
|
return /*#__PURE__*/React.createElement(OriginalDrawer, _extends({}, resetProps, innerProps, otherProps, others));
|
|
49
107
|
};
|
|
50
108
|
export default Drawer;
|
|
@@ -8,13 +8,13 @@ import React, { useEffect, useMemo } from "react";
|
|
|
8
8
|
import { Form } from "antd";
|
|
9
9
|
import FilterButton from "./components/FilterButton";
|
|
10
10
|
import QuickFilter from "./components/QuickFilter";
|
|
11
|
-
import { isMobile } from "../../utils/platform";
|
|
12
11
|
var formFiltersPrefix = "filters";
|
|
13
12
|
var Filter = function Filter(props) {
|
|
14
13
|
var filter = props.filter,
|
|
15
14
|
_props$isRenderFormCo = props.isRenderFormContent,
|
|
16
15
|
isRenderFormContent = _props$isRenderFormCo === void 0 ? true : _props$isRenderFormCo,
|
|
17
|
-
onValuesChange = props.onValuesChange
|
|
16
|
+
onValuesChange = props.onValuesChange,
|
|
17
|
+
isMobileBool = props.isMobile;
|
|
18
18
|
var _ref = filter || {},
|
|
19
19
|
show = _ref.show,
|
|
20
20
|
quickFilterMaxLength = _ref.quickFilterMaxLength,
|
|
@@ -23,7 +23,6 @@ var Filter = function Filter(props) {
|
|
|
23
23
|
var _Form$useForm = Form.useForm(),
|
|
24
24
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
25
25
|
form = _Form$useForm2[0];
|
|
26
|
-
var isMobileBool = isMobile();
|
|
27
26
|
var isShowQuickFilter = useMemo(function () {
|
|
28
27
|
// 移动端 并且 开启filter按钮 并且 开启filter排序时 不显示快速筛选
|
|
29
28
|
if (isMobileBool && show && sortButtonShow) {
|
|
@@ -8,7 +8,7 @@ import Buttons from "../Header/Buttons";
|
|
|
8
8
|
import ViewMode from "./component/ViewMode";
|
|
9
9
|
import GallerySetting from "./component/GallerySetting";
|
|
10
10
|
import "./index.less";
|
|
11
|
-
import
|
|
11
|
+
import useIsMobileTable from "../hooks/useIsMobileTable";
|
|
12
12
|
var Actions = function Actions(_ref) {
|
|
13
13
|
var filter = _ref.filter,
|
|
14
14
|
sort = _ref.sort,
|
|
@@ -20,6 +20,7 @@ var Actions = function Actions(_ref) {
|
|
|
20
20
|
view = _ref.view,
|
|
21
21
|
gallery = _ref.gallery;
|
|
22
22
|
var form = Form.useFormInstance();
|
|
23
|
+
var isMobileBool = useIsMobileTable();
|
|
23
24
|
var viewMode = Form.useWatch("view_mode", {
|
|
24
25
|
form: form,
|
|
25
26
|
preserve: true
|
|
@@ -27,7 +28,6 @@ var Actions = function Actions(_ref) {
|
|
|
27
28
|
var showActions = useMemo(function () {
|
|
28
29
|
return (filter === null || filter === void 0 ? void 0 : filter.show) || (sort === null || sort === void 0 ? void 0 : sort.show) || (columnSetting === null || columnSetting === void 0 ? void 0 : columnSetting.show) || (dataSourceGroup === null || dataSourceGroup === void 0 ? void 0 : dataSourceGroup.show) || view.multiple;
|
|
29
30
|
}, [filter === null || filter === void 0 ? void 0 : filter.show, sort === null || sort === void 0 ? void 0 : sort.show, columnSetting === null || columnSetting === void 0 ? void 0 : columnSetting.show, dataSourceGroup === null || dataSourceGroup === void 0 ? void 0 : dataSourceGroup.show, view.multiple]);
|
|
30
|
-
var isMobileBool = isMobile();
|
|
31
31
|
return showActions ? /*#__PURE__*/React.createElement("div", {
|
|
32
32
|
className: "materials-grid-actions"
|
|
33
33
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -36,7 +36,8 @@ var Actions = function Actions(_ref) {
|
|
|
36
36
|
filter: filter,
|
|
37
37
|
isRenderFormContent: false,
|
|
38
38
|
tableId: tableId,
|
|
39
|
-
viewMode: viewMode
|
|
39
|
+
viewMode: viewMode,
|
|
40
|
+
isMobile: isMobileBool
|
|
40
41
|
})), /*#__PURE__*/React.createElement("div", {
|
|
41
42
|
className: "right-wrap",
|
|
42
43
|
style: {
|
|
@@ -146,7 +146,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
|
|
|
146
146
|
sort?: SortType | undefined;
|
|
147
147
|
mode: "" | "localStorage" | "remote";
|
|
148
148
|
currentViewMode: ModeType;
|
|
149
|
-
}) => ("
|
|
149
|
+
}) => ("filter_setting" | "column_setting" | "gallery_setting" | "view_mode" | "group_by" | "order_by")[];
|
|
150
150
|
export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
|
|
151
151
|
export declare const stringify: (obj: Record<string, any>) => string;
|
|
152
152
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useSharedState } from "../../../hooks";
|
|
2
|
+
import { Context } from "../model";
|
|
3
|
+
var useIsMobileTable = function useIsMobileTable() {
|
|
4
|
+
var modal = useSharedState(Context);
|
|
5
|
+
var _ref = (modal === null || modal === void 0 ? void 0 : modal.state) || {},
|
|
6
|
+
tableWidth = _ref.tableWidth;
|
|
7
|
+
return !!(tableWidth && (tableWidth || 0) < 600);
|
|
8
|
+
};
|
|
9
|
+
export default useIsMobileTable;
|
|
@@ -16,6 +16,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
16
16
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
17
|
import React, { useEffect, useImperativeHandle, useMemo, forwardRef, useRef } from "react";
|
|
18
18
|
import { Form } from "antd";
|
|
19
|
+
import { useSize } from "ahooks";
|
|
19
20
|
import View from "./View";
|
|
20
21
|
import Header from "./Header";
|
|
21
22
|
import Actions from "./Actions";
|
|
@@ -70,6 +71,8 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
70
71
|
var tableSettingRef = useRef({});
|
|
71
72
|
var filterDefaultRef = useRef({});
|
|
72
73
|
var initialValuesRef = useRef({});
|
|
74
|
+
var _ref = useSize(wrapRef) || {},
|
|
75
|
+
width = _ref.width;
|
|
73
76
|
var utils = context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils;
|
|
74
77
|
var tableId = useMemo(function () {
|
|
75
78
|
if (props.__designMode === "design") {
|
|
@@ -116,6 +119,14 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
116
119
|
clearTableSettingToLocalStorage(tableId);
|
|
117
120
|
}
|
|
118
121
|
}, [currentSettingHash, tableId]);
|
|
122
|
+
useEffect(function () {
|
|
123
|
+
if (width) {
|
|
124
|
+
modal.dispatch({
|
|
125
|
+
type: "setTableWidth",
|
|
126
|
+
payload: width || {}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}, [width]);
|
|
119
130
|
var _useTableSetting = useTableSetting({
|
|
120
131
|
tableId: tableId,
|
|
121
132
|
filter: filter,
|
|
@@ -13,6 +13,7 @@ interface FormState {
|
|
|
13
13
|
otherFilter: FilterItemProps[];
|
|
14
14
|
utils: any;
|
|
15
15
|
localPagination: boolean;
|
|
16
|
+
tableWidth: number;
|
|
16
17
|
}
|
|
17
18
|
export declare const Provider: (ComponentUi: any) => (props: any, ref: any) => import("react").JSX.Element, Context: import("react").Context<{
|
|
18
19
|
state: FormState;
|
|
@@ -28,7 +28,8 @@ var defaultState = {
|
|
|
28
28
|
data: {
|
|
29
29
|
edit: 0
|
|
30
30
|
}
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
|
+
tableWidth: 500
|
|
32
33
|
};
|
|
33
34
|
var _getContext = getContext({
|
|
34
35
|
namespace: "state",
|
|
@@ -99,6 +100,11 @@ var _getContext = getContext({
|
|
|
99
100
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
100
101
|
localPagination: payload
|
|
101
102
|
});
|
|
103
|
+
},
|
|
104
|
+
setTableWidth: function setTableWidth(state, payload) {
|
|
105
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
106
|
+
tableWidth: payload
|
|
107
|
+
});
|
|
102
108
|
}
|
|
103
109
|
}
|
|
104
110
|
}),
|
|
@@ -39,9 +39,9 @@ var import_ArrowRight = __toESM(require("@pisell/icon/es/ArrowRight"));
|
|
|
39
39
|
var import_ArrowLeft = __toESM(require("@pisell/icon/es/ArrowLeft"));
|
|
40
40
|
var import_antd = require("antd");
|
|
41
41
|
var import_classnames = __toESM(require("classnames"));
|
|
42
|
-
var import_hooks = require("../../hooks");
|
|
43
42
|
var import_index = require("./index.less");
|
|
44
43
|
var import_locales = require("../../locales");
|
|
44
|
+
var import_useIsMobileTable = __toESM(require("../table/hooks/useIsMobileTable"));
|
|
45
45
|
var itemRender = (_, type, originalElement) => {
|
|
46
46
|
if (type === "prev") {
|
|
47
47
|
return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("paginator-page-btn", "left") }, /* @__PURE__ */ import_react.default.createElement(import_ArrowLeft.default, { className: "paginator-page-btn-left-icon" }), /* @__PURE__ */ import_react.default.createElement("span", { className: "paginator-page-btn-text" }, (0, import_locales.getText)("table-pagination-previous")));
|
|
@@ -60,20 +60,20 @@ var paginationConfig = {
|
|
|
60
60
|
size: "small"
|
|
61
61
|
};
|
|
62
62
|
var Pagination = (props) => {
|
|
63
|
-
const responsive = (0, import_hooks.useResponsive)();
|
|
64
63
|
const show = (0, import_react.useMemo)(() => {
|
|
65
64
|
return Object.keys(props).length;
|
|
66
65
|
}, [props]);
|
|
66
|
+
const isMiniPagination = (0, import_useIsMobileTable.default)();
|
|
67
67
|
const content = (0, import_react.useMemo)(() => {
|
|
68
68
|
if (!show) {
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
71
|
let Com = import_antd.Pagination;
|
|
72
|
-
if (
|
|
72
|
+
if (isMiniPagination) {
|
|
73
73
|
Com = MiniPagination;
|
|
74
74
|
}
|
|
75
75
|
return /* @__PURE__ */ import_react.default.createElement(Com, { ...paginationConfig, ...props });
|
|
76
|
-
}, [show, paginationConfig, props,
|
|
76
|
+
}, [show, paginationConfig, props, isMiniPagination]);
|
|
77
77
|
return content;
|
|
78
78
|
};
|
|
79
79
|
var Pagination_default = Pagination;
|
|
@@ -34,26 +34,78 @@ __export(drawer_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(drawer_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_antd = require("antd");
|
|
37
|
+
var import_ahooks = require("ahooks");
|
|
38
|
+
var import_classnames = __toESM(require("classnames"));
|
|
39
|
+
var import_utils = require("@pisell/utils");
|
|
37
40
|
var import_XClose = __toESM(require("@pisell/icon/es/XClose"));
|
|
41
|
+
var import_Pin02 = __toESM(require("@pisell/icon/es/Pin02"));
|
|
38
42
|
var import_index = require("./index.less");
|
|
39
43
|
var prefix = "pisell-lowcode-";
|
|
40
44
|
var Title = (props) => {
|
|
41
|
-
const { placement, onClose } = props;
|
|
45
|
+
const { placement, onClose, showPin, persistentState, setPersistentState } = props;
|
|
42
46
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
43
47
|
"div",
|
|
44
48
|
{
|
|
45
49
|
className: `${prefix}drawer-outside-wrap ${prefix}drawer-outside-wrap-${placement}`
|
|
46
50
|
},
|
|
47
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}drawer-outside-action-wrap`, onClick: onClose }, /* @__PURE__ */ import_react.default.createElement(import_XClose.default, null))
|
|
51
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}drawer-outside-action-wrap`, onClick: onClose }, /* @__PURE__ */ import_react.default.createElement(import_XClose.default, null)),
|
|
52
|
+
showPin && /* @__PURE__ */ import_react.default.createElement(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
className: (0, import_classnames.default)(`${prefix}drawer-outside-action-wrap`, {
|
|
56
|
+
[`${prefix}drawer-outside-action-active`]: persistentState
|
|
57
|
+
}),
|
|
58
|
+
onClick: () => setPersistentState(!persistentState)
|
|
59
|
+
},
|
|
60
|
+
/* @__PURE__ */ import_react.default.createElement(import_Pin02.default, null)
|
|
61
|
+
)
|
|
48
62
|
);
|
|
49
63
|
};
|
|
50
64
|
var Drawer = (props) => {
|
|
51
65
|
const { others, ...resetProps } = props;
|
|
52
|
-
const {
|
|
66
|
+
const {
|
|
67
|
+
operateMode,
|
|
68
|
+
headerStyle,
|
|
69
|
+
placement,
|
|
70
|
+
onClose,
|
|
71
|
+
showPin,
|
|
72
|
+
width,
|
|
73
|
+
getContainer,
|
|
74
|
+
open
|
|
75
|
+
} = props;
|
|
76
|
+
const [persistentState, setPersistentState] = (0, import_ahooks.useControllableValue)(
|
|
77
|
+
props,
|
|
78
|
+
{
|
|
79
|
+
trigger: "onPersistentChange",
|
|
80
|
+
valuePropName: "persistent"
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
const currentDrawerId = props.__id;
|
|
84
|
+
const storageKey = `drawer-${currentDrawerId}`;
|
|
53
85
|
const innerProps = {};
|
|
54
86
|
if (props.__designMode === "design") {
|
|
55
87
|
innerProps.open = true;
|
|
56
88
|
}
|
|
89
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
90
|
+
if ((0, import_utils.isBoolean)(persistentState) && (0, import_utils.isUndefined)(getContainer) && showPin) {
|
|
91
|
+
document.body.style.transition = "all 0.3s";
|
|
92
|
+
document.body.style[`padding-${placement}`] = persistentState && open ? `${width || 378}px` : "0";
|
|
93
|
+
}
|
|
94
|
+
return () => {
|
|
95
|
+
document.body.style[`padding-${placement}`] = "0";
|
|
96
|
+
document.body.style.transition = "none";
|
|
97
|
+
};
|
|
98
|
+
}, [persistentState, width, showPin, placement, open]);
|
|
99
|
+
(0, import_ahooks.useUpdateEffect)(() => {
|
|
100
|
+
if ((0, import_utils.isBoolean)(persistentState) && showPin) {
|
|
101
|
+
localStorage.setItem(storageKey, `${persistentState}`);
|
|
102
|
+
}
|
|
103
|
+
}, [persistentState, storageKey, showPin]);
|
|
104
|
+
(0, import_react.useLayoutEffect)(() => {
|
|
105
|
+
if (!(0, import_utils.isBoolean)(persistentState) && showPin) {
|
|
106
|
+
setPersistentState(localStorage.getItem(storageKey) === "true");
|
|
107
|
+
}
|
|
108
|
+
}, [persistentState, storageKey, showPin]);
|
|
57
109
|
const otherProps = (0, import_react.useMemo)(() => {
|
|
58
110
|
if (operateMode === "outside") {
|
|
59
111
|
return {
|
|
@@ -62,11 +114,20 @@ var Drawer = (props) => {
|
|
|
62
114
|
height: 0,
|
|
63
115
|
padding: 0
|
|
64
116
|
},
|
|
65
|
-
title: /* @__PURE__ */ import_react.default.createElement(
|
|
117
|
+
title: /* @__PURE__ */ import_react.default.createElement(
|
|
118
|
+
Title,
|
|
119
|
+
{
|
|
120
|
+
placement,
|
|
121
|
+
onClose,
|
|
122
|
+
showPin,
|
|
123
|
+
persistentState,
|
|
124
|
+
setPersistentState
|
|
125
|
+
}
|
|
126
|
+
)
|
|
66
127
|
};
|
|
67
128
|
}
|
|
68
129
|
return headerStyle;
|
|
69
|
-
}, [operateMode, placement, onClose]);
|
|
130
|
+
}, [operateMode, placement, onClose, persistentState, setPersistentState]);
|
|
70
131
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
71
132
|
import_antd.Drawer,
|
|
72
133
|
{
|
|
@@ -36,13 +36,11 @@ var import_react = __toESM(require("react"));
|
|
|
36
36
|
var import_antd = require("antd");
|
|
37
37
|
var import_FilterButton = __toESM(require("./components/FilterButton"));
|
|
38
38
|
var import_QuickFilter = __toESM(require("./components/QuickFilter"));
|
|
39
|
-
var import_platform = require("../../utils/platform");
|
|
40
39
|
var formFiltersPrefix = "filters";
|
|
41
40
|
var Filter = (props) => {
|
|
42
|
-
const { filter, isRenderFormContent = true, onValuesChange } = props;
|
|
41
|
+
const { filter, isRenderFormContent = true, onValuesChange, isMobile: isMobileBool } = props;
|
|
43
42
|
const { show, quickFilterMaxLength, sortButtonShow, list } = filter || {};
|
|
44
43
|
const [form] = import_antd.Form.useForm();
|
|
45
|
-
const isMobileBool = (0, import_platform.isMobile)();
|
|
46
44
|
const isShowQuickFilter = (0, import_react.useMemo)(() => {
|
|
47
45
|
if (isMobileBool && show && sortButtonShow) {
|
|
48
46
|
return false;
|
|
@@ -42,7 +42,7 @@ var import_Buttons = __toESM(require("../Header/Buttons"));
|
|
|
42
42
|
var import_ViewMode = __toESM(require("./component/ViewMode"));
|
|
43
43
|
var import_GallerySetting = __toESM(require("./component/GallerySetting"));
|
|
44
44
|
var import_index = require("./index.less");
|
|
45
|
-
var
|
|
45
|
+
var import_useIsMobileTable = __toESM(require("../hooks/useIsMobileTable"));
|
|
46
46
|
var Actions = ({
|
|
47
47
|
filter,
|
|
48
48
|
sort,
|
|
@@ -55,6 +55,7 @@ var Actions = ({
|
|
|
55
55
|
gallery
|
|
56
56
|
}) => {
|
|
57
57
|
const form = import_antd.Form.useFormInstance();
|
|
58
|
+
const isMobileBool = (0, import_useIsMobileTable.default)();
|
|
58
59
|
const viewMode = import_antd.Form.useWatch("view_mode", {
|
|
59
60
|
form,
|
|
60
61
|
preserve: true
|
|
@@ -68,14 +69,14 @@ var Actions = ({
|
|
|
68
69
|
dataSourceGroup == null ? void 0 : dataSourceGroup.show,
|
|
69
70
|
view.multiple
|
|
70
71
|
]);
|
|
71
|
-
const isMobileBool = (0, import_platform.isMobile)();
|
|
72
72
|
return showActions ? /* @__PURE__ */ import_react.default.createElement("div", { className: "materials-grid-actions" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "left-wrap" }, /* @__PURE__ */ import_react.default.createElement(
|
|
73
73
|
import_filter.default,
|
|
74
74
|
{
|
|
75
75
|
filter,
|
|
76
76
|
isRenderFormContent: false,
|
|
77
77
|
tableId,
|
|
78
|
-
viewMode
|
|
78
|
+
viewMode,
|
|
79
|
+
isMobile: isMobileBool
|
|
79
80
|
}
|
|
80
81
|
)), /* @__PURE__ */ import_react.default.createElement(
|
|
81
82
|
"div",
|
|
@@ -146,7 +146,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
|
|
|
146
146
|
sort?: SortType | undefined;
|
|
147
147
|
mode: "" | "localStorage" | "remote";
|
|
148
148
|
currentViewMode: ModeType;
|
|
149
|
-
}) => ("
|
|
149
|
+
}) => ("filter_setting" | "column_setting" | "gallery_setting" | "view_mode" | "group_by" | "order_by")[];
|
|
150
150
|
export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
|
|
151
151
|
export declare const stringify: (obj: Record<string, any>) => string;
|
|
152
152
|
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/table/hooks/useIsMobileTable.ts
|
|
20
|
+
var useIsMobileTable_exports = {};
|
|
21
|
+
__export(useIsMobileTable_exports, {
|
|
22
|
+
default: () => useIsMobileTable_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useIsMobileTable_exports);
|
|
25
|
+
var import_hooks = require("../../../hooks");
|
|
26
|
+
var import_model = require("../model");
|
|
27
|
+
var useIsMobileTable = () => {
|
|
28
|
+
const modal = (0, import_hooks.useSharedState)(import_model.Context);
|
|
29
|
+
const { tableWidth } = (modal == null ? void 0 : modal.state) || {};
|
|
30
|
+
return !!(tableWidth && (tableWidth || 0) < 600);
|
|
31
|
+
};
|
|
32
|
+
var useIsMobileTable_default = useIsMobileTable;
|
|
@@ -34,6 +34,7 @@ __export(table_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(table_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_antd = require("antd");
|
|
37
|
+
var import_ahooks = require("ahooks");
|
|
37
38
|
var import_View = __toESM(require("./View"));
|
|
38
39
|
var import_Header = __toESM(require("./Header"));
|
|
39
40
|
var import_Actions = __toESM(require("./Actions"));
|
|
@@ -85,6 +86,7 @@ var GridView = (0, import_model.Provider)(
|
|
|
85
86
|
const tableSettingRef = (0, import_react.useRef)({});
|
|
86
87
|
const filterDefaultRef = (0, import_react.useRef)({});
|
|
87
88
|
const initialValuesRef = (0, import_react.useRef)({});
|
|
89
|
+
const { width } = (0, import_ahooks.useSize)(wrapRef) || {};
|
|
88
90
|
const utils = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils;
|
|
89
91
|
const tableId = (0, import_react.useMemo)(() => {
|
|
90
92
|
if (props.__designMode === "design") {
|
|
@@ -129,6 +131,14 @@ var GridView = (0, import_model.Provider)(
|
|
|
129
131
|
(0, import_utils.clearTableSettingToLocalStorage)(tableId);
|
|
130
132
|
}
|
|
131
133
|
}, [currentSettingHash, tableId]);
|
|
134
|
+
(0, import_react.useEffect)(() => {
|
|
135
|
+
if (width) {
|
|
136
|
+
modal.dispatch({
|
|
137
|
+
type: "setTableWidth",
|
|
138
|
+
payload: width || {}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}, [width]);
|
|
132
142
|
const { setTableSetting, tableSetting } = (0, import_useTableSetting.default)({
|
|
133
143
|
tableId,
|
|
134
144
|
filter,
|
|
@@ -13,6 +13,7 @@ interface FormState {
|
|
|
13
13
|
otherFilter: FilterItemProps[];
|
|
14
14
|
utils: any;
|
|
15
15
|
localPagination: boolean;
|
|
16
|
+
tableWidth: number;
|
|
16
17
|
}
|
|
17
18
|
export declare const Provider: (ComponentUi: any) => (props: any, ref: any) => import("react").JSX.Element, Context: import("react").Context<{
|
|
18
19
|
state: FormState;
|
|
@@ -58,7 +58,8 @@ var defaultState = {
|
|
|
58
58
|
data: {
|
|
59
59
|
edit: 0
|
|
60
60
|
}
|
|
61
|
-
}
|
|
61
|
+
},
|
|
62
|
+
tableWidth: 500
|
|
62
63
|
};
|
|
63
64
|
var { Provider, Context } = (0, import_miniRedux.default)({
|
|
64
65
|
namespace: "state",
|
|
@@ -110,6 +111,9 @@ var { Provider, Context } = (0, import_miniRedux.default)({
|
|
|
110
111
|
},
|
|
111
112
|
setLocalPagination(state, payload) {
|
|
112
113
|
return { ...state, localPagination: payload };
|
|
114
|
+
},
|
|
115
|
+
setTableWidth(state, payload) {
|
|
116
|
+
return { ...state, tableWidth: payload };
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
});
|