@nascentdigital/funnel-core 7.0.2 → 8.0.0
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/dist/app/RegionsConfig.d.ts +5 -1
- package/dist/app/RegionsConfig.js +1 -1
- package/dist/regionalization/Regionalization.js +7 -1
- package/dist/schema/field/Config.d.ts +5 -0
- package/dist/schema/field/Config.js +6 -0
- package/dist/schema/field/Field.d.ts +11 -5
- package/dist/schema/field/Field.js +20 -9
- package/dist/schema/field/FieldTag.d.ts +4 -0
- package/dist/schema/field/FieldTag.js +2 -0
- package/dist/schema/field/base/AssetField.d.ts +11 -11
- package/dist/schema/field/base/AssetField.js +4 -4
- package/dist/schema/field/base/BooleanField.js +1 -1
- package/dist/schema/field/base/CollectionField.d.ts +2 -2
- package/dist/schema/field/base/CollectionField.js +2 -2
- package/dist/schema/field/base/DateField.js +1 -1
- package/dist/schema/field/base/DynamicPagesField.js +1 -1
- package/dist/schema/field/base/EmbeddedVideoField.js +1 -1
- package/dist/schema/field/base/EnumField.d.ts +3 -3
- package/dist/schema/field/base/EnumField.js +5 -1
- package/dist/schema/field/base/FormField.js +1 -1
- package/dist/schema/field/base/LinkField.js +1 -1
- package/dist/schema/field/base/PageField.d.ts +2 -2
- package/dist/schema/field/base/PageField.js +2 -2
- package/dist/schema/field/base/RichTextField.js +1 -1
- package/dist/schema/field/base/TextField.js +1 -1
- package/dist/schema/field/base/TimestampField.js +1 -1
- package/dist/schema/field/composite/ListField.js +1 -1
- package/dist/schema/field/composite/ObjectField.js +1 -1
- package/dist/schema/field/config/BooleanConfig.d.ts +1 -1
- package/dist/schema/field/config/BooleanConfig.js +20 -5
- package/dist/schema/field/config/EnumConfig.d.ts +2 -2
- package/dist/schema/field/config/EnumConfig.js +9 -5
- package/dist/schema/field/config/TextConfig.d.ts +1 -1
- package/dist/schema/field/config/TextConfig.js +20 -5
- package/dist/schema/field/index.d.ts +1 -0
- package/dist/schema/field/index.js +1 -0
- package/dist/utils/ArrayUtils.d.ts +3 -1
- package/dist/utils/ArrayUtils.js +18 -5
- package/package.json +2 -2
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Language, Locale } from '../regionalization';
|
|
2
|
+
import { Transform } from '../types';
|
|
2
3
|
export type RegionsConfig<TRegion extends string = string> = {
|
|
3
4
|
regions: Record<TRegion, RegionsConfig.RegionConfig>;
|
|
4
5
|
fallback: TRegion;
|
|
5
6
|
urlTruncation: RegionsConfig.UrlTruncation;
|
|
6
7
|
mergedRoutes?: boolean;
|
|
8
|
+
customRoutes?: boolean;
|
|
7
9
|
liveRoutesOnly?: boolean;
|
|
10
|
+
paramsToLocale: Transform.Async<Record<string, string>, Locale>;
|
|
11
|
+
localeToString: Transform<Locale, string>;
|
|
8
12
|
};
|
|
9
13
|
export declare namespace RegionsConfig {
|
|
10
14
|
type RegionConfig = {
|
|
@@ -37,7 +41,7 @@ export declare namespace RegionsConfig {
|
|
|
37
41
|
* is set through cookies, we use hat. Otherwise, if set we use the default language for that region. Otherwise,
|
|
38
42
|
* we use the first language available.
|
|
39
43
|
*/
|
|
40
|
-
function getDefaultLanguageForRegion(config: RegionConfig, inferredLocale
|
|
44
|
+
function getDefaultLanguageForRegion(config: RegionConfig, inferredLocale?: Partial<Locale>): Language;
|
|
41
45
|
/**
|
|
42
46
|
* Given the config for all regions, return the default language for the default region.
|
|
43
47
|
*/
|
|
@@ -102,7 +102,7 @@ var RegionsConfig;
|
|
|
102
102
|
* is set through cookies, we use hat. Otherwise, if set we use the default language for that region. Otherwise,
|
|
103
103
|
* we use the first language available.
|
|
104
104
|
*/
|
|
105
|
-
function getDefaultLanguageForRegion(config, inferredLocale) {
|
|
105
|
+
function getDefaultLanguageForRegion(config, inferredLocale = {}) {
|
|
106
106
|
var _a, _b;
|
|
107
107
|
return (_b = (_a = inferredLocale.language) !== null && _a !== void 0 ? _a : config.defaultLanguage) !== null && _b !== void 0 ? _b : config.languages[0];
|
|
108
108
|
}
|
|
@@ -126,6 +126,7 @@ var Regionalization;
|
|
|
126
126
|
}
|
|
127
127
|
Regionalization.targetUrlFor = targetUrlFor;
|
|
128
128
|
function getTargetPath({ sourceLocale, pagePath, regionalization }) {
|
|
129
|
+
var _a, _b;
|
|
129
130
|
// get target locale based on url truncation
|
|
130
131
|
const targetLocale = {};
|
|
131
132
|
switch (regionalization.urlTruncation) {
|
|
@@ -187,7 +188,12 @@ var Regionalization;
|
|
|
187
188
|
}
|
|
188
189
|
// if merged routes and both region and language exist append with '-'
|
|
189
190
|
let targetPath;
|
|
190
|
-
if (regionalization.
|
|
191
|
+
if (regionalization.customRoutes) {
|
|
192
|
+
const region = (_a = targetLocale.region) !== null && _a !== void 0 ? _a : app_1.RegionsConfig.getDefaultRegion(regionalization);
|
|
193
|
+
const language = (_b = targetLocale.language) !== null && _b !== void 0 ? _b : app_1.RegionsConfig.getDefaultLanguageForRegion(regionalization.regions[region]);
|
|
194
|
+
targetPath = regionalization.localeToString({ region, language });
|
|
195
|
+
}
|
|
196
|
+
else if (regionalization.mergedRoutes && targetLocale.region && targetLocale.language) {
|
|
191
197
|
targetPath = `/${targetLocale.region}-${targetLocale.language}`;
|
|
192
198
|
}
|
|
193
199
|
// or build segments based on region/language existing in target
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { BooleanField, EnumField, TextField } from './base';
|
|
2
2
|
import { BooleanConfig, EnumConfig, TextConfig } from './config/index';
|
|
3
3
|
import type { Field } from './Field';
|
|
4
|
+
import { FieldTag } from './FieldTag';
|
|
4
5
|
export declare namespace Config {
|
|
5
6
|
type Type = BooleanConfig | EnumConfig | TextConfig;
|
|
6
7
|
function isConfig(field: Field | Type): field is Config.Type;
|
|
8
|
+
namespace Tag {
|
|
9
|
+
const config: FieldTag;
|
|
10
|
+
const layout: FieldTag;
|
|
11
|
+
}
|
|
7
12
|
const text: (args: TextConfig.ConstructorArgs) => TextField;
|
|
8
13
|
const enumeration: <T extends EnumField.Options>(args: EnumConfig.ConstructorArgs<T>) => EnumField<T>;
|
|
9
14
|
const boolean: (args: BooleanConfig.ConstructorArgs) => BooleanField;
|
|
@@ -12,6 +12,12 @@ var Config;
|
|
|
12
12
|
|| field instanceof index_1.TextConfig;
|
|
13
13
|
}
|
|
14
14
|
Config.isConfig = isConfig;
|
|
15
|
+
// constants
|
|
16
|
+
let Tag;
|
|
17
|
+
(function (Tag) {
|
|
18
|
+
Tag.config = 'type.config';
|
|
19
|
+
Tag.layout = 'group.layout';
|
|
20
|
+
})(Tag = Config.Tag || (Config.Tag = {}));
|
|
15
21
|
// factories
|
|
16
22
|
Config.text = (args) => new index_1.TextConfig(args);
|
|
17
23
|
Config.enumeration = (args) => new index_1.EnumConfig(args);
|
|
@@ -3,17 +3,22 @@ import { Collection as CollectionType } from '../Collection';
|
|
|
3
3
|
import { Optional } from '../Optional';
|
|
4
4
|
import type { Page as PageType } from '../Page';
|
|
5
5
|
import { AssetField, BooleanConfig, BooleanField, CollectionField, DateField, DynamicPagesField, EmbeddedVideoField, EnumConfig, EnumField, FormField, LinkField, ListField, ObjectField, PageField, RichTextField, TextConfig, TextField, TimestampField } from './';
|
|
6
|
+
import { FieldTag } from './FieldTag';
|
|
6
7
|
export declare abstract class Field<TChild extends Field.Type = Field.Type> {
|
|
7
8
|
readonly name: string;
|
|
8
9
|
readonly hint?: string;
|
|
9
10
|
readonly description?: string;
|
|
10
11
|
readonly required: boolean;
|
|
12
|
+
readonly tags: ReadonlySet<FieldTag>;
|
|
11
13
|
protected constructor(args: Field.ConstructorArgs);
|
|
12
14
|
optional(): Optional<TChild>;
|
|
13
15
|
unwrap(): this;
|
|
14
16
|
abstract modify(args: Field.ModifyArgs): TChild;
|
|
15
17
|
rename(name: string): TChild;
|
|
16
18
|
require(): TChild;
|
|
19
|
+
hasTag(tag: FieldTag): boolean;
|
|
20
|
+
addTags(...tags: ReadonlyArray<FieldTag>): TChild;
|
|
21
|
+
removeTags(...tags: ReadonlyArray<FieldTag>): TChild;
|
|
17
22
|
}
|
|
18
23
|
export declare namespace Field {
|
|
19
24
|
type ConstructorArgs = {
|
|
@@ -21,6 +26,7 @@ export declare namespace Field {
|
|
|
21
26
|
hint?: string;
|
|
22
27
|
description?: string;
|
|
23
28
|
required?: boolean;
|
|
29
|
+
tags?: FieldTag | ReadonlyArray<FieldTag> | ReadonlySet<FieldTag>;
|
|
24
30
|
};
|
|
25
31
|
type ModifyArgs = Partial<ConstructorArgs>;
|
|
26
32
|
type Type = Type.Simple | Type.Composite;
|
|
@@ -165,11 +171,11 @@ export declare namespace Field {
|
|
|
165
171
|
const form: (args: FormField.ConstructorArgs) => FormField;
|
|
166
172
|
const embeddedVideo: (args: EmbeddedVideoField.ConstructorArgs) => EmbeddedVideoField;
|
|
167
173
|
const media: <T extends AssetField.LinkedValue>(args: AssetField.ConstructorArgs<T>) => AssetField<T>;
|
|
168
|
-
const visual: ({ mimeTypes,
|
|
169
|
-
const image: ({ mimeTypes,
|
|
170
|
-
const svg: ({
|
|
171
|
-
const logo: (args: Omit<AssetField.ConstructorArgs.ForImage, "mimeTypes" | "
|
|
172
|
-
const video: ({ mimeTypes,
|
|
174
|
+
const visual: ({ mimeTypes, assetTags, ...args }: AssetField.ConstructorArgs.ForVisual) => AssetField<AssetField.LinkedValue.Visual>;
|
|
175
|
+
const image: ({ mimeTypes, assetTags, ...args }: AssetField.ConstructorArgs.ForImage) => AssetField<AssetField.LinkedValue.Image>;
|
|
176
|
+
const svg: ({ assetTags, ...args }: Omit<AssetField.ConstructorArgs.ForImage, "mimeTypes">) => AssetField<AssetField.LinkedValue.Image>;
|
|
177
|
+
const logo: (args: Omit<AssetField.ConstructorArgs.ForImage, "mimeTypes" | "assetTags">) => AssetField<AssetField.LinkedValue.Image>;
|
|
178
|
+
const video: ({ mimeTypes, assetTags, ...args }: AssetField.ConstructorArgs.ForVideo) => AssetField<AssetField.LinkedValue.Video>;
|
|
173
179
|
const collection: <T extends CollectionType>(args: CollectionField.ConstructorArgs<T>) => CollectionField<T>;
|
|
174
180
|
const page: (args: Omit<PageField.ConstructorArgs, "scope">) => PageField<"full">;
|
|
175
181
|
const pagePreview: (args: Omit<PageField.ConstructorArgs, "scope">) => PageField<"preview">;
|
|
@@ -15,6 +15,7 @@ exports.Field = void 0;
|
|
|
15
15
|
const errors_1 = require("../../errors");
|
|
16
16
|
const MimeType_1 = require("../../ui/MimeType");
|
|
17
17
|
const LexicalUtils_1 = require("../../ui/richtext/LexicalUtils");
|
|
18
|
+
const utils_1 = require("../../utils");
|
|
18
19
|
const Optional_1 = require("../Optional");
|
|
19
20
|
const _1 = require("./");
|
|
20
21
|
// class
|
|
@@ -26,6 +27,7 @@ class Field {
|
|
|
26
27
|
this.hint = args.hint;
|
|
27
28
|
this.description = args.description;
|
|
28
29
|
this.required = (_a = args.required) !== null && _a !== void 0 ? _a : true;
|
|
30
|
+
this.tags = new Set(utils_1.ArrayUtils.coerce(args.tags));
|
|
29
31
|
}
|
|
30
32
|
optional() {
|
|
31
33
|
return new Optional_1.Optional(this);
|
|
@@ -39,6 +41,15 @@ class Field {
|
|
|
39
41
|
require() {
|
|
40
42
|
return this.modify({ required: true });
|
|
41
43
|
}
|
|
44
|
+
hasTag(tag) {
|
|
45
|
+
return this.tags.has(tag);
|
|
46
|
+
}
|
|
47
|
+
addTags(...tags) {
|
|
48
|
+
return this.modify({ tags: new Set([...this.tags.values().toArray(), ...tags]) });
|
|
49
|
+
}
|
|
50
|
+
removeTags(...tags) {
|
|
51
|
+
return this.modify({ tags: this.tags.values().toArray().filter(tag => !tags.includes(tag)) });
|
|
52
|
+
}
|
|
42
53
|
}
|
|
43
54
|
exports.Field = Field;
|
|
44
55
|
// extension
|
|
@@ -284,21 +295,21 @@ exports.Field = Field;
|
|
|
284
295
|
Field.embeddedVideo = (args) => new _1.EmbeddedVideoField(Object.assign({}, args));
|
|
285
296
|
Field.media = (args) => new _1.AssetField(args);
|
|
286
297
|
Field.visual = (_a) => {
|
|
287
|
-
var { mimeTypes = [...MimeType_1.MimeType.image, ...MimeType_1.MimeType.video],
|
|
288
|
-
return new _1.AssetField(Object.assign(Object.assign({}, args), { mimeTypes,
|
|
298
|
+
var { mimeTypes = [...MimeType_1.MimeType.image, ...MimeType_1.MimeType.video], assetTags } = _a, args = __rest(_a, ["mimeTypes", "assetTags"]);
|
|
299
|
+
return new _1.AssetField(Object.assign(Object.assign({}, args), { mimeTypes, assetTags: _1.AssetField.Tags.parse(assetTags) }));
|
|
289
300
|
};
|
|
290
301
|
Field.image = (_a) => {
|
|
291
|
-
var { mimeTypes = MimeType_1.MimeType.image,
|
|
292
|
-
return new _1.AssetField(Object.assign(Object.assign({}, args), { mimeTypes,
|
|
302
|
+
var { mimeTypes = MimeType_1.MimeType.image, assetTags } = _a, args = __rest(_a, ["mimeTypes", "assetTags"]);
|
|
303
|
+
return new _1.AssetField(Object.assign(Object.assign({}, args), { mimeTypes, assetTags: _1.AssetField.Tags.Image.parse(assetTags) }));
|
|
293
304
|
};
|
|
294
305
|
Field.svg = (_a) => {
|
|
295
|
-
var {
|
|
296
|
-
return new _1.AssetField(Object.assign(Object.assign({}, args), { mimeTypes: ['image/svg+xml'],
|
|
306
|
+
var { assetTags } = _a, args = __rest(_a, ["assetTags"]);
|
|
307
|
+
return new _1.AssetField(Object.assign(Object.assign({}, args), { mimeTypes: ['image/svg+xml'], assetTags: _1.AssetField.Tags.Image.parse(assetTags) }));
|
|
297
308
|
};
|
|
298
|
-
Field.logo = (args) => new _1.AssetField(Object.assign(Object.assign({}, args), { mimeTypes: ['image/webp', 'image/png', 'image/svg+xml'],
|
|
309
|
+
Field.logo = (args) => new _1.AssetField(Object.assign(Object.assign({}, args), { mimeTypes: ['image/webp', 'image/png', 'image/svg+xml'], assetTags: _1.AssetField.Tags.Image.parse(['logo', 'brand']) }));
|
|
299
310
|
Field.video = (_a) => {
|
|
300
|
-
var { mimeTypes = MimeType_1.MimeType.video,
|
|
301
|
-
return new _1.AssetField(Object.assign(Object.assign({}, args), { mimeTypes,
|
|
311
|
+
var { mimeTypes = MimeType_1.MimeType.video, assetTags } = _a, args = __rest(_a, ["mimeTypes", "assetTags"]);
|
|
312
|
+
return new _1.AssetField(Object.assign(Object.assign({}, args), { mimeTypes, assetTags: _1.AssetField.Tags.Video.parse(assetTags) }));
|
|
302
313
|
};
|
|
303
314
|
Field.collection = (args) => new _1.CollectionField(args);
|
|
304
315
|
Field.page = (args) => new _1.PageField(Object.assign(Object.assign({}, args), { scope: 'full' }));
|
|
@@ -13,9 +13,9 @@ export declare class AssetField<TValue extends AssetField.LinkedValue = AssetFie
|
|
|
13
13
|
readonly maxSize?: number;
|
|
14
14
|
readonly visualOptions?: AssetField.ConstructorArgs.VisualOptions;
|
|
15
15
|
readonly scope: AssetScope.Range;
|
|
16
|
-
readonly
|
|
17
|
-
constructor({ mimeTypes, minSize, maxSize, visualOptions, scope,
|
|
18
|
-
modify({
|
|
16
|
+
readonly assetTags: ReadonlyArray<Tag>;
|
|
17
|
+
constructor({ mimeTypes, minSize, maxSize, visualOptions, scope, assetTags, ...args }: AssetField.ConstructorArgs<TValue>);
|
|
18
|
+
modify({ assetTags, ...args }: AssetField.ModifyArgs<TValue>): AssetField<TValue>;
|
|
19
19
|
}
|
|
20
20
|
export declare namespace AssetField {
|
|
21
21
|
type Tags = Tags.Image | Tags.Video;
|
|
@@ -116,7 +116,7 @@ export declare namespace AssetField {
|
|
|
116
116
|
maxSize?: number;
|
|
117
117
|
visualOptions?: ConstructorArgs.VisualOptions;
|
|
118
118
|
scope?: AssetScope.Range;
|
|
119
|
-
|
|
119
|
+
assetTags?: ReadonlyArray<Tag>;
|
|
120
120
|
};
|
|
121
121
|
namespace ConstructorArgs {
|
|
122
122
|
type VisualOptions = {
|
|
@@ -126,23 +126,23 @@ export declare namespace AssetField {
|
|
|
126
126
|
maxHeight?: number;
|
|
127
127
|
aspectRatio?: AspectRatio;
|
|
128
128
|
};
|
|
129
|
-
type ForVisual = Omit<ConstructorArgs, 'mimeTypes' | '
|
|
129
|
+
type ForVisual = Omit<ConstructorArgs, 'mimeTypes' | 'assetTags'> & {
|
|
130
130
|
mimeTypes?: ReadonlyArray<MimeType.Image | MimeType.Video>;
|
|
131
131
|
visualOptions?: VisualOptions;
|
|
132
|
-
|
|
132
|
+
assetTags?: Tags | ReadonlyArray<Tags>;
|
|
133
133
|
};
|
|
134
|
-
type ForImage = Omit<ConstructorArgs, 'mimeTypes' | '
|
|
134
|
+
type ForImage = Omit<ConstructorArgs, 'mimeTypes' | 'assetTags'> & {
|
|
135
135
|
mimeTypes?: ReadonlyArray<MimeType.Image>;
|
|
136
136
|
visualOptions?: VisualOptions;
|
|
137
|
-
|
|
137
|
+
assetTags?: Tags.Image | ReadonlyArray<Tags.Image>;
|
|
138
138
|
};
|
|
139
|
-
type ForVideo = Omit<ConstructorArgs, 'mimeTypes' | '
|
|
139
|
+
type ForVideo = Omit<ConstructorArgs, 'mimeTypes' | 'assetTags'> & {
|
|
140
140
|
mimeTypes?: ReadonlyArray<MimeType.Video>;
|
|
141
141
|
visualOptions?: VisualOptions;
|
|
142
|
-
|
|
142
|
+
assetTags?: Tags.Video | ReadonlyArray<Tags.Video>;
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
type ModifyArgs<TValue extends AssetField.LinkedValue> = Omit<Partial<ConstructorArgs<TValue>>, 'tags' | 'required'> & {
|
|
146
|
-
|
|
146
|
+
assetTags?: Tags | ReadonlyArray<Tags>;
|
|
147
147
|
};
|
|
148
148
|
}
|
|
@@ -20,7 +20,7 @@ const index_1 = require("../index");
|
|
|
20
20
|
// class
|
|
21
21
|
class AssetField extends index_1.Field {
|
|
22
22
|
constructor(_a) {
|
|
23
|
-
var { mimeTypes, minSize, maxSize, visualOptions, scope = 'instance',
|
|
23
|
+
var { mimeTypes, minSize, maxSize, visualOptions, scope = 'instance', assetTags = [] } = _a, args = __rest(_a, ["mimeTypes", "minSize", "maxSize", "visualOptions", "scope", "assetTags"]);
|
|
24
24
|
// construct base
|
|
25
25
|
super(args);
|
|
26
26
|
this.type = 'asset';
|
|
@@ -35,11 +35,11 @@ class AssetField extends index_1.Field {
|
|
|
35
35
|
this.maxSize = maxSize;
|
|
36
36
|
this.visualOptions = visualOptions;
|
|
37
37
|
this.scope = scope;
|
|
38
|
-
this.
|
|
38
|
+
this.assetTags = assetTags;
|
|
39
39
|
}
|
|
40
40
|
modify(_a) {
|
|
41
|
-
var {
|
|
42
|
-
return new AssetField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, mimeTypes: this.mimeTypes, minSize: this.minSize, maxSize: this.maxSize, visualOptions: this.visualOptions, scope: this.scope,
|
|
41
|
+
var { assetTags } = _a, args = __rest(_a, ["assetTags"]);
|
|
42
|
+
return new AssetField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, mimeTypes: this.mimeTypes, minSize: this.minSize, maxSize: this.maxSize, visualOptions: this.visualOptions, scope: this.scope, assetTags: assetTags ? AssetField.Tags.parse(assetTags) : this.assetTags }, args));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
exports.AssetField = AssetField;
|
|
@@ -14,7 +14,7 @@ class BooleanField extends index_1.Field {
|
|
|
14
14
|
this.defaultValue = (_b = args.defaultValue) !== null && _b !== void 0 ? _b : false;
|
|
15
15
|
}
|
|
16
16
|
modify(args) {
|
|
17
|
-
return new BooleanField(Object.assign({ semantics: this.semantics, name: this.name, hint: this.hint, description: this.description, required: this.required, defaultValue: this.defaultValue }, args));
|
|
17
|
+
return new BooleanField(Object.assign({ semantics: this.semantics, name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, defaultValue: this.defaultValue }, args));
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
exports.BooleanField = BooleanField;
|
|
@@ -4,7 +4,7 @@ import { Field } from '../index';
|
|
|
4
4
|
export declare class CollectionField<TCollection extends Collection = Collection> extends Field<CollectionField<TCollection>> {
|
|
5
5
|
readonly type: "collection";
|
|
6
6
|
readonly collections: ReadonlyArray<TCollection>;
|
|
7
|
-
readonly
|
|
7
|
+
readonly collectionTags: ReadonlyArray<Tag>;
|
|
8
8
|
constructor(args: CollectionField.ConstructorArgs<TCollection>);
|
|
9
9
|
modify(args: CollectionField.ModifyArgs<TCollection>): CollectionField<TCollection>;
|
|
10
10
|
}
|
|
@@ -28,7 +28,7 @@ export declare namespace CollectionField {
|
|
|
28
28
|
type LinkedValue<TCollection extends Collection = Collection> = Collection.LinkedData<TCollection>;
|
|
29
29
|
type ConstructorArgs<TCollection extends Collection> = Field.ConstructorArgs & {
|
|
30
30
|
collections: TCollection | ReadonlyArray<TCollection>;
|
|
31
|
-
|
|
31
|
+
collectionTags?: ReadonlyArray<Tag>;
|
|
32
32
|
};
|
|
33
33
|
type ModifyArgs<TCollection extends Collection> = Omit<Partial<ConstructorArgs<TCollection>>, 'required'>;
|
|
34
34
|
}
|
|
@@ -13,10 +13,10 @@ class CollectionField extends index_1.Field {
|
|
|
13
13
|
this.collections = Array.isArray(args.collections)
|
|
14
14
|
? args.collections
|
|
15
15
|
: [args.collections];
|
|
16
|
-
this.
|
|
16
|
+
this.collectionTags = (_a = args.collectionTags) !== null && _a !== void 0 ? _a : [];
|
|
17
17
|
}
|
|
18
18
|
modify(args) {
|
|
19
|
-
return new CollectionField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, collections: this.collections,
|
|
19
|
+
return new CollectionField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, collections: this.collections, collectionTags: this.collectionTags }, args));
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.CollectionField = CollectionField;
|
|
@@ -13,7 +13,7 @@ class DateField extends index_1.Field {
|
|
|
13
13
|
this.maxDate = args.maxDate;
|
|
14
14
|
}
|
|
15
15
|
modify(args) {
|
|
16
|
-
return new DateField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, minDate: this.minDate, maxDate: this.maxDate }, args));
|
|
16
|
+
return new DateField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, minDate: this.minDate, maxDate: this.maxDate }, args));
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.DateField = DateField;
|
|
@@ -30,7 +30,7 @@ class DynamicPagesField extends index_1.Field {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
modify(args) {
|
|
33
|
-
return new DynamicPagesField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, types: this.types, size: this.size }, args));
|
|
33
|
+
return new DynamicPagesField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, types: this.types, size: this.size }, args));
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
exports.DynamicPagesField = DynamicPagesField;
|
|
@@ -10,7 +10,7 @@ class EmbeddedVideoField extends index_1.Field {
|
|
|
10
10
|
this.type = 'embedded.video';
|
|
11
11
|
}
|
|
12
12
|
modify(args) {
|
|
13
|
-
return new EmbeddedVideoField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required }, args));
|
|
13
|
+
return new EmbeddedVideoField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags }, args));
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.EmbeddedVideoField = EmbeddedVideoField;
|
|
@@ -4,7 +4,7 @@ export declare class EnumField<TOptions extends EnumField.Options = EnumField.Op
|
|
|
4
4
|
readonly type: "enum";
|
|
5
5
|
readonly semantics: EnumField.Semantics;
|
|
6
6
|
readonly options: TOptions;
|
|
7
|
-
readonly defaultOption
|
|
7
|
+
readonly defaultOption: StringKeyOf<TOptions>;
|
|
8
8
|
constructor(args: EnumField.ConstructorArgs<TOptions>);
|
|
9
9
|
get enum(): EnumField.Enum<TOptions>[];
|
|
10
10
|
modify({ options, ...args }: EnumField.ModifyArgs<TOptions>): EnumField<TOptions>;
|
|
@@ -13,7 +13,7 @@ export declare class EnumField<TOptions extends EnumField.Options = EnumField.Op
|
|
|
13
13
|
removeOptions<TKey extends StringKeyOf<TOptions>>(...keys: ReadonlyArray<TKey>): EnumField<TOptions>;
|
|
14
14
|
keepOptions<TKey extends StringKeyOf<TOptions>>(...keys: ReadonlyArray<TKey>): EnumField<TOptions>;
|
|
15
15
|
isValidOption<TKey extends StringKeyOf<TOptions>>(key: TKey | undefined): boolean;
|
|
16
|
-
setDefault<TKey extends StringKeyOf<TOptions>>(key: TKey
|
|
16
|
+
setDefault<TKey extends StringKeyOf<TOptions>>(key: TKey): EnumField<TOptions>;
|
|
17
17
|
protected new(args: EnumField.ConstructorArgs<TOptions>): EnumField<TOptions>;
|
|
18
18
|
}
|
|
19
19
|
export declare namespace EnumField {
|
|
@@ -25,7 +25,7 @@ export declare namespace EnumField {
|
|
|
25
25
|
type ConstructorArgs<TOptions extends Options> = Field.ConstructorArgs & {
|
|
26
26
|
semantics?: Semantics;
|
|
27
27
|
options: TOptions;
|
|
28
|
-
defaultOption
|
|
28
|
+
defaultOption: StringKeyOf<TOptions>;
|
|
29
29
|
};
|
|
30
30
|
type Enum<TOptions extends Options> = StringKeyOf<TOptions>;
|
|
31
31
|
type Options<TOption extends string = string> = Record<TOption, Readonly<Option>>;
|
|
@@ -31,7 +31,7 @@ class EnumField extends index_1.Field {
|
|
|
31
31
|
modify(_a) {
|
|
32
32
|
var _b;
|
|
33
33
|
var { options } = _a, args = __rest(_a, ["options"]);
|
|
34
|
-
return this.new(Object.assign({ semantics: this.semantics, name: this.name, hint: this.hint, description: this.description, required: this.required, options: (_b = options) !== null && _b !== void 0 ? _b : this.options, defaultOption: this.defaultOption }, args));
|
|
34
|
+
return this.new(Object.assign({ semantics: this.semantics, name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, options: (_b = options) !== null && _b !== void 0 ? _b : this.options, defaultOption: this.defaultOption }, args));
|
|
35
35
|
}
|
|
36
36
|
updateOptions(options) {
|
|
37
37
|
return this.new({
|
|
@@ -40,6 +40,7 @@ class EnumField extends index_1.Field {
|
|
|
40
40
|
hint: this.hint,
|
|
41
41
|
description: this.description,
|
|
42
42
|
required: this.required,
|
|
43
|
+
tags: this.tags,
|
|
43
44
|
options: Object.assign(Object.assign({}, this.options), options),
|
|
44
45
|
defaultOption: this.defaultOption
|
|
45
46
|
});
|
|
@@ -61,6 +62,7 @@ class EnumField extends index_1.Field {
|
|
|
61
62
|
hint: this.hint,
|
|
62
63
|
description: this.description,
|
|
63
64
|
required: this.required,
|
|
65
|
+
tags: this.tags,
|
|
64
66
|
options: prunedOptions,
|
|
65
67
|
defaultOption: defaultOption === undefined || defaultOption in prunedOptions
|
|
66
68
|
? defaultOption
|
|
@@ -86,6 +88,7 @@ class EnumField extends index_1.Field {
|
|
|
86
88
|
hint: this.hint,
|
|
87
89
|
description: this.description,
|
|
88
90
|
required: this.required,
|
|
91
|
+
tags: this.tags,
|
|
89
92
|
options: prunedOptions,
|
|
90
93
|
defaultOption: defaultOption === undefined || defaultOption in prunedOptions
|
|
91
94
|
? defaultOption
|
|
@@ -105,6 +108,7 @@ class EnumField extends index_1.Field {
|
|
|
105
108
|
hint: this.hint,
|
|
106
109
|
description: this.description,
|
|
107
110
|
required: this.required,
|
|
111
|
+
tags: this.tags,
|
|
108
112
|
options: this.options,
|
|
109
113
|
defaultOption: key
|
|
110
114
|
});
|
|
@@ -24,7 +24,7 @@ class FormField extends index_1.Field {
|
|
|
24
24
|
this.formId = formId;
|
|
25
25
|
}
|
|
26
26
|
modify(args) {
|
|
27
|
-
return new FormField(Object.assign({ formId: this.formId, name: this.name, hint: this.hint, description: this.description, required: this.required }, args));
|
|
27
|
+
return new FormField(Object.assign({ formId: this.formId, name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags }, args));
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
exports.FormField = FormField;
|
|
@@ -24,7 +24,7 @@ class LinkField extends index_1.Field {
|
|
|
24
24
|
return this.fileOptions !== undefined;
|
|
25
25
|
}
|
|
26
26
|
modify(args) {
|
|
27
|
-
return new LinkField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, allowExternal: this.allowExternal, allowEmail: this.allowEmail, allowPhone: this.allowPhone, internal: this.internalOptions, file: this.fileOptions }, args));
|
|
27
|
+
return new LinkField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, allowExternal: this.allowExternal, allowEmail: this.allowEmail, allowPhone: this.allowPhone, internal: this.internalOptions, file: this.fileOptions }, args));
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
exports.LinkField = LinkField;
|
|
@@ -5,7 +5,7 @@ export declare class PageField<TScope extends PageField.Scope = PageField.Scope>
|
|
|
5
5
|
readonly type: "page";
|
|
6
6
|
readonly scope: TScope;
|
|
7
7
|
readonly pageTypes: ReadonlyArray<Page.Type> | 'all';
|
|
8
|
-
readonly
|
|
8
|
+
readonly pageTags: ReadonlyArray<Tag>;
|
|
9
9
|
constructor(args: PageField.ConstructorArgs<TScope>);
|
|
10
10
|
modify(args: PageField.ModifyArgs): PageField<TScope>;
|
|
11
11
|
}
|
|
@@ -40,7 +40,7 @@ export declare namespace PageField {
|
|
|
40
40
|
type ConstructorArgs<TScope extends Scope = Scope> = Field.ConstructorArgs & {
|
|
41
41
|
scope: TScope;
|
|
42
42
|
pageTypes?: ReadonlyArray<string> | 'all';
|
|
43
|
-
|
|
43
|
+
pageTags?: ReadonlyArray<Tag>;
|
|
44
44
|
};
|
|
45
45
|
type ModifyArgs = Omit<Partial<ConstructorArgs>, 'scope' | 'required'>;
|
|
46
46
|
}
|
|
@@ -13,10 +13,10 @@ class PageField extends index_1.Field {
|
|
|
13
13
|
// initialize instance variables
|
|
14
14
|
this.scope = args.scope;
|
|
15
15
|
this.pageTypes = (_a = args.pageTypes) !== null && _a !== void 0 ? _a : 'all';
|
|
16
|
-
this.
|
|
16
|
+
this.pageTags = (_b = args.pageTags) !== null && _b !== void 0 ? _b : [];
|
|
17
17
|
}
|
|
18
18
|
modify(args) {
|
|
19
|
-
return new PageField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, scope: this.scope, pageTypes: this.pageTypes,
|
|
19
|
+
return new PageField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, scope: this.scope, pageTypes: this.pageTypes, pageTags: this.pageTags }, args));
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.PageField = PageField;
|
|
@@ -27,7 +27,7 @@ class RichTextField extends index_1.Field {
|
|
|
27
27
|
}
|
|
28
28
|
modify(_a) {
|
|
29
29
|
var { capabilities = {} } = _a, args = __rest(_a, ["capabilities"]);
|
|
30
|
-
return new RichTextField(Object.assign({ name: this.name, hint: this.hint, description: this.description, semantics: this.semantics, capabilities: Object.assign(Object.assign({}, this.capabilities), capabilities),
|
|
30
|
+
return new RichTextField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, semantics: this.semantics, capabilities: Object.assign(Object.assign({}, this.capabilities), capabilities), minLength: this.minLength, maxLength: this.maxLength }, args));
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
exports.RichTextField = RichTextField;
|
|
@@ -40,7 +40,7 @@ class TextField extends index_1.Field {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
modify(args) {
|
|
43
|
-
return new TextField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, semantics: this.semantics, regex: this.regex, exact: this.exact, minLength: this.minLength, maxLength: this.maxLength }, args));
|
|
43
|
+
return new TextField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, semantics: this.semantics, regex: this.regex, exact: this.exact, minLength: this.minLength, maxLength: this.maxLength }, args));
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
exports.TextField = TextField;
|
|
@@ -17,7 +17,7 @@ class TimestampField extends index_1.Field {
|
|
|
17
17
|
this.defaultHour = args.defaultHour;
|
|
18
18
|
}
|
|
19
19
|
modify(args) {
|
|
20
|
-
return new TimestampField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, timezone: this.timezone, minTime: this.minTime, maxTime: this.maxTime, defaultHour: this.defaultHour }, args));
|
|
20
|
+
return new TimestampField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, timezone: this.timezone, minTime: this.minTime, maxTime: this.maxTime, defaultHour: this.defaultHour }, args));
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
exports.TimestampField = TimestampField;
|
|
@@ -36,7 +36,7 @@ class ListField extends index_1.Field {
|
|
|
36
36
|
this.max = max;
|
|
37
37
|
}
|
|
38
38
|
modify(args) {
|
|
39
|
-
return new ListField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, itemTypes: this.itemTypes, min: this.min, max: this.max }, args));
|
|
39
|
+
return new ListField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, itemTypes: this.itemTypes, min: this.min, max: this.max }, args));
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
exports.ListField = ListField;
|
|
@@ -13,7 +13,7 @@ class ObjectField extends index_1.Field {
|
|
|
13
13
|
this.preview = args.preview;
|
|
14
14
|
}
|
|
15
15
|
modify(args) {
|
|
16
|
-
return new ObjectField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, content: this.content, preview: this.preview }, args));
|
|
16
|
+
return new ObjectField(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, content: this.content, preview: this.preview }, args));
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.ObjectField = ObjectField;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BooleanField } from '../base/BooleanField';
|
|
2
2
|
export declare class BooleanConfig extends BooleanField {
|
|
3
3
|
readonly responsive: boolean;
|
|
4
|
-
constructor(args: BooleanConfig.ConstructorArgs);
|
|
4
|
+
constructor({ tags: tagsRaw, ...args }: BooleanConfig.ConstructorArgs);
|
|
5
5
|
modify(args: BooleanConfig.ModifyArgs): BooleanConfig;
|
|
6
6
|
}
|
|
7
7
|
export declare namespace BooleanConfig {
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.BooleanConfig = void 0;
|
|
15
|
+
const utils_1 = require("../../../utils");
|
|
4
16
|
const BooleanField_1 = require("../base/BooleanField");
|
|
17
|
+
const Config_1 = require("../Config");
|
|
5
18
|
// class
|
|
6
19
|
class BooleanConfig extends BooleanField_1.BooleanField {
|
|
7
|
-
constructor(
|
|
8
|
-
var
|
|
20
|
+
constructor(_a) {
|
|
21
|
+
var _b;
|
|
22
|
+
var { tags: tagsRaw } = _a, args = __rest(_a, ["tags"]);
|
|
9
23
|
// construct base
|
|
10
|
-
|
|
24
|
+
const tags = utils_1.ArrayUtils.coerce(tagsRaw);
|
|
25
|
+
super(Object.assign(Object.assign({}, args), { tags: [...tags, Config_1.Config.Tag.config] }));
|
|
11
26
|
// initialize instance variable
|
|
12
|
-
this.responsive = (
|
|
27
|
+
this.responsive = (_b = args.responsive) !== null && _b !== void 0 ? _b : false;
|
|
13
28
|
}
|
|
14
29
|
modify(args) {
|
|
15
|
-
return new BooleanConfig(Object.assign({ semantics: this.semantics, name: this.name, hint: this.hint, description: this.description, required: this.required, defaultValue: this.defaultValue, responsive: this.responsive }, args));
|
|
30
|
+
return new BooleanConfig(Object.assign({ semantics: this.semantics, name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, defaultValue: this.defaultValue, responsive: this.responsive }, args));
|
|
16
31
|
}
|
|
17
32
|
}
|
|
18
33
|
exports.BooleanConfig = BooleanConfig;
|
|
@@ -2,13 +2,13 @@ import { StringKeyOf } from 'type-fest';
|
|
|
2
2
|
import { EnumField } from '../base/EnumField';
|
|
3
3
|
export declare class EnumConfig<TOptions extends EnumField.Options = EnumField.Options> extends EnumField<TOptions> {
|
|
4
4
|
readonly responsive: boolean;
|
|
5
|
-
constructor(args: EnumConfig.ConstructorArgs<TOptions>);
|
|
5
|
+
constructor({ tags: tagsRaw, ...args }: EnumConfig.ConstructorArgs<TOptions>);
|
|
6
6
|
modify({ options, ...args }: EnumConfig.ModifyArgs<TOptions>): EnumConfig<TOptions>;
|
|
7
7
|
updateOptions(options: Partial<TOptions>): EnumConfig<TOptions>;
|
|
8
8
|
removeOption<TKey extends StringKeyOf<TOptions>>(key: TKey): EnumConfig<TOptions>;
|
|
9
9
|
removeOptions<TKey extends StringKeyOf<TOptions>>(...keys: ReadonlyArray<TKey>): EnumConfig<TOptions>;
|
|
10
10
|
keepOptions<TKey extends StringKeyOf<TOptions>>(...keys: ReadonlyArray<TKey>): EnumConfig<TOptions>;
|
|
11
|
-
setDefault<TKey extends StringKeyOf<TOptions>>(key: TKey
|
|
11
|
+
setDefault<TKey extends StringKeyOf<TOptions>>(key: TKey): EnumConfig<TOptions>;
|
|
12
12
|
makeResponsive(responsive?: boolean): EnumConfig<TOptions>;
|
|
13
13
|
protected new({ responsive, ...args }: EnumConfig.ConstructorArgs<TOptions>): EnumConfig<TOptions>;
|
|
14
14
|
}
|
|
@@ -12,20 +12,24 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.EnumConfig = void 0;
|
|
15
|
+
const utils_1 = require("../../../utils");
|
|
15
16
|
const EnumField_1 = require("../base/EnumField");
|
|
17
|
+
const Config_1 = require("../Config");
|
|
16
18
|
// class
|
|
17
19
|
class EnumConfig extends EnumField_1.EnumField {
|
|
18
|
-
constructor(
|
|
19
|
-
var
|
|
20
|
+
constructor(_a) {
|
|
21
|
+
var _b;
|
|
22
|
+
var { tags: tagsRaw } = _a, args = __rest(_a, ["tags"]);
|
|
20
23
|
// construct base
|
|
21
|
-
|
|
24
|
+
const tags = utils_1.ArrayUtils.coerce(tagsRaw);
|
|
25
|
+
super(Object.assign(Object.assign({}, args), { tags: [...tags, Config_1.Config.Tag.config] }));
|
|
22
26
|
// initialize instance variable
|
|
23
|
-
this.responsive = (
|
|
27
|
+
this.responsive = (_b = args.responsive) !== null && _b !== void 0 ? _b : false;
|
|
24
28
|
}
|
|
25
29
|
modify(_a) {
|
|
26
30
|
var _b;
|
|
27
31
|
var { options } = _a, args = __rest(_a, ["options"]);
|
|
28
|
-
return this.new(Object.assign({ semantics: this.semantics, name: this.name, hint: this.hint, description: this.description, required: this.required, options: (_b = options) !== null && _b !== void 0 ? _b : this.options, defaultOption: this.defaultOption, responsive: this.responsive }, args));
|
|
32
|
+
return this.new(Object.assign({ semantics: this.semantics, name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, options: (_b = options) !== null && _b !== void 0 ? _b : this.options, defaultOption: this.defaultOption, responsive: this.responsive }, args));
|
|
29
33
|
}
|
|
30
34
|
updateOptions(options) {
|
|
31
35
|
return super.updateOptions(options);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TextField } from '../base/TextField';
|
|
2
2
|
export declare class TextConfig extends TextField {
|
|
3
3
|
readonly responsive: boolean;
|
|
4
|
-
constructor(args: TextConfig.ConstructorArgs);
|
|
4
|
+
constructor({ tags: tagsRaw, ...args }: TextConfig.ConstructorArgs);
|
|
5
5
|
modify(args: TextConfig.ModifyArgs): TextConfig;
|
|
6
6
|
}
|
|
7
7
|
export declare namespace TextConfig {
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.TextConfig = void 0;
|
|
15
|
+
const utils_1 = require("../../../utils");
|
|
4
16
|
const TextField_1 = require("../base/TextField");
|
|
17
|
+
const Config_1 = require("../Config");
|
|
5
18
|
// class
|
|
6
19
|
class TextConfig extends TextField_1.TextField {
|
|
7
|
-
constructor(
|
|
8
|
-
var
|
|
20
|
+
constructor(_a) {
|
|
21
|
+
var _b;
|
|
22
|
+
var { tags: tagsRaw } = _a, args = __rest(_a, ["tags"]);
|
|
9
23
|
// construct base
|
|
10
|
-
|
|
24
|
+
const tags = utils_1.ArrayUtils.coerce(tagsRaw);
|
|
25
|
+
super(Object.assign(Object.assign({}, args), { tags: [...tags, Config_1.Config.Tag.config] }));
|
|
11
26
|
// initialize instance variable
|
|
12
|
-
this.responsive = (
|
|
27
|
+
this.responsive = (_b = args.responsive) !== null && _b !== void 0 ? _b : false;
|
|
13
28
|
}
|
|
14
29
|
modify(args) {
|
|
15
|
-
return new TextConfig(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, semantics: this.semantics, regex: this.regex, exact: this.exact, minLength: this.minLength, maxLength: this.maxLength, responsive: this.responsive }, args));
|
|
30
|
+
return new TextConfig(Object.assign({ name: this.name, hint: this.hint, description: this.description, required: this.required, tags: this.tags, semantics: this.semantics, regex: this.regex, exact: this.exact, minLength: this.minLength, maxLength: this.maxLength, responsive: this.responsive }, args));
|
|
16
31
|
}
|
|
17
32
|
}
|
|
18
33
|
exports.TextConfig = TextConfig;
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./FieldTag"), exports);
|
|
17
18
|
__exportStar(require("./Field"), exports);
|
|
18
19
|
__exportStar(require("./Config"), exports);
|
|
19
20
|
__exportStar(require("./base"), exports);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { JsonValue } from 'type-fest';
|
|
2
2
|
import { Transform } from '../types';
|
|
3
3
|
export declare namespace ArrayUtils {
|
|
4
|
-
function
|
|
4
|
+
function isReadonlyArray<T>(value: unknown): value is readonly T[];
|
|
5
|
+
function isReadonlySet<T>(value: unknown): value is ReadonlySet<T>;
|
|
6
|
+
function coerce<T>(maybeArray: ReadonlySet<T> | ReadonlyArray<T> | T | null | undefined): T[];
|
|
5
7
|
function first<T>(array: ReadonlyArray<T>): T | undefined;
|
|
6
8
|
function last<T>(array: ReadonlyArray<T>): T | undefined;
|
|
7
9
|
/**
|
package/dist/utils/ArrayUtils.js
CHANGED
|
@@ -4,12 +4,25 @@ exports.ArrayUtils = void 0;
|
|
|
4
4
|
// namespace
|
|
5
5
|
var ArrayUtils;
|
|
6
6
|
(function (ArrayUtils) {
|
|
7
|
+
function isReadonlyArray(value) {
|
|
8
|
+
return Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
ArrayUtils.isReadonlyArray = isReadonlyArray;
|
|
11
|
+
function isReadonlySet(value) {
|
|
12
|
+
return !!value
|
|
13
|
+
&& typeof value === 'object'
|
|
14
|
+
&& !Array.isArray(value)
|
|
15
|
+
&& value instanceof Set;
|
|
16
|
+
}
|
|
17
|
+
ArrayUtils.isReadonlySet = isReadonlySet;
|
|
7
18
|
function coerce(maybeArray) {
|
|
8
|
-
return maybeArray
|
|
9
|
-
?
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
return maybeArray === null || maybeArray === undefined
|
|
20
|
+
? []
|
|
21
|
+
: isReadonlyArray(maybeArray)
|
|
22
|
+
? [...maybeArray]
|
|
23
|
+
: isReadonlySet(maybeArray)
|
|
24
|
+
? maybeArray.values().toArray()
|
|
25
|
+
: [maybeArray];
|
|
13
26
|
}
|
|
14
27
|
ArrayUtils.coerce = coerce;
|
|
15
28
|
function first(array) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nascentdigital/funnel-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/nascentdigital/funnel.git",
|
|
6
6
|
"directory": "libs/core"
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"jest-tsd": "^0.2.2",
|
|
66
66
|
"ts-jest": "^29.3.2"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "5fb91f3eecdfe1bcf18dc78f0ecf99668816d02a"
|
|
69
69
|
}
|