@pisell/materials 1.0.504 → 1.0.505

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 (29) 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/render/default/view.js +9 -9
  7. package/build/lowcode/view.js +10 -10
  8. package/es/components/dataSourceComponents/dataSourceForm/utils.js +4 -2
  9. package/es/components/dataSourceComponents/dataSourceTable/filter/index.js +2 -1
  10. package/es/components/dataSourceComponents/dataSourceTable/filter/utils.js +1 -0
  11. package/es/components/dataSourceComponents/fields/Translation/BaseTranslation.js +1 -1
  12. package/es/components/dataSourceComponents/hooks/useActions.js +10 -1
  13. package/es/components/table/Table/index.js +17 -6
  14. package/es/components/table/index.js +5 -1
  15. package/es/components/table/model.d.ts +1 -0
  16. package/es/components/table/model.js +7 -1
  17. package/es/hooks/useTranslationOriginal.js +2 -1
  18. package/lib/components/dataSourceComponents/dataSourceForm/utils.js +2 -2
  19. package/lib/components/dataSourceComponents/dataSourceTable/filter/index.js +2 -1
  20. package/lib/components/dataSourceComponents/dataSourceTable/filter/utils.js +1 -0
  21. package/lib/components/dataSourceComponents/fields/Translation/BaseTranslation.js +1 -1
  22. package/lib/components/dataSourceComponents/hooks/useActions.js +5 -1
  23. package/lib/components/table/Table/index.js +17 -6
  24. package/lib/components/table/index.js +5 -1
  25. package/lib/components/table/model.d.ts +1 -0
  26. package/lib/components/table/model.js +5 -1
  27. package/lib/hooks/useTranslationOriginal.js +2 -1
  28. package/lowcode/data-source-form/utils.ts +2 -2
  29. package/package.json +1 -1
@@ -294,12 +294,14 @@ export var withOptions = function withOptions(WrappedComponent) {
294
294
  if (optionSourceType !== 'api') {
295
295
  return propsOptions;
296
296
  }
297
- return ((_list$data = list.data) === null || _list$data === void 0 ? void 0 : (_list$data$data = _list$data.data) === null || _list$data$data === void 0 ? void 0 : _list$data$data.map(function (item) {
297
+ return (((_list$data = list.data) === null || _list$data === void 0 ? void 0 : (_list$data$data = _list$data.data) === null || _list$data$data === void 0 ? void 0 : _list$data$data.map(function (item) {
298
298
  return {
299
299
  label: translationOriginal(item[labelField]),
300
300
  value: item[valueField]
301
301
  };
302
- })) || [];
302
+ })) || []).sort(function (a, b) {
303
+ return a.label.localeCompare(b.label);
304
+ });
303
305
  }, [propsOptions, optionSourceType, list === null || list === void 0 ? void 0 : (_list$data2 = list.data) === null || _list$data2 === void 0 ? void 0 : _list$data2.data]);
304
306
  return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, {
305
307
  options: options
@@ -145,7 +145,8 @@ var Filter = function Filter(props) {
145
145
  style: {
146
146
  width: 200,
147
147
  margin: 0
148
- }
148
+ },
149
+ allowClear: true
149
150
  }) : null;
150
151
  }, [search]);
