@bpmn-io/form-js-viewer 0.10.0-alpha.3 → 0.10.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/README.md +1 -0
- package/dist/assets/flatpickr/light.css +809 -0
- package/dist/assets/form-js.css +148 -26
- package/dist/index.cjs +1435 -313
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +1417 -316
- package/dist/index.es.js.map +1 -1
- package/dist/types/render/components/Util.d.ts +0 -2
- package/dist/types/render/components/form-fields/Checklist.d.ts +1 -1
- package/dist/types/render/components/form-fields/Datetime.d.ts +11 -0
- package/dist/types/render/components/form-fields/Radio.d.ts +1 -1
- package/dist/types/render/components/form-fields/Select.d.ts +1 -1
- package/dist/types/render/components/form-fields/Taglist.d.ts +1 -1
- package/dist/types/render/components/form-fields/parts/Datepicker.d.ts +1 -0
- package/dist/types/render/components/form-fields/parts/InputAdorner.d.ts +1 -0
- package/dist/types/render/components/form-fields/parts/Timepicker.d.ts +1 -0
- package/dist/types/render/components/icons/index.d.ts +16 -0
- package/dist/types/render/components/index.d.ts +3 -1
- package/dist/types/render/components/util/dateTimeUtil.d.ts +12 -0
- package/dist/types/render/components/util/sanitizerUtil.d.ts +3 -0
- package/dist/types/util/constants/DatetimeConstants.d.ts +24 -0
- package/dist/types/util/constants/ValuesSourceConstants.d.ts +15 -0
- package/dist/types/util/constants/index.d.ts +2 -0
- package/dist/types/util/feel.d.ts +1 -0
- package/dist/types/util/index.d.ts +1 -0
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -12,6 +12,7 @@ var jsxRuntime = require('preact/jsx-runtime');
|
|
|
12
12
|
var hooks = require('preact/hooks');
|
|
13
13
|
var preact = require('preact');
|
|
14
14
|
var React = require('preact/compat');
|
|
15
|
+
var flatpickr = require('flatpickr');
|
|
15
16
|
var Markup = require('preact-markup');
|
|
16
17
|
var didi = require('didi');
|
|
17
18
|
|
|
@@ -22,6 +23,7 @@ var Big__default = /*#__PURE__*/_interopDefaultLegacy(Big);
|
|
|
22
23
|
var snarkdown__default = /*#__PURE__*/_interopDefaultLegacy(snarkdown);
|
|
23
24
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
24
25
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
|
+
var flatpickr__default = /*#__PURE__*/_interopDefaultLegacy(flatpickr);
|
|
25
27
|
var Markup__default = /*#__PURE__*/_interopDefaultLegacy(Markup);
|
|
26
28
|
|
|
27
29
|
/**
|
|
@@ -752,6 +754,71 @@ function getExpressionVariableNames(expression) {
|
|
|
752
754
|
} while (cursor.next());
|
|
753
755
|
return Array.from(variables);
|
|
754
756
|
}
|
|
757
|
+
function isExpression$2(value) {
|
|
758
|
+
return minDash.isString(value) && value.startsWith('=');
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
// config ///////////////////
|
|
762
|
+
|
|
763
|
+
const MINUTES_IN_DAY = 60 * 24;
|
|
764
|
+
const DATETIME_SUBTYPES = {
|
|
765
|
+
DATE: 'date',
|
|
766
|
+
TIME: 'time',
|
|
767
|
+
DATETIME: 'datetime'
|
|
768
|
+
};
|
|
769
|
+
const TIME_SERIALISING_FORMATS = {
|
|
770
|
+
UTC_OFFSET: 'utc_offset',
|
|
771
|
+
UTC_NORMALIZED: 'utc_normalized',
|
|
772
|
+
NO_TIMEZONE: 'no_timezone'
|
|
773
|
+
};
|
|
774
|
+
const DATETIME_SUBTYPES_LABELS = {
|
|
775
|
+
[DATETIME_SUBTYPES.DATE]: 'Date',
|
|
776
|
+
[DATETIME_SUBTYPES.TIME]: 'Time',
|
|
777
|
+
[DATETIME_SUBTYPES.DATETIME]: 'Date & Time'
|
|
778
|
+
};
|
|
779
|
+
const TIME_SERIALISINGFORMAT_LABELS = {
|
|
780
|
+
[TIME_SERIALISING_FORMATS.UTC_OFFSET]: 'UTC offset',
|
|
781
|
+
[TIME_SERIALISING_FORMATS.UTC_NORMALIZED]: 'UTC normalized',
|
|
782
|
+
[TIME_SERIALISING_FORMATS.NO_TIMEZONE]: 'No timezone'
|
|
783
|
+
};
|
|
784
|
+
const DATETIME_SUBTYPE_PATH = ['subtype'];
|
|
785
|
+
const DATE_LABEL_PATH = ['dateLabel'];
|
|
786
|
+
const DATE_DISALLOW_PAST_PATH = ['disallowPassedDates'];
|
|
787
|
+
const TIME_LABEL_PATH = ['timeLabel'];
|
|
788
|
+
const TIME_USE24H_PATH = ['use24h'];
|
|
789
|
+
const TIME_INTERVAL_PATH = ['timeInterval'];
|
|
790
|
+
const TIME_SERIALISING_FORMAT_PATH = ['timeSerializingFormat'];
|
|
791
|
+
|
|
792
|
+
// config ///////////////////
|
|
793
|
+
|
|
794
|
+
const VALUES_SOURCES = {
|
|
795
|
+
STATIC: 'static',
|
|
796
|
+
INPUT: 'input'
|
|
797
|
+
};
|
|
798
|
+
const VALUES_SOURCE_DEFAULT = VALUES_SOURCES.STATIC;
|
|
799
|
+
const VALUES_SOURCES_LABELS = {
|
|
800
|
+
[VALUES_SOURCES.STATIC]: 'Static',
|
|
801
|
+
[VALUES_SOURCES.INPUT]: 'Input data'
|
|
802
|
+
};
|
|
803
|
+
const VALUES_SOURCES_PATHS = {
|
|
804
|
+
[VALUES_SOURCES.STATIC]: ['values'],
|
|
805
|
+
[VALUES_SOURCES.INPUT]: ['valuesKey']
|
|
806
|
+
};
|
|
807
|
+
const VALUES_SOURCES_DEFAULTS = {
|
|
808
|
+
[VALUES_SOURCES.STATIC]: [],
|
|
809
|
+
[VALUES_SOURCES.INPUT]: ''
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
// helpers ///////////////////
|
|
813
|
+
|
|
814
|
+
function getValuesSource(field) {
|
|
815
|
+
for (const source of Object.values(VALUES_SOURCES)) {
|
|
816
|
+
if (minDash.get(field, VALUES_SOURCES_PATHS[source]) !== undefined) {
|
|
817
|
+
return source;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
return VALUES_SOURCE_DEFAULT;
|
|
821
|
+
}
|
|
755
822
|
|
|
756
823
|
function createInjector(bootstrapModules) {
|
|
757
824
|
const injector = new didi.Injector(bootstrapModules);
|
|
@@ -770,7 +837,7 @@ function createFormContainer(prefix = 'fjs') {
|
|
|
770
837
|
return container;
|
|
771
838
|
}
|
|
772
839
|
|
|
773
|
-
const EXPRESSION_PROPERTIES = ['alt', 'source'];
|
|
840
|
+
const EXPRESSION_PROPERTIES = ['alt', 'source', 'text'];
|
|
774
841
|
function findErrors(errors, path) {
|
|
775
842
|
return errors[pathStringify(path)];
|
|
776
843
|
}
|
|
@@ -835,7 +902,7 @@ function getSchemaVariables(schema) {
|
|
|
835
902
|
type,
|
|
836
903
|
conditional
|
|
837
904
|
} = component;
|
|
838
|
-
if (['
|
|
905
|
+
if (['button'].includes(type)) {
|
|
839
906
|
return variables;
|
|
840
907
|
}
|
|
841
908
|
if (key) {
|
|
@@ -1008,7 +1075,7 @@ var importModule = {
|
|
|
1008
1075
|
|
|
1009
1076
|
const NODE_TYPE_TEXT = 3,
|
|
1010
1077
|
NODE_TYPE_ELEMENT = 1;
|
|
1011
|
-
const ALLOWED_NODES = ['h1', 'h2', 'h3', 'h4', 'h5', 'span', 'em', 'a', 'p', 'div', 'ul', 'ol', 'li', 'hr', 'blockquote', 'img', 'pre', 'code', 'br', 'strong'];
|
|
1078
|
+
const ALLOWED_NODES = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span', 'em', 'a', 'p', 'div', 'ul', 'ol', 'li', 'hr', 'blockquote', 'img', 'pre', 'code', 'br', 'strong'];
|
|
1012
1079
|
const ALLOWED_ATTRIBUTES = ['align', 'alt', 'class', 'href', 'id', 'name', 'rel', 'target', 'src'];
|
|
1013
1080
|
const ALLOWED_URI_PATTERN = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape
|
|
1014
1081
|
const ALLOWED_IMAGE_SRC_PATTERN = /^(https?|data):.*/i; // eslint-disable-line no-useless-escape
|
|
@@ -1140,7 +1207,7 @@ function prefixId(id, formId) {
|
|
|
1140
1207
|
return `fjs-form-${id}`;
|
|
1141
1208
|
}
|
|
1142
1209
|
function markdownToHTML(markdown) {
|
|
1143
|
-
const htmls = markdown.split(/(?:\r?\n){2,}/).map(line => /^((\d+.)|[><\s#-*])/.test(line) ? snarkdown__default['default'](line) : `<p>${snarkdown__default['default'](line)}</p>`);
|
|
1210
|
+
const htmls = markdown.toString().split(/(?:\r?\n){2,}/).map(line => /^((\d+.)|[><\s#-*])/.test(line) ? snarkdown__default['default'](line) : `<p>${snarkdown__default['default'](line)}</p>`);
|
|
1144
1211
|
return htmls.join('\n\n');
|
|
1145
1212
|
}
|
|
1146
1213
|
|
|
@@ -1162,46 +1229,8 @@ function safeMarkdown(markdown) {
|
|
|
1162
1229
|
function safeImageSource(src) {
|
|
1163
1230
|
return sanitizeImageSource(src);
|
|
1164
1231
|
}
|
|
1165
|
-
function sanitizeSingleSelectValue(options) {
|
|
1166
|
-
const {
|
|
1167
|
-
formField,
|
|
1168
|
-
data,
|
|
1169
|
-
value
|
|
1170
|
-
} = options;
|
|
1171
|
-
const {
|
|
1172
|
-
valuesKey,
|
|
1173
|
-
values
|
|
1174
|
-
} = formField;
|
|
1175
|
-
try {
|
|
1176
|
-
const validValues = (valuesKey ? minDash.get(data, [valuesKey]) : values).map(v => v.value) || [];
|
|
1177
|
-
return validValues.includes(value) ? value : null;
|
|
1178
|
-
} catch (error) {
|
|
1179
|
-
// use default value in case of formatting error
|
|
1180
|
-
// TODO(@Skaiir): log a warning when this happens - https://github.com/bpmn-io/form-js/issues/289
|
|
1181
|
-
return null;
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
function sanitizeMultiSelectValue(options) {
|
|
1185
|
-
const {
|
|
1186
|
-
formField,
|
|
1187
|
-
data,
|
|
1188
|
-
value
|
|
1189
|
-
} = options;
|
|
1190
|
-
const {
|
|
1191
|
-
valuesKey,
|
|
1192
|
-
values
|
|
1193
|
-
} = formField;
|
|
1194
|
-
try {
|
|
1195
|
-
const validValues = (valuesKey ? minDash.get(data, [valuesKey]) : values).map(v => v.value) || [];
|
|
1196
|
-
return value.filter(v => validValues.includes(v));
|
|
1197
|
-
} catch (error) {
|
|
1198
|
-
// use default value in case of formatting error
|
|
1199
|
-
// TODO(@Skaiir): log a warning when this happens - https://github.com/bpmn-io/form-js/issues/289
|
|
1200
|
-
return [];
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
1232
|
|
|
1204
|
-
const type$
|
|
1233
|
+
const type$b = 'button';
|
|
1205
1234
|
function Button(props) {
|
|
1206
1235
|
const {
|
|
1207
1236
|
disabled,
|
|
@@ -1211,7 +1240,7 @@ function Button(props) {
|
|
|
1211
1240
|
action = 'submit'
|
|
1212
1241
|
} = field;
|
|
1213
1242
|
return jsxRuntime.jsx("div", {
|
|
1214
|
-
class: formFieldClasses(type$
|
|
1243
|
+
class: formFieldClasses(type$b),
|
|
1215
1244
|
children: jsxRuntime.jsx("button", {
|
|
1216
1245
|
class: "fjs-button",
|
|
1217
1246
|
type: action,
|
|
@@ -1226,7 +1255,7 @@ Button.create = function (options = {}) {
|
|
|
1226
1255
|
...options
|
|
1227
1256
|
};
|
|
1228
1257
|
};
|
|
1229
|
-
Button.type = type$
|
|
1258
|
+
Button.type = type$b;
|
|
1230
1259
|
Button.label = 'Button';
|
|
1231
1260
|
Button.keyed = true;
|
|
1232
1261
|
|
|
@@ -1290,11 +1319,14 @@ function Label(props) {
|
|
|
1290
1319
|
const {
|
|
1291
1320
|
id,
|
|
1292
1321
|
label,
|
|
1322
|
+
collapseOnEmpty = true,
|
|
1293
1323
|
required = false
|
|
1294
1324
|
} = props;
|
|
1295
1325
|
return jsxRuntime.jsxs("label", {
|
|
1296
1326
|
for: id,
|
|
1297
|
-
class: classNames__default['default']('fjs-form-field-label',
|
|
1327
|
+
class: classNames__default['default']('fjs-form-field-label', {
|
|
1328
|
+
'fjs-incollapsible-label': !collapseOnEmpty
|
|
1329
|
+
}, props['class']),
|
|
1298
1330
|
children: [props.children, label || '', required && jsxRuntime.jsx("span", {
|
|
1299
1331
|
class: "fjs-asterix",
|
|
1300
1332
|
children: "*"
|
|
@@ -1302,7 +1334,7 @@ function Label(props) {
|
|
|
1302
1334
|
});
|
|
1303
1335
|
}
|
|
1304
1336
|
|
|
1305
|
-
const type$
|
|
1337
|
+
const type$a = 'checkbox';
|
|
1306
1338
|
function Checkbox(props) {
|
|
1307
1339
|
const {
|
|
1308
1340
|
disabled,
|
|
@@ -1327,7 +1359,7 @@ function Checkbox(props) {
|
|
|
1327
1359
|
formId
|
|
1328
1360
|
} = hooks.useContext(FormContext);
|
|
1329
1361
|
return jsxRuntime.jsxs("div", {
|
|
1330
|
-
class: classNames__default['default'](formFieldClasses(type$
|
|
1362
|
+
class: classNames__default['default'](formFieldClasses(type$a, {
|
|
1331
1363
|
errors,
|
|
1332
1364
|
disabled
|
|
1333
1365
|
}), {
|
|
@@ -1357,7 +1389,7 @@ Checkbox.create = function (options = {}) {
|
|
|
1357
1389
|
...options
|
|
1358
1390
|
};
|
|
1359
1391
|
};
|
|
1360
|
-
Checkbox.type = type$
|
|
1392
|
+
Checkbox.type = type$a;
|
|
1361
1393
|
Checkbox.label = 'Checkbox';
|
|
1362
1394
|
Checkbox.keyed = true;
|
|
1363
1395
|
Checkbox.emptyValue = false;
|
|
@@ -1432,7 +1464,222 @@ const buildLoadedState = values => ({
|
|
|
1432
1464
|
state: LOAD_STATES.LOADED
|
|
1433
1465
|
});
|
|
1434
1466
|
|
|
1435
|
-
const
|
|
1467
|
+
const ENTER_KEYDOWN_EVENT = new KeyboardEvent('keydown', {
|
|
1468
|
+
code: 'Enter',
|
|
1469
|
+
key: 'Enter',
|
|
1470
|
+
charCode: 13,
|
|
1471
|
+
keyCode: 13,
|
|
1472
|
+
view: window,
|
|
1473
|
+
bubbles: true
|
|
1474
|
+
});
|
|
1475
|
+
function focusRelevantFlatpickerDay(flatpickrInstance) {
|
|
1476
|
+
if (!flatpickrInstance) return;
|
|
1477
|
+
!flatpickrInstance.isOpen && flatpickrInstance.open();
|
|
1478
|
+
const container = flatpickrInstance.calendarContainer;
|
|
1479
|
+
const dayToFocus = container.querySelector('.flatpickr-day.selected') || container.querySelector('.flatpickr-day.today') || container.querySelector('.flatpickr-day');
|
|
1480
|
+
dayToFocus && dayToFocus.focus();
|
|
1481
|
+
}
|
|
1482
|
+
function formatTime(use24h, minutes) {
|
|
1483
|
+
if (minutes === null) return null;
|
|
1484
|
+
const wrappedMinutes = minutes % (24 * 60);
|
|
1485
|
+
const minute = minutes % 60;
|
|
1486
|
+
let hour = Math.floor(wrappedMinutes / 60);
|
|
1487
|
+
if (use24h) {
|
|
1488
|
+
return _getZeroPaddedString(hour) + ':' + _getZeroPaddedString(minute);
|
|
1489
|
+
}
|
|
1490
|
+
hour = hour % 12 || 12;
|
|
1491
|
+
const isPM = wrappedMinutes >= 12 * 60;
|
|
1492
|
+
return _getZeroPaddedString(hour) + ':' + _getZeroPaddedString(minute) + ' ' + (isPM ? 'PM' : 'AM');
|
|
1493
|
+
}
|
|
1494
|
+
function parseInputTime(stringTime) {
|
|
1495
|
+
let workingString = stringTime.toLowerCase();
|
|
1496
|
+
const is12h = workingString.includes('am') || workingString.includes('pm');
|
|
1497
|
+
if (is12h) {
|
|
1498
|
+
const isPM = workingString.includes('pm');
|
|
1499
|
+
const digits = workingString.match(/\d+/g);
|
|
1500
|
+
const displayHour = parseInt(digits?.[0]);
|
|
1501
|
+
const minute = parseInt(digits?.[1]) || 0;
|
|
1502
|
+
const isValidDisplayHour = minDash.isNumber(displayHour) && displayHour >= 1 && displayHour <= 12;
|
|
1503
|
+
const isValidMinute = minute >= 0 && minute <= 59;
|
|
1504
|
+
if (!isValidDisplayHour || !isValidMinute) return null;
|
|
1505
|
+
const hour = displayHour % 12 + (isPM ? 12 : 0);
|
|
1506
|
+
return hour * 60 + minute;
|
|
1507
|
+
} else {
|
|
1508
|
+
const digits = workingString.match(/\d+/g);
|
|
1509
|
+
const hour = parseInt(digits?.[0]);
|
|
1510
|
+
const minute = parseInt(digits?.[1]);
|
|
1511
|
+
const isValidHour = minDash.isNumber(hour) && hour >= 0 && hour <= 23;
|
|
1512
|
+
const isValidMinute = minDash.isNumber(minute) && minute >= 0 && minute <= 59;
|
|
1513
|
+
if (!isValidHour || !isValidMinute) return null;
|
|
1514
|
+
return hour * 60 + minute;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
function serializeTime(minutes, offset, timeSerializingFormat) {
|
|
1518
|
+
if (timeSerializingFormat === TIME_SERIALISING_FORMATS.UTC_NORMALIZED) {
|
|
1519
|
+
const normalizedMinutes = (minutes + offset + MINUTES_IN_DAY) % MINUTES_IN_DAY;
|
|
1520
|
+
return _getZeroPaddedString(Math.floor(normalizedMinutes / 60)) + ':' + _getZeroPaddedString(normalizedMinutes % 60) + 'Z';
|
|
1521
|
+
}
|
|
1522
|
+
const baseTime = _getZeroPaddedString(Math.floor(minutes / 60)) + ':' + _getZeroPaddedString(minutes % 60);
|
|
1523
|
+
const addUTCOffset = timeSerializingFormat === TIME_SERIALISING_FORMATS.UTC_OFFSET;
|
|
1524
|
+
return baseTime + (addUTCOffset ? formatTimezoneOffset(offset) : '');
|
|
1525
|
+
}
|
|
1526
|
+
function parseIsoTime(isoTimeString) {
|
|
1527
|
+
if (!isoTimeString) return null;
|
|
1528
|
+
const parseBasicMinutes = timeString => {
|
|
1529
|
+
const timeSegments = timeString.split(':');
|
|
1530
|
+
const hour = parseInt(timeSegments[0]);
|
|
1531
|
+
const minute = timeSegments.length > 1 ? parseInt(timeSegments[1]) : 0;
|
|
1532
|
+
if (isNaN(hour) || hour < 0 || hour > 24 || isNaN(minute) || minute < 0 || minute > 60) return null;
|
|
1533
|
+
return hour * 60 + minute;
|
|
1534
|
+
};
|
|
1535
|
+
const localOffset = new Date().getTimezoneOffset();
|
|
1536
|
+
|
|
1537
|
+
// Parse normalized time
|
|
1538
|
+
if (isoTimeString.includes('Z')) {
|
|
1539
|
+
isoTimeString = isoTimeString.replace('Z', '');
|
|
1540
|
+
const minutes = parseBasicMinutes(isoTimeString);
|
|
1541
|
+
if (minutes === null) return null;
|
|
1542
|
+
return (minutes - localOffset + MINUTES_IN_DAY) % MINUTES_IN_DAY;
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
// Parse offset positive time
|
|
1546
|
+
else if (isoTimeString.includes('+')) {
|
|
1547
|
+
const [timeString, offsetString] = isoTimeString.split('+');
|
|
1548
|
+
const minutes = parseBasicMinutes(timeString);
|
|
1549
|
+
let inboundOffset = parseBasicMinutes(offsetString);
|
|
1550
|
+
if (minutes === null || inboundOffset === null) return null;
|
|
1551
|
+
|
|
1552
|
+
// The offset is flipped for consistency with javascript
|
|
1553
|
+
inboundOffset = -inboundOffset;
|
|
1554
|
+
return (minutes + inboundOffset - localOffset + MINUTES_IN_DAY) % MINUTES_IN_DAY;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
// Parse offset negative time
|
|
1558
|
+
else if (isoTimeString.includes('-')) {
|
|
1559
|
+
const [timeString, offsetString] = isoTimeString.split('-');
|
|
1560
|
+
const minutes = parseBasicMinutes(timeString);
|
|
1561
|
+
let inboundOffset = parseBasicMinutes(offsetString);
|
|
1562
|
+
if (minutes === null || inboundOffset === null) return null;
|
|
1563
|
+
return (minutes + inboundOffset - localOffset + MINUTES_IN_DAY) % MINUTES_IN_DAY;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
// Default to local parsing
|
|
1567
|
+
else {
|
|
1568
|
+
return parseBasicMinutes(isoTimeString);
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
function serializeDate(date) {
|
|
1572
|
+
var d = new Date(date),
|
|
1573
|
+
month = '' + (d.getMonth() + 1),
|
|
1574
|
+
day = '' + d.getDate(),
|
|
1575
|
+
year = d.getFullYear();
|
|
1576
|
+
if (month.length < 2) month = '0' + month;
|
|
1577
|
+
if (day.length < 2) day = '0' + day;
|
|
1578
|
+
return [year, month, day].join('-');
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
// this method is used to make the `new Date(value)` parsing behavior stricter
|
|
1582
|
+
function isDateTimeInputInformationSufficient(value) {
|
|
1583
|
+
if (!value || typeof value !== 'string') return false;
|
|
1584
|
+
const segments = value.split('T');
|
|
1585
|
+
if (segments.length != 2) return false;
|
|
1586
|
+
const dateNumbers = segments[0].split('-');
|
|
1587
|
+
if (dateNumbers.length != 3) return false;
|
|
1588
|
+
return true;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
// this method checks if the date isn't a datetime, or a partial date
|
|
1592
|
+
function isDateInputInformationMatching(value) {
|
|
1593
|
+
if (!value || typeof value !== 'string') return false;
|
|
1594
|
+
if (value.includes('T')) return false;
|
|
1595
|
+
const dateNumbers = value.split('-');
|
|
1596
|
+
if (dateNumbers.length != 3) return false;
|
|
1597
|
+
return true;
|
|
1598
|
+
}
|
|
1599
|
+
function serializeDateTime(date, time, timeSerializingFormat) {
|
|
1600
|
+
const workingDate = new Date();
|
|
1601
|
+
workingDate.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
|
|
1602
|
+
workingDate.setHours(Math.floor(time / 60), time % 60, 0, 0);
|
|
1603
|
+
if (timeSerializingFormat === TIME_SERIALISING_FORMATS.UTC_NORMALIZED) {
|
|
1604
|
+
const timezoneOffsetMinutes = workingDate.getTimezoneOffset();
|
|
1605
|
+
const dayOffset = time + timezoneOffsetMinutes < 0 ? -1 : time + timezoneOffsetMinutes > MINUTES_IN_DAY ? 1 : 0;
|
|
1606
|
+
|
|
1607
|
+
// Apply the date rollover pre-emptively
|
|
1608
|
+
workingDate.setHours(workingDate.getHours() + dayOffset * 24);
|
|
1609
|
+
}
|
|
1610
|
+
return serializeDate(workingDate) + 'T' + serializeTime(time, workingDate.getTimezoneOffset(), timeSerializingFormat);
|
|
1611
|
+
}
|
|
1612
|
+
function formatTimezoneOffset(minutes) {
|
|
1613
|
+
return _getSignedPaddedHours(minutes) + ':' + _getZeroPaddedString(Math.abs(minutes % 60));
|
|
1614
|
+
}
|
|
1615
|
+
function isInvalidDateString(value) {
|
|
1616
|
+
return isNaN(new Date(Date.parse(value)).getTime());
|
|
1617
|
+
}
|
|
1618
|
+
function _getSignedPaddedHours(minutes) {
|
|
1619
|
+
if (minutes > 0) {
|
|
1620
|
+
return '-' + _getZeroPaddedString(Math.floor(minutes / 60));
|
|
1621
|
+
} else {
|
|
1622
|
+
return '+' + _getZeroPaddedString(Math.floor((0 - minutes) / 60));
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
function _getZeroPaddedString(time) {
|
|
1626
|
+
return time.toString().padStart(2, '0');
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
function sanitizeDateTimePickerValue(options) {
|
|
1630
|
+
const {
|
|
1631
|
+
formField,
|
|
1632
|
+
value
|
|
1633
|
+
} = options;
|
|
1634
|
+
const {
|
|
1635
|
+
subtype
|
|
1636
|
+
} = formField;
|
|
1637
|
+
if (typeof value !== 'string') return null;
|
|
1638
|
+
if (subtype === DATETIME_SUBTYPES.DATE && (isInvalidDateString(value) || !isDateInputInformationMatching(value))) return null;
|
|
1639
|
+
if (subtype === DATETIME_SUBTYPES.TIME && parseIsoTime(value) === null) return null;
|
|
1640
|
+
if (subtype === DATETIME_SUBTYPES.DATETIME && (isInvalidDateString(value) || !isDateTimeInputInformationSufficient(value))) return null;
|
|
1641
|
+
return value;
|
|
1642
|
+
}
|
|
1643
|
+
function sanitizeSingleSelectValue(options) {
|
|
1644
|
+
const {
|
|
1645
|
+
formField,
|
|
1646
|
+
data,
|
|
1647
|
+
value
|
|
1648
|
+
} = options;
|
|
1649
|
+
const {
|
|
1650
|
+
valuesKey,
|
|
1651
|
+
values
|
|
1652
|
+
} = formField;
|
|
1653
|
+
try {
|
|
1654
|
+
const validValues = (valuesKey ? minDash.get(data, [valuesKey]) : values).map(v => v.value) || [];
|
|
1655
|
+
return validValues.includes(value) ? value : null;
|
|
1656
|
+
} catch (error) {
|
|
1657
|
+
// use default value in case of formatting error
|
|
1658
|
+
// TODO(@Skaiir): log a warning when this happens - https://github.com/bpmn-io/form-js/issues/289
|
|
1659
|
+
return null;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
function sanitizeMultiSelectValue(options) {
|
|
1663
|
+
const {
|
|
1664
|
+
formField,
|
|
1665
|
+
data,
|
|
1666
|
+
value
|
|
1667
|
+
} = options;
|
|
1668
|
+
const {
|
|
1669
|
+
valuesKey,
|
|
1670
|
+
values
|
|
1671
|
+
} = formField;
|
|
1672
|
+
try {
|
|
1673
|
+
const validValues = (valuesKey ? minDash.get(data, [valuesKey]) : values).map(v => v.value) || [];
|
|
1674
|
+
return value.filter(v => validValues.includes(v));
|
|
1675
|
+
} catch (error) {
|
|
1676
|
+
// use default value in case of formatting error
|
|
1677
|
+
// TODO(@Skaiir): log a warning when this happens - https://github.com/bpmn-io/form-js/issues/289
|
|
1678
|
+
return [];
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
const type$9 = 'checklist';
|
|
1436
1683
|
function Checklist(props) {
|
|
1437
1684
|
const {
|
|
1438
1685
|
disabled,
|
|
@@ -1465,7 +1712,7 @@ function Checklist(props) {
|
|
|
1465
1712
|
formId
|
|
1466
1713
|
} = hooks.useContext(FormContext);
|
|
1467
1714
|
return jsxRuntime.jsxs("div", {
|
|
1468
|
-
class: classNames__default['default'](formFieldClasses(type$
|
|
1715
|
+
class: classNames__default['default'](formFieldClasses(type$9, {
|
|
1469
1716
|
errors,
|
|
1470
1717
|
disabled
|
|
1471
1718
|
})),
|
|
@@ -1505,7 +1752,7 @@ Checklist.create = function (options = {}) {
|
|
|
1505
1752
|
...options
|
|
1506
1753
|
};
|
|
1507
1754
|
};
|
|
1508
|
-
Checklist.type = type$
|
|
1755
|
+
Checklist.type = type$9;
|
|
1509
1756
|
Checklist.label = 'Checklist';
|
|
1510
1757
|
Checklist.keyed = true;
|
|
1511
1758
|
Checklist.emptyValue = [];
|
|
@@ -1520,11 +1767,18 @@ Checklist.sanitizeValue = sanitizeMultiSelectValue;
|
|
|
1520
1767
|
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
1521
1768
|
*/
|
|
1522
1769
|
function useCondition(condition, data) {
|
|
1770
|
+
const initialData = useService('form')._getState().initialData;
|
|
1523
1771
|
const conditionChecker = useService('conditionChecker', false);
|
|
1524
1772
|
if (!conditionChecker) {
|
|
1525
1773
|
return null;
|
|
1526
1774
|
}
|
|
1527
|
-
|
|
1775
|
+
|
|
1776
|
+
// make sure we do not use data from hidden fields
|
|
1777
|
+
const filteredData = {
|
|
1778
|
+
...initialData,
|
|
1779
|
+
...conditionChecker.applyConditions(data, data)
|
|
1780
|
+
};
|
|
1781
|
+
return conditionChecker.check(condition, filteredData);
|
|
1528
1782
|
}
|
|
1529
1783
|
|
|
1530
1784
|
const noop$1 = () => false;
|
|
@@ -1606,115 +1860,771 @@ Default.create = function (options = {}) {
|
|
|
1606
1860
|
Default.type = 'default';
|
|
1607
1861
|
Default.keyed = false;
|
|
1608
1862
|
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
*/
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
})]
|
|
1628
|
-
});
|
|
1629
|
-
}
|
|
1630
|
-
function Lightbox(props) {
|
|
1863
|
+
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); }
|
|
1864
|
+
var CalendarIcon = (({
|
|
1865
|
+
styles = {},
|
|
1866
|
+
...props
|
|
1867
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$h({
|
|
1868
|
+
width: "14",
|
|
1869
|
+
height: "15",
|
|
1870
|
+
viewBox: "0 0 28 30",
|
|
1871
|
+
fill: "none",
|
|
1872
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1873
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
1874
|
+
fillRule: "evenodd",
|
|
1875
|
+
clipRule: "evenodd",
|
|
1876
|
+
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",
|
|
1877
|
+
fill: "#000"
|
|
1878
|
+
})));
|
|
1879
|
+
|
|
1880
|
+
function InputAdorner(props) {
|
|
1631
1881
|
const {
|
|
1632
|
-
|
|
1882
|
+
pre = null,
|
|
1883
|
+
post = null,
|
|
1884
|
+
rootRef,
|
|
1885
|
+
inputRef,
|
|
1886
|
+
children,
|
|
1887
|
+
disabled,
|
|
1888
|
+
hasErrors
|
|
1633
1889
|
} = props;
|
|
1634
|
-
|
|
1635
|
-
return null;
|
|
1636
|
-
}
|
|
1890
|
+
const onAdornmentClick = () => inputRef?.current?.focus();
|
|
1637
1891
|
return jsxRuntime.jsxs("div", {
|
|
1638
|
-
class:
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
class: "
|
|
1646
|
-
|
|
1647
|
-
children: [
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
children: jsxRuntime.jsx(Logo, {})
|
|
1653
|
-
}), jsxRuntime.jsxs("span", {
|
|
1654
|
-
children: ["Web-based tooling for BPMN, DMN, and forms powered by ", jsxRuntime.jsx("a", {
|
|
1655
|
-
href: "https://bpmn.io",
|
|
1656
|
-
target: "_blank",
|
|
1657
|
-
rel: "noopener",
|
|
1658
|
-
children: "bpmn.io"
|
|
1659
|
-
}), "."]
|
|
1660
|
-
})]
|
|
1661
|
-
})]
|
|
1662
|
-
});
|
|
1663
|
-
}
|
|
1664
|
-
function Link(props) {
|
|
1665
|
-
return jsxRuntime.jsx("div", {
|
|
1666
|
-
class: "fjs-powered-by fjs-form-field",
|
|
1667
|
-
style: "text-align: right",
|
|
1668
|
-
children: jsxRuntime.jsx("a", {
|
|
1669
|
-
href: "https://bpmn.io",
|
|
1670
|
-
target: "_blank",
|
|
1671
|
-
rel: "noopener",
|
|
1672
|
-
class: "fjs-powered-by-link",
|
|
1673
|
-
title: "Powered by bpmn.io",
|
|
1674
|
-
style: "color: #404040",
|
|
1675
|
-
onClick: props.onClick,
|
|
1676
|
-
children: jsxRuntime.jsx(Logo, {})
|
|
1677
|
-
})
|
|
1678
|
-
});
|
|
1679
|
-
}
|
|
1680
|
-
function PoweredBy(props) {
|
|
1681
|
-
const [open, setOpen] = hooks.useState(false);
|
|
1682
|
-
function toggleOpen(open) {
|
|
1683
|
-
return event => {
|
|
1684
|
-
event.preventDefault();
|
|
1685
|
-
setOpen(open);
|
|
1686
|
-
};
|
|
1687
|
-
}
|
|
1688
|
-
return jsxRuntime.jsxs(preact.Fragment, {
|
|
1689
|
-
children: [React.createPortal(jsxRuntime.jsx(Lightbox, {
|
|
1690
|
-
open: open,
|
|
1691
|
-
onBackdropClick: toggleOpen(false)
|
|
1692
|
-
}), document.body), jsxRuntime.jsx(Link, {
|
|
1693
|
-
onClick: toggleOpen(true)
|
|
1892
|
+
class: classNames__default['default']('fjs-input-group', {
|
|
1893
|
+
'disabled': disabled
|
|
1894
|
+
}, {
|
|
1895
|
+
'hasErrors': hasErrors
|
|
1896
|
+
}),
|
|
1897
|
+
ref: rootRef,
|
|
1898
|
+
children: [pre !== null && jsxRuntime.jsxs("span", {
|
|
1899
|
+
class: "fjs-input-adornment border-right border-radius-left",
|
|
1900
|
+
onClick: onAdornmentClick,
|
|
1901
|
+
children: [" ", pre, " "]
|
|
1902
|
+
}), children, post !== null && jsxRuntime.jsxs("span", {
|
|
1903
|
+
class: "fjs-input-adornment border-left border-radius-right",
|
|
1904
|
+
onClick: onAdornmentClick,
|
|
1905
|
+
children: [" ", post, " "]
|
|
1694
1906
|
})]
|
|
1695
1907
|
});
|
|
1696
1908
|
}
|
|
1697
1909
|
|
|
1698
|
-
|
|
1699
|
-
function FormComponent(props) {
|
|
1700
|
-
const form = useService('form');
|
|
1701
|
-
const {
|
|
1702
|
-
schema
|
|
1703
|
-
} = form._getState();
|
|
1910
|
+
function Datepicker(props) {
|
|
1704
1911
|
const {
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1912
|
+
id,
|
|
1913
|
+
label,
|
|
1914
|
+
collapseLabelOnEmpty,
|
|
1915
|
+
formId,
|
|
1916
|
+
required,
|
|
1917
|
+
disabled,
|
|
1918
|
+
disallowPassedDates,
|
|
1919
|
+
date,
|
|
1920
|
+
setDate
|
|
1708
1921
|
} = props;
|
|
1709
|
-
const
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
const
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1922
|
+
const dateInputRef = hooks.useRef();
|
|
1923
|
+
const focusScopeRef = hooks.useRef();
|
|
1924
|
+
const [flatpickrInstance, setFlatpickrInstance] = hooks.useState(null);
|
|
1925
|
+
const [isInputDirty, setIsInputDirty] = hooks.useState(false);
|
|
1926
|
+
const [forceFocusCalendar, setForceFocusCalendar] = hooks.useState(false);
|
|
1927
|
+
|
|
1928
|
+
// shorts the date value back to the source
|
|
1929
|
+
hooks.useEffect(() => {
|
|
1930
|
+
if (!flatpickrInstance || !flatpickrInstance.config) return;
|
|
1931
|
+
flatpickrInstance.setDate(date, true);
|
|
1932
|
+
setIsInputDirty(false);
|
|
1933
|
+
}, [flatpickrInstance, date.toString()]);
|
|
1934
|
+
hooks.useEffect(() => {
|
|
1935
|
+
if (!forceFocusCalendar) return;
|
|
1936
|
+
focusRelevantFlatpickerDay(flatpickrInstance);
|
|
1937
|
+
setForceFocusCalendar(false);
|
|
1938
|
+
}, [flatpickrInstance, forceFocusCalendar]);
|
|
1939
|
+
|
|
1940
|
+
// setup flatpickr instance
|
|
1941
|
+
hooks.useEffect(() => {
|
|
1942
|
+
if (disabled) {
|
|
1943
|
+
setFlatpickrInstance(null);
|
|
1944
|
+
return;
|
|
1945
|
+
}
|
|
1946
|
+
let config = {
|
|
1947
|
+
allowInput: true,
|
|
1948
|
+
dateFormat: 'm/d/Y',
|
|
1949
|
+
static: true,
|
|
1950
|
+
clickOpens: false,
|
|
1951
|
+
errorHandler: () => {/* do nothing, we expect the values to sometimes be erronous and we don't want warnings polluting the console */}
|
|
1952
|
+
};
|
|
1953
|
+
if (disallowPassedDates) {
|
|
1954
|
+
config = {
|
|
1955
|
+
...config,
|
|
1956
|
+
minDate: 'today'
|
|
1957
|
+
};
|
|
1958
|
+
}
|
|
1959
|
+
const instance = flatpickr__default['default'](dateInputRef.current, config);
|
|
1960
|
+
setFlatpickrInstance(instance);
|
|
1961
|
+
const onCalendarFocusOut = e => {
|
|
1962
|
+
if (!instance.calendarContainer.contains(e.relatedTarget) && e.relatedTarget != dateInputRef.current) {
|
|
1963
|
+
instance.close();
|
|
1964
|
+
}
|
|
1965
|
+
};
|
|
1966
|
+
|
|
1967
|
+
// remove dirty tag to have mouse day selection prioritize input blur
|
|
1968
|
+
const onCalendarMouseDown = e => {
|
|
1969
|
+
if (e.target.classList.contains('flatpickr-day')) {
|
|
1970
|
+
setIsInputDirty(false);
|
|
1971
|
+
}
|
|
1972
|
+
};
|
|
1973
|
+
|
|
1974
|
+
// when the dropdown of the datepickr opens, we register a few event handlers to re-implement some of the
|
|
1975
|
+
// flatpicker logic that was lost when setting allowInput to true
|
|
1976
|
+
instance.config.onOpen = [() => instance.calendarContainer.addEventListener('focusout', onCalendarFocusOut), () => instance.calendarContainer.addEventListener('mousedown', onCalendarMouseDown)];
|
|
1977
|
+
instance.config.onClose = [() => instance.calendarContainer.removeEventListener('focusout', onCalendarFocusOut), () => instance.calendarContainer.removeEventListener('mousedown', onCalendarMouseDown)];
|
|
1978
|
+
}, [disabled, disallowPassedDates]);
|
|
1979
|
+
|
|
1980
|
+
// onChange is updated dynamically, so not to re-render the flatpicker every time it changes
|
|
1981
|
+
hooks.useEffect(() => {
|
|
1982
|
+
if (!flatpickrInstance || !flatpickrInstance.config) return;
|
|
1983
|
+
flatpickrInstance.config.onChange = [date => setDate(new Date(date)), () => setIsInputDirty(false)];
|
|
1984
|
+
}, [flatpickrInstance, setDate]);
|
|
1985
|
+
const onInputKeyDown = hooks.useCallback(e => {
|
|
1986
|
+
if (!flatpickrInstance) return;
|
|
1987
|
+
if (e.code === 'Escape') {
|
|
1988
|
+
flatpickrInstance.close();
|
|
1989
|
+
}
|
|
1990
|
+
if (e.code === 'ArrowDown') {
|
|
1991
|
+
if (isInputDirty) {
|
|
1992
|
+
// trigger an enter keypress to submit the new input, then focus calendar day on the next render cycle
|
|
1993
|
+
dateInputRef.current.dispatchEvent(ENTER_KEYDOWN_EVENT);
|
|
1994
|
+
setIsInputDirty(false);
|
|
1995
|
+
setForceFocusCalendar(true);
|
|
1996
|
+
} else {
|
|
1997
|
+
// focus calendar day immediately
|
|
1998
|
+
focusRelevantFlatpickerDay(flatpickrInstance);
|
|
1999
|
+
}
|
|
2000
|
+
e.preventDefault();
|
|
2001
|
+
}
|
|
2002
|
+
if (e.code === 'Enter') {
|
|
2003
|
+
setIsInputDirty(false);
|
|
2004
|
+
}
|
|
2005
|
+
}, [flatpickrInstance, isInputDirty]);
|
|
2006
|
+
const onInputFocus = hooks.useCallback(e => {
|
|
2007
|
+
if (!flatpickrInstance || focusScopeRef.current.contains(e.relatedTarget)) return;
|
|
2008
|
+
flatpickrInstance.open();
|
|
2009
|
+
}, [flatpickrInstance]);
|
|
2010
|
+
|
|
2011
|
+
// simulate an enter press on blur to make sure the date value is submitted in all scenarios
|
|
2012
|
+
const onInputBlur = hooks.useCallback(e => {
|
|
2013
|
+
if (!isInputDirty || e.relatedTarget && e.relatedTarget.classList.contains('flatpickr-day')) return;
|
|
2014
|
+
dateInputRef.current.dispatchEvent(ENTER_KEYDOWN_EVENT);
|
|
2015
|
+
setIsInputDirty(false);
|
|
2016
|
+
}, [isInputDirty]);
|
|
2017
|
+
const fullId = `${prefixId(id, formId)}--date`;
|
|
2018
|
+
return jsxRuntime.jsxs("div", {
|
|
2019
|
+
class: "fjs-datetime-subsection",
|
|
2020
|
+
children: [jsxRuntime.jsx(Label, {
|
|
2021
|
+
id: fullId,
|
|
2022
|
+
label: label,
|
|
2023
|
+
collapseOnEmpty: collapseLabelOnEmpty,
|
|
2024
|
+
required: required
|
|
2025
|
+
}), jsxRuntime.jsx(InputAdorner, {
|
|
2026
|
+
pre: jsxRuntime.jsx(CalendarIcon, {}),
|
|
2027
|
+
disabled: disabled,
|
|
2028
|
+
rootRef: focusScopeRef,
|
|
2029
|
+
inputRef: dateInputRef,
|
|
2030
|
+
children: jsxRuntime.jsx("div", {
|
|
2031
|
+
class: "fjs-datepicker",
|
|
2032
|
+
style: {
|
|
2033
|
+
width: '100%'
|
|
2034
|
+
},
|
|
2035
|
+
children: jsxRuntime.jsx("input", {
|
|
2036
|
+
ref: dateInputRef,
|
|
2037
|
+
type: "text",
|
|
2038
|
+
id: fullId,
|
|
2039
|
+
class: 'fjs-input',
|
|
2040
|
+
disabled: disabled,
|
|
2041
|
+
placeholder: "mm/dd/yyyy",
|
|
2042
|
+
autoComplete: "false",
|
|
2043
|
+
onFocus: onInputFocus,
|
|
2044
|
+
onKeyDown: onInputKeyDown,
|
|
2045
|
+
onMouseDown: e => !flatpickrInstance.isOpen && flatpickrInstance.open(),
|
|
2046
|
+
onBlur: onInputBlur,
|
|
2047
|
+
onInput: e => setIsInputDirty(true),
|
|
2048
|
+
"data-input": true
|
|
2049
|
+
})
|
|
2050
|
+
})
|
|
2051
|
+
})]
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
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); }
|
|
2056
|
+
var ClockIcon = (({
|
|
2057
|
+
styles = {},
|
|
2058
|
+
...props
|
|
2059
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$g({
|
|
2060
|
+
width: "16",
|
|
2061
|
+
height: "16",
|
|
2062
|
+
viewBox: "0 0 28 29",
|
|
2063
|
+
fill: "none",
|
|
2064
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2065
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
2066
|
+
d: "M13 14.41L18.59 20 20 18.59l-5-5.01V5h-2v9.41z",
|
|
2067
|
+
fill: "#000"
|
|
2068
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
2069
|
+
fillRule: "evenodd",
|
|
2070
|
+
clipRule: "evenodd",
|
|
2071
|
+
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",
|
|
2072
|
+
fill: "#000"
|
|
2073
|
+
})));
|
|
2074
|
+
|
|
2075
|
+
function useKeyDownAction(targetKey, action, listenerElement = window) {
|
|
2076
|
+
function downHandler({
|
|
2077
|
+
key
|
|
2078
|
+
}) {
|
|
2079
|
+
if (key === targetKey) {
|
|
2080
|
+
action();
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
hooks.useEffect(() => {
|
|
2084
|
+
listenerElement.addEventListener('keydown', downHandler);
|
|
2085
|
+
return () => {
|
|
2086
|
+
listenerElement.removeEventListener('keydown', downHandler);
|
|
2087
|
+
};
|
|
2088
|
+
});
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
const DEFAULT_LABEL_GETTER = value => value;
|
|
2092
|
+
const NOOP = () => {};
|
|
2093
|
+
function DropdownList(props) {
|
|
2094
|
+
const {
|
|
2095
|
+
keyEventsListener = window,
|
|
2096
|
+
values = [],
|
|
2097
|
+
getLabel = DEFAULT_LABEL_GETTER,
|
|
2098
|
+
onValueSelected = NOOP,
|
|
2099
|
+
height = 235,
|
|
2100
|
+
emptyListMessage = 'No results',
|
|
2101
|
+
initialFocusIndex = 0
|
|
2102
|
+
} = props;
|
|
2103
|
+
const [mouseControl, setMouseControl] = hooks.useState(false);
|
|
2104
|
+
const [focusedValueIndex, setFocusedValueIndex] = hooks.useState(initialFocusIndex);
|
|
2105
|
+
const [smoothScrolling, setSmoothScrolling] = hooks.useState(false);
|
|
2106
|
+
const dropdownContainer = hooks.useRef();
|
|
2107
|
+
const mouseScreenPos = hooks.useRef();
|
|
2108
|
+
const focusedItem = hooks.useMemo(() => values.length ? values[focusedValueIndex] : null, [focusedValueIndex, values]);
|
|
2109
|
+
const changeFocusedValueIndex = hooks.useCallback(delta => {
|
|
2110
|
+
setFocusedValueIndex(x => Math.min(Math.max(0, x + delta), values.length - 1));
|
|
2111
|
+
}, [values.length]);
|
|
2112
|
+
hooks.useEffect(() => {
|
|
2113
|
+
if (focusedValueIndex === 0) return;
|
|
2114
|
+
if (!focusedValueIndex || !values.length) {
|
|
2115
|
+
setFocusedValueIndex(0);
|
|
2116
|
+
} else if (focusedValueIndex >= values.length) {
|
|
2117
|
+
setFocusedValueIndex(values.length - 1);
|
|
2118
|
+
}
|
|
2119
|
+
}, [focusedValueIndex, values.length]);
|
|
2120
|
+
useKeyDownAction('ArrowUp', () => {
|
|
2121
|
+
if (values.length) {
|
|
2122
|
+
changeFocusedValueIndex(-1);
|
|
2123
|
+
setMouseControl(false);
|
|
2124
|
+
}
|
|
2125
|
+
}, keyEventsListener);
|
|
2126
|
+
useKeyDownAction('ArrowDown', () => {
|
|
2127
|
+
if (values.length) {
|
|
2128
|
+
changeFocusedValueIndex(1);
|
|
2129
|
+
setMouseControl(false);
|
|
2130
|
+
}
|
|
2131
|
+
}, keyEventsListener);
|
|
2132
|
+
useKeyDownAction('Enter', () => {
|
|
2133
|
+
if (focusedItem) {
|
|
2134
|
+
onValueSelected(focusedItem);
|
|
2135
|
+
}
|
|
2136
|
+
}, keyEventsListener);
|
|
2137
|
+
hooks.useEffect(() => {
|
|
2138
|
+
const individualEntries = dropdownContainer.current.children;
|
|
2139
|
+
if (individualEntries.length && !mouseControl) {
|
|
2140
|
+
individualEntries[focusedValueIndex].scrollIntoView({
|
|
2141
|
+
block: 'nearest',
|
|
2142
|
+
inline: 'nearest'
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
}, [focusedValueIndex, mouseControl]);
|
|
2146
|
+
hooks.useEffect(() => {
|
|
2147
|
+
setSmoothScrolling(true);
|
|
2148
|
+
}, []);
|
|
2149
|
+
const onMouseMovedInKeyboardMode = (event, valueIndex) => {
|
|
2150
|
+
const userMovedCursor = !mouseScreenPos.current || mouseScreenPos.current.x !== event.screenX && mouseScreenPos.current.y !== event.screenY;
|
|
2151
|
+
if (userMovedCursor) {
|
|
2152
|
+
mouseScreenPos.current = {
|
|
2153
|
+
x: event.screenX,
|
|
2154
|
+
y: event.screenY
|
|
2155
|
+
};
|
|
2156
|
+
setMouseControl(true);
|
|
2157
|
+
setFocusedValueIndex(valueIndex);
|
|
2158
|
+
}
|
|
2159
|
+
};
|
|
2160
|
+
return jsxRuntime.jsxs("div", {
|
|
2161
|
+
ref: dropdownContainer,
|
|
2162
|
+
tabIndex: -1,
|
|
2163
|
+
class: "fjs-dropdownlist",
|
|
2164
|
+
style: {
|
|
2165
|
+
maxHeight: height,
|
|
2166
|
+
scrollBehavior: smoothScrolling ? 'smooth' : 'auto'
|
|
2167
|
+
},
|
|
2168
|
+
children: [values.length > 0 && values.map((v, i) => {
|
|
2169
|
+
return jsxRuntime.jsx("div", {
|
|
2170
|
+
class: classNames__default['default']('fjs-dropdownlist-item', {
|
|
2171
|
+
'focused': focusedValueIndex === i
|
|
2172
|
+
}),
|
|
2173
|
+
onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, i),
|
|
2174
|
+
onMouseEnter: mouseControl ? () => setFocusedValueIndex(i) : undefined,
|
|
2175
|
+
onMouseDown: e => {
|
|
2176
|
+
e.preventDefault();
|
|
2177
|
+
onValueSelected(v);
|
|
2178
|
+
},
|
|
2179
|
+
children: getLabel(v)
|
|
2180
|
+
});
|
|
2181
|
+
}), !values.length && jsxRuntime.jsx("div", {
|
|
2182
|
+
class: "fjs-dropdownlist-empty",
|
|
2183
|
+
children: emptyListMessage
|
|
2184
|
+
})]
|
|
2185
|
+
});
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
function Timepicker(props) {
|
|
2189
|
+
const {
|
|
2190
|
+
id,
|
|
2191
|
+
label,
|
|
2192
|
+
collapseLabelOnEmpty,
|
|
2193
|
+
formId,
|
|
2194
|
+
required,
|
|
2195
|
+
disabled,
|
|
2196
|
+
use24h = false,
|
|
2197
|
+
timeInterval,
|
|
2198
|
+
time,
|
|
2199
|
+
setTime
|
|
2200
|
+
} = props;
|
|
2201
|
+
const timeInputRef = hooks.useRef();
|
|
2202
|
+
const [dropdownIsOpen, setDropdownIsOpen] = hooks.useState(false);
|
|
2203
|
+
const useDropdown = hooks.useMemo(() => timeInterval !== 1, [timeInterval]);
|
|
2204
|
+
const [rawValue, setRawValue] = hooks.useState('');
|
|
2205
|
+
|
|
2206
|
+
// populates values from source
|
|
2207
|
+
hooks.useEffect(() => {
|
|
2208
|
+
if (time === null) {
|
|
2209
|
+
setRawValue('');
|
|
2210
|
+
return;
|
|
2211
|
+
}
|
|
2212
|
+
const intervalAdjustedTime = time - time % timeInterval;
|
|
2213
|
+
setRawValue(formatTime(use24h, intervalAdjustedTime));
|
|
2214
|
+
if (intervalAdjustedTime != time) {
|
|
2215
|
+
setTime(intervalAdjustedTime);
|
|
2216
|
+
}
|
|
2217
|
+
}, [time, setTime, use24h, timeInterval]);
|
|
2218
|
+
const propagateRawToMinute = hooks.useCallback(newRawValue => {
|
|
2219
|
+
const localRawValue = newRawValue || rawValue;
|
|
2220
|
+
|
|
2221
|
+
// If no raw value exists, set the minute to null
|
|
2222
|
+
if (!localRawValue) {
|
|
2223
|
+
setTime(null);
|
|
2224
|
+
return;
|
|
2225
|
+
}
|
|
2226
|
+
const minutes = parseInputTime(localRawValue);
|
|
2227
|
+
|
|
2228
|
+
// If raw string couldn't be parsed, clean everything up
|
|
2229
|
+
if (!minDash.isNumber(minutes)) {
|
|
2230
|
+
setRawValue('');
|
|
2231
|
+
setTime(null);
|
|
2232
|
+
return;
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
// Enforce the minutes to match the timeInterval
|
|
2236
|
+
const correctedMinutes = minutes - minutes % timeInterval;
|
|
2237
|
+
|
|
2238
|
+
// Enforce the raw text to be formatted properly
|
|
2239
|
+
setRawValue(formatTime(use24h, correctedMinutes));
|
|
2240
|
+
setTime(correctedMinutes);
|
|
2241
|
+
}, [rawValue, timeInterval, use24h, setTime]);
|
|
2242
|
+
const timeOptions = hooks.useMemo(() => {
|
|
2243
|
+
const minutesInDay = 24 * 60;
|
|
2244
|
+
const intervalCount = Math.floor(minutesInDay / timeInterval);
|
|
2245
|
+
return [...Array(intervalCount).keys()].map(intervalIndex => formatTime(use24h, intervalIndex * timeInterval));
|
|
2246
|
+
}, [timeInterval, use24h]);
|
|
2247
|
+
const initialFocusIndex = hooks.useMemo(() => {
|
|
2248
|
+
// if there are no options, there will not be any focusing
|
|
2249
|
+
if (!timeOptions || !timeInterval) return null;
|
|
2250
|
+
|
|
2251
|
+
// if there is a set minute value, we focus it in the dropdown
|
|
2252
|
+
if (time) return time / timeInterval;
|
|
2253
|
+
const cacheTime = parseInputTime(rawValue);
|
|
2254
|
+
|
|
2255
|
+
// if there is a valid value in the input cache, we try and focus close to it
|
|
2256
|
+
if (cacheTime) {
|
|
2257
|
+
const flooredCacheTime = cacheTime - cacheTime % timeInterval;
|
|
2258
|
+
return flooredCacheTime / timeInterval;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
// If there is no set value, simply focus the middle of the dropdown (12:00)
|
|
2262
|
+
return Math.floor(timeOptions.length / 2);
|
|
2263
|
+
}, [rawValue, time, timeInterval, timeOptions]);
|
|
2264
|
+
const onInputKeyDown = e => {
|
|
2265
|
+
switch (e.key) {
|
|
2266
|
+
case 'ArrowUp':
|
|
2267
|
+
e.preventDefault();
|
|
2268
|
+
break;
|
|
2269
|
+
case 'ArrowDown':
|
|
2270
|
+
useDropdown && setDropdownIsOpen(true);
|
|
2271
|
+
e.preventDefault();
|
|
2272
|
+
break;
|
|
2273
|
+
case 'Escape':
|
|
2274
|
+
useDropdown && setDropdownIsOpen(false);
|
|
2275
|
+
break;
|
|
2276
|
+
case 'Enter':
|
|
2277
|
+
!dropdownIsOpen && propagateRawToMinute();
|
|
2278
|
+
break;
|
|
2279
|
+
}
|
|
2280
|
+
};
|
|
2281
|
+
const onInputBlur = e => {
|
|
2282
|
+
setDropdownIsOpen(false);
|
|
2283
|
+
propagateRawToMinute();
|
|
2284
|
+
};
|
|
2285
|
+
const onDropdownValueSelected = value => {
|
|
2286
|
+
setDropdownIsOpen(false);
|
|
2287
|
+
propagateRawToMinute(value);
|
|
2288
|
+
};
|
|
2289
|
+
const fullId = `${prefixId(id, formId)}--time`;
|
|
2290
|
+
return jsxRuntime.jsxs("div", {
|
|
2291
|
+
class: "fjs-datetime-subsection",
|
|
2292
|
+
children: [jsxRuntime.jsx(Label, {
|
|
2293
|
+
id: fullId,
|
|
2294
|
+
label: label,
|
|
2295
|
+
collapseOnEmpty: collapseLabelOnEmpty,
|
|
2296
|
+
required: required
|
|
2297
|
+
}), jsxRuntime.jsx(InputAdorner, {
|
|
2298
|
+
pre: jsxRuntime.jsx(ClockIcon, {}),
|
|
2299
|
+
inputRef: timeInputRef,
|
|
2300
|
+
disabled: disabled,
|
|
2301
|
+
children: jsxRuntime.jsxs("div", {
|
|
2302
|
+
class: "fjs-timepicker fjs-timepicker-anchor",
|
|
2303
|
+
children: [jsxRuntime.jsx("input", {
|
|
2304
|
+
ref: timeInputRef,
|
|
2305
|
+
type: "text",
|
|
2306
|
+
id: fullId,
|
|
2307
|
+
class: "fjs-input",
|
|
2308
|
+
value: rawValue,
|
|
2309
|
+
disabled: disabled,
|
|
2310
|
+
placeholder: use24h ? 'hh:mm' : 'hh:mm ?m',
|
|
2311
|
+
autoComplete: "false",
|
|
2312
|
+
onFocus: () => useDropdown && setDropdownIsOpen(true),
|
|
2313
|
+
onClick: () => useDropdown && setDropdownIsOpen(true)
|
|
2314
|
+
|
|
2315
|
+
// @ts-ignore
|
|
2316
|
+
,
|
|
2317
|
+
onInput: e => {
|
|
2318
|
+
setRawValue(e.target.value);
|
|
2319
|
+
useDropdown && setDropdownIsOpen(false);
|
|
2320
|
+
},
|
|
2321
|
+
onBlur: onInputBlur,
|
|
2322
|
+
onKeyDown: onInputKeyDown,
|
|
2323
|
+
"data-input": true
|
|
2324
|
+
}), dropdownIsOpen && jsxRuntime.jsx(DropdownList, {
|
|
2325
|
+
values: timeOptions,
|
|
2326
|
+
height: 150,
|
|
2327
|
+
onValueSelected: onDropdownValueSelected,
|
|
2328
|
+
listenerElement: timeInputRef.current,
|
|
2329
|
+
initialFocusIndex: initialFocusIndex
|
|
2330
|
+
})]
|
|
2331
|
+
})
|
|
2332
|
+
})]
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
const type$8 = 'datetime';
|
|
2337
|
+
function Datetime(props) {
|
|
2338
|
+
const {
|
|
2339
|
+
disabled,
|
|
2340
|
+
errors = [],
|
|
2341
|
+
field,
|
|
2342
|
+
onChange,
|
|
2343
|
+
value = ''
|
|
2344
|
+
} = props;
|
|
2345
|
+
const {
|
|
2346
|
+
description,
|
|
2347
|
+
id,
|
|
2348
|
+
dateLabel,
|
|
2349
|
+
timeLabel,
|
|
2350
|
+
validate = {},
|
|
2351
|
+
subtype,
|
|
2352
|
+
use24h,
|
|
2353
|
+
disallowPassedDates,
|
|
2354
|
+
timeInterval,
|
|
2355
|
+
timeSerializingFormat
|
|
2356
|
+
} = field;
|
|
2357
|
+
const {
|
|
2358
|
+
required
|
|
2359
|
+
} = validate;
|
|
2360
|
+
const {
|
|
2361
|
+
formId
|
|
2362
|
+
} = hooks.useContext(FormContext);
|
|
2363
|
+
const getNullDateTime = () => ({
|
|
2364
|
+
date: new Date(Date.parse(null)),
|
|
2365
|
+
time: null
|
|
2366
|
+
});
|
|
2367
|
+
const [dateTime, setDateTime] = hooks.useState(getNullDateTime());
|
|
2368
|
+
const [dateTimeUpdateRequest, setDateTimeUpdateRequest] = hooks.useState(null);
|
|
2369
|
+
const isValidDate = date => date && !isNaN(date.getTime());
|
|
2370
|
+
const isValidTime = time => !isNaN(parseInt(time));
|
|
2371
|
+
const useDatePicker = hooks.useMemo(() => subtype === DATETIME_SUBTYPES.DATE || subtype === DATETIME_SUBTYPES.DATETIME, [subtype]);
|
|
2372
|
+
const useTimePicker = hooks.useMemo(() => subtype === DATETIME_SUBTYPES.TIME || subtype === DATETIME_SUBTYPES.DATETIME, [subtype]);
|
|
2373
|
+
hooks.useEffect(() => {
|
|
2374
|
+
let {
|
|
2375
|
+
date,
|
|
2376
|
+
time
|
|
2377
|
+
} = getNullDateTime();
|
|
2378
|
+
if (!disabled) {
|
|
2379
|
+
switch (subtype) {
|
|
2380
|
+
case DATETIME_SUBTYPES.DATE:
|
|
2381
|
+
{
|
|
2382
|
+
date = new Date(Date.parse(value));
|
|
2383
|
+
break;
|
|
2384
|
+
}
|
|
2385
|
+
case DATETIME_SUBTYPES.TIME:
|
|
2386
|
+
{
|
|
2387
|
+
time = parseIsoTime(value);
|
|
2388
|
+
break;
|
|
2389
|
+
}
|
|
2390
|
+
case DATETIME_SUBTYPES.DATETIME:
|
|
2391
|
+
{
|
|
2392
|
+
date = new Date(Date.parse(value));
|
|
2393
|
+
time = isValidDate(date) ? 60 * date.getHours() + date.getMinutes() : null;
|
|
2394
|
+
break;
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
setDateTime({
|
|
2399
|
+
date,
|
|
2400
|
+
time
|
|
2401
|
+
});
|
|
2402
|
+
}, [subtype, value, disabled]);
|
|
2403
|
+
const computeAndSetState = hooks.useCallback(({
|
|
2404
|
+
date,
|
|
2405
|
+
time
|
|
2406
|
+
}) => {
|
|
2407
|
+
let newDateTimeValue = null;
|
|
2408
|
+
if (subtype === DATETIME_SUBTYPES.DATE && isValidDate(date)) {
|
|
2409
|
+
newDateTimeValue = serializeDate(date);
|
|
2410
|
+
} else if (subtype === DATETIME_SUBTYPES.TIME && isValidTime(time)) {
|
|
2411
|
+
newDateTimeValue = serializeTime(time, new Date().getTimezoneOffset(), timeSerializingFormat);
|
|
2412
|
+
} else if (subtype === DATETIME_SUBTYPES.DATETIME && isValidDate(date) && isValidTime(time)) {
|
|
2413
|
+
newDateTimeValue = serializeDateTime(date, time, timeSerializingFormat);
|
|
2414
|
+
}
|
|
2415
|
+
onChange({
|
|
2416
|
+
value: newDateTimeValue,
|
|
2417
|
+
field
|
|
2418
|
+
});
|
|
2419
|
+
}, [field, onChange, subtype, timeSerializingFormat]);
|
|
2420
|
+
hooks.useEffect(() => {
|
|
2421
|
+
if (dateTimeUpdateRequest) {
|
|
2422
|
+
if (dateTimeUpdateRequest.refreshOnly) {
|
|
2423
|
+
computeAndSetState(dateTime);
|
|
2424
|
+
} else {
|
|
2425
|
+
const newDateTime = {
|
|
2426
|
+
...dateTime,
|
|
2427
|
+
...dateTimeUpdateRequest
|
|
2428
|
+
};
|
|
2429
|
+
setDateTime(newDateTime);
|
|
2430
|
+
computeAndSetState(newDateTime);
|
|
2431
|
+
}
|
|
2432
|
+
setDateTimeUpdateRequest(null);
|
|
2433
|
+
}
|
|
2434
|
+
}, [computeAndSetState, dateTime, dateTimeUpdateRequest]);
|
|
2435
|
+
hooks.useEffect(() => {
|
|
2436
|
+
setDateTimeUpdateRequest({
|
|
2437
|
+
refreshOnly: true
|
|
2438
|
+
});
|
|
2439
|
+
}, [timeSerializingFormat]);
|
|
2440
|
+
const allErrors = hooks.useMemo(() => {
|
|
2441
|
+
if (required || subtype !== DATETIME_SUBTYPES.DATETIME) return errors;
|
|
2442
|
+
const isOnlyOneFieldSet = isValidDate(dateTime.date) && !isValidTime(dateTime.time) || !isValidDate(dateTime.date) && isValidTime(dateTime.time);
|
|
2443
|
+
return isOnlyOneFieldSet ? ['Date and time must both be entered.', ...errors] : errors;
|
|
2444
|
+
}, [required, subtype, dateTime, errors]);
|
|
2445
|
+
const setDate = hooks.useCallback(date => {
|
|
2446
|
+
setDateTimeUpdateRequest(prev => prev ? {
|
|
2447
|
+
...prev,
|
|
2448
|
+
date
|
|
2449
|
+
} : {
|
|
2450
|
+
date
|
|
2451
|
+
});
|
|
2452
|
+
}, []);
|
|
2453
|
+
const setTime = hooks.useCallback(time => {
|
|
2454
|
+
setDateTimeUpdateRequest(prev => prev ? {
|
|
2455
|
+
...prev,
|
|
2456
|
+
time
|
|
2457
|
+
} : {
|
|
2458
|
+
time
|
|
2459
|
+
});
|
|
2460
|
+
}, []);
|
|
2461
|
+
const datePickerProps = {
|
|
2462
|
+
id,
|
|
2463
|
+
label: dateLabel,
|
|
2464
|
+
collapseLabelOnEmpty: !timeLabel,
|
|
2465
|
+
formId,
|
|
2466
|
+
required,
|
|
2467
|
+
disabled,
|
|
2468
|
+
disallowPassedDates,
|
|
2469
|
+
date: dateTime.date,
|
|
2470
|
+
setDate
|
|
2471
|
+
};
|
|
2472
|
+
const timePickerProps = {
|
|
2473
|
+
id,
|
|
2474
|
+
label: timeLabel,
|
|
2475
|
+
collapseLabelOnEmpty: !dateLabel,
|
|
2476
|
+
formId,
|
|
2477
|
+
required,
|
|
2478
|
+
disabled,
|
|
2479
|
+
use24h,
|
|
2480
|
+
timeInterval,
|
|
2481
|
+
time: dateTime.time,
|
|
2482
|
+
setTime
|
|
2483
|
+
};
|
|
2484
|
+
return jsxRuntime.jsxs("div", {
|
|
2485
|
+
class: formFieldClasses(type$8, {
|
|
2486
|
+
errors: allErrors,
|
|
2487
|
+
disabled
|
|
2488
|
+
}),
|
|
2489
|
+
children: [jsxRuntime.jsxs("div", {
|
|
2490
|
+
class: classNames__default['default']('fjs-vertical-group'),
|
|
2491
|
+
children: [useDatePicker && jsxRuntime.jsx(Datepicker, {
|
|
2492
|
+
...datePickerProps
|
|
2493
|
+
}), useTimePicker && useDatePicker && jsxRuntime.jsx("div", {
|
|
2494
|
+
class: "fjs-datetime-separator"
|
|
2495
|
+
}), useTimePicker && jsxRuntime.jsx(Timepicker, {
|
|
2496
|
+
...timePickerProps
|
|
2497
|
+
})]
|
|
2498
|
+
}), jsxRuntime.jsx(Description, {
|
|
2499
|
+
description: description
|
|
2500
|
+
}), jsxRuntime.jsx(Errors, {
|
|
2501
|
+
errors: allErrors
|
|
2502
|
+
})]
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
Datetime.create = function (options = {}) {
|
|
2506
|
+
const newOptions = {};
|
|
2507
|
+
minDash.set(newOptions, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
|
|
2508
|
+
minDash.set(newOptions, DATE_LABEL_PATH, 'Date');
|
|
2509
|
+
return {
|
|
2510
|
+
...newOptions,
|
|
2511
|
+
...options
|
|
2512
|
+
};
|
|
2513
|
+
};
|
|
2514
|
+
Datetime.type = type$8;
|
|
2515
|
+
Datetime.keyed = true;
|
|
2516
|
+
Datetime.emptyValue = null;
|
|
2517
|
+
Datetime.sanitizeValue = sanitizeDateTimePickerValue;
|
|
2518
|
+
|
|
2519
|
+
/**
|
|
2520
|
+
* This file must not be changed or exchanged.
|
|
2521
|
+
*
|
|
2522
|
+
* @see http://bpmn.io/license for more information.
|
|
2523
|
+
*/
|
|
2524
|
+
function Logo() {
|
|
2525
|
+
return jsxRuntime.jsxs("svg", {
|
|
2526
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2527
|
+
viewBox: "0 0 14.02 5.57",
|
|
2528
|
+
width: "53",
|
|
2529
|
+
height: "21",
|
|
2530
|
+
style: "vertical-align:middle",
|
|
2531
|
+
children: [jsxRuntime.jsx("path", {
|
|
2532
|
+
fill: "currentColor",
|
|
2533
|
+
d: "M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"
|
|
2534
|
+
}), jsxRuntime.jsx("path", {
|
|
2535
|
+
fill: "currentColor",
|
|
2536
|
+
d: "M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"
|
|
2537
|
+
})]
|
|
2538
|
+
});
|
|
2539
|
+
}
|
|
2540
|
+
function Lightbox(props) {
|
|
2541
|
+
const {
|
|
2542
|
+
open
|
|
2543
|
+
} = props;
|
|
2544
|
+
if (!open) {
|
|
2545
|
+
return null;
|
|
2546
|
+
}
|
|
2547
|
+
return jsxRuntime.jsxs("div", {
|
|
2548
|
+
class: "fjs-powered-by-lightbox",
|
|
2549
|
+
style: "z-index: 100; position: fixed; top: 0; left: 0;right: 0; bottom: 0",
|
|
2550
|
+
children: [jsxRuntime.jsx("div", {
|
|
2551
|
+
class: "backdrop",
|
|
2552
|
+
style: "width: 100%; height: 100%; background: rgba(40 40 40 / 20%)",
|
|
2553
|
+
onClick: props.onBackdropClick
|
|
2554
|
+
}), jsxRuntime.jsxs("div", {
|
|
2555
|
+
class: "notice",
|
|
2556
|
+
style: "position: absolute; left: 50%; top: 40%; transform: translate(-50%); width: 260px; padding: 10px; background: white; box-shadow: 0 1px 4px rgba(0 0 0 / 30%); font-family: Helvetica, Arial, sans-serif; font-size: 14px; display: flex; line-height: 1.3",
|
|
2557
|
+
children: [jsxRuntime.jsx("a", {
|
|
2558
|
+
href: "https://bpmn.io",
|
|
2559
|
+
target: "_blank",
|
|
2560
|
+
rel: "noopener",
|
|
2561
|
+
style: "margin: 15px 20px 15px 10px; align-self: center; color: #404040",
|
|
2562
|
+
children: jsxRuntime.jsx(Logo, {})
|
|
2563
|
+
}), jsxRuntime.jsxs("span", {
|
|
2564
|
+
children: ["Web-based tooling for BPMN, DMN, and forms powered by ", jsxRuntime.jsx("a", {
|
|
2565
|
+
href: "https://bpmn.io",
|
|
2566
|
+
target: "_blank",
|
|
2567
|
+
rel: "noopener",
|
|
2568
|
+
children: "bpmn.io"
|
|
2569
|
+
}), "."]
|
|
2570
|
+
})]
|
|
2571
|
+
})]
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
function Link(props) {
|
|
2575
|
+
return jsxRuntime.jsx("div", {
|
|
2576
|
+
class: "fjs-powered-by fjs-form-field",
|
|
2577
|
+
style: "text-align: right",
|
|
2578
|
+
children: jsxRuntime.jsx("a", {
|
|
2579
|
+
href: "https://bpmn.io",
|
|
2580
|
+
target: "_blank",
|
|
2581
|
+
rel: "noopener",
|
|
2582
|
+
class: "fjs-powered-by-link",
|
|
2583
|
+
title: "Powered by bpmn.io",
|
|
2584
|
+
style: "color: #404040",
|
|
2585
|
+
onClick: props.onClick,
|
|
2586
|
+
children: jsxRuntime.jsx(Logo, {})
|
|
2587
|
+
})
|
|
2588
|
+
});
|
|
2589
|
+
}
|
|
2590
|
+
function PoweredBy(props) {
|
|
2591
|
+
const [open, setOpen] = hooks.useState(false);
|
|
2592
|
+
function toggleOpen(open) {
|
|
2593
|
+
return event => {
|
|
2594
|
+
event.preventDefault();
|
|
2595
|
+
setOpen(open);
|
|
2596
|
+
};
|
|
2597
|
+
}
|
|
2598
|
+
return jsxRuntime.jsxs(preact.Fragment, {
|
|
2599
|
+
children: [React.createPortal(jsxRuntime.jsx(Lightbox, {
|
|
2600
|
+
open: open,
|
|
2601
|
+
onBackdropClick: toggleOpen(false)
|
|
2602
|
+
}), document.body), jsxRuntime.jsx(Link, {
|
|
2603
|
+
onClick: toggleOpen(true)
|
|
2604
|
+
})]
|
|
2605
|
+
});
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
const noop = () => {};
|
|
2609
|
+
function FormComponent(props) {
|
|
2610
|
+
const form = useService('form');
|
|
2611
|
+
const {
|
|
2612
|
+
schema
|
|
2613
|
+
} = form._getState();
|
|
2614
|
+
const {
|
|
2615
|
+
onSubmit = noop,
|
|
2616
|
+
onReset = noop,
|
|
2617
|
+
onChange = noop
|
|
2618
|
+
} = props;
|
|
2619
|
+
const handleSubmit = event => {
|
|
2620
|
+
event.preventDefault();
|
|
2621
|
+
onSubmit();
|
|
2622
|
+
};
|
|
2623
|
+
const handleReset = event => {
|
|
2624
|
+
event.preventDefault();
|
|
2625
|
+
onReset();
|
|
2626
|
+
};
|
|
2627
|
+
return jsxRuntime.jsxs("form", {
|
|
1718
2628
|
class: "fjs-form",
|
|
1719
2629
|
onSubmit: handleSubmit,
|
|
1720
2630
|
onReset: handleReset,
|
|
@@ -1732,11 +2642,18 @@ function FormComponent(props) {
|
|
|
1732
2642
|
* @param {import('../../types').Data} data
|
|
1733
2643
|
*/
|
|
1734
2644
|
function useEvaluation(expression, data) {
|
|
2645
|
+
const initialData = useService('form')._getState().initialData;
|
|
1735
2646
|
const conditionChecker = useService('conditionChecker', false);
|
|
1736
2647
|
if (!conditionChecker) {
|
|
1737
2648
|
return null;
|
|
1738
2649
|
}
|
|
1739
|
-
|
|
2650
|
+
|
|
2651
|
+
// make sure we do not use data from hidden fields
|
|
2652
|
+
const filteredData = {
|
|
2653
|
+
...initialData,
|
|
2654
|
+
...conditionChecker.applyConditions(data, data)
|
|
2655
|
+
};
|
|
2656
|
+
return conditionChecker.evaluate(expression, filteredData);
|
|
1740
2657
|
}
|
|
1741
2658
|
|
|
1742
2659
|
/**
|
|
@@ -1761,11 +2678,11 @@ function isExpression(value) {
|
|
|
1761
2678
|
return minDash.isString(value) && value.startsWith('=');
|
|
1762
2679
|
}
|
|
1763
2680
|
|
|
1764
|
-
function _extends$
|
|
2681
|
+
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); }
|
|
1765
2682
|
var ImagePlaceholder = (({
|
|
1766
2683
|
styles = {},
|
|
1767
2684
|
...props
|
|
1768
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$
|
|
2685
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$f({
|
|
1769
2686
|
width: "64",
|
|
1770
2687
|
height: "64",
|
|
1771
2688
|
viewBox: "0 0 1280 1280",
|
|
@@ -1845,11 +2762,16 @@ function Numberfield(props) {
|
|
|
1845
2762
|
description,
|
|
1846
2763
|
id,
|
|
1847
2764
|
label,
|
|
2765
|
+
appearance = {},
|
|
1848
2766
|
validate = {},
|
|
1849
2767
|
decimalDigits,
|
|
1850
2768
|
serializeToString = false,
|
|
1851
2769
|
increment: incrementValue
|
|
1852
2770
|
} = field;
|
|
2771
|
+
const {
|
|
2772
|
+
prefixAdorner,
|
|
2773
|
+
suffixAdorner
|
|
2774
|
+
} = appearance;
|
|
1853
2775
|
const {
|
|
1854
2776
|
required
|
|
1855
2777
|
} = validate;
|
|
@@ -1959,45 +2881,50 @@ function Numberfield(props) {
|
|
|
1959
2881
|
id: prefixId(id, formId),
|
|
1960
2882
|
label: label,
|
|
1961
2883
|
required: required
|
|
1962
|
-
}), jsxRuntime.
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
children: [jsxRuntime.jsx("input", {
|
|
1969
|
-
ref: inputRef,
|
|
1970
|
-
class: "fjs-input",
|
|
1971
|
-
disabled: disabled,
|
|
1972
|
-
id: prefixId(id, formId),
|
|
1973
|
-
onKeyDown: onKeyDown,
|
|
1974
|
-
onKeyPress: onKeyPress
|
|
1975
|
-
|
|
1976
|
-
// @ts-ignore
|
|
1977
|
-
,
|
|
1978
|
-
onInput: e => setValue(e.target.value),
|
|
1979
|
-
type: "text",
|
|
1980
|
-
autoComplete: "off",
|
|
1981
|
-
step: arrowIncrementValue,
|
|
1982
|
-
value: displayValue
|
|
1983
|
-
}), jsxRuntime.jsxs("div", {
|
|
1984
|
-
class: classNames__default['default']('fjs-number-arrow-container', {
|
|
2884
|
+
}), jsxRuntime.jsx(InputAdorner, {
|
|
2885
|
+
disabled: disabled,
|
|
2886
|
+
pre: prefixAdorner,
|
|
2887
|
+
post: suffixAdorner,
|
|
2888
|
+
children: jsxRuntime.jsxs("div", {
|
|
2889
|
+
class: classNames__default['default']('fjs-vertical-group', {
|
|
1985
2890
|
'disabled': disabled
|
|
2891
|
+
}, {
|
|
2892
|
+
'hasErrors': errors.length
|
|
1986
2893
|
}),
|
|
1987
|
-
children: [jsxRuntime.jsx("
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
2894
|
+
children: [jsxRuntime.jsx("input", {
|
|
2895
|
+
ref: inputRef,
|
|
2896
|
+
class: "fjs-input",
|
|
2897
|
+
disabled: disabled,
|
|
2898
|
+
id: prefixId(id, formId),
|
|
2899
|
+
onKeyDown: onKeyDown,
|
|
2900
|
+
onKeyPress: onKeyPress
|
|
2901
|
+
|
|
2902
|
+
// @ts-ignore
|
|
2903
|
+
,
|
|
2904
|
+
onInput: e => setValue(e.target.value),
|
|
2905
|
+
type: "text",
|
|
2906
|
+
autoComplete: "off",
|
|
2907
|
+
step: arrowIncrementValue,
|
|
2908
|
+
value: displayValue
|
|
2909
|
+
}), jsxRuntime.jsxs("div", {
|
|
2910
|
+
class: classNames__default['default']('fjs-number-arrow-container', {
|
|
2911
|
+
'disabled': disabled
|
|
2912
|
+
}),
|
|
2913
|
+
children: [jsxRuntime.jsx("button", {
|
|
2914
|
+
class: "fjs-number-arrow-up",
|
|
2915
|
+
onClick: () => increment(),
|
|
2916
|
+
tabIndex: -1,
|
|
2917
|
+
children: "\u02C4"
|
|
2918
|
+
}), jsxRuntime.jsx("div", {
|
|
2919
|
+
class: "fjs-number-arrow-separator"
|
|
2920
|
+
}), jsxRuntime.jsx("button", {
|
|
2921
|
+
class: "fjs-number-arrow-down",
|
|
2922
|
+
onClick: () => decrement(),
|
|
2923
|
+
tabIndex: -1,
|
|
2924
|
+
children: "\u02C5"
|
|
2925
|
+
})]
|
|
1999
2926
|
})]
|
|
2000
|
-
})
|
|
2927
|
+
})
|
|
2001
2928
|
}), jsxRuntime.jsx(Description, {
|
|
2002
2929
|
description: description
|
|
2003
2930
|
}), jsxRuntime.jsx(Errors, {
|
|
@@ -2180,11 +3107,11 @@ Select.keyed = true;
|
|
|
2180
3107
|
Select.emptyValue = null;
|
|
2181
3108
|
Select.sanitizeValue = sanitizeSingleSelectValue;
|
|
2182
3109
|
|
|
2183
|
-
function _extends() { _extends = 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.apply(this, arguments); }
|
|
3110
|
+
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); }
|
|
2184
3111
|
var CloseIcon = (({
|
|
2185
3112
|
styles = {},
|
|
2186
3113
|
...props
|
|
2187
|
-
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends({
|
|
3114
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$e({
|
|
2188
3115
|
width: "16",
|
|
2189
3116
|
height: "16",
|
|
2190
3117
|
fill: "none",
|
|
@@ -2196,113 +3123,6 @@ var CloseIcon = (({
|
|
|
2196
3123
|
fill: "currentColor"
|
|
2197
3124
|
})));
|
|
2198
3125
|
|
|
2199
|
-
function useKeyDownAction(targetKey, action, listenerElement = window) {
|
|
2200
|
-
function downHandler({
|
|
2201
|
-
key
|
|
2202
|
-
}) {
|
|
2203
|
-
if (key === targetKey) {
|
|
2204
|
-
action();
|
|
2205
|
-
}
|
|
2206
|
-
}
|
|
2207
|
-
hooks.useEffect(() => {
|
|
2208
|
-
listenerElement.addEventListener('keydown', downHandler);
|
|
2209
|
-
return () => {
|
|
2210
|
-
listenerElement.removeEventListener('keydown', downHandler);
|
|
2211
|
-
};
|
|
2212
|
-
});
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
|
-
const DEFAULT_LABEL_GETTER = value => value;
|
|
2216
|
-
const NOOP = () => {};
|
|
2217
|
-
function DropdownList(props) {
|
|
2218
|
-
const {
|
|
2219
|
-
keyEventsListener = window,
|
|
2220
|
-
values = [],
|
|
2221
|
-
getLabel = DEFAULT_LABEL_GETTER,
|
|
2222
|
-
onValueSelected = NOOP,
|
|
2223
|
-
height = 235,
|
|
2224
|
-
emptyListMessage = 'No results'
|
|
2225
|
-
} = props;
|
|
2226
|
-
const [mouseControl, setMouseControl] = hooks.useState(true);
|
|
2227
|
-
const [focusedValueIndex, setFocusedValueIndex] = hooks.useState(0);
|
|
2228
|
-
const dropdownContainer = hooks.useRef();
|
|
2229
|
-
const mouseScreenPos = hooks.useRef();
|
|
2230
|
-
const focusedItem = hooks.useMemo(() => values.length ? values[focusedValueIndex] : null, [focusedValueIndex, values]);
|
|
2231
|
-
const changeFocusedValueIndex = hooks.useCallback(delta => {
|
|
2232
|
-
setFocusedValueIndex(x => Math.min(Math.max(0, x + delta), values.length - 1));
|
|
2233
|
-
}, [values.length]);
|
|
2234
|
-
hooks.useEffect(() => {
|
|
2235
|
-
if (focusedValueIndex === 0) return;
|
|
2236
|
-
if (!focusedValueIndex || !values.length) {
|
|
2237
|
-
setFocusedValueIndex(0);
|
|
2238
|
-
} else if (focusedValueIndex >= values.length) {
|
|
2239
|
-
setFocusedValueIndex(values.length - 1);
|
|
2240
|
-
}
|
|
2241
|
-
}, [focusedValueIndex, values.length]);
|
|
2242
|
-
useKeyDownAction('ArrowUp', () => {
|
|
2243
|
-
if (values.length) {
|
|
2244
|
-
changeFocusedValueIndex(-1);
|
|
2245
|
-
setMouseControl(false);
|
|
2246
|
-
}
|
|
2247
|
-
}, keyEventsListener);
|
|
2248
|
-
useKeyDownAction('ArrowDown', () => {
|
|
2249
|
-
if (values.length) {
|
|
2250
|
-
changeFocusedValueIndex(1);
|
|
2251
|
-
setMouseControl(false);
|
|
2252
|
-
}
|
|
2253
|
-
}, keyEventsListener);
|
|
2254
|
-
useKeyDownAction('Enter', () => {
|
|
2255
|
-
if (focusedItem) {
|
|
2256
|
-
onValueSelected(focusedItem);
|
|
2257
|
-
}
|
|
2258
|
-
}, keyEventsListener);
|
|
2259
|
-
hooks.useEffect(() => {
|
|
2260
|
-
const individualEntries = dropdownContainer.current.children;
|
|
2261
|
-
if (individualEntries.length && !mouseControl) {
|
|
2262
|
-
individualEntries[focusedValueIndex].scrollIntoView({
|
|
2263
|
-
block: 'nearest',
|
|
2264
|
-
inline: 'nearest'
|
|
2265
|
-
});
|
|
2266
|
-
}
|
|
2267
|
-
}, [focusedValueIndex, mouseControl]);
|
|
2268
|
-
const mouseMove = (e, i) => {
|
|
2269
|
-
const userMoved = !mouseScreenPos.current || mouseScreenPos.current.x !== e.screenX && mouseScreenPos.current.y !== e.screenY;
|
|
2270
|
-
if (userMoved) {
|
|
2271
|
-
mouseScreenPos.current = {
|
|
2272
|
-
x: e.screenX,
|
|
2273
|
-
y: e.screenY
|
|
2274
|
-
};
|
|
2275
|
-
if (!mouseControl) {
|
|
2276
|
-
setMouseControl(true);
|
|
2277
|
-
setFocusedValueIndex(i);
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
};
|
|
2281
|
-
return jsxRuntime.jsxs("div", {
|
|
2282
|
-
ref: dropdownContainer,
|
|
2283
|
-
tabIndex: -1,
|
|
2284
|
-
class: "fjs-dropdownlist",
|
|
2285
|
-
style: {
|
|
2286
|
-
maxHeight: height
|
|
2287
|
-
},
|
|
2288
|
-
children: [!!values.length && values.map((v, i) => {
|
|
2289
|
-
return jsxRuntime.jsx("div", {
|
|
2290
|
-
class: 'fjs-dropdownlist-item' + (focusedValueIndex === i ? ' focused' : ''),
|
|
2291
|
-
onMouseMove: e => mouseMove(e, i),
|
|
2292
|
-
onMouseEnter: mouseControl ? () => setFocusedValueIndex(i) : undefined,
|
|
2293
|
-
onMouseDown: e => {
|
|
2294
|
-
e.preventDefault();
|
|
2295
|
-
onValueSelected(v);
|
|
2296
|
-
},
|
|
2297
|
-
children: getLabel(v)
|
|
2298
|
-
});
|
|
2299
|
-
}), !values.length && jsxRuntime.jsx("div", {
|
|
2300
|
-
class: "fjs-dropdownlist-empty",
|
|
2301
|
-
children: emptyListMessage
|
|
2302
|
-
})]
|
|
2303
|
-
});
|
|
2304
|
-
}
|
|
2305
|
-
|
|
2306
3126
|
const type$3 = 'taglist';
|
|
2307
3127
|
function Taglist(props) {
|
|
2308
3128
|
const {
|
|
@@ -2486,20 +3306,261 @@ Taglist.keyed = true;
|
|
|
2486
3306
|
Taglist.emptyValue = [];
|
|
2487
3307
|
Taglist.sanitizeValue = sanitizeMultiSelectValue;
|
|
2488
3308
|
|
|
3309
|
+
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); }
|
|
3310
|
+
var ButtonIcon = (({
|
|
3311
|
+
styles = {},
|
|
3312
|
+
...props
|
|
3313
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$d({
|
|
3314
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3315
|
+
width: "54",
|
|
3316
|
+
height: "54"
|
|
3317
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3318
|
+
fillRule: "evenodd",
|
|
3319
|
+
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"
|
|
3320
|
+
})));
|
|
3321
|
+
|
|
3322
|
+
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); }
|
|
3323
|
+
var CheckboxIcon = (({
|
|
3324
|
+
styles = {},
|
|
3325
|
+
...props
|
|
3326
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$c({
|
|
3327
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3328
|
+
width: "54",
|
|
3329
|
+
height: "54"
|
|
3330
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3331
|
+
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"
|
|
3332
|
+
})));
|
|
3333
|
+
|
|
3334
|
+
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); }
|
|
3335
|
+
var ChecklistIcon = (({
|
|
3336
|
+
styles = {},
|
|
3337
|
+
...props
|
|
3338
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$b({
|
|
3339
|
+
width: "54",
|
|
3340
|
+
height: "54",
|
|
3341
|
+
fill: "none",
|
|
3342
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
3343
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3344
|
+
fillRule: "evenodd",
|
|
3345
|
+
clipRule: "evenodd",
|
|
3346
|
+
d: "M19 24h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zm6 18h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zm6-30h-6v6h6V8zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2V8a2 2 0 00-2-2h-6z",
|
|
3347
|
+
fill: "#22242A"
|
|
3348
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3349
|
+
d: "M26 26a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2zm0 16a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2zm0-32a1 1 0 011-1h15a1 1 0 011 1v2a1 1 0 01-1 1H27a1 1 0 01-1-1v-2z",
|
|
3350
|
+
fill: "#22242A"
|
|
3351
|
+
})));
|
|
3352
|
+
|
|
3353
|
+
function _extends$a() { _extends$a = 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$a.apply(this, arguments); }
|
|
3354
|
+
var DatetimeIcon = (({
|
|
3355
|
+
styles = {},
|
|
3356
|
+
...props
|
|
3357
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$a({
|
|
3358
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3359
|
+
width: "54",
|
|
3360
|
+
height: "54",
|
|
3361
|
+
fill: "none"
|
|
3362
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3363
|
+
fill: "#000",
|
|
3364
|
+
fillRule: "evenodd",
|
|
3365
|
+
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",
|
|
3366
|
+
clipRule: "evenodd"
|
|
3367
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3368
|
+
fill: "#000",
|
|
3369
|
+
d: "M35.13 37.603l1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984z"
|
|
3370
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3371
|
+
fill: "#000",
|
|
3372
|
+
fillRule: "evenodd",
|
|
3373
|
+
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",
|
|
3374
|
+
clipRule: "evenodd"
|
|
3375
|
+
})));
|
|
3376
|
+
|
|
3377
|
+
function _extends$9() { _extends$9 = 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$9.apply(this, arguments); }
|
|
3378
|
+
var TaglistIcon = (({
|
|
3379
|
+
styles = {},
|
|
3380
|
+
...props
|
|
3381
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$9({
|
|
3382
|
+
width: "54",
|
|
3383
|
+
height: "54",
|
|
3384
|
+
fill: "none",
|
|
3385
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
3386
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3387
|
+
fillRule: "evenodd",
|
|
3388
|
+
clipRule: "evenodd",
|
|
3389
|
+
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",
|
|
3390
|
+
fill: "#000"
|
|
3391
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3392
|
+
d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
|
|
3393
|
+
fill: "#505562"
|
|
3394
|
+
})));
|
|
3395
|
+
|
|
3396
|
+
function _extends$8() { _extends$8 = 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$8.apply(this, arguments); }
|
|
3397
|
+
var FormIcon = (({
|
|
3398
|
+
styles = {},
|
|
3399
|
+
...props
|
|
3400
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$8({
|
|
3401
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3402
|
+
width: "54",
|
|
3403
|
+
height: "54"
|
|
3404
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("rect", {
|
|
3405
|
+
x: "15",
|
|
3406
|
+
y: "17",
|
|
3407
|
+
width: "24",
|
|
3408
|
+
height: "4",
|
|
3409
|
+
rx: "1"
|
|
3410
|
+
}), /*#__PURE__*/React__default['default'].createElement("rect", {
|
|
3411
|
+
x: "15",
|
|
3412
|
+
y: "25",
|
|
3413
|
+
width: "24",
|
|
3414
|
+
height: "4",
|
|
3415
|
+
rx: "1"
|
|
3416
|
+
}), /*#__PURE__*/React__default['default'].createElement("rect", {
|
|
3417
|
+
x: "15",
|
|
3418
|
+
y: "33",
|
|
3419
|
+
width: "13",
|
|
3420
|
+
height: "4",
|
|
3421
|
+
rx: "1"
|
|
3422
|
+
})));
|
|
3423
|
+
|
|
3424
|
+
function _extends$7() { _extends$7 = 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$7.apply(this, arguments); }
|
|
3425
|
+
var ColumnsIcon = (({
|
|
3426
|
+
styles = {},
|
|
3427
|
+
...props
|
|
3428
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$7({
|
|
3429
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3430
|
+
width: "54",
|
|
3431
|
+
height: "54"
|
|
3432
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3433
|
+
fillRule: "evenodd",
|
|
3434
|
+
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"
|
|
3435
|
+
})));
|
|
3436
|
+
|
|
3437
|
+
function _extends$6() { _extends$6 = 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$6.apply(this, arguments); }
|
|
3438
|
+
var NumberIcon = (({
|
|
3439
|
+
styles = {},
|
|
3440
|
+
...props
|
|
3441
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$6({
|
|
3442
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3443
|
+
width: "54",
|
|
3444
|
+
height: "54"
|
|
3445
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3446
|
+
fillRule: "evenodd",
|
|
3447
|
+
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"
|
|
3448
|
+
})));
|
|
3449
|
+
|
|
3450
|
+
function _extends$5() { _extends$5 = 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$5.apply(this, arguments); }
|
|
3451
|
+
var RadioIcon = (({
|
|
3452
|
+
styles = {},
|
|
3453
|
+
...props
|
|
3454
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$5({
|
|
3455
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3456
|
+
width: "54",
|
|
3457
|
+
height: "54"
|
|
3458
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3459
|
+
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"
|
|
3460
|
+
})));
|
|
3461
|
+
|
|
3462
|
+
function _extends$4() { _extends$4 = 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$4.apply(this, arguments); }
|
|
3463
|
+
var SelectIcon = (({
|
|
3464
|
+
styles = {},
|
|
3465
|
+
...props
|
|
3466
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$4({
|
|
3467
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3468
|
+
width: "54",
|
|
3469
|
+
height: "54"
|
|
3470
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3471
|
+
fillRule: "evenodd",
|
|
3472
|
+
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"
|
|
3473
|
+
})));
|
|
3474
|
+
|
|
3475
|
+
function _extends$3() { _extends$3 = 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$3.apply(this, arguments); }
|
|
3476
|
+
var TextIcon = (({
|
|
3477
|
+
styles = {},
|
|
3478
|
+
...props
|
|
3479
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$3({
|
|
3480
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3481
|
+
width: "54",
|
|
3482
|
+
height: "54"
|
|
3483
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3484
|
+
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"
|
|
3485
|
+
})));
|
|
3486
|
+
|
|
3487
|
+
function _extends$2() { _extends$2 = 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$2.apply(this, arguments); }
|
|
3488
|
+
var TextfieldIcon = (({
|
|
3489
|
+
styles = {},
|
|
3490
|
+
...props
|
|
3491
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$2({
|
|
3492
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3493
|
+
width: "54",
|
|
3494
|
+
height: "54"
|
|
3495
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3496
|
+
fillRule: "evenodd",
|
|
3497
|
+
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"
|
|
3498
|
+
})));
|
|
3499
|
+
|
|
3500
|
+
function _extends$1() { _extends$1 = 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$1.apply(this, arguments); }
|
|
3501
|
+
var TextareaIcon = (({
|
|
3502
|
+
styles = {},
|
|
3503
|
+
...props
|
|
3504
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends$1({
|
|
3505
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3506
|
+
width: "54",
|
|
3507
|
+
height: "54"
|
|
3508
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3509
|
+
fillRule: "evenodd",
|
|
3510
|
+
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"
|
|
3511
|
+
})));
|
|
3512
|
+
|
|
3513
|
+
function _extends() { _extends = 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.apply(this, arguments); }
|
|
3514
|
+
var ImageIcon = (({
|
|
3515
|
+
styles = {},
|
|
3516
|
+
...props
|
|
3517
|
+
}) => /*#__PURE__*/React__default['default'].createElement("svg", _extends({
|
|
3518
|
+
width: "54",
|
|
3519
|
+
height: "54",
|
|
3520
|
+
fill: "none",
|
|
3521
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
3522
|
+
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3523
|
+
fillRule: "evenodd",
|
|
3524
|
+
clipRule: "evenodd",
|
|
3525
|
+
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",
|
|
3526
|
+
fill: "#000"
|
|
3527
|
+
}), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3528
|
+
fillRule: "evenodd",
|
|
3529
|
+
clipRule: "evenodd",
|
|
3530
|
+
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",
|
|
3531
|
+
fill: "#000"
|
|
3532
|
+
})));
|
|
3533
|
+
|
|
3534
|
+
const iconsByType = {
|
|
3535
|
+
button: ButtonIcon,
|
|
3536
|
+
checkbox: CheckboxIcon,
|
|
3537
|
+
checklist: ChecklistIcon,
|
|
3538
|
+
columns: ColumnsIcon,
|
|
3539
|
+
datetime: DatetimeIcon,
|
|
3540
|
+
image: ImageIcon,
|
|
3541
|
+
number: NumberIcon,
|
|
3542
|
+
radio: RadioIcon,
|
|
3543
|
+
select: SelectIcon,
|
|
3544
|
+
taglist: TaglistIcon,
|
|
3545
|
+
text: TextIcon,
|
|
3546
|
+
textfield: TextfieldIcon,
|
|
3547
|
+
textarea: TextareaIcon,
|
|
3548
|
+
default: FormIcon
|
|
3549
|
+
};
|
|
3550
|
+
|
|
2489
3551
|
const type$2 = 'text';
|
|
2490
3552
|
function Text(props) {
|
|
2491
3553
|
const {
|
|
2492
|
-
field
|
|
3554
|
+
field,
|
|
3555
|
+
disabled
|
|
2493
3556
|
} = props;
|
|
2494
3557
|
const {
|
|
2495
3558
|
text = ''
|
|
2496
3559
|
} = field;
|
|
3560
|
+
const textValue = useExpressionValue(text) || '';
|
|
2497
3561
|
return jsxRuntime.jsx("div", {
|
|
2498
3562
|
class: formFieldClasses(type$2),
|
|
2499
|
-
children:
|
|
2500
|
-
markup: safeMarkdown(text),
|
|
2501
|
-
trim: false
|
|
2502
|
-
})
|
|
3563
|
+
children: renderText(field, textValue, disabled)
|
|
2503
3564
|
});
|
|
2504
3565
|
}
|
|
2505
3566
|
Text.create = function (options = {}) {
|
|
@@ -2511,6 +3572,37 @@ Text.create = function (options = {}) {
|
|
|
2511
3572
|
Text.type = type$2;
|
|
2512
3573
|
Text.keyed = false;
|
|
2513
3574
|
|
|
3575
|
+
// helper //////////////
|
|
3576
|
+
|
|
3577
|
+
function renderText(field, content, disabled) {
|
|
3578
|
+
const {
|
|
3579
|
+
text
|
|
3580
|
+
} = field;
|
|
3581
|
+
const Icon = iconsByType['text'];
|
|
3582
|
+
if (disabled) {
|
|
3583
|
+
if (!text) {
|
|
3584
|
+
return jsxRuntime.jsxs("div", {
|
|
3585
|
+
class: "fjs-form-field-placeholder",
|
|
3586
|
+
children: [jsxRuntime.jsx(Icon, {
|
|
3587
|
+
viewBox: "0 0 54 54"
|
|
3588
|
+
}), "Text view is empty"]
|
|
3589
|
+
});
|
|
3590
|
+
}
|
|
3591
|
+
if (isExpression$2(text)) {
|
|
3592
|
+
return jsxRuntime.jsxs("div", {
|
|
3593
|
+
class: "fjs-form-field-placeholder",
|
|
3594
|
+
children: [jsxRuntime.jsx(Icon, {
|
|
3595
|
+
viewBox: "0 0 54 54"
|
|
3596
|
+
}), "Text view is populated by an expression"]
|
|
3597
|
+
});
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
return jsxRuntime.jsx(Markup__default['default'], {
|
|
3601
|
+
markup: safeMarkdown(content),
|
|
3602
|
+
trim: false
|
|
3603
|
+
});
|
|
3604
|
+
}
|
|
3605
|
+
|
|
2514
3606
|
const type$1 = 'textfield';
|
|
2515
3607
|
function Textfield(props) {
|
|
2516
3608
|
const {
|
|
@@ -2523,8 +3615,13 @@ function Textfield(props) {
|
|
|
2523
3615
|
description,
|
|
2524
3616
|
id,
|
|
2525
3617
|
label,
|
|
3618
|
+
appearance = {},
|
|
2526
3619
|
validate = {}
|
|
2527
3620
|
} = field;
|
|
3621
|
+
const {
|
|
3622
|
+
prefixAdorner,
|
|
3623
|
+
suffixAdorner
|
|
3624
|
+
} = appearance;
|
|
2528
3625
|
const {
|
|
2529
3626
|
required
|
|
2530
3627
|
} = validate;
|
|
@@ -2548,13 +3645,18 @@ function Textfield(props) {
|
|
|
2548
3645
|
id: prefixId(id, formId),
|
|
2549
3646
|
label: label,
|
|
2550
3647
|
required: required
|
|
2551
|
-
}), jsxRuntime.jsx(
|
|
2552
|
-
class: "fjs-input",
|
|
3648
|
+
}), jsxRuntime.jsx(InputAdorner, {
|
|
2553
3649
|
disabled: disabled,
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
3650
|
+
pre: prefixAdorner,
|
|
3651
|
+
post: suffixAdorner,
|
|
3652
|
+
children: jsxRuntime.jsx("input", {
|
|
3653
|
+
class: "fjs-input",
|
|
3654
|
+
disabled: disabled,
|
|
3655
|
+
id: prefixId(id, formId),
|
|
3656
|
+
onInput: onChange,
|
|
3657
|
+
type: "text",
|
|
3658
|
+
value: value
|
|
3659
|
+
})
|
|
2558
3660
|
}), jsxRuntime.jsx(Description, {
|
|
2559
3661
|
description: description
|
|
2560
3662
|
}), jsxRuntime.jsx(Errors, {
|
|
@@ -2656,7 +3758,7 @@ Textarea.sanitizeValue = ({
|
|
|
2656
3758
|
value
|
|
2657
3759
|
}) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
|
|
2658
3760
|
|
|
2659
|
-
const formFields = [Button, Checkbox, Checklist, Default, Image, Numberfield, Radio, Select, Taglist, Text, Textfield, Textarea];
|
|
3761
|
+
const formFields = [Button, Checkbox, Checklist, Default, Image, Numberfield, Datetime, Radio, Select, Taglist, Text, Textfield, Textarea];
|
|
2660
3762
|
|
|
2661
3763
|
class FormFields {
|
|
2662
3764
|
constructor() {
|
|
@@ -3136,6 +4238,12 @@ function createForm(options) {
|
|
|
3136
4238
|
exports.Button = Button;
|
|
3137
4239
|
exports.Checkbox = Checkbox;
|
|
3138
4240
|
exports.Checklist = Checklist;
|
|
4241
|
+
exports.DATETIME_SUBTYPES = DATETIME_SUBTYPES;
|
|
4242
|
+
exports.DATETIME_SUBTYPES_LABELS = DATETIME_SUBTYPES_LABELS;
|
|
4243
|
+
exports.DATETIME_SUBTYPE_PATH = DATETIME_SUBTYPE_PATH;
|
|
4244
|
+
exports.DATE_DISALLOW_PAST_PATH = DATE_DISALLOW_PAST_PATH;
|
|
4245
|
+
exports.DATE_LABEL_PATH = DATE_LABEL_PATH;
|
|
4246
|
+
exports.Datetime = Datetime;
|
|
3139
4247
|
exports.Default = Default;
|
|
3140
4248
|
exports.Form = Form;
|
|
3141
4249
|
exports.FormComponent = FormComponent;
|
|
@@ -3144,13 +4252,25 @@ exports.FormFieldRegistry = FormFieldRegistry;
|
|
|
3144
4252
|
exports.FormFields = FormFields;
|
|
3145
4253
|
exports.FormRenderContext = FormRenderContext;
|
|
3146
4254
|
exports.Image = Image;
|
|
4255
|
+
exports.MINUTES_IN_DAY = MINUTES_IN_DAY;
|
|
3147
4256
|
exports.Numberfield = Numberfield;
|
|
3148
4257
|
exports.Radio = Radio;
|
|
3149
4258
|
exports.Select = Select;
|
|
4259
|
+
exports.TIME_INTERVAL_PATH = TIME_INTERVAL_PATH;
|
|
4260
|
+
exports.TIME_LABEL_PATH = TIME_LABEL_PATH;
|
|
4261
|
+
exports.TIME_SERIALISINGFORMAT_LABELS = TIME_SERIALISINGFORMAT_LABELS;
|
|
4262
|
+
exports.TIME_SERIALISING_FORMATS = TIME_SERIALISING_FORMATS;
|
|
4263
|
+
exports.TIME_SERIALISING_FORMAT_PATH = TIME_SERIALISING_FORMAT_PATH;
|
|
4264
|
+
exports.TIME_USE24H_PATH = TIME_USE24H_PATH;
|
|
3150
4265
|
exports.Taglist = Taglist;
|
|
3151
4266
|
exports.Text = Text;
|
|
3152
4267
|
exports.Textarea = Textarea;
|
|
3153
4268
|
exports.Textfield = Textfield;
|
|
4269
|
+
exports.VALUES_SOURCES = VALUES_SOURCES;
|
|
4270
|
+
exports.VALUES_SOURCES_DEFAULTS = VALUES_SOURCES_DEFAULTS;
|
|
4271
|
+
exports.VALUES_SOURCES_LABELS = VALUES_SOURCES_LABELS;
|
|
4272
|
+
exports.VALUES_SOURCES_PATHS = VALUES_SOURCES_PATHS;
|
|
4273
|
+
exports.VALUES_SOURCE_DEFAULT = VALUES_SOURCE_DEFAULT;
|
|
3154
4274
|
exports.clone = clone;
|
|
3155
4275
|
exports.createForm = createForm;
|
|
3156
4276
|
exports.createFormContainer = createFormContainer;
|
|
@@ -3160,6 +4280,8 @@ exports.formFields = formFields;
|
|
|
3160
4280
|
exports.generateIdForType = generateIdForType;
|
|
3161
4281
|
exports.generateIndexForType = generateIndexForType;
|
|
3162
4282
|
exports.getSchemaVariables = getSchemaVariables;
|
|
4283
|
+
exports.getValuesSource = getValuesSource;
|
|
4284
|
+
exports.iconsByType = iconsByType;
|
|
3163
4285
|
exports.isRequired = isRequired;
|
|
3164
4286
|
exports.pathParse = pathParse;
|
|
3165
4287
|
exports.pathStringify = pathStringify;
|