@pisell/materials 1.0.26 → 1.0.28

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.
Files changed (58) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +142 -142
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +159 -11
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +155 -7
  11. package/dist/umd/materials.min.css +1 -1
  12. package/dist/umd/materials.min.js +1 -1
  13. package/es/components/Pagination/index.less +8 -1
  14. package/es/components/date-picker/index.d.ts.map +1 -1
  15. package/es/components/date-picker/index.js +1 -0
  16. package/es/components/page/index.d.ts.map +1 -1
  17. package/es/components/page/index.js +156 -72
  18. package/es/components/table/Actions/Filter/FilterItem/index.js +3 -2
  19. package/es/components/table/Actions/Sort/index.d.ts +3 -3
  20. package/es/components/table/Actions/Sort/index.d.ts.map +1 -1
  21. package/es/components/table/Actions/Sort/index.js +53 -17
  22. package/es/components/table/Actions/index.d.ts.map +1 -1
  23. package/es/components/table/Actions/index.js +5 -5
  24. package/es/components/table/Actions/index.less +2 -0
  25. package/es/components/table/BasicTable/index.d.ts.map +1 -1
  26. package/es/components/table/BasicTable/index.js +11 -2
  27. package/es/components/table/Table/fields/rangePicker/Edit/index.d.ts.map +1 -1
  28. package/es/components/table/Table/fields/rangePicker/Edit/index.js +13 -3
  29. package/es/components/table/Table/index.js +4 -4
  30. package/es/components/table/Table/tableConfig/body/CellContent/index.less +0 -1
  31. package/es/components/table/Table/tableConfig/body/CellProvider/index.less +0 -3
  32. package/es/components/table/index.js +2 -2
  33. package/es/components/table/model.js +1 -1
  34. package/lib/components/Pagination/index.less +8 -1
  35. package/lib/components/date-picker/index.d.ts.map +1 -1
  36. package/lib/components/page/index.d.ts.map +1 -1
  37. package/lib/components/page/index.js +147 -72
  38. package/lib/components/table/Actions/Filter/FilterItem/index.js +2 -2
  39. package/lib/components/table/Actions/Sort/index.d.ts +3 -3
  40. package/lib/components/table/Actions/Sort/index.d.ts.map +1 -1
  41. package/lib/components/table/Actions/Sort/index.js +47 -2
  42. package/lib/components/table/Actions/index.d.ts.map +1 -1
  43. package/lib/components/table/Actions/index.js +2 -2
  44. package/lib/components/table/Actions/index.less +2 -0
  45. package/lib/components/table/BasicTable/index.d.ts.map +1 -1
  46. package/lib/components/table/BasicTable/index.js +10 -1
  47. package/lib/components/table/Table/fields/rangePicker/Edit/index.d.ts.map +1 -1
  48. package/lib/components/table/Table/fields/rangePicker/Edit/index.js +6 -1
  49. package/lib/components/table/Table/index.js +4 -4
  50. package/lib/components/table/Table/tableConfig/body/CellContent/index.less +0 -1
  51. package/lib/components/table/Table/tableConfig/body/CellProvider/index.less +0 -3
  52. package/lib/components/table/index.js +2 -2
  53. package/lib/components/table/model.js +1 -1
  54. package/lowcode/table/meta.ts +63 -0
  55. package/package.json +2 -1
  56. package/dist/umd/static/DotsSix.57d66266.svg +0 -1
  57. package/dist/umd/static/filter-lines.04a54ae9.svg +0 -1
  58. package/dist/umd/static/help-circle.31c9be40.svg +0 -1
