@dckj-npm/dc-material 0.1.374 → 0.1.376
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.
- package/build/docs/colorful-button.html +3 -3
- package/build/docs/colorful-input.html +3 -3
- package/build/docs/index.html +3 -3
- package/build/docs/teletext-list.html +3 -3
- package/build/docs/umi.d20b1d99.js +1 -0
- package/build/docs/~demos/colorful-button-demo.html +3 -3
- package/build/docs/~demos/colorful-input-demo.html +3 -3
- package/build/docs/~demos/teletext-list-demo-1.html +3 -3
- package/build/docs/~demos/teletext-list-demo.html +3 -3
- package/build/lowcode/assets-daily.json +13 -13
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +13 -13
- package/build/lowcode/meta.design.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/dist/BizComps.js +1 -1
- package/dist/BizComps.js.map +1 -1
- package/es/components/teletext-list/teletext-list-item.js +19 -11
- package/lib/components/teletext-list/teletext-list-item.js +19 -11
- package/lowcode/teletext-list/meta.ts +20 -74
- package/lowcode_es/meta.js +1 -1
- package/lowcode_es/teletext-list/meta.js +30 -81
- package/lowcode_lib/meta.js +1 -1
- package/lowcode_lib/teletext-list/meta.js +32 -83
- package/package.json +3 -3
- package/build/docs/umi.f5910099.js +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["onClick", "title", "image", "children", "imagePlacement", "description", "type", "textLines", "itemColumns", "itemPadding", "iconList", "tags", "text3", "text4", "imgWidth", "imgHeight", "itemBgColor", "style", "textAlign", "isShoppingCart", "isWishList", "isUserMenu", "itemType", "textImgGap"]
|
|
3
|
+
var _excluded = ["onClick", "title", "image", "children", "imagePlacement", "description", "type", "textLines", "itemColumns", "itemPadding", "iconList", "tags", "text3", "text4", "imgWidth", "imgHeight", "itemBgColor", "style", "textAlign", "isShoppingCart", "isWishList", "isUserMenu", "itemType", "textImgGap"],
|
|
4
|
+
_excluded2 = ["width", "height"];
|
|
4
5
|
import React, { createElement } from 'react';
|
|
5
6
|
import "./teletext-list-item.scss";
|
|
6
7
|
import { convertChildren } from "../../utils/children-node-handle";
|
|
@@ -61,18 +62,25 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
61
62
|
};
|
|
62
63
|
var imageChildProps = getChildPropsByKey('image');
|
|
63
64
|
var imageClassName = ['teletext-list__panel__item_image', imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.className].filter(Boolean).join(' ');
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
65
|
+
|
|
66
|
+
// 图片尺寸策略(修复:不再写入 Image 子节点 style):
|
|
67
|
+
// 低代码设计模式下,调用 imageChildNode.setPropValue('style', ...) 会让引擎以"节点级别"
|
|
68
|
+
// 重渲染 Image 节点,直接使用 schema 默认 imgSrc(占位图),绕过父组件
|
|
69
|
+
// convertChildren 注入的真实图片 URL,从而导致画布图片回退为默认图。
|
|
70
|
+
// 因此 imgWidth / imgHeight prop 是图片尺寸的唯一响应来源:
|
|
71
|
+
// • 优先使用 imgWidth/imgHeight prop(TeletextList 层面统一控制)
|
|
72
|
+
// • 若 prop 未设置,回退到子节点 style 中已有的宽高值(兼容旧页面)
|
|
73
|
+
// • 最终默认 100px
|
|
74
|
+
// 子节点 style 中非尺寸属性(margin、padding 等)始终保留。
|
|
69
75
|
var childStyle = (imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.style) || {};
|
|
76
|
+
var _childW = childStyle.width,
|
|
77
|
+
_childH = childStyle.height,
|
|
78
|
+
childLayoutStyle = _objectWithoutPropertiesLoose(childStyle, _excluded2);
|
|
70
79
|
var DEFAULT_IMG_SIZE = 100;
|
|
71
|
-
var imageStyle = _extends({},
|
|
72
|
-
width:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} : {});
|
|
80
|
+
var imageStyle = _extends({}, childLayoutStyle, {
|
|
81
|
+
width: typeof imgWidth === 'number' ? imgWidth + "px" : _childW != null ? _childW : DEFAULT_IMG_SIZE + "px",
|
|
82
|
+
height: typeof imgHeight === 'number' ? imgHeight + "px" : _childH != null ? _childH : DEFAULT_IMG_SIZE + "px"
|
|
83
|
+
});
|
|
76
84
|
var containerStyle = _extends({
|
|
77
85
|
padding: itemPadding + "px",
|
|
78
86
|
backgroundColor: itemBgColor,
|
|
@@ -9,7 +9,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
require("./teletext-list-item.scss");
|
|
10
10
|
var _childrenNodeHandle = require("../../utils/children-node-handle");
|
|
11
11
|
var _lowcodeMaterials = require("@alilc/lowcode-materials");
|
|
12
|
-
var _excluded = ["onClick", "title", "image", "children", "imagePlacement", "description", "type", "textLines", "itemColumns", "itemPadding", "iconList", "tags", "text3", "text4", "imgWidth", "imgHeight", "itemBgColor", "style", "textAlign", "isShoppingCart", "isWishList", "isUserMenu", "itemType", "textImgGap"]
|
|
12
|
+
var _excluded = ["onClick", "title", "image", "children", "imagePlacement", "description", "type", "textLines", "itemColumns", "itemPadding", "iconList", "tags", "text3", "text4", "imgWidth", "imgHeight", "itemBgColor", "style", "textAlign", "isShoppingCart", "isWishList", "isUserMenu", "itemType", "textImgGap"],
|
|
13
|
+
_excluded2 = ["width", "height"];
|
|
13
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
15
|
/**
|
|
15
16
|
* 数据
|
|
@@ -66,18 +67,25 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
66
67
|
};
|
|
67
68
|
var imageChildProps = getChildPropsByKey('image');
|
|
68
69
|
var imageClassName = ['teletext-list__panel__item_image', imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.className].filter(Boolean).join(' ');
|
|
69
|
-
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
//
|
|
70
|
+
|
|
71
|
+
// 图片尺寸策略(修复:不再写入 Image 子节点 style):
|
|
72
|
+
// 低代码设计模式下,调用 imageChildNode.setPropValue('style', ...) 会让引擎以"节点级别"
|
|
73
|
+
// 重渲染 Image 节点,直接使用 schema 默认 imgSrc(占位图),绕过父组件
|
|
74
|
+
// convertChildren 注入的真实图片 URL,从而导致画布图片回退为默认图。
|
|
75
|
+
// 因此 imgWidth / imgHeight prop 是图片尺寸的唯一响应来源:
|
|
76
|
+
// • 优先使用 imgWidth/imgHeight prop(TeletextList 层面统一控制)
|
|
77
|
+
// • 若 prop 未设置,回退到子节点 style 中已有的宽高值(兼容旧页面)
|
|
78
|
+
// • 最终默认 100px
|
|
79
|
+
// 子节点 style 中非尺寸属性(margin、padding 等)始终保留。
|
|
74
80
|
var childStyle = (imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.style) || {};
|
|
81
|
+
var _childW = childStyle.width,
|
|
82
|
+
_childH = childStyle.height,
|
|
83
|
+
childLayoutStyle = (0, _objectWithoutPropertiesLoose2["default"])(childStyle, _excluded2);
|
|
75
84
|
var DEFAULT_IMG_SIZE = 100;
|
|
76
|
-
var imageStyle = (0, _extends2["default"])({},
|
|
77
|
-
width:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
} : {});
|
|
85
|
+
var imageStyle = (0, _extends2["default"])({}, childLayoutStyle, {
|
|
86
|
+
width: typeof imgWidth === 'number' ? imgWidth + "px" : _childW != null ? _childW : DEFAULT_IMG_SIZE + "px",
|
|
87
|
+
height: typeof imgHeight === 'number' ? imgHeight + "px" : _childH != null ? _childH : DEFAULT_IMG_SIZE + "px"
|
|
88
|
+
});
|
|
81
89
|
var containerStyle = (0, _extends2["default"])({
|
|
82
90
|
padding: itemPadding + "px",
|
|
83
91
|
backgroundColor: itemBgColor,
|
|
@@ -3,13 +3,6 @@ import {
|
|
|
3
3
|
IPublicTypeSnippet,
|
|
4
4
|
} from '@alilc/lowcode-types'
|
|
5
5
|
|
|
6
|
-
const IMAGE_KEY = 'image'
|
|
7
|
-
|
|
8
|
-
const normalizeNodeKey = (rawKey: any): string => {
|
|
9
|
-
if (rawKey === undefined || rawKey === null) return ''
|
|
10
|
-
return String(rawKey).replace(/^\.?\$?/, '')
|
|
11
|
-
}
|
|
12
|
-
|
|
13
6
|
const parsePxNumber = (value: any): number | undefined => {
|
|
14
7
|
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
15
8
|
return value
|
|
@@ -27,46 +20,6 @@ const parsePxNumber = (value: any): number | undefined => {
|
|
|
27
20
|
return undefined
|
|
28
21
|
}
|
|
29
22
|
|
|
30
|
-
const findImageChildNode = (target: any): any | undefined => {
|
|
31
|
-
const children = target?.node?.children
|
|
32
|
-
if (!children) return undefined
|
|
33
|
-
if (typeof children.find === 'function') {
|
|
34
|
-
return children.find((child: any) => {
|
|
35
|
-
return normalizeNodeKey(child?.getPropValue?.('key')) === IMAGE_KEY
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
return undefined
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const getImageStyleNumber = (target: any, styleKey: 'width' | 'height'): number | undefined => {
|
|
42
|
-
const imageChildNode = findImageChildNode(target)
|
|
43
|
-
if (imageChildNode) {
|
|
44
|
-
return parsePxNumber(imageChildNode.getPropValue?.('style')?.[styleKey])
|
|
45
|
-
}
|
|
46
|
-
return undefined
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 同步 Image 子节点的 style.width / style.height。
|
|
51
|
-
* 使用 Promise.resolve().then() 异步执行,避免在父节点 setPropValue
|
|
52
|
-
* 的 MobX 同步响应链中触发子节点变更(可能导致 SettingField 重建)。
|
|
53
|
-
*/
|
|
54
|
-
const syncImageStyleValue = (target: any, styleKey: 'width' | 'height', value: number): void => {
|
|
55
|
-
Promise.resolve().then(() => {
|
|
56
|
-
const imageChildNode = findImageChildNode(target)
|
|
57
|
-
if (!imageChildNode) return
|
|
58
|
-
const currentStyle = imageChildNode.getPropValue?.('style') || {}
|
|
59
|
-
const updatedStyle: Record<string, any> = { ...currentStyle, [styleKey]: `${value}px` }
|
|
60
|
-
const otherKey = styleKey === 'width' ? 'height' : 'width'
|
|
61
|
-
if (!updatedStyle[otherKey]) {
|
|
62
|
-
const otherPropKey = otherKey === 'width' ? 'imgWidth' : 'imgHeight'
|
|
63
|
-
const otherPropValue = parsePxNumber(target?.getProps?.()?.getPropValue?.(otherPropKey))
|
|
64
|
-
updatedStyle[otherKey] = `${otherPropValue ?? 100}px`
|
|
65
|
-
}
|
|
66
|
-
imageChildNode.setPropValue?.('style', updatedStyle)
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
|
|
70
23
|
const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
71
24
|
group: '低代码组件',
|
|
72
25
|
componentName: 'TeletextList',
|
|
@@ -205,20 +158,21 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
205
158
|
initialValue: 100,
|
|
206
159
|
},
|
|
207
160
|
extraProps: {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
161
|
+
/**
|
|
162
|
+
* ignoreDefaultValue: 防止布局面板修改 Image 子节点 style 后,
|
|
163
|
+
* 引擎 remount SettingFieldView 时 initDefaultValue 把 imgWidth 重置为 100。
|
|
164
|
+
* 与 dataList 同理:只要 prop 有值就永远不应被 initialValue 覆盖。
|
|
165
|
+
*/
|
|
166
|
+
ignoreDefaultValue: () => true,
|
|
167
|
+
getValue: (target: any, value: any) => {
|
|
168
|
+
// 优先使用引擎传入的当前 prop 值
|
|
169
|
+
const parsed = parsePxNumber(value)
|
|
170
|
+
if (parsed !== undefined) return parsed
|
|
171
|
+
// 二级兜底:从 schema 快照读取(防止引擎传入 undefined 时丢失已保存的值)
|
|
172
|
+
const fromSchema = parsePxNumber(target?.node?.schema?.props?.imgWidth)
|
|
173
|
+
if (fromSchema !== undefined) return fromSchema
|
|
212
174
|
return 100
|
|
213
175
|
},
|
|
214
|
-
setValue: (target, value) => {
|
|
215
|
-
// 引擎已自动 setPropValue('imgWidth', value)
|
|
216
|
-
// 只需同步到 Image 子节点的 style
|
|
217
|
-
const parsedValue = parsePxNumber(value)
|
|
218
|
-
if (parsedValue !== undefined) {
|
|
219
|
-
syncImageStyleValue(target, 'width', parsedValue)
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
176
|
},
|
|
223
177
|
},
|
|
224
178
|
{
|
|
@@ -231,20 +185,14 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
231
185
|
initialValue: 100,
|
|
232
186
|
},
|
|
233
187
|
extraProps: {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
188
|
+
ignoreDefaultValue: () => true,
|
|
189
|
+
getValue: (target: any, value: any) => {
|
|
190
|
+
const parsed = parsePxNumber(value)
|
|
191
|
+
if (parsed !== undefined) return parsed
|
|
192
|
+
const fromSchema = parsePxNumber(target?.node?.schema?.props?.imgHeight)
|
|
193
|
+
if (fromSchema !== undefined) return fromSchema
|
|
238
194
|
return 100
|
|
239
195
|
},
|
|
240
|
-
setValue: (target, value) => {
|
|
241
|
-
// 引擎已自动 setPropValue('imgHeight', value)
|
|
242
|
-
// 只需同步到 Image 子节点的 style
|
|
243
|
-
const parsedValue = parsePxNumber(value)
|
|
244
|
-
if (parsedValue !== undefined) {
|
|
245
|
-
syncImageStyleValue(target, 'height', parsedValue)
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
196
|
},
|
|
249
197
|
},
|
|
250
198
|
{
|
|
@@ -268,9 +216,7 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
268
216
|
},
|
|
269
217
|
},
|
|
270
218
|
extraProps: {
|
|
271
|
-
|
|
272
|
-
target.getProps().setPropValue('dataListBind', value)
|
|
273
|
-
},
|
|
219
|
+
// 引擎已自动 node.setPropValue('dataListBind', value),无需重复写入
|
|
274
220
|
},
|
|
275
221
|
},
|
|
276
222
|
{
|
package/lowcode_es/meta.js
CHANGED
|
@@ -117,7 +117,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
|
|
|
117
117
|
packageName = '@dckj-npm/dc-material';
|
|
118
118
|
}
|
|
119
119
|
if (version === void 0) {
|
|
120
|
-
version = '0.1.
|
|
120
|
+
version = '0.1.376';
|
|
121
121
|
}
|
|
122
122
|
if (basicLibraryVersion === void 0) {
|
|
123
123
|
basicLibraryVersion = {
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
var IMAGE_KEY = 'image';
|
|
3
|
-
var normalizeNodeKey = function normalizeNodeKey(rawKey) {
|
|
4
|
-
if (rawKey === undefined || rawKey === null) return '';
|
|
5
|
-
return String(rawKey).replace(/^\.?\$?/, '');
|
|
6
|
-
};
|
|
7
2
|
var parsePxNumber = function parsePxNumber(value) {
|
|
8
3
|
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
9
4
|
return value;
|
|
@@ -20,49 +15,6 @@ var parsePxNumber = function parsePxNumber(value) {
|
|
|
20
15
|
}
|
|
21
16
|
return undefined;
|
|
22
17
|
};
|
|
23
|
-
var findImageChildNode = function findImageChildNode(target) {
|
|
24
|
-
var _target$node;
|
|
25
|
-
var children = target === null || target === void 0 ? void 0 : (_target$node = target.node) === null || _target$node === void 0 ? void 0 : _target$node.children;
|
|
26
|
-
if (!children) return undefined;
|
|
27
|
-
if (typeof children.find === 'function') {
|
|
28
|
-
return children.find(function (child) {
|
|
29
|
-
var _child$getPropValue;
|
|
30
|
-
return normalizeNodeKey(child === null || child === void 0 ? void 0 : (_child$getPropValue = child.getPropValue) === null || _child$getPropValue === void 0 ? void 0 : _child$getPropValue.call(child, 'key')) === IMAGE_KEY;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return undefined;
|
|
34
|
-
};
|
|
35
|
-
var getImageStyleNumber = function getImageStyleNumber(target, styleKey) {
|
|
36
|
-
var imageChildNode = findImageChildNode(target);
|
|
37
|
-
if (imageChildNode) {
|
|
38
|
-
var _imageChildNode$getPr, _imageChildNode$getPr2;
|
|
39
|
-
return parsePxNumber((_imageChildNode$getPr = imageChildNode.getPropValue) === null || _imageChildNode$getPr === void 0 ? void 0 : (_imageChildNode$getPr2 = _imageChildNode$getPr.call(imageChildNode, 'style')) === null || _imageChildNode$getPr2 === void 0 ? void 0 : _imageChildNode$getPr2[styleKey]);
|
|
40
|
-
}
|
|
41
|
-
return undefined;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* 同步 Image 子节点的 style.width / style.height。
|
|
46
|
-
* 使用 Promise.resolve().then() 异步执行,避免在父节点 setPropValue
|
|
47
|
-
* 的 MobX 同步响应链中触发子节点变更(可能导致 SettingField 重建)。
|
|
48
|
-
*/
|
|
49
|
-
var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value) {
|
|
50
|
-
Promise.resolve().then(function () {
|
|
51
|
-
var _imageChildNode$getPr3, _extends2, _imageChildNode$setPr;
|
|
52
|
-
var imageChildNode = findImageChildNode(target);
|
|
53
|
-
if (!imageChildNode) return;
|
|
54
|
-
var currentStyle = ((_imageChildNode$getPr3 = imageChildNode.getPropValue) === null || _imageChildNode$getPr3 === void 0 ? void 0 : _imageChildNode$getPr3.call(imageChildNode, 'style')) || {};
|
|
55
|
-
var updatedStyle = _extends({}, currentStyle, (_extends2 = {}, _extends2[styleKey] = value + "px", _extends2));
|
|
56
|
-
var otherKey = styleKey === 'width' ? 'height' : 'width';
|
|
57
|
-
if (!updatedStyle[otherKey]) {
|
|
58
|
-
var _target$getProps, _target$getProps$call, _target$getProps$call2;
|
|
59
|
-
var otherPropKey = otherKey === 'width' ? 'imgWidth' : 'imgHeight';
|
|
60
|
-
var otherPropValue = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$getProps = target.getProps) === null || _target$getProps === void 0 ? void 0 : (_target$getProps$call = _target$getProps.call(target)) === null || _target$getProps$call === void 0 ? void 0 : (_target$getProps$call2 = _target$getProps$call.getPropValue) === null || _target$getProps$call2 === void 0 ? void 0 : _target$getProps$call2.call(_target$getProps$call, otherPropKey));
|
|
61
|
-
updatedStyle[otherKey] = (otherPropValue !== null && otherPropValue !== void 0 ? otherPropValue : 100) + "px";
|
|
62
|
-
}
|
|
63
|
-
(_imageChildNode$setPr = imageChildNode.setPropValue) === null || _imageChildNode$setPr === void 0 ? void 0 : _imageChildNode$setPr.call(imageChildNode, 'style', updatedStyle);
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
18
|
var TeletextListMeta = {
|
|
67
19
|
group: '低代码组件',
|
|
68
20
|
componentName: 'TeletextList',
|
|
@@ -178,20 +130,23 @@ var TeletextListMeta = {
|
|
|
178
130
|
initialValue: 100
|
|
179
131
|
},
|
|
180
132
|
extraProps: {
|
|
133
|
+
/**
|
|
134
|
+
* ignoreDefaultValue: 防止布局面板修改 Image 子节点 style 后,
|
|
135
|
+
* 引擎 remount SettingFieldView 时 initDefaultValue 把 imgWidth 重置为 100。
|
|
136
|
+
* 与 dataList 同理:只要 prop 有值就永远不应被 initialValue 覆盖。
|
|
137
|
+
*/
|
|
138
|
+
ignoreDefaultValue: function ignoreDefaultValue() {
|
|
139
|
+
return true;
|
|
140
|
+
},
|
|
181
141
|
getValue: function getValue(target, value) {
|
|
182
|
-
var
|
|
183
|
-
|
|
184
|
-
var
|
|
185
|
-
if (
|
|
142
|
+
var _target$node, _target$node$schema, _target$node$schema$p;
|
|
143
|
+
// 优先使用引擎传入的当前 prop 值
|
|
144
|
+
var parsed = parsePxNumber(value);
|
|
145
|
+
if (parsed !== undefined) return parsed;
|
|
146
|
+
// 二级兜底:从 schema 快照读取(防止引擎传入 undefined 时丢失已保存的值)
|
|
147
|
+
var fromSchema = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$node = target.node) === null || _target$node === void 0 ? void 0 : (_target$node$schema = _target$node.schema) === null || _target$node$schema === void 0 ? void 0 : (_target$node$schema$p = _target$node$schema.props) === null || _target$node$schema$p === void 0 ? void 0 : _target$node$schema$p.imgWidth);
|
|
148
|
+
if (fromSchema !== undefined) return fromSchema;
|
|
186
149
|
return 100;
|
|
187
|
-
},
|
|
188
|
-
setValue: function setValue(target, value) {
|
|
189
|
-
// 引擎已自动 setPropValue('imgWidth', value)
|
|
190
|
-
// 只需同步到 Image 子节点的 style
|
|
191
|
-
var parsedValue = parsePxNumber(value);
|
|
192
|
-
if (parsedValue !== undefined) {
|
|
193
|
-
syncImageStyleValue(target, 'width', parsedValue);
|
|
194
|
-
}
|
|
195
150
|
}
|
|
196
151
|
}
|
|
197
152
|
}, {
|
|
@@ -204,20 +159,16 @@ var TeletextListMeta = {
|
|
|
204
159
|
initialValue: 100
|
|
205
160
|
},
|
|
206
161
|
extraProps: {
|
|
162
|
+
ignoreDefaultValue: function ignoreDefaultValue() {
|
|
163
|
+
return true;
|
|
164
|
+
},
|
|
207
165
|
getValue: function getValue(target, value) {
|
|
208
|
-
var
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
166
|
+
var _target$node2, _target$node2$schema, _target$node2$schema$;
|
|
167
|
+
var parsed = parsePxNumber(value);
|
|
168
|
+
if (parsed !== undefined) return parsed;
|
|
169
|
+
var fromSchema = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$node2 = target.node) === null || _target$node2 === void 0 ? void 0 : (_target$node2$schema = _target$node2.schema) === null || _target$node2$schema === void 0 ? void 0 : (_target$node2$schema$ = _target$node2$schema.props) === null || _target$node2$schema$ === void 0 ? void 0 : _target$node2$schema$.imgHeight);
|
|
170
|
+
if (fromSchema !== undefined) return fromSchema;
|
|
212
171
|
return 100;
|
|
213
|
-
},
|
|
214
|
-
setValue: function setValue(target, value) {
|
|
215
|
-
// 引擎已自动 setPropValue('imgHeight', value)
|
|
216
|
-
// 只需同步到 Image 子节点的 style
|
|
217
|
-
var parsedValue = parsePxNumber(value);
|
|
218
|
-
if (parsedValue !== undefined) {
|
|
219
|
-
syncImageStyleValue(target, 'height', parsedValue);
|
|
220
|
-
}
|
|
221
172
|
}
|
|
222
173
|
}
|
|
223
174
|
}, {
|
|
@@ -246,9 +197,7 @@ var TeletextListMeta = {
|
|
|
246
197
|
}
|
|
247
198
|
},
|
|
248
199
|
extraProps: {
|
|
249
|
-
|
|
250
|
-
target.getProps().setPropValue('dataListBind', value);
|
|
251
|
-
}
|
|
200
|
+
// 引擎已自动 node.setPropValue('dataListBind', value),无需重复写入
|
|
252
201
|
}
|
|
253
202
|
}, {
|
|
254
203
|
title: '标题',
|
|
@@ -291,9 +240,9 @@ var TeletextListMeta = {
|
|
|
291
240
|
},
|
|
292
241
|
extraProps: {
|
|
293
242
|
setValue: function setValue(target, value) {
|
|
294
|
-
var _target$
|
|
243
|
+
var _target$node3, _schemaChildren$filte, _target$parent, _target$parent$items;
|
|
295
244
|
target.getProps().setPropValue('textLines', value);
|
|
296
|
-
var schema = target === null || target === void 0 ? void 0 : (_target$
|
|
245
|
+
var schema = target === null || target === void 0 ? void 0 : (_target$node3 = target.node) === null || _target$node3 === void 0 ? void 0 : _target$node3.schema;
|
|
297
246
|
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
298
247
|
var schemaChildren = Array.isArray(schema === null || schema === void 0 ? void 0 : schema.children) ? schema.children : [];
|
|
299
248
|
|
|
@@ -687,11 +636,11 @@ var TeletextListMeta = {
|
|
|
687
636
|
}
|
|
688
637
|
},
|
|
689
638
|
initialValue: function initialValue(target) {
|
|
690
|
-
var _target$node$schema$
|
|
639
|
+
var _target$node$schema$p2, _target$node4, _target$node4$schema, _target$node4$schema$, _target$getProps, _target$getProps$call, _target$getProps$call2;
|
|
691
640
|
// ignoreDefaultValue: () => true 保证此函数在 SettingFieldView remount 时
|
|
692
641
|
// 永远不会被 initDefaultValue 调用,仅作为安全兜底保留。
|
|
693
642
|
// 正常的首次创建数据由 snippet.props.dataList 提供。
|
|
694
|
-
var existing = (_target$node$schema$
|
|
643
|
+
var existing = (_target$node$schema$p2 = target === null || target === void 0 ? void 0 : (_target$node4 = target.node) === null || _target$node4 === void 0 ? void 0 : (_target$node4$schema = _target$node4.schema) === null || _target$node4$schema === void 0 ? void 0 : (_target$node4$schema$ = _target$node4$schema.props) === null || _target$node4$schema$ === void 0 ? void 0 : _target$node4$schema$.dataList) !== null && _target$node$schema$p2 !== void 0 ? _target$node$schema$p2 : target === null || target === void 0 ? void 0 : (_target$getProps = target.getProps) === null || _target$getProps === void 0 ? void 0 : (_target$getProps$call = _target$getProps.call(target)) === null || _target$getProps$call === void 0 ? void 0 : (_target$getProps$call2 = _target$getProps$call.getPropValue) === null || _target$getProps$call2 === void 0 ? void 0 : _target$getProps$call2.call(_target$getProps$call, 'dataList');
|
|
695
644
|
if (existing !== undefined) return existing;
|
|
696
645
|
return DEFAULT_DATA_LIST;
|
|
697
646
|
}
|
|
@@ -709,11 +658,11 @@ var TeletextListMeta = {
|
|
|
709
658
|
return true;
|
|
710
659
|
},
|
|
711
660
|
getValue: function getValue(target, currentValue) {
|
|
712
|
-
var _target$
|
|
661
|
+
var _target$node5, _target$node5$schema, _target$node5$schema$;
|
|
713
662
|
// currentValue 已有值时直接返回
|
|
714
663
|
if (currentValue !== undefined) return currentValue;
|
|
715
664
|
// 从 schema 快照兜底读取(最可靠的源头数据,始终反映持久化状态)
|
|
716
|
-
var fromSchema = target === null || target === void 0 ? void 0 : (_target$
|
|
665
|
+
var fromSchema = target === null || target === void 0 ? void 0 : (_target$node5 = target.node) === null || _target$node5 === void 0 ? void 0 : (_target$node5$schema = _target$node5.schema) === null || _target$node5$schema === void 0 ? void 0 : (_target$node5$schema$ = _target$node5$schema.props) === null || _target$node5$schema$ === void 0 ? void 0 : _target$node5$schema$.dataList;
|
|
717
666
|
if (fromSchema !== undefined) return fromSchema;
|
|
718
667
|
return undefined;
|
|
719
668
|
}
|
package/lowcode_lib/meta.js
CHANGED
|
@@ -122,7 +122,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
|
|
|
122
122
|
packageName = '@dckj-npm/dc-material';
|
|
123
123
|
}
|
|
124
124
|
if (version === void 0) {
|
|
125
|
-
version = '0.1.
|
|
125
|
+
version = '0.1.376';
|
|
126
126
|
}
|
|
127
127
|
if (basicLibraryVersion === void 0) {
|
|
128
128
|
basicLibraryVersion = {
|
|
@@ -3,12 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports["default"] = void 0;
|
|
6
|
-
var
|
|
7
|
-
var IMAGE_KEY = 'image';
|
|
8
|
-
var normalizeNodeKey = function normalizeNodeKey(rawKey) {
|
|
9
|
-
if (rawKey === undefined || rawKey === null) return '';
|
|
10
|
-
return String(rawKey).replace(/^\.?\$?/, '');
|
|
11
|
-
};
|
|
6
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
7
|
var parsePxNumber = function parsePxNumber(value) {
|
|
13
8
|
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
14
9
|
return value;
|
|
@@ -25,49 +20,6 @@ var parsePxNumber = function parsePxNumber(value) {
|
|
|
25
20
|
}
|
|
26
21
|
return undefined;
|
|
27
22
|
};
|
|
28
|
-
var findImageChildNode = function findImageChildNode(target) {
|
|
29
|
-
var _target$node;
|
|
30
|
-
var children = target === null || target === void 0 ? void 0 : (_target$node = target.node) === null || _target$node === void 0 ? void 0 : _target$node.children;
|
|
31
|
-
if (!children) return undefined;
|
|
32
|
-
if (typeof children.find === 'function') {
|
|
33
|
-
return children.find(function (child) {
|
|
34
|
-
var _child$getPropValue;
|
|
35
|
-
return normalizeNodeKey(child === null || child === void 0 ? void 0 : (_child$getPropValue = child.getPropValue) === null || _child$getPropValue === void 0 ? void 0 : _child$getPropValue.call(child, 'key')) === IMAGE_KEY;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return undefined;
|
|
39
|
-
};
|
|
40
|
-
var getImageStyleNumber = function getImageStyleNumber(target, styleKey) {
|
|
41
|
-
var imageChildNode = findImageChildNode(target);
|
|
42
|
-
if (imageChildNode) {
|
|
43
|
-
var _imageChildNode$getPr, _imageChildNode$getPr2;
|
|
44
|
-
return parsePxNumber((_imageChildNode$getPr = imageChildNode.getPropValue) === null || _imageChildNode$getPr === void 0 ? void 0 : (_imageChildNode$getPr2 = _imageChildNode$getPr.call(imageChildNode, 'style')) === null || _imageChildNode$getPr2 === void 0 ? void 0 : _imageChildNode$getPr2[styleKey]);
|
|
45
|
-
}
|
|
46
|
-
return undefined;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 同步 Image 子节点的 style.width / style.height。
|
|
51
|
-
* 使用 Promise.resolve().then() 异步执行,避免在父节点 setPropValue
|
|
52
|
-
* 的 MobX 同步响应链中触发子节点变更(可能导致 SettingField 重建)。
|
|
53
|
-
*/
|
|
54
|
-
var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value) {
|
|
55
|
-
Promise.resolve().then(function () {
|
|
56
|
-
var _imageChildNode$getPr3, _extends2, _imageChildNode$setPr;
|
|
57
|
-
var imageChildNode = findImageChildNode(target);
|
|
58
|
-
if (!imageChildNode) return;
|
|
59
|
-
var currentStyle = ((_imageChildNode$getPr3 = imageChildNode.getPropValue) === null || _imageChildNode$getPr3 === void 0 ? void 0 : _imageChildNode$getPr3.call(imageChildNode, 'style')) || {};
|
|
60
|
-
var updatedStyle = (0, _extends3["default"])({}, currentStyle, (_extends2 = {}, _extends2[styleKey] = value + "px", _extends2));
|
|
61
|
-
var otherKey = styleKey === 'width' ? 'height' : 'width';
|
|
62
|
-
if (!updatedStyle[otherKey]) {
|
|
63
|
-
var _target$getProps, _target$getProps$call, _target$getProps$call2;
|
|
64
|
-
var otherPropKey = otherKey === 'width' ? 'imgWidth' : 'imgHeight';
|
|
65
|
-
var otherPropValue = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$getProps = target.getProps) === null || _target$getProps === void 0 ? void 0 : (_target$getProps$call = _target$getProps.call(target)) === null || _target$getProps$call === void 0 ? void 0 : (_target$getProps$call2 = _target$getProps$call.getPropValue) === null || _target$getProps$call2 === void 0 ? void 0 : _target$getProps$call2.call(_target$getProps$call, otherPropKey));
|
|
66
|
-
updatedStyle[otherKey] = (otherPropValue !== null && otherPropValue !== void 0 ? otherPropValue : 100) + "px";
|
|
67
|
-
}
|
|
68
|
-
(_imageChildNode$setPr = imageChildNode.setPropValue) === null || _imageChildNode$setPr === void 0 ? void 0 : _imageChildNode$setPr.call(imageChildNode, 'style', updatedStyle);
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
23
|
var TeletextListMeta = {
|
|
72
24
|
group: '低代码组件',
|
|
73
25
|
componentName: 'TeletextList',
|
|
@@ -183,20 +135,23 @@ var TeletextListMeta = {
|
|
|
183
135
|
initialValue: 100
|
|
184
136
|
},
|
|
185
137
|
extraProps: {
|
|
138
|
+
/**
|
|
139
|
+
* ignoreDefaultValue: 防止布局面板修改 Image 子节点 style 后,
|
|
140
|
+
* 引擎 remount SettingFieldView 时 initDefaultValue 把 imgWidth 重置为 100。
|
|
141
|
+
* 与 dataList 同理:只要 prop 有值就永远不应被 initialValue 覆盖。
|
|
142
|
+
*/
|
|
143
|
+
ignoreDefaultValue: function ignoreDefaultValue() {
|
|
144
|
+
return true;
|
|
145
|
+
},
|
|
186
146
|
getValue: function getValue(target, value) {
|
|
187
|
-
var
|
|
188
|
-
|
|
189
|
-
var
|
|
190
|
-
if (
|
|
147
|
+
var _target$node, _target$node$schema, _target$node$schema$p;
|
|
148
|
+
// 优先使用引擎传入的当前 prop 值
|
|
149
|
+
var parsed = parsePxNumber(value);
|
|
150
|
+
if (parsed !== undefined) return parsed;
|
|
151
|
+
// 二级兜底:从 schema 快照读取(防止引擎传入 undefined 时丢失已保存的值)
|
|
152
|
+
var fromSchema = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$node = target.node) === null || _target$node === void 0 ? void 0 : (_target$node$schema = _target$node.schema) === null || _target$node$schema === void 0 ? void 0 : (_target$node$schema$p = _target$node$schema.props) === null || _target$node$schema$p === void 0 ? void 0 : _target$node$schema$p.imgWidth);
|
|
153
|
+
if (fromSchema !== undefined) return fromSchema;
|
|
191
154
|
return 100;
|
|
192
|
-
},
|
|
193
|
-
setValue: function setValue(target, value) {
|
|
194
|
-
// 引擎已自动 setPropValue('imgWidth', value)
|
|
195
|
-
// 只需同步到 Image 子节点的 style
|
|
196
|
-
var parsedValue = parsePxNumber(value);
|
|
197
|
-
if (parsedValue !== undefined) {
|
|
198
|
-
syncImageStyleValue(target, 'width', parsedValue);
|
|
199
|
-
}
|
|
200
155
|
}
|
|
201
156
|
}
|
|
202
157
|
}, {
|
|
@@ -209,20 +164,16 @@ var TeletextListMeta = {
|
|
|
209
164
|
initialValue: 100
|
|
210
165
|
},
|
|
211
166
|
extraProps: {
|
|
167
|
+
ignoreDefaultValue: function ignoreDefaultValue() {
|
|
168
|
+
return true;
|
|
169
|
+
},
|
|
212
170
|
getValue: function getValue(target, value) {
|
|
213
|
-
var
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
171
|
+
var _target$node2, _target$node2$schema, _target$node2$schema$;
|
|
172
|
+
var parsed = parsePxNumber(value);
|
|
173
|
+
if (parsed !== undefined) return parsed;
|
|
174
|
+
var fromSchema = parsePxNumber(target === null || target === void 0 ? void 0 : (_target$node2 = target.node) === null || _target$node2 === void 0 ? void 0 : (_target$node2$schema = _target$node2.schema) === null || _target$node2$schema === void 0 ? void 0 : (_target$node2$schema$ = _target$node2$schema.props) === null || _target$node2$schema$ === void 0 ? void 0 : _target$node2$schema$.imgHeight);
|
|
175
|
+
if (fromSchema !== undefined) return fromSchema;
|
|
217
176
|
return 100;
|
|
218
|
-
},
|
|
219
|
-
setValue: function setValue(target, value) {
|
|
220
|
-
// 引擎已自动 setPropValue('imgHeight', value)
|
|
221
|
-
// 只需同步到 Image 子节点的 style
|
|
222
|
-
var parsedValue = parsePxNumber(value);
|
|
223
|
-
if (parsedValue !== undefined) {
|
|
224
|
-
syncImageStyleValue(target, 'height', parsedValue);
|
|
225
|
-
}
|
|
226
177
|
}
|
|
227
178
|
}
|
|
228
179
|
}, {
|
|
@@ -251,9 +202,7 @@ var TeletextListMeta = {
|
|
|
251
202
|
}
|
|
252
203
|
},
|
|
253
204
|
extraProps: {
|
|
254
|
-
|
|
255
|
-
target.getProps().setPropValue('dataListBind', value);
|
|
256
|
-
}
|
|
205
|
+
// 引擎已自动 node.setPropValue('dataListBind', value),无需重复写入
|
|
257
206
|
}
|
|
258
207
|
}, {
|
|
259
208
|
title: '标题',
|
|
@@ -296,9 +245,9 @@ var TeletextListMeta = {
|
|
|
296
245
|
},
|
|
297
246
|
extraProps: {
|
|
298
247
|
setValue: function setValue(target, value) {
|
|
299
|
-
var _target$
|
|
248
|
+
var _target$node3, _schemaChildren$filte, _target$parent, _target$parent$items;
|
|
300
249
|
target.getProps().setPropValue('textLines', value);
|
|
301
|
-
var schema = target === null || target === void 0 ? void 0 : (_target$
|
|
250
|
+
var schema = target === null || target === void 0 ? void 0 : (_target$node3 = target.node) === null || _target$node3 === void 0 ? void 0 : _target$node3.schema;
|
|
302
251
|
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
303
252
|
var schemaChildren = Array.isArray(schema === null || schema === void 0 ? void 0 : schema.children) ? schema.children : [];
|
|
304
253
|
|
|
@@ -692,11 +641,11 @@ var TeletextListMeta = {
|
|
|
692
641
|
}
|
|
693
642
|
},
|
|
694
643
|
initialValue: function initialValue(target) {
|
|
695
|
-
var _target$node$schema$
|
|
644
|
+
var _target$node$schema$p2, _target$node4, _target$node4$schema, _target$node4$schema$, _target$getProps, _target$getProps$call, _target$getProps$call2;
|
|
696
645
|
// ignoreDefaultValue: () => true 保证此函数在 SettingFieldView remount 时
|
|
697
646
|
// 永远不会被 initDefaultValue 调用,仅作为安全兜底保留。
|
|
698
647
|
// 正常的首次创建数据由 snippet.props.dataList 提供。
|
|
699
|
-
var existing = (_target$node$schema$
|
|
648
|
+
var existing = (_target$node$schema$p2 = target === null || target === void 0 ? void 0 : (_target$node4 = target.node) === null || _target$node4 === void 0 ? void 0 : (_target$node4$schema = _target$node4.schema) === null || _target$node4$schema === void 0 ? void 0 : (_target$node4$schema$ = _target$node4$schema.props) === null || _target$node4$schema$ === void 0 ? void 0 : _target$node4$schema$.dataList) !== null && _target$node$schema$p2 !== void 0 ? _target$node$schema$p2 : target === null || target === void 0 ? void 0 : (_target$getProps = target.getProps) === null || _target$getProps === void 0 ? void 0 : (_target$getProps$call = _target$getProps.call(target)) === null || _target$getProps$call === void 0 ? void 0 : (_target$getProps$call2 = _target$getProps$call.getPropValue) === null || _target$getProps$call2 === void 0 ? void 0 : _target$getProps$call2.call(_target$getProps$call, 'dataList');
|
|
700
649
|
if (existing !== undefined) return existing;
|
|
701
650
|
return DEFAULT_DATA_LIST;
|
|
702
651
|
}
|
|
@@ -714,11 +663,11 @@ var TeletextListMeta = {
|
|
|
714
663
|
return true;
|
|
715
664
|
},
|
|
716
665
|
getValue: function getValue(target, currentValue) {
|
|
717
|
-
var _target$
|
|
666
|
+
var _target$node5, _target$node5$schema, _target$node5$schema$;
|
|
718
667
|
// currentValue 已有值时直接返回
|
|
719
668
|
if (currentValue !== undefined) return currentValue;
|
|
720
669
|
// 从 schema 快照兜底读取(最可靠的源头数据,始终反映持久化状态)
|
|
721
|
-
var fromSchema = target === null || target === void 0 ? void 0 : (_target$
|
|
670
|
+
var fromSchema = target === null || target === void 0 ? void 0 : (_target$node5 = target.node) === null || _target$node5 === void 0 ? void 0 : (_target$node5$schema = _target$node5.schema) === null || _target$node5$schema === void 0 ? void 0 : (_target$node5$schema$ = _target$node5$schema.props) === null || _target$node5$schema$ === void 0 ? void 0 : _target$node5$schema$.dataList;
|
|
722
671
|
if (fromSchema !== undefined) return fromSchema;
|
|
723
672
|
return undefined;
|
|
724
673
|
}
|
|
@@ -865,6 +814,6 @@ var getSnippets = function getSnippets(textLines) {
|
|
|
865
814
|
}
|
|
866
815
|
}];
|
|
867
816
|
};
|
|
868
|
-
var _default = exports["default"] = (0,
|
|
817
|
+
var _default = exports["default"] = (0, _extends2["default"])({}, TeletextListMeta, {
|
|
869
818
|
snippets: getSnippets(2)
|
|
870
819
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dckj-npm/dc-material",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.376",
|
|
4
4
|
"description": "dc低代码物料",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -114,10 +114,10 @@
|
|
|
114
114
|
},
|
|
115
115
|
"componentConfig": {
|
|
116
116
|
"isComponentLibrary": true,
|
|
117
|
-
"materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.
|
|
117
|
+
"materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.376/build/lowcode/assets-prod.json"
|
|
118
118
|
},
|
|
119
119
|
"lcMeta": {
|
|
120
120
|
"type": "component"
|
|
121
121
|
},
|
|
122
|
-
"homepage": "https://unpkg.com/@dckj-npm/dc-material@0.1.
|
|
122
|
+
"homepage": "https://unpkg.com/@dckj-npm/dc-material@0.1.376/build/index.html"
|
|
123
123
|
}
|