complexqa_frontend_core 1.13.3 → 1.13.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "complexqa_frontend_core",
3
- "version": "1.13.3",
3
+ "version": "1.13.4",
4
4
  "description": "core of web ",
5
5
  "type": "module",
6
6
  "exports": {
@@ -250,6 +250,39 @@ export class ApiAbstractElementClass
250
250
  }
251
251
 
252
252
 
253
+ /**
254
+ *
255
+ * @version v.0.1 (07/04/2026)
256
+ * @param payload
257
+ */
258
+ async update_property_mass(payload)
259
+ {
260
+ if (!this.module_prefix)
261
+ {
262
+ throw new Error('Error #262-4529 in ApiAbstractClass');
263
+ }
264
+
265
+ if (this.stage === 'development')
266
+ {
267
+ return {
268
+ response: payload,
269
+ payload : payload
270
+ };
271
+ }
272
+
273
+ let url = `/${ this.api_prefix }/${ this.module_prefix }/update_property_mass`;
274
+
275
+ payload = this.handle_request_payload(payload);
276
+ let response = this.api_request(url, payload);
277
+ response = this.handle_response(response);
278
+
279
+ return {
280
+ response: response,
281
+ payload : payload
282
+ };
283
+ }
284
+
285
+
253
286
  /**
254
287
  *
255
288
  * @version v.0.1 (26/05/2024)
@@ -7,14 +7,14 @@ import { clone_object, echo, in_array, is_array } from "../../utils/utils";
7
7
  */
8
8
  export class familyGeneralElement