@@ -34,89 +34,164 @@ __export(page_exports, {
34
34
  module.exports = __toCommonJS(page_exports);
35
35
  var import_react = __toESM(require("react"));
36
36
  var import_config_provider = __toESM(require("../config-provider"));
37
+ var import_AdapterDayjs = require("@pisell/date-picker/es/AdapterDayjs");
38
+ var import_date_picker = require("@pisell/date-picker");
37
39
  var theme = {
38
- components: {
39
- Table: {
40
- colorFillContent: "rgba(0, 0, 0, 0.06)",
41
- colorFillSecondary: "rgba(0, 0, 0, 0.06)",
42
- colorBorderSecondary: "#EAECF0",
43
- colorFillAlter: "rgba(0, 0, 0, 0.02)"
40
+ "components": {
41
+ "Table": {
42
+ "colorFillContent": "#EAECF0",
43
+ "colorFillSecondary": "#F2F4F7",
44
+ "colorBorderSecondary": "#EAECF0",
45
+ "colorFillAlter": "#F9FAFB",
46
+ "controlItemBgHover": "#F9FAFB",
47
+ "colorTextHeading": "#475467",
48
+ "colorTextDescription": "#667085",
49
+ "colorText": "#101828",
50
+ "controlHeight": 32,
51
+ "padding": 24,
52
+ "margin": 16
53
+ },
54
+ "Button": {
55
+ "borderRadiusSM": 6,
56
+ "borderRadiusLG": 9,
57
+ "borderRadius": 8,
58
+ "controlHeight": 36,
59
+ "colorBgContainerDisabled": "#F2F4F7",
60
+ "colorBgTextHover": "#F9FAFB",
61
+ "colorBorder": "#D0D5DD",
62
+ "colorError": "#D92D20",
63
+ "colorErrorActive": "#D92D20",
64
+ "colorErrorHover": "#B42318",
65
+ "colorErrorBg": "#FEF3F2",
66
+ "colorErrorBorderHover": "#FDA29B",
67
+ "colorErrorOutline": "rgba(217, 45, 32, 0.06)",
68
+ "colorLink": "#175CD3",
69
+ "colorLinkActive": "#194185",
70
+ "colorLinkHover": "#1849A9",
71
+ "colorPrimaryActive": "#7f56d9",
72
+ "colorPrimaryBorder": "#E9D7FE",
73
+ "colorText": "#344054",
74
+ "colorTextDisabled": "#D0D5DD",
75
+ "colorTextLightSolid": "#fff",
76
+ "colorBgTextActive": "#D0D5DD",
77
+ "controlOutline": "rgba(127, 86, 217, 0.04)",
78
+ "controlTmpOutline": "#F9FAFB",
79
+ "paddingContentHorizontal": 14,
80
+ "marginXS": 8
81
+ },
82
+ "Divider": {
83
+ "colorSplit": "#EAECF0"
84
+ },
85
+ "Breadcrumb": {
86
+ "itemColor": "#475467",
87
+ "colorTextDescription": "#475467",
88
+ "lastItemColor": "#6941C6",
89
+ "separatorMargin": 12,
90
+ "separatorColor": "#D0D5DD",
91
+ "linkHoverColor": "#1D2939",
92
+ "linkColor": "#475467",
93
+ "colorBgTextHover": "#F9FAFB",
94
+ "paddingXXS": 8
95
+ },
96
+ "Dropdown": {
97
+ "borderRadiusLG": 8,
98
+ // "boxShadowPopoverArrow": "2px 2px 5px rgba(0, 0, 0, 0.05)",
99
+ "controlHeight": 42,
100
+ "fontSize": 14
101
+ },
102
+ "DatePicker": {
103
+ "borderRadius": 8,
104
+ "colorTextPlaceholder": "#667085",
105
+ "colorIcon": "#667085",
106
+ "colorTextQuaternary": "#D0D5DD",
107
+ "colorBgContainerDisabled": "#F9FAFB",
108
+ "colorTextDisabled": "#98A2B3"
44
109
  }
45
110
  },
46
- token: {
47
- colorPrimary: "#7F56D9",
48
- colorPrimaryBg: "#F9F5FF",
49
- colorPrimaryBgHover: "#F4EBFF",
50
- colorPrimaryBorder: "#E9D7FE",
51
- colorPrimaryBorderHover: "#D6BBFB",
52
- colorPrimaryHover: "#6941C6",
53
- colorPrimaryActive: "#53389E",
54
- colorPrimaryTextHover: "#53389E",
55
- colorPrimaryText: "#6941C6",
56
- colorPrimaryTextActive: "#42307D",
57
- colorSuccess: "#079455",
58
- colorSuccessBg: "#ECFDF3",
59
- colorSuccessBgHover: "#DCFAE6",
60
- colorSuccessBorder: "#ABEFC6",
61
- colorSuccessBorderHover: "#75E0A7",
62
- colorSuccessHover: "#067647",
63
- colorSuccessText: "#067647",
64
- colorSuccessActive: "#085D3A",
65
- colorSuccessTextHover: "#085D3A",
66
- colorSuccessTextActive: "#074D31",
67
- colorWarning: "#dc6803",
68
- colorWarningBg: "#FFFAEB",
69
- colorWarningBgHover: "#FEF0C7",
70
- colorWarningBorder: "#FEDF89",
71
- colorWarningBorderHover: "#FEC84B",
72
- colorWarningHover: "#B54708",
73
- colorWarningText: "#B54708",
74
- colorWarningActive: "#93370D",
75
- colorWarningTextHover: "#93370D",
76
- colorWarningTextActive: "#7A2E0E",
77
- colorError: "#d92d20",
78
- colorErrorBg: "#FEF3F2",
79
- colorErrorBgHover: "#FEE4E2",
80
- colorErrorBorder: "#FECDCA",
81
- colorErrorBorderHover: "#FDA29B",
82
- colorErrorHover: "#B42318",
83
- colorErrorText: "#B42318",
84
- colorErrorActive: "#912018",
85
- colorErrorTextHover: "#912018",
86
- colorErrorTextActive: "#7A271A",
87
- colorInfo: "#1570ef",
88
- colorInfoBg: "#EFF8FF",
89
- colorInfoBgHover: "#D1E9FF",
90
- colorInfoBorder: "#B2DDFF",
91
- colorInfoBorderHover: "#84CAFF",
92
- colorInfoHover: "#175CD3",
93
- colorInfoText: "#175CD3",
94
- colorInfoActive: "#1849A9",
95
- colorInfoTextHover: "#1849A9",
96
- colorInfoTextActive: "#194185",
97
- colorText: "#101828",
98
- colorTextSecondary: "#475467",
99
- colorTextTertiary: "#667085",
100
- colorTextQuaternary: "#D0D5DD",
101
- colorBorder: "#D0D5DD",
102
- colorBorderSecondary: "#EAECF0",
103
- colorFill: "#D0D5DD",
104
- colorFillSecondary: "#EAECF0",
105
- colorFillTertiary: "#F2F4F7",
106
- colorFillQuaternary: "#F9FAFB",
107
- colorBgLayout: "#F2F4F7",
108
- colorBgSpotlight: "#101828",
109
- colorBgMask: "rgba(0, 0, 0, 0.5)"
111
+ "token": {
112
+ "colorPrimary": "#7F56D9",
113
+ "colorPrimaryBg": "#F9F5FF",
114
+ "colorPrimaryBgHover": "#F4EBFF",
115
+ "colorPrimaryBorder": "#E9D7FE",
116
+ "colorPrimaryBorderHover": "#D6BBFB",
117
+ "colorPrimaryHover": "#6941C6",
118
+ "colorPrimaryActive": "#53389E",
119
+ "colorPrimaryTextHover": "#53389E",
120
+ "colorPrimaryText": "#6941C6",
121
+ "colorPrimaryTextActive": "#42307D",
122
+ "colorSuccess": "#079455",
123
+ "colorSuccessBg": "#ECFDF3",
124
+ "colorSuccessBgHover": "#DCFAE6",
125
+ "colorSuccessBorder": "#ABEFC6",
126
+ "colorSuccessBorderHover": "#75E0A7",
127
+ "colorSuccessHover": "#067647",
128
+ "colorSuccessText": "#067647",
129
+ "colorSuccessActive": "#085D3A",
130
+ "colorSuccessTextHover": "#085D3A",
131
+ "colorSuccessTextActive": "#074D31",
132
+ "colorWarning": "#dc6803",
133
+ "colorWarningBg": "#FFFAEB",
134
+ "colorWarningBgHover": "#FEF0C7",
135
+ "colorWarningBorder": "#FEDF89",
136
+ "colorWarningBorderHover": "#FEC84B",
137
+ "colorWarningHover": "#B54708",
138
+ "colorWarningText": "#B54708",
139
+ "colorWarningActive": "#93370D",
140
+ "colorWarningTextHover": "#93370D",
141
+ "colorWarningTextActive": "#7A2E0E",
142
+ "colorError": "#d92d20",
143
+ "colorErrorBg": "#FEF3F2",
144
+ "colorErrorBgHover": "#FEE4E2",
145
+ "colorErrorBorder": "#FECDCA",
146
+ "colorErrorBorderHover": "#FDA29B",
147
+ "colorErrorHover": "#B42318",
148
+ "colorErrorText": "#B42318",
149
+ "colorErrorActive": "#912018",
150
+ "colorErrorTextHover": "#912018",
151
+ "colorErrorTextActive": "#7A271A",
152
+ "colorInfo": "#1570ef",
153
+ "colorInfoBg": "#EFF8FF",
154
+ "colorInfoBgHover": "#D1E9FF",
155
+ "colorInfoBorder": "#B2DDFF",
156
+ "colorInfoBorderHover": "#84CAFF",
157
+ "colorInfoHover": "#175CD3",
158
+ "colorInfoText": "#175CD3",
159
+ "colorInfoActive": "#1849A9",
160
+ "colorInfoTextHover": "#1849A9",
161
+ "colorInfoTextActive": "#194185",
162
+ "colorText": "#101828",
163
+ "colorTextSecondary": "#475467",
164
+ "colorTextTertiary": "#667085",
165
+ "colorTextQuaternary": "#D0D5DD",
166
+ "colorBorder": "#D0D5DD",
167
+ "colorBorderSecondary": "#EAECF0",
168
+ "colorFill": "#D0D5DD",
169
+ "colorFillSecondary": "#EAECF0",
170
+ "colorFillTertiary": "#F2F4F7",
171
+ "colorFillQuaternary": "#F9FAFB",
172
+ "colorBgLayout": "#F2F4F7",
173
+ "colorBgSpotlight": "#101828",
174
+ "colorBgMask": "rgba(0, 0, 0, 0.5)",
175
+ "wireframe": false,
176
+ "borderRadius": 8
110
177
  }
111
178
  };
179
+ var _a;
180
+ var datePickerTheme = (0, import_date_picker.createTheme)({
181
+ palette: {
182
+ primary: { main: ((_a = theme.token) == null ? void 0 : _a.colorPrimary) || "#7F56D9" }
183
+ }
184
+ });
112
185
  var Page = (props) => {
186
+ const { children, ...others } = props;
113
187
  return /* @__PURE__ */ import_react.default.createElement(
114
188
  import_config_provider.default,
115
189
  {
116
- ...props,
190
+ ...others,
117
191
  prefixCls: props.prefixCls || "pisell-lowcode",
118
192
  theme: props.theme || theme
119
- }
193
+ },
194
+ /* @__PURE__ */ import_react.default.createElement(import_date_picker.LocalizationProvider, { dateAdapter: import_AdapterDayjs.AdapterDayjs }, /* @__PURE__ */ import_react.default.createElement(import_date_picker.ThemeProvider, { theme: datePickerTheme }, children))
120
195
  );
121
196
  };
122
197
  var page_default = Page;
@@ -37,11 +37,11 @@ var import_antd = require("antd");
37
37
  var import_fields = require("../../../Table/fields");
38
38
  var import_index = require("./index.less");
39
39
  var FilterItem = (props) => {
40
- const { label, type, name } = props;
40
+ const { label, type, name, other } = props;
41
41
  const Com = (0, import_react.useMemo)(() => {
42
42
  var _a;
43
43
  return (_a = import_fields.fieldMaps[type]) == null ? void 0 : _a.edit;
44
44
  }, [type]);
45
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label, name }, /* @__PURE__ */ import_react.default.createElement(Com, null));
45
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label, name }, /* @__PURE__ */ import_react.default.createElement(Com, { ...other }));
46
46
  };
