@overmap-ai/core 1.0.36-misc-improvements.3 → 1.0.36
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/forms/fields/MultiStringField/MultiStringField.d.ts +0 -2
- package/dist/forms/fields/NumberField/NumberField.d.ts +0 -2
- package/dist/forms/fields/SelectField/BaseSelectField.d.ts +0 -3
- package/dist/forms/fields/StringOrTextFields/StringOrTextField.d.ts +0 -2
- package/dist/forms/typings.d.ts +0 -4
- package/dist/overmap-core.js +26 -53
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +25 -52
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,6 @@ import { ISerializedField, SelectFieldOption, SerializedMultiStringField } from
|
|
|
6
6
|
type MultiStringFieldOptions = ChildFieldOptions<SelectFieldOption[]> & {
|
|
7
7
|
minimum_length?: number;
|
|
8
8
|
maximum_length?: number;
|
|
9
|
-
placeholder?: string;
|
|
10
9
|
};
|
|
11
10
|
export declare const emptyMultiStringField: {
|
|
12
11
|
type: string;
|
|
@@ -27,7 +26,6 @@ export declare class MultiStringField extends BaseField<SelectFieldOption[], "mu
|
|
|
27
26
|
readonly minLength: number;
|
|
28
27
|
readonly maxLength: number;
|
|
29
28
|
readonly onlyValidateAfterTouched = false;
|
|
30
|
-
readonly placeholder: string;
|
|
31
29
|
static Icon: typeof ListBulletIcon;
|
|
32
30
|
constructor(options: MultiStringFieldOptions);
|
|
33
31
|
getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement> | SelectFieldOption[]): SelectFieldOption[];
|
|
@@ -18,7 +18,6 @@ export interface NumberFieldOptions extends ChildFieldOptions<NumberFieldValue>
|
|
|
18
18
|
maximum?: number;
|
|
19
19
|
minimum?: number;
|
|
20
20
|
integers?: boolean;
|
|
21
|
-
placeholder?: string;
|
|
22
21
|
}
|
|
23
22
|
export declare class NumberField extends BaseField<NumberFieldValue, "number"> {
|
|
24
23
|
static readonly fieldTypeName = "Number";
|
|
@@ -26,7 +25,6 @@ export declare class NumberField extends BaseField<NumberFieldValue, "number"> {
|
|
|
26
25
|
readonly minimum: number | undefined;
|
|
27
26
|
readonly maximum: number | undefined;
|
|
28
27
|
readonly integers: boolean;
|
|
29
|
-
readonly placeholder: string;
|
|
30
28
|
static Icon: typeof FontFamilyIcon;
|
|
31
29
|
constructor(options: NumberFieldOptions);
|
|
32
30
|
getValueFromChangeEvent(event: ChangeEvent<HTMLInputElement>): NumberFieldValue;
|
|
@@ -10,16 +10,13 @@ export interface BaseSelectFieldOptions<TValue, TIdentifier extends "select" | "
|
|
|
10
10
|
* where the `label` is the text to display to the user and the `value` is the value handled by Formik.*/
|
|
11
11
|
options: string[] | SelectFieldOption[];
|
|
12
12
|
type: TIdentifier;
|
|
13
|
-
placeholder?: string;
|
|
14
13
|
}
|
|
15
14
|
export declare abstract class BaseSelectField<TValue extends FieldValue, TIdentifier extends "select" | "multi-select"> extends BaseField<TValue, TIdentifier> {
|
|
16
15
|
readonly options: SelectFieldOption[];
|
|
17
16
|
readonly onlyValidateAfterTouched = false;
|
|
18
|
-
readonly placeholder: string;
|
|
19
17
|
protected constructor(options: BaseSelectFieldOptions<TValue, TIdentifier>);
|
|
20
18
|
protected _serialize(): {
|
|
21
19
|
options: SelectFieldOption[];
|
|
22
|
-
placeholder: string;
|
|
23
20
|
label: string;
|
|
24
21
|
required: boolean;
|
|
25
22
|
image?: File | Promise<File> | undefined;
|
|
@@ -5,7 +5,6 @@ import { SerializedStringField } from "../../typings";
|
|
|
5
5
|
export interface StringOrTextFieldOptions extends FieldOptions<string> {
|
|
6
6
|
minLength?: NumberFieldValue;
|
|
7
7
|
maxLength?: NumberFieldValue;
|
|
8
|
-
placeholder?: string;
|
|
9
8
|
}
|
|
10
9
|
export type SerializedStringOrTextField<TIdentifier extends "string" | "text"> = Omit<SerializedStringField, "type"> & {
|
|
11
10
|
type: TIdentifier;
|
|
@@ -13,7 +12,6 @@ export type SerializedStringOrTextField<TIdentifier extends "string" | "text"> =
|
|
|
13
12
|
export declare abstract class StringOrTextField<TIdentifier extends "string" | "text"> extends BaseField<string, TIdentifier> {
|
|
14
13
|
readonly minLength?: number;
|
|
15
14
|
readonly maxLength: number;
|
|
16
|
-
readonly placeholder: string;
|
|
17
15
|
protected constructor(options: StringOrTextFieldOptions);
|
|
18
16
|
/**
|
|
19
17
|
* This function returns a function that validates that the value given for "minimum length" (when creating a new field) is less than or
|
package/dist/forms/typings.d.ts
CHANGED
|
@@ -43,7 +43,6 @@ export interface SerializedFieldSection extends BaseSerializedObject {
|
|
|
43
43
|
interface BaseSerializedStringField extends BaseSerializedField {
|
|
44
44
|
minimum_length?: number;
|
|
45
45
|
maximum_length: number;
|
|
46
|
-
placeholder?: string;
|
|
47
46
|
}
|
|
48
47
|
export type StringInputType = Exclude<HTMLInputTypeAttribute, "checkbox" | "number" | "button">;
|
|
49
48
|
export interface SerializedStringField extends BaseSerializedStringField {
|
|
@@ -64,7 +63,6 @@ export interface SerializedNumberField extends BaseSerializedField {
|
|
|
64
63
|
minimum: number | undefined;
|
|
65
64
|
maximum: number | undefined;
|
|
66
65
|
integers: boolean;
|
|
67
|
-
placeholder?: string;
|
|
68
66
|
}
|
|
69
67
|
export interface SerializedDateField extends BaseSerializedField {
|
|
70
68
|
type: "date";
|
|
@@ -78,12 +76,10 @@ export interface SelectFieldOption {
|
|
|
78
76
|
export interface SerializedSelectField extends BaseSerializedField {
|
|
79
77
|
type: "select";
|
|
80
78
|
options: SelectFieldOption[];
|
|
81
|
-
placeholder?: string;
|
|
82
79
|
}
|
|
83
80
|
export interface SerializedMultiSelectField extends BaseSerializedField {
|
|
84
81
|
type: "multi-select";
|
|
85
82
|
options: SelectFieldOption[];
|
|
86
|
-
placeholder?: string;
|
|
87
83
|
}
|
|
88
84
|
export interface SerializedUploadField extends BaseSerializedField {
|
|
89
85
|
type: "upload";
|
package/dist/overmap-core.js
CHANGED
|
@@ -8,7 +8,7 @@ var _a;
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import React__default, { useState, useEffect, useRef, memo, useMemo, forwardRef, createElement, useCallback, createContext, useContext, Children, isValidElement, cloneElement, Fragment as Fragment$1, useLayoutEffect, useReducer } from "react";
|
|
10
10
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
11
|
-
import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex, IconButton, Text, useSeverityColor, Checkbox, TextArea, Select, useToast, Badge, MultiSelect, Button, ButtonList, divButtonProps, Tooltip, DropdownItemMenu, Popover,
|
|
11
|
+
import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex, IconButton, Text, useSeverityColor, Checkbox, TextArea, Select, useToast, Badge, MultiSelect, Button, ButtonList, divButtonProps, Tooltip, DropdownItemMenu, Popover, Input, useAlertDialog } from "@overmap-ai/blocks";
|
|
12
12
|
import { DepGraph } from "dependency-graph";
|
|
13
13
|
import { offline as offline$1 } from "@redux-offline/redux-offline";
|
|
14
14
|
import offlineConfig from "@redux-offline/redux-offline/lib/defaults";
|
|
@@ -8485,7 +8485,7 @@ const NumberInput = memo((props) => {
|
|
|
8485
8485
|
...fieldProps,
|
|
8486
8486
|
type: "number",
|
|
8487
8487
|
id: inputId,
|
|
8488
|
-
placeholder:
|
|
8488
|
+
placeholder: "Enter a number",
|
|
8489
8489
|
min: field.minimum,
|
|
8490
8490
|
max: field.maximum,
|
|
8491
8491
|
step: field.integers ? 1 : 0.1,
|
|
@@ -8512,18 +8512,15 @@ const _NumberField = class _NumberField extends BaseField {
|
|
|
8512
8512
|
minimum = Number.MIN_SAFE_INTEGER,
|
|
8513
8513
|
maximum = Number.MAX_SAFE_INTEGER,
|
|
8514
8514
|
integers = false,
|
|
8515
|
-
placeholder = "Enter a number",
|
|
8516
8515
|
...base
|
|
8517
8516
|
} = options;
|
|
8518
8517
|
super({ ...base, type: "number" });
|
|
8519
8518
|
__publicField(this, "minimum");
|
|
8520
8519
|
__publicField(this, "maximum");
|
|
8521
8520
|
__publicField(this, "integers");
|
|
8522
|
-
__publicField(this, "placeholder");
|
|
8523
8521
|
this.minimum = minimum;
|
|
8524
8522
|
this.maximum = maximum;
|
|
8525
8523
|
this.integers = integers;
|
|
8526
|
-
this.placeholder = placeholder;
|
|
8527
8524
|
}
|
|
8528
8525
|
getValueFromChangeEvent(event) {
|
|
8529
8526
|
const number = Number.parseFloat(event.target.value);
|
|
@@ -8599,8 +8596,7 @@ const _NumberField = class _NumberField extends BaseField {
|
|
|
8599
8596
|
...super._serialize(),
|
|
8600
8597
|
minimum: this.minimum,
|
|
8601
8598
|
maximum: this.maximum,
|
|
8602
|
-
integers: this.integers
|
|
8603
|
-
placeholder: this.placeholder
|
|
8599
|
+
integers: this.integers
|
|
8604
8600
|
};
|
|
8605
8601
|
}
|
|
8606
8602
|
static deserialize(data) {
|
|
@@ -8684,14 +8680,12 @@ const valueIsFormikUserFormRevision = (form) => {
|
|
|
8684
8680
|
};
|
|
8685
8681
|
class StringOrTextField extends BaseField {
|
|
8686
8682
|
constructor(options) {
|
|
8687
|
-
const { minLength, maxLength = 5e3,
|
|
8683
|
+
const { minLength, maxLength = 5e3, ...base } = options;
|
|
8688
8684
|
super(base);
|
|
8689
8685
|
__publicField(this, "minLength");
|
|
8690
8686
|
__publicField(this, "maxLength");
|
|
8691
|
-
__publicField(this, "placeholder");
|
|
8692
8687
|
this.minLength = minLength ? Math.max(minLength, 0) : void 0;
|
|
8693
8688
|
this.maxLength = maxLength ? Math.max(maxLength, 0) : 5e3;
|
|
8694
|
-
this.placeholder = placeholder;
|
|
8695
8689
|
}
|
|
8696
8690
|
static getFieldCreationSchema(parentPath = "") {
|
|
8697
8691
|
const path = parentPath && `${parentPath}.`;
|
|
@@ -8756,8 +8750,7 @@ class StringOrTextField extends BaseField {
|
|
|
8756
8750
|
return {
|
|
8757
8751
|
...super._serialize(),
|
|
8758
8752
|
minimum_length: this.minLength,
|
|
8759
|
-
maximum_length: this.maxLength
|
|
8760
|
-
placeholder: this.placeholder
|
|
8753
|
+
maximum_length: this.maxLength
|
|
8761
8754
|
};
|
|
8762
8755
|
}
|
|
8763
8756
|
}
|
|
@@ -8816,7 +8809,7 @@ const StringInput = memo((props) => {
|
|
|
8816
8809
|
...fieldProps,
|
|
8817
8810
|
type: field.inputType,
|
|
8818
8811
|
id: inputId,
|
|
8819
|
-
placeholder:
|
|
8812
|
+
placeholder: "Enter a short description",
|
|
8820
8813
|
color
|
|
8821
8814
|
}
|
|
8822
8815
|
) : /* @__PURE__ */ jsxs(TextField$1.Root, { className: styles$5.clickableLinkContainer, children: [
|
|
@@ -8867,13 +8860,7 @@ const _StringField = class _StringField extends StringOrTextField {
|
|
|
8867
8860
|
if (data.type !== "string")
|
|
8868
8861
|
throw new Error("Type mismatch.");
|
|
8869
8862
|
const { maximum_length, minimum_length, input_type, ...rest } = data;
|
|
8870
|
-
return new _StringField({
|
|
8871
|
-
...rest,
|
|
8872
|
-
maxLength: maximum_length,
|
|
8873
|
-
minLength: minimum_length,
|
|
8874
|
-
inputType: input_type,
|
|
8875
|
-
placeholder: "Enter a short description"
|
|
8876
|
-
});
|
|
8863
|
+
return new _StringField({ ...rest, maxLength: maximum_length, minLength: minimum_length, inputType: input_type });
|
|
8877
8864
|
}
|
|
8878
8865
|
getInput(props) {
|
|
8879
8866
|
return /* @__PURE__ */ jsx(StringInput, { field: this, ...props });
|
|
@@ -8904,7 +8891,7 @@ const TextInput = memo((props) => {
|
|
|
8904
8891
|
...fieldProps,
|
|
8905
8892
|
resize: "vertical",
|
|
8906
8893
|
id: inputId,
|
|
8907
|
-
placeholder:
|
|
8894
|
+
placeholder: "Enter a description",
|
|
8908
8895
|
severity
|
|
8909
8896
|
}
|
|
8910
8897
|
)
|
|
@@ -8930,12 +8917,7 @@ const _TextField = class _TextField extends StringOrTextField {
|
|
|
8930
8917
|
if (data.type !== "text")
|
|
8931
8918
|
throw new Error("Type mismatch.");
|
|
8932
8919
|
const { maximum_length, minimum_length, ...rest } = data;
|
|
8933
|
-
return new _TextField({
|
|
8934
|
-
...rest,
|
|
8935
|
-
maxLength: maximum_length,
|
|
8936
|
-
minLength: minimum_length,
|
|
8937
|
-
placeholder: "Enter a description"
|
|
8938
|
-
});
|
|
8920
|
+
return new _TextField({ ...rest, maxLength: maximum_length, minLength: minimum_length });
|
|
8939
8921
|
}
|
|
8940
8922
|
getInput(props) {
|
|
8941
8923
|
return /* @__PURE__ */ jsx(TextInput, { field: this, ...props });
|
|
@@ -8977,7 +8959,7 @@ const SelectInput = memo((props) => {
|
|
|
8977
8959
|
items: options,
|
|
8978
8960
|
...fieldProps,
|
|
8979
8961
|
onValueChange: handleChange,
|
|
8980
|
-
placeholder:
|
|
8962
|
+
placeholder: "Select one...",
|
|
8981
8963
|
id: inputId,
|
|
8982
8964
|
severity,
|
|
8983
8965
|
...rest
|
|
@@ -9238,13 +9220,13 @@ const MultiStringInput = memo((props) => {
|
|
|
9238
9220
|
/* @__PURE__ */ jsx(Box, { grow: "1", children: /* @__PURE__ */ jsx(
|
|
9239
9221
|
TextField$1.Input,
|
|
9240
9222
|
{
|
|
9223
|
+
placeholder: "Press enter to add a new option",
|
|
9241
9224
|
...rest,
|
|
9242
9225
|
...fieldProps,
|
|
9243
9226
|
value: intermediateValue,
|
|
9244
9227
|
onChange: handleChange,
|
|
9245
9228
|
onKeyDown: handleKeyDown,
|
|
9246
9229
|
id: inputId,
|
|
9247
|
-
placeholder: field.placeholder,
|
|
9248
9230
|
color: updatedColor,
|
|
9249
9231
|
onBlur: void 0
|
|
9250
9232
|
}
|
|
@@ -9316,15 +9298,13 @@ const emptyMultiStringField = {
|
|
|
9316
9298
|
};
|
|
9317
9299
|
const _MultiStringField = class _MultiStringField extends BaseField {
|
|
9318
9300
|
constructor(options) {
|
|
9319
|
-
const { minimum_length, maximum_length,
|
|
9301
|
+
const { minimum_length, maximum_length, ...rest } = options;
|
|
9320
9302
|
super({ ...rest, type: "multi-string" });
|
|
9321
9303
|
__publicField(this, "minLength");
|
|
9322
9304
|
__publicField(this, "maxLength");
|
|
9323
9305
|
__publicField(this, "onlyValidateAfterTouched", false);
|
|
9324
|
-
__publicField(this, "placeholder");
|
|
9325
9306
|
this.minLength = minimum_length ?? 0;
|
|
9326
9307
|
this.maxLength = maximum_length ?? Infinity;
|
|
9327
|
-
this.placeholder = placeholder ?? "Press enter to add a new option";
|
|
9328
9308
|
}
|
|
9329
9309
|
getValueFromChangeEvent(event) {
|
|
9330
9310
|
if (Array.isArray(event))
|
|
@@ -9335,12 +9315,7 @@ const _MultiStringField = class _MultiStringField extends BaseField {
|
|
|
9335
9315
|
return /* @__PURE__ */ jsx(MultiStringInput, { field: this, ...props });
|
|
9336
9316
|
}
|
|
9337
9317
|
serialize() {
|
|
9338
|
-
return {
|
|
9339
|
-
...super._serialize(),
|
|
9340
|
-
minimum_length: this.minLength,
|
|
9341
|
-
maximum_length: this.maxLength,
|
|
9342
|
-
placeholder: this.placeholder
|
|
9343
|
-
};
|
|
9318
|
+
return { ...super._serialize(), minimum_length: this.minLength, maximum_length: this.maxLength };
|
|
9344
9319
|
}
|
|
9345
9320
|
isBlank(value) {
|
|
9346
9321
|
return super.isBlank(value) || value.length === 0;
|
|
@@ -9371,12 +9346,9 @@ __publicField(_MultiStringField, "Icon", ListBulletIcon);
|
|
|
9371
9346
|
let MultiStringField = _MultiStringField;
|
|
9372
9347
|
class BaseSelectField extends BaseField {
|
|
9373
9348
|
constructor(options) {
|
|
9374
|
-
|
|
9375
|
-
super(base);
|
|
9349
|
+
super(options);
|
|
9376
9350
|
__publicField(this, "options");
|
|
9377
9351
|
__publicField(this, "onlyValidateAfterTouched", false);
|
|
9378
|
-
__publicField(this, "placeholder");
|
|
9379
|
-
this.placeholder = placeholder;
|
|
9380
9352
|
const encounteredIds = /* @__PURE__ */ new Set();
|
|
9381
9353
|
this.options = options.options.map((option) => {
|
|
9382
9354
|
if (typeof option === "string") {
|
|
@@ -9395,8 +9367,7 @@ class BaseSelectField extends BaseField {
|
|
|
9395
9367
|
_serialize() {
|
|
9396
9368
|
return {
|
|
9397
9369
|
...super._serialize(),
|
|
9398
|
-
options: this.options
|
|
9399
|
-
placeholder: this.placeholder
|
|
9370
|
+
options: this.options
|
|
9400
9371
|
};
|
|
9401
9372
|
}
|
|
9402
9373
|
static getFieldCreationSchema(parentPath = "") {
|
|
@@ -9423,8 +9394,7 @@ const emptySelectField = {
|
|
|
9423
9394
|
};
|
|
9424
9395
|
const _SelectField = class _SelectField extends BaseSelectField {
|
|
9425
9396
|
constructor(options) {
|
|
9426
|
-
|
|
9427
|
-
super({ ...rest, placeholder, type: "select" });
|
|
9397
|
+
super({ ...options, type: "select" });
|
|
9428
9398
|
}
|
|
9429
9399
|
getValueFromChangeEvent(event) {
|
|
9430
9400
|
if (typeof event === "string")
|
|
@@ -9484,7 +9454,7 @@ const MultiSelectInput = memo((props) => {
|
|
|
9484
9454
|
onValueChange: handleChange,
|
|
9485
9455
|
options: field.options,
|
|
9486
9456
|
name: fieldProps.name,
|
|
9487
|
-
placeholder:
|
|
9457
|
+
placeholder: "Select one or more...",
|
|
9488
9458
|
id: inputId,
|
|
9489
9459
|
severity,
|
|
9490
9460
|
...rest
|
|
@@ -9501,8 +9471,7 @@ const emptyMultiSelectField = {
|
|
|
9501
9471
|
};
|
|
9502
9472
|
const _MultiSelectField = class _MultiSelectField extends BaseSelectField {
|
|
9503
9473
|
constructor(options) {
|
|
9504
|
-
|
|
9505
|
-
super({ ...rest, placeholder, type: "multi-select" });
|
|
9474
|
+
super({ ...options, type: "multi-select" });
|
|
9506
9475
|
}
|
|
9507
9476
|
getValueFromChangeEvent(event) {
|
|
9508
9477
|
if (Array.isArray(event))
|
|
@@ -10896,6 +10865,11 @@ const FieldBuilder = memo((props) => {
|
|
|
10896
10865
|
}
|
|
10897
10866
|
conditionValue = Array.isArray((_c = initial.condition) == null ? void 0 : _c.value) ? initial.condition.value.map((v) => typeof v === "string" ? v : v.label).join(", ") : (_e = (_d = initial.condition) == null ? void 0 : _d.value) == null ? void 0 : _e.toString();
|
|
10898
10867
|
}
|
|
10868
|
+
const handleInputChangeForInput = useCallback((event) => {
|
|
10869
|
+
if (event.target.parentNode instanceof HTMLElement) {
|
|
10870
|
+
event.target.parentNode.dataset.replicatedValue = event.target.value;
|
|
10871
|
+
}
|
|
10872
|
+
}, []);
|
|
10899
10873
|
const handleInputChangeForTextArea = useCallback((event) => {
|
|
10900
10874
|
if (event.target.parentNode instanceof HTMLElement) {
|
|
10901
10875
|
event.target.parentNode.dataset.replicatedValue = event.target.value;
|
|
@@ -11034,7 +11008,7 @@ const FieldBuilder = memo((props) => {
|
|
|
11034
11008
|
{
|
|
11035
11009
|
name: `${parentPath}.${index2}.label`,
|
|
11036
11010
|
render: ({ setValue, value }) => /* @__PURE__ */ jsx(
|
|
11037
|
-
|
|
11011
|
+
Input,
|
|
11038
11012
|
{
|
|
11039
11013
|
className: styles.grow,
|
|
11040
11014
|
placeholder: `Enter a ${type === "section" ? "section" : "field"} label`,
|
|
@@ -11042,12 +11016,11 @@ const FieldBuilder = memo((props) => {
|
|
|
11042
11016
|
onChange: (event) => {
|
|
11043
11017
|
setValue(event.target.value);
|
|
11044
11018
|
},
|
|
11045
|
-
onInput:
|
|
11046
|
-
resize: "none",
|
|
11019
|
+
onInput: handleInputChangeForInput,
|
|
11047
11020
|
maxLength: 200,
|
|
11048
11021
|
showInputLength: false,
|
|
11049
11022
|
variant: "ghost",
|
|
11050
|
-
size: "
|
|
11023
|
+
size: "large"
|
|
11051
11024
|
}
|
|
11052
11025
|
)
|
|
11053
11026
|
}
|