@bpmn-io/form-js-viewer 0.11.0 → 0.12.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/assets/form-js.css +140 -43
- package/dist/index.cjs +733 -468
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +654 -380
- package/dist/index.es.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/render/components/form-fields/Button.d.ts +1 -0
- package/dist/types/render/components/form-fields/Checkbox.d.ts +1 -0
- package/dist/types/render/components/form-fields/Checklist.d.ts +7 -1
- package/dist/types/render/components/form-fields/Datetime.d.ts +2 -0
- package/dist/types/render/components/form-fields/Default.d.ts +2 -0
- package/dist/types/render/components/form-fields/Image.d.ts +2 -0
- package/dist/types/render/components/form-fields/Number.d.ts +1 -0
- package/dist/types/render/components/form-fields/Radio.d.ts +7 -1
- package/dist/types/render/components/form-fields/Select.d.ts +7 -1
- package/dist/types/render/components/form-fields/Taglist.d.ts +7 -1
- package/dist/types/render/components/form-fields/Text.d.ts +2 -0
- package/dist/types/render/components/form-fields/Textarea.d.ts +1 -0
- package/dist/types/render/components/form-fields/Textfield.d.ts +1 -0
- package/dist/types/render/components/form-fields/parts/SearchableSelect.d.ts +1 -0
- package/dist/types/render/components/form-fields/parts/SimpleSelect.d.ts +1 -0
- package/dist/types/render/components/index.d.ts +1 -1
- package/dist/types/util/constants/ValuesSourceConstants.d.ts +4 -1
- package/dist/types/util/index.d.ts +1 -0
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var Ids = require('ids');
|
|
6
4
|
var minDash = require('min-dash');
|
|
7
5
|
var feelin = require('feelin');
|
|
@@ -16,16 +14,6 @@ var flatpickr = require('flatpickr');
|
|
|
16
14
|
var Markup = require('preact-markup');
|
|
17
15
|
var didi = require('didi');
|
|
18
16
|
|
|
19
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
-
|
|
21
|
-
var Ids__default = /*#__PURE__*/_interopDefaultLegacy(Ids);
|
|
22
|
-
var Big__default = /*#__PURE__*/_interopDefaultLegacy(Big);
|
|
23
|
-
var snarkdown__default = /*#__PURE__*/_interopDefaultLegacy(snarkdown);
|
|
24
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
25
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
|
-
var flatpickr__default = /*#__PURE__*/_interopDefaultLegacy(flatpickr);
|
|
27
|
-
var Markup__default = /*#__PURE__*/_interopDefaultLegacy(Markup);
|
|
28
|
-
|
|
29
17
|
/**
|
|
30
18
|
* @typedef {object} Condition
|
|
31
19
|
* @property {string} [hide]
|
|
@@ -580,7 +568,7 @@ function invokeFunction(fn, args) {
|
|
|
580
568
|
}
|
|
581
569
|
|
|
582
570
|
function countDecimals(number) {
|
|
583
|
-
const num =
|
|
571
|
+
const num = Big(number);
|
|
584
572
|
if (num.toString() === num.toFixed(0)) return 0;
|
|
585
573
|
return num.toFixed().split('.')[1].length || 0;
|
|
586
574
|
}
|
|
@@ -625,8 +613,8 @@ class Validator {
|
|
|
625
613
|
errors = [...errors, 'Value is expected to ' + (decimalDigits === 0 ? 'be an integer' : `have at most ${decimalDigits} decimal digit${decimalDigits > 1 ? 's' : ''}`) + '.'];
|
|
626
614
|
}
|
|
627
615
|
if (increment) {
|
|
628
|
-
const bigValue =
|
|
629
|
-
const bigIncrement =
|
|
616
|
+
const bigValue = Big(value);
|
|
617
|
+
const bigIncrement = Big(increment);
|
|
630
618
|
const offset = bigValue.mod(bigIncrement);
|
|
631
619
|
if (offset.cmp(0) !== 0) {
|
|
632
620
|
const previousValue = bigValue.minus(offset);
|
|
@@ -673,8 +661,8 @@ class FormFieldRegistry {
|
|
|
673
661
|
this._eventBus = eventBus;
|
|
674
662
|
this._formFields = {};
|
|
675
663
|
eventBus.on('form.clear', () => this.clear());
|
|
676
|
-
this._ids = new
|
|
677
|
-
this._keys = new
|
|
664
|
+
this._ids = new Ids([32, 36, 1]);
|
|
665
|
+
this._keys = new Ids([32, 36, 1]);
|
|
678
666
|
}
|
|
679
667
|
add(formField) {
|
|
680
668
|
const {
|
|
@@ -754,7 +742,7 @@ function getExpressionVariableNames(expression) {
|
|
|
754
742
|
} while (cursor.next());
|
|
755
743
|
return Array.from(variables);
|
|
756
744
|
}
|
|
757
|
-
function isExpression$
|
|
745
|
+
function isExpression$1(value) {
|
|
758
746
|
return minDash.isString(value) && value.startsWith('=');
|
|
759
747
|
}
|
|
760
748
|
|
|
@@ -805,7 +793,10 @@ const VALUES_SOURCES_PATHS = {
|
|
|
805
793
|
[VALUES_SOURCES.INPUT]: ['valuesKey']
|
|
806
794
|
};
|
|
807
795
|
const VALUES_SOURCES_DEFAULTS = {
|
|
808
|
-
[VALUES_SOURCES.STATIC]: [
|
|
796
|
+
[VALUES_SOURCES.STATIC]: [{
|
|
797
|
+
label: 'Value',
|
|
798
|
+
value: 'value'
|
|
799
|
+
}],
|
|
809
800
|
[VALUES_SOURCES.INPUT]: ''
|
|
810
801
|
};
|
|
811
802
|
|
|
@@ -931,12 +922,6 @@ function getSchemaVariables(schema) {
|
|
|
931
922
|
return Array.from(new Set(variables));
|
|
932
923
|
}
|
|
933
924
|
|
|
934
|
-
// helper ///////////////
|
|
935
|
-
|
|
936
|
-
function isExpression$1(value) {
|
|
937
|
-
return minDash.isString(value) && value.startsWith('=');
|
|
938
|
-
}
|
|
939
|
-
|
|
940
925
|
class Importer {
|
|
941
926
|
/**
|
|
942
927
|
* @constructor
|
|
@@ -1195,7 +1180,7 @@ function formFieldClasses(type, {
|
|
|
1195
1180
|
if (!type) {
|
|
1196
1181
|
throw new Error('type required');
|
|
1197
1182
|
}
|
|
1198
|
-
return
|
|
1183
|
+
return classNames('fjs-form-field', `fjs-form-field-${type}`, {
|
|
1199
1184
|
'fjs-has-errors': errors.length > 0,
|
|
1200
1185
|
'fjs-disabled': disabled
|
|
1201
1186
|
});
|
|
@@ -1207,7 +1192,7 @@ function prefixId(id, formId) {
|
|
|
1207
1192
|
return `fjs-form-${id}`;
|
|
1208
1193
|
}
|
|
1209
1194
|
function markdownToHTML(markdown) {
|
|
1210
|
-
const htmls = markdown.toString().split(/(?:\r?\n){2,}/).map(line => /^((\d+.)|[><\s#-*])/.test(line) ?
|
|
1195
|
+
const htmls = markdown.toString().split(/(?:\r?\n){2,}/).map(line => /^((\d+.)|[><\s#-*])/.test(line) ? snarkdown(line) : `<p>${snarkdown(line)}</p>`);
|
|
1211
1196
|
return htmls.join('\n\n');
|
|
1212
1197
|
}
|
|
1213
1198
|
|
|
@@ -1249,15 +1234,14 @@ function Button(props) {
|
|
|
1249
1234
|
})
|
|
1250
1235
|
});
|
|
1251
1236
|
}
|
|
1252
|
-
Button.create =
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
};
|
|
1257
|
-
};
|
|
1237
|
+
Button.create = (options = {}) => ({
|
|
1238
|
+
action: 'submit',
|
|
1239
|
+
...options
|
|
1240
|
+
});
|
|
1258
1241
|
Button.type = type$b;
|
|
1259
1242
|
Button.label = 'Button';
|
|
1260
1243
|
Button.keyed = true;
|
|
1244
|
+
Button.group = 'action';
|
|
1261
1245
|
|
|
1262
1246
|
const FormRenderContext = preact.createContext({
|
|
1263
1247
|
Empty: props => {
|
|
@@ -1270,6 +1254,7 @@ const FormRenderContext = preact.createContext({
|
|
|
1270
1254
|
return props.children;
|
|
1271
1255
|
}
|
|
1272
1256
|
});
|
|
1257
|
+
var FormRenderContext$1 = FormRenderContext;
|
|
1273
1258
|
|
|
1274
1259
|
/**
|
|
1275
1260
|
* @param {string} type
|
|
@@ -1282,6 +1267,7 @@ const FormContext = preact.createContext({
|
|
|
1282
1267
|
getService,
|
|
1283
1268
|
formId: null
|
|
1284
1269
|
});
|
|
1270
|
+
var FormContext$1 = FormContext;
|
|
1285
1271
|
|
|
1286
1272
|
function Description(props) {
|
|
1287
1273
|
const {
|
|
@@ -1324,7 +1310,7 @@ function Label(props) {
|
|
|
1324
1310
|
} = props;
|
|
1325
1311
|
return jsxRuntime.jsxs("label", {
|
|
1326
1312
|
for: id,
|
|
1327
|
-
class:
|
|
1313
|
+
class: classNames('fjs-form-field-label', {
|
|
1328
1314
|
'fjs-incollapsible-label': !collapseOnEmpty
|
|
1329
1315
|
}, props['class']),
|
|
1330
1316
|
children: [props.children, label || '', required && jsxRuntime.jsx("span", {
|
|
@@ -1357,9 +1343,9 @@ function Checkbox(props) {
|
|
|
1357
1343
|
};
|
|
1358
1344
|
const {
|
|
1359
1345
|
formId
|
|
1360
|
-
} = hooks.useContext(FormContext);
|
|
1346
|
+
} = hooks.useContext(FormContext$1);
|
|
1361
1347
|
return jsxRuntime.jsxs("div", {
|
|
1362
|
-
class:
|
|
1348
|
+
class: classNames(formFieldClasses(type$a, {
|
|
1363
1349
|
errors,
|
|
1364
1350
|
disabled
|
|
1365
1351
|
}), {
|
|
@@ -1384,11 +1370,9 @@ function Checkbox(props) {
|
|
|
1384
1370
|
})]
|
|
1385
1371
|
});
|
|
1386
1372
|
}
|
|
1387
|
-
Checkbox.create =
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
};
|
|
1391
|
-
};
|
|
1373
|
+
Checkbox.create = (options = {}) => ({
|
|
1374
|
+
...options
|
|
1375
|
+
});
|
|
1392
1376
|
Checkbox.type = type$a;
|
|
1393
1377
|
Checkbox.label = 'Checkbox';
|
|
1394
1378
|
Checkbox.keyed = true;
|
|
@@ -1396,11 +1380,12 @@ Checkbox.emptyValue = false;
|
|
|
1396
1380
|
Checkbox.sanitizeValue = ({
|
|
1397
1381
|
value
|
|
1398
1382
|
}) => value === true;
|
|
1383
|
+
Checkbox.group = 'selection';
|
|
1399
1384
|
|
|
1400
1385
|
function useService (type, strict) {
|
|
1401
1386
|
const {
|
|
1402
1387
|
getService
|
|
1403
|
-
} = hooks.useContext(FormContext);
|
|
1388
|
+
} = hooks.useContext(FormContext$1);
|
|
1404
1389
|
return getService(type, strict);
|
|
1405
1390
|
}
|
|
1406
1391
|
|
|
@@ -1497,8 +1482,8 @@ function parseInputTime(stringTime) {
|
|
|
1497
1482
|
if (is12h) {
|
|
1498
1483
|
const isPM = workingString.includes('pm');
|
|
1499
1484
|
const digits = workingString.match(/\d+/g);
|
|
1500
|
-
const displayHour = parseInt(digits
|
|
1501
|
-
const minute = parseInt(digits
|
|
1485
|
+
const displayHour = parseInt(digits && digits[0]);
|
|
1486
|
+
const minute = parseInt(digits && digits[1]) || 0;
|
|
1502
1487
|
const isValidDisplayHour = minDash.isNumber(displayHour) && displayHour >= 1 && displayHour <= 12;
|
|
1503
1488
|
const isValidMinute = minute >= 0 && minute <= 59;
|
|
1504
1489
|
if (!isValidDisplayHour || !isValidMinute) return null;
|
|
@@ -1506,8 +1491,8 @@ function parseInputTime(stringTime) {
|
|
|
1506
1491
|
return hour * 60 + minute;
|
|
1507
1492
|
} else {
|
|
1508
1493
|
const digits = workingString.match(/\d+/g);
|
|
1509
|
-
const hour = parseInt(digits
|
|
1510
|
-
const minute = parseInt(digits
|
|
1494
|
+
const hour = parseInt(digits && digits[0]);
|
|
1495
|
+
const minute = parseInt(digits && digits[1]);
|
|
1511
1496
|
const isValidHour = minDash.isNumber(hour) && hour >= 0 && hour <= 23;
|
|
1512
1497
|
const isValidMinute = minDash.isNumber(minute) && minute >= 0 && minute <= 59;
|
|
1513
1498
|
if (!isValidHour || !isValidMinute) return null;
|
|
@@ -1710,9 +1695,9 @@ function Checklist(props) {
|
|
|
1710
1695
|
} = useValuesAsync(field);
|
|
1711
1696
|
const {
|
|
1712
1697
|
formId
|
|
1713
|
-
} = hooks.useContext(FormContext);
|
|
1698
|
+
} = hooks.useContext(FormContext$1);
|
|
1714
1699
|
return jsxRuntime.jsxs("div", {
|
|
1715
|
-
class:
|
|
1700
|
+
class: classNames(formFieldClasses(type$9, {
|
|
1716
1701
|
errors,
|
|
1717
1702
|
disabled
|
|
1718
1703
|
})),
|
|
@@ -1722,7 +1707,7 @@ function Checklist(props) {
|
|
|
1722
1707
|
return jsxRuntime.jsx(Label, {
|
|
1723
1708
|
id: prefixId(`${id}-${index}`, formId),
|
|
1724
1709
|
label: v.label,
|
|
1725
|
-
class:
|
|
1710
|
+
class: classNames({
|
|
1726
1711
|
'fjs-checked': value.includes(v.value)
|
|
1727
1712
|
}),
|
|
1728
1713
|
required: false,
|
|
@@ -1742,13 +1727,18 @@ function Checklist(props) {
|
|
|
1742
1727
|
})]
|
|
1743
1728
|
});
|
|
1744
1729
|
}
|
|
1745
|
-
Checklist.create =
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1730
|
+
Checklist.create = (options = {}) => {
|
|
1731
|
+
const defaults = {};
|
|
1732
|
+
|
|
1733
|
+
// provide default values if valuesKey isn't set
|
|
1734
|
+
if (!options.valuesKey) {
|
|
1735
|
+
defaults.values = [{
|
|
1749
1736
|
label: 'Value',
|
|
1750
1737
|
value: 'value'
|
|
1751
|
-
}]
|
|
1738
|
+
}];
|
|
1739
|
+
}
|
|
1740
|
+
return {
|
|
1741
|
+
...defaults,
|
|
1752
1742
|
...options
|
|
1753
1743
|
};
|
|
1754
1744
|
};
|
|
@@ -1757,6 +1747,7 @@ Checklist.label = 'Checklist';
|
|
|
1757
1747
|
Checklist.keyed = true;
|
|
1758
1748
|
Checklist.emptyValue = [];
|
|
1759
1749
|
Checklist.sanitizeValue = sanitizeMultiSelectValue;
|
|
1750
|
+
Checklist.group = 'selection';
|
|
1760
1751
|
|
|
1761
1752
|
/**
|
|
1762
1753
|
* Check if condition is met with given variables.
|
|
@@ -1800,7 +1791,7 @@ function FormField(props) {
|
|
|
1800
1791
|
const {
|
|
1801
1792
|
Element,
|
|
1802
1793
|
Empty
|
|
1803
|
-
} = hooks.useContext(FormRenderContext);
|
|
1794
|
+
} = hooks.useContext(FormRenderContext$1);
|
|
1804
1795
|
const FormFieldComponent = formFields.get(field.type);
|
|
1805
1796
|
if (!FormFieldComponent) {
|
|
1806
1797
|
throw new Error(`cannot render field <${field.type}>`);
|
|
@@ -1832,7 +1823,7 @@ function Default(props) {
|
|
|
1832
1823
|
const {
|
|
1833
1824
|
Children,
|
|
1834
1825
|
Empty
|
|
1835
|
-
} = hooks.useContext(FormRenderContext);
|
|
1826
|
+
} = hooks.useContext(FormRenderContext$1);
|
|
1836
1827
|
const {
|
|
1837
1828
|
field
|
|
1838
1829
|
} = props;
|
|
@@ -1851,30 +1842,30 @@ function Default(props) {
|
|
|
1851
1842
|
}), components.length ? null : jsxRuntime.jsx(Empty, {})]
|
|
1852
1843
|
});
|
|
1853
1844
|
}
|
|
1854
|
-
Default.create =
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
};
|
|
1859
|
-
};
|
|
1845
|
+
Default.create = (options = {}) => ({
|
|
1846
|
+
components: [],
|
|
1847
|
+
...options
|
|
1848
|
+
});
|
|
1860
1849
|
Default.type = 'default';
|
|
1861
1850
|
Default.keyed = false;
|
|
1851
|
+
Default.label = null;
|
|
1852
|
+
Default.group = null;
|
|
1862
1853
|
|
|
1863
|
-
function _extends$
|
|
1854
|
+
function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
|
|
1864
1855
|
var CalendarIcon = (({
|
|
1865
1856
|
styles = {},
|
|
1866
1857
|
...props
|
|
1867
|
-
}) => /*#__PURE__*/
|
|
1858
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$j({
|
|
1868
1859
|
width: "14",
|
|
1869
1860
|
height: "15",
|
|
1870
1861
|
viewBox: "0 0 28 30",
|
|
1871
1862
|
fill: "none",
|
|
1872
1863
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1873
|
-
}, props), /*#__PURE__*/
|
|
1864
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
1874
1865
|
fillRule: "evenodd",
|
|
1875
1866
|
clipRule: "evenodd",
|
|
1876
|
-
|
|
1877
|
-
|
|
1867
|
+
fill: "currentColor",
|
|
1868
|
+
d: "M19 2H9V0H7v2H2a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V4a2 2 0 00-2-2h-5V0h-2v2zM7 7V4H2v5h24V4h-5v3h-2V4H9v3H7zm-5 4v17h24V11H2z"
|
|
1878
1869
|
})));
|
|
1879
1870
|
|
|
1880
1871
|
function InputAdorner(props) {
|
|
@@ -1887,10 +1878,10 @@ function InputAdorner(props) {
|
|
|
1887
1878
|
disabled,
|
|
1888
1879
|
hasErrors
|
|
1889
1880
|
} = props;
|
|
1890
|
-
const onAdornmentClick = () => inputRef
|
|
1881
|
+
const onAdornmentClick = () => inputRef && inputRef.current && inputRef.current.focus();
|
|
1891
1882
|
return jsxRuntime.jsxs("div", {
|
|
1892
|
-
class:
|
|
1893
|
-
'disabled': disabled
|
|
1883
|
+
class: classNames('fjs-input-group', {
|
|
1884
|
+
'fjs-disabled': disabled
|
|
1894
1885
|
}, {
|
|
1895
1886
|
'hasErrors': hasErrors
|
|
1896
1887
|
}),
|
|
@@ -1944,15 +1935,11 @@ function Datepicker(props) {
|
|
|
1944
1935
|
dateFormat: 'm/d/Y',
|
|
1945
1936
|
static: true,
|
|
1946
1937
|
clickOpens: false,
|
|
1938
|
+
// TODO: support dates prior to 1900 (https://github.com/bpmn-io/form-js/issues/533)
|
|
1939
|
+
minDate: disallowPassedDates ? 'today' : '01/01/1900',
|
|
1947
1940
|
errorHandler: () => {/* do nothing, we expect the values to sometimes be erronous and we don't want warnings polluting the console */}
|
|
1948
1941
|
};
|
|
1949
|
-
|
|
1950
|
-
config = {
|
|
1951
|
-
...config,
|
|
1952
|
-
minDate: 'today'
|
|
1953
|
-
};
|
|
1954
|
-
}
|
|
1955
|
-
const instance = flatpickr__default['default'](dateInputRef.current, config);
|
|
1942
|
+
const instance = flatpickr(dateInputRef.current, config);
|
|
1956
1943
|
setFlatpickrInstance(instance);
|
|
1957
1944
|
const onCalendarFocusOut = e => {
|
|
1958
1945
|
if (!instance.calendarContainer.contains(e.relatedTarget) && e.relatedTarget != dateInputRef.current) {
|
|
@@ -2035,7 +2022,7 @@ function Datepicker(props) {
|
|
|
2035
2022
|
class: 'fjs-input',
|
|
2036
2023
|
disabled: disabled,
|
|
2037
2024
|
placeholder: "mm/dd/yyyy",
|
|
2038
|
-
autoComplete: "
|
|
2025
|
+
autoComplete: "off",
|
|
2039
2026
|
onFocus: onInputFocus,
|
|
2040
2027
|
onKeyDown: onInputKeyDown,
|
|
2041
2028
|
onMouseDown: e => !flatpickrInstance.isOpen && flatpickrInstance.open(),
|
|
@@ -2048,24 +2035,24 @@ function Datepicker(props) {
|
|
|
2048
2035
|
});
|
|
2049
2036
|
}
|
|
2050
2037
|
|
|
2051
|
-
function _extends$
|
|
2038
|
+
function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
|
|
2052
2039
|
var ClockIcon = (({
|
|
2053
2040
|
styles = {},
|
|
2054
2041
|
...props
|
|
2055
|
-
}) => /*#__PURE__*/
|
|
2042
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$i({
|
|
2056
2043
|
width: "16",
|
|
2057
2044
|
height: "16",
|
|
2058
2045
|
viewBox: "0 0 28 29",
|
|
2059
2046
|
fill: "none",
|
|
2060
2047
|
xmlns: "http://www.w3.org/2000/svg"
|
|
2061
|
-
}, props), /*#__PURE__*/
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
}), /*#__PURE__*/
|
|
2048
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
2049
|
+
fill: "currentColor",
|
|
2050
|
+
d: "M13 14.41L18.59 20 20 18.59l-5-5.01V5h-2v9.41z"
|
|
2051
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
2065
2052
|
fillRule: "evenodd",
|
|
2066
2053
|
clipRule: "evenodd",
|
|
2067
|
-
|
|
2068
|
-
|
|
2054
|
+
fill: "currentColor",
|
|
2055
|
+
d: "M6.222 25.64A14 14 0 1021.778 2.36 14 14 0 006.222 25.64zM7.333 4.023a12 12 0 1113.334 19.955A12 12 0 017.333 4.022z"
|
|
2069
2056
|
})));
|
|
2070
2057
|
|
|
2071
2058
|
function useKeyDownAction(targetKey, action, listenerElement = window) {
|
|
@@ -2088,7 +2075,7 @@ const DEFAULT_LABEL_GETTER = value => value;
|
|
|
2088
2075
|
const NOOP = () => {};
|
|
2089
2076
|
function DropdownList(props) {
|
|
2090
2077
|
const {
|
|
2091
|
-
|
|
2078
|
+
listenerElement = window,
|
|
2092
2079
|
values = [],
|
|
2093
2080
|
getLabel = DEFAULT_LABEL_GETTER,
|
|
2094
2081
|
onValueSelected = NOOP,
|
|
@@ -2118,18 +2105,18 @@ function DropdownList(props) {
|
|
|
2118
2105
|
changeFocusedValueIndex(-1);
|
|
2119
2106
|
setMouseControl(false);
|
|
2120
2107
|
}
|
|
2121
|
-
},
|
|
2108
|
+
}, listenerElement);
|
|
2122
2109
|
useKeyDownAction('ArrowDown', () => {
|
|
2123
2110
|
if (values.length) {
|
|
2124
2111
|
changeFocusedValueIndex(1);
|
|
2125
2112
|
setMouseControl(false);
|
|
2126
2113
|
}
|
|
2127
|
-
},
|
|
2114
|
+
}, listenerElement);
|
|
2128
2115
|
useKeyDownAction('Enter', () => {
|
|
2129
2116
|
if (focusedItem) {
|
|
2130
2117
|
onValueSelected(focusedItem);
|
|
2131
2118
|
}
|
|
2132
|
-
},
|
|
2119
|
+
}, listenerElement);
|
|
2133
2120
|
hooks.useEffect(() => {
|
|
2134
2121
|
const individualEntries = dropdownContainer.current.children;
|
|
2135
2122
|
if (individualEntries.length && !mouseControl) {
|
|
@@ -2164,7 +2151,7 @@ function DropdownList(props) {
|
|
|
2164
2151
|
},
|
|
2165
2152
|
children: [values.length > 0 && values.map((v, i) => {
|
|
2166
2153
|
return jsxRuntime.jsx("div", {
|
|
2167
|
-
class:
|
|
2154
|
+
class: classNames('fjs-dropdownlist-item', {
|
|
2168
2155
|
'focused': focusedValueIndex === i
|
|
2169
2156
|
}),
|
|
2170
2157
|
onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, i),
|
|
@@ -2302,7 +2289,7 @@ function Timepicker(props) {
|
|
|
2302
2289
|
value: rawValue,
|
|
2303
2290
|
disabled: disabled,
|
|
2304
2291
|
placeholder: use24h ? 'hh:mm' : 'hh:mm ?m',
|
|
2305
|
-
autoComplete: "
|
|
2292
|
+
autoComplete: "off",
|
|
2306
2293
|
onFocus: () => useDropdown && setDropdownIsOpen(true),
|
|
2307
2294
|
onClick: () => useDropdown && setDropdownIsOpen(true)
|
|
2308
2295
|
|
|
@@ -2353,7 +2340,7 @@ function Datetime(props) {
|
|
|
2353
2340
|
} = validate;
|
|
2354
2341
|
const {
|
|
2355
2342
|
formId
|
|
2356
|
-
} = hooks.useContext(FormContext);
|
|
2343
|
+
} = hooks.useContext(FormContext$1);
|
|
2357
2344
|
const getNullDateTime = () => ({
|
|
2358
2345
|
date: new Date(Date.parse(null)),
|
|
2359
2346
|
time: null
|
|
@@ -2479,7 +2466,7 @@ function Datetime(props) {
|
|
|
2479
2466
|
disabled
|
|
2480
2467
|
}),
|
|
2481
2468
|
children: [jsxRuntime.jsxs("div", {
|
|
2482
|
-
class:
|
|
2469
|
+
class: classNames('fjs-vertical-group'),
|
|
2483
2470
|
children: [useDatePicker && jsxRuntime.jsx(Datepicker, {
|
|
2484
2471
|
...datePickerProps
|
|
2485
2472
|
}), useTimePicker && useDatePicker && jsxRuntime.jsx("div", {
|
|
@@ -2494,12 +2481,12 @@ function Datetime(props) {
|
|
|
2494
2481
|
})]
|
|
2495
2482
|
});
|
|
2496
2483
|
}
|
|
2497
|
-
Datetime.create =
|
|
2498
|
-
const
|
|
2499
|
-
minDash.set(
|
|
2500
|
-
minDash.set(
|
|
2484
|
+
Datetime.create = (options = {}) => {
|
|
2485
|
+
const defaults = {};
|
|
2486
|
+
minDash.set(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
|
|
2487
|
+
minDash.set(defaults, DATE_LABEL_PATH, 'Date');
|
|
2501
2488
|
return {
|
|
2502
|
-
...
|
|
2489
|
+
...defaults,
|
|
2503
2490
|
...options
|
|
2504
2491
|
};
|
|
2505
2492
|
};
|
|
@@ -2507,6 +2494,8 @@ Datetime.type = type$8;
|
|
|
2507
2494
|
Datetime.keyed = true;
|
|
2508
2495
|
Datetime.emptyValue = null;
|
|
2509
2496
|
Datetime.sanitizeValue = sanitizeDateTimePickerValue;
|
|
2497
|
+
Datetime.label = 'Date time';
|
|
2498
|
+
Datetime.group = 'basic-input';
|
|
2510
2499
|
|
|
2511
2500
|
/**
|
|
2512
2501
|
* This file must not be changed or exchanged.
|
|
@@ -2670,11 +2659,11 @@ function isExpression(value) {
|
|
|
2670
2659
|
return minDash.isString(value) && value.startsWith('=');
|
|
2671
2660
|
}
|
|
2672
2661
|
|
|
2673
|
-
function _extends$
|
|
2662
|
+
function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
|
|
2674
2663
|
var ImagePlaceholder = (({
|
|
2675
2664
|
styles = {},
|
|
2676
2665
|
...props
|
|
2677
|
-
}) => /*#__PURE__*/
|
|
2666
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$h({
|
|
2678
2667
|
width: "64",
|
|
2679
2668
|
height: "64",
|
|
2680
2669
|
viewBox: "0 0 1280 1280",
|
|
@@ -2683,16 +2672,16 @@ var ImagePlaceholder = (({
|
|
|
2683
2672
|
clipRule: "evenodd",
|
|
2684
2673
|
strokeLinejoin: "round",
|
|
2685
2674
|
strokeMiterlimit: "2"
|
|
2686
|
-
}, props), /*#__PURE__*/
|
|
2675
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
2687
2676
|
fill: "#e5e9ed",
|
|
2688
2677
|
d: "M0 0h1280v1280H0z"
|
|
2689
|
-
}), /*#__PURE__*/
|
|
2678
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
2690
2679
|
d: "M910 410H370v470h540V410zm-57.333 57.333v355.334H427.333V467.333h425.334z",
|
|
2691
2680
|
fill: "#cad3db"
|
|
2692
|
-
}), /*#__PURE__*/
|
|
2681
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
2693
2682
|
d: "M810 770H480v-60l100-170 130 170 100-65v125z",
|
|
2694
2683
|
fill: "#cad3db"
|
|
2695
|
-
}), /*#__PURE__*/
|
|
2684
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
2696
2685
|
cx: "750",
|
|
2697
2686
|
cy: "550",
|
|
2698
2687
|
r: "50",
|
|
@@ -2714,7 +2703,7 @@ function Image(props) {
|
|
|
2714
2703
|
const altText = useExpressionValue(alt);
|
|
2715
2704
|
const {
|
|
2716
2705
|
formId
|
|
2717
|
-
} = hooks.useContext(FormContext);
|
|
2706
|
+
} = hooks.useContext(FormContext$1);
|
|
2718
2707
|
return jsxRuntime.jsx("div", {
|
|
2719
2708
|
class: formFieldClasses(type$7),
|
|
2720
2709
|
children: jsxRuntime.jsxs("div", {
|
|
@@ -2733,13 +2722,47 @@ function Image(props) {
|
|
|
2733
2722
|
})
|
|
2734
2723
|
});
|
|
2735
2724
|
}
|
|
2736
|
-
Image.create =
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
};
|
|
2740
|
-
};
|
|
2725
|
+
Image.create = (options = {}) => ({
|
|
2726
|
+
...options
|
|
2727
|
+
});
|
|
2741
2728
|
Image.type = type$7;
|
|
2742
2729
|
Image.keyed = false;
|
|
2730
|
+
Image.label = 'Image view';
|
|
2731
|
+
Image.group = 'presentation';
|
|
2732
|
+
|
|
2733
|
+
function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
|
|
2734
|
+
var AngelDownIcon = (({
|
|
2735
|
+
styles = {},
|
|
2736
|
+
...props
|
|
2737
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$g({
|
|
2738
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2739
|
+
width: "8",
|
|
2740
|
+
height: "8"
|
|
2741
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
2742
|
+
fillRule: "evenodd",
|
|
2743
|
+
clipRule: "evenodd",
|
|
2744
|
+
fill: "currentColor",
|
|
2745
|
+
stroke: "currentColor",
|
|
2746
|
+
strokeWidth: ".5",
|
|
2747
|
+
d: "M7.75 1.336L4 6.125.258 1.335 0 1.54l4 5.125L8 1.54zm0 0"
|
|
2748
|
+
})));
|
|
2749
|
+
|
|
2750
|
+
function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
|
|
2751
|
+
var AngelUpIcon = (({
|
|
2752
|
+
styles = {},
|
|
2753
|
+
...props
|
|
2754
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$f({
|
|
2755
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2756
|
+
width: "8",
|
|
2757
|
+
height: "8"
|
|
2758
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
2759
|
+
fillRule: "evenodd",
|
|
2760
|
+
clipRule: "evenodd",
|
|
2761
|
+
fill: "currentColor",
|
|
2762
|
+
stroke: "currentColor",
|
|
2763
|
+
strokeWidth: ".5",
|
|
2764
|
+
d: "M7.75 6.664L4 1.875.258 6.665 0 6.46l4-5.125L8 6.46zm0 0"
|
|
2765
|
+
})));
|
|
2743
2766
|
|
|
2744
2767
|
const type$6 = 'number';
|
|
2745
2768
|
function Numberfield(props) {
|
|
@@ -2782,12 +2805,12 @@ function Numberfield(props) {
|
|
|
2782
2805
|
const displayValue = hooks.useMemo(() => {
|
|
2783
2806
|
if (value === 'NaN') return 'NaN';
|
|
2784
2807
|
if (stringValueCache === '-') return '-';
|
|
2785
|
-
return cacheValueMatchesState ? stringValueCache : value || value === 0 ?
|
|
2808
|
+
return cacheValueMatchesState ? stringValueCache : value || value === 0 ? Big(value).toFixed() : '';
|
|
2786
2809
|
}, [stringValueCache, value, cacheValueMatchesState]);
|
|
2787
2810
|
const arrowIncrementValue = hooks.useMemo(() => {
|
|
2788
|
-
if (incrementValue) return
|
|
2789
|
-
if (decimalDigits) return
|
|
2790
|
-
return
|
|
2811
|
+
if (incrementValue) return Big(incrementValue);
|
|
2812
|
+
if (decimalDigits) return Big(`1e-${decimalDigits}`);
|
|
2813
|
+
return Big('1');
|
|
2791
2814
|
}, [decimalDigits, incrementValue]);
|
|
2792
2815
|
const setValue = hooks.useCallback(stringValue => {
|
|
2793
2816
|
if (isNullEquivalentValue(stringValue)) {
|
|
@@ -2820,14 +2843,14 @@ function Numberfield(props) {
|
|
|
2820
2843
|
});
|
|
2821
2844
|
}, [field, onChange, serializeToString]);
|
|
2822
2845
|
const increment = () => {
|
|
2823
|
-
const base = isValidNumber(value) ?
|
|
2846
|
+
const base = isValidNumber(value) ? Big(value) : Big(0);
|
|
2824
2847
|
const stepFlooredValue = base.minus(base.mod(arrowIncrementValue));
|
|
2825
2848
|
|
|
2826
2849
|
// note: toFixed() behaves differently in big.js
|
|
2827
2850
|
setValue(stepFlooredValue.plus(arrowIncrementValue).toFixed());
|
|
2828
2851
|
};
|
|
2829
2852
|
const decrement = () => {
|
|
2830
|
-
const base = isValidNumber(value) ?
|
|
2853
|
+
const base = isValidNumber(value) ? Big(value) : Big(0);
|
|
2831
2854
|
const offset = base.mod(arrowIncrementValue);
|
|
2832
2855
|
if (offset.cmp(0) === 0) {
|
|
2833
2856
|
// if we're already on a valid step, decrement
|
|
@@ -2868,7 +2891,7 @@ function Numberfield(props) {
|
|
|
2868
2891
|
};
|
|
2869
2892
|
const {
|
|
2870
2893
|
formId
|
|
2871
|
-
} = hooks.useContext(FormContext);
|
|
2894
|
+
} = hooks.useContext(FormContext$1);
|
|
2872
2895
|
return jsxRuntime.jsxs("div", {
|
|
2873
2896
|
class: formFieldClasses(type$6, {
|
|
2874
2897
|
errors,
|
|
@@ -2883,8 +2906,8 @@ function Numberfield(props) {
|
|
|
2883
2906
|
pre: prefixAdorner,
|
|
2884
2907
|
post: suffixAdorner,
|
|
2885
2908
|
children: jsxRuntime.jsxs("div", {
|
|
2886
|
-
class:
|
|
2887
|
-
'disabled': disabled
|
|
2909
|
+
class: classNames('fjs-vertical-group', {
|
|
2910
|
+
'fjs-disabled': disabled
|
|
2888
2911
|
}, {
|
|
2889
2912
|
'hasErrors': errors.length
|
|
2890
2913
|
}),
|
|
@@ -2904,23 +2927,25 @@ function Numberfield(props) {
|
|
|
2904
2927
|
step: arrowIncrementValue,
|
|
2905
2928
|
value: displayValue
|
|
2906
2929
|
}), jsxRuntime.jsxs("div", {
|
|
2907
|
-
class:
|
|
2908
|
-
'disabled': disabled
|
|
2930
|
+
class: classNames('fjs-number-arrow-container', {
|
|
2931
|
+
'fjs-disabled': disabled
|
|
2909
2932
|
}),
|
|
2910
2933
|
children: [jsxRuntime.jsx("button", {
|
|
2911
2934
|
class: "fjs-number-arrow-up",
|
|
2912
2935
|
type: "button",
|
|
2936
|
+
"aria-label": "Increment",
|
|
2913
2937
|
onClick: () => increment(),
|
|
2914
2938
|
tabIndex: -1,
|
|
2915
|
-
children:
|
|
2939
|
+
children: jsxRuntime.jsx(AngelUpIcon, {})
|
|
2916
2940
|
}), jsxRuntime.jsx("div", {
|
|
2917
2941
|
class: "fjs-number-arrow-separator"
|
|
2918
2942
|
}), jsxRuntime.jsx("button", {
|
|
2919
2943
|
class: "fjs-number-arrow-down",
|
|
2920
2944
|
type: "button",
|
|
2945
|
+
"aria-label": "Decrement",
|
|
2921
2946
|
onClick: () => decrement(),
|
|
2922
2947
|
tabIndex: -1,
|
|
2923
|
-
children:
|
|
2948
|
+
children: jsxRuntime.jsx(AngelDownIcon, {})
|
|
2924
2949
|
})]
|
|
2925
2950
|
})]
|
|
2926
2951
|
})
|
|
@@ -2931,7 +2956,9 @@ function Numberfield(props) {
|
|
|
2931
2956
|
})]
|
|
2932
2957
|
});
|
|
2933
2958
|
}
|
|
2934
|
-
Numberfield.create = (options = {}) =>
|
|
2959
|
+
Numberfield.create = (options = {}) => ({
|
|
2960
|
+
...options
|
|
2961
|
+
});
|
|
2935
2962
|
Numberfield.sanitizeValue = ({
|
|
2936
2963
|
value,
|
|
2937
2964
|
formField
|
|
@@ -2949,6 +2976,7 @@ Numberfield.type = type$6;
|
|
|
2949
2976
|
Numberfield.keyed = true;
|
|
2950
2977
|
Numberfield.label = 'Number';
|
|
2951
2978
|
Numberfield.emptyValue = null;
|
|
2979
|
+
Numberfield.group = 'basic-input';
|
|
2952
2980
|
|
|
2953
2981
|
const type$5 = 'radio';
|
|
2954
2982
|
function Radio(props) {
|
|
@@ -2979,7 +3007,7 @@ function Radio(props) {
|
|
|
2979
3007
|
} = useValuesAsync(field);
|
|
2980
3008
|
const {
|
|
2981
3009
|
formId
|
|
2982
|
-
} = hooks.useContext(FormContext);
|
|
3010
|
+
} = hooks.useContext(FormContext$1);
|
|
2983
3011
|
return jsxRuntime.jsxs("div", {
|
|
2984
3012
|
class: formFieldClasses(type$5, {
|
|
2985
3013
|
errors,
|
|
@@ -2992,7 +3020,7 @@ function Radio(props) {
|
|
|
2992
3020
|
return jsxRuntime.jsx(Label, {
|
|
2993
3021
|
id: prefixId(`${id}-${index}`, formId),
|
|
2994
3022
|
label: option.label,
|
|
2995
|
-
class:
|
|
3023
|
+
class: classNames({
|
|
2996
3024
|
'fjs-checked': option.value === value
|
|
2997
3025
|
}),
|
|
2998
3026
|
required: false,
|
|
@@ -3013,12 +3041,17 @@ function Radio(props) {
|
|
|
3013
3041
|
});
|
|
3014
3042
|
}
|
|
3015
3043
|
Radio.create = function (options = {}) {
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3044
|
+
const defaults = {};
|
|
3045
|
+
|
|
3046
|
+
// provide default values if valuesKey isn't set
|
|
3047
|
+
if (!options.valuesKey) {
|
|
3048
|
+
defaults.values = [{
|
|
3019
3049
|
label: 'Value',
|
|
3020
3050
|
value: 'value'
|
|
3021
|
-
}]
|
|
3051
|
+
}];
|
|
3052
|
+
}
|
|
3053
|
+
return {
|
|
3054
|
+
...defaults,
|
|
3022
3055
|
...options
|
|
3023
3056
|
};
|
|
3024
3057
|
};
|
|
@@ -3027,6 +3060,266 @@ Radio.label = 'Radio';
|
|
|
3027
3060
|
Radio.keyed = true;
|
|
3028
3061
|
Radio.emptyValue = null;
|
|
3029
3062
|
Radio.sanitizeValue = sanitizeSingleSelectValue;
|
|
3063
|
+
Radio.group = 'selection';
|
|
3064
|
+
|
|
3065
|
+
function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
|
|
3066
|
+
var XMarkIcon = (({
|
|
3067
|
+
styles = {},
|
|
3068
|
+
...props
|
|
3069
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$e({
|
|
3070
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3071
|
+
width: "8",
|
|
3072
|
+
height: "8"
|
|
3073
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3074
|
+
fillRule: "evenodd",
|
|
3075
|
+
clipRule: "evenodd",
|
|
3076
|
+
fill: "currentColor",
|
|
3077
|
+
stroke: "currentColor",
|
|
3078
|
+
strokeWidth: ".5",
|
|
3079
|
+
d: "M4 3.766L7.43.336l.234.234L4.234 4l3.43 3.43-.234.234L4 4.234.57 7.664.336 7.43 3.766 4 .336.57.57.336zm0 0"
|
|
3080
|
+
})));
|
|
3081
|
+
|
|
3082
|
+
function SearchableSelect(props) {
|
|
3083
|
+
const {
|
|
3084
|
+
id,
|
|
3085
|
+
disabled,
|
|
3086
|
+
errors,
|
|
3087
|
+
field,
|
|
3088
|
+
value
|
|
3089
|
+
} = props;
|
|
3090
|
+
const {
|
|
3091
|
+
formId
|
|
3092
|
+
} = hooks.useContext(FormContext$1);
|
|
3093
|
+
const [filter, setFilter] = hooks.useState('');
|
|
3094
|
+
const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
|
|
3095
|
+
const [shouldApplyFilter, setShouldApplyFilter] = hooks.useState(true);
|
|
3096
|
+
const [isEscapeClosed, setIsEscapeClose] = hooks.useState(false);
|
|
3097
|
+
const searchbarRef = hooks.useRef();
|
|
3098
|
+
const {
|
|
3099
|
+
state: loadState,
|
|
3100
|
+
values: options
|
|
3101
|
+
} = useValuesAsync(field);
|
|
3102
|
+
|
|
3103
|
+
// We cache a map of option values to their index so that we don't need to search the whole options array every time to correlate the label
|
|
3104
|
+
const valueToOptionMap = hooks.useMemo(() => Object.assign({}, ...options.map((o, x) => ({
|
|
3105
|
+
[o.value]: options[x]
|
|
3106
|
+
}))), [options]);
|
|
3107
|
+
const valueLabel = hooks.useMemo(() => value && valueToOptionMap[value] && valueToOptionMap[value].label || '', [value, valueToOptionMap]);
|
|
3108
|
+
|
|
3109
|
+
// whenever we change the underlying value, set the label to it
|
|
3110
|
+
hooks.useEffect(() => {
|
|
3111
|
+
setFilter(valueLabel);
|
|
3112
|
+
}, [valueLabel]);
|
|
3113
|
+
const filteredOptions = hooks.useMemo(() => {
|
|
3114
|
+
if (loadState === LOAD_STATES.LOADED) {
|
|
3115
|
+
return shouldApplyFilter ? options.filter(o => o.label && o.value && o.label.toLowerCase().includes(filter.toLowerCase())) : options;
|
|
3116
|
+
}
|
|
3117
|
+
return [];
|
|
3118
|
+
}, [filter, loadState, options, shouldApplyFilter]);
|
|
3119
|
+
const onChange = ({
|
|
3120
|
+
target
|
|
3121
|
+
}) => {
|
|
3122
|
+
setIsEscapeClose(false);
|
|
3123
|
+
setIsDropdownExpanded(true);
|
|
3124
|
+
setShouldApplyFilter(true);
|
|
3125
|
+
setFilter(target.value || '');
|
|
3126
|
+
};
|
|
3127
|
+
const setValue = hooks.useCallback(option => {
|
|
3128
|
+
setFilter(option && option.label || '');
|
|
3129
|
+
props.onChange({
|
|
3130
|
+
value: option && option.value || null,
|
|
3131
|
+
field
|
|
3132
|
+
});
|
|
3133
|
+
}, [field, props]);
|
|
3134
|
+
const onInputKeyDown = hooks.useCallback(keyDownEvent => {
|
|
3135
|
+
switch (keyDownEvent.key) {
|
|
3136
|
+
case 'ArrowUp':
|
|
3137
|
+
keyDownEvent.preventDefault();
|
|
3138
|
+
break;
|
|
3139
|
+
case 'ArrowDown':
|
|
3140
|
+
{
|
|
3141
|
+
if (!isDropdownExpanded) {
|
|
3142
|
+
setIsDropdownExpanded(true);
|
|
3143
|
+
setShouldApplyFilter(false);
|
|
3144
|
+
}
|
|
3145
|
+
keyDownEvent.preventDefault();
|
|
3146
|
+
break;
|
|
3147
|
+
}
|
|
3148
|
+
case 'Escape':
|
|
3149
|
+
setIsEscapeClose(true);
|
|
3150
|
+
break;
|
|
3151
|
+
case 'Enter':
|
|
3152
|
+
if (isEscapeClosed) {
|
|
3153
|
+
setIsEscapeClose(false);
|
|
3154
|
+
}
|
|
3155
|
+
break;
|
|
3156
|
+
}
|
|
3157
|
+
}, [isDropdownExpanded, isEscapeClosed]);
|
|
3158
|
+
const displayState = hooks.useMemo(() => {
|
|
3159
|
+
const ds = {};
|
|
3160
|
+
ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
|
|
3161
|
+
ds.displayCross = ds.componentReady && value !== null && value !== undefined;
|
|
3162
|
+
ds.displayDropdown = !disabled && isDropdownExpanded && !isEscapeClosed;
|
|
3163
|
+
return ds;
|
|
3164
|
+
}, [disabled, isDropdownExpanded, isEscapeClosed, loadState, value]);
|
|
3165
|
+
const onAngelMouseDown = hooks.useCallback(e => {
|
|
3166
|
+
setIsEscapeClose(false);
|
|
3167
|
+
setIsDropdownExpanded(!isDropdownExpanded);
|
|
3168
|
+
const searchbar = searchbarRef.current;
|
|
3169
|
+
isDropdownExpanded ? searchbar.blur() : searchbar.focus();
|
|
3170
|
+
e.preventDefault();
|
|
3171
|
+
}, [isDropdownExpanded]);
|
|
3172
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3173
|
+
children: [jsxRuntime.jsxs("div", {
|
|
3174
|
+
id: prefixId(`${id}`, formId),
|
|
3175
|
+
class: classNames('fjs-input-group', {
|
|
3176
|
+
'disabled': disabled
|
|
3177
|
+
}, {
|
|
3178
|
+
'hasErrors': errors.length
|
|
3179
|
+
}),
|
|
3180
|
+
children: [jsxRuntime.jsx("input", {
|
|
3181
|
+
disabled: disabled,
|
|
3182
|
+
class: "fjs-input",
|
|
3183
|
+
ref: searchbarRef,
|
|
3184
|
+
id: prefixId(`${id}-search`, formId),
|
|
3185
|
+
onChange: onChange,
|
|
3186
|
+
type: "text",
|
|
3187
|
+
value: filter,
|
|
3188
|
+
placeholder: 'Search',
|
|
3189
|
+
autoComplete: "off",
|
|
3190
|
+
onKeyDown: e => onInputKeyDown(e),
|
|
3191
|
+
onMouseDown: () => {
|
|
3192
|
+
setIsEscapeClose(false);
|
|
3193
|
+
setIsDropdownExpanded(true);
|
|
3194
|
+
setShouldApplyFilter(false);
|
|
3195
|
+
},
|
|
3196
|
+
onFocus: () => {
|
|
3197
|
+
setIsDropdownExpanded(true);
|
|
3198
|
+
setShouldApplyFilter(false);
|
|
3199
|
+
},
|
|
3200
|
+
onBlur: () => {
|
|
3201
|
+
setIsDropdownExpanded(false);
|
|
3202
|
+
setFilter(valueLabel);
|
|
3203
|
+
}
|
|
3204
|
+
}), displayState.displayCross && jsxRuntime.jsxs("span", {
|
|
3205
|
+
class: "fjs-select-cross",
|
|
3206
|
+
onMouseDown: e => {
|
|
3207
|
+
setValue(null);
|
|
3208
|
+
e.preventDefault();
|
|
3209
|
+
},
|
|
3210
|
+
children: [jsxRuntime.jsx(XMarkIcon, {}), " "]
|
|
3211
|
+
}), jsxRuntime.jsx("span", {
|
|
3212
|
+
class: "fjs-select-arrow",
|
|
3213
|
+
onMouseDown: e => onAngelMouseDown(e),
|
|
3214
|
+
children: displayState.displayDropdown ? jsxRuntime.jsx(AngelUpIcon, {}) : jsxRuntime.jsx(AngelDownIcon, {})
|
|
3215
|
+
})]
|
|
3216
|
+
}), jsxRuntime.jsx("div", {
|
|
3217
|
+
class: "fjs-select-anchor",
|
|
3218
|
+
children: displayState.displayDropdown && jsxRuntime.jsx(DropdownList, {
|
|
3219
|
+
values: filteredOptions,
|
|
3220
|
+
getLabel: o => o.label,
|
|
3221
|
+
onValueSelected: o => {
|
|
3222
|
+
setValue(o);
|
|
3223
|
+
setIsDropdownExpanded(false);
|
|
3224
|
+
},
|
|
3225
|
+
listenerElement: searchbarRef.current
|
|
3226
|
+
})
|
|
3227
|
+
})]
|
|
3228
|
+
});
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
function SimpleSelect(props) {
|
|
3232
|
+
const {
|
|
3233
|
+
id,
|
|
3234
|
+
disabled,
|
|
3235
|
+
errors,
|
|
3236
|
+
field,
|
|
3237
|
+
value
|
|
3238
|
+
} = props;
|
|
3239
|
+
const {
|
|
3240
|
+
formId
|
|
3241
|
+
} = hooks.useContext(FormContext$1);
|
|
3242
|
+
const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
|
|
3243
|
+
const selectRef = hooks.useRef();
|
|
3244
|
+
const {
|
|
3245
|
+
state: loadState,
|
|
3246
|
+
values: options
|
|
3247
|
+
} = useValuesAsync(field);
|
|
3248
|
+
|
|
3249
|
+
// We cache a map of option values to their index so that we don't need to search the whole options array every time to correlate the label
|
|
3250
|
+
const valueToOptionMap = hooks.useMemo(() => Object.assign({}, ...options.map((o, x) => ({
|
|
3251
|
+
[o.value]: options[x]
|
|
3252
|
+
}))), [options]);
|
|
3253
|
+
const valueLabel = hooks.useMemo(() => value && valueToOptionMap[value] && valueToOptionMap[value].label || '', [value, valueToOptionMap]);
|
|
3254
|
+
const setValue = hooks.useCallback(option => {
|
|
3255
|
+
props.onChange({
|
|
3256
|
+
value: option && option.value || null,
|
|
3257
|
+
field
|
|
3258
|
+
});
|
|
3259
|
+
}, [field, props]);
|
|
3260
|
+
const displayState = hooks.useMemo(() => {
|
|
3261
|
+
const ds = {};
|
|
3262
|
+
ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
|
|
3263
|
+
ds.displayCross = ds.componentReady && value !== null && value !== undefined;
|
|
3264
|
+
ds.displayDropdown = !disabled && isDropdownExpanded;
|
|
3265
|
+
return ds;
|
|
3266
|
+
}, [disabled, isDropdownExpanded, loadState, value]);
|
|
3267
|
+
const onMouseDown = hooks.useCallback(e => {
|
|
3268
|
+
const select = selectRef.current;
|
|
3269
|
+
setIsDropdownExpanded(!isDropdownExpanded);
|
|
3270
|
+
if (isDropdownExpanded) {
|
|
3271
|
+
select.blur();
|
|
3272
|
+
} else {
|
|
3273
|
+
select.focus();
|
|
3274
|
+
}
|
|
3275
|
+
e.preventDefault();
|
|
3276
|
+
}, [isDropdownExpanded]);
|
|
3277
|
+
const initialFocusIndex = hooks.useMemo(() => value && minDash.findIndex(options, o => o.value === value) || 0, [options, value]);
|
|
3278
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3279
|
+
children: [jsxRuntime.jsxs("div", {
|
|
3280
|
+
ref: selectRef,
|
|
3281
|
+
id: prefixId(`${id}`, formId),
|
|
3282
|
+
class: classNames('fjs-input-group', {
|
|
3283
|
+
'disabled': disabled
|
|
3284
|
+
}, {
|
|
3285
|
+
'hasErrors': errors.length
|
|
3286
|
+
}),
|
|
3287
|
+
onFocus: () => setIsDropdownExpanded(true),
|
|
3288
|
+
onBlur: () => setIsDropdownExpanded(false),
|
|
3289
|
+
onMouseDown: e => onMouseDown(e),
|
|
3290
|
+
tabIndex: disabled ? undefined : 0,
|
|
3291
|
+
children: [jsxRuntime.jsx("div", {
|
|
3292
|
+
class: classNames('fjs-select-display', {
|
|
3293
|
+
'fjs-select-placeholder': !value
|
|
3294
|
+
}),
|
|
3295
|
+
id: prefixId(`${id}-display`, formId),
|
|
3296
|
+
children: valueLabel || 'Select'
|
|
3297
|
+
}), displayState.displayCross && jsxRuntime.jsx("span", {
|
|
3298
|
+
class: "fjs-select-cross",
|
|
3299
|
+
onMouseDown: e => {
|
|
3300
|
+
setValue(null);
|
|
3301
|
+
e.stopPropagation();
|
|
3302
|
+
},
|
|
3303
|
+
children: jsxRuntime.jsx(XMarkIcon, {})
|
|
3304
|
+
}), jsxRuntime.jsx("span", {
|
|
3305
|
+
class: "fjs-select-arrow",
|
|
3306
|
+
children: displayState.displayDropdown ? jsxRuntime.jsx(AngelUpIcon, {}) : jsxRuntime.jsx(AngelDownIcon, {})
|
|
3307
|
+
})]
|
|
3308
|
+
}), jsxRuntime.jsx("div", {
|
|
3309
|
+
class: "fjs-select-anchor",
|
|
3310
|
+
children: displayState.displayDropdown && jsxRuntime.jsx(DropdownList, {
|
|
3311
|
+
values: options,
|
|
3312
|
+
getLabel: o => o.label,
|
|
3313
|
+
initialFocusIndex: initialFocusIndex,
|
|
3314
|
+
onValueSelected: o => {
|
|
3315
|
+
setValue(o);
|
|
3316
|
+
setIsDropdownExpanded(false);
|
|
3317
|
+
},
|
|
3318
|
+
listenerElement: selectRef.current
|
|
3319
|
+
})
|
|
3320
|
+
})]
|
|
3321
|
+
});
|
|
3322
|
+
}
|
|
3030
3323
|
|
|
3031
3324
|
const type$4 = 'select';
|
|
3032
3325
|
function Select(props) {
|
|
@@ -3034,32 +3327,30 @@ function Select(props) {
|
|
|
3034
3327
|
disabled,
|
|
3035
3328
|
errors = [],
|
|
3036
3329
|
field,
|
|
3330
|
+
onChange,
|
|
3037
3331
|
value
|
|
3038
3332
|
} = props;
|
|
3039
3333
|
const {
|
|
3040
3334
|
description,
|
|
3041
3335
|
id,
|
|
3042
3336
|
label,
|
|
3337
|
+
searchable = false,
|
|
3043
3338
|
validate = {}
|
|
3044
3339
|
} = field;
|
|
3045
3340
|
const {
|
|
3046
3341
|
required
|
|
3047
3342
|
} = validate;
|
|
3048
|
-
const onChange = ({
|
|
3049
|
-
target
|
|
3050
|
-
}) => {
|
|
3051
|
-
props.onChange({
|
|
3052
|
-
field,
|
|
3053
|
-
value: target.value === '' ? null : target.value
|
|
3054
|
-
});
|
|
3055
|
-
};
|
|
3056
|
-
const {
|
|
3057
|
-
state: loadState,
|
|
3058
|
-
values: options
|
|
3059
|
-
} = useValuesAsync(field);
|
|
3060
3343
|
const {
|
|
3061
3344
|
formId
|
|
3062
|
-
} = hooks.useContext(FormContext);
|
|
3345
|
+
} = hooks.useContext(FormContext$1);
|
|
3346
|
+
const selectProps = hooks.useMemo(() => ({
|
|
3347
|
+
id,
|
|
3348
|
+
disabled,
|
|
3349
|
+
errors,
|
|
3350
|
+
field,
|
|
3351
|
+
value,
|
|
3352
|
+
onChange
|
|
3353
|
+
}), [disabled, errors, field, id, value, onChange]);
|
|
3063
3354
|
return jsxRuntime.jsxs("div", {
|
|
3064
3355
|
class: formFieldClasses(type$4, {
|
|
3065
3356
|
errors,
|
|
@@ -3069,20 +3360,10 @@ function Select(props) {
|
|
|
3069
3360
|
id: prefixId(id, formId),
|
|
3070
3361
|
label: label,
|
|
3071
3362
|
required: required
|
|
3072
|
-
}), jsxRuntime.
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
onChange: onChange,
|
|
3077
|
-
value: value || '',
|
|
3078
|
-
children: [jsxRuntime.jsx("option", {
|
|
3079
|
-
value: ""
|
|
3080
|
-
}), loadState == LOAD_STATES.LOADED && options.map((option, index) => {
|
|
3081
|
-
return jsxRuntime.jsx("option", {
|
|
3082
|
-
value: option.value,
|
|
3083
|
-
children: option.label
|
|
3084
|
-
}, `${id}-${index}`);
|
|
3085
|
-
})]
|
|
3363
|
+
}), searchable ? jsxRuntime.jsx(SearchableSelect, {
|
|
3364
|
+
...selectProps
|
|
3365
|
+
}) : jsxRuntime.jsx(SimpleSelect, {
|
|
3366
|
+
...selectProps
|
|
3086
3367
|
}), jsxRuntime.jsx(Description, {
|
|
3087
3368
|
description: description
|
|
3088
3369
|
}), jsxRuntime.jsx(Errors, {
|
|
@@ -3090,13 +3371,18 @@ function Select(props) {
|
|
|
3090
3371
|
})]
|
|
3091
3372
|
});
|
|
3092
3373
|
}
|
|
3093
|
-
Select.create =
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3374
|
+
Select.create = (options = {}) => {
|
|
3375
|
+
const defaults = {};
|
|
3376
|
+
|
|
3377
|
+
// provide default values if valuesKey isn't set
|
|
3378
|
+
if (!options.valuesKey) {
|
|
3379
|
+
defaults.values = [{
|
|
3097
3380
|
label: 'Value',
|
|
3098
3381
|
value: 'value'
|
|
3099
|
-
}]
|
|
3382
|
+
}];
|
|
3383
|
+
}
|
|
3384
|
+
return {
|
|
3385
|
+
...defaults,
|
|
3100
3386
|
...options
|
|
3101
3387
|
};
|
|
3102
3388
|
};
|
|
@@ -3105,22 +3391,7 @@ Select.label = 'Select';
|
|
|
3105
3391
|
Select.keyed = true;
|
|
3106
3392
|
Select.emptyValue = null;
|
|
3107
3393
|
Select.sanitizeValue = sanitizeSingleSelectValue;
|
|
3108
|
-
|
|
3109
|
-
function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
|
|
3110
|
-
var CloseIcon = (({
|
|
3111
|
-
styles = {},
|
|
3112
|
-
...props
|
|
3113
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$e({
|
|
3114
|
-
width: "16",
|
|
3115
|
-
height: "16",
|
|
3116
|
-
fill: "none",
|
|
3117
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
3118
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3119
|
-
fillRule: "evenodd",
|
|
3120
|
-
clipRule: "evenodd",
|
|
3121
|
-
d: "M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8 12 4.7z",
|
|
3122
|
-
fill: "currentColor"
|
|
3123
|
-
})));
|
|
3394
|
+
Select.group = 'selection';
|
|
3124
3395
|
|
|
3125
3396
|
const type$3 = 'taglist';
|
|
3126
3397
|
function Taglist(props) {
|
|
@@ -3137,7 +3408,7 @@ function Taglist(props) {
|
|
|
3137
3408
|
} = field;
|
|
3138
3409
|
const {
|
|
3139
3410
|
formId
|
|
3140
|
-
} = hooks.useContext(FormContext);
|
|
3411
|
+
} = hooks.useContext(FormContext$1);
|
|
3141
3412
|
const [filter, setFilter] = hooks.useState('');
|
|
3142
3413
|
const [filteredOptions, setFilteredOptions] = hooks.useState([]);
|
|
3143
3414
|
const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
|
|
@@ -3225,6 +3496,7 @@ function Taglist(props) {
|
|
|
3225
3496
|
searchbarRef.current.focus();
|
|
3226
3497
|
}
|
|
3227
3498
|
};
|
|
3499
|
+
const shouldDisplayDropdown = hooks.useMemo(() => !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed, [disabled, isDropdownExpanded, isEscapeClosed, loadState]);
|
|
3228
3500
|
return jsxRuntime.jsxs("div", {
|
|
3229
3501
|
class: formFieldClasses(type$3, {
|
|
3230
3502
|
errors,
|
|
@@ -3234,24 +3506,26 @@ function Taglist(props) {
|
|
|
3234
3506
|
label: label,
|
|
3235
3507
|
id: prefixId(`${id}-search`, formId)
|
|
3236
3508
|
}), jsxRuntime.jsxs("div", {
|
|
3237
|
-
class:
|
|
3238
|
-
'disabled': disabled
|
|
3509
|
+
class: classNames('fjs-taglist', {
|
|
3510
|
+
'fjs-disabled': disabled
|
|
3239
3511
|
}),
|
|
3240
|
-
children: [
|
|
3512
|
+
children: [loadState === LOAD_STATES.LOADED && jsxRuntime.jsx("div", {
|
|
3241
3513
|
class: "fjs-taglist-tags",
|
|
3242
3514
|
children: values.map(v => {
|
|
3243
3515
|
return jsxRuntime.jsxs("div", {
|
|
3244
|
-
class:
|
|
3516
|
+
class: classNames('fjs-taglist-tag', {
|
|
3517
|
+
'fjs-disabled': disabled
|
|
3518
|
+
}),
|
|
3245
3519
|
onMouseDown: e => e.preventDefault(),
|
|
3246
3520
|
children: [jsxRuntime.jsx("span", {
|
|
3247
3521
|
class: "fjs-taglist-tag-label",
|
|
3248
3522
|
children: valueToOptionMap[v] ? valueToOptionMap[v].label : `unexpected value{${v}}`
|
|
3249
|
-
}), jsxRuntime.jsx("button", {
|
|
3523
|
+
}), !disabled && jsxRuntime.jsx("button", {
|
|
3250
3524
|
type: "button",
|
|
3251
3525
|
title: "Remove tag",
|
|
3252
3526
|
class: "fjs-taglist-tag-remove",
|
|
3253
3527
|
onClick: event => onTagRemoveClick(event, v),
|
|
3254
|
-
children: jsxRuntime.jsx(
|
|
3528
|
+
children: jsxRuntime.jsx(XMarkIcon, {})
|
|
3255
3529
|
})]
|
|
3256
3530
|
});
|
|
3257
3531
|
})
|
|
@@ -3263,7 +3537,7 @@ function Taglist(props) {
|
|
|
3263
3537
|
onChange: onFilterChange,
|
|
3264
3538
|
type: "text",
|
|
3265
3539
|
value: filter,
|
|
3266
|
-
placeholder: 'Search',
|
|
3540
|
+
placeholder: disabled ? '' : 'Search',
|
|
3267
3541
|
autoComplete: "off",
|
|
3268
3542
|
onKeyDown: e => onInputKeyDown(e),
|
|
3269
3543
|
onMouseDown: () => setIsEscapeClose(false),
|
|
@@ -3275,7 +3549,7 @@ function Taglist(props) {
|
|
|
3275
3549
|
})]
|
|
3276
3550
|
}), jsxRuntime.jsx("div", {
|
|
3277
3551
|
class: "fjs-taglist-anchor",
|
|
3278
|
-
children:
|
|
3552
|
+
children: shouldDisplayDropdown && jsxRuntime.jsx(DropdownList, {
|
|
3279
3553
|
values: filteredOptions,
|
|
3280
3554
|
getLabel: o => o.label,
|
|
3281
3555
|
onValueSelected: o => selectValue(o.value),
|
|
@@ -3289,62 +3563,263 @@ function Taglist(props) {
|
|
|
3289
3563
|
})]
|
|
3290
3564
|
});
|
|
3291
3565
|
}
|
|
3292
|
-
Taglist.create =
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3566
|
+
Taglist.create = (options = {}) => {
|
|
3567
|
+
const defaults = {};
|
|
3568
|
+
|
|
3569
|
+
// provide default values if valuesKey isn't set
|
|
3570
|
+
if (!options.valuesKey) {
|
|
3571
|
+
defaults.values = [{
|
|
3296
3572
|
label: 'Value',
|
|
3297
3573
|
value: 'value'
|
|
3298
|
-
}]
|
|
3574
|
+
}];
|
|
3575
|
+
}
|
|
3576
|
+
return {
|
|
3577
|
+
...defaults,
|
|
3299
3578
|
...options
|
|
3300
3579
|
};
|
|
3301
3580
|
};
|
|
3302
3581
|
Taglist.type = type$3;
|
|
3303
|
-
Taglist.label = '
|
|
3582
|
+
Taglist.label = 'Tag list';
|
|
3304
3583
|
Taglist.keyed = true;
|
|
3305
3584
|
Taglist.emptyValue = [];
|
|
3306
3585
|
Taglist.sanitizeValue = sanitizeMultiSelectValue;
|
|
3586
|
+
Taglist.group = 'selection';
|
|
3307
3587
|
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
}
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
}
|
|
3330
|
-
|
|
3331
|
-
|
|
3588
|
+
const type$2 = 'text';
|
|
3589
|
+
function Text(props) {
|
|
3590
|
+
const {
|
|
3591
|
+
field,
|
|
3592
|
+
disableLinks
|
|
3593
|
+
} = props;
|
|
3594
|
+
const {
|
|
3595
|
+
text = ''
|
|
3596
|
+
} = field;
|
|
3597
|
+
const textValue = useExpressionValue(text) || '';
|
|
3598
|
+
const componentOverrides = disableLinks ? {
|
|
3599
|
+
'a': DisabledLink
|
|
3600
|
+
} : {};
|
|
3601
|
+
return jsxRuntime.jsx("div", {
|
|
3602
|
+
class: formFieldClasses(type$2),
|
|
3603
|
+
children: jsxRuntime.jsx(Markup, {
|
|
3604
|
+
markup: safeMarkdown(textValue),
|
|
3605
|
+
components: componentOverrides,
|
|
3606
|
+
trim: false
|
|
3607
|
+
})
|
|
3608
|
+
});
|
|
3609
|
+
}
|
|
3610
|
+
Text.create = (options = {}) => ({
|
|
3611
|
+
text: '# Text',
|
|
3612
|
+
...options
|
|
3613
|
+
});
|
|
3614
|
+
Text.type = type$2;
|
|
3615
|
+
Text.keyed = false;
|
|
3616
|
+
Text.group = 'presentation';
|
|
3617
|
+
Text.label = 'Text view';
|
|
3618
|
+
function DisabledLink({
|
|
3619
|
+
href,
|
|
3620
|
+
children
|
|
3621
|
+
}) {
|
|
3622
|
+
return jsxRuntime.jsx("a", {
|
|
3623
|
+
class: "fjs-disabled-link",
|
|
3624
|
+
href: href,
|
|
3625
|
+
tabIndex: -1,
|
|
3626
|
+
children: children
|
|
3627
|
+
});
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
const type$1 = 'textfield';
|
|
3631
|
+
function Textfield(props) {
|
|
3632
|
+
const {
|
|
3633
|
+
disabled,
|
|
3634
|
+
errors = [],
|
|
3635
|
+
field,
|
|
3636
|
+
value = ''
|
|
3637
|
+
} = props;
|
|
3638
|
+
const {
|
|
3639
|
+
description,
|
|
3640
|
+
id,
|
|
3641
|
+
label,
|
|
3642
|
+
appearance = {},
|
|
3643
|
+
validate = {}
|
|
3644
|
+
} = field;
|
|
3645
|
+
const {
|
|
3646
|
+
prefixAdorner,
|
|
3647
|
+
suffixAdorner
|
|
3648
|
+
} = appearance;
|
|
3649
|
+
const {
|
|
3650
|
+
required
|
|
3651
|
+
} = validate;
|
|
3652
|
+
const onChange = ({
|
|
3653
|
+
target
|
|
3654
|
+
}) => {
|
|
3655
|
+
props.onChange({
|
|
3656
|
+
field,
|
|
3657
|
+
value: target.value
|
|
3658
|
+
});
|
|
3659
|
+
};
|
|
3660
|
+
const {
|
|
3661
|
+
formId
|
|
3662
|
+
} = hooks.useContext(FormContext$1);
|
|
3663
|
+
return jsxRuntime.jsxs("div", {
|
|
3664
|
+
class: formFieldClasses(type$1, {
|
|
3665
|
+
errors,
|
|
3666
|
+
disabled
|
|
3667
|
+
}),
|
|
3668
|
+
children: [jsxRuntime.jsx(Label, {
|
|
3669
|
+
id: prefixId(id, formId),
|
|
3670
|
+
label: label,
|
|
3671
|
+
required: required
|
|
3672
|
+
}), jsxRuntime.jsx(InputAdorner, {
|
|
3673
|
+
disabled: disabled,
|
|
3674
|
+
pre: prefixAdorner,
|
|
3675
|
+
post: suffixAdorner,
|
|
3676
|
+
children: jsxRuntime.jsx("input", {
|
|
3677
|
+
class: "fjs-input",
|
|
3678
|
+
disabled: disabled,
|
|
3679
|
+
id: prefixId(id, formId),
|
|
3680
|
+
onInput: onChange,
|
|
3681
|
+
type: "text",
|
|
3682
|
+
value: value
|
|
3683
|
+
})
|
|
3684
|
+
}), jsxRuntime.jsx(Description, {
|
|
3685
|
+
description: description
|
|
3686
|
+
}), jsxRuntime.jsx(Errors, {
|
|
3687
|
+
errors: errors
|
|
3688
|
+
})]
|
|
3689
|
+
});
|
|
3690
|
+
}
|
|
3691
|
+
Textfield.create = (options = {}) => ({
|
|
3692
|
+
...options
|
|
3693
|
+
});
|
|
3694
|
+
Textfield.type = type$1;
|
|
3695
|
+
Textfield.label = 'Text field';
|
|
3696
|
+
Textfield.keyed = true;
|
|
3697
|
+
Textfield.emptyValue = '';
|
|
3698
|
+
Textfield.sanitizeValue = ({
|
|
3699
|
+
value
|
|
3700
|
+
}) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
|
|
3701
|
+
Textfield.group = 'basic-input';
|
|
3702
|
+
|
|
3703
|
+
const type = 'textarea';
|
|
3704
|
+
function Textarea(props) {
|
|
3705
|
+
const {
|
|
3706
|
+
disabled,
|
|
3707
|
+
errors = [],
|
|
3708
|
+
field,
|
|
3709
|
+
value = ''
|
|
3710
|
+
} = props;
|
|
3711
|
+
const {
|
|
3712
|
+
description,
|
|
3713
|
+
id,
|
|
3714
|
+
label,
|
|
3715
|
+
validate = {}
|
|
3716
|
+
} = field;
|
|
3717
|
+
const {
|
|
3718
|
+
required
|
|
3719
|
+
} = validate;
|
|
3720
|
+
const textareaRef = hooks.useRef();
|
|
3721
|
+
const onInput = ({
|
|
3722
|
+
target
|
|
3723
|
+
}) => {
|
|
3724
|
+
props.onChange({
|
|
3725
|
+
field,
|
|
3726
|
+
value: target.value
|
|
3727
|
+
});
|
|
3728
|
+
};
|
|
3729
|
+
const autoSizeTextarea = hooks.useCallback(textarea => {
|
|
3730
|
+
// Ensures the textarea shrinks back, and improves resizing behavior consistency
|
|
3731
|
+
textarea.style.height = '0px';
|
|
3732
|
+
const computed = window.getComputedStyle(textarea);
|
|
3733
|
+
const calculatedHeight = parseInt(computed.getPropertyValue('border-top-width')) + parseInt(computed.getPropertyValue('padding-top')) + textarea.scrollHeight + parseInt(computed.getPropertyValue('padding-bottom')) + parseInt(computed.getPropertyValue('border-bottom-width'));
|
|
3734
|
+
const minHeight = 75;
|
|
3735
|
+
const maxHeight = 350;
|
|
3736
|
+
const displayHeight = Math.max(Math.min(calculatedHeight, maxHeight), minHeight);
|
|
3737
|
+
textarea.style.height = `${displayHeight}px`;
|
|
3738
|
+
|
|
3739
|
+
// Overflow is hidden by default to hide scrollbar flickering
|
|
3740
|
+
textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
|
|
3741
|
+
}, []);
|
|
3742
|
+
hooks.useEffect(() => {
|
|
3743
|
+
autoSizeTextarea(textareaRef.current);
|
|
3744
|
+
}, [autoSizeTextarea, value]);
|
|
3745
|
+
const {
|
|
3746
|
+
formId
|
|
3747
|
+
} = hooks.useContext(FormContext$1);
|
|
3748
|
+
return jsxRuntime.jsxs("div", {
|
|
3749
|
+
class: formFieldClasses(type, {
|
|
3750
|
+
errors,
|
|
3751
|
+
disabled
|
|
3752
|
+
}),
|
|
3753
|
+
children: [jsxRuntime.jsx(Label, {
|
|
3754
|
+
id: prefixId(id, formId),
|
|
3755
|
+
label: label,
|
|
3756
|
+
required: required
|
|
3757
|
+
}), jsxRuntime.jsx("textarea", {
|
|
3758
|
+
class: "fjs-textarea",
|
|
3759
|
+
disabled: disabled,
|
|
3760
|
+
id: prefixId(id, formId),
|
|
3761
|
+
onInput: onInput,
|
|
3762
|
+
value: value,
|
|
3763
|
+
ref: textareaRef
|
|
3764
|
+
}), jsxRuntime.jsx(Description, {
|
|
3765
|
+
description: description
|
|
3766
|
+
}), jsxRuntime.jsx(Errors, {
|
|
3767
|
+
errors: errors
|
|
3768
|
+
})]
|
|
3769
|
+
});
|
|
3770
|
+
}
|
|
3771
|
+
Textarea.create = (options = {}) => ({
|
|
3772
|
+
...options
|
|
3773
|
+
});
|
|
3774
|
+
Textarea.type = type;
|
|
3775
|
+
Textarea.label = 'Text area';
|
|
3776
|
+
Textarea.keyed = true;
|
|
3777
|
+
Textarea.emptyValue = '';
|
|
3778
|
+
Textarea.sanitizeValue = ({
|
|
3779
|
+
value
|
|
3780
|
+
}) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
|
|
3781
|
+
Textarea.group = 'basic-input';
|
|
3782
|
+
|
|
3783
|
+
function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
|
|
3784
|
+
var ButtonIcon = (({
|
|
3785
|
+
styles = {},
|
|
3786
|
+
...props
|
|
3787
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$d({
|
|
3788
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3789
|
+
width: "54",
|
|
3790
|
+
height: "54"
|
|
3791
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3792
|
+
fillRule: "evenodd",
|
|
3793
|
+
d: "M45 17a3 3 0 013 3v14a3 3 0 01-3 3H9a3 3 0 01-3-3V20a3 3 0 013-3h36zm-9 8.889H18v2.222h18V25.89z"
|
|
3794
|
+
})));
|
|
3795
|
+
|
|
3796
|
+
function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$c.apply(this, arguments); }
|
|
3797
|
+
var CheckboxIcon = (({
|
|
3798
|
+
styles = {},
|
|
3799
|
+
...props
|
|
3800
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$c({
|
|
3801
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3802
|
+
width: "54",
|
|
3803
|
+
height: "54"
|
|
3804
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3805
|
+
d: "M34 18H20a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V20a2 2 0 00-2-2zm-9 14l-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
|
|
3806
|
+
})));
|
|
3332
3807
|
|
|
3333
3808
|
function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
|
|
3334
3809
|
var ChecklistIcon = (({
|
|
3335
3810
|
styles = {},
|
|
3336
3811
|
...props
|
|
3337
|
-
}) => /*#__PURE__*/
|
|
3812
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$b({
|
|
3338
3813
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3339
3814
|
width: "54",
|
|
3340
3815
|
height: "54",
|
|
3341
3816
|
fill: "none"
|
|
3342
|
-
}, props), /*#__PURE__*/
|
|
3817
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3343
3818
|
fillRule: "evenodd",
|
|
3344
3819
|
clipRule: "evenodd",
|
|
3345
3820
|
d: "M18 12h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 36h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 24h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6z",
|
|
3346
3821
|
fill: "#161616"
|
|
3347
|
-
}), /*#__PURE__*/
|
|
3822
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3348
3823
|
d: "M23 14.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 26.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 38.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1z",
|
|
3349
3824
|
fill: "#161616"
|
|
3350
3825
|
})));
|
|
@@ -3353,20 +3828,20 @@ function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : func
|
|
|
3353
3828
|
var DatetimeIcon = (({
|
|
3354
3829
|
styles = {},
|
|
3355
3830
|
...props
|
|
3356
|
-
}) => /*#__PURE__*/
|
|
3831
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$a({
|
|
3357
3832
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3358
3833
|
width: "54",
|
|
3359
3834
|
height: "54",
|
|
3360
3835
|
fill: "none"
|
|
3361
|
-
}, props), /*#__PURE__*/
|
|
3836
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3362
3837
|
fill: "#000",
|
|
3363
3838
|
fillRule: "evenodd",
|
|
3364
3839
|
d: "M37.908 13.418h-5.004v-2.354h-1.766v2.354H21.13v-2.354h-1.766v2.354H14.36c-1.132 0-2.06.928-2.06 2.06v23.549c0 1.132.928 2.06 2.06 2.06h6.77v-1.766h-6.358a.707.707 0 01-.706-.706V15.89c0-.39.316-.707.706-.707h4.592v2.355h1.766v-2.355h10.008v2.355h1.766v-2.355h4.592c.39 0 .707.317.707.707v6.358h1.765v-6.77c0-1.133-.927-2.06-2.06-2.06z",
|
|
3365
3840
|
clipRule: "evenodd"
|
|
3366
|
-
}), /*#__PURE__*/
|
|
3841
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3367
3842
|
fill: "#000",
|
|
3368
3843
|
d: "M35.13 37.603l1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984z"
|
|
3369
|
-
}), /*#__PURE__*/
|
|
3844
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3370
3845
|
fill: "#000",
|
|
3371
3846
|
fillRule: "evenodd",
|
|
3372
3847
|
d: "M23.08 36.962a9.678 9.678 0 1017.883-7.408 9.678 9.678 0 00-17.882 7.408zm4.54-10.292a7.924 7.924 0 118.805 13.177A7.924 7.924 0 0127.62 26.67z",
|
|
@@ -3377,17 +3852,17 @@ function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : func
|
|
|
3377
3852
|
var TaglistIcon = (({
|
|
3378
3853
|
styles = {},
|
|
3379
3854
|
...props
|
|
3380
|
-
}) => /*#__PURE__*/
|
|
3855
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$9({
|
|
3381
3856
|
width: "54",
|
|
3382
3857
|
height: "54",
|
|
3383
3858
|
fill: "none",
|
|
3384
3859
|
xmlns: "http://www.w3.org/2000/svg"
|
|
3385
|
-
}, props), /*#__PURE__*/
|
|
3860
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3386
3861
|
fillRule: "evenodd",
|
|
3387
3862
|
clipRule: "evenodd",
|
|
3388
3863
|
d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1z",
|
|
3389
3864
|
fill: "#000"
|
|
3390
|
-
}), /*#__PURE__*/
|
|
3865
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3391
3866
|
d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
|
|
3392
3867
|
fill: "#505562"
|
|
3393
3868
|
})));
|
|
@@ -3396,23 +3871,23 @@ function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : func
|
|
|
3396
3871
|
var FormIcon = (({
|
|
3397
3872
|
styles = {},
|
|
3398
3873
|
...props
|
|
3399
|
-
}) => /*#__PURE__*/
|
|
3874
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$8({
|
|
3400
3875
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3401
3876
|
width: "54",
|
|
3402
3877
|
height: "54"
|
|
3403
|
-
}, props), /*#__PURE__*/
|
|
3878
|
+
}, props), /*#__PURE__*/React.createElement("rect", {
|
|
3404
3879
|
x: "15",
|
|
3405
3880
|
y: "17",
|
|
3406
3881
|
width: "24",
|
|
3407
3882
|
height: "4",
|
|
3408
3883
|
rx: "1"
|
|
3409
|
-
}), /*#__PURE__*/
|
|
3884
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
3410
3885
|
x: "15",
|
|
3411
3886
|
y: "25",
|
|
3412
3887
|
width: "24",
|
|
3413
3888
|
height: "4",
|
|
3414
3889
|
rx: "1"
|
|
3415
|
-
}), /*#__PURE__*/
|
|
3890
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
3416
3891
|
x: "15",
|
|
3417
3892
|
y: "33",
|
|
3418
3893
|
width: "13",
|
|
@@ -3424,11 +3899,11 @@ function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : func
|
|
|
3424
3899
|
var ColumnsIcon = (({
|
|
3425
3900
|
styles = {},
|
|
3426
3901
|
...props
|
|
3427
|
-
}) => /*#__PURE__*/
|
|
3902
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$7({
|
|
3428
3903
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3429
3904
|
width: "54",
|
|
3430
3905
|
height: "54"
|
|
3431
|
-
}, props), /*#__PURE__*/
|
|
3906
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3432
3907
|
fillRule: "evenodd",
|
|
3433
3908
|
d: "M8 33v5a1 1 0 001 1h4v2H9a3 3 0 01-3-3v-5h2zm18 6v2H15v-2h11zm13 0v2H28v-2h11zm9-6v5a3 3 0 01-3 3h-4v-2h4a1 1 0 00.993-.883L46 38v-5h2zM8 22v9H6v-9h2zm40 0v9h-2v-9h2zm-35-9v2H9a1 1 0 00-.993.883L8 16v4H6v-4a3 3 0 013-3h4zm32 0a3 3 0 013 3v4h-2v-4a1 1 0 00-.883-.993L45 15h-4v-2h4zm-6 0v2H28v-2h11zm-13 0v2H15v-2h11z"
|
|
3434
3909
|
})));
|
|
@@ -3437,11 +3912,11 @@ function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : func
|
|
|
3437
3912
|
var NumberIcon = (({
|
|
3438
3913
|
styles = {},
|
|
3439
3914
|
...props
|
|
3440
|
-
}) => /*#__PURE__*/
|
|
3915
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$6({
|
|
3441
3916
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3442
3917
|
width: "54",
|
|
3443
3918
|
height: "54"
|
|
3444
|
-
}, props), /*#__PURE__*/
|
|
3919
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3445
3920
|
fillRule: "evenodd",
|
|
3446
3921
|
d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
|
|
3447
3922
|
})));
|
|
@@ -3450,11 +3925,11 @@ function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : func
|
|
|
3450
3925
|
var RadioIcon = (({
|
|
3451
3926
|
styles = {},
|
|
3452
3927
|
...props
|
|
3453
|
-
}) => /*#__PURE__*/
|
|
3928
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$5({
|
|
3454
3929
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3455
3930
|
width: "54",
|
|
3456
3931
|
height: "54"
|
|
3457
|
-
}, props), /*#__PURE__*/
|
|
3932
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3458
3933
|
d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
|
3459
3934
|
})));
|
|
3460
3935
|
|
|
@@ -3462,11 +3937,11 @@ function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : func
|
|
|
3462
3937
|
var SelectIcon = (({
|
|
3463
3938
|
styles = {},
|
|
3464
3939
|
...props
|
|
3465
|
-
}) => /*#__PURE__*/
|
|
3940
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$4({
|
|
3466
3941
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3467
3942
|
width: "54",
|
|
3468
3943
|
height: "54"
|
|
3469
|
-
}, props), /*#__PURE__*/
|
|
3944
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3470
3945
|
fillRule: "evenodd",
|
|
3471
3946
|
d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-12 7h9l-4.5 6-4.5-6z"
|
|
3472
3947
|
})));
|
|
@@ -3475,11 +3950,11 @@ function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : func
|
|
|
3475
3950
|
var TextIcon = (({
|
|
3476
3951
|
styles = {},
|
|
3477
3952
|
...props
|
|
3478
|
-
}) => /*#__PURE__*/
|
|
3953
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$3({
|
|
3479
3954
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3480
3955
|
width: "54",
|
|
3481
3956
|
height: "54"
|
|
3482
|
-
}, props), /*#__PURE__*/
|
|
3957
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3483
3958
|
d: "M20.58 33.77h-3l-1.18-3.08H11l-1.1 3.08H7l5.27-13.54h2.89zm-5-5.36l-1.86-5-1.83 5zM22 20.23h5.41a15.47 15.47 0 012.4.14 3.42 3.42 0 011.41.55 3.47 3.47 0 011 1.14 3 3 0 01.42 1.58 3.26 3.26 0 01-1.91 2.94 3.63 3.63 0 011.91 1.22 3.28 3.28 0 01.66 2 4 4 0 01-.43 1.8 3.63 3.63 0 01-1.09 1.4 3.89 3.89 0 01-1.83.65q-.69.07-3.3.09H22zm2.73 2.25v3.13h3.8a1.79 1.79 0 001.1-.49 1.41 1.41 0 00.41-1 1.49 1.49 0 00-.35-1 1.54 1.54 0 00-1-.48c-.27 0-1.05-.05-2.34-.05zm0 5.39v3.62h2.57a11.52 11.52 0 001.88-.09 1.65 1.65 0 001-.54 1.6 1.6 0 00.38-1.14 1.75 1.75 0 00-.29-1 1.69 1.69 0 00-.86-.62 9.28 9.28 0 00-2.41-.23zM44.35 28.79l2.65.84a5.94 5.94 0 01-2 3.29A5.74 5.74 0 0141.38 34a5.87 5.87 0 01-4.44-1.84 7.09 7.09 0 01-1.73-5A7.43 7.43 0 0137 21.87 6 6 0 0141.54 20a5.64 5.64 0 014 1.47A5.33 5.33 0 0147 24l-2.7.65a2.8 2.8 0 00-2.86-2.27A3.09 3.09 0 0039 23.42a5.31 5.31 0 00-.93 3.5 5.62 5.62 0 00.93 3.65 3 3 0 002.4 1.09 2.72 2.72 0 001.82-.66 4 4 0 001.13-2.21z"
|
|
3484
3959
|
})));
|
|
3485
3960
|
|
|
@@ -3487,11 +3962,11 @@ function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : func
|
|
|
3487
3962
|
var TextfieldIcon = (({
|
|
3488
3963
|
styles = {},
|
|
3489
3964
|
...props
|
|
3490
|
-
}) => /*#__PURE__*/
|
|
3965
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
3491
3966
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3492
3967
|
width: "54",
|
|
3493
3968
|
height: "54"
|
|
3494
|
-
}, props), /*#__PURE__*/
|
|
3969
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3495
3970
|
fillRule: "evenodd",
|
|
3496
3971
|
d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-32 4v10h-2V22h2z"
|
|
3497
3972
|
})));
|
|
@@ -3500,11 +3975,11 @@ function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : func
|
|
|
3500
3975
|
var TextareaIcon = (({
|
|
3501
3976
|
styles = {},
|
|
3502
3977
|
...props
|
|
3503
|
-
}) => /*#__PURE__*/
|
|
3978
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
3504
3979
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3505
3980
|
width: "54",
|
|
3506
3981
|
height: "54"
|
|
3507
|
-
}, props), /*#__PURE__*/
|
|
3982
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3508
3983
|
fillRule: "evenodd",
|
|
3509
3984
|
d: "M45 13a3 3 0 013 3v22a3 3 0 01-3 3H9a3 3 0 01-3-3V16a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v22a1 1 0 001 1h36a1 1 0 001-1V16a1 1 0 00-1-1zm-1.136 15.5l.848.849-6.363 6.363-.849-.848 6.364-6.364zm.264 3.5l.849.849-2.828 2.828-.849-.849L44.128 34zM13 19v10h-2V19h2z"
|
|
3510
3985
|
})));
|
|
@@ -3513,17 +3988,17 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
3513
3988
|
var ImageIcon = (({
|
|
3514
3989
|
styles = {},
|
|
3515
3990
|
...props
|
|
3516
|
-
}) => /*#__PURE__*/
|
|
3991
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends({
|
|
3517
3992
|
width: "54",
|
|
3518
3993
|
height: "54",
|
|
3519
3994
|
fill: "none",
|
|
3520
3995
|
xmlns: "http://www.w3.org/2000/svg"
|
|
3521
|
-
}, props), /*#__PURE__*/
|
|
3996
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3522
3997
|
fillRule: "evenodd",
|
|
3523
3998
|
clipRule: "evenodd",
|
|
3524
3999
|
d: "M34.636 21.91A3.818 3.818 0 1127 21.908a3.818 3.818 0 017.636 0zm-2 0A1.818 1.818 0 1129 21.908a1.818 1.818 0 013.636 0z",
|
|
3525
4000
|
fill: "#000"
|
|
3526
|
-
}), /*#__PURE__*/
|
|
4001
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3527
4002
|
fillRule: "evenodd",
|
|
3528
4003
|
clipRule: "evenodd",
|
|
3529
4004
|
d: "M15 13a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V15a2 2 0 00-2-2H15zm24 2H15v12.45l4.71-4.709a1.91 1.91 0 012.702 0l6.695 6.695 2.656-1.77a1.91 1.91 0 012.411.239L39 32.73V15zM15 39v-8.754c.06-.038.116-.083.168-.135l5.893-5.893 6.684 6.685a1.911 1.911 0 002.41.238l2.657-1.77 6.02 6.02c.052.051.108.097.168.135V39H15z",
|
|
@@ -3547,226 +4022,13 @@ const iconsByType = {
|
|
|
3547
4022
|
default: FormIcon
|
|
3548
4023
|
};
|
|
3549
4024
|
|
|
3550
|
-
const type$2 = 'text';
|
|
3551
|
-
function Text(props) {
|
|
3552
|
-
const {
|
|
3553
|
-
field,
|
|
3554
|
-
disabled
|
|
3555
|
-
} = props;
|
|
3556
|
-
const {
|
|
3557
|
-
text = ''
|
|
3558
|
-
} = field;
|
|
3559
|
-
const textValue = useExpressionValue(text) || '';
|
|
3560
|
-
return jsxRuntime.jsx("div", {
|
|
3561
|
-
class: formFieldClasses(type$2),
|
|
3562
|
-
children: renderText(field, textValue, disabled)
|
|
3563
|
-
});
|
|
3564
|
-
}
|
|
3565
|
-
Text.create = function (options = {}) {
|
|
3566
|
-
return {
|
|
3567
|
-
text: '# Text',
|
|
3568
|
-
...options
|
|
3569
|
-
};
|
|
3570
|
-
};
|
|
3571
|
-
Text.type = type$2;
|
|
3572
|
-
Text.keyed = false;
|
|
3573
|
-
|
|
3574
|
-
// helper //////////////
|
|
3575
|
-
|
|
3576
|
-
function renderText(field, content, disabled) {
|
|
3577
|
-
const {
|
|
3578
|
-
text
|
|
3579
|
-
} = field;
|
|
3580
|
-
const Icon = iconsByType['text'];
|
|
3581
|
-
if (disabled) {
|
|
3582
|
-
if (!text) {
|
|
3583
|
-
return jsxRuntime.jsxs("div", {
|
|
3584
|
-
class: "fjs-form-field-placeholder",
|
|
3585
|
-
children: [jsxRuntime.jsx(Icon, {
|
|
3586
|
-
viewBox: "0 0 54 54"
|
|
3587
|
-
}), "Text view is empty"]
|
|
3588
|
-
});
|
|
3589
|
-
}
|
|
3590
|
-
if (isExpression$2(text)) {
|
|
3591
|
-
return jsxRuntime.jsxs("div", {
|
|
3592
|
-
class: "fjs-form-field-placeholder",
|
|
3593
|
-
children: [jsxRuntime.jsx(Icon, {
|
|
3594
|
-
viewBox: "0 0 54 54"
|
|
3595
|
-
}), "Text view is populated by an expression"]
|
|
3596
|
-
});
|
|
3597
|
-
}
|
|
3598
|
-
}
|
|
3599
|
-
return jsxRuntime.jsx(Markup__default['default'], {
|
|
3600
|
-
markup: safeMarkdown(content),
|
|
3601
|
-
trim: false
|
|
3602
|
-
});
|
|
3603
|
-
}
|
|
3604
|
-
|
|
3605
|
-
const type$1 = 'textfield';
|
|
3606
|
-
function Textfield(props) {
|
|
3607
|
-
const {
|
|
3608
|
-
disabled,
|
|
3609
|
-
errors = [],
|
|
3610
|
-
field,
|
|
3611
|
-
value = ''
|
|
3612
|
-
} = props;
|
|
3613
|
-
const {
|
|
3614
|
-
description,
|
|
3615
|
-
id,
|
|
3616
|
-
label,
|
|
3617
|
-
appearance = {},
|
|
3618
|
-
validate = {}
|
|
3619
|
-
} = field;
|
|
3620
|
-
const {
|
|
3621
|
-
prefixAdorner,
|
|
3622
|
-
suffixAdorner
|
|
3623
|
-
} = appearance;
|
|
3624
|
-
const {
|
|
3625
|
-
required
|
|
3626
|
-
} = validate;
|
|
3627
|
-
const onChange = ({
|
|
3628
|
-
target
|
|
3629
|
-
}) => {
|
|
3630
|
-
props.onChange({
|
|
3631
|
-
field,
|
|
3632
|
-
value: target.value
|
|
3633
|
-
});
|
|
3634
|
-
};
|
|
3635
|
-
const {
|
|
3636
|
-
formId
|
|
3637
|
-
} = hooks.useContext(FormContext);
|
|
3638
|
-
return jsxRuntime.jsxs("div", {
|
|
3639
|
-
class: formFieldClasses(type$1, {
|
|
3640
|
-
errors,
|
|
3641
|
-
disabled
|
|
3642
|
-
}),
|
|
3643
|
-
children: [jsxRuntime.jsx(Label, {
|
|
3644
|
-
id: prefixId(id, formId),
|
|
3645
|
-
label: label,
|
|
3646
|
-
required: required
|
|
3647
|
-
}), jsxRuntime.jsx(InputAdorner, {
|
|
3648
|
-
disabled: disabled,
|
|
3649
|
-
pre: prefixAdorner,
|
|
3650
|
-
post: suffixAdorner,
|
|
3651
|
-
children: jsxRuntime.jsx("input", {
|
|
3652
|
-
class: "fjs-input",
|
|
3653
|
-
disabled: disabled,
|
|
3654
|
-
id: prefixId(id, formId),
|
|
3655
|
-
onInput: onChange,
|
|
3656
|
-
type: "text",
|
|
3657
|
-
value: value
|
|
3658
|
-
})
|
|
3659
|
-
}), jsxRuntime.jsx(Description, {
|
|
3660
|
-
description: description
|
|
3661
|
-
}), jsxRuntime.jsx(Errors, {
|
|
3662
|
-
errors: errors
|
|
3663
|
-
})]
|
|
3664
|
-
});
|
|
3665
|
-
}
|
|
3666
|
-
Textfield.create = function (options = {}) {
|
|
3667
|
-
return {
|
|
3668
|
-
...options
|
|
3669
|
-
};
|
|
3670
|
-
};
|
|
3671
|
-
Textfield.type = type$1;
|
|
3672
|
-
Textfield.label = 'Text field';
|
|
3673
|
-
Textfield.keyed = true;
|
|
3674
|
-
Textfield.emptyValue = '';
|
|
3675
|
-
Textfield.sanitizeValue = ({
|
|
3676
|
-
value
|
|
3677
|
-
}) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
|
|
3678
|
-
|
|
3679
|
-
const type = 'textarea';
|
|
3680
|
-
function Textarea(props) {
|
|
3681
|
-
const {
|
|
3682
|
-
disabled,
|
|
3683
|
-
errors = [],
|
|
3684
|
-
field,
|
|
3685
|
-
value = ''
|
|
3686
|
-
} = props;
|
|
3687
|
-
const {
|
|
3688
|
-
description,
|
|
3689
|
-
id,
|
|
3690
|
-
label,
|
|
3691
|
-
validate = {}
|
|
3692
|
-
} = field;
|
|
3693
|
-
const {
|
|
3694
|
-
required
|
|
3695
|
-
} = validate;
|
|
3696
|
-
const textareaRef = hooks.useRef();
|
|
3697
|
-
const onInput = ({
|
|
3698
|
-
target
|
|
3699
|
-
}) => {
|
|
3700
|
-
props.onChange({
|
|
3701
|
-
field,
|
|
3702
|
-
value: target.value
|
|
3703
|
-
});
|
|
3704
|
-
};
|
|
3705
|
-
const autoSizeTextarea = hooks.useCallback(textarea => {
|
|
3706
|
-
// Ensures the textarea shrinks back, and improves resizing behavior consistency
|
|
3707
|
-
textarea.style.height = '0px';
|
|
3708
|
-
const computed = window.getComputedStyle(textarea);
|
|
3709
|
-
const calculatedHeight = parseInt(computed.getPropertyValue('border-top-width')) + parseInt(computed.getPropertyValue('padding-top')) + textarea.scrollHeight + parseInt(computed.getPropertyValue('padding-bottom')) + parseInt(computed.getPropertyValue('border-bottom-width'));
|
|
3710
|
-
const minHeight = 75;
|
|
3711
|
-
const maxHeight = 350;
|
|
3712
|
-
const displayHeight = Math.max(Math.min(calculatedHeight, maxHeight), minHeight);
|
|
3713
|
-
textarea.style.height = `${displayHeight}px`;
|
|
3714
|
-
|
|
3715
|
-
// Overflow is hidden by default to hide scrollbar flickering
|
|
3716
|
-
textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
|
|
3717
|
-
}, []);
|
|
3718
|
-
hooks.useEffect(() => {
|
|
3719
|
-
autoSizeTextarea(textareaRef.current);
|
|
3720
|
-
}, [autoSizeTextarea, value]);
|
|
3721
|
-
const {
|
|
3722
|
-
formId
|
|
3723
|
-
} = hooks.useContext(FormContext);
|
|
3724
|
-
return jsxRuntime.jsxs("div", {
|
|
3725
|
-
class: formFieldClasses(type, {
|
|
3726
|
-
errors,
|
|
3727
|
-
disabled
|
|
3728
|
-
}),
|
|
3729
|
-
children: [jsxRuntime.jsx(Label, {
|
|
3730
|
-
id: prefixId(id, formId),
|
|
3731
|
-
label: label,
|
|
3732
|
-
required: required
|
|
3733
|
-
}), jsxRuntime.jsx("textarea", {
|
|
3734
|
-
class: "fjs-textarea",
|
|
3735
|
-
disabled: disabled,
|
|
3736
|
-
id: prefixId(id, formId),
|
|
3737
|
-
onInput: onInput,
|
|
3738
|
-
value: value,
|
|
3739
|
-
ref: textareaRef
|
|
3740
|
-
}), jsxRuntime.jsx(Description, {
|
|
3741
|
-
description: description
|
|
3742
|
-
}), jsxRuntime.jsx(Errors, {
|
|
3743
|
-
errors: errors
|
|
3744
|
-
})]
|
|
3745
|
-
});
|
|
3746
|
-
}
|
|
3747
|
-
Textarea.create = function (options = {}) {
|
|
3748
|
-
return {
|
|
3749
|
-
...options
|
|
3750
|
-
};
|
|
3751
|
-
};
|
|
3752
|
-
Textarea.type = type;
|
|
3753
|
-
Textarea.label = 'Text area';
|
|
3754
|
-
Textarea.keyed = true;
|
|
3755
|
-
Textarea.emptyValue = '';
|
|
3756
|
-
Textarea.sanitizeValue = ({
|
|
3757
|
-
value
|
|
3758
|
-
}) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
|
|
3759
|
-
|
|
3760
4025
|
const formFields = [Button, Checkbox, Checklist, Default, Image, Numberfield, Datetime, Radio, Select, Taglist, Text, Textfield, Textarea];
|
|
3761
4026
|
|
|
3762
4027
|
class FormFields {
|
|
3763
4028
|
constructor() {
|
|
3764
4029
|
this._formFields = {};
|
|
3765
4030
|
formFields.forEach(formField => {
|
|
3766
|
-
|
|
3767
|
-
type
|
|
3768
|
-
} = formField;
|
|
3769
|
-
this.register(type, formField);
|
|
4031
|
+
this.register(formField.type, formField);
|
|
3770
4032
|
});
|
|
3771
4033
|
}
|
|
3772
4034
|
register(type, formField) {
|
|
@@ -3808,7 +4070,7 @@ function Renderer(config, eventBus, form, injector) {
|
|
|
3808
4070
|
if (!schema) {
|
|
3809
4071
|
return null;
|
|
3810
4072
|
}
|
|
3811
|
-
return jsxRuntime.jsx(FormContext.Provider, {
|
|
4073
|
+
return jsxRuntime.jsx(FormContext$1.Provider, {
|
|
3812
4074
|
value: formContext,
|
|
3813
4075
|
children: jsxRuntime.jsx(FormComponent, {
|
|
3814
4076
|
onChange: onChange,
|
|
@@ -3866,7 +4128,7 @@ var core = {
|
|
|
3866
4128
|
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
3867
4129
|
*/
|
|
3868
4130
|
|
|
3869
|
-
const ids = new
|
|
4131
|
+
const ids = new Ids([32, 36, 1]);
|
|
3870
4132
|
|
|
3871
4133
|
/**
|
|
3872
4134
|
* The form.
|
|
@@ -4209,7 +4471,7 @@ class Form {
|
|
|
4209
4471
|
}
|
|
4210
4472
|
}
|
|
4211
4473
|
|
|
4212
|
-
const schemaVersion =
|
|
4474
|
+
const schemaVersion = 7;
|
|
4213
4475
|
|
|
4214
4476
|
/**
|
|
4215
4477
|
* @typedef { import('./types').CreateFormOptions } CreateFormOptions
|
|
@@ -4246,10 +4508,10 @@ exports.Datetime = Datetime;
|
|
|
4246
4508
|
exports.Default = Default;
|
|
4247
4509
|
exports.Form = Form;
|
|
4248
4510
|
exports.FormComponent = FormComponent;
|
|
4249
|
-
exports.FormContext = FormContext;
|
|
4511
|
+
exports.FormContext = FormContext$1;
|
|
4250
4512
|
exports.FormFieldRegistry = FormFieldRegistry;
|
|
4251
4513
|
exports.FormFields = FormFields;
|
|
4252
|
-
exports.FormRenderContext = FormRenderContext;
|
|
4514
|
+
exports.FormRenderContext = FormRenderContext$1;
|
|
4253
4515
|
exports.Image = Image;
|
|
4254
4516
|
exports.MINUTES_IN_DAY = MINUTES_IN_DAY;
|
|
4255
4517
|
exports.Numberfield = Numberfield;
|
|
@@ -4278,9 +4540,12 @@ exports.findErrors = findErrors;
|
|
|
4278
4540
|
exports.formFields = formFields;
|
|
4279
4541
|
exports.generateIdForType = generateIdForType;
|
|
4280
4542
|
exports.generateIndexForType = generateIndexForType;
|
|
4543
|
+
exports.getExpressionVariableNames = getExpressionVariableNames;
|
|
4281
4544
|
exports.getSchemaVariables = getSchemaVariables;
|
|
4282
4545
|
exports.getValuesSource = getValuesSource;
|
|
4546
|
+
exports.getVariableNames = getVariableNames;
|
|
4283
4547
|
exports.iconsByType = iconsByType;
|
|
4548
|
+
exports.isExpression = isExpression$1;
|
|
4284
4549
|
exports.isRequired = isRequired;
|
|
4285
4550
|
exports.pathParse = pathParse;
|
|
4286
4551
|
exports.pathStringify = pathStringify;
|