47
47
  var FilterItem_default = FilterItem;
@@ -1,12 +1,12 @@
1
1
  import React from "react";
2
2
  export declare type SortItemProps = {
3
- type: "single" | "input";
3
+ type: "date" | "string" | "number";
4
+ label: string;
4
5
  name: string;
5
- props: object;
6
- title: string;
7
6
  };
8
7
  declare type SortListProps = {
9
8
  list: SortItemProps[];
9
+ onChange?: (val: string) => void;
10
10
  };
11
11
  declare const Sort: React.FC<SortListProps>;
12
12
  export default Sort;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC,oBAAY,aAAa,GAAG;IAC3B,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,aAAK,aAAa,GAAG;IACpB,IAAI,EAAE,aAAa,EAAE,CAAC;CACtB,CAAC;AAaF,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAEjC,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC,oBAAY,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,aAAK,aAAa,GAAG;IACnB,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC;AAmCF,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAoBjC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -35,7 +35,52 @@ module.exports = __toCommonJS(Sort_exports);
35
35
  var import_react = __toESM(require("react"));
36
36
  var import_antd = require("antd");
37
37
  var import_icon = require("@pisell/icon");
38
- var Sort = ({ list = [] }) => {
39
- return /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { icon: /* @__PURE__ */ import_react.default.createElement(import_icon.SwitchVertical01, null) }, "Sort");
38
+ var sortChildrenMap = {
39
+ date: (key) => [
40
+ {
41
+ key: `${key}:desc`,
42
+ label: "Oldest to newest"
43
+ },
44
+ {
45
+ key: `${key}:asc`,
46
+ label: "Newest to oldest"
47
+ }
48
+ ],
49
+ string: (key) => [
50
+ {
51
+ key: `${key}:asc`,
52
+ label: "A to Z"
53
+ },
54
+ {
55
+ key: `${key}:desc`,
56
+ label: "Z to A"
57
+ }
58
+ ],
59
+ number: (key) => [
60
+ {
61
+ key: `${key}:asc`,
62
+ label: "Lowest to highest"
63
+ },
64
+ {
65
+ key: `${key}:desc`,
66
+ label: "Highest to lowest"
67
+ }
68
+ ]
69
+ };
70
+ var Sort = ({ list = [], onChange }) => {
71
+ const sortItems = (0, import_react.useMemo)(() => {
72
+ return list.map((d) => {
73
+ return {
74
+ key: d.name,
75
+ label: d.label,
76
+ children: sortChildrenMap[d.type](d.name)
77
+ };
78
+ });
79
+ }, [list]);
80
+ const onClick = (detail) => {
81
+ var _a;
82
+ onChange == null ? void 0 : onChange((_a = detail == null ? void 0 : detail.keyPath) == null ? void 0 : _a[0]);
83
+ };
84
+ return /* @__PURE__ */ import_react.default.createElement(import_antd.Dropdown, { menu: { items: sortItems, onClick } }, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { icon: /* @__PURE__ */ import_react.default.createElement(import_icon.SwitchVertical01, null) }, "Sort"));
40
85
  };
