@pisell/materials 6.3.6 → 6.3.7

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 (186) 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 +7 -7
  6. package/build/lowcode/preview.js +150 -150
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +39 -28
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +45 -34
  11. package/es/components/colorPicker/index.d.ts +0 -1
  12. package/es/components/dataSourceComponents/dataSourceForm/formItem.d.ts +1 -0
  13. package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +11 -4
  14. package/es/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -1
  15. package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +7 -2
  16. package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +1 -0
  17. package/es/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +2 -3
  18. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +10 -11
  19. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +11 -4
  20. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +2 -2
  21. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +92 -6
  22. package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +5 -0
  23. package/es/components/dataSourceComponents/fields/Input.Json/ReadPretty.d.ts +1 -0
  24. package/es/components/dataSourceComponents/fields/Input.Password/ReadPretty.d.ts +1 -0
  25. package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
  26. package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +199 -19
  27. package/es/components/dataSourceComponents/fields/Upload/CameraPopover.d.ts +6 -0
  28. package/es/components/dataSourceComponents/fields/Upload/CameraPopover.js +66 -0
  29. package/es/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -0
  30. package/es/components/dataSourceComponents/fields/Upload/index.less +35 -3
  31. package/es/components/dataSourceComponents/fields/Upload/type.d.ts +1 -0
  32. package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
  33. package/es/components/dataSourceComponents/fields/index.d.ts +8 -8
  34. package/es/components/date-picker/datePickerCpt.d.ts +1 -0
  35. package/es/components/drag-sort-tree/TreeItem/index.d.ts +0 -1
  36. package/es/components/filter/components/items/index.d.ts +0 -1
  37. package/es/components/filter/components/items/text/Editor/index.d.ts +0 -1
  38. package/es/components/filter/components/items/text/Preview/index.d.ts +0 -1
  39. package/es/components/filter/components/items/text/index.d.ts +0 -1
  40. package/es/components/filter/index.d.ts +0 -1
  41. package/es/components/filter/types.d.ts +1 -0
  42. package/es/components/list/index.d.ts +1 -0
  43. package/es/components/lowCodePage/index.d.ts +1 -0
  44. package/es/components/page/index.d.ts +1 -0
  45. package/es/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +0 -1
  46. package/es/components/pisellCamera/index.d.ts +4 -0
  47. package/es/components/pisellCamera/index.js +228 -0
  48. package/es/components/pisellCamera/index.less +131 -0
  49. package/es/components/pisellDatePicker/datePickerCpt.d.ts +1 -0
  50. package/es/components/pisellInput/components/BankCard/index.d.ts +1 -0
  51. package/es/components/pisellInput/components/Copy/index.d.ts +1 -0
  52. package/es/components/pisellInput/components/SecurityCode/index.d.ts +1 -0
  53. package/es/components/pisellInput/index.d.ts +1 -0
  54. package/es/components/pisellTooltip/index.d.ts +1 -0
  55. package/es/components/productCard/components/Action/index.d.ts +1 -0
  56. package/es/components/productCard/components/AmountFooter/index.d.ts +1 -0
  57. package/es/components/productCard/components/Header/EditButton/index.d.ts +1 -0
  58. package/es/components/productCard/components/Header/index.d.ts +1 -0
  59. package/es/components/productCard/components/Note/index.d.ts +1 -0
  60. package/es/components/productCard/components/Packages/index.d.ts +1 -0
  61. package/es/components/productCard/components/Packages/utils.d.ts +1 -1
  62. package/es/components/productCard/components/Sales/index.d.ts +1 -0
  63. package/es/components/productCard/components/Time/components/SelectHolder/index.d.ts +1 -0
  64. package/es/components/productCard/components/Time/components/SelectHolderModal/index.d.ts +1 -0
  65. package/es/components/productCard/components/Time/components/SelectHolderMultiple/index.d.ts +1 -0
  66. package/es/components/productCard/components/Time/components/SelectResource/index.d.ts +1 -0
  67. package/es/components/qrcode/index.d.ts +1 -0
  68. package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +0 -1
  69. package/es/components/table/Actions/component/ExportImport/components/ExportTable/index.d.ts +0 -1
  70. package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +0 -1
  71. package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts +0 -1
  72. package/es/components/table/Actions/component/GallerySetting/index.d.ts +0 -1
  73. package/es/components/table/Actions/component/Group/index.d.ts +0 -1
  74. package/es/components/table/Actions/component/ViewMode/index.d.ts +0 -1
  75. package/es/components/table/Actions/index.d.ts +0 -1
  76. package/es/components/table/Gallery/components/GalleryItem/components/Cover/index.d.ts +0 -1
  77. package/es/components/table/Gallery/components/GalleryItem/components/RenderFields/index.d.ts +1 -0
  78. package/es/components/table/Gallery/components/GalleryItem/components/Title/index.d.ts +0 -1
  79. package/es/components/table/Table/SelectField/index.d.ts +0 -1
  80. package/es/components/table/Table/fields/date/Show/index.d.ts +1 -0
  81. package/es/components/table/Table/fields/link/Show/index.d.ts +1 -0
  82. package/es/components/table/Table/tableConfig/summary/index.d.ts +0 -1
  83. package/es/components/table/Table/utils.d.ts +1 -1
  84. package/es/components/table/Table/utils.js +22 -1
  85. package/es/components/table/View/index.d.ts +0 -1
  86. package/es/components/table/hooks/useTableSetting.d.ts +3 -4
  87. package/es/components/table/hooks/useTableSetting.js +113 -5
  88. package/es/components/table/index.js +14 -3
  89. package/es/components/table/types.d.ts +17 -0
  90. package/es/locales/en-US.d.ts +10 -0
  91. package/es/locales/en-US.js +13 -1
  92. package/es/locales/zh-CN.d.ts +10 -0
  93. package/es/locales/zh-CN.js +13 -1
  94. package/es/locales/zh-TW.d.ts +10 -0
  95. package/es/locales/zh-TW.js +13 -1
  96. package/es/utils/platform.d.ts +1 -1
  97. package/lib/components/colorPicker/index.d.ts +0 -1
  98. package/lib/components/dataSourceComponents/dataSourceForm/formItem.d.ts +1 -0
  99. package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +8 -2
  100. package/lib/components/dataSourceComponents/dataSourceTable/filter/index.d.ts +1 -1
  101. package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +7 -2
  102. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +1 -0
  103. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDrawerState.d.ts +2 -3
  104. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +10 -11
  105. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +11 -4
  106. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.d.ts +2 -2
  107. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableQuery.js +78 -7
  108. package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +5 -0
  109. package/lib/components/dataSourceComponents/fields/Input.Json/ReadPretty.d.ts +1 -0
  110. package/lib/components/dataSourceComponents/fields/Input.Password/ReadPretty.d.ts +1 -0
  111. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
  112. package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +168 -5
  113. package/lib/components/dataSourceComponents/fields/Upload/CameraPopover.d.ts +6 -0
  114. package/lib/components/dataSourceComponents/fields/Upload/CameraPopover.js +95 -0
  115. package/lib/components/dataSourceComponents/fields/Upload/ReadPretty.d.ts +1 -0
  116. package/lib/components/dataSourceComponents/fields/Upload/index.less +35 -3
  117. package/lib/components/dataSourceComponents/fields/Upload/type.d.ts +1 -0
  118. package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
  119. package/lib/components/dataSourceComponents/fields/index.d.ts +8 -8
  120. package/lib/components/date-picker/datePickerCpt.d.ts +1 -0
  121. package/lib/components/drag-sort-tree/TreeItem/index.d.ts +0 -1
  122. package/lib/components/filter/components/items/index.d.ts +0 -1
  123. package/lib/components/filter/components/items/text/Editor/index.d.ts +0 -1
  124. package/lib/components/filter/components/items/text/Preview/index.d.ts +0 -1
  125. package/lib/components/filter/components/items/text/index.d.ts +0 -1
  126. package/lib/components/filter/index.d.ts +0 -1
  127. package/lib/components/filter/types.d.ts +1 -0
  128. package/lib/components/list/index.d.ts +1 -0
  129. package/lib/components/lowCodePage/index.d.ts +1 -0
  130. package/lib/components/page/index.d.ts +1 -0
  131. package/lib/components/pisellAdjustPrice/PisellAdjustPriceInputNumber.d.ts +0 -1
  132. package/lib/components/pisellCamera/index.d.ts +4 -0
  133. package/lib/components/pisellCamera/index.js +222 -0
  134. package/lib/components/pisellCamera/index.less +131 -0
  135. package/lib/components/pisellDatePicker/datePickerCpt.d.ts +1 -0
  136. package/lib/components/pisellInput/components/BankCard/index.d.ts +1 -0
  137. package/lib/components/pisellInput/components/Copy/index.d.ts +1 -0
  138. package/lib/components/pisellInput/components/SecurityCode/index.d.ts +1 -0
  139. package/lib/components/pisellInput/index.d.ts +1 -0
  140. package/lib/components/pisellTooltip/index.d.ts +1 -0
  141. package/lib/components/productCard/components/Action/index.d.ts +1 -0
  142. package/lib/components/productCard/components/AmountFooter/index.d.ts +1 -0
  143. package/lib/components/productCard/components/Header/EditButton/index.d.ts +1 -0
  144. package/lib/components/productCard/components/Header/index.d.ts +1 -0
  145. package/lib/components/productCard/components/Note/index.d.ts +1 -0
  146. package/lib/components/productCard/components/Packages/index.d.ts +1 -0
  147. package/lib/components/productCard/components/Packages/utils.d.ts +1 -1
  148. package/lib/components/productCard/components/Sales/index.d.ts +1 -0
  149. package/lib/components/productCard/components/Time/components/SelectHolder/index.d.ts +1 -0
  150. package/lib/components/productCard/components/Time/components/SelectHolderModal/index.d.ts +1 -0
  151. package/lib/components/productCard/components/Time/components/SelectHolderMultiple/index.d.ts +1 -0
  152. package/lib/components/productCard/components/Time/components/SelectResource/index.d.ts +1 -0
  153. package/lib/components/qrcode/index.d.ts +1 -0
  154. package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +0 -1
  155. package/lib/components/table/Actions/component/ExportImport/components/ExportTable/index.d.ts +0 -1
  156. package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +0 -1
  157. package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts +0 -1
  158. package/lib/components/table/Actions/component/GallerySetting/index.d.ts +0 -1
  159. package/lib/components/table/Actions/component/Group/index.d.ts +0 -1
  160. package/lib/components/table/Actions/component/ViewMode/index.d.ts +0 -1
  161. package/lib/components/table/Actions/index.d.ts +0 -1
  162. package/lib/components/table/Gallery/components/GalleryItem/components/Cover/index.d.ts +0 -1
  163. package/lib/components/table/Gallery/components/GalleryItem/components/RenderFields/index.d.ts +1 -0
  164. package/lib/components/table/Gallery/components/GalleryItem/components/Title/index.d.ts +0 -1
  165. package/lib/components/table/Table/SelectField/index.d.ts +0 -1
  166. package/lib/components/table/Table/fields/date/Show/index.d.ts +1 -0
  167. package/lib/components/table/Table/fields/link/Show/index.d.ts +1 -0
  168. package/lib/components/table/Table/tableConfig/summary/index.d.ts +0 -1
  169. package/lib/components/table/Table/utils.d.ts +1 -1
  170. package/lib/components/table/Table/utils.js +18 -1
  171. package/lib/components/table/View/index.d.ts +0 -1
  172. package/lib/components/table/hooks/useTableSetting.d.ts +3 -4
  173. package/lib/components/table/hooks/useTableSetting.js +114 -4
  174. package/lib/components/table/index.js +12 -1
  175. package/lib/components/table/types.d.ts +17 -0
  176. package/lib/locales/en-US.d.ts +10 -0
  177. package/lib/locales/en-US.js +13 -1
  178. package/lib/locales/zh-CN.d.ts +10 -0
  179. package/lib/locales/zh-CN.js +13 -1
  180. package/lib/locales/zh-TW.d.ts +10 -0
  181. package/lib/locales/zh-TW.js +13 -1
  182. package/lib/utils/platform.d.ts +1 -1
  183. package/lowcode/data-source-table/meta.ts +239 -0
  184. package/lowcode/form-item-upload/meta.ts +20 -5
  185. package/lowcode/table/meta.ts +104 -0
  186. package/package.json +4 -3
