@pisell/materials 1.0.16 → 1.0.18

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.
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M8 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM8 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM8 20a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM16 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM16 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM16 20a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.707 4.293a1 1 0 0 1 0 1.414L7.414 11H19a1 1 0 1 1 0 2H7.414l5.293 5.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.293 4.293a1 1 0 0 1 1.414 0l7 7a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414-1.414L16.586 13H5a1 1 0 1 1 0-2h11.586l-5.293-5.293a1 1 0 0 1 0-1.414Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M2 6a1 1 0 0 1 1-1h18a1 1 0 1 1 0 2H3a1 1 0 0 1-1-1Zm3 6a1 1 0 0 1 1-1h12a1 1 0 1 1 0 2H6a1 1 0 0 1-1-1Zm3 6a1 1 0 0 1 1-1h6a1 1 0 1 1 0 2H9a1 1 0 0 1-1-1Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18ZM1 12C1 5.925 5.925 1 12 1s11 4.925 11 11-4.925 11-11 11S1 18.075 1 12Zm11.258-3.976a2 2 0 0 0-2.225 1.308 1 1 0 1 1-1.886-.664 4 4 0 0 1 7.773 1.333c0 1.53-1.135 2.54-1.945 3.081a8.044 8.044 0 0 1-1.686.848l-.035.013-.011.003-.004.002h-.002L11.92 13l.316.949a1 1 0 0 1-.633-1.897l.016-.006.074-.027a6.051 6.051 0 0 0 1.172-.6c.69-.46 1.055-.95 1.055-1.419v-.001a2 2 0 0 0-1.662-1.975ZM11 17a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg width="24" height="24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M6.293 3.293a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L8 6.414V20a1 1 0 1 1-2 0V6.414L3.707 8.707a1 1 0 0 1-1.414-1.414l4-4ZM16 17.586V4a1 1 0 1 1 2 0v13.586l2.293-2.293a1 1 0 0 1 1.414 1.414l-4 4a1 1 0 0 1-1.414 0l-4-4a1 1 0 0 1 1.414-1.414L16 17.586Z"/></svg>
@@ -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
package/es/index.d.ts CHANGED
@@ -43,7 +43,6 @@ export { default as Checkbox } from './components/checkbox';
43
43
  export { default as Button } from './components/button';
44
44
  export { default as Radio } from './components/radio';
45
45
  export { default as Upload } from './components/upload';
46
- export { default as Icon } from './components/icon';
47
46
  export { default as Form } from './components/form';
48
47
  export { default as Dropdown } from './components/dropdown';
49
48
  export { default as Calendar } from './components/calendar';
package/es/index.js CHANGED
@@ -68,7 +68,9 @@ export { default as Checkbox } from "./components/checkbox";
68
68
  export { default as Button } from "./components/button";
69
69
  export { default as Radio } from "./components/radio";
70
70
  export { default as Upload } from "./components/upload";
71
- export { default as Icon } from "./components/icon";
71
+
72
+ // export { default as Icon } from './components/icon';
73
+
72
74
  export { default as Form } from "./components/form";
73
75
  export { default as Dropdown } from "./components/dropdown";
74
76
  export { default as Calendar } from "./components/calendar";
@@ -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
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Form, { form, layout: "vertical", onValuesChange }, /* @__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 })));
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/lib/index.d.ts CHANGED
@@ -43,7 +43,6 @@ export { default as Checkbox } from './components/checkbox';
43
43
  export { default as Button } from './components/button';
44
44
  export { default as Radio } from './components/radio';
45
45
  export { default as Upload } from './components/upload';
46
- export { default as Icon } from './components/icon';
47
46
  export { default as Form } from './components/form';
48
47
  export { default as Dropdown } from './components/dropdown';
49
48
  export { default as Calendar } from './components/calendar';
package/lib/index.js CHANGED
@@ -54,7 +54,6 @@ __export(src_exports, {
54
54
  Empty: () => import_antd13.Empty,
55
55
  Form: () => import_form.default,
56
56
  Grid: () => import_antd14.Grid,
57
- Icon: () => import_icon.default,
58
57
  Image: () => import_antd15.Image,
59
58
  Input: () => import_input.default,
60
59
  InputNumber: () => import_antd16.InputNumber,
@@ -140,7 +139,6 @@ var import_checkbox = __toESM(require("./components/checkbox"));
140
139
  var import_button = __toESM(require("./components/button"));
141
140
  var import_radio = __toESM(require("./components/radio"));
142
141
  var import_upload = __toESM(require("./components/upload"));
143
- var import_icon = __toESM(require("./components/icon"));
144
142
  var import_form = __toESM(require("./components/form"));
145
143
  var import_dropdown = __toESM(require("./components/dropdown"));
146
144
  var import_calendar = __toESM(require("./components/calendar"));
@@ -186,7 +184,6 @@ var import_page = __toESM(require("./components/page"));
186
184
  Empty,
187
185
  Form,
188
186
  Grid,
189
- Icon,
190
187
  Image,
191
188
  Input,
192
189
  InputNumber,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -35,7 +35,8 @@
35
35
  "package.json",
36
36
  "README.md",
37
37
  "build",
38
- "lowcode"
38
+ "lowcode",
39
+ "dist"
39
40
  ],
40
41
  "dependencies": {
41
42
  "antd": "^5.6.3",
@@ -61,7 +62,8 @@
61
62
  },
62
63
  "scripts": {
63
64
  "dev": "father dev",
64
- "build": "father build && build-scripts build --config ./build.lowcode.js",
65
- "lowcode:dev": "build-scripts start --config ./build.lowcode.js"
65
+ "build": "ANALYZE=1 father build",
66
+ "lowcode:dev": "build-scripts start --config ./build.lowcode.js",
67
+ "lowcode:build": " build-scripts build --config ./build.lowcode.js"
66
68
  }
67
69
  }