9
9
  {
10
- primary_key = false;
11
- create_scheme = false;
12
- structure_scheme = false;
13
- available_enum_values = false;
14
- api_key = false;
10
+ primary_key = false;
11
+ create_scheme = false;
12
+ structure_scheme = false;
13
+ available_enum_values = false;
14
+ api_key = false;
15
15
  attribute_name_translate_matrix = {
16
- en:{},
17
- ru:{}
16
+ en: {},
17
+ ru: {}
18
18
  }
19
19
 
20
20
  enum_value_translate_matrix = false;
@@ -52,7 +52,7 @@ export class familyGeneralElement
52
52
  {
53
53
  if (this.get_primary_key())
54
54
  {
55
- return this[this.get_primary_key()];
55
+ return this[ this.get_primary_key() ];
56
56
  }
57
57
  else
58
58
  {
@@ -227,9 +227,9 @@ export class familyGeneralElement
227
227
  lang = 'en';
228
228
  }
229
229
 
230
- if (this.attribute_name_translate_matrix?.[lang]?.[attribute_name])
230
+ if (this.attribute_name_translate_matrix?.[ lang ]?.[ attribute_name ])
231
231
  {
232
- response = this.attribute_name_translate_matrix?.[lang]?.[attribute_name];
232
+ response = this.attribute_name_translate_matrix?.[ lang ]?.[ attribute_name ];
233
233
  }
234
234
 
235
235
  return response;
@@ -250,9 +250,9 @@ export class familyGeneralElement
250
250
  lang = 'en';
251
251
  }
252
252
 
253
- if (this.enum_value_translate_matrix?.[attribute]?.[lang]?.[value])
253
+ if (this.enum_value_translate_matrix?.[ attribute ]?.[ lang ]?.[ value ])
254
254
  {
255
- response = this.enum_value_translate_matrix?.[attribute]?.[lang]?.[value];
255
+ response = this.enum_value_translate_matrix?.[ attribute ]?.[ lang ]?.[ value ];
256
256
  }
257
257
 
258
258
  return response;
@@ -319,7 +319,7 @@ export class familyGeneralElement
319
319
  /**
320
320
  * {Api} ApiService
321
321
  */
322
- return ApiService[this.api_key].create(payload).then((response) =>
322
+ return ApiService[ this.api_key ].create(payload).then((response) =>
323
323
  {
324
324
  if (typeof callback?.success === 'function')
325
325
  {
@@ -342,8 +342,8 @@ export class familyGeneralElement
342
342
  }
343
343
 
344
344
 
345
-
346
345
  /**
346
+ * Обновление целой модели элемента
347
347
  *
348
348
  * @version v.2.0 (12/06/2025)
349
349
  */
@@ -365,7 +365,7 @@ export class familyGeneralElement
365
365
  /**
366
366
  * {Api} ApiService
367
367
  */
368
- return ApiService[this.api_key].update(payload).then((response) =>
368
+ return ApiService[ this.api_key ].update(payload).then((response) =>
369
369
  {
370
370
  if (typeof callback?.success === 'function')
371
371
  {
@@ -388,8 +388,8 @@ export class familyGeneralElement
388
388
  }
389
389
 
390
390
 
391
-
392
391
  /**
392
+ * Обновление 1 атрибута у 1 элемента
393
393
  *
394
394
  * @version v.2.0 (12/06/2025)
395
395
  * @param key
@@ -404,11 +404,11 @@ export class familyGeneralElement
404
404
  throw new Error('Error #345-2215 - element has no api_key');
405
405
  }
406
406
 
407
- let payload = {
408
- key : key,
409
- value : value,
407
+ let payload = {
408
+ key : key,
409
+ value: value,
410
410
  };
411
- payload[this.get_primary_key()] = this[this.get_primary_key()];
411
+ payload[ this.get_primary_key() ] = this[ this.get_primary_key() ];
412
412
 
413
413
  if (typeof callback?.before === 'function')
414
414
  {
@@ -418,7 +418,7 @@ export class familyGeneralElement
418
418
  /**
419
419
  * {Api} ApiService
420
420
  */
421
- return ApiService[this.api_key].update_property(payload).then((response) =>
421
+ return ApiService[ this.api_key ].update_property(payload).then((response) =>
422
422
  {
423
423
  if (typeof callback?.success === 'function')
424
424
  {
@@ -442,15 +442,74 @@ export class familyGeneralElement
442
442
 
443
443
 
444
444
  /**
445
+ * Массив свойств у 1 элемента
445
446
  *
446
447
  * @version v.0.1 (26/05/2024)
448
+ * @param {number} element_id
449
+ * @param {array} payload array<key->value>
450
+ * @returns {Promise<void>}
447
451
  */
448
- async update_properties()
452
+ async update_properties(element_id, payload, callback)
449
453
  {
450
454
  alert('Error #272-001 Not implemented method');
451
455
  }
452
456
 
453
457
 
458
+ /**
459
+ * 1 свойство и массива элементов
460
+ *
461
+ * @version v.0.1 (07/07/2026)
462
+ *
463
+ * @param {array<number>} element_ids
464
+ * @param {string} key
465
+ * @param {any} value в зависимости от типа
466
+ * @param {object|typeFunctionCallback} callback
467
+ *
468
+ * @returns {Promise<void>}
469
+ */
470
+ async update_property_mass(element_ids, key, value, callback)
471
+ {
472
+ if (!this.api_key)
473
+ {
474
+ throw new Error('Error #471-2598 - element has no api_key');
475
+ }
476
+
477
+ let payload = {
478
+ element_ids: element_ids,
479
+ key : key,
480
+ value : value,
481
+ };
482
+
483
+ if (typeof callback?.before === 'function')
484
+ {
485
+ callback?.before({ payload });
486
+ }
487
+
488
+ /**
489
+ * {Api} ApiService
490
+ */
491
+ return ApiService[ this.api_key ].update_property_mass(payload).then((response) =>
492
+ {
493
+ if (typeof callback?.success === 'function')
494
+ {
495
+ callback?.success({ response, payload })
496
+ }
497
+ }).catch((error) =>
498
+ {
499
+ echo({ error });
500
+ if (typeof callback?.error === 'function')
501
+ {
502
+ callback?.error({ error, payload })
503
+ }
504
+ }).finally((response) =>
505
+ {
506
+ if (typeof callback?.final === 'function')
507
+ {
508
+ callback?.final({ response, payload })
509
+ }
510
+ });
511
+ }
512
+
454
513
 
455
514
  /**
456
515
  *
@@ -475,14 +534,14 @@ export class familyGeneralElement
475
534
 
476
535
  let payload = {};
477
536
 
478
- payload[this.get_primary_key()] = element[this.get_primary_key()];
537
+ payload[ this.get_primary_key() ] = element[ this.get_primary_key() ];
479
538
 
480
539
  if (typeof callback?.before === 'function')
481
540
  {
482
541
  callback?.before({ payload });
483
542
  }
484
543
 
485
- return ApiService[this.api_key].delete(payload).then((response) =>
544
+ return ApiService[ this.api_key ].delete(payload).then((response) =>
486
545
  {
487
546
  if (typeof callback?.success === 'function')
488
547
  {
@@ -505,7 +564,6 @@ export class familyGeneralElement
505
564
  }
506
565
 
507
566
 
508
-
509
567
  /**
510
568
  *
511
569
  * @version v.1.0 (07/03/2026)
@@ -534,13 +592,13 @@ export class familyGeneralElement
534
592
 
535
593
  let payload = {};
536
594
 
537
- payload[this.get_primary_key()] = element[this.get_primary_key()];
595
+ payload[ this.get_primary_key() ] = element[ this.get_primary_key() ];
538
596
 
539
597
 
540
598
  /**
541
599
  * {Api} ApiService
542
600
  */
543
- return ApiService[this.api_key].clone_element(payload).then((response) =>
601
+ return ApiService[ this.api_key ].clone_element(payload).then((response) =>
544
602
  {
545
603
  if (typeof callback?.success === 'function')
546
604
  {