rerobe-js-orm 2.9.4 → 2.9.5

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.
@@ -17,7 +17,13 @@ export default class ProductFormState extends FormState {
17
17
  clothingSizes: string[];
18
18
  jeanSizes: string[];
19
19
  shoeSizes: string[];
20
- conditions: string[];
20
+ conditions: {
21
+ label: string;
22
+ value: string;
23
+ description: string;
24
+ }[];
25
+ majorDefects: string[];
26
+ minorDefects: string[];
21
27
  };
22
28
  constructor(props?: any, opts?: any);
23
29
  autoCreateTitle(): string;
@@ -413,7 +413,7 @@ class ProductFormState extends FormState_1.default {
413
413
  }
414
414
  }
415
415
  fieldFactory(fieldType, fieldKey, fieldOptions) {
416
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
416
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
417
417
  let options = fieldOptions || [];
418
418
  let hidden = false;
419
419
  if (fieldType === 'singleSelect') {
@@ -533,7 +533,11 @@ class ProductFormState extends FormState_1.default {
533
533
  }
534
534
  if (fieldKey === 'condition') {
535
535
  if ((_k = (_j = this.opts) === null || _j === void 0 ? void 0 : _j.conditions) === null || _k === void 0 ? void 0 : _k.length) {
536
- const conditionsOptions = this.opts.conditions.map((t) => ({ label: t, value: t }));
536
+ const conditionsOptions = this.opts.conditions.map((t) => ({
537
+ label: t.label || '',
538
+ value: t.value || '',
539
+ description: t.description || '',
540
+ }));
537
541
  options = this.utilities.uniqObjArray(conditionsOptions, 'value');
538
542
  }
539
543
  onChangeHandler = (val) => this.conditionSelectHandler(val);
@@ -589,6 +593,28 @@ class ProductFormState extends FormState_1.default {
589
593
  }
590
594
  hidden = this.props.productCategory !== 'Clothing' || this.props.productType === 'Jeans';
591
595
  }
596
+ if (fieldKey === 'majorDefects') {
597
+ let selectedMajorDefectsOptions = [];
598
+ if (this.props.majorDefects && Array.isArray(this.props.majorDefects) && this.props.majorDefects.length > 0) {
599
+ selectedMajorDefectsOptions = this.props.majorDefects.map((t) => ({ label: t, value: t }));
600
+ }
601
+ let majorDefectsOptions = [];
602
+ if ((_p = (_o = this.opts) === null || _o === void 0 ? void 0 : _o.majorDefects) === null || _p === void 0 ? void 0 : _p.length) {
603
+ majorDefectsOptions = this.opts.majorDefects.map((t) => ({ label: t, value: t }));
604
+ }
605
+ options = this.utilities.uniqObjArray([...selectedMajorDefectsOptions, ...majorDefectsOptions], 'value');
606
+ }
607
+ if (fieldKey === 'minorDefects') {
608
+ let selectedMinorDefectsOptions = [];
609
+ if (this.props.minorDefects && Array.isArray(this.props.minorDefects) && this.props.minorDefects.length > 0) {
610
+ selectedMinorDefectsOptions = this.props.minorDefects.map((t) => ({ label: t, value: t }));
611
+ }
612
+ let minorDefectsOptions = [];
613
+ if ((_r = (_q = this.opts) === null || _q === void 0 ? void 0 : _q.minorDefects) === null || _r === void 0 ? void 0 : _r.length) {
614
+ minorDefectsOptions = this.opts.minorDefects.map((t) => ({ label: t, value: t }));
615
+ }
616
+ options = this.utilities.uniqObjArray([...selectedMinorDefectsOptions, ...minorDefectsOptions], 'value');
617
+ }
592
618
  if (fieldKey === 'inventoryLocations') {
593
619
  onChangeHandler = (val) => this.inventoryLocationsChangeHandler(val);
594
620
  }
@@ -26,9 +26,7 @@ interface FormFieldOption {
26
26
  label: string;
27
27
  value: string | boolean;
28
28
  description?: string;
29
- color?: string;
30
29
  key?: string;
31
- [key: string]: any;
32
30
  }
33
31
  interface FileObj {
34
32
  uri: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.9.4",
3
+ "version": "2.9.5",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",