@dckj-npm/dc-material 0.1.210 → 0.1.211

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.
@@ -153,19 +153,7 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
153
153
  },
154
154
  extraProps: {
155
155
  getValue(target, value) {
156
- const textLines = target.getProps().getPropValue('textLines')
157
- // const a = target?.getValue()
158
- // const b = target?.getPropValue('dataListBind')
159
- // const c = target?.getDefaultValue()
160
- // const d = target?.getExtraPropValue('dataListBind')
161
- const setter = target.setter.props.attributes
162
- target.setter.props.attributes[0].children.push(
163
- ...Array.from({ length: textLines }).map((_, index) => ({
164
- label: `文本${index + 1}`,
165
- value: `text${index + 1}`,
166
- })),
167
- )
168
- console.log('dataList getValue', target, value, setter)
156
+ console.log('dataList getValue', target, value)
169
157
  },
170
158
  setValue: (target, value) => {
171
159
  console.log('dataList setValue', target, value)
@@ -359,13 +347,32 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
359
347
  ),
360
348
  )
361
349
  }
362
- // const a = target?.getValue()
363
- // const b = target?.getPropValue('dataListBind')
364
- // const c = target?.getDefaultValue()
365
- // const d = target?.getExtraPropValue('dataListBind')
366
350
 
367
- // 设置新的数据源绑定配置
368
- // target.getProps().setPropValue('数据源绑定', dataSourceConfig)
351
+ // 更新数据源绑定的配置
352
+ const dataListBindProp = target.node.getProp('dataListBind')
353
+ if (dataListBindProp && dataListBindProp.setter) {
354
+ const baseChildren = [
355
+ { label: '图片链接', value: 'image' },
356
+ { label: '标题', value: 'title' },
357
+ { label: '说明', value: 'description' },
358
+ ]
359
+
360
+ // 只有当value大于2时才添加额外的文本字段
361
+ const textChildren =
362
+ value > 2
363
+ ? Array.from({ length: value - 2 }).map((_, index) => ({
364
+ label: `文本${index + 3}`,
365
+ value: `text${index + 3}`,
366
+ }))
367
+ : []
368
+
369
+ // 更新setter的attributes
370
+ dataListBindProp.setter.props.attributes[0].children = [
371
+ ...baseChildren,
372
+ ...textChildren,
373
+ ]
374
+ }
375
+
369
376
  console.log('文字行数', target, value, schema)
370
377
  },
371
378
  },
@@ -99,7 +99,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
99
99
  packageName = '@dckj-npm/dc-material';
100
100
  }
101
101
  if (version === void 0) {
102
- version = '0.1.210';
102
+ version = '0.1.211';
103
103
  }
104
104
  if (basicLibraryVersion === void 0) {
105
105
  basicLibraryVersion = {
@@ -129,22 +129,7 @@ var TeletextListMeta = {
129
129
  },
130
130
  extraProps: {
131
131
  getValue: function getValue(target, value) {
132
- var _target$setter$props$;
133
- var textLines = target.getProps().getPropValue('textLines');
134
- // const a = target?.getValue()
135
- // const b = target?.getPropValue('dataListBind')
136
- // const c = target?.getDefaultValue()
137
- // const d = target?.getExtraPropValue('dataListBind')
138
- var setter = target.setter.props.attributes;
139
- (_target$setter$props$ = target.setter.props.attributes[0].children).push.apply(_target$setter$props$, Array.from({
140
- length: textLines
141
- }).map(function (_, index) {
142
- return {
143
- label: "\u6587\u672C" + (index + 1),
144
- value: "text" + (index + 1)
145
- };
146
- }));
147
- console.log('dataList getValue', target, value, setter);
132
+ console.log('dataList getValue', target, value);
148
133
  },
149
134
  setValue: function setValue(target, value) {
150
135
  console.log('dataList setValue', target, value);
@@ -316,13 +301,34 @@ var TeletextListMeta = {
316
301
  return !(child.componentName === 'NextText' && (_child$props$key2 = child.props.key) !== null && _child$props$key2 !== void 0 && _child$props$key2.startsWith('text-') && parseInt(child.props.key.split('-')[1]) > value);
317
302
  });
318
303
  }
319
- // const a = target?.getValue()
320
- // const b = target?.getPropValue('dataListBind')
321
- // const c = target?.getDefaultValue()
322
- // const d = target?.getExtraPropValue('dataListBind')
323
304
 
324
- // 设置新的数据源绑定配置
325
- // target.getProps().setPropValue('数据源绑定', dataSourceConfig)
305
+ // 更新数据源绑定的配置
306
+ var dataListBindProp = target.node.getProp('dataListBind');
307
+ if (dataListBindProp && dataListBindProp.setter) {
308
+ var baseChildren = [{
309
+ label: '图片链接',
310
+ value: 'image'
311
+ }, {
312
+ label: '标题',
313
+ value: 'title'
314
+ }, {
315
+ label: '说明',
316
+ value: 'description'
317
+ }];
318
+
319
+ // 只有当value大于2时才添加额外的文本字段
320
+ var textChildren = value > 2 ? Array.from({
321
+ length: value - 2
322
+ }).map(function (_, index) {
323
+ return {
324
+ label: "\u6587\u672C" + (index + 3),
325
+ value: "text" + (index + 3)
326
+ };
327
+ }) : [];
328
+
329
+ // 更新setter的attributes
330
+ dataListBindProp.setter.props.attributes[0].children = [].concat(baseChildren, textChildren);
331
+ }
326
332
  console.log('文字行数', target, value, schema);
327
333
  }
328
334
  }
