@nokecy/qc-ui 1.1.41 → 1.1.42

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.
@@ -20,6 +20,17 @@ declare const useArrayTableActions: () => ObservableColumnSource[];
20
20
  * 校验安全:未碰过的存量格本就是 readPretty、本就不参与校验,不挂树校验语义零变化。@author nokecy
21
21
  */
22
22
  declare const LazyAgField: (params: any) => React.JSX.Element;
23
+ /**
24
+ * 反应式只读文本渲染器(列级 readPretty 在「可编辑表」里的展示列)。
25
+ *
26
+ * 只读纯文本快路径(valueFormatter)经 AG-Grid 缓存 params.value 取值,setValuesIn 程序化原地改值
27
+ * 不会刷新该格 → 自动带出的外码/描述等只读展示列空白。本渲染器 Observer 读可观察 record[dataKey],
28
+ * 保持 readPretty 纯文本观感(不挂 Formily 树、不可点编辑),但能跟随 setValuesIn 即时刷新。
29
+ *
30
+ * 仅用于「可编辑表的列级 readPretty 展示列」;「整表 readPretty」(明细/详情页,数据经 setValues 整体
31
+ * 加载,行引用整体替换→AG-Grid 自然刷新)仍走更廉价的静态 valueFormatter 快路径。@author nokecy
32
+ */
33
+ declare const LazyReadOnlyText: (params: any) => React.JSX.Element;
23
34
  declare const buildArrayTableColumns: (dataSource: any[], field: ArrayField, sources: ObservableColumnSource[]) => AgGridReactProps['columnDefs'];
24
35
  declare const useAddition: () => React.JSX.Element | null;
25
- export { isColumnComponent, useArrayTableSources, useArrayTableActions, buildArrayTableColumns, useAddition, LazyAgField };
36
+ export { isColumnComponent, useArrayTableSources, useArrayTableActions, buildArrayTableColumns, useAddition, LazyAgField, LazyReadOnlyText };
@@ -4,7 +4,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useArrayTableSources = exports.useArrayTableActions = exports.useAddition = exports.isColumnComponent = exports.buildArrayTableColumns = exports.LazyAgField = void 0;
7
+ exports.useArrayTableSources = exports.useArrayTableActions = exports.useAddition = exports.isColumnComponent = exports.buildArrayTableColumns = exports.LazyReadOnlyText = exports.LazyAgField = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _react2 = require("@formily/react");
10
10
  var _shared = require("@formily/shared");
@@ -204,6 +204,41 @@ var LazyAgField = exports.LazyAgField = function LazyAgField(params) {
204
204
  });
205
205
  };
206
206
 
207
+ /**
208
+ * 反应式只读文本渲染器(列级 readPretty 在「可编辑表」里的展示列)。
209
+ *
210
+ * 只读纯文本快路径(valueFormatter)经 AG-Grid 缓存 params.value 取值,setValuesIn 程序化原地改值
211
+ * 不会刷新该格 → 自动带出的外码/描述等只读展示列空白。本渲染器 Observer 读可观察 record[dataKey],
212
+ * 保持 readPretty 纯文本观感(不挂 Formily 树、不可点编辑),但能跟随 setValuesIn 即时刷新。
213
+ *
214
+ * 仅用于「可编辑表的列级 readPretty 展示列」;「整表 readPretty」(明细/详情页,数据经 setValues 整体
215
+ * 加载,行引用整体替换→AG-Grid 自然刷新)仍走更廉价的静态 valueFormatter 快路径。@author nokecy
216
+ */
217
+ var LazyReadOnlyText = exports.LazyReadOnlyText = function LazyReadOnlyText(params) {
218
+ var _fieldSchema$name2;
219
+ var value = params.value,
220
+ record = params.data,
221
+ colDef = params.colDef,
222
+ formatter = params.formatter,
223
+ columnProps = params.columnProps,
224
+ fieldSchema = params.fieldSchema;
225
+ var dataKey = (_fieldSchema$name2 = fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.name) !== null && _fieldSchema$name2 !== void 0 ? _fieldSchema$name2 : colDef === null || colDef === void 0 ? void 0 : colDef.field;
226
+ return /*#__PURE__*/_react.default.createElement(_react2.Observer, null, function () {
227
+ var liveValue = dataKey != null && record ? record[dataKey] : value;
228
+ var text = formatter ? formatter(liveValue, {
229
+ columnProps: columnProps,
230
+ fieldSchema: fieldSchema
231
+ }) : liveValue == null ? '' : String(liveValue);
232
+ return /*#__PURE__*/_react.default.createElement("span", {
233
+ className: "ag-array-table-readonly-text",
234
+ style: {
235
+ display: 'inline-block',
236
+ width: '100%'
237
+ }
238
+ }, text);
239
+ });
240
+ };
241
+
207
242
  // 在 Column 的子 schema 里递归找到内层数据字段(可读 x-component / x-pattern / x-reactions / enum) @author nokecy