@@ -5,8 +5,9 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import { useMemo } from "react";
8
- import { getSettingKeyArrByMode, getTableSettingByCurrentViewMode, getTableSettingFromLocalStorage, mergeColumnSetting, mergeFilterSetting, setFormValuesToLocalStorage } from "../Table/utils";
8
+ import { getSettingKeyArrByMode, getTableSettingByCurrentViewMode, getTableSettingFromLocalStorage, mergeColumnSetting, mergeFilterSetting, setTableSettingToLocalStorage, setFormValuesToLocalStorage } from "../Table/utils";
9
9
  import { useMemoizedFn } from "ahooks";
10
+ import React from "react";
10
11
  var useTableSetting = function useTableSetting(params) {
11
12
  var tableId = params.tableId,
12
13
  filter = params.filter,
@@ -18,7 +19,8 @@ var useTableSetting = function useTableSetting(params) {
18
19
  propsColumns = params.columns,
19
20
  gallery = params.gallery,
20
21
  currentSettingHash = params.currentSettingHash,
21
- exportImport = params.exportImport;
22
+ exportImport = params.exportImport,
23
+ localSettings = params.localSettings;
22
24
  var columnsMap = useMemo(function () {
23
25
  return new Map(propsColumns.map(function (item) {
24
26
  return [item.key, item];
@@ -60,7 +62,8 @@ var useTableSetting = function useTableSetting(params) {
60
62
  * 获取需要本地存储的 keyArr
61
63
  */
62
64
  var localStorageSettingKeyArr = useMemo(function () {
63
- return getSettingKeyArrByMode({
65
+ var _localSettings$scope;
66
+ var keys = getSettingKeyArrByMode({
64
67
  filter: filter,
65
68
  columnSetting: columnSetting,
66
69
  dataSourceGroup: dataSourceGroup,
@@ -68,6 +71,13 @@ var useTableSetting = function useTableSetting(params) {
68
71
  mode: "localStorage",
69
72
  currentViewMode: currentViewMode
70
73
  });
74
+ // 本地记忆:filters 范围 -> 存储到 filter 字段
75
+ if (localSettings !== null && localSettings !== void 0 && localSettings.enable && (_localSettings$scope = localSettings.scope) !== null && _localSettings$scope !== void 0 && _localSettings$scope.includes("filters")) {
76
+ if (!keys.includes("filters")) {
77
+ keys.push("filters");
78
+ }
79
+ }
80
+ return keys;
71
81
  }, [tableId, filter, columnSetting, dataSourceGroup, sort, currentViewMode]);
72
82
  var defaultKeyArr = useMemo(function () {
73
83
  return getSettingKeyArrByMode({
@@ -117,6 +127,8 @@ var useTableSetting = function useTableSetting(params) {
117
127
  compactMode: (mergedSetting === null || mergedSetting === void 0 || (_mergedSetting$item3 = mergedSetting[item]) === null || _mergedSetting$item3 === void 0 ? void 0 : _mergedSetting$item3.compactMode) || defaultGalleryCoverSetting.compactMode,
118
128
  isShowLabel: (_mergedSetting$item$i = mergedSetting === null || mergedSetting === void 0 || (_mergedSetting$item4 = mergedSetting[item]) === null || _mergedSetting$item4 === void 0 ? void 0 : _mergedSetting$item4.isShowLabel) !== null && _mergedSetting$item$i !== void 0 ? _mergedSetting$item$i : defaultGalleryCoverSetting.isShowLabel
119
129
  });
130
+ } else if (item === "filters") {
131
+ setting[item] = (mergedSetting === null || mergedSetting === void 0 ? void 0 : mergedSetting[item]) || {};
120
132
  } else {
121
133
  setting[item] = mergedSetting === null || mergedSetting === void 0 ? void 0 : mergedSetting[item];
122
134
  }
@@ -158,17 +170,113 @@ var useTableSetting = function useTableSetting(params) {
158
170
  * @param values
159
171
  */
160
172
  var setTableSetting = useMemoizedFn(function (values) {
173
+ var _localSettings$scope2;
174
+ // 计算需要存储的 filter 值(仅当开启本地记忆且包含 filters 时)
175
+ var valuesForSave = values;
176
+ if (localSettings !== null && localSettings !== void 0 && localSettings.enable && (_localSettings$scope2 = localSettings.scope) !== null && _localSettings$scope2 !== void 0 && _localSettings$scope2.includes("filters")) {
177
+ var excluded = new Set((localSettings === null || localSettings === void 0 ? void 0 : localSettings.excludedFilterFields) || []);
178
+ var filterValue = {};
179
+ ((filter === null || filter === void 0 ? void 0 : filter.list) || []).forEach(function (item) {
180
+ var rawName = item === null || item === void 0 ? void 0 : item.name;
181
+ if (!rawName) return;
182
+ var key = Array.isArray(rawName) ? rawName.join(",") : String(rawName);
183
+ if (excluded.has(key)) return;
184
+ if (values.hasOwnProperty(key)) {
185
+ filterValue[key] = values[key];
186
+ }
187
+ });
188
+ valuesForSave = _objectSpread(_objectSpread({}, values), {}, {
189
+ filters: filterValue
190
+ });
191
+ }
161
192
  setFormValuesToLocalStorage({
162
193
  tableId: tableId,
163
- allValues: values,
194
+ allValues: valuesForSave,
164
195
  keys: localStorageSettingKeyArr,
165
196
  currentViewMode: currentViewMode,
166
197
  currentSettingHash: currentSettingHash
167
198
  });
168
199
  });
169
200
  var tableSetting = useMemo(function () {
170
- return _objectSpread(_objectSpread({}, tableLocalSetting), defaultTableSetting);
201
+ var _localSettings$scope3;
202
+ var merged = _objectSpread(_objectSpread({}, tableLocalSetting), defaultTableSetting);
203
+ // 将本地记忆的 filter 扁平化注入初始表单值(不改变存储结构)
204
+ if (localSettings !== null && localSettings !== void 0 && localSettings.enable && (_localSettings$scope3 = localSettings.scope) !== null && _localSettings$scope3 !== void 0 && _localSettings$scope3.includes("filters")) {
205
+ var persistedFilter = tableLocalSetting === null || tableLocalSetting === void 0 ? void 0 : tableLocalSetting.filters;
206
+ if (persistedFilter && _typeof(persistedFilter) === "object") {
207
+ return _objectSpread(_objectSpread({}, merged), persistedFilter);
208
+ }
209
+ }
210
+ return merged;
171
211
  }, [tableLocalSetting, defaultTableSetting]);
212
+
213
+ /**
214
+ * 当刷新后获得新的 localSettings(scope 或 excludedFilterFields 变化)时,
215
+ * 根据最新规则调整已存储的 filters
216
+ */
217
+ // 对本地已存储 filters 做一次对齐(仅在必要时写回)
218
+ useMemo(function () {
219
+ try {
220
+ var _localSettings$scope4;
221
+ if (!tableId) return;
222
+ var current = getTableSettingByCurrentViewMode(tableId, currentViewMode) || {};
223
+ var persistedFilters = (current === null || current === void 0 ? void 0 : current.filters) || {};
224
+ var nextFilters = _objectSpread({}, persistedFilters);
225
+ var shouldUpdate = false;
226
+ var enableFiltersMemory = !!(localSettings !== null && localSettings !== void 0 && localSettings.enable && (_localSettings$scope4 = localSettings.scope) !== null && _localSettings$scope4 !== void 0 && _localSettings$scope4.includes("filters"));
227
+ if (!enableFiltersMemory) {
228
+ if (Object.keys(persistedFilters || {}).length > 0) {
229
+ nextFilters = {};
230
+ shouldUpdate = true;
231
+ }
232
+ } else {
233
+ var names = new Set();
234
+ if ( /*#__PURE__*/React.isValidElement(filter)) {
235
+ names = new Set(((filter === null || filter === void 0 ? void 0 : filter.items) || []).filter(function (item) {
236
+ return !item.isHidden;
237
+ }).map(function (item) {
238
+ var rawName = item === null || item === void 0 ? void 0 : item.value;
239
+ if (!rawName) return undefined;
240
+ return Array.isArray(rawName) ? rawName.join(",") : String(rawName);
241
+ }));
242
+ } else {
243
+ names = new Set(((filter === null || filter === void 0 ? void 0 : filter.list) || []).map(function (item) {
244
+ var rawName = item === null || item === void 0 ? void 0 : item.name;
245
+ if (!rawName) return undefined;
246
+ return Array.isArray(rawName) ? rawName.join(",") : String(rawName);
247
+ }).filter(Boolean));
248
+ }
249
+ var excluded = new Set((localSettings === null || localSettings === void 0 ? void 0 : localSettings.excludedFilterFields) || []);
250
+ var allowed = new Set(Array.from(names).filter(function (k) {
251
+ return !excluded.has(k);
252
+ }));
253
+ var filtered = {};
254
+ Object.keys(persistedFilters || {}).forEach(function (k) {
255
+ if (allowed.has(k)) {
256
+ filtered[k] = persistedFilters[k];
257
+ } else {
258
+ shouldUpdate = true;
259
+ }
260
+ });
261
+ if (Object.keys(filtered).length !== Object.keys(persistedFilters || {}).length) {
262
+ shouldUpdate = true;
263
+ }
264
+ nextFilters = filtered;
265
+ }
266
+ if (shouldUpdate) {
267
+ setTableSettingToLocalStorage({
268
+ tableId: tableId,
269
+ tableSettingObj: {
270
+ filters: nextFilters
271
+ },
272
+ currentViewMode: currentViewMode,
273
+ currentSettingHash: currentSettingHash
274
+ });
275
+ }
276
+ } catch (e) {
277
+ // ignore
278
+ }
279
+ }, []);
172
280
  return {
173
281
  setTableSetting: setTableSetting,
174
282
  tableSetting: tableSetting
@@ -1,5 +1,5 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["dataSource", "columns", "dispatch", "style", "filter", "sort", "buttons", "actionButtons", "title", "showTitle", "subTitle", "showSubTitle", "summary", "onValuesChange", "columnSetting", "dataSourceGroup", "view", "gallery", "currentSettingKey", "exportImport", "currentComponentId", "tabs"];
2
+ var _excluded = ["dataSource", "columns", "dispatch", "style", "filter", "sort", "buttons", "actionButtons", "title", "showTitle", "subTitle", "showSubTitle", "summary", "onValuesChange", "columnSetting", "dataSourceGroup", "localSettings", "view", "gallery", "currentSettingKey", "exportImport", "currentComponentId", "tabs"];
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(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -24,7 +24,7 @@ import useEngineContext from "../../hooks/useEngineContext";
24
24
  import Actions from "./Actions";
25
25
  import Header from "./Header";
26
26
  import Summary from "./Summary";
27
- import { clearTableSettingToLocalStorage, getCurrentViewModeFromLocalStorage, getHash, getTableSettingFromLocalStorage, mergeColumnSetting, omit, stringify } from "./Table/utils";
27
+ import { clearTableSettingToLocalStorage, getCurrentViewModeFromLocalStorage, getTableSettingByCurrentViewMode, getHash, getTableSettingFromLocalStorage, mergeColumnSetting, omit, stringify } from "./Table/utils";
28
28
  import View from "./View";
29
29
  import useTableSetting from "./hooks/useTableSetting";
30
30
  import useTransDataSourceGroupSetting from "./hooks/useTransDataSourceGroupSetting";
@@ -58,6 +58,7 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
58
58
  _onValuesChange = props.onValuesChange,
59
59
  columnSetting = props.columnSetting,
60
60
  propsDataSourceGroup = props.dataSourceGroup,
61
+ _localSettings = props.localSettings,
61
62
  _props$view = props.view,
62
63
  view = _props$view === void 0 ? defaultView : _props$view,
63
64
  gallery = props.gallery,
@@ -162,7 +163,8 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
162
163
  view: view,
163
164
  currentViewMode: currentViewMode,
164
165
  gallery: gallery,
165
- currentSettingHash: currentSettingHash
166
+ currentSettingHash: currentSettingHash,
167
+ localSettings: _localSettings
166
168
  }),
167
169
  setTableSetting = _useTableSetting.setTableSetting,
168
170
  tableSetting = _useTableSetting.tableSetting;
@@ -246,6 +248,15 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
246
248
  useImperativeHandle(ref, function () {
247
249
  if (wrapRef.current) {
248
250
  wrapRef.current.formInstance = form;
251
+ wrapRef.current.getCachedFilters = function () {
252
+ try {
253
+ if (!tableId) return {};
254
+ var setting = getTableSettingByCurrentViewMode(tableId, currentViewMode);
255
+ return (setting === null || setting === void 0 ? void 0 : setting.filters) || {};
256
+ } catch (e) {
257
+ return {};
258
+ }
259
+ };
249
260
  }
250
261
  // forwardRef 后需要返回元素才能选中
251
262
  return wrapRef.current;
@@ -191,6 +191,21 @@ export declare type ExportImportType = {
191
191
  apiUrl?: ApiProps;
192
192
  otherParams?: any;
193
193
  };
194
+ /**
195
+ * 设置记忆范围
196
+ */
197
+ export declare type LocalSettingsScope = "filters" | "sorting" | "columns";
198
+ /**
199
+ * 本地记忆设置
200
+ */
201
+ export declare type LocalSettingsType = {
202
+ /** 启用设置记忆 */
203
+ enable: boolean;
204
+ /** 记忆范围 */
205
+ scope: LocalSettingsScope[];
206
+ /** 不需要记忆的筛选字段(当 scope 包含 filters 时生效) */
207
+ excludedFilterFields?: string[];
208
+ };
194
209
  export declare type GridViewProps = {
195
210
  columns: any;
196
211
  dataSource: any[];
@@ -247,5 +262,7 @@ export declare type GridViewProps = {
247
262
  sortBy?: string;
248
263
  }[];
249
264
  };
265
+ /** 本地记忆设置 */
266
+ localSettings?: LocalSettingsType;
250
267
  };
251
268
  export {};
@@ -276,5 +276,15 @@ declare const _default: {
276
276
  'pisell2.text.goodpass.last-settlement': string;
277
277
  'pisell2.text.goodpass.view-more': string;
278
278
  'pisell2.text.goodpass.save': string;
279
+ 'pisell-camera-no-camera-accessible': string;
280
+ 'pisell-camera-permission-denied': string;
281
+ 'pisell-camera-switch-camera': string;
282
+ 'pisell-camera-canvas': string;
283
+ 'pisell-camera-checking': string;
284
+ 'pisell-camera-no-camera-desc': string;
285
+ 'pisell-upload-camera-local-files': string;
286
+ 'pisell-upload-camera-capture': string;
287
+ 'pisell-upload-camera-retake': string;
288
+ 'pisell-upload-camera-use': string;
279
289
  };
280
290
  export default _default;
@@ -340,5 +340,17 @@ export default {
340
340
  'pisell2.text.goodpass.product-vouchers': 'Promotions & Vouchers',
341
341
  'pisell2.text.goodpass.last-settlement': '(Last payment)',
342
342
  'pisell2.text.goodpass.view-more': 'View More',
343
- 'pisell2.text.goodpass.save': 'Save'
343
+ 'pisell2.text.goodpass.save': 'Save',
344
+ // 相机组件
345
+ 'pisell-camera-no-camera-accessible': 'No camera accessible',
346
+ 'pisell-camera-permission-denied': 'Permission denied',
347
+ 'pisell-camera-switch-camera': 'Switch camera',
348
+ 'pisell-camera-canvas': 'Canvas not supported',
349
+ 'pisell-camera-checking': 'Detecting camera...',
350
+ 'pisell-camera-no-camera-desc': 'Please check if your device has a camera or grant browser permission to access camera',
351
+ // 拍照组件
352
+ 'pisell-upload-camera-local-files': 'Local Files',
353
+ 'pisell-upload-camera-capture': 'Capture',
354
+ 'pisell-upload-camera-retake': 'Retake',
355
+ 'pisell-upload-camera-use': 'Use photo'
344
356
  };
@@ -271,5 +271,15 @@ declare const _default: {
271
271
  'pisell2.text.goodpass.last-settlement': string;
272
272
  'pisell2.text.goodpass.view-more': string;
273
273
  'pisell2.text.goodpass.save': string;
274
+ 'pisell-camera-no-camera-accessible': string;
275
+ 'pisell-camera-permission-denied': string;
276
+ 'pisell-camera-switch-camera': string;
277
+ 'pisell-camera-canvas': string;
278
+ 'pisell-camera-checking': string;
279
+ 'pisell-camera-no-camera-desc': string;
280
+ 'pisell-upload-camera-local-files': string;
281
+ 'pisell-upload-camera-capture': string;
282
+ 'pisell-upload-camera-retake': string;
283
+ 'pisell-upload-camera-use': string;
274
284
  };
275
285
  export default _default;
@@ -331,5 +331,17 @@ export default {
331
331
  'pisell2.text.goodpass.product-vouchers': '优惠促销',
332
332
  'pisell2.text.goodpass.last-settlement': '(上次结算)',
333
333
  'pisell2.text.goodpass.view-more': '查看更多',
334
- 'pisell2.text.goodpass.save': '节省'
334
+ 'pisell2.text.goodpass.save': '节省',
335
+ // 相机组件
336
+ 'pisell-camera-no-camera-accessible': '没有找到摄像头',
337
+ 'pisell-camera-permission-denied': '没有权限使用摄像头',
338
+ 'pisell-camera-switch-camera': '切换摄像头',
339
+ 'pisell-camera-canvas': 'canvas不支持',
340
+ 'pisell-camera-checking': '正在检测摄像头...',
341
+ 'pisell-camera-no-camera-desc': '请检查设备是否连接摄像头或授权浏览器访问摄像头',
342
+ // 拍照组件
343
+ 'pisell-upload-camera-local-files': '本地文件',
344
+ 'pisell-upload-camera-capture': '拍摄/拍照',
345
+ 'pisell-upload-camera-retake': '重拍',
346
+ 'pisell-upload-camera-use': '使用照片'
335
347
  };
@@ -271,5 +271,15 @@ declare const _default: {
271
271
  'pisell2.text.goodpass.last-settlement': string;
272
272
  'pisell2.text.goodpass.view-more': string;
273
273
  'pisell2.text.goodpass.save': string;
274
+ 'pisell-camera-no-camera-accessible': string;
275
+ 'pisell-camera-permission-denied': string;
276
+ 'pisell-camera-switch-camera': string;
277
+ 'pisell-camera-canvas': string;
278
+ 'pisell-camera-checking': string;
279
+ 'pisell-camera-no-camera-desc': string;
280
+ 'pisell-upload-camera-local-files': string;
281
+ 'pisell-upload-camera-capture': string;
282
+ 'pisell-upload-camera-retake': string;
283
+ 'pisell-upload-camera-use': string;
274
284
  };
275
285
  export default _default;
@@ -332,5 +332,17 @@ export default {
332
332
  'pisell2.text.goodpass.product-vouchers': '優惠促銷',
333
333
  'pisell2.text.goodpass.last-settlement': '(上次結算)',
334
334
  'pisell2.text.goodpass.view-more': '查看更多',
335
- 'pisell2.text.goodpass.save': '節省'
335
+ 'pisell2.text.goodpass.save': '節省',
336
+ // 相机组件
337
+ 'pisell-camera-no-camera-accessible': '沒有找到攝像頭',
338
+ 'pisell-camera-permission-denied': '沒有權限使用攝像頭',
339
+ 'pisell-camera-switch-camera': '切換攝像頭',
340
+ 'pisell-camera-canvas': 'canvas不支持',
341
+ 'pisell-camera-checking': '正在檢測攝像頭...',
342
+ 'pisell-camera-no-camera-desc': '請檢查設備是否連接攝像頭或授權瀏覽器訪問攝像頭',
343
+ // 拍照组件
344
+ 'pisell-upload-camera-local-files': '本地文件',
345
+ 'pisell-upload-camera-capture': '拍攝/拍照',
346
+ 'pisell-upload-camera-retake': '重拍',
347
+ 'pisell-upload-camera-use': '使用照片'
336
348
  };
@@ -1 +1 @@
1
- export declare const isMobile: () => any;
1
+ export declare const isMobile: () => boolean;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ColorPickerProps } from 'antd';
3
2
  declare const ColorPicker: (props: ColorPickerProps) => JSX.Element;
4
3
  export default ColorPicker;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const FormItem: (props: any) => JSX.Element;
2
3
  export default FormItem;
@@ -56,6 +56,7 @@ var BaseTable = (props, ref) => {
56
56
  columns: propsColumns,
57
57
  dataSource,
58
58
  operationContent,
59
+ currentSettingKey,
59
60
  ...others
60
61
  } = props;
61
62
  const tableRef = (0, import_react.useRef)(null);
@@ -70,6 +71,9 @@ var BaseTable = (props, ref) => {
70
71
  }
71
72
  return originData;
72
73
  }, [originData, __designMode]);
74
+ const formatCurrentSettingKey = (0, import_react.useMemo)(() => {
75
+ return currentSettingKey || props.__id || "";
76
+ }, [currentSettingKey]);
73
77
  const { dataSourceKey, dataSourceKeyRef } = (0, import_useDataSourceKey.default)();
74
78
  const beforeClose = (0, import_react.useRef)();
75
79
  const setBeforeClose = (0, import_react.useCallback)((fn) => {
@@ -84,7 +88,7 @@ var BaseTable = (props, ref) => {
84
88
  Container,
85
89
  drawerContent
86
90
  } = (0, import_useDrawerState.default)(operationContent);
87
- const { queryPageConfig, handleValuesChange, refreshData, handleFilterChange, refreshCurrentPage } = (0, import_useTableQuery.default)(props);
91
+ const { queryPageConfig, handleValuesChange, refreshData, handleFilterChange, refreshCurrentPage, getInitialValues } = (0, import_useTableQuery.default)(props, formatCurrentSettingKey);
88
92
  const handleAllValuesChange = (changedValues, values) => {
89
93
  var _a;
90
94
  (_a = props == null ? void 0 : props.onValuesChange) == null ? void 0 : _a.call(props, changedValues, values);
@@ -130,7 +134,8 @@ var BaseTable = (props, ref) => {
130
134
  closeDrawer,
131
135
  refreshData,
132
136
  handleFilterChange,
133
- tableRef
137
+ tableRef,
138
+ getInitialValues
134
139
  });
135
140
  (0, import_react.useImperativeHandle)(ref, () => {
136
141
  if (tableRef.current) {
@@ -147,6 +152,7 @@ var BaseTable = (props, ref) => {
147
152
  ref: tableRef,
148
153
  ...others,
149
154
  ...transformProps,
155
+ currentSettingKey: formatCurrentSettingKey,
150
156
  dataSource: (data == null ? void 0 : data.data) || [],
151
157
  loading: list == null ? void 0 : list.loading,
152
158
  onValuesChange: handleAllValuesChange
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import './index.less';
3
2
  interface BaseFilterItem {
4
3
  name?: string;
@@ -22,6 +21,7 @@ interface FilterProps {
22
21
  placeholder: string;
23
22
  key: string;
24
23
  };
24
+ getInitialValues?: () => Record<string, any>;
25
25
  }
26
26
  declare const Filter: (props: FilterProps) => JSX.Element;
27
27
  export default Filter;
@@ -52,7 +52,8 @@ var Filter = (props) => {
52
52
  handleValuesChange,
53
53
  search,
54
54
  filterBy,
55
- show
55
+ show,
56
+ getInitialValues
56
57
  } = props;
57
58
  const [form] = import_antd.Form.useForm();
58
59
  const { dataSource } = (0, import_useDataSource.default)();
@@ -155,6 +156,9 @@ var Filter = (props) => {
155
156
  }
156
157
  ) : null;
157
158
  }, [search]);
159
+ const initialValues = (0, import_react.useMemo)(() => {
160
+ return getInitialValues == null ? void 0 : getInitialValues();
161
+ }, [search, filterBy]);
158
162
  return /* @__PURE__ */ import_react.default.createElement(
159
163
  import_antd.Form,
160
164
  {
@@ -163,7 +167,8 @@ var Filter = (props) => {
163
167
  size: "large",
164
168
  layout: "inline",
165
169
  className: "filter-form-wrapper",
166
- onValuesChange
170
+ onValuesChange,
171
+ initialValues
167
172
  },
168
173
  searchDom,
169
174
  filterDom,
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const useDataSourceKey: () => {
2
3
  dataSourceKey: string | undefined;
3
4
  dataSourceKeyRef: import("react").MutableRefObject<string | undefined>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { Drawer } from 'antd';
3
2
  import { OperationItem } from '../type';
4
3
  declare const useDrawerState: (operationContent?: {
@@ -9,7 +8,7 @@ declare const useDrawerState: (operationContent?: {
9
8
  openDrawer: (item: OperationItem) => void;
10
9
  closeDrawer: () => void;
11
10
  drawerContent: import("react").ReactNode;
12
- Container: {
11
+ Container: typeof Drawer | {
13
12
  (props: import("../../../pisellModal").PisellModalProps): JSX.Element;
14
13
  confirm: (props: import("../../../pisellModal/components/functions").PisellModalFuncProps) => {
15
14
  destroy: () => void;
@@ -33,7 +32,7 @@ declare const useDrawerState: (operationContent?: {
33
32
  update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
34
33
  };
35
34
  Information: (props: import("../../../pisellModal/components/Information").InformationProps) => JSX.Element;
36
- } | typeof Drawer;
35
+ };
37
36
  containerProps: {};
38
37
  };
39
38
  export default useDrawerState;
@@ -9,6 +9,7 @@ interface UseTablePropsProps {
9
9
  refreshData: () => void;
10
10
  handleFilterChange: (changedFields: any, allFields: any) => void;
11
11
  tableRef: any;
12
+ getInitialValues: () => Record<string, any>;
12
13
  }
13
14
  /**
14
15
  * 处理table的props
@@ -17,7 +18,8 @@ interface UseTablePropsProps {
17
18
  * @returns
18
19
  */
19
20
  declare const useTableProps: (props: UseTablePropsProps) => {
20
- title: number | boolean | React.ReactFragment | JSX.Element | (() => React.ReactNode) | null | undefined;
21
+ currentComponentId: any;
22
+ title: number | boolean | React.ReactFragment | (() => React.ReactNode) | JSX.Element | null | undefined;
21
23
  pagination: {
22
24
  total: number;
23
25
  current: number;
@@ -26,11 +28,13 @@ declare const useTableProps: (props: UseTablePropsProps) => {
26
28
  showSizeChanger: boolean;
27
29
  };
28
30
  columns: import("./useColumns").Column[];
29
- subTitle: number | boolean | React.ReactFragment | JSX.Element | (() => React.ReactNode) | null | undefined;
31
+ subTitle: number | boolean | React.ReactFragment | (() => React.ReactNode) | JSX.Element | null | undefined;
30
32
  buttons: any[] | null;
31
- filter: JSX.Element | null;
33
+ filter: any;
32
34
  onRow: (record: any) => any;
33
35
  actionButtons: any[] | null;
36
+ __id?: string | undefined;
37
+ currentSettingKey?: string | undefined;
34
38
  titleButtons?: {
35
39
  show: boolean;
36
40
  maxCount: number;
@@ -42,18 +46,12 @@ declare const useTableProps: (props: UseTablePropsProps) => {
42
46
  items: OperationItem[];
43
47
  } | undefined;
44
48
  operation?: {
45
- /**
46
- * 处理table的props
47
- * 转换title
48
- * @param props
49
- * @returns
50
- */
51
49
  show: boolean;
52
50
  title: string;
53
51
  width: number;
54
- align: "center" | "left" | "right";
52
+ align: "left" | "center" | "right";
55
53
  fixed: false | "left" | "right";
56
- type: "link" | "button";
54
+ type: "button" | "link";
57
55
  items: OperationItem[];
58
56
  } | undefined;
59
57
  operationContent?: {
@@ -94,5 +92,6 @@ declare const useTableProps: (props: UseTablePropsProps) => {
94
92
  create?: Record<string, any> | undefined;
95
93
  destroy?: Record<string, any> | undefined;
96
94
  } | undefined;
95
+ localSettings?: import("../../../table/types").LocalSettingsType | undefined;
97
96
  };
98
97
  export default useTableProps;
@@ -54,7 +54,8 @@ var useTableProps = (props) => {
54
54
  closeDrawer,
55
55
  refreshData,
56
56
  handleFilterChange,
57
- tableRef
57
+ tableRef,
58
+ getInitialValues
58
59
  } = props;
59
60
  const {
60
61
  title: propsTitle,
@@ -66,7 +67,9 @@ var useTableProps = (props) => {
66
67
  search,
67
68
  clickToDetail,
68
69
  onRow: propsOnRow,
69
- filterBy
70
+ filterBy,
71
+ currentSettingKey,
72
+ __id
70
73
  } = originProps;
71
74
  const {
72
75
  items,
@@ -260,16 +263,19 @@ var useTableProps = (props) => {
260
263
  if (!(propsFilter == null ? void 0 : propsFilter.show) && !(search == null ? void 0 : search.show)) {
261
264
  return null;
262
265
  }
263
- return /* @__PURE__ */ import_react.default.createElement(
266
+ const dom = /* @__PURE__ */ import_react.default.createElement(
264
267
  import_filter.default,
265
268
  {
266
269
  ...propsFilter,
267
270
  componentId,
268
271
  search,
269
272
  handleValuesChange: handleFilterChange,
270
- filterBy
273
+ filterBy,
274
+ getInitialValues
271
275
  }
272
276
  );
277
+ dom.__proto__.items = propsFilter == null ? void 0 : propsFilter.items;
278
+ return dom;
273
279
  }, [propsFilter, search]);
274
280
  const onRow = (0, import_ahooks.useMemoizedFn)((record) => {
275
281
  if (!(clickToDetail == null ? void 0 : clickToDetail.show)) {
@@ -300,6 +306,7 @@ var useTableProps = (props) => {
300
306
  });
301
307
  return {
302
308
  ...originProps,
309
+ currentComponentId: componentId,
303
310
  title,
304
311
  pagination,
305
312
  columns,
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { DataSourceTableProps } from '../type';
3
2
  declare type Params = {
4
3
  pagination?: {
@@ -12,7 +11,7 @@ declare type Params = {
12
11
  sortBy: string;
13
12
  };
14
13
  };
15
- declare const useTableQuery: (props: DataSourceTableProps) => {
14
+ declare const useTableQuery: (props: DataSourceTableProps, currentSettingHash: string) => {
16
15
  queryPageConfig: {
17
16
  page: number;
18
17
  pageSize: number;
@@ -29,5 +28,6 @@ declare const useTableQuery: (props: DataSourceTableProps) => {
29
28
  refreshData: () => void;
30
29
  handleFilterChange: (changedFields: any, allFields: any) => void;
31
30
  refreshCurrentPage: () => void;
31
+ getInitialValues: () => Record<string, any>;
32
32
  };
33
33
  export default useTableQuery;