@@ -104,7 +104,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
104
104
  packageName = '@dckj-npm/dc-material';
105
105
  }
106
106
  if (version === void 0) {
107
- version = '0.1.210';
107
+ version = '0.1.211';
108
108
  }
109
109
  if (basicLibraryVersion === void 0) {
110
110
  basicLibraryVersion = {
@@ -134,22 +134,7 @@ var TeletextListMeta = {
134
134
  },
135
135
  extraProps: {
136
136
  getValue: function getValue(target, value) {
137
- var _target$setter$props$;
138
- var textLines = target.getProps().getPropValue('textLines');
139
- // const a = target?.getValue()
140
- // const b = target?.getPropValue('dataListBind')
141
- // const c = target?.getDefaultValue()
142
- // const d = target?.getExtraPropValue('dataListBind')
143
- var setter = target.setter.props.attributes;
144
- (_target$setter$props$ = target.setter.props.attributes[0].children).push.apply(_target$setter$props$, Array.from({
145
- length: textLines
146
- }).map(function (_, index) {
147
- return {
148
- label: "\u6587\u672C" + (index + 1),
149
- value: "text" + (index + 1)
150
- };
151
- }));
152
- console.log('dataList getValue', target, value, setter);
137
+ console.log('dataList getValue', target, value);
153
138
  },
154
139
  setValue: function setValue(target, value) {
155
140
  console.log('dataList setValue', target, value);
@@ -321,13 +306,34 @@ var TeletextListMeta = {
321
306
  return !(child.componentName === 'NextText' && (_child$props$key2 = child.props.key) !== null && _child$props$key2 !== void 0 && _child$props$key2.startsWith('text-') && parseInt(child.props.key.split('-')[1]) > value);
322
307
  });
323
308
  }
324
- // const a = target?.getValue()
325
- // const b = target?.getPropValue('dataListBind')
326
- // const c = target?.getDefaultValue()
327
- // const d = target?.getExtraPropValue('dataListBind')
328
309
 
329
- // 设置新的数据源绑定配置
330
- // target.getProps().setPropValue('数据源绑定', dataSourceConfig)
310
+ // 更新数据源绑定的配置
311
+ var dataListBindProp = target.node.getProp('dataListBind');
312
+ if (dataListBindProp && dataListBindProp.setter) {
313
+ var baseChildren = [{
314
+ label: '图片链接',
315
+ value: 'image'
316
+ }, {
317
+ label: '标题',
318
+ value: 'title'
319
+ }, {
320
+ label: '说明',
321
+ value: 'description'
322
+ }];
323
+
324
+ // 只有当value大于2时才添加额外的文本字段
325
+ var textChildren = value > 2 ? Array.from({
326
+ length: value - 2
327
+ }).map(function (_, index) {
328
+ return {
329
+ label: "\u6587\u672C" + (index + 3),
330
+ value: "text" + (index + 3)
331
+ };
332
+ }) : [];
333
+
334
+ // 更新setter的attributes
335
+ dataListBindProp.setter.props.attributes[0].children = [].concat(baseChildren, textChildren);
336
+ }
331
337
  console.log('文字行数', target, value, schema);
332
338
  }
333
339
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dckj-npm/dc-material",
3
- "version": "0.1.210",
3
+ "version": "0.1.211",
4
4
  "description": "dc低代码物料",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -106,7 +106,7 @@
106
106
  },
107
107
  "componentConfig": {
108
108
  "isComponentLibrary": true,
109
- "materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.210/build/lowcode/assets-prod.json"
109
+ "materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.211/build/lowcode/assets-prod.json"
110
110
  },
111
111
  "lcMeta": {
112
112
  "type": "component"