@dckj-npm/dc-material 0.1.219 → 0.1.221

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.
@@ -314,19 +314,10 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
314
314
  extraProps: {
315
315
  setValue(target, value) {
316
316
  target.getProps().setPropValue('textLines', value)
317
- const map = {}
318
-
319
- if (!Array.isArray(value)) {
320
- value = []
321
- }
322
- value.forEach((item) => {
323
- const tabItem = Object.assign({}, item)
324
- map[item.key] = tabItem
325
- })
326
-
327
- // 获取组件schema
328
- const node = target?.node
329
317
  const schema = target?.node?.schema
318
+ const node = target?.node
319
+
320
+ // 获取当前文本组件数量
330
321
  const currentLength =
331
322
  schema?.children?.filter(
332
323
  (child) =>
@@ -344,45 +335,17 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
344
335
  key: `text-${i}`,
345
336
  },
346
337
  }
347
- // 使用 node.children.push 添加子节点
348
- // node.children.push(newChild)
349
- node?.children?.mergeChildren(
350
- (child) => {
351
- const primaryKey = String(child.getPropValue('key'))
352
- return Object.hasOwnProperty.call(map, primaryKey)
353
- },
354
- () => {
355
- const items = []
356
- for (const key in map) {
357
- if (Object.hasOwnProperty.call(map, key)) {
358
- items.push({
359
- componentName: 'NextText',
360
- props: map[key],
361
- })
362
- }
363
- }
364
- items.push(newChild)
365
- return items
366
- },
367
- (child1, child2) => {
368
- const a = children.findIndex(
369
- (item) => String(item.props.key) === String(child1.getPropValue('key')),
370
- )
371
- const b = children.findIndex(
372
- (item) => String(item.props.key) === String(child2.getPropValue('key')),
373
- )
374
- return a - b
375
- },
376
- )
338
+ console.log('node', node, 'node-children', node?.children)
339
+ node?.children?.push(newChild)
377
340
  }
378
341
  } else if (value < currentLength) {
379
342
  // 需要移除多余的文本组件
380
- node.children = node.children.filter(
343
+ node?.children?.filter(
381
344
  (child) =>
382
345
  !(
383
346
  child.componentName === 'NextText' &&
384
- child.props.key?.startsWith('text-') &&
385
- parseInt(child.props.key.split('-')[1]) > value
347
+ child.props?.key?.startsWith('text-') &&
348
+ parseInt(child?.props?.key.split('-')[1]) > value
386
349
  ),
387
350
  )
388
351
  }
@@ -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.219';
102
+ version = '0.1.221';
103
103
  }
