@nokecy/qc-ui 1.1.46 → 1.1.48
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.
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
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
|
+
var _antd = require("antd");
|
|
9
10
|
var _react2 = require("@formily/react");
|
|
10
11
|
var _shared = require("@formily/shared");
|
|
11
12
|
var _arrayBase = _interopRequireDefault(require("./arrayBase"));
|
|
@@ -141,6 +142,54 @@ var AgField = function AgField(_ref) {
|
|
|
141
142
|
return children;
|
|
142
143
|
};
|
|
143
144
|
|
|
145
|
+
/**
|
|
146
|
+
* 快路径能否按这个字段名取到值。
|
|
147
|
+
*
|
|
148
|
+
* Formily 的字段名是「路径」不是「键」,支持点号嵌套(`item.qty`)、数组下标(`a[0]`)、
|
|
149
|
+
* 解构(`{value:code,label:name}`)等语法。快路径(只读文本/懒挂载)不挂 Formily 树,
|
|
150
|
+
* 取值得自己解析。这里只认「点号分段」这一种简单形态,其余一律判不合格 ->
|
|
151
|
+
* 调用方回退 AgField 全树(由 Formily 自己解析,正确优先于速度)。@author nokecy
|
|
152
|
+
*/
|
|
153
|
+
var isSimpleFieldPath = function isSimpleFieldPath(name) {
|
|
154
|
+
return !!name && /^[^.{}[\]*]+(\.[^.{}[\]*]+)*$/.test(name);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 按 Formily 字段名从行数据取值。
|
|
159
|
+
*
|
|
160
|
+
* 曾经一律按扁平键取 record['item.qty'],而数据在 record.item.qty ->
|
|
161
|
+
* 嵌套字段名恒 undefined,单元格默认空白,点击挂上全树(按路径解析)才显出真值。
|
|
162
|
+
*
|
|
163
|
+
* 在 Observer 里逐层读可观察对象,依赖链完整,程序化改值(setValuesIn)照样刷新。@author nokecy
|
|
164
|
+
*/
|
|
165
|
+
var readByFieldPath = function readByFieldPath(record, path) {
|
|
166
|
+
if (record == null) return undefined;
|
|
167
|
+
if (path.indexOf('.') < 0) return record[path];
|
|
168
|
+
return path.split('.').reduce(function (acc, key) {
|
|
169
|
+
return acc == null ? undefined : acc[key];
|
|
170
|
+
}, record);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/** 「选一个」型组件:空值占位说「请选择」,其余说「请输入」 */
|
|
174
|
+
var SELECT_LIKE = new Set(['Select', 'TreeSelect', 'Cascader', 'DatePicker', 'TimePicker', 'Radio.Group', 'Checkbox.Group', 'Transfer']);
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* 懒挂载空值格显示什么。
|
|
178
|
+
*
|
|
179
|
+
* 懒挂载把未激活的可编辑格降成纯文本,值为空时整格一片空白——连输入框边框都没有,
|
|
180
|
+
* 用户看不出这里能填,以为功能坏了。故空值时按真控件的 placeholder 出淡灰占位,
|
|
181
|
+
* 点开前后看到同一句话,观感连续。
|
|
182
|
+
*
|
|
183
|
+
* 同样的理由 Switch/Checkbox 早就强制 eager 了(见 buildArrayTableColumns 的
|
|
184
|
+
* isInlineToggle),这里是把那条理由推广到其余可编辑列。@author nokecy
|
|
185
|
+
*/
|
|
186
|
+
var resolveEmptyPlaceholder = function resolveEmptyPlaceholder(fieldSchema) {
|
|
187
|
+
var _fieldSchema$xCompon;
|
|
188
|
+
var configured = fieldSchema === null || fieldSchema === void 0 || (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.placeholder;
|
|
189
|
+
if (typeof configured === 'string' && configured) return configured;
|
|
190
|
+
return SELECT_LIKE.has(fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component']) ? '请选择' : '请输入';
|
|
191
|
+
};
|
|
192
|
+
|
|
144
193
|
/**
|
|
145
194
|
* 懒挂载单元格渲染器(可编辑列)。
|
|
146
195
|
*
|
|
@@ -167,6 +216,9 @@ var LazyAgField = exports.LazyAgField = function LazyAgField(params) {
|
|
|
167
216
|
formatter = params.formatter,
|
|
168
217
|
columnProps = params.columnProps,
|
|
169
218
|
fieldSchema = params.fieldSchema;
|
|
219
|
+
// hook 必须在下面的条件 return 之前调用
|
|
220
|
+
var _theme$useToken = _antd.theme.useToken(),
|
|
221
|
+
token = _theme$useToken.token;
|
|
170
222
|
var key = "".concat(node === null || node === void 0 ? void 0 : node.id, ":").concat(colDef === null || colDef === void 0 ? void 0 : colDef.field);
|
|
171
223
|
var activated = (record === null || record === void 0 ? void 0 : record._isNew) === true || (context === null || context === void 0 || (_context$activeCells = context.activeCells) === null || _context$activeCells === void 0 || (_context$activeCells$ = _context$activeCells.has) === null || _context$activeCells$ === void 0 ? void 0 : _context$activeCells$.call(_context$activeCells, key)) === true;
|
|
172
224
|
if (activated) {
|
|
@@ -187,12 +239,24 @@ var LazyAgField = exports.LazyAgField = function LazyAgField(params) {
|
|
|
187
239
|
// 免去调用方加 forceAgField 逃生阀。字段名缺失才回退 params.value。@author nokecy
|
|
188
240
|
var dataKey = (_fieldSchema$name = fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.name) !== null && _fieldSchema$name !== void 0 ? _fieldSchema$name : colDef === null || colDef === void 0 ? void 0 : colDef.field;
|
|
189
241
|
return /*#__PURE__*/_react.default.createElement(_react2.Observer, null, function () {
|
|
190
|
-
var liveValue = dataKey != null && record ? record
|
|
242
|
+
var liveValue = dataKey != null && record ? readByFieldPath(record, dataKey) : value;
|
|
191
243
|
var text = formatter ? formatter(liveValue, {
|
|
192
244
|
columnProps: columnProps,
|
|
193
245
|
fieldSchema: fieldSchema
|
|
194
246
|
}) : liveValue == null ? '' : String(liveValue);
|
|
195
247
|
// 纯文本占满单元格,点击交给 AG-Grid onCellClicked 激活;样式尽量贴近 Editable 只读态避免点开跳动
|
|
248
|
+
if (text === '') {
|
|
249
|
+
// 空值:出淡灰 placeholder,让用户看得出这格能填(颜色取 antd 输入框 placeholder 的 token,自动跟随暗色主题)
|
|
250
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
251
|
+
className: "ag-array-table-lazy-placeholder",
|
|
252
|
+
style: {
|
|
253
|
+
display: 'inline-block',
|
|
254
|
+
width: '100%',
|
|
255
|
+
cursor: 'text',
|
|
256
|
+
color: token.colorTextPlaceholder
|
|
257
|
+
}
|
|
258
|
+
}, resolveEmptyPlaceholder(fieldSchema));
|
|
259
|
+
}
|
|
196
260
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
197
261
|
className: "ag-array-table-lazy-text",
|
|
198
262
|
style: {
|
|
@@ -224,7 +288,7 @@ var LazyReadOnlyText = exports.LazyReadOnlyText = function LazyReadOnlyText(para
|
|
|
224
288
|
fieldSchema = params.fieldSchema;
|
|
225
289
|
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
290
|
return /*#__PURE__*/_react.default.createElement(_react2.Observer, null, function () {
|
|
227
|
-
var liveValue = dataKey != null && record ? record
|
|
291
|
+
var liveValue = dataKey != null && record ? readByFieldPath(record, dataKey) : value;
|
|
228
292
|
var text = formatter ? formatter(liveValue, {
|
|
229
293
|
columnProps: columnProps,
|
|
230
294
|
fieldSchema: fieldSchema
|
|
@@ -317,7 +381,7 @@ var buildArrayTableColumns = exports.buildArrayTableColumns = function buildArra
|
|
|
317
381
|
// ① 只读纯文本(永不可编辑):只读列 + 有格式化器 -> valueFormatter,不挂 Formily 树。
|
|
318
382
|
// ② 可编辑懒挂载:可编辑列 + 有格式化器 + 无 reactions + 未强制 eager -> LazyAgField,
|
|
319
383
|
// 存量格先出廉价文本、点击/导航才挂全树(挂了不卸)。
|
|
320
|
-
// ③ 兜底全树:其余(无格式化器/带 reactions/forceAgField
|
|
384
|
+
// ③ 兜底全树:其余(无格式化器/带 reactions/forceAgField/复杂字段名/只读但无格式化器) -> AgField。
|
|
321
385
|
var dataField = findDataFieldSchema(schema, name);
|
|
322
386
|
var component = dataField === null || dataField === void 0 ? void 0 : dataField['x-component'];
|
|
323
387
|
var formatter = (0, _readOnlyFormatters.getReadOnlyFormatter)(component);
|
|
@@ -335,12 +399,14 @@ var buildArrayTableColumns = exports.buildArrayTableColumns = function buildArra
|
|
|
335
399
|
// 故按内层字段名补 valueGetter(仅在与 name 不一致时,保持 name===字段名 的现状)。@author nokecy
|
|
336
400
|
var dataFieldName = dataField === null || dataField === void 0 ? void 0 : dataField.name;
|
|
337
401
|
var valueGetter = dataFieldName && dataFieldName !== name ? function (params) {
|
|
338
|
-
|
|
339
|
-
return params === null || params === void 0 || (_params$data = params.data) === null || _params$data === void 0 ? void 0 : _params$data[dataFieldName];
|
|
402
|
+
return readByFieldPath(params === null || params === void 0 ? void 0 : params.data, dataFieldName);
|
|
340
403
|
} : undefined;
|
|
404
|
+
// 字段名是路径:`item.qty` 的值在 record.item.qty。快路径自己解析,只认点号分段;
|
|
405
|
+
// 解构(`{value:a,label:b}`)/数组下标等复杂语法解析不了,回退全树交给 Formily。@author nokecy
|
|
406
|
+
var canFastPath = !dataFieldName || isSimpleFieldPath(dataFieldName);
|
|
341
407
|
|
|
342
408
|
// ① 只读纯文本
|
|
343
|
-
if (readOnly && formatter) {
|
|
409
|
+
if (readOnly && formatter && canFastPath) {
|
|
344
410
|
// 列级 readPretty 在「可编辑表」里是展示列(值可能被 setValuesIn 自动带出),静态 valueFormatter
|
|
345
411
|
// 读 AG-Grid 缓存值不刷新 → 反应式只读渲染。整表 readPretty(明细/详情页,数据 setValues 整体加载、
|
|
346
412
|
// 行引用整体替换、AG-Grid 自然刷新)仍走更廉价的静态 valueFormatter 快路径。@author nokecy
|
|
@@ -371,7 +437,7 @@ var buildArrayTableColumns = exports.buildArrayTableColumns = function buildArra
|
|
|
371
437
|
}
|
|
372
438
|
|
|
373
439
|
// ② 可编辑懒挂载(排除单击直控的 Switch/Checkbox:须 eager 出真控件)
|
|
374
|
-
if (!readOnly && formatter && !hasReactions && !forceEager && !isInlineToggle) {
|
|
440
|
+
if (!readOnly && formatter && !hasReactions && !forceEager && !isInlineToggle && canFastPath) {
|
|
375
441
|
return buf.concat(_objectSpread(_objectSpread(_objectSpread({}, base), valueGetter ? {
|
|
376
442
|
valueGetter: valueGetter
|
|
377
443
|
} : {}), {}, {
|
|
@@ -8,6 +8,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
8
8
|
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; }
|
|
9
9
|
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; }
|
|
10
10
|
import React from 'react';
|
|
11
|
+
import { theme } from 'antd';
|
|
11
12
|
import { useField, useFieldSchema, RecursionField, Observer } from '@formily/react';
|
|
12
13
|
import { isArr } from '@formily/shared';
|
|
13
14
|
import ArrayBase from "./arrayBase";
|
|
@@ -134,6 +135,54 @@ var AgField = function AgField(_ref) {
|
|
|
134
135
|
return children;
|
|
135
136
|
};
|
|
136
137
|
|
|
138
|
+
/**
|
|
139
|
+
* 快路径能否按这个字段名取到值。
|
|
140
|
+
*
|
|
141
|
+
* Formily 的字段名是「路径」不是「键」,支持点号嵌套(`item.qty`)、数组下标(`a[0]`)、
|
|
142
|
+
* 解构(`{value:code,label:name}`)等语法。快路径(只读文本/懒挂载)不挂 Formily 树,
|
|
143
|
+
* 取值得自己解析。这里只认「点号分段」这一种简单形态,其余一律判不合格 ->
|
|
144
|
+
* 调用方回退 AgField 全树(由 Formily 自己解析,正确优先于速度)。@author nokecy
|
|
145
|
+
*/
|
|
146
|
+
var isSimpleFieldPath = function isSimpleFieldPath(name) {
|
|
147
|
+
return !!name && /^[^.{}[\]*]+(\.[^.{}[\]*]+)*$/.test(name);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* 按 Formily 字段名从行数据取值。
|
|
152
|
+
*
|
|
153
|
+
* 曾经一律按扁平键取 record['item.qty'],而数据在 record.item.qty ->
|
|
154
|
+
* 嵌套字段名恒 undefined,单元格默认空白,点击挂上全树(按路径解析)才显出真值。
|
|
155
|
+
*
|
|
156
|
+
* 在 Observer 里逐层读可观察对象,依赖链完整,程序化改值(setValuesIn)照样刷新。@author nokecy
|
|
157
|
+
*/
|
|
158
|
+
var readByFieldPath = function readByFieldPath(record, path) {
|
|
159
|
+
if (record == null) return undefined;
|
|
160
|
+
if (path.indexOf('.') < 0) return record[path];
|
|
161
|
+
return path.split('.').reduce(function (acc, key) {
|
|
162
|
+
return acc == null ? undefined : acc[key];
|
|
163
|
+
}, record);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/** 「选一个」型组件:空值占位说「请选择」,其余说「请输入」 */
|
|
167
|
+
var SELECT_LIKE = new Set(['Select', 'TreeSelect', 'Cascader', 'DatePicker', 'TimePicker', 'Radio.Group', 'Checkbox.Group', 'Transfer']);
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* 懒挂载空值格显示什么。
|
|
171
|
+
*
|
|
172
|
+
* 懒挂载把未激活的可编辑格降成纯文本,值为空时整格一片空白——连输入框边框都没有,
|
|
173
|
+
* 用户看不出这里能填,以为功能坏了。故空值时按真控件的 placeholder 出淡灰占位,
|
|
174
|
+
* 点开前后看到同一句话,观感连续。
|
|
175
|
+
*
|
|
176
|
+
* 同样的理由 Switch/Checkbox 早就强制 eager 了(见 buildArrayTableColumns 的
|
|
177
|
+
* isInlineToggle),这里是把那条理由推广到其余可编辑列。@author nokecy
|
|
178
|
+
*/
|
|
179
|
+
var resolveEmptyPlaceholder = function resolveEmptyPlaceholder(fieldSchema) {
|
|
180
|
+
var _fieldSchema$xCompon;
|
|
181
|
+
var configured = fieldSchema === null || fieldSchema === void 0 || (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.placeholder;
|
|
182
|
+
if (typeof configured === 'string' && configured) return configured;
|
|
183
|
+
return SELECT_LIKE.has(fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema['x-component']) ? '请选择' : '请输入';
|
|
184
|
+
};
|
|
185
|
+
|
|
137
186
|
/**
|
|
138
187
|
* 懒挂载单元格渲染器(可编辑列)。
|
|
139
188
|
*
|
|
@@ -160,6 +209,9 @@ var LazyAgField = function LazyAgField(params) {
|
|
|
160
209
|
formatter = params.formatter,
|
|
161
210
|
columnProps = params.columnProps,
|
|
162
211
|
fieldSchema = params.fieldSchema;
|
|
212
|
+
// hook 必须在下面的条件 return 之前调用
|
|
213
|
+
var _theme$useToken = theme.useToken(),
|
|
214
|
+
token = _theme$useToken.token;
|
|
163
215
|
var key = "".concat(node === null || node === void 0 ? void 0 : node.id, ":").concat(colDef === null || colDef === void 0 ? void 0 : colDef.field);
|
|
164
216
|
var activated = (record === null || record === void 0 ? void 0 : record._isNew) === true || (context === null || context === void 0 || (_context$activeCells = context.activeCells) === null || _context$activeCells === void 0 || (_context$activeCells$ = _context$activeCells.has) === null || _context$activeCells$ === void 0 ? void 0 : _context$activeCells$.call(_context$activeCells, key)) === true;
|
|
165
217
|
if (activated) {
|
|
@@ -180,12 +232,24 @@ var LazyAgField = function LazyAgField(params) {
|
|
|
180
232
|
// 免去调用方加 forceAgField 逃生阀。字段名缺失才回退 params.value。@author nokecy
|
|
181
233
|
var dataKey = (_fieldSchema$name = fieldSchema === null || fieldSchema === void 0 ? void 0 : fieldSchema.name) !== null && _fieldSchema$name !== void 0 ? _fieldSchema$name : colDef === null || colDef === void 0 ? void 0 : colDef.field;
|
|
182
234
|
return /*#__PURE__*/React.createElement(Observer, null, function () {
|
|
183
|
-
var liveValue = dataKey != null && record ? record
|
|
235
|
+
var liveValue = dataKey != null && record ? readByFieldPath(record, dataKey) : value;
|
|
184
236
|
var text = formatter ? formatter(liveValue, {
|
|
185
237
|
columnProps: columnProps,
|
|
186
238
|
fieldSchema: fieldSchema
|
|
187
239
|
}) : liveValue == null ? '' : String(liveValue);
|
|
188
240
|
// 纯文本占满单元格,点击交给 AG-Grid onCellClicked 激活;样式尽量贴近 Editable 只读态避免点开跳动
|
|
241
|
+
if (text === '') {
|
|
242
|
+
// 空值:出淡灰 placeholder,让用户看得出这格能填(颜色取 antd 输入框 placeholder 的 token,自动跟随暗色主题)
|
|
243
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
244
|
+
className: "ag-array-table-lazy-placeholder",
|
|
245
|
+
style: {
|
|
246
|
+
display: 'inline-block',
|
|
247
|
+
width: '100%',
|
|
248
|
+
cursor: 'text',
|
|
249
|
+
color: token.colorTextPlaceholder
|
|
250
|
+
}
|
|
251
|
+
}, resolveEmptyPlaceholder(fieldSchema));
|
|
252
|
+
}
|
|
189
253
|
return /*#__PURE__*/React.createElement("span", {
|
|
190
254
|
className: "ag-array-table-lazy-text",
|
|
191
255
|
style: {
|
|
@@ -217,7 +281,7 @@ var LazyReadOnlyText = function LazyReadOnlyText(params) {
|
|
|
217
281
|
fieldSchema = params.fieldSchema;
|
|
218
282
|
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
283
|
return /*#__PURE__*/React.createElement(Observer, null, function () {
|
|
220
|
-
var liveValue = dataKey != null && record ? record
|
|
284
|
+
var liveValue = dataKey != null && record ? readByFieldPath(record, dataKey) : value;
|
|
221
285
|
var text = formatter ? formatter(liveValue, {
|
|
222
286
|
columnProps: columnProps,
|
|
223
287
|
fieldSchema: fieldSchema
|
|
@@ -310,7 +374,7 @@ var buildArrayTableColumns = function buildArrayTableColumns(dataSource, field,
|
|
|
310
374
|
// ① 只读纯文本(永不可编辑):只读列 + 有格式化器 -> valueFormatter,不挂 Formily 树。
|
|
311
375
|
// ② 可编辑懒挂载:可编辑列 + 有格式化器 + 无 reactions + 未强制 eager -> LazyAgField,
|
|
312
376
|
// 存量格先出廉价文本、点击/导航才挂全树(挂了不卸)。
|
|
313
|
-
// ③ 兜底全树:其余(无格式化器/带 reactions/forceAgField
|
|
377
|
+
// ③ 兜底全树:其余(无格式化器/带 reactions/forceAgField/复杂字段名/只读但无格式化器) -> AgField。
|
|
314
378
|
var dataField = findDataFieldSchema(schema, name);
|
|
315
379
|
var component = dataField === null || dataField === void 0 ? void 0 : dataField['x-component'];
|
|
316
380
|
var formatter = getReadOnlyFormatter(component);
|
|
@@ -328,12 +392,14 @@ var buildArrayTableColumns = function buildArrayTableColumns(dataSource, field,
|
|
|
328
392
|
// 故按内层字段名补 valueGetter(仅在与 name 不一致时,保持 name===字段名 的现状)。@author nokecy
|
|
329
393
|
var dataFieldName = dataField === null || dataField === void 0 ? void 0 : dataField.name;
|
|
330
394
|
var valueGetter = dataFieldName && dataFieldName !== name ? function (params) {
|
|
331
|
-
|
|
332
|
-
return params === null || params === void 0 || (_params$data = params.data) === null || _params$data === void 0 ? void 0 : _params$data[dataFieldName];
|
|
395
|
+
return readByFieldPath(params === null || params === void 0 ? void 0 : params.data, dataFieldName);
|
|
333
396
|
} : undefined;
|
|
397
|
+
// 字段名是路径:`item.qty` 的值在 record.item.qty。快路径自己解析,只认点号分段;
|
|
398
|
+
// 解构(`{value:a,label:b}`)/数组下标等复杂语法解析不了,回退全树交给 Formily。@author nokecy
|
|
399
|
+
var canFastPath = !dataFieldName || isSimpleFieldPath(dataFieldName);
|
|
334
400
|
|
|
335
401
|
// ① 只读纯文本
|
|
336
|
-
if (readOnly && formatter) {
|
|
402
|
+
if (readOnly && formatter && canFastPath) {
|
|
337
403
|
// 列级 readPretty 在「可编辑表」里是展示列(值可能被 setValuesIn 自动带出),静态 valueFormatter
|
|
338
404
|
// 读 AG-Grid 缓存值不刷新 → 反应式只读渲染。整表 readPretty(明细/详情页,数据 setValues 整体加载、
|
|
339
405
|
// 行引用整体替换、AG-Grid 自然刷新)仍走更廉价的静态 valueFormatter 快路径。@author nokecy
|
|
@@ -364,7 +430,7 @@ var buildArrayTableColumns = function buildArrayTableColumns(dataSource, field,
|
|
|
364
430
|
}
|
|
365
431
|
|
|
366
432
|
// ② 可编辑懒挂载(排除单击直控的 Switch/Checkbox:须 eager 出真控件)
|
|
367
|
-
if (!readOnly && formatter && !hasReactions && !forceEager && !isInlineToggle) {
|
|
433
|
+
if (!readOnly && formatter && !hasReactions && !forceEager && !isInlineToggle && canFastPath) {
|
|
368
434
|
return buf.concat(_objectSpread(_objectSpread(_objectSpread({}, base), valueGetter ? {
|
|
369
435
|
valueGetter: valueGetter
|
|
370
436
|
} : {}), {}, {
|