@pisell/materials 1.0.16 → 1.0.17
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/meta.js +1 -1
- package/build/lowcode/render/default/view.js +3 -3
- package/build/lowcode/view.js +3 -3
- package/es/components/table/BasicTable/index.js +4 -1
- package/es/components/table/Table/fields/rangePicker/Edit/index.js +3 -0
- package/es/components/table/index.js +15 -2
- package/lib/components/table/BasicTable/index.js +3 -0
- package/lib/components/table/Table/fields/rangePicker/Edit/index.js +1 -0
- package/lib/components/table/index.js +23 -1
- package/package.json +4 -3
|
@@ -9,7 +9,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
9
9
|
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; }
|
|
10
10
|
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; }
|
|
11
11
|
import { Table } from "antd";
|
|
12
|
-
import React, { useState, useMemo } from "react";
|
|
12
|
+
import React, { useState, useMemo, useEffect } from "react";
|
|
13
13
|
import Pagination from "../../Pagination";
|
|
14
14
|
var BasicTable = function BasicTable(props) {
|
|
15
15
|
var dataSource = props.dataSource,
|
|
@@ -23,6 +23,9 @@ var BasicTable = function BasicTable(props) {
|
|
|
23
23
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
24
24
|
pageSize = _useState4[0],
|
|
25
25
|
setPageSize = _useState4[1];
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
setCurrentPage(1);
|
|
28
|
+
}, [dataSource]);
|
|
26
29
|
|
|
27
30
|
// 分割数据源
|
|
28
31
|
var _dataSource = useMemo(function () {
|
|
@@ -33,6 +33,9 @@ var Edit = function Edit(props, ref) {
|
|
|
33
33
|
return value;
|
|
34
34
|
}, [value]);
|
|
35
35
|
var rangePresets = [{
|
|
36
|
+
label: "Today",
|
|
37
|
+
value: [dayjs().startOf('day'), dayjs().endOf('day')]
|
|
38
|
+
}, {
|
|
36
39
|
label: "Last 3 Days",
|
|
37
40
|
value: [dayjs().add(-3, "d").startOf('day'), dayjs().endOf('day')]
|
|
38
41
|
}, {
|
|
@@ -1,4 +1,10 @@
|
|
|
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); }
|
|
1
2
|
var _excluded = ["dataSource", "columns", "dispatch", "style", "filter", "sort", "buttons", "title", "summary", "onValuesChange"];
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
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
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
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); }
|
|
2
8
|
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; }
|
|
3
9
|
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; }
|
|
4
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -7,7 +13,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
7
13
|
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
14
|
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
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
10
|
-
import React, { useEffect } from "react";
|
|
16
|
+
import React, { useEffect, useMemo } from "react";
|
|
11
17
|
import { Form } from "antd";
|
|
12
18
|
import Header from "./Header";
|
|
13
19
|
import Actions from "./Actions";
|
|
@@ -55,10 +61,17 @@ var GridView = Provider(function (props) {
|
|
|
55
61
|
payload: (filter === null || filter === void 0 ? void 0 : (_filter$list2 = filter.list) === null || _filter$list2 === void 0 ? void 0 : (_filter$list2$slice = _filter$list2.slice) === null || _filter$list2$slice === void 0 ? void 0 : _filter$list2$slice.call(_filter$list2, 3)) || []
|
|
56
62
|
});
|
|
57
63
|
}, [filter]);
|
|
64
|
+
var initialValues = useMemo(function () {
|
|
65
|
+
return (filter.list || []).reduce(function (p, c) {
|
|
66
|
+
var _c$other;
|
|
67
|
+
return _objectSpread(_objectSpread({}, p), {}, _defineProperty({}, c.name, c === null || c === void 0 ? void 0 : (_c$other = c.other) === null || _c$other === void 0 ? void 0 : _c$other.defaultValue));
|
|
68
|
+
}, {});
|
|
69
|
+
}, [filter.list]);
|
|
58
70
|
return /*#__PURE__*/React.createElement(Form, {
|
|
59
71
|
form: form,
|
|
60
72
|
layout: "vertical",
|
|
61
|
-
onValuesChange: onValuesChange
|
|
73
|
+
onValuesChange: onValuesChange,
|
|
74
|
+
initialValues: initialValues
|
|
62
75
|
}, /*#__PURE__*/React.createElement("div", {
|
|
63
76
|
className: "materials-grid",
|
|
64
77
|
style: style
|
|
@@ -39,6 +39,9 @@ var BasicTable = (props) => {
|
|
|
39
39
|
const { dataSource, pagination, ...other } = props;
|
|
40
40
|
const [currentPage, setCurrentPage] = (0, import_react.useState)(1);
|
|
41
41
|
const [pageSize, setPageSize] = (0, import_react.useState)(10);
|
|
42
|
+
(0, import_react.useEffect)(() => {
|
|
43
|
+
setCurrentPage(1);
|
|
44
|
+
}, [dataSource]);
|
|
42
45
|
const _dataSource = (0, import_react.useMemo)(() => {
|
|
43
46
|
let list = (dataSource == null ? void 0 : dataSource.list) || [];
|
|
44
47
|
let total2 = (dataSource == null ? void 0 : dataSource.total) || 0;
|
|
@@ -61,6 +61,7 @@ var Edit = (props, ref) => {
|
|
|
61
61
|
return value;
|
|
62
62
|
}, [value]);
|
|
63
63
|
const rangePresets = [
|
|
64
|
+
{ label: "Today", value: [(0, import_dayjs.default)().startOf("day"), (0, import_dayjs.default)().endOf("day")] },
|
|
64
65
|
{ label: "Last 3 Days", value: [(0, import_dayjs.default)().add(-3, "d").startOf("day"), (0, import_dayjs.default)().endOf("day")] },
|
|
65
66
|
{ label: "Last 7 Days", value: [(0, import_dayjs.default)().add(-7, "d").startOf("day"), (0, import_dayjs.default)().endOf("day")] },
|
|
66
67
|
{ label: "Last 14 Days", value: [(0, import_dayjs.default)().add(-14, "d").startOf("day"), (0, import_dayjs.default)().endOf("day")] },
|
|
@@ -81,6 +81,28 @@ var GridView = (0, import_model.Provider)((props) => {
|
|
|
81
81
|
payload: ((_d = (_c = filter == null ? void 0 : filter.list) == null ? void 0 : _c.slice) == null ? void 0 : _d.call(_c, 3)) || []
|
|
82
82
|
});
|
|
83
83
|
}, [filter]);
|
|
84
|
-
|
|
84
|
+
const initialValues = (0, import_react.useMemo)(
|
|
85
|
+
() => (filter.list || []).reduce(
|
|
86
|
+
(p, c) => {
|
|
87
|
+
var _a;
|
|
88
|
+
return {
|
|
89
|
+
...p,
|
|
90
|
+
[c.name]: (_a = c == null ? void 0 : c.other) == null ? void 0 : _a.defaultValue
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
{}
|
|
94
|
+
),
|
|
95
|
+
[filter.list]
|
|
96
|
+
);
|
|
97
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
98
|
+
import_antd.Form,
|
|
99
|
+
{
|
|
100
|
+
form,
|
|
101
|
+
layout: "vertical",
|
|
102
|
+
onValuesChange,
|
|
103
|
+
initialValues
|
|
104
|
+
},
|
|
105
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "materials-grid", style }, /* @__PURE__ */ import_react.default.createElement(import_Header.default, { title, buttons }), /* @__PURE__ */ import_react.default.createElement(import_Actions.default, { filter, sort }), /* @__PURE__ */ import_react.default.createElement(import_Summary.default, { summary }), /* @__PURE__ */ import_react.default.createElement(import_Table.default, { tableProps: other }))
|
|
106
|
+
);
|
|
85
107
|
});
|
|
86
108
|
var table_default = GridView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/materials",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"react": "^18.0.0",
|
|
15
15
|
"react-dom": "^18.0.0",
|
|
16
16
|
"@alib/build-scripts": "^0.1.32",
|
|
17
|
-
"@pisell/build-plugin-lowcode": "
|
|
17
|
+
"@pisell/build-plugin-lowcode": "1.0.3",
|
|
18
18
|
"@types/react": "^18.0.0",
|
|
19
19
|
"@types/react-dom": "^18.0.0",
|
|
20
20
|
"@alilc/lowcode-utils": "1.1.6",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"scripts": {
|
|
63
63
|
"dev": "father dev",
|
|
64
64
|
"build": "father build && build-scripts build --config ./build.lowcode.js",
|
|
65
|
-
"lowcode:dev": "build-scripts start --config ./build.lowcode.js"
|
|
65
|
+
"lowcode:dev": "build-scripts start --config ./build.lowcode.js",
|
|
66
|
+
"lowcode:build": " build-scripts build --config ./build.lowcode.js"
|
|
66
67
|
}
|
|
67
68
|
}
|