104
104
  if (basicLibraryVersion === void 0) {
105
105
  basicLibraryVersion = {
@@ -272,24 +272,17 @@ var TeletextListMeta = {
272
272
  setValue: function setValue(target, value) {
273
273
  var _target$node, _schema$children, _schema$children$filt, _target$parent$node;
274
274
  target.getProps().setPropValue('textLines', value);
275
- var map = {};
276
- if (!Array.isArray(value)) {
277
- value = [];
278
- }
279
- value.forEach(function (item) {
280
- var tabItem = Object.assign({}, item);
281
- map[item.key] = tabItem;
282
- });
283
-
284
- // 获取组件schema
285
- var node = target === null || target === void 0 ? void 0 : target.node;
286
275
  var schema = target === null || target === void 0 ? void 0 : (_target$node = target.node) === null || _target$node === void 0 ? void 0 : _target$node.schema;
276
+ var node = target === null || target === void 0 ? void 0 : target.node;
277
+
278
+ // 获取当前文本组件数量
287
279
  var currentLength = (schema === null || schema === void 0 ? void 0 : (_schema$children = schema.children) === null || _schema$children === void 0 ? void 0 : (_schema$children$filt = _schema$children.filter(function (child) {
288
280
  var _child$props$key;
289
281
  return child.componentName === 'NextText' && ((_child$props$key = child.props.key) === null || _child$props$key === void 0 ? void 0 : _child$props$key.startsWith('text-'));
290
282
  })) === null || _schema$children$filt === void 0 ? void 0 : _schema$children$filt.length) || 0;
291
283
  if (value > currentLength) {
292
- var _loop = function _loop() {
284
+ // 需要添加新的文本组件
285
+ for (var i = currentLength + 1; i <= value; i++) {
293
286
  var _node$children;
294
287
  var newChild = {
295
288
  componentName: 'NextText',
@@ -299,42 +292,15 @@ var TeletextListMeta = {
299
292
  key: "text-" + i
300
293
  }
301
294
  };
302
- // 使用 node.children.push 添加子节点
303
- // node.children.push(newChild)
304
- node === null || node === void 0 ? void 0 : (_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.mergeChildren(function (child) {
305
- var primaryKey = String(child.getPropValue('key'));
306
- return Object.hasOwnProperty.call(map, primaryKey);
307
- }, function () {
308
- var items = [];
309
- for (var key in map) {
310
- if (Object.hasOwnProperty.call(map, key)) {
311
- items.push({
312
- componentName: 'NextText',
313
- props: map[key]
314
- });
315
- }
316
- }
317
- items.push(newChild);
318
- return items;
319
- }, function (child1, child2) {
320
- var a = children.findIndex(function (item) {
321
- return String(item.props.key) === String(child1.getPropValue('key'));
322
- });
323
- var b = children.findIndex(function (item) {
324
- return String(item.props.key) === String(child2.getPropValue('key'));
325
- });
326
- return a - b;
327
- });
328
- };
329
- // 需要添加新的文本组件
330
- for (var i = currentLength + 1; i <= value; i++) {
331
- _loop();
295
+ console.log('node', node, 'node-children', node === null || node === void 0 ? void 0 : node.children);
296
+ node === null || node === void 0 ? void 0 : (_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.push(newChild);
332
297
  }
333
298
  } else if (value < currentLength) {
299
+ var _node$children2;
334
300
  // 需要移除多余的文本组件
335
- node.children = node.children.filter(function (child) {
336
- var _child$props$key2;
337
- 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);
301
+ node === null || node === void 0 ? void 0 : (_node$children2 = node.children) === null || _node$children2 === void 0 ? void 0 : _node$children2.filter(function (child) {
302
+ var _child$props, _child$props$key2, _child$props2;
303
+ return !(child.componentName === 'NextText' && (_child$props = child.props) !== null && _child$props !== void 0 && (_child$props$key2 = _child$props.key) !== null && _child$props$key2 !== void 0 && _child$props$key2.startsWith('text-') && parseInt(child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.key.split('-')[1]) > value);
338
304
  });
339
305
  }
340
306
 
@@ -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.219';
107
+ version = '0.1.221';
108
108
  }
109
109
  if (basicLibraryVersion === void 0) {
110
110
  basicLibraryVersion = {
@@ -277,24 +277,17 @@ var TeletextListMeta = {
277
277
  setValue: function setValue(target, value) {
278
278
  var _target$node, _schema$children, _schema$children$filt, _target$parent$node;
279
279
  target.getProps().setPropValue('textLines', value);
280
- var map = {};
281
- if (!Array.isArray(value)) {
282
- value = [];
283
- }
284
- value.forEach(function (item) {
285
- var tabItem = Object.assign({}, item);
286
- map[item.key] = tabItem;
287
- });
288
-
289
- // 获取组件schema
290
- var node = target === null || target === void 0 ? void 0 : target.node;
291
280
  var schema = target === null || target === void 0 ? void 0 : (_target$node = target.node) === null || _target$node === void 0 ? void 0 : _target$node.schema;
281
+ var node = target === null || target === void 0 ? void 0 : target.node;
282
+
283
+ // 获取当前文本组件数量
292
284
  var currentLength = (schema === null || schema === void 0 ? void 0 : (_schema$children = schema.children) === null || _schema$children === void 0 ? void 0 : (_schema$children$filt = _schema$children.filter(function (child) {
293
285
  var _child$props$key;
294
286
  return child.componentName === 'NextText' && ((_child$props$key = child.props.key) === null || _child$props$key === void 0 ? void 0 : _child$props$key.startsWith('text-'));
295
287
  })) === null || _schema$children$filt === void 0 ? void 0 : _schema$children$filt.length) || 0;
296
288
  if (value > currentLength) {
297
- var _loop = function _loop() {
289
+ // 需要添加新的文本组件
290
+ for (var i = currentLength + 1; i <= value; i++) {
298
291
  var _node$children;
299
292
  var newChild = {
300
293
  componentName: 'NextText',
@@ -304,42 +297,15 @@ var TeletextListMeta = {
304
297
  key: "text-" + i
305
298
  }
306
299
  };
307
- // 使用 node.children.push 添加子节点
308
- // node.children.push(newChild)
309
- node === null || node === void 0 ? void 0 : (_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.mergeChildren(function (child) {
310
- var primaryKey = String(child.getPropValue('key'));
311
- return Object.hasOwnProperty.call(map, primaryKey);
312
- }, function () {
313
- var items = [];
314
- for (var key in map) {
315
- if (Object.hasOwnProperty.call(map, key)) {
316
- items.push({
317
- componentName: 'NextText',
318
- props: map[key]
319
- });
320
- }
321
- }
322
- items.push(newChild);
323
- return items;
324
- }, function (child1, child2) {
325
- var a = children.findIndex(function (item) {
326
- return String(item.props.key) === String(child1.getPropValue('key'));
327
- });
328
- var b = children.findIndex(function (item) {
329
- return String(item.props.key) === String(child2.getPropValue('key'));
330
- });
331
- return a - b;
332
- });
333
- };
334
- // 需要添加新的文本组件
335
- for (var i = currentLength + 1; i <= value; i++) {
336
- _loop();
300
+ console.log('node', node, 'node-children', node === null || node === void 0 ? void 0 : node.children);
301
+ node === null || node === void 0 ? void 0 : (_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.push(newChild);
337
302
  }
338
303
  } else if (value < currentLength) {
304
+ var _node$children2;
339
305
  // 需要移除多余的文本组件
340
- node.children = node.children.filter(function (child) {
341
- var _child$props$key2;
342
- 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);
306
+ node === null || node === void 0 ? void 0 : (_node$children2 = node.children) === null || _node$children2 === void 0 ? void 0 : _node$children2.filter(function (child) {
307
+ var _child$props, _child$props$key2, _child$props2;
308
+ return !(child.componentName === 'NextText' && (_child$props = child.props) !== null && _child$props !== void 0 && (_child$props$key2 = _child$props.key) !== null && _child$props$key2 !== void 0 && _child$props$key2.startsWith('text-') && parseInt(child === null || child === void 0 ? void 0 : (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.key.split('-')[1]) > value);
343
309
  });
344
310
  }
345
311
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dckj-npm/dc-material",
3
- "version": "0.1.219",
3
+ "version": "0.1.221",
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.219/build/lowcode/assets-prod.json"
109
+ "materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.221/build/lowcode/assets-prod.json"
110
110
  },
111
111
  "lcMeta": {
112
112
  "type": "component"