41
86
  var Sort_default = Sort;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAEtB,QAAA,MAAM,OAAO,qBAAsB,GAAG,uBAerC,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAKA,OAAO,cAAc,CAAC;AAEtB,QAAA,MAAM,OAAO,qBAAsB,GAAG,uBAmBrC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -33,7 +33,7 @@ __export(Actions_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(Actions_exports);
35
35
  var import_react = __toESM(require("react"));
36
- var import_Filter = __toESM(require("./Filter"));
36
+ var import_antd = require("antd");
37
37
  var import_QuickFilter = __toESM(require("./Filter/QuickFilter"));
38
38
  var import_Sort = __toESM(require("./Sort"));
39
39
  var import_index = require("./index.less");
@@ -41,6 +41,6 @@ var Actions = ({ filter, sort }) => {
41
41
  const showActions = (0, import_react.useMemo)(() => {
42
42
  return (filter == null ? void 0 : filter.show) || (sort == null ? void 0 : sort.show);
43
43
  }, [filter == null ? void 0 : filter.show, sort == null ? void 0 : sort.show]);
44
- 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(import_QuickFilter.default, null)), /* @__PURE__ */ import_react.default.createElement("div", { className: "right-wrap" }, (filter == null ? void 0 : filter.show) ? /* @__PURE__ */ import_react.default.createElement(import_Filter.default, { list: (filter == null ? void 0 : filter.list) || [] }) : null, (sort == null ? void 0 : sort.show) ? /* @__PURE__ */ import_react.default.createElement(import_Sort.default, { list: (sort == null ? void 0 : sort.list) || [] }) : null)) : null;
44
+ 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(import_QuickFilter.default, null)), /* @__PURE__ */ import_react.default.createElement("div", { className: "right-wrap" }, (sort == null ? void 0 : sort.show) ? /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "order_by" }, /* @__PURE__ */ import_react.default.createElement(import_Sort.default, { list: (sort == null ? void 0 : sort.list) || [] })) : null)) : null;
45
45
  };
