ftdsy-attr 2.1.16 → 2.1.18

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.
@@ -91,6 +91,10 @@ declare function matchCategoryProperties(matchDatas: MatchDatas, matchLevel?: nu
91
91
  data: goodsAttr[];
92
92
  code: number;
93
93
  }>;
94
+ /**
95
+ * 根据模板重新填写属性
96
+ *
97
+ * */
94
98
  /**
95
99
  * 创建分类属性模板
96
100
  *
@@ -105,6 +109,12 @@ declare function matchCategoryProperties(matchDatas: MatchDatas, matchLevel?: nu
105
109
  * treeSingleSelect: { attr_name: '风格', value: '休闲风-简约风' };
106
110
  * */
107
111
  declare function createCategoryPropertyTemplate(properties: (DsyAttrWithValue | goodsAttr)[]): goodsAttr[];
112
+ declare const ftdsyAttr: {
113
+ createCategoryProperties: typeof createCategoryProperties;
114
+ getOriginProperty: typeof getOriginProperty;
115
+ matchCategoryProperties: typeof matchCategoryProperties;
116
+ createCategoryPropertyTemplate: typeof createCategoryPropertyTemplate;
117
+ };
108
118
 
109
- export { createCategoryProperties, createCategoryPropertyTemplate, getOriginProperty, matchCategoryProperties };
119
+ export { createCategoryProperties, createCategoryPropertyTemplate, ftdsyAttr as default, getOriginProperty, matchCategoryProperties };
110
120
  export type { ComponentType, Condition, DsyAttr, DsyAttrValue, DsyAttrWithValue, MatchDatas, PropertyComponent, PropertyOption, PropertyType, Pt, Rule, RuleName, goodsAttr };
@@ -297,7 +297,7 @@ var y = function t(s) {
297
297
  return s.values && s.values.length > 0 ? 1 === s.choose_max_num ? "singleSelect" : "multiSelect" : 5 == s.property_value_type ? "date" : s.value_unit && s.value_unit.length > 0 ? "inputComponent" : "input";
298
298
  };
299
299
 
300
- function U(t) {
300
+ function r(t) {
301
301
  return t && Array.isArray(t);
302
302
  }
303
303
 
@@ -307,7 +307,7 @@ Object.getPrototypeOf(k(o().m(function t() {
307
307
  }, t);
308
308
  }))).constructor;
309
309
 
