@pisell/materials 1.0.309 → 1.0.313

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 (103) 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 +2 -2
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +14 -14
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +14 -14
  11. package/es/components/Pagination/index.d.ts +1 -1
  12. package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +5 -0
  13. package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.js +137 -0
  14. package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.less +29 -0
  15. package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.d.ts +1 -0
  16. package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.js +86 -0
  17. package/es/components/table/Actions/component/ExportImport/components/ExportTable/index.d.ts +8 -0
  18. package/es/components/table/Actions/component/ExportImport/components/ExportTable/index.js +41 -0
  19. package/es/components/table/Actions/component/ExportImport/components/ExportTable/index.less +5 -0
  20. package/es/components/table/Actions/component/ExportImport/components/ImportLog/Detail.d.ts +4 -0
  21. package/es/components/table/Actions/component/ExportImport/components/ImportLog/Detail.js +97 -0
  22. package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +5 -0
  23. package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.js +131 -0
  24. package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.less +48 -0
  25. package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts +10 -0
  26. package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.js +147 -0
  27. package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.less +97 -0
  28. package/es/components/table/Actions/component/ExportImport/index.d.ts +8 -0
  29. package/es/components/table/Actions/component/ExportImport/index.js +216 -0
  30. package/es/components/table/Actions/component/ExportImport/index.less +194 -0
  31. package/es/components/table/Actions/component/ExportImport/utils/date.d.ts +8 -0
  32. package/es/components/table/Actions/component/ExportImport/utils/date.js +19 -0
  33. package/es/components/table/Actions/component/ExportImport/utils/download.d.ts +3 -0
  34. package/es/components/table/Actions/component/ExportImport/utils/download.js +39 -0
  35. package/es/components/table/Actions/component/ExportImport/utils/file.d.ts +7 -0
  36. package/es/components/table/Actions/component/ExportImport/utils/file.js +21 -0
  37. package/es/components/table/Actions/index.d.ts +3 -2
  38. package/es/components/table/Actions/index.js +12 -8
  39. package/es/components/table/hooks/useTableSetting.d.ts +2 -1
  40. package/es/components/table/hooks/useTableSetting.js +2 -1
  41. package/es/components/table/index.js +15 -13
  42. package/es/components/table/serve.d.ts +13 -0
  43. package/es/components/table/serve.js +55 -0
  44. package/es/components/table/status.d.ts +19 -0
  45. package/es/components/table/status.js +26 -0
  46. package/es/components/table/types.d.ts +20 -0
  47. package/es/components/table/utils.d.ts +15 -0
  48. package/es/components/table/utils.js +26 -0
  49. package/es/components/virtual-keyboard/Time/index.js +1 -1
  50. package/es/locales/en-US.d.ts +47 -0
  51. package/es/locales/en-US.js +60 -1
  52. package/es/locales/zh-CN.d.ts +47 -0
  53. package/es/locales/zh-CN.js +60 -1
  54. package/es/locales/zh-TW.d.ts +47 -0
  55. package/es/locales/zh-TW.js +60 -1
  56. package/lib/components/Pagination/index.d.ts +1 -1
  57. package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +5 -0
  58. package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.js +144 -0
  59. package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.less +29 -0
  60. package/lib/components/table/Actions/component/ExportImport/components/ExportTable/function.d.ts +1 -0
  61. package/lib/components/table/Actions/component/ExportImport/components/ExportTable/function.js +79 -0
  62. package/lib/components/table/Actions/component/ExportImport/components/ExportTable/index.d.ts +8 -0
  63. package/lib/components/table/Actions/component/ExportImport/components/ExportTable/index.js +60 -0
  64. package/lib/components/table/Actions/component/ExportImport/components/ExportTable/index.less +5 -0
  65. package/lib/components/table/Actions/component/ExportImport/components/ImportLog/Detail.d.ts +4 -0
  66. package/lib/components/table/Actions/component/ExportImport/components/ImportLog/Detail.js +117 -0
  67. package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +5 -0
  68. package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.js +135 -0
  69. package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.less +48 -0
  70. package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts +10 -0
  71. package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.js +119 -0
  72. package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.less +97 -0
  73. package/lib/components/table/Actions/component/ExportImport/index.d.ts +8 -0
  74. package/lib/components/table/Actions/component/ExportImport/index.js +194 -0
  75. package/lib/components/table/Actions/component/ExportImport/index.less +194 -0
  76. package/lib/components/table/Actions/component/ExportImport/utils/date.d.ts +8 -0
  77. package/lib/components/table/Actions/component/ExportImport/utils/date.js +49 -0
  78. package/lib/components/table/Actions/component/ExportImport/utils/download.d.ts +3 -0
  79. package/lib/components/table/Actions/component/ExportImport/utils/download.js +62 -0
  80. package/lib/components/table/Actions/component/ExportImport/utils/file.d.ts +7 -0
  81. package/lib/components/table/Actions/component/ExportImport/utils/file.js +55 -0
  82. package/lib/components/table/Actions/index.d.ts +3 -2
  83. package/lib/components/table/Actions/index.js +11 -7
  84. package/lib/components/table/hooks/useTableSetting.d.ts +2 -1
  85. package/lib/components/table/hooks/useTableSetting.js +2 -1
  86. package/lib/components/table/index.js +14 -12
  87. package/lib/components/table/serve.d.ts +13 -0
  88. package/lib/components/table/serve.js +55 -0
  89. package/lib/components/table/status.d.ts +19 -0
  90. package/lib/components/table/status.js +55 -0
  91. package/lib/components/table/types.d.ts +20 -0
  92. package/lib/components/table/utils.d.ts +15 -0
  93. package/lib/components/table/utils.js +40 -0
  94. package/lib/components/virtual-keyboard/Time/index.js +1 -1
  95. package/lib/locales/en-US.d.ts +47 -0
  96. package/lib/locales/en-US.js +52 -1
  97. package/lib/locales/zh-CN.d.ts +47 -0
  98. package/lib/locales/zh-CN.js +52 -1
  99. package/lib/locales/zh-TW.d.ts +47 -0
  100. package/lib/locales/zh-TW.js +52 -1
  101. package/lowcode/table/meta.ts +84 -1
  102. package/lowcode/table/snippets.ts +8 -0
  103. package/package.json +4 -4