208
243
  var findDataFieldSchema = function findDataFieldSchema(columnSchema, name) {
209
244
  if (!columnSchema || !columnSchema.properties) return null;
@@ -306,6 +341,21 @@ var buildArrayTableColumns = exports.buildArrayTableColumns = function buildArra
306
341
 
307
342
  // ① 只读纯文本
308
343
  if (readOnly && formatter) {
344
+ // 列级 readPretty 在「可编辑表」里是展示列(值可能被 setValuesIn 自动带出),静态 valueFormatter
345
+ // 读 AG-Grid 缓存值不刷新 → 反应式只读渲染。整表 readPretty(明细/详情页,数据 setValues 整体加载、
346
+ // 行引用整体替换、AG-Grid 自然刷新)仍走更廉价的静态 valueFormatter 快路径。@author nokecy
347
+ if (arrayPattern !== 'readPretty') {
348
+ return buf.concat(_objectSpread(_objectSpread(_objectSpread({}, base), valueGetter ? {
349
+ valueGetter: valueGetter
350
+ } : {}), {}, {
351
+ cellRenderer: LazyReadOnlyText,
352
+ cellRendererParams: {
353
+ formatter: formatter,
354
+ columnProps: columnProps,
355
+ fieldSchema: dataField
356
+ }
357
+ }));
358
+ }
309
359
  return buf.concat(_objectSpread(_objectSpread(_objectSpread({}, base), valueGetter ? {
310
360
  valueGetter: valueGetter
311
361
  } : {}), {}, {
@@ -20,6 +20,17 @@ declare const useArrayTableActions: () => ObservableColumnSource[];
20
20
  * 校验安全:未碰过的存量格本就是 readPretty、本就不参与校验,不挂树校验语义零变化。@author nokecy
21
21
  */
22
22
  declare const LazyAgField: (params: any) => React.JSX.Element;
23
+ /**
24
+ * 反应式只读文本渲染器(列级 readPretty 在「可编辑表」里的展示列)。
25
+ *
26
+ * 只读纯文本快路径(valueFormatter)经 AG-Grid 缓存 params.value 取值,setValuesIn 程序化原地改值
27
+ * 不会刷新该格 → 自动带出的外码/描述等只读展示列空白。本渲染器 Observer 读可观察 record[dataKey],
28
+ * 保持 readPretty 纯文本观感(不挂 Formily 树、不可点编辑),但能跟随 setValuesIn 即时刷新。
29
+ *
30
+ * 仅用于「可编辑表的列级 readPretty 展示列」;「整表 readPretty」(明细/详情页,数据经 setValues 整体
31
+ * 加载,行引用整体替换→AG-Grid 自然刷新)仍走更廉价的静态 valueFormatter 快路径。@author nokecy
32
+ */
33
+ declare const LazyReadOnlyText: (params: any) => React.JSX.Element;
23
34
  declare const buildArrayTableColumns: (dataSource: any[], field: ArrayField, sources: ObservableColumnSource[]) => AgGridReactProps['columnDefs'];
24
35
  declare const useAddition: () => React.JSX.Element | null;
25
- export { isColumnComponent, useArrayTableSources, useArrayTableActions, buildArrayTableColumns, useAddition, LazyAgField };
36
+ export { isColumnComponent, useArrayTableSources, useArrayTableActions, buildArrayTableColumns, useAddition, LazyAgField, LazyReadOnlyText };
@@ -197,6 +197,41 @@ var LazyAgField = function LazyAgField(params) {
197
197
  });
198
198
  };
199
199
 
200
+ /**
201
+ * 反应式只读文本渲染器(列级 readPretty 在「可编辑表」里的展示列)。
202
+ *
203
+ * 只读纯文本快路径(valueFormatter)经 AG-Grid 缓存 params.value 取值,setValuesIn 程序化原地改值
204
+ * 不会刷新该格 → 自动带出的外码/描述等只读展示列空白。本渲染器 Observer 读可观察 record[dataKey],
205
+ * 保持 readPretty 纯文本观感(不挂 Formily 树、不可点编辑),但能跟随 setValuesIn 即时刷新。
206
+ *
207
+ * 仅用于「可编辑表的列级 readPretty 展示列」;「整表 readPretty」(明细/详情页,数据经 setValues 整体
208
+ * 加载,行引用整体替换→AG-Grid 自然刷新)仍走更廉价的静态 valueFormatter 快路径。@author nokecy
209
+ */
210
+ var LazyReadOnlyText = function LazyReadOnlyText(params) {
211
+ var _fieldSchema$name2;
212
+ var value = params.value,
213
+ record = params.data,
214
+ colDef = params.colDef,
215
+ formatter = params.formatter,
216
+ columnProps = params.columnProps,
217
+ fieldSchema = params.fieldSchema;
218
+ var dataKey = (_fieldSchema$name2 = fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.name) !== null && _fieldSchema$name2 !== void 0 ? _fieldSchema$name2 : colDef === null || colDef === void 0 ? void 0 : colDef.field;
219
+ return /*#__PURE__*/React.createElement(Observer, null, function () {
220
+ var liveValue = dataKey != null && record ? record[dataKey] : value;
221
+ var text = formatter ? formatter(liveValue, {
222
+ columnProps: columnProps,
223
+ fieldSchema: fieldSchema
224
+ }) : liveValue == null ? '' : String(liveValue);
225
+ return /*#__PURE__*/React.createElement("span", {
226
+ className: "ag-array-table-readonly-text",
227
+ style: {
228
+ display: 'inline-block',
229
+ width: '100%'
230
+ }
231
+ }, text);
232
+ });
233
+ };
234
+
200
235
  // 在 Column 的子 schema 里递归找到内层数据字段(可读 x-component / x-pattern / x-reactions / enum) @author nokecy
201
236
  var findDataFieldSchema = function findDataFieldSchema(columnSchema, name) {
202
237
  if (!columnSchema || !columnSchema.properties) return null;
@@ -299,6 +334,21 @@ var buildArrayTableColumns = function buildArrayTableColumns(dataSource, field,
299
334
 
300
335
  // ① 只读纯文本
301
336
  if (readOnly && formatter) {
337
+ // 列级 readPretty 在「可编辑表」里是展示列(值可能被 setValuesIn 自动带出),静态 valueFormatter
338
+ // 读 AG-Grid 缓存值不刷新 → 反应式只读渲染。整表 readPretty(明细/详情页,数据 setValues 整体加载、
339
+ // 行引用整体替换、AG-Grid 自然刷新)仍走更廉价的静态 valueFormatter 快路径。@author nokecy
340
+ if (arrayPattern !== 'readPretty') {
341
+ return buf.concat(_objectSpread(_objectSpread(_objectSpread({}, base), valueGetter ? {
342
+ valueGetter: valueGetter
343
+ } : {}), {}, {
344
+ cellRenderer: LazyReadOnlyText,
345
+ cellRendererParams: {
346
+ formatter: formatter,
347
+ columnProps: columnProps,
348
+ fieldSchema: dataField
349
+ }
350
+ }));
351
+ }
302
352
  return buf.concat(_objectSpread(_objectSpread(_objectSpread({}, base), valueGetter ? {
303
353
  valueGetter: valueGetter
304
354
  } : {}), {}, {
@@ -354,4 +404,4 @@ var useAddition = function useAddition() {
354
404
  return addition;
355
405
  }, null);
356
406
  };
357
- export { isColumnComponent, useArrayTableSources, useArrayTableActions, buildArrayTableColumns, useAddition, LazyAgField };
407
+ export { isColumnComponent, useArrayTableSources, useArrayTableActions, buildArrayTableColumns, useAddition, LazyAgField, LazyReadOnlyText };