310
- var w = function t(s) {
310
+ var U = function t(s) {
311
311
  switch (s) {
312
312
  case "singleCheck":
313
313
  return "singleSelect";
@@ -326,15 +326,15 @@ var w = function t(s) {
326
326
  }
327
327
  };
328
328
 
329
- function r(t) {
329
+ function w(t) {
330
330
  return t.map(function(t) {
331
331
  var s, e, k, d, i = [];
332
- null != t && t.options && (i = U(null == t || null === (e = t.options) || void 0 === e ? void 0 : e.option) ? null == t || null === (d = t.options) || void 0 === d ? void 0 : d.option : [ null == t || null === (k = t.options) || void 0 === k ? void 0 : k.option ]);
332
+ null != t && t.options && (i = r(null == t || null === (e = t.options) || void 0 === e ? void 0 : e.option) ? null == t || null === (d = t.options) || void 0 === d ? void 0 : d.option : [ null == t || null === (k = t.options) || void 0 === k ? void 0 : k.option ]);
333
333
  var b = {
334
334
  property_id: t.id,
335
335
  property_required: !1,
336
336
  property_name: t.name,
337
- property_type: w(t.type),
337
+ property_type: U(t.type),
338
338
  property_values: (null === (s = i) || void 0 === s ? void 0 : s.map(function(t) {
339
339
  return {
340
340
  label: t.displayName,
@@ -345,7 +345,7 @@ function r(t) {
345
345
  has_children: !1
346
346
  };
347
347
  if (t.rules) {
348
- var o, h = U(null === (o = t.rules) || void 0 === o ? void 0 : o.rule) ? t.rules.rule : [ t.rules.rule ];
348
+ var o, h = r(null === (o = t.rules) || void 0 === o ? void 0 : o.rule) ? t.rules.rule : [ t.rules.rule ];
349
349
  b.property_required = h.some(function(t) {
350
350
  return "requiredRule" === t.name;
351
351
  }) || !1, b.select_custom = h.some(function(t) {
@@ -355,11 +355,11 @@ function r(t) {
355
355
  }) || !1;
356
356
  }
357
357
  if ("input" === b.property_type && t.properties) {
358
- var l = t.properties.property.taoSirType.value, a = U(t.properties.property.formats.format) ? t.properties.property.formats.format : [ t.properties.property.formats.format ];
358
+ var l = t.properties.property.taoSirType.value, a = r(t.properties.property.formats.format) ? t.properties.property.formats.format : [ t.properties.property.formats.format ];
359
359
  if ("date" === l) {
360
360
  var x;
361
361
  b.property_type = "date";
362
- var m = U(t.properties.property.unitNames.unitName) ? (null === (x = t.properties.property.unitNames.unitName[0]) || void 0 === x ? void 0 : x.value) || "" : t.properties.property.unitNames.unitName.value;
362
+ var m = r(t.properties.property.unitNames.unitName) ? (null === (x = t.properties.property.unitNames.unitName[0]) || void 0 === x ? void 0 : x.value) || "" : t.properties.property.unitNames.unitName.value;
363
363
  "年" === m ? b.rules.push({
364
364
  name: "format",
365
365
  value: "YYYY"
@@ -378,7 +378,7 @@ function r(t) {
378
378
  type: s.type,
379
379
  options: "unit" === s.type ? function() {
380
380
  var s = t.properties.property.unitNames.unitName;
381
- return U(s) || (s = [ s ]), s.map(function(t) {
381
+ return r(s) || (s = [ s ]), s.map(function(t) {
382
382
  return {
383
383
  label: t.value,
384
384
  value: t.value
@@ -391,7 +391,7 @@ function r(t) {
391
391
  }
392
392
  }
393
393
  if ("multiComplex" === b.property_type) {
394
- var y = U(t.fields.field) ? t.fields.field : [ t.fields.field ];
394
+ var y = r(t.fields.field) ? t.fields.field : [ t.fields.field ];
395
395
  b.property_component = y.map(function(t) {
396
396
  var s;
397
397
  return {
@@ -70646,14 +70646,14 @@ function Q(t, s, e, k) {
70646
70646
  if ([ "上市时间", "上市年份季节", "上市时节", "适用季节", "上市年份/季节", "年份季节", "适合季节", "上市年份" ].includes(s.property_name) || "date" == d) {
70647
70647
  var y = A();
70648
70648
  if ("date" == d) {
70649
- var U = ((null == s ? void 0 : s.date_format) || "yyyy-MM-dd").toUpperCase(), w = "";
70650
- return w = "YYYY-MM-DD" === U ? "".concat(y.year, "-").concat(y.month, "-").concat(y.day) : "YYYY-MM" === U ? "".concat(y.year, "-").concat(y.month) : "".concat(y.year),
70651
- void (s.property_value = w);
70649
+ var r = ((null == s ? void 0 : s.date_format) || "yyyy-MM-dd").toUpperCase(), U = "";
70650
+ return U = "YYYY-MM-DD" === r ? "".concat(y.year, "-").concat(y.month, "-").concat(y.day) : "YYYY-MM" === r ? "".concat(y.year, "-").concat(y.month) : "".concat(y.year),
70651
+ void (s.property_value = U);
70652
70652
  }
70653
70653
  if ("input" == d) return void (s.property_value = (null == y ? void 0 : y.year) || "");
70654
70654
  if ([ "上市年份季节", "上市时节", "上市时间", "上市年份/季节", "年份季节", "上市年份" ].includes(s.property_name) && [ "singleSelect", "multiSelect" ].includes(d)) {
70655
- var r = y.year + "年" + y.season, j = i.find(function(t) {
70656
- return B(t.name, [ "春", "夏", "秋", "冬" ]) ? t.name === r || t.name + "季" === r : t.name.includes(y.year + "年");
70655
+ var w = y.year + "年" + y.season, j = i.find(function(t) {
70656
+ return B(t.name, [ "春", "夏", "秋", "冬" ]) ? t.name === w || t.name + "季" === w : t.name.includes(y.year + "年");
70657
70657
  });
70658
70658
  if (j) return void ("singleSelect" == d ? s.property_value = j : "multiSelect" == d && (s.property_value = [ j ]));
70659
70659
  }
@@ -70896,7 +70896,7 @@ var Z = function() {
70896
70896
 
70897
70897
  function dt() {
70898
70898
  return dt = k(o().m(function t(s, e) {
70899
- var k, i, b, h, l, a, x, m, f, y, U, w, r, j, u, n, c, v, _, C, S, I = arguments;
70899
+ var k, i, b, h, l, a, x, m, f, y, r, U, w, j, u, n, c, v, _, C, S, I = arguments;
70900
70900
  return o().w(function(t) {
70901
70901
  for (;;) switch (t.p = t.n) {
70902
70902
  case 0:
@@ -70964,11 +70964,11 @@ function dt() {
70964
70964
  t.n = 15;
70965
70965
  break;
70966
70966
  }
70967
- if (O((U = y.value).property_value)) {
70967
+ if (O((r = y.value).property_value)) {
70968
70968
  t.n = 14;
70969
70969
  break;
70970
70970
  }
70971
- if (Q(s, U, l.join("、"), i), O(U.property_value)) {
70971
+ if (Q(s, r, l.join("、"), i), O(r.property_value)) {
70972
70972
  t.n = 13;
70973
70973
  break;
70974
70974
  }
@@ -70976,11 +70976,11 @@ function dt() {
70976
70976
  break;
70977
70977
 
70978
70978
  case 13:
70979
- if (!U.has_children) {
70979
+ if (!r.has_children) {
70980
70980
  t.n = 14;
70981
70981
  break;
70982
70982
  }
70983
- return t.n = 14, bt(s, U, b);
70983
+ return t.n = 14, bt(s, r, b);
70984
70984
 
70985
70985
  case 14:
70986
70986
  t.n = 12;
@@ -71001,10 +71001,10 @@ function dt() {
71001
71001
  t.n = 26;
71002
71002
  break;
71003
71003
  }
71004
- w = s.is_other_force ? b.list : b.required_list, r = d(w), t.p = 19, r.s();
71004
+ U = s.is_other_force ? b.list : b.required_list, w = d(U), t.p = 19, w.s();
71005
71005
 
71006
71006
  case 20:
71007
- if ((j = r.n()).done) {
71007
+ if ((j = w.n()).done) {
71008
71008
  t.n = 23;
71009
71009
  break;
71010
71010
  }
@@ -71037,10 +71037,10 @@ function dt() {
71037
71037
  break;
71038
71038
 
71039
71039
  case 24:
71040
- t.p = 24, S = t.v, r.e(S);
71040
+ t.p = 24, S = t.v, w.e(S);
71041
71041
 
71042
71042
  case 25:
71043
- return t.p = 25, r.f(), t.f(25);
71043
+ return t.p = 25, w.f(), t.f(25);
71044
71044
 
71045
71045
  case 26:
71046
71046
  return v = b.list.map(function(t) {
@@ -71226,7 +71226,7 @@ function pt() {
71226
71226
  t.n = 2, st(l);
71227
71227
 
71228
71228
  case 2:
71229
- (a = t.v) && (x = a.data).length > 0 && (r(x) || []).forEach(function(t) {
71229
+ (a = t.v) && (x = a.data).length > 0 && (w(x) || []).forEach(function(t) {
71230
71230
  if (b && b.property_id === t.property_id) if (h && h.parent_value_ids) h.parent_value_ids.push(d); else {
71231
71231
  var s = b.show_condition || [];
71232
71232
  s.push({
@@ -71370,7 +71370,7 @@ function ht(t, s) {
71370
71370
  }(s);
71371
71371
 
71372
71372
  case "tb":
71373
- return r(s);
71373
+ return w(s);
71374
71374
 
71375
71375
  case "jd":
71376
71376
  return function e(t) {
@@ -71900,5 +71900,15 @@ function mt(t) {
71900
71900
  }), s;
71901
71901
  }
71902
71902
 
71903
- export { ht as createCategoryProperties, mt as createCategoryPropertyTemplate, lt as getOriginProperty, at as matchCategoryProperties };
71903
+ var ft = {
71904
+ createCategoryProperties: ht,
71905
+ getOriginProperty: lt,
71906
+ matchCategoryProperties: at,
71907
+ createCategoryPropertyTemplate: mt
71908
+ };
71909
+
71910
+ "undefined" != typeof module && module.exports && (module.exports = ft, module.exports.default = ft),
71911
+ "undefined" != typeof globalThis && (globalThis.ftdsyAttr = ft);
71912
+
71913
+ export { ht as createCategoryProperties, mt as createCategoryPropertyTemplate, ft as default, lt as getOriginProperty, at as matchCategoryProperties };
71904
71914
  //# sourceMappingURL=ftdsy-attr.esm.mjs.map