rerobe-js-orm 2.4.72 → 2.4.73
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.
|
@@ -3,7 +3,13 @@ import Product from '../../models/Product';
|
|
|
3
3
|
export default class ProductFormState extends FormState {
|
|
4
4
|
fields: ProductFormFields;
|
|
5
5
|
props: CompleteProduct;
|
|
6
|
-
|
|
6
|
+
opts: {
|
|
7
|
+
featuredCollectionOpts: {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
constructor(props?: any, opts?: any);
|
|
7
13
|
autoCreateTitle(): string;
|
|
8
14
|
autoCreateDescription(): string;
|
|
9
15
|
createProduct(): Product;
|
|
@@ -5,9 +5,10 @@ const options_1 = require("./options");
|
|
|
5
5
|
const Product_1 = require("../../models/Product");
|
|
6
6
|
const ProductFromFormState_1 = require("../../factories/Product/ProductFromFormState");
|
|
7
7
|
class ProductFormState extends FormState_1.default {
|
|
8
|
-
constructor(props) {
|
|
8
|
+
constructor(props, opts) {
|
|
9
9
|
super();
|
|
10
10
|
this.props = new Product_1.default(props).toObj();
|
|
11
|
+
this.opts = opts;
|
|
11
12
|
// ProductAttributesFormFields
|
|
12
13
|
this.fields.availableForSale = this.fieldFactory('singleSelect', 'availableForSale', options_1.availableForSaleOptions);
|
|
13
14
|
this.fields.description = this.fieldFactory('textInput', 'description');
|
|
@@ -519,6 +520,13 @@ class ProductFormState extends FormState_1.default {
|
|
|
519
520
|
}
|
|
520
521
|
hidden = Boolean(this.props.tags && Array.isArray(this.props.tags) && this.props.tags.length < 1);
|
|
521
522
|
}
|
|
523
|
+
if (fieldKey === 'featuredCollections') {
|
|
524
|
+
if (this.opts && this.opts.featuredCollectionOpts && this.opts.featuredCollectionOpts.length > 0) {
|
|
525
|
+
options = this.utilities
|
|
526
|
+
.uniqObjArray([...options, ...this.opts.featuredCollectionOpts.map((o) => ({ label: o.label, value: o.value }))], 'value')
|
|
527
|
+
.filter((o) => { var _a; return !((_a = this.props.featuredCollections) === null || _a === void 0 ? void 0 : _a.includes(o.value)); });
|
|
528
|
+
}
|
|
529
|
+
}
|
|
522
530
|
if (fieldKey === 'clothingSize') {
|
|
523
531
|
if (this.props.gender === 'Woman') {
|
|
524
532
|
options = [
|