151
152
  return /*#__PURE__*/React.createElement(Form, {
@@ -48,6 +48,7 @@ var getCptProps = function getCptProps(field, cptType, item) {
48
48
  props.allowClear = true;
49
49
  if (cptType === 'FormItemSelect') {
50
50
  props.mode = 'multiple';
51
+ props.showSearch = true;
51
52
  }
52
53
  if (['Select', 'Radio.Group', 'Checkbox.Group'].includes(field === null || field === void 0 ? void 0 : (_field$uiSchema2 = field.uiSchema) === null || _field$uiSchema2 === void 0 ? void 0 : _field$uiSchema2['x-component']) && ((field === null || field === void 0 ? void 0 : (_field$uiSchema3 = field.uiSchema) === null || _field$uiSchema3 === void 0 ? void 0 : (_field$uiSchema3$enum = _field$uiSchema3.enum) === null || _field$uiSchema3$enum === void 0 ? void 0 : _field$uiSchema3$enum.length) || 0) > 0) {
53
54
  var _field$uiSchema4, _field$uiSchema5;
@@ -52,7 +52,7 @@ var Translation = function Translation(_ref) {
52
52
  var _ref3 = _slicedToArray(_ref2, 2),
53
53
  key = _ref3[0],
54
54
  val = _ref3[1];
55
- return val;
55
+ return key !== 'original' && val;
56
56
  });
57
57
  }, [value]);
58
58
  var handleInputChange = useCallback(function (lang) {
@@ -2,6 +2,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2
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
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
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 { useMemo } from 'react';
5
6
  import { useMemoizedFn } from 'ahooks';
6
7
  import PisellToast from "../../pisellToast";
7
8
  import useFormat from "../dataSourceTable/hooks/useFormat";
@@ -41,8 +42,16 @@ var useActions = function useActions() {
41
42
  formatListResult = _useFormat.formatListResult,
42
43
  formatListParams = _useFormat.formatListParams,
43
44
  formatCreateUpdateParams = _useFormat.formatCreateUpdateParams;
45
+
46
+ // 真实currentRecord
47
+ var currentRecord = useMemo(function () {
48
+ return parseVariable === null || parseVariable === void 0 ? void 0 : parseVariable(currentValue, {});
49
+ }, [currentValue, parseVariable]);
44
50
  var getParsedActions = useMemoizedFn(function () {
45
- return parseActions(originalActions, {});
51
+ // 目前接口使用变量还无法在界面配置 所以这里默认追加currentRecord
52
+ return parseActions(originalActions, {
53
+ currentRecord: currentRecord
54
+ });
46
55
  });
47
56
 
48
57
  // 生成自定义 API 请求函数
@@ -43,7 +43,8 @@ var GridViewTable = function GridViewTable(_ref) {
43
43
  }) || [];
44
44
  var tableWrapRef = useRef(null);
45
45
  var defaultDataSource = state.dataSource,
46
- originDataSource = state.originDataSource;
46
+ originDataSource = state.originDataSource,
47
+ isTerminal = state.isTerminal;
47
48
  var handleSave = useMemoizedFn(function (row) {
48
49
  var newData = _toConsumableArray(defaultDataSource);
49
50
  var index = newData.findIndex(function (item) {
@@ -114,6 +115,7 @@ var GridViewTable = function GridViewTable(_ref) {
114
115
  className: 'materials-grid-table-wrap',
115
116
  ref: tableWrapRef
116
117
  }, /*#__PURE__*/React.createElement(AutoSizerContent, {
118
+ isTerminal: isTerminal,
117
119
  tableWrapRef: tableWrapRef,
118
120
  dataSource: dataSource,
119
121
  tableProps: tableProps,
@@ -129,7 +131,8 @@ var AutoSizerContent = function AutoSizerContent(props) {
129
131
  paginationConfig = props.paginationConfig,
130
132
  columns = props.columns,
131
133
  components = props.components,
132
- tableWrapRef = props.tableWrapRef;
134
+ tableWrapRef = props.tableWrapRef,
135
+ isTerminal = props.isTerminal;
133
136
  var _ref3 = useSize(tableWrapRef) || {},
134
137
  height = _ref3.height;
135
138
  var debouncedHeight = useDebounce(height, {
@@ -144,7 +147,7 @@ var AutoSizerContent = function AutoSizerContent(props) {
144
147
  return total > ((tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio5 = tableProps.pagination) === null || _tableProps$paginatio5 === void 0 ? void 0 : _tableProps$paginatio5.pageSize) || (tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio6 = tableProps.pagination) === null || _tableProps$paginatio6 === void 0 ? void 0 : (_tableProps$paginatio7 = _tableProps$paginatio6.pageSizeOptions) === null || _tableProps$paginatio7 === void 0 ? void 0 : _tableProps$paginatio7[0]) || 10) || (tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio8 = tableProps.pagination) === null || _tableProps$paginatio8 === void 0 ? void 0 : _tableProps$paginatio8.showPagination) && total > 10;
145
148
  }, [tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio9 = tableProps.pagination) === null || _tableProps$paginatio9 === void 0 ? void 0 : _tableProps$paginatio9.localPagination, tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio10 = tableProps.pagination) === null || _tableProps$paginatio10 === void 0 ? void 0 : _tableProps$paginatio10.total, dataSource.length, tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio11 = tableProps.pagination) === null || _tableProps$paginatio11 === void 0 ? void 0 : (_tableProps$paginatio12 = _tableProps$paginatio11.pageSizeOptions) === null || _tableProps$paginatio12 === void 0 ? void 0 : _tableProps$paginatio12[0]]);
146
149
  var scroll = useGenScroll({
147
- wrapHeight: debouncedHeight || 500,
150
+ wrapHeight: height || 500,
148
151
  scroll: tableProps.scroll,
149
152
  columns: columns,
150
153
  isShowPagination: isShowPagination
@@ -152,18 +155,26 @@ var AutoSizerContent = function AutoSizerContent(props) {
152
155
  var debouncedScroll = useDebounce(scroll, {
153
156
  wait: 200
154
157
  });
158
+ var platformScroll = useMemo(function () {
159
+ if (isTerminal) {
160
+ return debouncedScroll;
161
+ }
162
+ return scroll;
163
+ }, [debouncedScroll, scroll, isTerminal]);
155
164
  var basicTable = useMemo(function () {
165
+ if (!height) {
166
+ return null;
167
+ }
156
168
  return /*#__PURE__*/React.createElement(BasicTable, _extends({
157
- key: debouncedScroll,
158
169
  dataSource: dataSource,
159
170
  columns: columns,
160
171
  className: 'grid-view-table',
161
172
  components: components
162
173
  }, tableProps, {
163
- scroll: debouncedScroll,
174
+ scroll: platformScroll,
164
175
  pagination: paginationConfig
165
176
  }));
166
- }, [debouncedScroll, dataSource, columns, components, paginationConfig, tableProps]);
177
+ }, [height, platformScroll, dataSource, columns, components, paginationConfig, tableProps]);
167
178
  return /*#__PURE__*/React.createElement(SortRow, {
168
179
  rowKey: tableProps.rowKey,
169
180
  onSortChange: tableProps.onSortChange
@@ -180,7 +180,11 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
180
180
  type: 'setUtils',
181
181
  payload: utils || {}
182
182
  });
183
- }, [utils]);
183
+ modal.dispatch({
184
+ type: 'setIsTerminal',
185
+ payload: isTerminal
186
+ });
187
+ }, [utils, isTerminal]);
184
188
  useEffect(function () {
185
189
  modal.dispatch({
186
190
  type: 'setDefaultColumns',
@@ -12,6 +12,7 @@ interface FormState {
12
12
  quickFilter: FilterItemProps[];
13
13
  otherFilter: FilterItemProps[];
14
14
  utils: any;
15
+ isTerminal: boolean;
15
16
  localPagination: boolean;
16
17
  tableWidth: number;
17
18
  currentDataSource: any[];
@@ -21,6 +21,7 @@ var defaultState = {
21
21
  quickFilter: [],
22
22
  otherFilter: [],
23
23
  utils: {},
24
+ isTerminal: false,
24
25
  setting: {
25
26
  field: {
26
27
  edit: 0
@@ -29,7 +30,7 @@ var defaultState = {
29
30
  edit: 0
30
31
  }
31
32
  },
32
- tableWidth: 500,
33
+ tableWidth: 700,
33
34
  // 当前页展示的数据
34
35
  currentDataSource: [],
35
36
  // 经过一系列格式化之后的所有数据
@@ -83,6 +84,11 @@ var _getContext = getContext({
83
84
  utils: payload
84
85
  });
85
86
  },
87
+ setIsTerminal: function setIsTerminal(state, payload) {
88
+ return _objectSpread(_objectSpread({}, state), {}, {
89
+ isTerminal: payload
90
+ });
91
+ },
86
92
  syncStorage: function syncStorage(state, payload) {
87
93
  return _objectSpread({}, state);
88
94
  },
@@ -1,9 +1,10 @@
1
1
  import useEngineContext from "./useEngineContext";
2
+ import { isString } from "@pisell/utils";
2
3
  var useTranslationOriginal = function useTranslationOriginal() {
3
4
  var _context$appHelper, _context$appHelper$ut;
4
5
  var context = useEngineContext();
5
6
  return (context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : (_context$appHelper$ut = _context$appHelper.utils) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.translationOriginal) || function (val) {
6
- return val === null || val === void 0 ? void 0 : val.original;
7
+ return isString(val) ? val : val === null || val === void 0 ? void 0 : val.original;
7
8
  };
8
9
  };
9
10
  export default useTranslationOriginal;
@@ -320,10 +320,10 @@ var withOptions = (WrappedComponent) => {
320
320
  if (optionSourceType !== "api") {
321
321
  return propsOptions;
322
322
  }
323
- return ((_b = (_a2 = list.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.map((item) => ({
323
+ return (((_b = (_a2 = list.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.map((item) => ({
324
324
  label: translationOriginal(item[labelField]),
325
325
  value: item[valueField]
326
- }))) || [];
326
+ }))) || []).sort((a, b) => a.label.localeCompare(b.label));
327
327
  }, [propsOptions, optionSourceType, (_a = list == null ? void 0 : list.data) == null ? void 0 : _a.data]);
328
328
  return /* @__PURE__ */ import_react.default.createElement(WrappedComponent, { ...props, options });
329
329
  };
@@ -150,7 +150,8 @@ var Filter = (props) => {
150
150
  placeholder: search.placeholder,
151
151
  renderMode: "edit",
152
152
  prefix: /* @__PURE__ */ import_react.default.createElement(import_icons.SearchOutlined, null),
153
- style: { width: 200, margin: 0 }
153
+ style: { width: 200, margin: 0 },
154
+ allowClear: true
154
155
  }
155
156
  ) : null;
156
157
  }, [search]);
@@ -78,6 +78,7 @@ var getCptProps = (field, cptType, item) => {
78
78
  props.allowClear = true;
79
79
  if (cptType === "FormItemSelect") {
80
80
  props.mode = "multiple";
81
+ props.showSearch = true;
81
82
  }
82
83
  if (["Select", "Radio.Group", "Checkbox.Group"].includes(
83
84
  (_b = field == null ? void 0 : field.uiSchema) == null ? void 0 : _b["x-component"]
@@ -60,7 +60,7 @@ var Translation = ({
60
60
  if (!value) {
61
61
  return false;
62
62
  }
63
- return Object.entries(value).some(([key, val]) => val);
63
+ return Object.entries(value).some(([key, val]) => key !== "original" && val);
64
64
  }, [value]);
65
65
  const handleInputChange = (0, import_react.useCallback)(
66
66
  (lang) => (e) => {
@@ -32,6 +32,7 @@ __export(useActions_exports, {
32
32
  default: () => useActions_default
33
33
  });
34
34
  module.exports = __toCommonJS(useActions_exports);
35
+ var import_react = require("react");
35
36
  var import_ahooks = require("ahooks");
36
37
  var import_pisellToast = __toESM(require("../../pisellToast"));
37
38
  var import_useFormat = __toESM(require("../dataSourceTable/hooks/useFormat"));
@@ -64,8 +65,11 @@ var useActions = ({
64
65
  dataSourceKey: dataSourceKey || "",
65
66
  fields: fields || []
66
67
  });
68
+ const currentRecord = (0, import_react.useMemo)(() => {
69
+ return parseVariable == null ? void 0 : parseVariable(currentValue, {});
70
+ }, [currentValue, parseVariable]);
67
71
  const getParsedActions = (0, import_ahooks.useMemoizedFn)(() => {
68
- return parseActions(originalActions, {});
72
+ return parseActions(originalActions, { currentRecord });
69
73
  });
70
74
  const genCustomApi = (0, import_ahooks.useMemoizedFn)(
71
75
  ({
@@ -57,7 +57,7 @@ var GridViewTable = ({
57
57
  const form = import_antd.Form.useFormInstance();
58
58
  const column_setting = import_antd.Form.useWatch("column_setting", { form, preserve: true }) || [];
59
59
  const tableWrapRef = (0, import_react.useRef)(null);
60
- const { dataSource: defaultDataSource, originDataSource } = state;
60
+ const { dataSource: defaultDataSource, originDataSource, isTerminal } = state;
61
61
  const handleSave = (0, import_ahooks.useMemoizedFn)((row) => {
62
62
  const newData = [...defaultDataSource];
63
63
  const index = newData.findIndex((item2) => row.key === item2.key);
@@ -133,6 +133,7 @@ var GridViewTable = ({
133
133
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "materials-grid-table-wrap", ref: tableWrapRef }, /* @__PURE__ */ import_react.default.createElement(
134
134
  AutoSizerContent,
135
135
  {
136
+ isTerminal,
136
137
  tableWrapRef,
137
138
  dataSource,
138
139
  tableProps,
@@ -150,7 +151,8 @@ var AutoSizerContent = (props) => {
150
151
  paginationConfig: paginationConfig2,
151
152
  columns,
152
153
  components,
153
- tableWrapRef
154
+ tableWrapRef,
155
+ isTerminal
154
156
  } = props;
155
157
  const { height } = (0, import_ahooks.useSize)(tableWrapRef) || {};
156
158
  const debouncedHeight = (0, import_ahooks.useDebounce)(height, { wait: 500 });
@@ -168,28 +170,37 @@ var AutoSizerContent = (props) => {
168
170
  (_d = (_c = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _c.pageSizeOptions) == null ? void 0 : _d[0]
169
171
  ]);
170
172
  const scroll = (0, import_useGenScroll.default)({
171
- wrapHeight: debouncedHeight || 500,
173
+ wrapHeight: height || 500,
172
174
  scroll: tableProps.scroll,
173
175
  columns,
174
176
  isShowPagination
175
177
  });
176
178
  const debouncedScroll = (0, import_ahooks.useDebounce)(scroll, { wait: 200 });
179
+ const platformScroll = (0, import_react.useMemo)(() => {
180
+ if (isTerminal) {
181
+ return debouncedScroll;
182
+ }
183
+ return scroll;
184
+ }, [debouncedScroll, scroll, isTerminal]);
177
185
  const basicTable = (0, import_react.useMemo)(() => {
186
+ if (!height) {
187
+ return null;
188
+ }
178
189
  return /* @__PURE__ */ import_react.default.createElement(
179
190
  import_BasicTable.default,
180
191
  {
181
- key: debouncedScroll,
182
192
  dataSource,
183
193
  columns,
184
194
  className: "grid-view-table",
185
195
  components,
186
196
  ...tableProps,
187
- scroll: debouncedScroll,
197
+ scroll: platformScroll,
188
198
  pagination: paginationConfig2
189
199
  }
190
200
  );
191
201
  }, [
192
- debouncedScroll,
202
+ height,
203
+ platformScroll,
193
204
  dataSource,
194
205
  columns,
195
206
  components,
@@ -185,7 +185,11 @@ var GridView = (0, import_model.Provider)(
185
185
  type: "setUtils",
186
186
  payload: utils || {}
187
187
  });
188
- }, [utils]);
188
+ modal.dispatch({
189
+ type: "setIsTerminal",
190
+ payload: isTerminal
191
+ });
192
+ }, [utils, isTerminal]);
189
193
  (0, import_react.useEffect)(() => {
190
194
  modal.dispatch({
191
195
  type: "setDefaultColumns",
@@ -12,6 +12,7 @@ interface FormState {
12
12
  quickFilter: FilterItemProps[];
13
13
  otherFilter: FilterItemProps[];
14
14
  utils: any;
15
+ isTerminal: boolean;
15
16
  localPagination: boolean;
16
17
  tableWidth: number;
17
18
  currentDataSource: any[];
@@ -51,6 +51,7 @@ var defaultState = {
51
51
  quickFilter: [],
52
52
  otherFilter: [],
53
53
  utils: {},
54
+ isTerminal: false,
54
55
  setting: {
55
56
  field: {
56
57
  edit: 0
@@ -59,7 +60,7 @@ var defaultState = {
59
60
  edit: 0
60
61
  }
61
62
  },
62
- tableWidth: 500,
63
+ tableWidth: 700,
63
64
  // 当前页展示的数据
64
65
  currentDataSource: [],
65
66
  // 经过一系列格式化之后的所有数据
@@ -101,6 +102,9 @@ var { Provider, Context } = (0, import_miniRedux.default)({
101
102
  setUtils(state, payload) {
102
103
  return { ...state, utils: payload };
103
104
  },
105
+ setIsTerminal(state, payload) {
106
+ return { ...state, isTerminal: payload };
107
+ },
104
108
  syncStorage(state, payload) {
105
109
  return { ...state };
106
110
  },
@@ -33,9 +33,10 @@ __export(useTranslationOriginal_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(useTranslationOriginal_exports);
35
35
  var import_useEngineContext = __toESM(require("./useEngineContext"));
36
+ var import_utils = require("@pisell/utils");
36
37
  var useTranslationOriginal = () => {
37
38
  var _a, _b;
38
39
  const context = (0, import_useEngineContext.default)();
39
- return ((_b = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.translationOriginal) || ((val) => val == null ? void 0 : val.original);
40
+ return ((_b = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.translationOriginal) || ((val) => (0, import_utils.isString)(val) ? val : val == null ? void 0 : val.original);
40
41
  };
41
42
  var useTranslationOriginal_default = useTranslationOriginal;
@@ -226,10 +226,10 @@ export const createFormItemSchema = (
226
226
  props.direction = 'horizontal';
227
227
  } else {
228
228
  props.styleType = 'antd';
229
+ props.showSearch = true;
230
+ props.isShowDropdown = true;
229
231
  if (props.mode === "multiple") {
230
232
  props.selectAll = true;
231
- props.isShowDropdown = true;
232
- props.showSearch = true;
233
233
  }
234
234
  }
235
235
  props.optionSourceType = 'default';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.504",
3
+ "version": "1.0.505",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",