@pisell/materials 1.0.304 → 2.2.1
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 +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +20 -29
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +22 -31
- package/es/components/batch-editor/index.js +4 -4
- package/es/components/batch-editor/index.less +1 -1
- package/es/components/page/index.js +8 -12
- package/es/components/table/Table/index.js +2 -11
- package/es/components/table/Table/utils.d.ts +2 -14
- package/es/components/table/Table/utils.js +2 -6
- package/es/components/table/hooks/useGenScroll.d.ts +0 -1
- package/es/components/table/hooks/useGenScroll.js +3 -4
- package/es/components/table/hooks/useTableSetting.js +5 -26
- package/es/components/virtual-keyboard/VirtualKeyInput/index.js +1 -1
- package/es/index.d.ts +0 -1
- package/es/index.js +0 -1
- package/lib/components/batch-editor/index.js +1 -0
- package/lib/components/batch-editor/index.less +1 -1
- package/lib/components/page/index.js +6 -6
- package/lib/components/table/Table/index.js +3 -22
- package/lib/components/table/Table/utils.d.ts +2 -14
- package/lib/components/table/Table/utils.js +1 -7
- package/lib/components/table/hooks/useGenScroll.d.ts +0 -1
- package/lib/components/table/hooks/useGenScroll.js +3 -3
- package/lib/components/table/hooks/useTableSetting.js +9 -23
- package/lib/components/virtual-keyboard/VirtualKeyInput/index.js +2 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -3
- package/lowcode/button/meta.ts +5 -10
- package/lowcode/menu/utils.ts +1 -1
- package/lowcode/select-time/meta.ts +8 -8
- package/package.json +4 -5
- package/es/components/picker-view/index.d.ts +0 -2
- package/es/components/picker-view/index.js +0 -2
- package/lib/components/picker-view/index.d.ts +0 -2
- package/lib/components/picker-view/index.js +0 -36
- package/lowcode/picker-view/__screenshots__/select-1.png +0 -0
- package/lowcode/picker-view/meta.ts +0 -206
- package/lowcode/picker-view/snippets.ts +0 -24
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
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
|
-
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); }
|
|
3
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
3
|
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
4
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -10,6 +9,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
10
9
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
10
|
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); }
|
|
12
11
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
12
|
+
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); }
|
|
13
13
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
14
|
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."); }
|
|
15
15
|
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); }
|
|
@@ -87,17 +87,17 @@ var BatchEditor = function BatchEditor(props) {
|
|
|
87
87
|
if (Com) {
|
|
88
88
|
return /*#__PURE__*/React.createElement("div", {
|
|
89
89
|
className: "editor-item"
|
|
90
|
-
}, /*#__PURE__*/React.createElement(Com, {
|
|
90
|
+
}, /*#__PURE__*/React.createElement(Com, _extends({
|
|
91
91
|
status: record.status,
|
|
92
92
|
value: text
|
|
93
93
|
// 为了应对每个字段需要设置不同的 placeholder
|
|
94
|
-
|
|
94
|
+
}, _item.componentProps, {
|
|
95
95
|
placeholder: _item.placeholder || record[_item.dataIndex + "placeholder"],
|
|
96
96
|
symbol: symbol,
|
|
97
97
|
onChange: function onChange(e) {
|
|
98
98
|
handleChange(e, _item.dataIndex, record[rowKey]);
|
|
99
99
|
}
|
|
100
|
-
}));
|
|
100
|
+
})));
|
|
101
101
|
}
|
|
102
102
|
return /*#__PURE__*/React.createElement("div", {
|
|
103
103
|
className: "editor-item"
|
|
@@ -6,7 +6,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
6
6
|
import React from "react";
|
|
7
7
|
import ConfigProvider from "../config-provider";
|
|
8
8
|
import { AdapterDayjs } from "@pisell/date-picker/es/AdapterDayjs";
|
|
9
|
-
import { LocalizationProvider, createTheme, ThemeProvider
|
|
9
|
+
import { LocalizationProvider, createTheme, ThemeProvider } from "@pisell/date-picker";
|
|
10
10
|
import enUS from "antd/locale/en_US";
|
|
11
11
|
import zhCN from "antd/locale/zh_CN";
|
|
12
12
|
import zhTW from "antd/locale/zh_TW";
|
|
@@ -89,13 +89,13 @@ var theme = {
|
|
|
89
89
|
colorBgContainerDisabled: "#F9FAFB",
|
|
90
90
|
colorTextDisabled: "#98A2B3"
|
|
91
91
|
},
|
|
92
|
-
Input: {
|
|
93
|
-
fontSizeIcon: 16
|
|
92
|
+
"Input": {
|
|
93
|
+
"fontSizeIcon": 16
|
|
94
94
|
// "lineHeight": 1
|
|
95
95
|
},
|
|
96
96
|
|
|
97
|
-
Select: {
|
|
98
|
-
fontSizeIcon: 16
|
|
97
|
+
"Select": {
|
|
98
|
+
"fontSizeIcon": 16
|
|
99
99
|
// "lineHeight": 1
|
|
100
100
|
}
|
|
101
101
|
},
|
|
@@ -179,7 +179,7 @@ var localeDateMap = {
|
|
|
179
179
|
"en-US": {
|
|
180
180
|
adapterLocale: "en"
|
|
181
181
|
},
|
|
182
|
-
en: {
|
|
182
|
+
"en": {
|
|
183
183
|
adapterLocale: "en"
|
|
184
184
|
},
|
|
185
185
|
"zh-TW": {
|
|
@@ -204,15 +204,11 @@ var Page = function Page(props) {
|
|
|
204
204
|
theme: props.theme || theme
|
|
205
205
|
}), /*#__PURE__*/React.createElement(LocalizationProvider, {
|
|
206
206
|
dateAdapter: AdapterDayjs,
|
|
207
|
-
adapterLocale: (localeDateMap === null || localeDateMap === void 0 ? void 0 : (_localeDateMap = localeDateMap[locale]) === null || _localeDateMap === void 0 ? void 0 : _localeDateMap.adapterLocale) ||
|
|
207
|
+
adapterLocale: (localeDateMap === null || localeDateMap === void 0 ? void 0 : (_localeDateMap = localeDateMap[locale]) === null || _localeDateMap === void 0 ? void 0 : _localeDateMap.adapterLocale) || 'en'
|
|
208
208
|
}, /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
209
209
|
theme: datePickerTheme
|
|
210
|
-
}, /*#__PURE__*/React.createElement(LocaleProvider, {
|
|
211
|
-
value: {
|
|
212
|
-
locale: locale
|
|
213
|
-
}
|
|
214
210
|
}, /*#__PURE__*/React.createElement("div", {
|
|
215
211
|
style: style
|
|
216
|
-
}, children))))
|
|
212
|
+
}, children))));
|
|
217
213
|
};
|
|
218
214
|
export default Page;
|
|
@@ -28,7 +28,7 @@ import useGenScroll from "../hooks/useGenScroll";
|
|
|
28
28
|
import { useSharedState, useResponsive } from "../../../hooks";
|
|
29
29
|
import "./index.less";
|
|
30
30
|
var GridViewTable = function GridViewTable(_ref) {
|
|
31
|
-
var _tableProps$paginatio, _tableProps$paginatio2
|
|
31
|
+
var _tableProps$paginatio, _tableProps$paginatio2;
|
|
32
32
|
var tableProps = _ref.tableProps,
|
|
33
33
|
filter = _ref.filter,
|
|
34
34
|
setTableSetting = _ref.setTableSetting,
|
|
@@ -93,19 +93,10 @@ var GridViewTable = function GridViewTable(_ref) {
|
|
|
93
93
|
var components = useGenTableComponents({
|
|
94
94
|
form: form
|
|
95
95
|
});
|
|
96
|
-
var isShowPagination = useMemo(function () {
|
|
97
|
-
var _tableProps$paginatio3, _tableProps$paginatio4, _tableProps$paginatio5, _tableProps$paginatio6;
|
|
98
|
-
var total = (tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio3 = tableProps.pagination) === null || _tableProps$paginatio3 === void 0 ? void 0 : _tableProps$paginatio3.total) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0;
|
|
99
|
-
if (tableProps !== null && tableProps !== void 0 && (_tableProps$paginatio4 = tableProps.pagination) !== null && _tableProps$paginatio4 !== void 0 && _tableProps$paginatio4.localPagination) {
|
|
100
|
-
total = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0;
|
|
101
|
-
}
|
|
102
|
-
return total > ((tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio5 = tableProps.pagination) === null || _tableProps$paginatio5 === void 0 ? void 0 : (_tableProps$paginatio6 = _tableProps$paginatio5.pageSizeOptions) === null || _tableProps$paginatio6 === void 0 ? void 0 : _tableProps$paginatio6[0]) || 10);
|
|
103
|
-
}, [tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio7 = tableProps.pagination) === null || _tableProps$paginatio7 === void 0 ? void 0 : _tableProps$paginatio7.localPagination, tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio8 = tableProps.pagination) === null || _tableProps$paginatio8 === void 0 ? void 0 : _tableProps$paginatio8.total, dataSource.length, tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio9 = tableProps.pagination) === null || _tableProps$paginatio9 === void 0 ? void 0 : (_tableProps$paginatio10 = _tableProps$paginatio9.pageSizeOptions) === null || _tableProps$paginatio10 === void 0 ? void 0 : _tableProps$paginatio10[0]]);
|
|
104
96
|
var scroll = useGenScroll({
|
|
105
97
|
wrapHeight: height || 500,
|
|
106
98
|
scroll: tableProps.scroll,
|
|
107
|
-
columns: columns
|
|
108
|
-
isShowPagination: isShowPagination
|
|
99
|
+
columns: columns
|
|
109
100
|
});
|
|
110
101
|
var showTotal = useCallback(function (total, range, pageSize) {
|
|
111
102
|
var start = range[0] - 1;
|
|
@@ -72,10 +72,7 @@ export declare const setTableSettingToLocalStorage: ({ tableId, tableSettingObj,
|
|
|
72
72
|
}>;
|
|
73
73
|
currentViewMode: ModeType;
|
|
74
74
|
currentSettingHash: string;
|
|
75
|
-
}) =>
|
|
76
|
-
key: string;
|
|
77
|
-
value: Record<string, any>;
|
|
78
|
-
} | undefined;
|
|
75
|
+
}) => void;
|
|
79
76
|
export declare const clearTableSettingToLocalStorage: (tableId?: string) => void;
|
|
80
77
|
/**
|
|
81
78
|
* 从本地存储中获取表格设置, 全部配置
|
|
@@ -106,16 +103,7 @@ export declare const setFormValuesToLocalStorage: ({ tableId, allValues, keys, c
|
|
|
106
103
|
keys?: string[] | undefined;
|
|
107
104
|
currentViewMode: ModeType;
|
|
108
105
|
currentSettingHash: string;
|
|
109
|
-
}) =>
|
|
110
|
-
key: string;
|
|
111
|
-
value: Record<string, any>;
|
|
112
|
-
} | undefined;
|
|
113
|
-
/**
|
|
114
|
-
* 获取表格键值
|
|
115
|
-
* @param tableId 表格ID
|
|
116
|
-
* @returns 返回格式化后的表格键值
|
|
117
|
-
*/
|
|
118
|
-
export declare const getTableKey: (tableId: string) => string;
|
|
106
|
+
}) => void;
|
|
119
107
|
/**
|
|
120
108
|
* 合并筛选设置
|
|
121
109
|
* @param list 列表数据
|
|
@@ -267,10 +267,6 @@ export var setTableSettingToLocalStorage = function setTableSettingToLocalStorag
|
|
|
267
267
|
currentSettingHash: currentSettingHash
|
|
268
268
|
}, currentViewMode, _objectSpread(_objectSpread({}, newData[currentViewMode] || {}), itemSetting)));
|
|
269
269
|
localStorage.setItem(getTableKey(tableId), JSON.stringify(newData));
|
|
270
|
-
return {
|
|
271
|
-
key: getTableKey(tableId),
|
|
272
|
-
value: newData
|
|
273
|
-
};
|
|
274
270
|
};
|
|
275
271
|
export var clearTableSettingToLocalStorage = function clearTableSettingToLocalStorage(tableId) {
|
|
276
272
|
if (!tableId) return;
|
|
@@ -327,7 +323,7 @@ export var setFormValuesToLocalStorage = function setFormValuesToLocalStorage(_r
|
|
|
327
323
|
keys === null || keys === void 0 ? void 0 : keys.forEach(function (key) {
|
|
328
324
|
obj[key] = allValues === null || allValues === void 0 ? void 0 : allValues[key];
|
|
329
325
|
});
|
|
330
|
-
|
|
326
|
+
setTableSettingToLocalStorage({
|
|
331
327
|
tableId: tableId,
|
|
332
328
|
tableSettingObj: obj,
|
|
333
329
|
currentViewMode: currentViewMode,
|
|
@@ -340,7 +336,7 @@ export var setFormValuesToLocalStorage = function setFormValuesToLocalStorage(_r
|
|
|
340
336
|
* @param tableId 表格ID
|
|
341
337
|
* @returns 返回格式化后的表格键值
|
|
342
338
|
*/
|
|
343
|
-
|
|
339
|
+
var getTableKey = function getTableKey(tableId) {
|
|
344
340
|
return "".concat(tableKeyPrefix, "-").concat(tableId);
|
|
345
341
|
};
|
|
346
342
|
|
|
@@ -2,20 +2,19 @@ import { useMemo } from "react";
|
|
|
2
2
|
var useGenScroll = function useGenScroll(params) {
|
|
3
3
|
var wrapHeight = params.wrapHeight,
|
|
4
4
|
propsScroll = params.scroll,
|
|
5
|
-
columns = params.columns
|
|
6
|
-
isShowPagination = params.isShowPagination;
|
|
5
|
+
columns = params.columns;
|
|
7
6
|
var scroll = useMemo(function () {
|
|
8
7
|
if (propsScroll !== null && propsScroll !== void 0 && propsScroll.autoCalc) {
|
|
9
8
|
return {
|
|
10
9
|
x: (propsScroll === null || propsScroll === void 0 ? void 0 : propsScroll.x) || columns.reduce(function (p, c) {
|
|
11
10
|
return p + (c.width || 250);
|
|
12
11
|
}, 0) || 2000,
|
|
13
|
-
y: (propsScroll === null || propsScroll === void 0 ? void 0 : propsScroll.y) || Math.max(wrapHeight - 48 -
|
|
12
|
+
y: (propsScroll === null || propsScroll === void 0 ? void 0 : propsScroll.y) || Math.max(wrapHeight - 48 - 50 - 24, 100),
|
|
14
13
|
scrollToFirstRowOnChange: propsScroll === null || propsScroll === void 0 ? void 0 : propsScroll.scrollToFirstRowOnChange
|
|
15
14
|
};
|
|
16
15
|
}
|
|
17
16
|
return propsScroll;
|
|
18
|
-
}, [propsScroll, wrapHeight, columns
|
|
17
|
+
}, [propsScroll, wrapHeight, columns]);
|
|
19
18
|
return scroll;
|
|
20
19
|
};
|
|
21
20
|
export default useGenScroll;
|
|
@@ -6,9 +6,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
6
6
|
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
7
|
import { useMemo } from "react";
|
|
8
8
|
import { getSettingKeyArrByMode, getTableSettingByCurrentViewMode, getTableSettingFromLocalStorage, mergeColumnSetting, mergeFilterSetting, setFormValuesToLocalStorage } from "../Table/utils";
|
|
9
|
-
import useEngineContext from "../../../hooks/useEngineContext";
|
|
10
9
|
var useTableSetting = function useTableSetting(params) {
|
|
11
|
-
var _context$appHelper;
|
|
12
10
|
var tableId = params.tableId,
|
|
13
11
|
filter = params.filter,
|
|
14
12
|
columnSetting = params.columnSetting,
|
|
@@ -19,10 +17,6 @@ var useTableSetting = function useTableSetting(params) {
|
|
|
19
17
|
propsColumns = params.columns,
|
|
20
18
|
gallery = params.gallery,
|
|
21
19
|
currentSettingHash = params.currentSettingHash;
|
|
22
|
-
var context = useEngineContext();
|
|
23
|
-
var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
|
|
24
|
-
isTerminal = _ref.isTerminal,
|
|
25
|
-
interaction = _ref.interaction;
|
|
26
20
|
var columnsMap = useMemo(function () {
|
|
27
21
|
return new Map(propsColumns.map(function (item) {
|
|
28
22
|
return [item.key, item];
|
|
@@ -43,10 +37,10 @@ var useTableSetting = function useTableSetting(params) {
|
|
|
43
37
|
}
|
|
44
38
|
return propsColumns;
|
|
45
39
|
}, [propsColumns, currentViewMode, gallery, columnsMap]);
|
|
46
|
-
var
|
|
47
|
-
list =
|
|
48
|
-
quickFilterMaxLength =
|
|
49
|
-
sortButtonShow =
|
|
40
|
+
var _ref = filter || {},
|
|
41
|
+
list = _ref.list,
|
|
42
|
+
quickFilterMaxLength = _ref.quickFilterMaxLength,
|
|
43
|
+
sortButtonShow = _ref.sortButtonShow;
|
|
50
44
|
var defaultGalleryCoverSetting = useMemo(function () {
|
|
51
45
|
var _gallery$cover, _columns$find;
|
|
52
46
|
return {
|
|
@@ -162,29 +156,14 @@ var useTableSetting = function useTableSetting(params) {
|
|
|
162
156
|
* @param values
|
|
163
157
|
*/
|
|
164
158
|
var setTableSetting = function setTableSetting(values) {
|
|
165
|
-
|
|
159
|
+
setFormValuesToLocalStorage({
|
|
166
160
|
tableId: tableId,
|
|
167
161
|
allValues: values,
|
|
168
162
|
keys: localStorageSettingKeyArr,
|
|
169
163
|
currentViewMode: currentViewMode,
|
|
170
164
|
currentSettingHash: currentSettingHash
|
|
171
165
|
});
|
|
172
|
-
/*
|
|
173
|
-
if (isTerminal?.() && result) {
|
|
174
|
-
interaction?.utils?.postMessageToApp?.({
|
|
175
|
-
module: "global",
|
|
176
|
-
key: "local_storage",
|
|
177
|
-
data: {
|
|
178
|
-
type: "set",
|
|
179
|
-
value: {
|
|
180
|
-
[result.key]: result.value
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
})
|
|
184
|
-
}
|
|
185
|
-
*/
|
|
186
166
|
};
|
|
187
|
-
|
|
188
167
|
var tableSetting = useMemo(function () {
|
|
189
168
|
return _objectSpread(_objectSpread({}, tableLocalSetting), defaultTableSetting);
|
|
190
169
|
}, [tableLocalSetting, defaultTableSetting]);
|
|
@@ -7,7 +7,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
8
|
import React, { useEffect, useState } from "react";
|
|
9
9
|
import { Input } from "antd";
|
|
10
|
-
import Delete from "@pisell/icon
|
|
10
|
+
import { Delete } from "@pisell/icon";
|
|
11
11
|
import { useEventListener } from "ahooks";
|
|
12
12
|
import classNames from "classnames";
|
|
13
13
|
import "./index.less";
|
package/es/index.d.ts
CHANGED
|
@@ -72,7 +72,6 @@ export { default as List } from "./components/list";
|
|
|
72
72
|
export { default as Sort } from "./components/sort";
|
|
73
73
|
export { default as InputNumberRange } from "./components/input-number-range";
|
|
74
74
|
export { default as LowCodePage } from "./components/lowCodePage";
|
|
75
|
-
export { default as PickerView } from "./components/picker-view";
|
|
76
75
|
export { default as Segmented } from "./components/segmented";
|
|
77
76
|
export { default as VirtualKeyboard } from "./components/virtual-keyboard";
|
|
78
77
|
export { default as VirtualKeyboardTime } from "./components/virtual-keyboard/Time";
|
package/es/index.js
CHANGED
|
@@ -92,7 +92,6 @@ export { default as List } from "./components/list";
|
|
|
92
92
|
export { default as Sort } from "./components/sort";
|
|
93
93
|
export { default as InputNumberRange } from "./components/input-number-range";
|
|
94
94
|
export { default as LowCodePage } from "./components/lowCodePage";
|
|
95
|
-
export { default as PickerView } from "./components/picker-view";
|
|
96
95
|
export { default as Segmented } from "./components/segmented";
|
|
97
96
|
export { default as VirtualKeyboard } from "./components/virtual-keyboard";
|
|
98
97
|
export { default as VirtualKeyboardTime } from "./components/virtual-keyboard/Time";
|
|
@@ -118,12 +118,12 @@ var theme = {
|
|
|
118
118
|
colorBgContainerDisabled: "#F9FAFB",
|
|
119
119
|
colorTextDisabled: "#98A2B3"
|
|
120
120
|
},
|
|
121
|
-
Input: {
|
|
122
|
-
fontSizeIcon: 16
|
|
121
|
+
"Input": {
|
|
122
|
+
"fontSizeIcon": 16
|
|
123
123
|
// "lineHeight": 1
|
|
124
124
|
},
|
|
125
|
-
Select: {
|
|
126
|
-
fontSizeIcon: 16
|
|
125
|
+
"Select": {
|
|
126
|
+
"fontSizeIcon": 16
|
|
127
127
|
// "lineHeight": 1
|
|
128
128
|
}
|
|
129
129
|
},
|
|
@@ -205,7 +205,7 @@ var localeDateMap = {
|
|
|
205
205
|
"en-US": {
|
|
206
206
|
adapterLocale: "en"
|
|
207
207
|
},
|
|
208
|
-
en: {
|
|
208
|
+
"en": {
|
|
209
209
|
adapterLocale: "en"
|
|
210
210
|
},
|
|
211
211
|
"zh-TW": {
|
|
@@ -235,7 +235,7 @@ var Page = (props) => {
|
|
|
235
235
|
dateAdapter: import_AdapterDayjs.AdapterDayjs,
|
|
236
236
|
adapterLocale: ((_a2 = localeDateMap == null ? void 0 : localeDateMap[locale]) == null ? void 0 : _a2.adapterLocale) || "en"
|
|
237
237
|
},
|
|
238
|
-
/* @__PURE__ */ import_react.default.createElement(import_date_picker.ThemeProvider, { theme: datePickerTheme }, /* @__PURE__ */ import_react.default.createElement(
|
|
238
|
+
/* @__PURE__ */ import_react.default.createElement(import_date_picker.ThemeProvider, { theme: datePickerTheme }, /* @__PURE__ */ import_react.default.createElement("div", { style }, children))
|
|
239
239
|
)
|
|
240
240
|
);
|
|
241
241
|
};
|
|
@@ -46,13 +46,8 @@ var import_useGenTableComponents = __toESM(require("../hooks/useGenTableComponen
|
|
|
46
46
|
var import_useGenScroll = __toESM(require("../hooks/useGenScroll"));
|
|
47
47
|
var import_hooks = require("../../../hooks");
|
|
48
48
|
var import_index = require("./index.less");
|
|
49
|
-
var GridViewTable = ({
|
|
50
|
-
|
|
51
|
-
filter,
|
|
52
|
-
setTableSetting,
|
|
53
|
-
onDataSourceChange
|
|
54
|
-
}) => {
|
|
55
|
-
var _a, _b, _c, _d, _e, _f;
|
|
49
|
+
var GridViewTable = ({ tableProps, filter, setTableSetting, onDataSourceChange }) => {
|
|
50
|
+
var _a, _b;
|
|
56
51
|
const responsive = (0, import_hooks.useResponsive)();
|
|
57
52
|
const { state, dispatch } = (0, import_hooks.useSharedState)(import_model.Context);
|
|
58
53
|
const form = import_antd.Form.useFormInstance();
|
|
@@ -104,24 +99,10 @@ var GridViewTable = ({
|
|
|
104
99
|
const components = (0, import_useGenTableComponents.default)({
|
|
105
100
|
form
|
|
106
101
|
});
|
|
107
|
-
const isShowPagination = (0, import_react.useMemo)(() => {
|
|
108
|
-
var _a2, _b2, _c2, _d2;
|
|
109
|
-
let total = ((_a2 = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _a2.total) || (dataSource == null ? void 0 : dataSource.length) || 0;
|
|
110
|
-
if ((_b2 = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _b2.localPagination) {
|
|
111
|
-
total = (dataSource == null ? void 0 : dataSource.length) || 0;
|
|
112
|
-
}
|
|
113
|
-
return total > (((_d2 = (_c2 = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _c2.pageSizeOptions) == null ? void 0 : _d2[0]) || 10);
|
|
114
|
-
}, [
|
|
115
|
-
(_c = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _c.localPagination,
|
|
116
|
-
(_d = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _d.total,
|
|
117
|
-
dataSource.length,
|
|
118
|
-
(_f = (_e = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _e.pageSizeOptions) == null ? void 0 : _f[0]
|
|
119
|
-
]);
|
|
120
102
|
const scroll = (0, import_useGenScroll.default)({
|
|
121
103
|
wrapHeight: height || 500,
|
|
122
104
|
scroll: tableProps.scroll,
|
|
123
|
-
columns
|
|
124
|
-
isShowPagination
|
|
105
|
+
columns
|
|
125
106
|
});
|
|
126
107
|
const showTotal = (0, import_react.useCallback)(
|
|
127
108
|
(total, range, pageSize) => {
|
|
@@ -72,10 +72,7 @@ export declare const setTableSettingToLocalStorage: ({ tableId, tableSettingObj,
|
|
|
72
72
|
}>;
|
|
73
73
|
currentViewMode: ModeType;
|
|
74
74
|
currentSettingHash: string;
|
|
75
|
-
}) =>
|
|
76
|
-
key: string;
|
|
77
|
-
value: Record<string, any>;
|
|
78
|
-
} | undefined;
|
|
75
|
+
}) => void;
|
|
79
76
|
export declare const clearTableSettingToLocalStorage: (tableId?: string) => void;
|
|
80
77
|
/**
|
|
81
78
|
* 从本地存储中获取表格设置, 全部配置
|
|
@@ -106,16 +103,7 @@ export declare const setFormValuesToLocalStorage: ({ tableId, allValues, keys, c
|
|
|
106
103
|
keys?: string[] | undefined;
|
|
107
104
|
currentViewMode: ModeType;
|
|
108
105
|
currentSettingHash: string;
|
|
109
|
-
}) =>
|
|
110
|
-
key: string;
|
|
111
|
-
value: Record<string, any>;
|
|
112
|
-
} | undefined;
|
|
113
|
-
/**
|
|
114
|
-
* 获取表格键值
|
|
115
|
-
* @param tableId 表格ID
|
|
116
|
-
* @returns 返回格式化后的表格键值
|
|
117
|
-
*/
|
|
118
|
-
export declare const getTableKey: (tableId: string) => string;
|
|
106
|
+
}) => void;
|
|
119
107
|
/**
|
|
120
108
|
* 合并筛选设置
|
|
121
109
|
* @param list 列表数据
|
|
@@ -36,7 +36,6 @@ __export(utils_exports, {
|
|
|
36
36
|
getHash: () => getHash,
|
|
37
37
|
getIdByRowKey: () => getIdByRowKey,
|
|
38
38
|
getSettingKeyArrByMode: () => getSettingKeyArrByMode,
|
|
39
|
-
getTableKey: () => getTableKey,
|
|
40
39
|
getTableSettingByCurrentViewMode: () => getTableSettingByCurrentViewMode,
|
|
41
40
|
getTableSettingFromLocalStorage: () => getTableSettingFromLocalStorage,
|
|
42
41
|
groupDataSource: () => groupDataSource,
|
|
@@ -268,10 +267,6 @@ var setTableSettingToLocalStorage = ({
|
|
|
268
267
|
}
|
|
269
268
|
};
|
|
270
269
|
localStorage.setItem(getTableKey(tableId), JSON.stringify(newData));
|
|
271
|
-
return {
|
|
272
|
-
key: getTableKey(tableId),
|
|
273
|
-
value: newData
|
|
274
|
-
};
|
|
275
270
|
};
|
|
276
271
|
var clearTableSettingToLocalStorage = (tableId) => {
|
|
277
272
|
if (!tableId)
|
|
@@ -308,7 +303,7 @@ var setFormValuesToLocalStorage = ({
|
|
|
308
303
|
keys == null ? void 0 : keys.forEach((key) => {
|
|
309
304
|
obj[key] = allValues == null ? void 0 : allValues[key];
|
|
310
305
|
});
|
|
311
|
-
|
|
306
|
+
setTableSettingToLocalStorage({
|
|
312
307
|
tableId,
|
|
313
308
|
tableSettingObj: obj,
|
|
314
309
|
currentViewMode,
|
|
@@ -462,7 +457,6 @@ var stringify = (obj) => {
|
|
|
462
457
|
getHash,
|
|
463
458
|
getIdByRowKey,
|
|
464
459
|
getSettingKeyArrByMode,
|
|
465
|
-
getTableKey,
|
|
466
460
|
getTableSettingByCurrentViewMode,
|
|
467
461
|
getTableSettingFromLocalStorage,
|
|
468
462
|
groupDataSource,
|
|
@@ -24,19 +24,19 @@ __export(useGenScroll_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(useGenScroll_exports);
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
var useGenScroll = (params) => {
|
|
27
|
-
const { wrapHeight, scroll: propsScroll, columns
|
|
27
|
+
const { wrapHeight, scroll: propsScroll, columns } = params;
|
|
28
28
|
const scroll = (0, import_react.useMemo)(() => {
|
|
29
29
|
if (propsScroll == null ? void 0 : propsScroll.autoCalc) {
|
|
30
30
|
return {
|
|
31
31
|
x: (propsScroll == null ? void 0 : propsScroll.x) || columns.reduce((p, c) => {
|
|
32
32
|
return p + (c.width || 250);
|
|
33
33
|
}, 0) || 2e3,
|
|
34
|
-
y: (propsScroll == null ? void 0 : propsScroll.y) || Math.max(wrapHeight - 48 -
|
|
34
|
+
y: (propsScroll == null ? void 0 : propsScroll.y) || Math.max(wrapHeight - 48 - 50 - 24, 100),
|
|
35
35
|
scrollToFirstRowOnChange: propsScroll == null ? void 0 : propsScroll.scrollToFirstRowOnChange
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
return propsScroll;
|
|
39
|
-
}, [propsScroll, wrapHeight, columns
|
|
39
|
+
}, [propsScroll, wrapHeight, columns]);
|
|
40
40
|
return scroll;
|
|
41
41
|
};
|
|
42
42
|
var useGenScroll_default = useGenScroll;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
|
|
29
19
|
// src/components/table/hooks/useTableSetting.ts
|
|
@@ -34,9 +24,7 @@ __export(useTableSetting_exports, {
|
|
|
34
24
|
module.exports = __toCommonJS(useTableSetting_exports);
|
|
35
25
|
var import_react = require("react");
|
|
36
26
|
var import_utils = require("../Table/utils");
|
|
37
|
-
var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
|
|
38
27
|
var useTableSetting = (params) => {
|
|
39
|
-
var _a;
|
|
40
28
|
const {
|
|
41
29
|
tableId,
|
|
42
30
|
filter,
|
|
@@ -49,29 +37,27 @@ var useTableSetting = (params) => {
|
|
|
49
37
|
gallery,
|
|
50
38
|
currentSettingHash
|
|
51
39
|
} = params;
|
|
52
|
-
const context = (0, import_useEngineContext.default)();
|
|
53
|
-
const { isTerminal, interaction } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
|
|
54
40
|
const columnsMap = (0, import_react.useMemo)(() => {
|
|
55
41
|
return new Map(propsColumns.map((item) => [item.key, item]));
|
|
56
42
|
}, [propsColumns]);
|
|
57
43
|
const columns = (0, import_react.useMemo)(() => {
|
|
58
|
-
var
|
|
44
|
+
var _a;
|
|
59
45
|
if (currentViewMode === "grid") {
|
|
60
46
|
return propsColumns;
|
|
61
47
|
} else if (currentViewMode === "gallery") {
|
|
62
|
-
return (((
|
|
48
|
+
return (((_a = gallery == null ? void 0 : gallery.content) == null ? void 0 : _a.fields) || []).filter((item) => item.show).map((item) => columnsMap.get(item.columnKey)).filter(Boolean);
|
|
63
49
|
}
|
|
64
50
|
return propsColumns;
|
|
65
51
|
}, [propsColumns, currentViewMode, gallery, columnsMap]);
|
|
66
52
|
const { list, quickFilterMaxLength, sortButtonShow } = filter || {};
|
|
67
53
|
const defaultGalleryCoverSetting = (0, import_react.useMemo)(() => {
|
|
68
|
-
var
|
|
54
|
+
var _a, _b;
|
|
69
55
|
return {
|
|
70
|
-
coverObjectFit: (
|
|
56
|
+
coverObjectFit: (_a = gallery == null ? void 0 : gallery.cover) == null ? void 0 : _a.objectFit,
|
|
71
57
|
coverField: (_b = columns.find(
|
|
72
58
|
(column) => {
|
|
73
|
-
var
|
|
74
|
-
return column.key === ((_b2 = (
|
|
59
|
+
var _a2, _b2;
|
|
60
|
+
return column.key === ((_b2 = (_a2 = gallery == null ? void 0 : gallery.cover) == null ? void 0 : _a2.fields) == null ? void 0 : _b2[0]);
|
|
75
61
|
}
|
|
76
62
|
)) == null ? void 0 : _b.dataIndex,
|
|
77
63
|
compactMode: "default",
|
|
@@ -115,7 +101,7 @@ var useTableSetting = (params) => {
|
|
|
115
101
|
);
|
|
116
102
|
const mergedSetting = { ...allSetting, ...currentViewModeSetting };
|
|
117
103
|
localStorageSettingKeyArr.forEach((item) => {
|
|
118
|
-
var
|
|
104
|
+
var _a, _b, _c, _d;
|
|
119
105
|
if (item === "view_mode") {
|
|
120
106
|
setting[item] = view.multiple ? (mergedSetting == null ? void 0 : mergedSetting[item]) || view.defaultViewMode : view.defaultViewMode;
|
|
121
107
|
} else if (item === "filter_setting") {
|
|
@@ -136,7 +122,7 @@ var useTableSetting = (params) => {
|
|
|
136
122
|
setting[item] = {
|
|
137
123
|
...mergedSetting == null ? void 0 : mergedSetting[item],
|
|
138
124
|
// 本地没有默认封面效果时取配置中的
|
|
139
|
-
coverObjectFit: ((
|
|
125
|
+
coverObjectFit: ((_a = mergedSetting == null ? void 0 : mergedSetting[item]) == null ? void 0 : _a.coverObjectFit) || defaultGalleryCoverSetting.coverObjectFit,
|
|
140
126
|
coverField: ((_b = mergedSetting == null ? void 0 : mergedSetting[item]) == null ? void 0 : _b.coverField) || defaultGalleryCoverSetting.coverField,
|
|
141
127
|
compactMode: ((_c = mergedSetting == null ? void 0 : mergedSetting[item]) == null ? void 0 : _c.compactMode) || defaultGalleryCoverSetting.compactMode,
|
|
142
128
|
isShowLabel: ((_d = mergedSetting == null ? void 0 : mergedSetting[item]) == null ? void 0 : _d.isShowLabel) ?? defaultGalleryCoverSetting.isShowLabel
|
|
@@ -199,7 +185,7 @@ var useTableSetting = (params) => {
|
|
|
199
185
|
sortButtonShow
|
|
200
186
|
]);
|
|
201
187
|
const setTableSetting = (values) => {
|
|
202
|
-
|
|
188
|
+
(0, import_utils.setFormValuesToLocalStorage)({
|
|
203
189
|
tableId,
|
|
204
190
|
allValues: values,
|
|
205
191
|
keys: localStorageSettingKeyArr,
|
|
@@ -34,7 +34,7 @@ __export(VirtualKeyInput_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(VirtualKeyInput_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_antd = require("antd");
|
|
37
|
-
var
|
|
37
|
+
var import_icon = require("@pisell/icon");
|
|
38
38
|
var import_ahooks = require("ahooks");
|
|
39
39
|
var import_classnames = __toESM(require("classnames"));
|
|
40
40
|
var import_index = require("./index.less");
|
|
@@ -85,6 +85,6 @@ var VirtualKeyInput = (props) => {
|
|
|
85
85
|
readOnly: true,
|
|
86
86
|
value: previewValue
|
|
87
87
|
}
|
|
88
|
-
), (value == null ? void 0 : value.length) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "virtual-keyboard-input-delete", onClick: _onDelete }, /* @__PURE__ */ import_react.default.createElement(
|
|
88
|
+
), (value == null ? void 0 : value.length) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "virtual-keyboard-input-delete", onClick: _onDelete }, /* @__PURE__ */ import_react.default.createElement(import_icon.Delete, { className: "virtual-keyboard-input-delete-icon" })) : null);
|
|
89
89
|
};
|
|
90
90
|
var VirtualKeyInput_default = VirtualKeyInput;
|
package/lib/index.d.ts
CHANGED
|
@@ -72,7 +72,6 @@ export { default as List } from "./components/list";
|
|
|
72
72
|
export { default as Sort } from "./components/sort";
|
|
73
73
|
export { default as InputNumberRange } from "./components/input-number-range";
|
|
74
74
|
export { default as LowCodePage } from "./components/lowCodePage";
|
|
75
|
-
export { default as PickerView } from "./components/picker-view";
|
|
76
75
|
export { default as Segmented } from "./components/segmented";
|
|
77
76
|
export { default as VirtualKeyboard } from "./components/virtual-keyboard";
|
|
78
77
|
export { default as VirtualKeyboardTime } from "./components/virtual-keyboard/Time";
|