46
46
  var Actions_default = Actions;
@@ -3,11 +3,13 @@
3
3
  align-items: center;
4
4
  justify-content: space-between;
5
5
  margin-bottom: 16px;
6
+ gap: 16px;
6
7
 
7
8
  .left-wrap {
8
9
  flex: 1;
9
10
  display: flex;
10
11
  align-items: center;
12
+
11
13
  .pisell-lowcode-form-item {
12
14
  margin-bottom: 0;
13
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,MAAM,CAAC;AAIzC,QAAA,MAAM,UAAU,UAAW,WAAW,GAAG,CAAC,gBA8DzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAS,UAAU,EAAE,MAAM,MAAM,CAAC;AAIzC,QAAA,MAAM,UAAU,UAAW,WAAW,GAAG,CAAC,gBAyEzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -36,12 +36,20 @@ var import_antd = require("antd");
36
36
  var import_react = __toESM(require("react"));
37
37
  var import_Pagination = __toESM(require("../../Pagination"));
38
38
  var BasicTable = (props) => {
39
+ var _a;
39
40
  const { dataSource, pagination, ...other } = props;
40
41
  const [currentPage, setCurrentPage] = (0, import_react.useState)(1);
41
42
  const [pageSize, setPageSize] = (0, import_react.useState)(10);
43
+ const { showTotal } = pagination;
44
+ const _showTotal = (0, import_react.useCallback)((total2, range) => {
45
+ return showTotal(total2, range, pageSize);
46
+ }, [showTotal, pageSize, currentPage]);
42
47
  (0, import_react.useEffect)(() => {
43
48
  setCurrentPage(1);
44
49
  }, [dataSource]);
50
+ (0, import_react.useEffect)(() => {
51
+ (pagination == null ? void 0 : pagination.pageSize) && setPageSize(pagination == null ? void 0 : pagination.pageSize);
52
+ }, [pagination.pageSize]);
45
53
  const _dataSource = (0, import_react.useMemo)(() => {
46
54
  let list = (dataSource == null ? void 0 : dataSource.list) || [];
47
55
  let total2 = (dataSource == null ? void 0 : dataSource.total) || 0;
@@ -62,10 +70,11 @@ var BasicTable = (props) => {
62
70
  setCurrentPage(page);
63
71
  setPageSize(pageSize2);
64
72
  };
65
- return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_antd.Table, { ...other, pagination: false, dataSource: _dataSource == null ? void 0 : _dataSource.list }), total > pageSize ? /* @__PURE__ */ import_react.default.createElement(
73
+ return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_antd.Table, { ...other, pagination: false, dataSource: _dataSource == null ? void 0 : _dataSource.list }), total > (((_a = pagination == null ? void 0 : pagination.pageSizeOptions) == null ? void 0 : _a[0]) || 10) ? /* @__PURE__ */ import_react.default.createElement(
66
74
  import_Pagination.default,
67
75
  {
68
76
  ...pagination,
77
+ showTotal: _showTotal,
69
78
  current: currentPage,
70
79
  pageSize,
71
80
  onShowSizeChange: onPaginationChange,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;;AAuE5C,wBAAgC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;;AA4E5C,wBAAgC"}
@@ -46,7 +46,9 @@ var Edit = (props, ref) => {
46
46
  style,
47
47
  bordered,
48
48
  presets,
49
- showTime
49
+ showTime,
50
+ format,
51
+ ...others
50
52
  } = props;
51
53
  const dayjsVal = (0, import_react.useMemo)(() => {
52
54
  if ((0, import_utils.isString)(value)) {
@@ -62,6 +64,7 @@ var Edit = (props, ref) => {
62
64
  }, [value]);
63
65
  const rangePresets = [
64
66
  { label: "Today", value: [(0, import_dayjs.default)().startOf("day"), (0, import_dayjs.default)().endOf("day")] },
67
+ { label: "Yesterday", value: [(0, import_dayjs.default)().add(-1, "d").startOf("day"), (0, import_dayjs.default)().add(-1, "d").endOf("day")] },
65
68
  { label: "Last 3 Days", value: [(0, import_dayjs.default)().add(-3, "d").startOf("day"), (0, import_dayjs.default)().endOf("day")] },
66
69
  { label: "Last 7 Days", value: [(0, import_dayjs.default)().add(-7, "d").startOf("day"), (0, import_dayjs.default)().endOf("day")] },
67
70
  { label: "Last 14 Days", value: [(0, import_dayjs.default)().add(-14, "d").startOf("day"), (0, import_dayjs.default)().endOf("day")] },
@@ -77,6 +80,8 @@ var Edit = (props, ref) => {
77
80
  return /* @__PURE__ */ React.createElement(
78
81
  RangePicker,
79
82
  {
83
+ ...others,
84
+ format,
80
85
  showTime: _showTime,
81
86
  presets: presets || rangePresets,
82
87
  ref,
@@ -99,14 +99,14 @@ var GridViewTable = ({ tableProps }) => {
99
99
  });
100
100
  }, [defaultColumns]);
101
101
  const showTotal = (0, import_react.useCallback)(
102
- (total, range) => {
102
+ (total, range, pageSize) => {
103
103
  let start = range[0] - 1;
104
- let _current = start / tableProps.pagination.pageSize + 1;
104
+ let _current = start / pageSize + 1;
105
105
  return `Page ${_current} of ${Math.ceil(
106
- total / tableProps.pagination.pageSize
106
+ total / pageSize
107
107
  )}`;
108
108
  },
109
- [tableProps.pagination.pageSize]
109
+ []
110
110
  );
111
111
  const _paginationConfig = (0, import_react.useMemo)(() => {
112
112
  if (tableProps.pagination === false) {
@@ -1,6 +1,5 @@
1
1
  .cell-provider {
2
2
  position: relative;
3
- // cursor: pointer;
4
3
  width: 100%;
5
4
  height: 100%;
6
5
  display: flex;
@@ -1,6 +1,4 @@
1
1
  .cell-provider {
2
- // position: relative;
3
- cursor: pointer;
4
2
  width: 100%;
5
3
  height: 100%;
6
4
  display: flex;
@@ -8,7 +6,6 @@
8
6
  justify-content: center;
9
7
  border-radius: 4px;
10
8
  padding: 12px;
11
- // cursor: pointer;
12
9
 
13
10
  &.focus {
14
11
  box-shadow: var(--theme-color) 0px 0px 0px 1px !important;
@@ -82,7 +82,7 @@ var GridView = (0, import_model.Provider)((props) => {
82
82
  });
83
83
  }, [filter]);
84
84
  const initialValues = (0, import_react.useMemo)(
85
- () => (filter.list || []).reduce(
85
+ () => ((filter == null ? void 0 : filter.list) || []).reduce(
86
86
  (p, c) => {
87
87
  var _a;
88
88
  return {
@@ -92,7 +92,7 @@ var GridView = (0, import_model.Provider)((props) => {
92
92
  },
93
93
  {}
94
94
  ),
95
- [filter.list]
95
+ [filter == null ? void 0 : filter.list]
96
96
  );
97
97
  return /* @__PURE__ */ import_react.default.createElement(
98
98
  import_antd.Form,
@@ -131,7 +131,7 @@ var { Provider, Context } = (0, import_miniRedux.default)({
131
131
  var formatColumn = (item) => {
132
132
  let _other = {
133
133
  editable: true,
134
- width: 200,
134
+ width: 100,
135
135
  field_type: "text",
136
136
  lock: true,
137
137
  ...item.other || {}
@@ -966,6 +966,69 @@ export default {
966
966
  setter: 'BoolSetter',
967
967
  defaultValue: true,
968
968
  },
969
+ {
970
+ name: "sort.list",
971
+ condition: {
972
+ type: 'JSFunction',
973
+ value: 'target => !!target.getProps().getPropValue("sort.show")',
974
+ },
975
+ setter: {
976
+ componentName: 'ArraySetter',
977
+ props: {
978
+ itemSetter: {
979
+ componentName: 'ObjectSetter',
980
+ props: {
981
+ config: {
982
+ items: [
983
+ {
984
+ name: 'label',
985
+ title: { label: '排序项', tip: '排序项展示文案' },
986
+ propType: 'string',
987
+ setter: 'StringSetter',
988
+ isRequired: true,
989
+ },
990
+ {
991
+ name: 'name',
992
+ title: { label: '字段', tip: '所排序的字段' },
993
+ propType: 'string',
994
+ setter: 'StringSetter',
995
+ isRequired: true,
996
+ },
997
+ {
998
+ name: 'type',
999
+ title: { label: '字段类型', tip: '所排序的字段类型' },
1000
+ propType: 'string',
1001
+ setter: {
1002
+ componentName: 'SelectSetter',
1003
+ mode: "single",
1004
+ defaultValue: "single",
1005
+ props: {
1006
+ options: [
1007
+ {
1008
+ title: '日期排序',
1009
+ value: 'date',
1010
+ },
1011
+ {
1012
+ title: '数字排序',
1013
+ value: 'number',
1014
+ },
1015
+ {
1016
+ title: 'a-z排序',
1017
+ value: 'string',
1018
+ },
1019
+ ],
1020
+ },
1021
+ },
1022
+ },
1023
+ ],
1024
+ },
1025
+ },
1026
+ initialValue: { label: '标题', name: "name", type: "date", },
1027
+ },
1028
+ },
1029
+ },
1030
+ }
1031
+
969
1032
  ]
970
1033
  },
971
1034
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -53,6 +53,7 @@
53
53
  "@dnd-kit/sortable": "^7.0.2",
54
54
  "@dnd-kit/utilities": "^3.2.1",
55
55
  "ahooks": "^3.7.6",
56
+ "@pisell/date-picker": "1.0.0",
56
57
  "@pisell/utils": "1.0.1",
57
58
  "@pisell/icon": "0.0.6"
58
59
  },
@@ -1 +0,0 @@
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>
@@ -1 +0,0 @@
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>
@@ -1 +0,0 @@
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>