@@ -0,0 +1,194 @@
1
+ .export-import-modal{
2
+ .pisell-lowcode-modal-header{
3
+ padding: 0 0 6px 0!important;
4
+ }
5
+
6
+ .pisell-lowcode-table-content{
7
+ .pisell-lowcode-table-cell{
8
+ padding: 16px!important;
9
+ }
10
+ }
11
+ }
12
+
13
+ .goods-list-page {
14
+ padding: 0 30px;
15
+
16
+ .header {
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: space-between;
20
+ padding: 22px 0;
21
+ font-size: 20px;
22
+ font-weight: 650;
23
+ line-height: 28px;
24
+ color: #252a2d;
25
+
26
+ .action-list {
27
+ display: flex;
28
+ align-items: center;
29
+ min-height: 40px;
30
+
31
+ .import-btn,
32
+ .export-btn {
33
+ height: 28px;
34
+ font-size: 14px;
35
+ font-weight: 650;
36
+ line-height: 28px;
37
+ color: #252a2d;
38
+ cursor: pointer;
39
+ }
40
+ }
41
+ }
42
+
43
+ .content {
44
+ padding: 20px 0;
45
+ background: #ffffff;
46
+ border-radius: var(--small-border-radius);
47
+
48
+ .search-wrap {
49
+ width: 100%;
50
+ box-sizing: border-box;
51
+ padding: 10px 32px 0 32px;
52
+ display: flex;
53
+ align-items: center;
54
+
55
+ .search-input {
56
+ flex: 1;
57
+ margin-right: 20px;
58
+ }
59
+
60
+ &.phone-wrap {
61
+ flex-direction: column;
62
+ align-items: flex-end;
63
+
64
+ .search-input {
65
+ width: 100%;
66
+ margin-bottom: 16px;
67
+ margin-right: 0;
68
+ }
69
+ }
70
+ }
71
+
72
+ .cover-wrap {
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ overflow: hidden;
77
+ width: 64px;
78
+ height: 64px;
79
+ opacity: 1;
80
+ border-radius: 2px;
81
+ margin: 0 auto;
82
+
83
+ img {
84
+ width: 100%;
85
+ }
86
+ }
87
+
88
+ .goods-status {
89
+ display: inline-block;
90
+ min-width: 58px;
91
+ border-radius: 16px;
92
+ font-size: 13px;
93
+
94
+ text-align: center;
95
+ padding: 2px 8px;
96
+
97
+ &.release {
98
+ background: #6fa629;
99
+ color: #ffffff;
100
+ }
101
+
102
+ &.pending {
103
+ background: #ec808d;
104
+ color: #fff;
105
+ }
106
+
107
+ &.archived {
108
+ background: #e4e5e7;
109
+ color: #252a2d;
110
+ }
111
+
112
+ &.draft {
113
+ background: #a4e8f2;
114
+ color: #202223;
115
+ }
116
+ }
117
+ }
118
+ }
119
+
120
+ .spin {
121
+ :global {
122
+ .ant-spin {
123
+ max-height: 10000px !important;
124
+ }
125
+ }
126
+ }
127
+
128
+ .empty-wrap {
129
+ min-height: 550px;
130
+
131
+ .empty-content {
132
+ display: flex;
133
+ align-items: center;
134
+ flex-direction: column;
135
+ height: 550px;
136
+ background: #ffffff;
137
+ border-radius: 4px;
138
+
139
+ .icon {
140
+ font-size: 170px;
141
+ margin-top: 70px;
142
+ }
143
+
144
+ .title {
145
+ margin-top: 40px;
146
+ height: 22px;
147
+ font-size: 16px;
148
+ font-weight: 650;
149
+ line-height: 28px;
150
+ color: #252a2d;
151
+ }
152
+
153
+ .describe {
154
+ margin-top: 22px;
155
+ margin-bottom: 9px;
156
+ max-width: 390px;
157
+ height: 86px;
158
+ font-size: 14px;
159
+
160
+ font-weight: 400;
161
+ line-height: 22px;
162
+ color: #707070;
163
+ }
164
+ }
165
+ }
166
+
167
+ .footer {
168
+ margin-top: 30px;
169
+ height: 17px;
170
+ font-size: 12px;
171
+
172
+ font-weight: 400;
173
+ line-height: 17px;
174
+ color: #8c8c8c;
175
+ text-align: center;
176
+ }
177
+
178
+ .phone-wrap {
179
+ padding: 0 16px;
180
+
181
+ .content {
182
+ .search-wrap {
183
+ padding: 10px 16px 0 16px;
184
+ }
185
+
186
+ .list-wrap {
187
+ padding: 16px;
188
+ }
189
+ }
190
+ }
191
+
192
+ .list-wrap {
193
+ padding: 20px 32px;
194
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @Title: 格式化日期
3
+ * @Describe:
4
+ * @Author: Wzw
5
+ * @param {string} date
6
+ * @param {string} format
7
+ */
8
+ export declare const formatDate: (date: any, format?: string[]) => any;
@@ -0,0 +1,19 @@
1
+ import dayjs from 'dayjs';
2
+ import { getCurrentLocale } from "../../../../../../utils/locale";
3
+
4
+ /**
5
+ * @Title: 格式化日期
6
+ * @Describe:
7
+ * @Author: Wzw
8
+ * @param {string} date
9
+ * @param {string} format
10
+ */
11
+ export var formatDate = function formatDate(date, format) {
12
+ if (!date) {
13
+ return date;
14
+ }
15
+ var lang = getCurrentLocale();
16
+ var _format = format || ['HH:mm:ss DD/MM/YYYY', 'YYYY-MM-DD HH:mm:ss'];
17
+ var type = lang === 'en-US' || lang === 'en' ? _format[0] : _format[1];
18
+ return dayjs(date).format(type);
19
+ };
@@ -0,0 +1,3 @@
1
+ export declare const windowOpen: (url: string, target?: string) => void;
2
+ declare const _default: (sUrl: string, fileName?: string) => boolean;
3
+ export default _default;
@@ -0,0 +1,39 @@
1
+ // 兼容ios的window.open的跳转
2
+ export var windowOpen = function windowOpen(url, target) {
3
+ var oWindow = window.open('', target || '_blank');
4
+ oWindow.location = url;
5
+ };
6
+ export default (function (sUrl, fileName) {
7
+ var isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
8
+ var isSafari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
9
+ //iOS channelList do not support downloading. We have to inform user about this.
10
+ if (/(iP)/g.test(navigator.userAgent)) {
11
+ alert('Your device does not support files downloading. Please try again in desktop browser.');
12
+ return false;
13
+ }
14
+ //If in Chrome or Safari - download via virtual link click
15
+ if (isChrome || isSafari) {
16
+ //Creating new link node.
17
+ var link = document.createElement('a');
18
+ link.href = sUrl;
19
+ if (link.download !== undefined) {
20
+ //Set HTML5 download attribute. This will prevent file from opening if supported.
21
+ var _fileName = fileName || sUrl.substring(sUrl.lastIndexOf('/') + 1, sUrl.length);
22
+ link.download = _fileName;
23
+ }
24
+
25
+ //Dispatching click event.
26
+ if (document.createEvent) {
27
+ var e = document.createEvent('MouseEvents');
28
+ e.initEvent('click', true, true);
29
+ link.dispatchEvent(e);
30
+ return true;
31
+ }
32
+ }
33
+ // Force file download (whether supported by server).
34
+ if (sUrl.indexOf('?') === -1) {
35
+ sUrl += '?download';
36
+ }
37
+ windowOpen(sUrl, '_self');
38
+ return true;
39
+ });
@@ -0,0 +1,7 @@
1
+ export declare const getFileDateName: () => string;
2
+ /**
3
+ * @Title: 复制内容
4
+ * @Describe:
5
+ * @Author: Wzw
6
+ */
7
+ export declare const copyText: (text: string) => void;
@@ -0,0 +1,21 @@
1
+ import dayjs from 'dayjs';
2
+ import { message } from 'antd';
3
+ import { getText } from "../../../../../../locales/index";
4
+ export var getFileDateName = function getFileDateName() {
5
+ return '-' + dayjs().format('YYYY-MM-DD-HH-mm-ss');
6
+ };
7
+
8
+ /**
9
+ * @Title: 复制内容
10
+ * @Describe:
11
+ * @Author: Wzw
12
+ */
13
+ export var copyText = function copyText(text) {
14
+ var input = document.createElement('input');
15
+ input.setAttribute('value', text);
16
+ document.body.appendChild(input);
17
+ input.select();
18
+ document.execCommand('copy');
19
+ document.body.removeChild(input);
20
+ message.success(getText('table-action-export-import-table-success-copy'));
21
+ };
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { FilterType } from "../../filter/types";
3
- import { ColumnSettingType, DataSourceGroupType, GallerySettingType, GridViewType, SortType } from "../types";
3
+ import { ColumnSettingType, DataSourceGroupType, ExportImportType, GallerySettingType, GridViewType, SortType } from "../types";
4
4
  import "./index.less";
5
5
  declare type ActionsProps = {
6
6
  filter: FilterType;
@@ -12,6 +12,7 @@ declare type ActionsProps = {
12
12
  buttons: any[];
13
13
  view: GridViewType;
14
14
  gallery: GallerySettingType;
15
+ exportImport?: ExportImportType;
15
16
  };
16
- declare const Actions: ({ filter, sort, columnSetting, dataSourceGroup, tableId, localPagination, buttons, view, gallery, }: ActionsProps) => React.JSX.Element | null;
17
+ declare const Actions: ({ filter, sort, columnSetting, dataSourceGroup, tableId, localPagination, buttons, view, gallery, exportImport, }: ActionsProps) => React.JSX.Element | null;
17
18
  export default Actions;
@@ -1,14 +1,15 @@
1
- import React, { useMemo } from "react";
2
1
  import { Form } from "antd";
2
+ import React, { useMemo } from "react";
3
3
  import Filter from "../../filter";
4
4
  import Sort from "../../sort";
5
+ import Buttons from "../Header/Buttons";
5
6
  import ColumnsSetting from "./component/ColumnsSetting";
7
+ import ExportImport from "./component/ExportImport";
8
+ import GallerySetting from "./component/GallerySetting";
6
9
  import Group from "./component/Group";
7
- import Buttons from "../Header/Buttons";
8
10
  import ViewMode from "./component/ViewMode";
9
- import GallerySetting from "./component/GallerySetting";
10
- import "./index.less";
11
11
  import useIsMobileTable from "../hooks/useIsMobileTable";
12
+ import "./index.less";
12
13
  var Actions = function Actions(_ref) {
13
14
  var filter = _ref.filter,
14
15
  sort = _ref.sort,
@@ -18,7 +19,8 @@ var Actions = function Actions(_ref) {
18
19
  localPagination = _ref.localPagination,
19
20
  buttons = _ref.buttons,
20
21
  view = _ref.view,
21
- gallery = _ref.gallery;
22
+ gallery = _ref.gallery,
23
+ exportImport = _ref.exportImport;
22
24
  var form = Form.useFormInstance();
23
25
  var isMobileBool = useIsMobileTable();
24
26
  var viewMode = Form.useWatch("view_mode", {
@@ -26,8 +28,8 @@ var Actions = function Actions(_ref) {
26
28
  preserve: true
27
29
  });
28
30
  var showActions = useMemo(function () {
29
- return (filter === null || filter === void 0 ? void 0 : filter.show) || (sort === null || sort === void 0 ? void 0 : sort.show) || (columnSetting === null || columnSetting === void 0 ? void 0 : columnSetting.show) || (dataSourceGroup === null || dataSourceGroup === void 0 ? void 0 : dataSourceGroup.show) || view.multiple;
30
- }, [filter === null || filter === void 0 ? void 0 : filter.show, sort === null || sort === void 0 ? void 0 : sort.show, columnSetting === null || columnSetting === void 0 ? void 0 : columnSetting.show, dataSourceGroup === null || dataSourceGroup === void 0 ? void 0 : dataSourceGroup.show, view.multiple]);
31
+ return (filter === null || filter === void 0 ? void 0 : filter.show) || (sort === null || sort === void 0 ? void 0 : sort.show) || (columnSetting === null || columnSetting === void 0 ? void 0 : columnSetting.show) || (dataSourceGroup === null || dataSourceGroup === void 0 ? void 0 : dataSourceGroup.show) || view.multiple || (exportImport === null || exportImport === void 0 ? void 0 : exportImport.show);
32
+ }, [filter === null || filter === void 0 ? void 0 : filter.show, sort === null || sort === void 0 ? void 0 : sort.show, columnSetting === null || columnSetting === void 0 ? void 0 : columnSetting.show, dataSourceGroup === null || dataSourceGroup === void 0 ? void 0 : dataSourceGroup.show, view.multiple, exportImport === null || exportImport === void 0 ? void 0 : exportImport.show]);
31
33
  return showActions ? /*#__PURE__*/React.createElement("div", {
32
34
  className: "materials-grid-actions"
33
35
  }, /*#__PURE__*/React.createElement("div", {
@@ -48,7 +50,9 @@ var Actions = function Actions(_ref) {
48
50
  noStyle: true
49
51
  }, /*#__PURE__*/React.createElement(ViewMode, {
50
52
  view: view
51
- })), (dataSourceGroup === null || dataSourceGroup === void 0 ? void 0 : dataSourceGroup.show) && viewMode === "grid" && /*#__PURE__*/React.createElement(Form.Item, {
53
+ })), exportImport !== null && exportImport !== void 0 && exportImport.show ? /*#__PURE__*/React.createElement(ExportImport, {
54
+ exportImport: exportImport
55
+ }) : null, (dataSourceGroup === null || dataSourceGroup === void 0 ? void 0 : dataSourceGroup.show) && viewMode === "grid" && /*#__PURE__*/React.createElement(Form.Item, {
52
56
  name: "group_by",
53
57
  noStyle: true
54
58
  }, /*#__PURE__*/React.createElement(Group, {
@@ -1,5 +1,5 @@
1
1
  import { FilterType } from "../../filter/types";
2
- import { ColumnSettingType, DataSourceGroupType, GallerySettingType, GridViewType, ModeType, SortType } from "../types";
2
+ import { ColumnSettingType, DataSourceGroupType, GallerySettingType, GridViewType, ModeType, SortType, ExportImportModeType } from "../types";
3
3
  declare type UseTableSettingProps = {
4
4
  tableId?: string;
5
5
  filter: FilterType;
@@ -11,6 +11,7 @@ declare type UseTableSettingProps = {
11
11
  currentViewMode: ModeType;
12
12
  gallery?: GallerySettingType;
13
13
  currentSettingHash: string;
14
+ exportImport?: ExportImportModeType;
14
15
  };
15
16
  declare const useTableSetting: (params: UseTableSettingProps) => {
16
17
  setTableSetting: (values: Record<string, any>) => void;
@@ -18,7 +18,8 @@ var useTableSetting = function useTableSetting(params) {
18
18
  currentViewMode = params.currentViewMode,
19
19
  propsColumns = params.columns,
20
20
  gallery = params.gallery,
21
- currentSettingHash = params.currentSettingHash;
21
+ currentSettingHash = params.currentSettingHash,
22
+ exportImport = params.exportImport;
22
23
  var context = useEngineContext();
23
24
  var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
24
25
  isTerminal = _ref.isTerminal,
@@ -1,5 +1,5 @@
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
- var _excluded = ["dataSource", "columns", "dispatch", "style", "filter", "sort", "buttons", "actionButtons", "title", "summary", "onValuesChange", "columnSetting", "dataSourceGroup", "view", "gallery", "currentSettingKey"];
2
+ var _excluded = ["dataSource", "columns", "dispatch", "style", "filter", "sort", "buttons", "actionButtons", "title", "summary", "onValuesChange", "columnSetting", "dataSourceGroup", "view", "gallery", "currentSettingKey", "exportImport"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
  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; }
5
5
  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; }
@@ -14,22 +14,22 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
14
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
15
  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; }
16
16
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
- import React, { useEffect, useImperativeHandle, useMemo, forwardRef, useRef } from "react";
18
- import { Form } from "antd";
19
17
  import { useSize } from "ahooks";
20
- import View from "./View";
21
- import Header from "./Header";
22
- import Actions from "./Actions";
23
- import Summary from "./Summary";
18
+ import { Form } from "antd";
19
+ import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from "react";
24
20
  import { useSharedState } from "../../hooks";
25
- import { Provider, Context, formatColumn } from "./model";
26
21
  import useEngineContext from "../../hooks/useEngineContext";
27
- import useTableSetting from "./hooks/useTableSetting";
28
- import useTriggerValuesChange from "./hooks/useTriggerValuesChange";
22
+ import Actions from "./Actions";
23
+ import Header from "./Header";
24
+ import Summary from "./Summary";
29
25
  import { clearTableSettingToLocalStorage, getCurrentViewModeFromLocalStorage, getHash, getTableSettingFromLocalStorage, mergeColumnSetting, omit, stringify } from "./Table/utils";
30
- import useTransSortSetting from "./hooks/useTransSortSetting";
31
- import useTransFilterSetting from "./hooks/useTransFilterSetting";
26
+ import View from "./View";
27
+ import useTableSetting from "./hooks/useTableSetting";
32
28
  import useTransDataSourceGroupSetting from "./hooks/useTransDataSourceGroupSetting";
29
+ import useTransFilterSetting from "./hooks/useTransFilterSetting";
30
+ import useTransSortSetting from "./hooks/useTransSortSetting";
31
+ import useTriggerValuesChange from "./hooks/useTriggerValuesChange";
32
+ import { Context, Provider, formatColumn } from "./model";
33
33
  import "./index.less";
34
34
  var defaultView = {
35
35
  defaultViewMode: "grid",
@@ -55,6 +55,7 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
55
55
  view = _props$view === void 0 ? defaultView : _props$view,
56
56
  gallery = props.gallery,
57
57
  currentSettingKey = props.currentSettingKey,
58
+ exportImport = props.exportImport,
58
59
  other = _objectWithoutProperties(props, _excluded);
59
60
  var modal = useSharedState(Context);
60
61
  var _Form$useForm = Form.useForm(),
@@ -295,7 +296,8 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
295
296
  sort: sort,
296
297
  tableId: tableId,
297
298
  localPagination: other === null || other === void 0 ? void 0 : (_other$pagination8 = other.pagination) === null || _other$pagination8 === void 0 ? void 0 : _other$pagination8.localPagination,
298
- gallery: gallery
299
+ gallery: gallery,
300
+ exportImport: exportImport
299
301
  }), /*#__PURE__*/React.createElement(Summary, {
300
302
  summary: summary
301
303
  }), /*#__PURE__*/React.createElement(View, _extends({}, props, {
@@ -0,0 +1,13 @@
1
+ declare type exportParams = {
2
+ ids?: Array<string | number>;
3
+ file_name?: string;
4
+ };
5
+ export declare const exportData: (params: exportParams) => Promise<any>;
6
+ export declare const batchExport: (params: any) => Promise<any>;
7
+ export declare const formIdExport: (form_id: string | number, params: exportParams) => Promise<any>;
8
+ export declare const formCodeExport: (code: string, params: exportParams) => Promise<any>;
9
+ export declare const batchImport: (params: any) => Promise<any>;
10
+ export declare const importCodeTemplate: (code: string) => Promise<any>;
11
+ export declare const importFormIdTemplate: (form_id: string | number) => Promise<any>;
12
+ export declare const historyData: (params: any) => Promise<any>;
13
+ export {};
@@ -0,0 +1,55 @@
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ import { request } from "./utils";
6
+ // 导出
7
+ export var exportData = function exportData(params) {
8
+ return request.getRequest().get("/shop/form/data/export", params);
9
+ };
10
+
11
+ // 导出
12
+ export var batchExport = function batchExport(params) {
13
+ return request.getRequest().get("/shop/form/data/export", params);
14
+ };
15
+
16
+ // 根据表单id导出
17
+ export var formIdExport = function formIdExport(form_id, params) {
18
+ return request.getRequest().post("/shop/form/data/export/".concat(form_id), params);
19
+ };
20
+ // 根据表单code导出
21
+ export var formCodeExport = function formCodeExport(code, params) {
22
+ return request.getRequest().get("/shop/form/data/export/code/".concat(code), params);
23
+ };
24
+
25
+ // 导入
26
+ export var batchImport = function batchImport(params) {
27
+ return request.getRequest().post('/shop/form/data/import', params);
28
+ };
29
+ // 根据code导入模版
30
+ export var importCodeTemplate = function importCodeTemplate(code) {
31
+ return request.getRequest().get("/shop/form/data/download-template/code/".concat(code));
32
+ };
33
+ // 根据form_id导入模版
34
+ export var importFormIdTemplate = function importFormIdTemplate(form_id) {
35
+ return request.getRequest().get("/shop/form/data/download-template/id/".concat(form_id));
36
+ };
37
+ export var historyData = /*#__PURE__*/function () {
38
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
39
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
40
+ while (1) switch (_context.prev = _context.next) {
41
+ case 0:
42
+ _context.next = 2;
43
+ return request.getRequest().get('/shop/form/data/task', params);
44
+ case 2:
45
+ return _context.abrupt("return", _context.sent);
46
+ case 3:
47
+ case "end":
48
+ return _context.stop();
49
+ }
50
+ }, _callee);
51
+ }));
52
+ return function historyData(_x) {
53
+ return _ref.apply(this, arguments);
54
+ };
55
+ }();
@@ -0,0 +1,19 @@
1
+ interface defaultOptions {
2
+ exportType: string;
3
+ footerHintTypes: string[];
4
+ okShowButtonTypes: string[];
5
+ exportValue: string;
6
+ importValue: string;
7
+ }
8
+ export declare const defaultOptions: defaultOptions;
9
+ interface SomeArray {
10
+ [index: string]: string;
11
+ }
12
+ export declare const suffixOptions: SomeArray;
13
+ export declare const exportImportOptions: {
14
+ import: any;
15
+ export: any;
16
+ export_file: any;
17
+ import_log: any;
18
+ };
19
+ export {};
@@ -0,0 +1,26 @@
1
+ import { getText } from "../../locales/index";
2
+ // 默认值
3
+ export var defaultOptions = {
4
+ exportType: 'current-page',
5
+ footerHintTypes: ["export_file", "import_log"],
6
+ okShowButtonTypes: ["export", "import"],
7
+ exportValue: 'export',
8
+ importValue: 'import'
9
+ };
10
+ export var suffixOptions = {
11
+ '1': "".concat(getText('page.customer.list.table.num')),
12
+ '2': "".concat(getText('page.customer.suffix')),
13
+ product: "".concat(getText('page.product.suffix')),
14
+ '4': "".concat(getText('page.voucher.suffix')),
15
+ '5': "".concat(getText('page.recharge.suffix')),
16
+ '6': "".concat(getText('page.ticket.suffix')),
17
+ '7': "".concat(getText('page.package.ticket.suffix'))
18
+ };
19
+
20
+ // 导入导出
21
+ export var exportImportOptions = {
22
+ import: getText('table-action-export-import-button-import'),
23
+ export: getText('table-action-export-import-button'),
24
+ export_file: getText('table-action-export-import-export-title'),
25
+ import_log: getText('table-action-export-import-import-title')
26
+ };
@@ -158,6 +158,25 @@ declare type SortDetail = {
158
158
  fromItem: Record<string, any>;
159
159
  toItem: Record<string, any>;
160
160
  };
161
+ /** 导入导出模式 */
162
+ export declare type ExportImportModeType = "import" | "export" | "export_file" | "import_log";
163
+ /**
164
+ * 导入导出配置
165
+ */
166
+ export declare type ExportImportType = {
167
+ /** 是否展示 */
168
+ show: boolean;
169
+ /** 表id */
170
+ formId?: string;
171
+ /** 表key */
172
+ formCode?: string;
173
+ /** 当前所选项 */
174
+ selectLists: string[];
175
+ /** 导入模版链接 */
176
+ templateFileUrl: string;
177
+ /** 标题 */
178
+ title: string;
179
+ };
161
180
  export declare type GridViewProps = {
162
181
  columns: any;
163
182
  dataSource: any[];
@@ -177,6 +196,7 @@ export declare type GridViewProps = {
177
196
  actionButtons: any;
178
197
  sort: SortType;
179
198
  title: any;
199
+ exportImport: ExportImportType;
180
200
  onValuesChange: (changedValues: any, values: any) => void;
181
201
  summary: any;
182
202
  utils: any;
@@ -0,0 +1,15 @@
1
+ declare type RType = (url: string, data?: {} | undefined, config?: {} | undefined) => Promise<any>;
2
+ declare class Request {
3
+ private request;
4
+ constructor();
5
+ setRequest(val: any): void;
6
+ getRequest(): {
7
+ get: RType;
8
+ post: RType;
9
+ put: RType;
10
+ remove: RType;
11
+ custom: RType;
12
+ };
13
+ }
14
+ export declare const request: Request;
15
+ export {};