@bpmn-io/form-js-viewer 0.10.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -22
- package/README.md +165 -165
- package/dist/assets/form-js.css +715 -611
- package/dist/index.cjs +953 -691
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +877 -606
- package/dist/index.es.js.map +1 -1
- package/dist/types/Form.d.ts +144 -144
- package/dist/types/core/ConditionChecker.d.ts +57 -57
- package/dist/types/core/EventBus.d.ts +1 -1
- package/dist/types/core/FormFieldRegistry.d.ts +17 -17
- package/dist/types/core/Validator.d.ts +7 -7
- package/dist/types/core/index.d.ts +18 -18
- package/dist/types/import/Importer.d.ts +43 -43
- package/dist/types/import/index.d.ts +5 -5
- package/dist/types/index.d.ts +18 -18
- package/dist/types/render/FormFields.d.ts +5 -5
- package/dist/types/render/Renderer.d.ts +23 -23
- package/dist/types/render/components/Description.d.ts +1 -1
- package/dist/types/render/components/Errors.d.ts +1 -1
- package/dist/types/render/components/FormComponent.d.ts +1 -1
- package/dist/types/render/components/FormField.d.ts +1 -1
- package/dist/types/render/components/Label.d.ts +1 -1
- package/dist/types/render/components/PoweredBy.d.ts +1 -1
- package/dist/types/render/components/Sanitizer.d.ts +8 -8
- package/dist/types/render/components/Util.d.ts +17 -17
- package/dist/types/render/components/form-fields/Button.d.ts +12 -11
- package/dist/types/render/components/form-fields/Checkbox.d.ts +14 -13
- package/dist/types/render/components/form-fields/Checklist.d.ts +18 -12
- package/dist/types/render/components/form-fields/Datetime.d.ts +13 -11
- package/dist/types/render/components/form-fields/Default.d.ts +11 -9
- package/dist/types/render/components/form-fields/Image.d.ts +10 -8
- package/dist/types/render/components/form-fields/Number.d.ts +15 -14
- package/dist/types/render/components/form-fields/Radio.d.ts +18 -12
- package/dist/types/render/components/form-fields/Select.d.ts +18 -12
- package/dist/types/render/components/form-fields/Taglist.d.ts +18 -12
- package/dist/types/render/components/form-fields/Text.d.ts +12 -10
- package/dist/types/render/components/form-fields/Textarea.d.ts +14 -13
- package/dist/types/render/components/form-fields/Textfield.d.ts +14 -13
- package/dist/types/render/components/form-fields/parts/Datepicker.d.ts +1 -1
- package/dist/types/render/components/form-fields/parts/DropdownList.d.ts +1 -1
- package/dist/types/render/components/form-fields/parts/InputAdorner.d.ts +1 -1
- package/dist/types/render/components/form-fields/parts/SearchableSelect.d.ts +1 -0
- package/dist/types/render/components/form-fields/parts/SimpleSelect.d.ts +1 -0
- package/dist/types/render/components/form-fields/parts/Timepicker.d.ts +1 -1
- package/dist/types/render/components/icons/index.d.ts +16 -16
- package/dist/types/render/components/index.d.ts +17 -17
- package/dist/types/render/components/util/dateTimeUtil.d.ts +12 -12
- package/dist/types/render/components/util/numberFieldUtil.d.ts +4 -4
- package/dist/types/render/components/util/sanitizerUtil.d.ts +3 -3
- package/dist/types/render/context/FormContext.d.ts +12 -12
- package/dist/types/render/context/FormRenderContext.d.ts +6 -6
- package/dist/types/render/context/index.d.ts +2 -2
- package/dist/types/render/hooks/useCondition.d.ts +9 -9
- package/dist/types/render/hooks/useEvaluation.d.ts +6 -6
- package/dist/types/render/hooks/useExpressionValue.d.ts +5 -5
- package/dist/types/render/hooks/useKeyDownAction.d.ts +1 -1
- package/dist/types/render/hooks/useService.d.ts +1 -1
- package/dist/types/render/hooks/useValuesAsync.d.ts +28 -28
- package/dist/types/render/index.d.ts +11 -11
- package/dist/types/src/types.d.ts +35 -35
- package/dist/types/util/constants/DatetimeConstants.d.ts +24 -24
- package/dist/types/util/constants/ValuesSourceConstants.d.ts +18 -15
- package/dist/types/util/constants/index.d.ts +2 -2
- package/dist/types/util/feel.d.ts +15 -15
- package/dist/types/util/form.d.ts +6 -6
- package/dist/types/util/index.d.ts +26 -25
- package/dist/types/util/injector.d.ts +2 -2
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var Ids = require('ids');
|
|
6
4
|
var minDash = require('min-dash');
|
|
7
5
|
var feelin = require('feelin');
|
|
@@ -16,19 +14,9 @@ var flatpickr = require('flatpickr');
|
|
|
16
14
|
var Markup = require('preact-markup');
|
|
17
15
|
var didi = require('didi');
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var Big__default = /*#__PURE__*/_interopDefaultLegacy(Big);
|
|
23
|
-
var snarkdown__default = /*#__PURE__*/_interopDefaultLegacy(snarkdown);
|
|
24
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
25
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
26
|
-
var flatpickr__default = /*#__PURE__*/_interopDefaultLegacy(flatpickr);
|
|
27
|
-
var Markup__default = /*#__PURE__*/_interopDefaultLegacy(Markup);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @typedef {object} Condition
|
|
31
|
-
* @property {string} [hide]
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {object} Condition
|
|
19
|
+
* @property {string} [hide]
|
|
32
20
|
*/
|
|
33
21
|
|
|
34
22
|
class ConditionChecker {
|
|
@@ -37,11 +25,11 @@ class ConditionChecker {
|
|
|
37
25
|
this._eventBus = eventBus;
|
|
38
26
|
}
|
|
39
27
|
|
|
40
|
-
/**
|
|
41
|
-
* For given data, remove properties based on condition.
|
|
42
|
-
*
|
|
43
|
-
* @param {Object<string, any>} properties
|
|
44
|
-
* @param {Object<string, any>} data
|
|
28
|
+
/**
|
|
29
|
+
* For given data, remove properties based on condition.
|
|
30
|
+
*
|
|
31
|
+
* @param {Object<string, any>} properties
|
|
32
|
+
* @param {Object<string, any>} data
|
|
45
33
|
*/
|
|
46
34
|
applyConditions(properties, data = {}) {
|
|
47
35
|
const conditions = this._getConditions();
|
|
@@ -60,13 +48,13 @@ class ConditionChecker {
|
|
|
60
48
|
return newProperties;
|
|
61
49
|
}
|
|
62
50
|
|
|
63
|
-
/**
|
|
64
|
-
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
65
|
-
*
|
|
66
|
-
* @param {string} condition
|
|
67
|
-
* @param {import('../types').Data} [data]
|
|
68
|
-
*
|
|
69
|
-
* @returns {boolean|null}
|
|
51
|
+
/**
|
|
52
|
+
* Check if given condition is met. Returns null for invalid/missing conditions.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} condition
|
|
55
|
+
* @param {import('../types').Data} [data]
|
|
56
|
+
*
|
|
57
|
+
* @returns {boolean|null}
|
|
70
58
|
*/
|
|
71
59
|
check(condition, data = {}) {
|
|
72
60
|
if (!condition) {
|
|
@@ -87,12 +75,12 @@ class ConditionChecker {
|
|
|
87
75
|
}
|
|
88
76
|
}
|
|
89
77
|
|
|
90
|
-
/**
|
|
91
|
-
* Check if hide condition is met.
|
|
92
|
-
*
|
|
93
|
-
* @param {Condition} condition
|
|
94
|
-
* @param {Object<string, any>} data
|
|
95
|
-
* @returns {boolean}
|
|
78
|
+
/**
|
|
79
|
+
* Check if hide condition is met.
|
|
80
|
+
*
|
|
81
|
+
* @param {Condition} condition
|
|
82
|
+
* @param {Object<string, any>} data
|
|
83
|
+
* @returns {boolean}
|
|
96
84
|
*/
|
|
97
85
|
_checkHideCondition(condition, data) {
|
|
98
86
|
if (!condition.hide) {
|
|
@@ -102,13 +90,13 @@ class ConditionChecker {
|
|
|
102
90
|
return result === true;
|
|
103
91
|
}
|
|
104
92
|
|
|
105
|
-
/**
|
|
106
|
-
* Evaluate an expression.
|
|
107
|
-
*
|
|
108
|
-
* @param {string} expression
|
|
109
|
-
* @param {import('../types').Data} [data]
|
|
110
|
-
*
|
|
111
|
-
* @returns {any}
|
|
93
|
+
/**
|
|
94
|
+
* Evaluate an expression.
|
|
95
|
+
*
|
|
96
|
+
* @param {string} expression
|
|
97
|
+
* @param {import('../types').Data} [data]
|
|
98
|
+
*
|
|
99
|
+
* @returns {any}
|
|
112
100
|
*/
|
|
113
101
|
evaluate(expression, data = {}) {
|
|
114
102
|
if (!expression) {
|
|
@@ -580,7 +568,7 @@ function invokeFunction(fn, args) {
|
|
|
580
568
|
}
|
|
581
569
|
|
|
582
570
|
function countDecimals(number) {
|
|
583
|
-
const num =
|
|
571
|
+
const num = Big(number);
|
|
584
572
|
if (num.toString() === num.toFixed(0)) return 0;
|
|
585
573
|
return num.toFixed().split('.')[1].length || 0;
|
|
586
574
|
}
|
|
@@ -616,7 +604,7 @@ class Validator {
|
|
|
616
604
|
if (type === 'number') {
|
|
617
605
|
const {
|
|
618
606
|
decimalDigits,
|
|
619
|
-
|
|
607
|
+
increment
|
|
620
608
|
} = field;
|
|
621
609
|
if (value === 'NaN') {
|
|
622
610
|
errors = [...errors, 'Value is not a number.'];
|
|
@@ -624,13 +612,13 @@ class Validator {
|
|
|
624
612
|
if (decimalDigits >= 0 && countDecimals(value) > decimalDigits) {
|
|
625
613
|
errors = [...errors, 'Value is expected to ' + (decimalDigits === 0 ? 'be an integer' : `have at most ${decimalDigits} decimal digit${decimalDigits > 1 ? 's' : ''}`) + '.'];
|
|
626
614
|
}
|
|
627
|
-
if (
|
|
628
|
-
const bigValue =
|
|
629
|
-
const
|
|
630
|
-
const offset = bigValue.mod(
|
|
615
|
+
if (increment) {
|
|
616
|
+
const bigValue = Big(value);
|
|
617
|
+
const bigIncrement = Big(increment);
|
|
618
|
+
const offset = bigValue.mod(bigIncrement);
|
|
631
619
|
if (offset.cmp(0) !== 0) {
|
|
632
620
|
const previousValue = bigValue.minus(offset);
|
|
633
|
-
const nextValue = previousValue.plus(
|
|
621
|
+
const nextValue = previousValue.plus(bigIncrement);
|
|
634
622
|
errors = [...errors, `Please select a valid value, the two nearest valid values are ${previousValue} and ${nextValue}.`];
|
|
635
623
|
}
|
|
636
624
|
}
|
|
@@ -645,10 +633,10 @@ class Validator {
|
|
|
645
633
|
if (validate.required && (minDash.isNil(value) || value === '')) {
|
|
646
634
|
errors = [...errors, 'Field is required.'];
|
|
647
635
|
}
|
|
648
|
-
if ('min' in validate && value && value < validate.min) {
|
|
636
|
+
if ('min' in validate && (value || value === 0) && value < validate.min) {
|
|
649
637
|
errors = [...errors, `Field must have minimum value of ${validate.min}.`];
|
|
650
638
|
}
|
|
651
|
-
if ('max' in validate && value && value > validate.max) {
|
|
639
|
+
if ('max' in validate && (value || value === 0) && value > validate.max) {
|
|
652
640
|
errors = [...errors, `Field must have maximum value of ${validate.max}.`];
|
|
653
641
|
}
|
|
654
642
|
if ('minLength' in validate && value && value.trim().length < validate.minLength) {
|
|
@@ -673,8 +661,8 @@ class FormFieldRegistry {
|
|
|
673
661
|
this._eventBus = eventBus;
|
|
674
662
|
this._formFields = {};
|
|
675
663
|
eventBus.on('form.clear', () => this.clear());
|
|
676
|
-
this._ids = new
|
|
677
|
-
this._keys = new
|
|
664
|
+
this._ids = new Ids([32, 36, 1]);
|
|
665
|
+
this._keys = new Ids([32, 36, 1]);
|
|
678
666
|
}
|
|
679
667
|
add(formField) {
|
|
680
668
|
const {
|
|
@@ -717,11 +705,11 @@ class FormFieldRegistry {
|
|
|
717
705
|
}
|
|
718
706
|
FormFieldRegistry.$inject = ['eventBus'];
|
|
719
707
|
|
|
720
|
-
/**
|
|
721
|
-
* Retrieve variable names from given FEEL unary test.
|
|
722
|
-
*
|
|
723
|
-
* @param {string} unaryTest
|
|
724
|
-
* @returns {string[]}
|
|
708
|
+
/**
|
|
709
|
+
* Retrieve variable names from given FEEL unary test.
|
|
710
|
+
*
|
|
711
|
+
* @param {string} unaryTest
|
|
712
|
+
* @returns {string[]}
|
|
725
713
|
*/
|
|
726
714
|
function getVariableNames(unaryTest) {
|
|
727
715
|
const tree = feelin.parseUnaryTests(unaryTest);
|
|
@@ -736,11 +724,11 @@ function getVariableNames(unaryTest) {
|
|
|
736
724
|
return Array.from(variables);
|
|
737
725
|
}
|
|
738
726
|
|
|
739
|
-
/**
|
|
740
|
-
* Retrieve variable names from given FEEL expression.
|
|
741
|
-
*
|
|
742
|
-
* @param {string} expression
|
|
743
|
-
* @returns {string[]}
|
|
727
|
+
/**
|
|
728
|
+
* Retrieve variable names from given FEEL expression.
|
|
729
|
+
*
|
|
730
|
+
* @param {string} expression
|
|
731
|
+
* @returns {string[]}
|
|
744
732
|
*/
|
|
745
733
|
function getExpressionVariableNames(expression) {
|
|
746
734
|
const tree = feelin.parseExpressions(expression);
|
|
@@ -754,7 +742,7 @@ function getExpressionVariableNames(expression) {
|
|
|
754
742
|
} while (cursor.next());
|
|
755
743
|
return Array.from(variables);
|
|
756
744
|
}
|
|
757
|
-
function isExpression$
|
|
745
|
+
function isExpression$1(value) {
|
|
758
746
|
return minDash.isString(value) && value.startsWith('=');
|
|
759
747
|
}
|
|
760
748
|
|
|
@@ -805,7 +793,10 @@ const VALUES_SOURCES_PATHS = {
|
|
|
805
793
|
[VALUES_SOURCES.INPUT]: ['valuesKey']
|
|
806
794
|
};
|
|
807
795
|
const VALUES_SOURCES_DEFAULTS = {
|
|
808
|
-
[VALUES_SOURCES.STATIC]: [
|
|
796
|
+
[VALUES_SOURCES.STATIC]: [{
|
|
797
|
+
label: 'Value',
|
|
798
|
+
value: 'value'
|
|
799
|
+
}],
|
|
809
800
|
[VALUES_SOURCES.INPUT]: ''
|
|
810
801
|
};
|
|
811
802
|
|
|
@@ -826,10 +817,10 @@ function createInjector(bootstrapModules) {
|
|
|
826
817
|
return injector;
|
|
827
818
|
}
|
|
828
819
|
|
|
829
|
-
/**
|
|
830
|
-
* @param {string?} prefix
|
|
831
|
-
*
|
|
832
|
-
* @returns Element
|
|
820
|
+
/**
|
|
821
|
+
* @param {string?} prefix
|
|
822
|
+
*
|
|
823
|
+
* @returns Element
|
|
833
824
|
*/
|
|
834
825
|
function createFormContainer(prefix = 'fjs') {
|
|
835
826
|
const container = document.createElement('div');
|
|
@@ -874,22 +865,22 @@ function generateIdForType(type) {
|
|
|
874
865
|
return `${type}${generateIndexForType(type)}`;
|
|
875
866
|
}
|
|
876
867
|
|
|
877
|
-
/**
|
|
878
|
-
* @template T
|
|
879
|
-
* @param {T} data
|
|
880
|
-
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
881
|
-
* @return {T}
|
|
868
|
+
/**
|
|
869
|
+
* @template T
|
|
870
|
+
* @param {T} data
|
|
871
|
+
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
872
|
+
* @return {T}
|
|
882
873
|
*/
|
|
883
874
|
function clone(data, replacer) {
|
|
884
875
|
return JSON.parse(JSON.stringify(data, replacer));
|
|
885
876
|
}
|
|
886
877
|
|
|
887
|
-
/**
|
|
888
|
-
* Parse the schema for input variables a form might make use of
|
|
889
|
-
*
|
|
890
|
-
* @param {any} schema
|
|
891
|
-
*
|
|
892
|
-
* @return {string[]}
|
|
878
|
+
/**
|
|
879
|
+
* Parse the schema for input variables a form might make use of
|
|
880
|
+
*
|
|
881
|
+
* @param {any} schema
|
|
882
|
+
*
|
|
883
|
+
* @return {string[]}
|
|
893
884
|
*/
|
|
894
885
|
function getSchemaVariables(schema) {
|
|
895
886
|
if (!schema.components) {
|
|
@@ -931,32 +922,26 @@ function getSchemaVariables(schema) {
|
|
|
931
922
|
return Array.from(new Set(variables));
|
|
932
923
|
}
|
|
933
924
|
|
|
934
|
-
// helper ///////////////
|
|
935
|
-
|
|
936
|
-
function isExpression$1(value) {
|
|
937
|
-
return minDash.isString(value) && value.startsWith('=');
|
|
938
|
-
}
|
|
939
|
-
|
|
940
925
|
class Importer {
|
|
941
|
-
/**
|
|
942
|
-
* @constructor
|
|
943
|
-
* @param { import('../core').FormFieldRegistry } formFieldRegistry
|
|
944
|
-
* @param { import('../render/FormFields').default } formFields
|
|
926
|
+
/**
|
|
927
|
+
* @constructor
|
|
928
|
+
* @param { import('../core').FormFieldRegistry } formFieldRegistry
|
|
929
|
+
* @param { import('../render/FormFields').default } formFields
|
|
945
930
|
*/
|
|
946
931
|
constructor(formFieldRegistry, formFields) {
|
|
947
932
|
this._formFieldRegistry = formFieldRegistry;
|
|
948
933
|
this._formFields = formFields;
|
|
949
934
|
}
|
|
950
935
|
|
|
951
|
-
/**
|
|
952
|
-
* Import schema adding `id`, `_parent` and `_path`
|
|
953
|
-
* information to each field and adding it to the
|
|
954
|
-
* form field registry.
|
|
955
|
-
*
|
|
956
|
-
* @param {any} schema
|
|
957
|
-
* @param {any} [data]
|
|
958
|
-
*
|
|
959
|
-
* @return { { warnings: Array<any>, schema: any, data: any } }
|
|
936
|
+
/**
|
|
937
|
+
* Import schema adding `id`, `_parent` and `_path`
|
|
938
|
+
* information to each field and adding it to the
|
|
939
|
+
* form field registry.
|
|
940
|
+
*
|
|
941
|
+
* @param {any} schema
|
|
942
|
+
* @param {any} [data]
|
|
943
|
+
*
|
|
944
|
+
* @return { { warnings: Array<any>, schema: any, data: any } }
|
|
960
945
|
*/
|
|
961
946
|
importSchema(schema, data = {}) {
|
|
962
947
|
// TODO: Add warnings - https://github.com/bpmn-io/form-js/issues/289
|
|
@@ -975,11 +960,11 @@ class Importer {
|
|
|
975
960
|
}
|
|
976
961
|
}
|
|
977
962
|
|
|
978
|
-
/**
|
|
979
|
-
* @param {any} formField
|
|
980
|
-
* @param {string} [parentId]
|
|
981
|
-
*
|
|
982
|
-
* @return {any} importedField
|
|
963
|
+
/**
|
|
964
|
+
* @param {any} formField
|
|
965
|
+
* @param {string} [parentId]
|
|
966
|
+
*
|
|
967
|
+
* @return {any} importedField
|
|
983
968
|
*/
|
|
984
969
|
importFormField(formField, parentId) {
|
|
985
970
|
const {
|
|
@@ -1030,10 +1015,10 @@ class Importer {
|
|
|
1030
1015
|
});
|
|
1031
1016
|
}
|
|
1032
1017
|
|
|
1033
|
-
/**
|
|
1034
|
-
* @param {Object} data
|
|
1035
|
-
*
|
|
1036
|
-
* @return {Object} initializedData
|
|
1018
|
+
/**
|
|
1019
|
+
* @param {Object} data
|
|
1020
|
+
*
|
|
1021
|
+
* @return {Object} initializedData
|
|
1037
1022
|
*/
|
|
1038
1023
|
initializeFieldValues(data) {
|
|
1039
1024
|
return this._formFieldRegistry.getAll().reduce((initializedData, formField) => {
|
|
@@ -1083,11 +1068,11 @@ const ATTR_WHITESPACE_PATTERN = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u
|
|
|
1083
1068
|
|
|
1084
1069
|
const FORM_ELEMENT = document.createElement('form');
|
|
1085
1070
|
|
|
1086
|
-
/**
|
|
1087
|
-
* Sanitize a HTML string and return the cleaned, safe version.
|
|
1088
|
-
*
|
|
1089
|
-
* @param {string} html
|
|
1090
|
-
* @return {string}
|
|
1071
|
+
/**
|
|
1072
|
+
* Sanitize a HTML string and return the cleaned, safe version.
|
|
1073
|
+
*
|
|
1074
|
+
* @param {string} html
|
|
1075
|
+
* @return {string}
|
|
1091
1076
|
*/
|
|
1092
1077
|
function sanitizeHTML(html) {
|
|
1093
1078
|
const doc = new DOMParser().parseFromString(`<!DOCTYPE html>\n<html><body><div>${html}`, 'text/html');
|
|
@@ -1107,15 +1092,15 @@ function sanitizeImageSource(src) {
|
|
|
1107
1092
|
return valid ? src : '';
|
|
1108
1093
|
}
|
|
1109
1094
|
|
|
1110
|
-
/**
|
|
1111
|
-
* Recursively sanitize a HTML node, potentially
|
|
1112
|
-
* removing it, its children or attributes.
|
|
1113
|
-
*
|
|
1114
|
-
* Inspired by https://github.com/developit/snarkdown/issues/70
|
|
1115
|
-
* and https://github.com/cure53/DOMPurify. Simplified
|
|
1116
|
-
* for our use-case.
|
|
1117
|
-
*
|
|
1118
|
-
* @param {Element} node
|
|
1095
|
+
/**
|
|
1096
|
+
* Recursively sanitize a HTML node, potentially
|
|
1097
|
+
* removing it, its children or attributes.
|
|
1098
|
+
*
|
|
1099
|
+
* Inspired by https://github.com/developit/snarkdown/issues/70
|
|
1100
|
+
* and https://github.com/cure53/DOMPurify. Simplified
|
|
1101
|
+
* for our use-case.
|
|
1102
|
+
*
|
|
1103
|
+
* @param {Element} node
|
|
1119
1104
|
*/
|
|
1120
1105
|
function sanitizeNode(node) {
|
|
1121
1106
|
// allow text nodes
|
|
@@ -1159,13 +1144,13 @@ function sanitizeNode(node) {
|
|
|
1159
1144
|
}
|
|
1160
1145
|
}
|
|
1161
1146
|
|
|
1162
|
-
/**
|
|
1163
|
-
* Validates attributes for validity.
|
|
1164
|
-
*
|
|
1165
|
-
* @param {string} lcTag
|
|
1166
|
-
* @param {string} lcName
|
|
1167
|
-
* @param {string} value
|
|
1168
|
-
* @return {boolean}
|
|
1147
|
+
/**
|
|
1148
|
+
* Validates attributes for validity.
|
|
1149
|
+
*
|
|
1150
|
+
* @param {string} lcTag
|
|
1151
|
+
* @param {string} lcName
|
|
1152
|
+
* @param {string} value
|
|
1153
|
+
* @return {boolean}
|
|
1169
1154
|
*/
|
|
1170
1155
|
function isValidAttribute(lcTag, lcName, value) {
|
|
1171
1156
|
// disallow most attributes based on whitelist
|
|
@@ -1195,7 +1180,7 @@ function formFieldClasses(type, {
|
|
|
1195
1180
|
if (!type) {
|
|
1196
1181
|
throw new Error('type required');
|
|
1197
1182
|
}
|
|
1198
|
-
return
|
|
1183
|
+
return classNames('fjs-form-field', `fjs-form-field-${type}`, {
|
|
1199
1184
|
'fjs-has-errors': errors.length > 0,
|
|
1200
1185
|
'fjs-disabled': disabled
|
|
1201
1186
|
});
|
|
@@ -1207,7 +1192,7 @@ function prefixId(id, formId) {
|
|
|
1207
1192
|
return `fjs-form-${id}`;
|
|
1208
1193
|
}
|
|
1209
1194
|
function markdownToHTML(markdown) {
|
|
1210
|
-
const htmls = markdown.toString().split(/(?:\r?\n){2,}/).map(line => /^((\d+.)|[><\s#-*])/.test(line) ?
|
|
1195
|
+
const htmls = markdown.toString().split(/(?:\r?\n){2,}/).map(line => /^((\d+.)|[><\s#-*])/.test(line) ? snarkdown(line) : `<p>${snarkdown(line)}</p>`);
|
|
1211
1196
|
return htmls.join('\n\n');
|
|
1212
1197
|
}
|
|
1213
1198
|
|
|
@@ -1217,14 +1202,14 @@ function safeMarkdown(markdown) {
|
|
|
1217
1202
|
return sanitizeHTML(html);
|
|
1218
1203
|
}
|
|
1219
1204
|
|
|
1220
|
-
/**
|
|
1221
|
-
* Sanitizes an image source to ensure we only allow for data URI and links
|
|
1222
|
-
* that start with http(s).
|
|
1223
|
-
*
|
|
1224
|
-
* Note: Most browsers anyway do not support script execution in <img> elements.
|
|
1225
|
-
*
|
|
1226
|
-
* @param {string} src
|
|
1227
|
-
* @returns {string}
|
|
1205
|
+
/**
|
|
1206
|
+
* Sanitizes an image source to ensure we only allow for data URI and links
|
|
1207
|
+
* that start with http(s).
|
|
1208
|
+
*
|
|
1209
|
+
* Note: Most browsers anyway do not support script execution in <img> elements.
|
|
1210
|
+
*
|
|
1211
|
+
* @param {string} src
|
|
1212
|
+
* @returns {string}
|
|
1228
1213
|
*/
|
|
1229
1214
|
function safeImageSource(src) {
|
|
1230
1215
|
return sanitizeImageSource(src);
|
|
@@ -1249,15 +1234,14 @@ function Button(props) {
|
|
|
1249
1234
|
})
|
|
1250
1235
|
});
|
|
1251
1236
|
}
|
|
1252
|
-
Button.create =
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
};
|
|
1257
|
-
};
|
|
1237
|
+
Button.create = (options = {}) => ({
|
|
1238
|
+
action: 'submit',
|
|
1239
|
+
...options
|
|
1240
|
+
});
|
|
1258
1241
|
Button.type = type$b;
|
|
1259
1242
|
Button.label = 'Button';
|
|
1260
1243
|
Button.keyed = true;
|
|
1244
|
+
Button.group = 'action';
|
|
1261
1245
|
|
|
1262
1246
|
const FormRenderContext = preact.createContext({
|
|
1263
1247
|
Empty: props => {
|
|
@@ -1270,18 +1254,20 @@ const FormRenderContext = preact.createContext({
|
|
|
1270
1254
|
return props.children;
|
|
1271
1255
|
}
|
|
1272
1256
|
});
|
|
1257
|
+
var FormRenderContext$1 = FormRenderContext;
|
|
1273
1258
|
|
|
1274
|
-
/**
|
|
1275
|
-
* @param {string} type
|
|
1276
|
-
* @param {boolean} [strict]
|
|
1277
|
-
*
|
|
1278
|
-
* @returns {any}
|
|
1259
|
+
/**
|
|
1260
|
+
* @param {string} type
|
|
1261
|
+
* @param {boolean} [strict]
|
|
1262
|
+
*
|
|
1263
|
+
* @returns {any}
|
|
1279
1264
|
*/
|
|
1280
1265
|
function getService(type, strict) {}
|
|
1281
1266
|
const FormContext = preact.createContext({
|
|
1282
1267
|
getService,
|
|
1283
1268
|
formId: null
|
|
1284
1269
|
});
|
|
1270
|
+
var FormContext$1 = FormContext;
|
|
1285
1271
|
|
|
1286
1272
|
function Description(props) {
|
|
1287
1273
|
const {
|
|
@@ -1324,7 +1310,7 @@ function Label(props) {
|
|
|
1324
1310
|
} = props;
|
|
1325
1311
|
return jsxRuntime.jsxs("label", {
|
|
1326
1312
|
for: id,
|
|
1327
|
-
class:
|
|
1313
|
+
class: classNames('fjs-form-field-label', {
|
|
1328
1314
|
'fjs-incollapsible-label': !collapseOnEmpty
|
|
1329
1315
|
}, props['class']),
|
|
1330
1316
|
children: [props.children, label || '', required && jsxRuntime.jsx("span", {
|
|
@@ -1357,9 +1343,9 @@ function Checkbox(props) {
|
|
|
1357
1343
|
};
|
|
1358
1344
|
const {
|
|
1359
1345
|
formId
|
|
1360
|
-
} = hooks.useContext(FormContext);
|
|
1346
|
+
} = hooks.useContext(FormContext$1);
|
|
1361
1347
|
return jsxRuntime.jsxs("div", {
|
|
1362
|
-
class:
|
|
1348
|
+
class: classNames(formFieldClasses(type$a, {
|
|
1363
1349
|
errors,
|
|
1364
1350
|
disabled
|
|
1365
1351
|
}), {
|
|
@@ -1384,11 +1370,9 @@ function Checkbox(props) {
|
|
|
1384
1370
|
})]
|
|
1385
1371
|
});
|
|
1386
1372
|
}
|
|
1387
|
-
Checkbox.create =
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
};
|
|
1391
|
-
};
|
|
1373
|
+
Checkbox.create = (options = {}) => ({
|
|
1374
|
+
...options
|
|
1375
|
+
});
|
|
1392
1376
|
Checkbox.type = type$a;
|
|
1393
1377
|
Checkbox.label = 'Checkbox';
|
|
1394
1378
|
Checkbox.keyed = true;
|
|
@@ -1396,16 +1380,17 @@ Checkbox.emptyValue = false;
|
|
|
1396
1380
|
Checkbox.sanitizeValue = ({
|
|
1397
1381
|
value
|
|
1398
1382
|
}) => value === true;
|
|
1383
|
+
Checkbox.group = 'selection';
|
|
1399
1384
|
|
|
1400
1385
|
function useService (type, strict) {
|
|
1401
1386
|
const {
|
|
1402
1387
|
getService
|
|
1403
|
-
} = hooks.useContext(FormContext);
|
|
1388
|
+
} = hooks.useContext(FormContext$1);
|
|
1404
1389
|
return getService(type, strict);
|
|
1405
1390
|
}
|
|
1406
1391
|
|
|
1407
|
-
/**
|
|
1408
|
-
* @enum { String }
|
|
1392
|
+
/**
|
|
1393
|
+
* @enum { String }
|
|
1409
1394
|
*/
|
|
1410
1395
|
const LOAD_STATES = {
|
|
1411
1396
|
LOADING: 'loading',
|
|
@@ -1413,17 +1398,17 @@ const LOAD_STATES = {
|
|
|
1413
1398
|
ERROR: 'error'
|
|
1414
1399
|
};
|
|
1415
1400
|
|
|
1416
|
-
/**
|
|
1417
|
-
* @typedef {Object} ValuesGetter
|
|
1418
|
-
* @property {Object[]} values - The values data
|
|
1419
|
-
* @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
|
|
1401
|
+
/**
|
|
1402
|
+
* @typedef {Object} ValuesGetter
|
|
1403
|
+
* @property {Object[]} values - The values data
|
|
1404
|
+
* @property {(LOAD_STATES)} state - The values data's loading state, to use for conditional rendering
|
|
1420
1405
|
*/
|
|
1421
1406
|
|
|
1422
|
-
/**
|
|
1423
|
-
* A hook to load values for single and multiselect components.
|
|
1424
|
-
*
|
|
1425
|
-
* @param {Object} field - The form field to handle values for
|
|
1426
|
-
* @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
|
|
1407
|
+
/**
|
|
1408
|
+
* A hook to load values for single and multiselect components.
|
|
1409
|
+
*
|
|
1410
|
+
* @param {Object} field - The form field to handle values for
|
|
1411
|
+
* @return {ValuesGetter} valuesGetter - A values getter object providing loading state and values
|
|
1427
1412
|
*/
|
|
1428
1413
|
function useValuesAsync (field) {
|
|
1429
1414
|
const {
|
|
@@ -1497,8 +1482,8 @@ function parseInputTime(stringTime) {
|
|
|
1497
1482
|
if (is12h) {
|
|
1498
1483
|
const isPM = workingString.includes('pm');
|
|
1499
1484
|
const digits = workingString.match(/\d+/g);
|
|
1500
|
-
const displayHour = parseInt(digits
|
|
1501
|
-
const minute = parseInt(digits
|
|
1485
|
+
const displayHour = parseInt(digits && digits[0]);
|
|
1486
|
+
const minute = parseInt(digits && digits[1]) || 0;
|
|
1502
1487
|
const isValidDisplayHour = minDash.isNumber(displayHour) && displayHour >= 1 && displayHour <= 12;
|
|
1503
1488
|
const isValidMinute = minute >= 0 && minute <= 59;
|
|
1504
1489
|
if (!isValidDisplayHour || !isValidMinute) return null;
|
|
@@ -1506,8 +1491,8 @@ function parseInputTime(stringTime) {
|
|
|
1506
1491
|
return hour * 60 + minute;
|
|
1507
1492
|
} else {
|
|
1508
1493
|
const digits = workingString.match(/\d+/g);
|
|
1509
|
-
const hour = parseInt(digits
|
|
1510
|
-
const minute = parseInt(digits
|
|
1494
|
+
const hour = parseInt(digits && digits[0]);
|
|
1495
|
+
const minute = parseInt(digits && digits[1]);
|
|
1511
1496
|
const isValidHour = minDash.isNumber(hour) && hour >= 0 && hour <= 23;
|
|
1512
1497
|
const isValidMinute = minDash.isNumber(minute) && minute >= 0 && minute <= 59;
|
|
1513
1498
|
if (!isValidHour || !isValidMinute) return null;
|
|
@@ -1710,9 +1695,9 @@ function Checklist(props) {
|
|
|
1710
1695
|
} = useValuesAsync(field);
|
|
1711
1696
|
const {
|
|
1712
1697
|
formId
|
|
1713
|
-
} = hooks.useContext(FormContext);
|
|
1698
|
+
} = hooks.useContext(FormContext$1);
|
|
1714
1699
|
return jsxRuntime.jsxs("div", {
|
|
1715
|
-
class:
|
|
1700
|
+
class: classNames(formFieldClasses(type$9, {
|
|
1716
1701
|
errors,
|
|
1717
1702
|
disabled
|
|
1718
1703
|
})),
|
|
@@ -1722,7 +1707,7 @@ function Checklist(props) {
|
|
|
1722
1707
|
return jsxRuntime.jsx(Label, {
|
|
1723
1708
|
id: prefixId(`${id}-${index}`, formId),
|
|
1724
1709
|
label: v.label,
|
|
1725
|
-
class:
|
|
1710
|
+
class: classNames({
|
|
1726
1711
|
'fjs-checked': value.includes(v.value)
|
|
1727
1712
|
}),
|
|
1728
1713
|
required: false,
|
|
@@ -1742,13 +1727,18 @@ function Checklist(props) {
|
|
|
1742
1727
|
})]
|
|
1743
1728
|
});
|
|
1744
1729
|
}
|
|
1745
|
-
Checklist.create =
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1730
|
+
Checklist.create = (options = {}) => {
|
|
1731
|
+
const defaults = {};
|
|
1732
|
+
|
|
1733
|
+
// provide default values if valuesKey isn't set
|
|
1734
|
+
if (!options.valuesKey) {
|
|
1735
|
+
defaults.values = [{
|
|
1749
1736
|
label: 'Value',
|
|
1750
1737
|
value: 'value'
|
|
1751
|
-
}]
|
|
1738
|
+
}];
|
|
1739
|
+
}
|
|
1740
|
+
return {
|
|
1741
|
+
...defaults,
|
|
1752
1742
|
...options
|
|
1753
1743
|
};
|
|
1754
1744
|
};
|
|
@@ -1757,14 +1747,15 @@ Checklist.label = 'Checklist';
|
|
|
1757
1747
|
Checklist.keyed = true;
|
|
1758
1748
|
Checklist.emptyValue = [];
|
|
1759
1749
|
Checklist.sanitizeValue = sanitizeMultiSelectValue;
|
|
1750
|
+
Checklist.group = 'selection';
|
|
1760
1751
|
|
|
1761
|
-
/**
|
|
1762
|
-
* Check if condition is met with given variables.
|
|
1763
|
-
*
|
|
1764
|
-
* @param {string | undefined} condition
|
|
1765
|
-
* @param {import('../../types').Data} data
|
|
1766
|
-
*
|
|
1767
|
-
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
1752
|
+
/**
|
|
1753
|
+
* Check if condition is met with given variables.
|
|
1754
|
+
*
|
|
1755
|
+
* @param {string | undefined} condition
|
|
1756
|
+
* @param {import('../../types').Data} data
|
|
1757
|
+
*
|
|
1758
|
+
* @returns {boolean} true if condition is met or no condition or condition checker exists
|
|
1768
1759
|
*/
|
|
1769
1760
|
function useCondition(condition, data) {
|
|
1770
1761
|
const initialData = useService('form')._getState().initialData;
|
|
@@ -1800,7 +1791,7 @@ function FormField(props) {
|
|
|
1800
1791
|
const {
|
|
1801
1792
|
Element,
|
|
1802
1793
|
Empty
|
|
1803
|
-
} = hooks.useContext(FormRenderContext);
|
|
1794
|
+
} = hooks.useContext(FormRenderContext$1);
|
|
1804
1795
|
const FormFieldComponent = formFields.get(field.type);
|
|
1805
1796
|
if (!FormFieldComponent) {
|
|
1806
1797
|
throw new Error(`cannot render field <${field.type}>`);
|
|
@@ -1832,7 +1823,7 @@ function Default(props) {
|
|
|
1832
1823
|
const {
|
|
1833
1824
|
Children,
|
|
1834
1825
|
Empty
|
|
1835
|
-
} = hooks.useContext(FormRenderContext);
|
|
1826
|
+
} = hooks.useContext(FormRenderContext$1);
|
|
1836
1827
|
const {
|
|
1837
1828
|
field
|
|
1838
1829
|
} = props;
|
|
@@ -1851,30 +1842,30 @@ function Default(props) {
|
|
|
1851
1842
|
}), components.length ? null : jsxRuntime.jsx(Empty, {})]
|
|
1852
1843
|
});
|
|
1853
1844
|
}
|
|
1854
|
-
Default.create =
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
};
|
|
1859
|
-
};
|
|
1845
|
+
Default.create = (options = {}) => ({
|
|
1846
|
+
components: [],
|
|
1847
|
+
...options
|
|
1848
|
+
});
|
|
1860
1849
|
Default.type = 'default';
|
|
1861
1850
|
Default.keyed = false;
|
|
1851
|
+
Default.label = null;
|
|
1852
|
+
Default.group = null;
|
|
1862
1853
|
|
|
1863
|
-
function _extends$
|
|
1854
|
+
function _extends$j() { _extends$j = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$j.apply(this, arguments); }
|
|
1864
1855
|
var CalendarIcon = (({
|
|
1865
1856
|
styles = {},
|
|
1866
1857
|
...props
|
|
1867
|
-
}) => /*#__PURE__*/
|
|
1858
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$j({
|
|
1868
1859
|
width: "14",
|
|
1869
1860
|
height: "15",
|
|
1870
1861
|
viewBox: "0 0 28 30",
|
|
1871
1862
|
fill: "none",
|
|
1872
1863
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1873
|
-
}, props), /*#__PURE__*/
|
|
1864
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
1874
1865
|
fillRule: "evenodd",
|
|
1875
1866
|
clipRule: "evenodd",
|
|
1876
|
-
|
|
1877
|
-
|
|
1867
|
+
fill: "currentColor",
|
|
1868
|
+
d: "M19 2H9V0H7v2H2a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V4a2 2 0 00-2-2h-5V0h-2v2zM7 7V4H2v5h24V4h-5v3h-2V4H9v3H7zm-5 4v17h24V11H2z"
|
|
1878
1869
|
})));
|
|
1879
1870
|
|
|
1880
1871
|
function InputAdorner(props) {
|
|
@@ -1887,10 +1878,10 @@ function InputAdorner(props) {
|
|
|
1887
1878
|
disabled,
|
|
1888
1879
|
hasErrors
|
|
1889
1880
|
} = props;
|
|
1890
|
-
const onAdornmentClick = () => inputRef
|
|
1881
|
+
const onAdornmentClick = () => inputRef && inputRef.current && inputRef.current.focus();
|
|
1891
1882
|
return jsxRuntime.jsxs("div", {
|
|
1892
|
-
class:
|
|
1893
|
-
'disabled': disabled
|
|
1883
|
+
class: classNames('fjs-input-group', {
|
|
1884
|
+
'fjs-disabled': disabled
|
|
1894
1885
|
}, {
|
|
1895
1886
|
'hasErrors': hasErrors
|
|
1896
1887
|
}),
|
|
@@ -1939,24 +1930,16 @@ function Datepicker(props) {
|
|
|
1939
1930
|
|
|
1940
1931
|
// setup flatpickr instance
|
|
1941
1932
|
hooks.useEffect(() => {
|
|
1942
|
-
if (disabled) {
|
|
1943
|
-
setFlatpickrInstance(null);
|
|
1944
|
-
return;
|
|
1945
|
-
}
|
|
1946
1933
|
let config = {
|
|
1947
1934
|
allowInput: true,
|
|
1948
1935
|
dateFormat: 'm/d/Y',
|
|
1949
1936
|
static: true,
|
|
1950
1937
|
clickOpens: false,
|
|
1938
|
+
// TODO: support dates prior to 1900 (https://github.com/bpmn-io/form-js/issues/533)
|
|
1939
|
+
minDate: disallowPassedDates ? 'today' : '01/01/1900',
|
|
1951
1940
|
errorHandler: () => {/* do nothing, we expect the values to sometimes be erronous and we don't want warnings polluting the console */}
|
|
1952
1941
|
};
|
|
1953
|
-
|
|
1954
|
-
config = {
|
|
1955
|
-
...config,
|
|
1956
|
-
minDate: 'today'
|
|
1957
|
-
};
|
|
1958
|
-
}
|
|
1959
|
-
const instance = flatpickr__default['default'](dateInputRef.current, config);
|
|
1942
|
+
const instance = flatpickr(dateInputRef.current, config);
|
|
1960
1943
|
setFlatpickrInstance(instance);
|
|
1961
1944
|
const onCalendarFocusOut = e => {
|
|
1962
1945
|
if (!instance.calendarContainer.contains(e.relatedTarget) && e.relatedTarget != dateInputRef.current) {
|
|
@@ -1975,7 +1958,7 @@ function Datepicker(props) {
|
|
|
1975
1958
|
// flatpicker logic that was lost when setting allowInput to true
|
|
1976
1959
|
instance.config.onOpen = [() => instance.calendarContainer.addEventListener('focusout', onCalendarFocusOut), () => instance.calendarContainer.addEventListener('mousedown', onCalendarMouseDown)];
|
|
1977
1960
|
instance.config.onClose = [() => instance.calendarContainer.removeEventListener('focusout', onCalendarFocusOut), () => instance.calendarContainer.removeEventListener('mousedown', onCalendarMouseDown)];
|
|
1978
|
-
}, [
|
|
1961
|
+
}, [disallowPassedDates]);
|
|
1979
1962
|
|
|
1980
1963
|
// onChange is updated dynamically, so not to re-render the flatpicker every time it changes
|
|
1981
1964
|
hooks.useEffect(() => {
|
|
@@ -2039,7 +2022,7 @@ function Datepicker(props) {
|
|
|
2039
2022
|
class: 'fjs-input',
|
|
2040
2023
|
disabled: disabled,
|
|
2041
2024
|
placeholder: "mm/dd/yyyy",
|
|
2042
|
-
autoComplete: "
|
|
2025
|
+
autoComplete: "off",
|
|
2043
2026
|
onFocus: onInputFocus,
|
|
2044
2027
|
onKeyDown: onInputKeyDown,
|
|
2045
2028
|
onMouseDown: e => !flatpickrInstance.isOpen && flatpickrInstance.open(),
|
|
@@ -2052,24 +2035,24 @@ function Datepicker(props) {
|
|
|
2052
2035
|
});
|
|
2053
2036
|
}
|
|
2054
2037
|
|
|
2055
|
-
function _extends$
|
|
2038
|
+
function _extends$i() { _extends$i = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$i.apply(this, arguments); }
|
|
2056
2039
|
var ClockIcon = (({
|
|
2057
2040
|
styles = {},
|
|
2058
2041
|
...props
|
|
2059
|
-
}) => /*#__PURE__*/
|
|
2042
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$i({
|
|
2060
2043
|
width: "16",
|
|
2061
2044
|
height: "16",
|
|
2062
2045
|
viewBox: "0 0 28 29",
|
|
2063
2046
|
fill: "none",
|
|
2064
2047
|
xmlns: "http://www.w3.org/2000/svg"
|
|
2065
|
-
}, props), /*#__PURE__*/
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
}), /*#__PURE__*/
|
|
2048
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
2049
|
+
fill: "currentColor",
|
|
2050
|
+
d: "M13 14.41L18.59 20 20 18.59l-5-5.01V5h-2v9.41z"
|
|
2051
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
2069
2052
|
fillRule: "evenodd",
|
|
2070
2053
|
clipRule: "evenodd",
|
|
2071
|
-
|
|
2072
|
-
|
|
2054
|
+
fill: "currentColor",
|
|
2055
|
+
d: "M6.222 25.64A14 14 0 1021.778 2.36 14 14 0 006.222 25.64zM7.333 4.023a12 12 0 1113.334 19.955A12 12 0 017.333 4.022z"
|
|
2073
2056
|
})));
|
|
2074
2057
|
|
|
2075
2058
|
function useKeyDownAction(targetKey, action, listenerElement = window) {
|
|
@@ -2092,7 +2075,7 @@ const DEFAULT_LABEL_GETTER = value => value;
|
|
|
2092
2075
|
const NOOP = () => {};
|
|
2093
2076
|
function DropdownList(props) {
|
|
2094
2077
|
const {
|
|
2095
|
-
|
|
2078
|
+
listenerElement = window,
|
|
2096
2079
|
values = [],
|
|
2097
2080
|
getLabel = DEFAULT_LABEL_GETTER,
|
|
2098
2081
|
onValueSelected = NOOP,
|
|
@@ -2122,18 +2105,18 @@ function DropdownList(props) {
|
|
|
2122
2105
|
changeFocusedValueIndex(-1);
|
|
2123
2106
|
setMouseControl(false);
|
|
2124
2107
|
}
|
|
2125
|
-
},
|
|
2108
|
+
}, listenerElement);
|
|
2126
2109
|
useKeyDownAction('ArrowDown', () => {
|
|
2127
2110
|
if (values.length) {
|
|
2128
2111
|
changeFocusedValueIndex(1);
|
|
2129
2112
|
setMouseControl(false);
|
|
2130
2113
|
}
|
|
2131
|
-
},
|
|
2114
|
+
}, listenerElement);
|
|
2132
2115
|
useKeyDownAction('Enter', () => {
|
|
2133
2116
|
if (focusedItem) {
|
|
2134
2117
|
onValueSelected(focusedItem);
|
|
2135
2118
|
}
|
|
2136
|
-
},
|
|
2119
|
+
}, listenerElement);
|
|
2137
2120
|
hooks.useEffect(() => {
|
|
2138
2121
|
const individualEntries = dropdownContainer.current.children;
|
|
2139
2122
|
if (individualEntries.length && !mouseControl) {
|
|
@@ -2161,21 +2144,19 @@ function DropdownList(props) {
|
|
|
2161
2144
|
ref: dropdownContainer,
|
|
2162
2145
|
tabIndex: -1,
|
|
2163
2146
|
class: "fjs-dropdownlist",
|
|
2147
|
+
onMouseDown: e => e.preventDefault(),
|
|
2164
2148
|
style: {
|
|
2165
2149
|
maxHeight: height,
|
|
2166
2150
|
scrollBehavior: smoothScrolling ? 'smooth' : 'auto'
|
|
2167
2151
|
},
|
|
2168
2152
|
children: [values.length > 0 && values.map((v, i) => {
|
|
2169
2153
|
return jsxRuntime.jsx("div", {
|
|
2170
|
-
class:
|
|
2154
|
+
class: classNames('fjs-dropdownlist-item', {
|
|
2171
2155
|
'focused': focusedValueIndex === i
|
|
2172
2156
|
}),
|
|
2173
2157
|
onMouseMove: mouseControl ? undefined : e => onMouseMovedInKeyboardMode(e, i),
|
|
2174
2158
|
onMouseEnter: mouseControl ? () => setFocusedValueIndex(i) : undefined,
|
|
2175
|
-
onMouseDown: e =>
|
|
2176
|
-
e.preventDefault();
|
|
2177
|
-
onValueSelected(v);
|
|
2178
|
-
},
|
|
2159
|
+
onMouseDown: e => onValueSelected(v),
|
|
2179
2160
|
children: getLabel(v)
|
|
2180
2161
|
});
|
|
2181
2162
|
}), !values.length && jsxRuntime.jsx("div", {
|
|
@@ -2308,7 +2289,7 @@ function Timepicker(props) {
|
|
|
2308
2289
|
value: rawValue,
|
|
2309
2290
|
disabled: disabled,
|
|
2310
2291
|
placeholder: use24h ? 'hh:mm' : 'hh:mm ?m',
|
|
2311
|
-
autoComplete: "
|
|
2292
|
+
autoComplete: "off",
|
|
2312
2293
|
onFocus: () => useDropdown && setDropdownIsOpen(true),
|
|
2313
2294
|
onClick: () => useDropdown && setDropdownIsOpen(true)
|
|
2314
2295
|
|
|
@@ -2359,7 +2340,7 @@ function Datetime(props) {
|
|
|
2359
2340
|
} = validate;
|
|
2360
2341
|
const {
|
|
2361
2342
|
formId
|
|
2362
|
-
} = hooks.useContext(FormContext);
|
|
2343
|
+
} = hooks.useContext(FormContext$1);
|
|
2363
2344
|
const getNullDateTime = () => ({
|
|
2364
2345
|
date: new Date(Date.parse(null)),
|
|
2365
2346
|
time: null
|
|
@@ -2375,31 +2356,29 @@ function Datetime(props) {
|
|
|
2375
2356
|
date,
|
|
2376
2357
|
time
|
|
2377
2358
|
} = getNullDateTime();
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2359
|
+
switch (subtype) {
|
|
2360
|
+
case DATETIME_SUBTYPES.DATE:
|
|
2361
|
+
{
|
|
2362
|
+
date = new Date(Date.parse(value));
|
|
2363
|
+
break;
|
|
2364
|
+
}
|
|
2365
|
+
case DATETIME_SUBTYPES.TIME:
|
|
2366
|
+
{
|
|
2367
|
+
time = parseIsoTime(value);
|
|
2368
|
+
break;
|
|
2369
|
+
}
|
|
2370
|
+
case DATETIME_SUBTYPES.DATETIME:
|
|
2371
|
+
{
|
|
2372
|
+
date = new Date(Date.parse(value));
|
|
2373
|
+
time = isValidDate(date) ? 60 * date.getHours() + date.getMinutes() : null;
|
|
2374
|
+
break;
|
|
2375
|
+
}
|
|
2397
2376
|
}
|
|
2398
2377
|
setDateTime({
|
|
2399
2378
|
date,
|
|
2400
2379
|
time
|
|
2401
2380
|
});
|
|
2402
|
-
}, [subtype, value
|
|
2381
|
+
}, [subtype, value]);
|
|
2403
2382
|
const computeAndSetState = hooks.useCallback(({
|
|
2404
2383
|
date,
|
|
2405
2384
|
time
|
|
@@ -2487,7 +2466,7 @@ function Datetime(props) {
|
|
|
2487
2466
|
disabled
|
|
2488
2467
|
}),
|
|
2489
2468
|
children: [jsxRuntime.jsxs("div", {
|
|
2490
|
-
class:
|
|
2469
|
+
class: classNames('fjs-vertical-group'),
|
|
2491
2470
|
children: [useDatePicker && jsxRuntime.jsx(Datepicker, {
|
|
2492
2471
|
...datePickerProps
|
|
2493
2472
|
}), useTimePicker && useDatePicker && jsxRuntime.jsx("div", {
|
|
@@ -2502,12 +2481,12 @@ function Datetime(props) {
|
|
|
2502
2481
|
})]
|
|
2503
2482
|
});
|
|
2504
2483
|
}
|
|
2505
|
-
Datetime.create =
|
|
2506
|
-
const
|
|
2507
|
-
minDash.set(
|
|
2508
|
-
minDash.set(
|
|
2484
|
+
Datetime.create = (options = {}) => {
|
|
2485
|
+
const defaults = {};
|
|
2486
|
+
minDash.set(defaults, DATETIME_SUBTYPE_PATH, DATETIME_SUBTYPES.DATE);
|
|
2487
|
+
minDash.set(defaults, DATE_LABEL_PATH, 'Date');
|
|
2509
2488
|
return {
|
|
2510
|
-
...
|
|
2489
|
+
...defaults,
|
|
2511
2490
|
...options
|
|
2512
2491
|
};
|
|
2513
2492
|
};
|
|
@@ -2515,11 +2494,13 @@ Datetime.type = type$8;
|
|
|
2515
2494
|
Datetime.keyed = true;
|
|
2516
2495
|
Datetime.emptyValue = null;
|
|
2517
2496
|
Datetime.sanitizeValue = sanitizeDateTimePickerValue;
|
|
2497
|
+
Datetime.label = 'Date time';
|
|
2498
|
+
Datetime.group = 'basic-input';
|
|
2518
2499
|
|
|
2519
|
-
/**
|
|
2520
|
-
* This file must not be changed or exchanged.
|
|
2521
|
-
*
|
|
2522
|
-
* @see http://bpmn.io/license for more information.
|
|
2500
|
+
/**
|
|
2501
|
+
* This file must not be changed or exchanged.
|
|
2502
|
+
*
|
|
2503
|
+
* @see http://bpmn.io/license for more information.
|
|
2523
2504
|
*/
|
|
2524
2505
|
function Logo() {
|
|
2525
2506
|
return jsxRuntime.jsxs("svg", {
|
|
@@ -2636,10 +2617,10 @@ function FormComponent(props) {
|
|
|
2636
2617
|
});
|
|
2637
2618
|
}
|
|
2638
2619
|
|
|
2639
|
-
/**
|
|
2640
|
-
*
|
|
2641
|
-
* @param {string | undefined} expression
|
|
2642
|
-
* @param {import('../../types').Data} data
|
|
2620
|
+
/**
|
|
2621
|
+
*
|
|
2622
|
+
* @param {string | undefined} expression
|
|
2623
|
+
* @param {import('../../types').Data} data
|
|
2643
2624
|
*/
|
|
2644
2625
|
function useEvaluation(expression, data) {
|
|
2645
2626
|
const initialData = useService('form')._getState().initialData;
|
|
@@ -2656,9 +2637,9 @@ function useEvaluation(expression, data) {
|
|
|
2656
2637
|
return conditionChecker.evaluate(expression, filteredData);
|
|
2657
2638
|
}
|
|
2658
2639
|
|
|
2659
|
-
/**
|
|
2660
|
-
*
|
|
2661
|
-
* @param {string} value
|
|
2640
|
+
/**
|
|
2641
|
+
*
|
|
2642
|
+
* @param {string} value
|
|
2662
2643
|
*/
|
|
2663
2644
|
function useExpressionValue(value) {
|
|
2664
2645
|
const formData = useService('form')._getState().data;
|
|
@@ -2678,11 +2659,11 @@ function isExpression(value) {
|
|
|
2678
2659
|
return minDash.isString(value) && value.startsWith('=');
|
|
2679
2660
|
}
|
|
2680
2661
|
|
|
2681
|
-
function _extends$
|
|
2662
|
+
function _extends$h() { _extends$h = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$h.apply(this, arguments); }
|
|
2682
2663
|
var ImagePlaceholder = (({
|
|
2683
2664
|
styles = {},
|
|
2684
2665
|
...props
|
|
2685
|
-
}) => /*#__PURE__*/
|
|
2666
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$h({
|
|
2686
2667
|
width: "64",
|
|
2687
2668
|
height: "64",
|
|
2688
2669
|
viewBox: "0 0 1280 1280",
|
|
@@ -2691,16 +2672,16 @@ var ImagePlaceholder = (({
|
|
|
2691
2672
|
clipRule: "evenodd",
|
|
2692
2673
|
strokeLinejoin: "round",
|
|
2693
2674
|
strokeMiterlimit: "2"
|
|
2694
|
-
}, props), /*#__PURE__*/
|
|
2675
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
2695
2676
|
fill: "#e5e9ed",
|
|
2696
2677
|
d: "M0 0h1280v1280H0z"
|
|
2697
|
-
}), /*#__PURE__*/
|
|
2678
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
2698
2679
|
d: "M910 410H370v470h540V410zm-57.333 57.333v355.334H427.333V467.333h425.334z",
|
|
2699
2680
|
fill: "#cad3db"
|
|
2700
|
-
}), /*#__PURE__*/
|
|
2681
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
2701
2682
|
d: "M810 770H480v-60l100-170 130 170 100-65v125z",
|
|
2702
2683
|
fill: "#cad3db"
|
|
2703
|
-
}), /*#__PURE__*/
|
|
2684
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
2704
2685
|
cx: "750",
|
|
2705
2686
|
cy: "550",
|
|
2706
2687
|
r: "50",
|
|
@@ -2722,7 +2703,7 @@ function Image(props) {
|
|
|
2722
2703
|
const altText = useExpressionValue(alt);
|
|
2723
2704
|
const {
|
|
2724
2705
|
formId
|
|
2725
|
-
} = hooks.useContext(FormContext);
|
|
2706
|
+
} = hooks.useContext(FormContext$1);
|
|
2726
2707
|
return jsxRuntime.jsx("div", {
|
|
2727
2708
|
class: formFieldClasses(type$7),
|
|
2728
2709
|
children: jsxRuntime.jsxs("div", {
|
|
@@ -2741,13 +2722,47 @@ function Image(props) {
|
|
|
2741
2722
|
})
|
|
2742
2723
|
});
|
|
2743
2724
|
}
|
|
2744
|
-
Image.create =
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
};
|
|
2748
|
-
};
|
|
2725
|
+
Image.create = (options = {}) => ({
|
|
2726
|
+
...options
|
|
2727
|
+
});
|
|
2749
2728
|
Image.type = type$7;
|
|
2750
2729
|
Image.keyed = false;
|
|
2730
|
+
Image.label = 'Image view';
|
|
2731
|
+
Image.group = 'presentation';
|
|
2732
|
+
|
|
2733
|
+
function _extends$g() { _extends$g = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$g.apply(this, arguments); }
|
|
2734
|
+
var AngelDownIcon = (({
|
|
2735
|
+
styles = {},
|
|
2736
|
+
...props
|
|
2737
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$g({
|
|
2738
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2739
|
+
width: "8",
|
|
2740
|
+
height: "8"
|
|
2741
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
2742
|
+
fillRule: "evenodd",
|
|
2743
|
+
clipRule: "evenodd",
|
|
2744
|
+
fill: "currentColor",
|
|
2745
|
+
stroke: "currentColor",
|
|
2746
|
+
strokeWidth: ".5",
|
|
2747
|
+
d: "M7.75 1.336L4 6.125.258 1.335 0 1.54l4 5.125L8 1.54zm0 0"
|
|
2748
|
+
})));
|
|
2749
|
+
|
|
2750
|
+
function _extends$f() { _extends$f = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$f.apply(this, arguments); }
|
|
2751
|
+
var AngelUpIcon = (({
|
|
2752
|
+
styles = {},
|
|
2753
|
+
...props
|
|
2754
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$f({
|
|
2755
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2756
|
+
width: "8",
|
|
2757
|
+
height: "8"
|
|
2758
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
2759
|
+
fillRule: "evenodd",
|
|
2760
|
+
clipRule: "evenodd",
|
|
2761
|
+
fill: "currentColor",
|
|
2762
|
+
stroke: "currentColor",
|
|
2763
|
+
strokeWidth: ".5",
|
|
2764
|
+
d: "M7.75 6.664L4 1.875.258 6.665 0 6.46l4-5.125L8 6.46zm0 0"
|
|
2765
|
+
})));
|
|
2751
2766
|
|
|
2752
2767
|
const type$6 = 'number';
|
|
2753
2768
|
function Numberfield(props) {
|
|
@@ -2789,12 +2804,13 @@ function Numberfield(props) {
|
|
|
2789
2804
|
}), [stringValueCache, value, field]);
|
|
2790
2805
|
const displayValue = hooks.useMemo(() => {
|
|
2791
2806
|
if (value === 'NaN') return 'NaN';
|
|
2792
|
-
|
|
2807
|
+
if (stringValueCache === '-') return '-';
|
|
2808
|
+
return cacheValueMatchesState ? stringValueCache : value || value === 0 ? Big(value).toFixed() : '';
|
|
2793
2809
|
}, [stringValueCache, value, cacheValueMatchesState]);
|
|
2794
2810
|
const arrowIncrementValue = hooks.useMemo(() => {
|
|
2795
|
-
if (incrementValue) return
|
|
2796
|
-
if (decimalDigits) return
|
|
2797
|
-
return
|
|
2811
|
+
if (incrementValue) return Big(incrementValue);
|
|
2812
|
+
if (decimalDigits) return Big(`1e-${decimalDigits}`);
|
|
2813
|
+
return Big('1');
|
|
2798
2814
|
}, [decimalDigits, incrementValue]);
|
|
2799
2815
|
const setValue = hooks.useCallback(stringValue => {
|
|
2800
2816
|
if (isNullEquivalentValue(stringValue)) {
|
|
@@ -2808,6 +2824,10 @@ function Numberfield(props) {
|
|
|
2808
2824
|
|
|
2809
2825
|
// treat commas as dots
|
|
2810
2826
|
stringValue = stringValue.replaceAll(',', '.');
|
|
2827
|
+
if (stringValue === '-') {
|
|
2828
|
+
setStringValueCache('-');
|
|
2829
|
+
return;
|
|
2830
|
+
}
|
|
2811
2831
|
if (isNaN(Number(stringValue))) {
|
|
2812
2832
|
setStringValueCache('NaN');
|
|
2813
2833
|
onChange({
|
|
@@ -2823,14 +2843,14 @@ function Numberfield(props) {
|
|
|
2823
2843
|
});
|
|
2824
2844
|
}, [field, onChange, serializeToString]);
|
|
2825
2845
|
const increment = () => {
|
|
2826
|
-
const base = isValidNumber(value) ?
|
|
2846
|
+
const base = isValidNumber(value) ? Big(value) : Big(0);
|
|
2827
2847
|
const stepFlooredValue = base.minus(base.mod(arrowIncrementValue));
|
|
2828
2848
|
|
|
2829
2849
|
// note: toFixed() behaves differently in big.js
|
|
2830
2850
|
setValue(stepFlooredValue.plus(arrowIncrementValue).toFixed());
|
|
2831
2851
|
};
|
|
2832
2852
|
const decrement = () => {
|
|
2833
|
-
const base = isValidNumber(value) ?
|
|
2853
|
+
const base = isValidNumber(value) ? Big(value) : Big(0);
|
|
2834
2854
|
const offset = base.mod(arrowIncrementValue);
|
|
2835
2855
|
if (offset.cmp(0) === 0) {
|
|
2836
2856
|
// if we're already on a valid step, decrement
|
|
@@ -2871,7 +2891,7 @@ function Numberfield(props) {
|
|
|
2871
2891
|
};
|
|
2872
2892
|
const {
|
|
2873
2893
|
formId
|
|
2874
|
-
} = hooks.useContext(FormContext);
|
|
2894
|
+
} = hooks.useContext(FormContext$1);
|
|
2875
2895
|
return jsxRuntime.jsxs("div", {
|
|
2876
2896
|
class: formFieldClasses(type$6, {
|
|
2877
2897
|
errors,
|
|
@@ -2886,8 +2906,8 @@ function Numberfield(props) {
|
|
|
2886
2906
|
pre: prefixAdorner,
|
|
2887
2907
|
post: suffixAdorner,
|
|
2888
2908
|
children: jsxRuntime.jsxs("div", {
|
|
2889
|
-
class:
|
|
2890
|
-
'disabled': disabled
|
|
2909
|
+
class: classNames('fjs-vertical-group', {
|
|
2910
|
+
'fjs-disabled': disabled
|
|
2891
2911
|
}, {
|
|
2892
2912
|
'hasErrors': errors.length
|
|
2893
2913
|
}),
|
|
@@ -2907,23 +2927,25 @@ function Numberfield(props) {
|
|
|
2907
2927
|
step: arrowIncrementValue,
|
|
2908
2928
|
value: displayValue
|
|
2909
2929
|
}), jsxRuntime.jsxs("div", {
|
|
2910
|
-
class:
|
|
2911
|
-
'disabled': disabled
|
|
2930
|
+
class: classNames('fjs-number-arrow-container', {
|
|
2931
|
+
'fjs-disabled': disabled
|
|
2912
2932
|
}),
|
|
2913
2933
|
children: [jsxRuntime.jsx("button", {
|
|
2914
2934
|
class: "fjs-number-arrow-up",
|
|
2915
2935
|
type: "button",
|
|
2936
|
+
"aria-label": "Increment",
|
|
2916
2937
|
onClick: () => increment(),
|
|
2917
2938
|
tabIndex: -1,
|
|
2918
|
-
children:
|
|
2939
|
+
children: jsxRuntime.jsx(AngelUpIcon, {})
|
|
2919
2940
|
}), jsxRuntime.jsx("div", {
|
|
2920
2941
|
class: "fjs-number-arrow-separator"
|
|
2921
2942
|
}), jsxRuntime.jsx("button", {
|
|
2922
2943
|
class: "fjs-number-arrow-down",
|
|
2923
2944
|
type: "button",
|
|
2945
|
+
"aria-label": "Decrement",
|
|
2924
2946
|
onClick: () => decrement(),
|
|
2925
2947
|
tabIndex: -1,
|
|
2926
|
-
children:
|
|
2948
|
+
children: jsxRuntime.jsx(AngelDownIcon, {})
|
|
2927
2949
|
})]
|
|
2928
2950
|
})]
|
|
2929
2951
|
})
|
|
@@ -2934,7 +2956,9 @@ function Numberfield(props) {
|
|
|
2934
2956
|
})]
|
|
2935
2957
|
});
|
|
2936
2958
|
}
|
|
2937
|
-
Numberfield.create = (options = {}) =>
|
|
2959
|
+
Numberfield.create = (options = {}) => ({
|
|
2960
|
+
...options
|
|
2961
|
+
});
|
|
2938
2962
|
Numberfield.sanitizeValue = ({
|
|
2939
2963
|
value,
|
|
2940
2964
|
formField
|
|
@@ -2952,6 +2976,7 @@ Numberfield.type = type$6;
|
|
|
2952
2976
|
Numberfield.keyed = true;
|
|
2953
2977
|
Numberfield.label = 'Number';
|
|
2954
2978
|
Numberfield.emptyValue = null;
|
|
2979
|
+
Numberfield.group = 'basic-input';
|
|
2955
2980
|
|
|
2956
2981
|
const type$5 = 'radio';
|
|
2957
2982
|
function Radio(props) {
|
|
@@ -2982,7 +3007,7 @@ function Radio(props) {
|
|
|
2982
3007
|
} = useValuesAsync(field);
|
|
2983
3008
|
const {
|
|
2984
3009
|
formId
|
|
2985
|
-
} = hooks.useContext(FormContext);
|
|
3010
|
+
} = hooks.useContext(FormContext$1);
|
|
2986
3011
|
return jsxRuntime.jsxs("div", {
|
|
2987
3012
|
class: formFieldClasses(type$5, {
|
|
2988
3013
|
errors,
|
|
@@ -2995,7 +3020,7 @@ function Radio(props) {
|
|
|
2995
3020
|
return jsxRuntime.jsx(Label, {
|
|
2996
3021
|
id: prefixId(`${id}-${index}`, formId),
|
|
2997
3022
|
label: option.label,
|
|
2998
|
-
class:
|
|
3023
|
+
class: classNames({
|
|
2999
3024
|
'fjs-checked': option.value === value
|
|
3000
3025
|
}),
|
|
3001
3026
|
required: false,
|
|
@@ -3016,12 +3041,17 @@ function Radio(props) {
|
|
|
3016
3041
|
});
|
|
3017
3042
|
}
|
|
3018
3043
|
Radio.create = function (options = {}) {
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3044
|
+
const defaults = {};
|
|
3045
|
+
|
|
3046
|
+
// provide default values if valuesKey isn't set
|
|
3047
|
+
if (!options.valuesKey) {
|
|
3048
|
+
defaults.values = [{
|
|
3022
3049
|
label: 'Value',
|
|
3023
3050
|
value: 'value'
|
|
3024
|
-
}]
|
|
3051
|
+
}];
|
|
3052
|
+
}
|
|
3053
|
+
return {
|
|
3054
|
+
...defaults,
|
|
3025
3055
|
...options
|
|
3026
3056
|
};
|
|
3027
3057
|
};
|
|
@@ -3030,121 +3060,39 @@ Radio.label = 'Radio';
|
|
|
3030
3060
|
Radio.keyed = true;
|
|
3031
3061
|
Radio.emptyValue = null;
|
|
3032
3062
|
Radio.sanitizeValue = sanitizeSingleSelectValue;
|
|
3033
|
-
|
|
3034
|
-
const type$4 = 'select';
|
|
3035
|
-
function Select(props) {
|
|
3036
|
-
const {
|
|
3037
|
-
disabled,
|
|
3038
|
-
errors = [],
|
|
3039
|
-
field,
|
|
3040
|
-
value
|
|
3041
|
-
} = props;
|
|
3042
|
-
const {
|
|
3043
|
-
description,
|
|
3044
|
-
id,
|
|
3045
|
-
label,
|
|
3046
|
-
validate = {}
|
|
3047
|
-
} = field;
|
|
3048
|
-
const {
|
|
3049
|
-
required
|
|
3050
|
-
} = validate;
|
|
3051
|
-
const onChange = ({
|
|
3052
|
-
target
|
|
3053
|
-
}) => {
|
|
3054
|
-
props.onChange({
|
|
3055
|
-
field,
|
|
3056
|
-
value: target.value === '' ? null : target.value
|
|
3057
|
-
});
|
|
3058
|
-
};
|
|
3059
|
-
const {
|
|
3060
|
-
state: loadState,
|
|
3061
|
-
values: options
|
|
3062
|
-
} = useValuesAsync(field);
|
|
3063
|
-
const {
|
|
3064
|
-
formId
|
|
3065
|
-
} = hooks.useContext(FormContext);
|
|
3066
|
-
return jsxRuntime.jsxs("div", {
|
|
3067
|
-
class: formFieldClasses(type$4, {
|
|
3068
|
-
errors,
|
|
3069
|
-
disabled
|
|
3070
|
-
}),
|
|
3071
|
-
children: [jsxRuntime.jsx(Label, {
|
|
3072
|
-
id: prefixId(id, formId),
|
|
3073
|
-
label: label,
|
|
3074
|
-
required: required
|
|
3075
|
-
}), jsxRuntime.jsxs("select", {
|
|
3076
|
-
class: "fjs-select",
|
|
3077
|
-
disabled: disabled,
|
|
3078
|
-
id: prefixId(id, formId),
|
|
3079
|
-
onChange: onChange,
|
|
3080
|
-
value: value || '',
|
|
3081
|
-
children: [jsxRuntime.jsx("option", {
|
|
3082
|
-
value: ""
|
|
3083
|
-
}), loadState == LOAD_STATES.LOADED && options.map((option, index) => {
|
|
3084
|
-
return jsxRuntime.jsx("option", {
|
|
3085
|
-
value: option.value,
|
|
3086
|
-
children: option.label
|
|
3087
|
-
}, `${id}-${index}`);
|
|
3088
|
-
})]
|
|
3089
|
-
}), jsxRuntime.jsx(Description, {
|
|
3090
|
-
description: description
|
|
3091
|
-
}), jsxRuntime.jsx(Errors, {
|
|
3092
|
-
errors: errors
|
|
3093
|
-
})]
|
|
3094
|
-
});
|
|
3095
|
-
}
|
|
3096
|
-
Select.create = function (options = {}) {
|
|
3097
|
-
if (options.valuesKey) return options;
|
|
3098
|
-
return {
|
|
3099
|
-
values: [{
|
|
3100
|
-
label: 'Value',
|
|
3101
|
-
value: 'value'
|
|
3102
|
-
}],
|
|
3103
|
-
...options
|
|
3104
|
-
};
|
|
3105
|
-
};
|
|
3106
|
-
Select.type = type$4;
|
|
3107
|
-
Select.label = 'Select';
|
|
3108
|
-
Select.keyed = true;
|
|
3109
|
-
Select.emptyValue = null;
|
|
3110
|
-
Select.sanitizeValue = sanitizeSingleSelectValue;
|
|
3063
|
+
Radio.group = 'selection';
|
|
3111
3064
|
|
|
3112
3065
|
function _extends$e() { _extends$e = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$e.apply(this, arguments); }
|
|
3113
|
-
var
|
|
3066
|
+
var XMarkIcon = (({
|
|
3114
3067
|
styles = {},
|
|
3115
3068
|
...props
|
|
3116
|
-
}) => /*#__PURE__*/
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3069
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$e({
|
|
3070
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3071
|
+
width: "8",
|
|
3072
|
+
height: "8"
|
|
3073
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3122
3074
|
fillRule: "evenodd",
|
|
3123
3075
|
clipRule: "evenodd",
|
|
3124
|
-
|
|
3125
|
-
|
|
3076
|
+
fill: "currentColor",
|
|
3077
|
+
stroke: "currentColor",
|
|
3078
|
+
strokeWidth: ".5",
|
|
3079
|
+
d: "M4 3.766L7.43.336l.234.234L4.234 4l3.43 3.43-.234.234L4 4.234.57 7.664.336 7.43 3.766 4 .336.57.57.336zm0 0"
|
|
3126
3080
|
})));
|
|
3127
3081
|
|
|
3128
|
-
|
|
3129
|
-
function Taglist(props) {
|
|
3082
|
+
function SearchableSelect(props) {
|
|
3130
3083
|
const {
|
|
3084
|
+
id,
|
|
3131
3085
|
disabled,
|
|
3132
|
-
errors
|
|
3086
|
+
errors,
|
|
3133
3087
|
field,
|
|
3134
|
-
value
|
|
3088
|
+
value
|
|
3135
3089
|
} = props;
|
|
3136
|
-
const {
|
|
3137
|
-
description,
|
|
3138
|
-
id,
|
|
3139
|
-
label
|
|
3140
|
-
} = field;
|
|
3141
3090
|
const {
|
|
3142
3091
|
formId
|
|
3143
|
-
} = hooks.useContext(FormContext);
|
|
3092
|
+
} = hooks.useContext(FormContext$1);
|
|
3144
3093
|
const [filter, setFilter] = hooks.useState('');
|
|
3145
|
-
const [filteredOptions, setFilteredOptions] = hooks.useState([]);
|
|
3146
3094
|
const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
|
|
3147
|
-
const [
|
|
3095
|
+
const [shouldApplyFilter, setShouldApplyFilter] = hooks.useState(true);
|
|
3148
3096
|
const [isEscapeClosed, setIsEscapeClose] = hooks.useState(false);
|
|
3149
3097
|
const searchbarRef = hooks.useRef();
|
|
3150
3098
|
const {
|
|
@@ -3156,15 +3104,335 @@ function Taglist(props) {
|
|
|
3156
3104
|
const valueToOptionMap = hooks.useMemo(() => Object.assign({}, ...options.map((o, x) => ({
|
|
3157
3105
|
[o.value]: options[x]
|
|
3158
3106
|
}))), [options]);
|
|
3107
|
+
const valueLabel = hooks.useMemo(() => value && valueToOptionMap[value] && valueToOptionMap[value].label || '', [value, valueToOptionMap]);
|
|
3159
3108
|
|
|
3160
|
-
//
|
|
3109
|
+
// whenever we change the underlying value, set the label to it
|
|
3161
3110
|
hooks.useEffect(() => {
|
|
3111
|
+
setFilter(valueLabel);
|
|
3112
|
+
}, [valueLabel]);
|
|
3113
|
+
const filteredOptions = hooks.useMemo(() => {
|
|
3162
3114
|
if (loadState === LOAD_STATES.LOADED) {
|
|
3163
|
-
|
|
3164
|
-
} else {
|
|
3165
|
-
setFilteredOptions([]);
|
|
3115
|
+
return shouldApplyFilter ? options.filter(o => o.label && o.value && o.label.toLowerCase().includes(filter.toLowerCase())) : options;
|
|
3166
3116
|
}
|
|
3167
|
-
|
|
3117
|
+
return [];
|
|
3118
|
+
}, [filter, loadState, options, shouldApplyFilter]);
|
|
3119
|
+
const onChange = ({
|
|
3120
|
+
target
|
|
3121
|
+
}) => {
|
|
3122
|
+
setIsEscapeClose(false);
|
|
3123
|
+
setIsDropdownExpanded(true);
|
|
3124
|
+
setShouldApplyFilter(true);
|
|
3125
|
+
setFilter(target.value || '');
|
|
3126
|
+
};
|
|
3127
|
+
const setValue = hooks.useCallback(option => {
|
|
3128
|
+
setFilter(option && option.label || '');
|
|
3129
|
+
props.onChange({
|
|
3130
|
+
value: option && option.value || null,
|
|
3131
|
+
field
|
|
3132
|
+
});
|
|
3133
|
+
}, [field, props]);
|
|
3134
|
+
const onInputKeyDown = hooks.useCallback(keyDownEvent => {
|
|
3135
|
+
switch (keyDownEvent.key) {
|
|
3136
|
+
case 'ArrowUp':
|
|
3137
|
+
keyDownEvent.preventDefault();
|
|
3138
|
+
break;
|
|
3139
|
+
case 'ArrowDown':
|
|
3140
|
+
{
|
|
3141
|
+
if (!isDropdownExpanded) {
|
|
3142
|
+
setIsDropdownExpanded(true);
|
|
3143
|
+
setShouldApplyFilter(false);
|
|
3144
|
+
}
|
|
3145
|
+
keyDownEvent.preventDefault();
|
|
3146
|
+
break;
|
|
3147
|
+
}
|
|
3148
|
+
case 'Escape':
|
|
3149
|
+
setIsEscapeClose(true);
|
|
3150
|
+
break;
|
|
3151
|
+
case 'Enter':
|
|
3152
|
+
if (isEscapeClosed) {
|
|
3153
|
+
setIsEscapeClose(false);
|
|
3154
|
+
}
|
|
3155
|
+
break;
|
|
3156
|
+
}
|
|
3157
|
+
}, [isDropdownExpanded, isEscapeClosed]);
|
|
3158
|
+
const displayState = hooks.useMemo(() => {
|
|
3159
|
+
const ds = {};
|
|
3160
|
+
ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
|
|
3161
|
+
ds.displayCross = ds.componentReady && value !== null && value !== undefined;
|
|
3162
|
+
ds.displayDropdown = !disabled && isDropdownExpanded && !isEscapeClosed;
|
|
3163
|
+
return ds;
|
|
3164
|
+
}, [disabled, isDropdownExpanded, isEscapeClosed, loadState, value]);
|
|
3165
|
+
const onAngelMouseDown = hooks.useCallback(e => {
|
|
3166
|
+
setIsEscapeClose(false);
|
|
3167
|
+
setIsDropdownExpanded(!isDropdownExpanded);
|
|
3168
|
+
const searchbar = searchbarRef.current;
|
|
3169
|
+
isDropdownExpanded ? searchbar.blur() : searchbar.focus();
|
|
3170
|
+
e.preventDefault();
|
|
3171
|
+
}, [isDropdownExpanded]);
|
|
3172
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3173
|
+
children: [jsxRuntime.jsxs("div", {
|
|
3174
|
+
id: prefixId(`${id}`, formId),
|
|
3175
|
+
class: classNames('fjs-input-group', {
|
|
3176
|
+
'disabled': disabled
|
|
3177
|
+
}, {
|
|
3178
|
+
'hasErrors': errors.length
|
|
3179
|
+
}),
|
|
3180
|
+
children: [jsxRuntime.jsx("input", {
|
|
3181
|
+
disabled: disabled,
|
|
3182
|
+
class: "fjs-input",
|
|
3183
|
+
ref: searchbarRef,
|
|
3184
|
+
id: prefixId(`${id}-search`, formId),
|
|
3185
|
+
onChange: onChange,
|
|
3186
|
+
type: "text",
|
|
3187
|
+
value: filter,
|
|
3188
|
+
placeholder: 'Search',
|
|
3189
|
+
autoComplete: "off",
|
|
3190
|
+
onKeyDown: e => onInputKeyDown(e),
|
|
3191
|
+
onMouseDown: () => {
|
|
3192
|
+
setIsEscapeClose(false);
|
|
3193
|
+
setIsDropdownExpanded(true);
|
|
3194
|
+
setShouldApplyFilter(false);
|
|
3195
|
+
},
|
|
3196
|
+
onFocus: () => {
|
|
3197
|
+
setIsDropdownExpanded(true);
|
|
3198
|
+
setShouldApplyFilter(false);
|
|
3199
|
+
},
|
|
3200
|
+
onBlur: () => {
|
|
3201
|
+
setIsDropdownExpanded(false);
|
|
3202
|
+
setFilter(valueLabel);
|
|
3203
|
+
}
|
|
3204
|
+
}), displayState.displayCross && jsxRuntime.jsxs("span", {
|
|
3205
|
+
class: "fjs-select-cross",
|
|
3206
|
+
onMouseDown: e => {
|
|
3207
|
+
setValue(null);
|
|
3208
|
+
e.preventDefault();
|
|
3209
|
+
},
|
|
3210
|
+
children: [jsxRuntime.jsx(XMarkIcon, {}), " "]
|
|
3211
|
+
}), jsxRuntime.jsx("span", {
|
|
3212
|
+
class: "fjs-select-arrow",
|
|
3213
|
+
onMouseDown: e => onAngelMouseDown(e),
|
|
3214
|
+
children: displayState.displayDropdown ? jsxRuntime.jsx(AngelUpIcon, {}) : jsxRuntime.jsx(AngelDownIcon, {})
|
|
3215
|
+
})]
|
|
3216
|
+
}), jsxRuntime.jsx("div", {
|
|
3217
|
+
class: "fjs-select-anchor",
|
|
3218
|
+
children: displayState.displayDropdown && jsxRuntime.jsx(DropdownList, {
|
|
3219
|
+
values: filteredOptions,
|
|
3220
|
+
getLabel: o => o.label,
|
|
3221
|
+
onValueSelected: o => {
|
|
3222
|
+
setValue(o);
|
|
3223
|
+
setIsDropdownExpanded(false);
|
|
3224
|
+
},
|
|
3225
|
+
listenerElement: searchbarRef.current
|
|
3226
|
+
})
|
|
3227
|
+
})]
|
|
3228
|
+
});
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
function SimpleSelect(props) {
|
|
3232
|
+
const {
|
|
3233
|
+
id,
|
|
3234
|
+
disabled,
|
|
3235
|
+
errors,
|
|
3236
|
+
field,
|
|
3237
|
+
value
|
|
3238
|
+
} = props;
|
|
3239
|
+
const {
|
|
3240
|
+
formId
|
|
3241
|
+
} = hooks.useContext(FormContext$1);
|
|
3242
|
+
const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
|
|
3243
|
+
const selectRef = hooks.useRef();
|
|
3244
|
+
const {
|
|
3245
|
+
state: loadState,
|
|
3246
|
+
values: options
|
|
3247
|
+
} = useValuesAsync(field);
|
|
3248
|
+
|
|
3249
|
+
// We cache a map of option values to their index so that we don't need to search the whole options array every time to correlate the label
|
|
3250
|
+
const valueToOptionMap = hooks.useMemo(() => Object.assign({}, ...options.map((o, x) => ({
|
|
3251
|
+
[o.value]: options[x]
|
|
3252
|
+
}))), [options]);
|
|
3253
|
+
const valueLabel = hooks.useMemo(() => value && valueToOptionMap[value] && valueToOptionMap[value].label || '', [value, valueToOptionMap]);
|
|
3254
|
+
const setValue = hooks.useCallback(option => {
|
|
3255
|
+
props.onChange({
|
|
3256
|
+
value: option && option.value || null,
|
|
3257
|
+
field
|
|
3258
|
+
});
|
|
3259
|
+
}, [field, props]);
|
|
3260
|
+
const displayState = hooks.useMemo(() => {
|
|
3261
|
+
const ds = {};
|
|
3262
|
+
ds.componentReady = !disabled && loadState === LOAD_STATES.LOADED;
|
|
3263
|
+
ds.displayCross = ds.componentReady && value !== null && value !== undefined;
|
|
3264
|
+
ds.displayDropdown = !disabled && isDropdownExpanded;
|
|
3265
|
+
return ds;
|
|
3266
|
+
}, [disabled, isDropdownExpanded, loadState, value]);
|
|
3267
|
+
const onMouseDown = hooks.useCallback(e => {
|
|
3268
|
+
const select = selectRef.current;
|
|
3269
|
+
setIsDropdownExpanded(!isDropdownExpanded);
|
|
3270
|
+
if (isDropdownExpanded) {
|
|
3271
|
+
select.blur();
|
|
3272
|
+
} else {
|
|
3273
|
+
select.focus();
|
|
3274
|
+
}
|
|
3275
|
+
e.preventDefault();
|
|
3276
|
+
}, [isDropdownExpanded]);
|
|
3277
|
+
const initialFocusIndex = hooks.useMemo(() => value && minDash.findIndex(options, o => o.value === value) || 0, [options, value]);
|
|
3278
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3279
|
+
children: [jsxRuntime.jsxs("div", {
|
|
3280
|
+
ref: selectRef,
|
|
3281
|
+
id: prefixId(`${id}`, formId),
|
|
3282
|
+
class: classNames('fjs-input-group', {
|
|
3283
|
+
'disabled': disabled
|
|
3284
|
+
}, {
|
|
3285
|
+
'hasErrors': errors.length
|
|
3286
|
+
}),
|
|
3287
|
+
onFocus: () => setIsDropdownExpanded(true),
|
|
3288
|
+
onBlur: () => setIsDropdownExpanded(false),
|
|
3289
|
+
onMouseDown: e => onMouseDown(e),
|
|
3290
|
+
tabIndex: disabled ? undefined : 0,
|
|
3291
|
+
children: [jsxRuntime.jsx("div", {
|
|
3292
|
+
class: classNames('fjs-select-display', {
|
|
3293
|
+
'fjs-select-placeholder': !value
|
|
3294
|
+
}),
|
|
3295
|
+
id: prefixId(`${id}-display`, formId),
|
|
3296
|
+
children: valueLabel || 'Select'
|
|
3297
|
+
}), displayState.displayCross && jsxRuntime.jsx("span", {
|
|
3298
|
+
class: "fjs-select-cross",
|
|
3299
|
+
onMouseDown: e => {
|
|
3300
|
+
setValue(null);
|
|
3301
|
+
e.stopPropagation();
|
|
3302
|
+
},
|
|
3303
|
+
children: jsxRuntime.jsx(XMarkIcon, {})
|
|
3304
|
+
}), jsxRuntime.jsx("span", {
|
|
3305
|
+
class: "fjs-select-arrow",
|
|
3306
|
+
children: displayState.displayDropdown ? jsxRuntime.jsx(AngelUpIcon, {}) : jsxRuntime.jsx(AngelDownIcon, {})
|
|
3307
|
+
})]
|
|
3308
|
+
}), jsxRuntime.jsx("div", {
|
|
3309
|
+
class: "fjs-select-anchor",
|
|
3310
|
+
children: displayState.displayDropdown && jsxRuntime.jsx(DropdownList, {
|
|
3311
|
+
values: options,
|
|
3312
|
+
getLabel: o => o.label,
|
|
3313
|
+
initialFocusIndex: initialFocusIndex,
|
|
3314
|
+
onValueSelected: o => {
|
|
3315
|
+
setValue(o);
|
|
3316
|
+
setIsDropdownExpanded(false);
|
|
3317
|
+
},
|
|
3318
|
+
listenerElement: selectRef.current
|
|
3319
|
+
})
|
|
3320
|
+
})]
|
|
3321
|
+
});
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
const type$4 = 'select';
|
|
3325
|
+
function Select(props) {
|
|
3326
|
+
const {
|
|
3327
|
+
disabled,
|
|
3328
|
+
errors = [],
|
|
3329
|
+
field,
|
|
3330
|
+
onChange,
|
|
3331
|
+
value
|
|
3332
|
+
} = props;
|
|
3333
|
+
const {
|
|
3334
|
+
description,
|
|
3335
|
+
id,
|
|
3336
|
+
label,
|
|
3337
|
+
searchable = false,
|
|
3338
|
+
validate = {}
|
|
3339
|
+
} = field;
|
|
3340
|
+
const {
|
|
3341
|
+
required
|
|
3342
|
+
} = validate;
|
|
3343
|
+
const {
|
|
3344
|
+
formId
|
|
3345
|
+
} = hooks.useContext(FormContext$1);
|
|
3346
|
+
const selectProps = hooks.useMemo(() => ({
|
|
3347
|
+
id,
|
|
3348
|
+
disabled,
|
|
3349
|
+
errors,
|
|
3350
|
+
field,
|
|
3351
|
+
value,
|
|
3352
|
+
onChange
|
|
3353
|
+
}), [disabled, errors, field, id, value, onChange]);
|
|
3354
|
+
return jsxRuntime.jsxs("div", {
|
|
3355
|
+
class: formFieldClasses(type$4, {
|
|
3356
|
+
errors,
|
|
3357
|
+
disabled
|
|
3358
|
+
}),
|
|
3359
|
+
children: [jsxRuntime.jsx(Label, {
|
|
3360
|
+
id: prefixId(id, formId),
|
|
3361
|
+
label: label,
|
|
3362
|
+
required: required
|
|
3363
|
+
}), searchable ? jsxRuntime.jsx(SearchableSelect, {
|
|
3364
|
+
...selectProps
|
|
3365
|
+
}) : jsxRuntime.jsx(SimpleSelect, {
|
|
3366
|
+
...selectProps
|
|
3367
|
+
}), jsxRuntime.jsx(Description, {
|
|
3368
|
+
description: description
|
|
3369
|
+
}), jsxRuntime.jsx(Errors, {
|
|
3370
|
+
errors: errors
|
|
3371
|
+
})]
|
|
3372
|
+
});
|
|
3373
|
+
}
|
|
3374
|
+
Select.create = (options = {}) => {
|
|
3375
|
+
const defaults = {};
|
|
3376
|
+
|
|
3377
|
+
// provide default values if valuesKey isn't set
|
|
3378
|
+
if (!options.valuesKey) {
|
|
3379
|
+
defaults.values = [{
|
|
3380
|
+
label: 'Value',
|
|
3381
|
+
value: 'value'
|
|
3382
|
+
}];
|
|
3383
|
+
}
|
|
3384
|
+
return {
|
|
3385
|
+
...defaults,
|
|
3386
|
+
...options
|
|
3387
|
+
};
|
|
3388
|
+
};
|
|
3389
|
+
Select.type = type$4;
|
|
3390
|
+
Select.label = 'Select';
|
|
3391
|
+
Select.keyed = true;
|
|
3392
|
+
Select.emptyValue = null;
|
|
3393
|
+
Select.sanitizeValue = sanitizeSingleSelectValue;
|
|
3394
|
+
Select.group = 'selection';
|
|
3395
|
+
|
|
3396
|
+
const type$3 = 'taglist';
|
|
3397
|
+
function Taglist(props) {
|
|
3398
|
+
const {
|
|
3399
|
+
disabled,
|
|
3400
|
+
errors = [],
|
|
3401
|
+
field,
|
|
3402
|
+
value: values = []
|
|
3403
|
+
} = props;
|
|
3404
|
+
const {
|
|
3405
|
+
description,
|
|
3406
|
+
id,
|
|
3407
|
+
label
|
|
3408
|
+
} = field;
|
|
3409
|
+
const {
|
|
3410
|
+
formId
|
|
3411
|
+
} = hooks.useContext(FormContext$1);
|
|
3412
|
+
const [filter, setFilter] = hooks.useState('');
|
|
3413
|
+
const [filteredOptions, setFilteredOptions] = hooks.useState([]);
|
|
3414
|
+
const [isDropdownExpanded, setIsDropdownExpanded] = hooks.useState(false);
|
|
3415
|
+
const [hasOptionsLeft, setHasOptionsLeft] = hooks.useState(true);
|
|
3416
|
+
const [isEscapeClosed, setIsEscapeClose] = hooks.useState(false);
|
|
3417
|
+
const searchbarRef = hooks.useRef();
|
|
3418
|
+
const {
|
|
3419
|
+
state: loadState,
|
|
3420
|
+
values: options
|
|
3421
|
+
} = useValuesAsync(field);
|
|
3422
|
+
|
|
3423
|
+
// We cache a map of option values to their index so that we don't need to search the whole options array every time to correlate the label
|
|
3424
|
+
const valueToOptionMap = hooks.useMemo(() => Object.assign({}, ...options.map((o, x) => ({
|
|
3425
|
+
[o.value]: options[x]
|
|
3426
|
+
}))), [options]);
|
|
3427
|
+
|
|
3428
|
+
// Usage of stringify is necessary here because we want this effect to only trigger when there is a value change to the array
|
|
3429
|
+
hooks.useEffect(() => {
|
|
3430
|
+
if (loadState === LOAD_STATES.LOADED) {
|
|
3431
|
+
setFilteredOptions(options.filter(o => o.label && o.value && o.label.toLowerCase().includes(filter.toLowerCase()) && !values.includes(o.value)));
|
|
3432
|
+
} else {
|
|
3433
|
+
setFilteredOptions([]);
|
|
3434
|
+
}
|
|
3435
|
+
}, [filter, JSON.stringify(values), options, loadState]);
|
|
3168
3436
|
hooks.useEffect(() => {
|
|
3169
3437
|
setHasOptionsLeft(options.length > values.length);
|
|
3170
3438
|
}, [options.length, values.length]);
|
|
@@ -3228,6 +3496,7 @@ function Taglist(props) {
|
|
|
3228
3496
|
searchbarRef.current.focus();
|
|
3229
3497
|
}
|
|
3230
3498
|
};
|
|
3499
|
+
const shouldDisplayDropdown = hooks.useMemo(() => !disabled && loadState === LOAD_STATES.LOADED && isDropdownExpanded && !isEscapeClosed, [disabled, isDropdownExpanded, isEscapeClosed, loadState]);
|
|
3231
3500
|
return jsxRuntime.jsxs("div", {
|
|
3232
3501
|
class: formFieldClasses(type$3, {
|
|
3233
3502
|
errors,
|
|
@@ -3237,24 +3506,26 @@ function Taglist(props) {
|
|
|
3237
3506
|
label: label,
|
|
3238
3507
|
id: prefixId(`${id}-search`, formId)
|
|
3239
3508
|
}), jsxRuntime.jsxs("div", {
|
|
3240
|
-
class:
|
|
3241
|
-
'disabled': disabled
|
|
3509
|
+
class: classNames('fjs-taglist', {
|
|
3510
|
+
'fjs-disabled': disabled
|
|
3242
3511
|
}),
|
|
3243
|
-
children: [
|
|
3512
|
+
children: [loadState === LOAD_STATES.LOADED && jsxRuntime.jsx("div", {
|
|
3244
3513
|
class: "fjs-taglist-tags",
|
|
3245
3514
|
children: values.map(v => {
|
|
3246
3515
|
return jsxRuntime.jsxs("div", {
|
|
3247
|
-
class:
|
|
3516
|
+
class: classNames('fjs-taglist-tag', {
|
|
3517
|
+
'fjs-disabled': disabled
|
|
3518
|
+
}),
|
|
3248
3519
|
onMouseDown: e => e.preventDefault(),
|
|
3249
3520
|
children: [jsxRuntime.jsx("span", {
|
|
3250
3521
|
class: "fjs-taglist-tag-label",
|
|
3251
3522
|
children: valueToOptionMap[v] ? valueToOptionMap[v].label : `unexpected value{${v}}`
|
|
3252
|
-
}), jsxRuntime.jsx("button", {
|
|
3523
|
+
}), !disabled && jsxRuntime.jsx("button", {
|
|
3253
3524
|
type: "button",
|
|
3254
3525
|
title: "Remove tag",
|
|
3255
3526
|
class: "fjs-taglist-tag-remove",
|
|
3256
3527
|
onClick: event => onTagRemoveClick(event, v),
|
|
3257
|
-
children: jsxRuntime.jsx(
|
|
3528
|
+
children: jsxRuntime.jsx(XMarkIcon, {})
|
|
3258
3529
|
})]
|
|
3259
3530
|
});
|
|
3260
3531
|
})
|
|
@@ -3266,7 +3537,7 @@ function Taglist(props) {
|
|
|
3266
3537
|
onChange: onFilterChange,
|
|
3267
3538
|
type: "text",
|
|
3268
3539
|
value: filter,
|
|
3269
|
-
placeholder: 'Search',
|
|
3540
|
+
placeholder: disabled ? '' : 'Search',
|
|
3270
3541
|
autoComplete: "off",
|
|
3271
3542
|
onKeyDown: e => onInputKeyDown(e),
|
|
3272
3543
|
onMouseDown: () => setIsEscapeClose(false),
|
|
@@ -3278,7 +3549,7 @@ function Taglist(props) {
|
|
|
3278
3549
|
})]
|
|
3279
3550
|
}), jsxRuntime.jsx("div", {
|
|
3280
3551
|
class: "fjs-taglist-anchor",
|
|
3281
|
-
children:
|
|
3552
|
+
children: shouldDisplayDropdown && jsxRuntime.jsx(DropdownList, {
|
|
3282
3553
|
values: filteredOptions,
|
|
3283
3554
|
getLabel: o => o.label,
|
|
3284
3555
|
onValueSelected: o => selectValue(o.value),
|
|
@@ -3292,31 +3563,232 @@ function Taglist(props) {
|
|
|
3292
3563
|
})]
|
|
3293
3564
|
});
|
|
3294
3565
|
}
|
|
3295
|
-
Taglist.create =
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
}
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3566
|
+
Taglist.create = (options = {}) => {
|
|
3567
|
+
const defaults = {};
|
|
3568
|
+
|
|
3569
|
+
// provide default values if valuesKey isn't set
|
|
3570
|
+
if (!options.valuesKey) {
|
|
3571
|
+
defaults.values = [{
|
|
3572
|
+
label: 'Value',
|
|
3573
|
+
value: 'value'
|
|
3574
|
+
}];
|
|
3575
|
+
}
|
|
3576
|
+
return {
|
|
3577
|
+
...defaults,
|
|
3578
|
+
...options
|
|
3579
|
+
};
|
|
3580
|
+
};
|
|
3581
|
+
Taglist.type = type$3;
|
|
3582
|
+
Taglist.label = 'Tag list';
|
|
3583
|
+
Taglist.keyed = true;
|
|
3584
|
+
Taglist.emptyValue = [];
|
|
3585
|
+
Taglist.sanitizeValue = sanitizeMultiSelectValue;
|
|
3586
|
+
Taglist.group = 'selection';
|
|
3587
|
+
|
|
3588
|
+
const type$2 = 'text';
|
|
3589
|
+
function Text(props) {
|
|
3590
|
+
const {
|
|
3591
|
+
field,
|
|
3592
|
+
disableLinks
|
|
3593
|
+
} = props;
|
|
3594
|
+
const {
|
|
3595
|
+
text = ''
|
|
3596
|
+
} = field;
|
|
3597
|
+
const textValue = useExpressionValue(text) || '';
|
|
3598
|
+
const componentOverrides = disableLinks ? {
|
|
3599
|
+
'a': DisabledLink
|
|
3600
|
+
} : {};
|
|
3601
|
+
return jsxRuntime.jsx("div", {
|
|
3602
|
+
class: formFieldClasses(type$2),
|
|
3603
|
+
children: jsxRuntime.jsx(Markup, {
|
|
3604
|
+
markup: safeMarkdown(textValue),
|
|
3605
|
+
components: componentOverrides,
|
|
3606
|
+
trim: false
|
|
3607
|
+
})
|
|
3608
|
+
});
|
|
3609
|
+
}
|
|
3610
|
+
Text.create = (options = {}) => ({
|
|
3611
|
+
text: '# Text',
|
|
3612
|
+
...options
|
|
3613
|
+
});
|
|
3614
|
+
Text.type = type$2;
|
|
3615
|
+
Text.keyed = false;
|
|
3616
|
+
Text.group = 'presentation';
|
|
3617
|
+
Text.label = 'Text view';
|
|
3618
|
+
function DisabledLink({
|
|
3619
|
+
href,
|
|
3620
|
+
children
|
|
3621
|
+
}) {
|
|
3622
|
+
return jsxRuntime.jsx("a", {
|
|
3623
|
+
class: "fjs-disabled-link",
|
|
3624
|
+
href: href,
|
|
3625
|
+
tabIndex: -1,
|
|
3626
|
+
children: children
|
|
3627
|
+
});
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
const type$1 = 'textfield';
|
|
3631
|
+
function Textfield(props) {
|
|
3632
|
+
const {
|
|
3633
|
+
disabled,
|
|
3634
|
+
errors = [],
|
|
3635
|
+
field,
|
|
3636
|
+
value = ''
|
|
3637
|
+
} = props;
|
|
3638
|
+
const {
|
|
3639
|
+
description,
|
|
3640
|
+
id,
|
|
3641
|
+
label,
|
|
3642
|
+
appearance = {},
|
|
3643
|
+
validate = {}
|
|
3644
|
+
} = field;
|
|
3645
|
+
const {
|
|
3646
|
+
prefixAdorner,
|
|
3647
|
+
suffixAdorner
|
|
3648
|
+
} = appearance;
|
|
3649
|
+
const {
|
|
3650
|
+
required
|
|
3651
|
+
} = validate;
|
|
3652
|
+
const onChange = ({
|
|
3653
|
+
target
|
|
3654
|
+
}) => {
|
|
3655
|
+
props.onChange({
|
|
3656
|
+
field,
|
|
3657
|
+
value: target.value
|
|
3658
|
+
});
|
|
3659
|
+
};
|
|
3660
|
+
const {
|
|
3661
|
+
formId
|
|
3662
|
+
} = hooks.useContext(FormContext$1);
|
|
3663
|
+
return jsxRuntime.jsxs("div", {
|
|
3664
|
+
class: formFieldClasses(type$1, {
|
|
3665
|
+
errors,
|
|
3666
|
+
disabled
|
|
3667
|
+
}),
|
|
3668
|
+
children: [jsxRuntime.jsx(Label, {
|
|
3669
|
+
id: prefixId(id, formId),
|
|
3670
|
+
label: label,
|
|
3671
|
+
required: required
|
|
3672
|
+
}), jsxRuntime.jsx(InputAdorner, {
|
|
3673
|
+
disabled: disabled,
|
|
3674
|
+
pre: prefixAdorner,
|
|
3675
|
+
post: suffixAdorner,
|
|
3676
|
+
children: jsxRuntime.jsx("input", {
|
|
3677
|
+
class: "fjs-input",
|
|
3678
|
+
disabled: disabled,
|
|
3679
|
+
id: prefixId(id, formId),
|
|
3680
|
+
onInput: onChange,
|
|
3681
|
+
type: "text",
|
|
3682
|
+
value: value
|
|
3683
|
+
})
|
|
3684
|
+
}), jsxRuntime.jsx(Description, {
|
|
3685
|
+
description: description
|
|
3686
|
+
}), jsxRuntime.jsx(Errors, {
|
|
3687
|
+
errors: errors
|
|
3688
|
+
})]
|
|
3689
|
+
});
|
|
3690
|
+
}
|
|
3691
|
+
Textfield.create = (options = {}) => ({
|
|
3692
|
+
...options
|
|
3693
|
+
});
|
|
3694
|
+
Textfield.type = type$1;
|
|
3695
|
+
Textfield.label = 'Text field';
|
|
3696
|
+
Textfield.keyed = true;
|
|
3697
|
+
Textfield.emptyValue = '';
|
|
3698
|
+
Textfield.sanitizeValue = ({
|
|
3699
|
+
value
|
|
3700
|
+
}) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
|
|
3701
|
+
Textfield.group = 'basic-input';
|
|
3702
|
+
|
|
3703
|
+
const type = 'textarea';
|
|
3704
|
+
function Textarea(props) {
|
|
3705
|
+
const {
|
|
3706
|
+
disabled,
|
|
3707
|
+
errors = [],
|
|
3708
|
+
field,
|
|
3709
|
+
value = ''
|
|
3710
|
+
} = props;
|
|
3711
|
+
const {
|
|
3712
|
+
description,
|
|
3713
|
+
id,
|
|
3714
|
+
label,
|
|
3715
|
+
validate = {}
|
|
3716
|
+
} = field;
|
|
3717
|
+
const {
|
|
3718
|
+
required
|
|
3719
|
+
} = validate;
|
|
3720
|
+
const textareaRef = hooks.useRef();
|
|
3721
|
+
const onInput = ({
|
|
3722
|
+
target
|
|
3723
|
+
}) => {
|
|
3724
|
+
props.onChange({
|
|
3725
|
+
field,
|
|
3726
|
+
value: target.value
|
|
3727
|
+
});
|
|
3728
|
+
};
|
|
3729
|
+
const autoSizeTextarea = hooks.useCallback(textarea => {
|
|
3730
|
+
// Ensures the textarea shrinks back, and improves resizing behavior consistency
|
|
3731
|
+
textarea.style.height = '0px';
|
|
3732
|
+
const computed = window.getComputedStyle(textarea);
|
|
3733
|
+
const calculatedHeight = parseInt(computed.getPropertyValue('border-top-width')) + parseInt(computed.getPropertyValue('padding-top')) + textarea.scrollHeight + parseInt(computed.getPropertyValue('padding-bottom')) + parseInt(computed.getPropertyValue('border-bottom-width'));
|
|
3734
|
+
const minHeight = 75;
|
|
3735
|
+
const maxHeight = 350;
|
|
3736
|
+
const displayHeight = Math.max(Math.min(calculatedHeight, maxHeight), minHeight);
|
|
3737
|
+
textarea.style.height = `${displayHeight}px`;
|
|
3738
|
+
|
|
3739
|
+
// Overflow is hidden by default to hide scrollbar flickering
|
|
3740
|
+
textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
|
|
3741
|
+
}, []);
|
|
3742
|
+
hooks.useEffect(() => {
|
|
3743
|
+
autoSizeTextarea(textareaRef.current);
|
|
3744
|
+
}, [autoSizeTextarea, value]);
|
|
3745
|
+
const {
|
|
3746
|
+
formId
|
|
3747
|
+
} = hooks.useContext(FormContext$1);
|
|
3748
|
+
return jsxRuntime.jsxs("div", {
|
|
3749
|
+
class: formFieldClasses(type, {
|
|
3750
|
+
errors,
|
|
3751
|
+
disabled
|
|
3752
|
+
}),
|
|
3753
|
+
children: [jsxRuntime.jsx(Label, {
|
|
3754
|
+
id: prefixId(id, formId),
|
|
3755
|
+
label: label,
|
|
3756
|
+
required: required
|
|
3757
|
+
}), jsxRuntime.jsx("textarea", {
|
|
3758
|
+
class: "fjs-textarea",
|
|
3759
|
+
disabled: disabled,
|
|
3760
|
+
id: prefixId(id, formId),
|
|
3761
|
+
onInput: onInput,
|
|
3762
|
+
value: value,
|
|
3763
|
+
ref: textareaRef
|
|
3764
|
+
}), jsxRuntime.jsx(Description, {
|
|
3765
|
+
description: description
|
|
3766
|
+
}), jsxRuntime.jsx(Errors, {
|
|
3767
|
+
errors: errors
|
|
3768
|
+
})]
|
|
3769
|
+
});
|
|
3770
|
+
}
|
|
3771
|
+
Textarea.create = (options = {}) => ({
|
|
3772
|
+
...options
|
|
3773
|
+
});
|
|
3774
|
+
Textarea.type = type;
|
|
3775
|
+
Textarea.label = 'Text area';
|
|
3776
|
+
Textarea.keyed = true;
|
|
3777
|
+
Textarea.emptyValue = '';
|
|
3778
|
+
Textarea.sanitizeValue = ({
|
|
3779
|
+
value
|
|
3780
|
+
}) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
|
|
3781
|
+
Textarea.group = 'basic-input';
|
|
3310
3782
|
|
|
3311
3783
|
function _extends$d() { _extends$d = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$d.apply(this, arguments); }
|
|
3312
3784
|
var ButtonIcon = (({
|
|
3313
3785
|
styles = {},
|
|
3314
3786
|
...props
|
|
3315
|
-
}) => /*#__PURE__*/
|
|
3787
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$d({
|
|
3316
3788
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3317
3789
|
width: "54",
|
|
3318
3790
|
height: "54"
|
|
3319
|
-
}, props), /*#__PURE__*/
|
|
3791
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3320
3792
|
fillRule: "evenodd",
|
|
3321
3793
|
d: "M45 17a3 3 0 013 3v14a3 3 0 01-3 3H9a3 3 0 01-3-3V20a3 3 0 013-3h36zm-9 8.889H18v2.222h18V25.89z"
|
|
3322
3794
|
})));
|
|
@@ -3325,11 +3797,11 @@ function _extends$c() { _extends$c = Object.assign ? Object.assign.bind() : func
|
|
|
3325
3797
|
var CheckboxIcon = (({
|
|
3326
3798
|
styles = {},
|
|
3327
3799
|
...props
|
|
3328
|
-
}) => /*#__PURE__*/
|
|
3800
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$c({
|
|
3329
3801
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3330
3802
|
width: "54",
|
|
3331
3803
|
height: "54"
|
|
3332
|
-
}, props), /*#__PURE__*/
|
|
3804
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3333
3805
|
d: "M34 18H20a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V20a2 2 0 00-2-2zm-9 14l-5-5 1.41-1.41L25 29.17l7.59-7.59L34 23l-9 9z"
|
|
3334
3806
|
})));
|
|
3335
3807
|
|
|
@@ -3337,39 +3809,39 @@ function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : func
|
|
|
3337
3809
|
var ChecklistIcon = (({
|
|
3338
3810
|
styles = {},
|
|
3339
3811
|
...props
|
|
3340
|
-
}) => /*#__PURE__*/
|
|
3812
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$b({
|
|
3813
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3341
3814
|
width: "54",
|
|
3342
3815
|
height: "54",
|
|
3343
|
-
fill: "none"
|
|
3344
|
-
|
|
3345
|
-
}, props), /*#__PURE__*/React__default['default'].createElement("path", {
|
|
3816
|
+
fill: "none"
|
|
3817
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3346
3818
|
fillRule: "evenodd",
|
|
3347
3819
|
clipRule: "evenodd",
|
|
3348
|
-
d: "
|
|
3349
|
-
fill: "#
|
|
3350
|
-
}), /*#__PURE__*/
|
|
3351
|
-
d: "
|
|
3352
|
-
fill: "#
|
|
3820
|
+
d: "M18 12h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 36h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6zM18 24h-6v6h6v-6zm-6-2a2 2 0 00-2 2v6a2 2 0 002 2h6a2 2 0 002-2v-6a2 2 0 00-2-2h-6z",
|
|
3821
|
+
fill: "#161616"
|
|
3822
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3823
|
+
d: "M23 14.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 26.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1zM23 38.5a1 1 0 011-1h19a1 1 0 011 1v1a1 1 0 01-1 1H24a1 1 0 01-1-1v-1z",
|
|
3824
|
+
fill: "#161616"
|
|
3353
3825
|
})));
|
|
3354
3826
|
|
|
3355
3827
|
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); }
|
|
3356
3828
|
var DatetimeIcon = (({
|
|
3357
3829
|
styles = {},
|
|
3358
3830
|
...props
|
|
3359
|
-
}) => /*#__PURE__*/
|
|
3831
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$a({
|
|
3360
3832
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3361
3833
|
width: "54",
|
|
3362
3834
|
height: "54",
|
|
3363
3835
|
fill: "none"
|
|
3364
|
-
}, props), /*#__PURE__*/
|
|
3836
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3365
3837
|
fill: "#000",
|
|
3366
3838
|
fillRule: "evenodd",
|
|
3367
3839
|
d: "M37.908 13.418h-5.004v-2.354h-1.766v2.354H21.13v-2.354h-1.766v2.354H14.36c-1.132 0-2.06.928-2.06 2.06v23.549c0 1.132.928 2.06 2.06 2.06h6.77v-1.766h-6.358a.707.707 0 01-.706-.706V15.89c0-.39.316-.707.706-.707h4.592v2.355h1.766v-2.355h10.008v2.355h1.766v-2.355h4.592c.39 0 .707.317.707.707v6.358h1.765v-6.77c0-1.133-.927-2.06-2.06-2.06z",
|
|
3368
3840
|
clipRule: "evenodd"
|
|
3369
|
-
}), /*#__PURE__*/
|
|
3841
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3370
3842
|
fill: "#000",
|
|
3371
3843
|
d: "M35.13 37.603l1.237-1.237-3.468-3.475v-5.926h-1.754v6.654l3.984 3.984z"
|
|
3372
|
-
}), /*#__PURE__*/
|
|
3844
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3373
3845
|
fill: "#000",
|
|
3374
3846
|
fillRule: "evenodd",
|
|
3375
3847
|
d: "M23.08 36.962a9.678 9.678 0 1017.883-7.408 9.678 9.678 0 00-17.882 7.408zm4.54-10.292a7.924 7.924 0 118.805 13.177A7.924 7.924 0 0127.62 26.67z",
|
|
@@ -3380,17 +3852,17 @@ function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : func
|
|
|
3380
3852
|
var TaglistIcon = (({
|
|
3381
3853
|
styles = {},
|
|
3382
3854
|
...props
|
|
3383
|
-
}) => /*#__PURE__*/
|
|
3855
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$9({
|
|
3384
3856
|
width: "54",
|
|
3385
3857
|
height: "54",
|
|
3386
3858
|
fill: "none",
|
|
3387
3859
|
xmlns: "http://www.w3.org/2000/svg"
|
|
3388
|
-
}, props), /*#__PURE__*/
|
|
3860
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3389
3861
|
fillRule: "evenodd",
|
|
3390
3862
|
clipRule: "evenodd",
|
|
3391
3863
|
d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1z",
|
|
3392
3864
|
fill: "#000"
|
|
3393
|
-
}), /*#__PURE__*/
|
|
3865
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3394
3866
|
d: "M11 22a1 1 0 011-1h19a1 1 0 011 1v10a1 1 0 01-1 1H12a1 1 0 01-1-1V22z",
|
|
3395
3867
|
fill: "#505562"
|
|
3396
3868
|
})));
|
|
@@ -3399,23 +3871,23 @@ function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : func
|
|
|
3399
3871
|
var FormIcon = (({
|
|
3400
3872
|
styles = {},
|
|
3401
3873
|
...props
|
|
3402
|
-
}) => /*#__PURE__*/
|
|
3874
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$8({
|
|
3403
3875
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3404
3876
|
width: "54",
|
|
3405
3877
|
height: "54"
|
|
3406
|
-
}, props), /*#__PURE__*/
|
|
3878
|
+
}, props), /*#__PURE__*/React.createElement("rect", {
|
|
3407
3879
|
x: "15",
|
|
3408
3880
|
y: "17",
|
|
3409
3881
|
width: "24",
|
|
3410
3882
|
height: "4",
|
|
3411
3883
|
rx: "1"
|
|
3412
|
-
}), /*#__PURE__*/
|
|
3884
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
3413
3885
|
x: "15",
|
|
3414
3886
|
y: "25",
|
|
3415
3887
|
width: "24",
|
|
3416
3888
|
height: "4",
|
|
3417
3889
|
rx: "1"
|
|
3418
|
-
}), /*#__PURE__*/
|
|
3890
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
3419
3891
|
x: "15",
|
|
3420
3892
|
y: "33",
|
|
3421
3893
|
width: "13",
|
|
@@ -3427,11 +3899,11 @@ function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : func
|
|
|
3427
3899
|
var ColumnsIcon = (({
|
|
3428
3900
|
styles = {},
|
|
3429
3901
|
...props
|
|
3430
|
-
}) => /*#__PURE__*/
|
|
3902
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$7({
|
|
3431
3903
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3432
3904
|
width: "54",
|
|
3433
3905
|
height: "54"
|
|
3434
|
-
}, props), /*#__PURE__*/
|
|
3906
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3435
3907
|
fillRule: "evenodd",
|
|
3436
3908
|
d: "M8 33v5a1 1 0 001 1h4v2H9a3 3 0 01-3-3v-5h2zm18 6v2H15v-2h11zm13 0v2H28v-2h11zm9-6v5a3 3 0 01-3 3h-4v-2h4a1 1 0 00.993-.883L46 38v-5h2zM8 22v9H6v-9h2zm40 0v9h-2v-9h2zm-35-9v2H9a1 1 0 00-.993.883L8 16v4H6v-4a3 3 0 013-3h4zm32 0a3 3 0 013 3v4h-2v-4a1 1 0 00-.883-.993L45 15h-4v-2h4zm-6 0v2H28v-2h11zm-13 0v2H15v-2h11z"
|
|
3437
3909
|
})));
|
|
@@ -3440,11 +3912,11 @@ function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : func
|
|
|
3440
3912
|
var NumberIcon = (({
|
|
3441
3913
|
styles = {},
|
|
3442
3914
|
...props
|
|
3443
|
-
}) => /*#__PURE__*/
|
|
3915
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$6({
|
|
3444
3916
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3445
3917
|
width: "54",
|
|
3446
3918
|
height: "54"
|
|
3447
|
-
}, props), /*#__PURE__*/
|
|
3919
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3448
3920
|
fillRule: "evenodd",
|
|
3449
3921
|
d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zM35 28.444h7l-3.5 4-3.5-4zM35 26h7l-3.5-4-3.5 4z"
|
|
3450
3922
|
})));
|
|
@@ -3453,11 +3925,11 @@ function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : func
|
|
|
3453
3925
|
var RadioIcon = (({
|
|
3454
3926
|
styles = {},
|
|
3455
3927
|
...props
|
|
3456
|
-
}) => /*#__PURE__*/
|
|
3928
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$5({
|
|
3457
3929
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3458
3930
|
width: "54",
|
|
3459
3931
|
height: "54"
|
|
3460
|
-
}, props), /*#__PURE__*/
|
|
3932
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3461
3933
|
d: "M27 22c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
|
3462
3934
|
})));
|
|
3463
3935
|
|
|
@@ -3465,11 +3937,11 @@ function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : func
|
|
|
3465
3937
|
var SelectIcon = (({
|
|
3466
3938
|
styles = {},
|
|
3467
3939
|
...props
|
|
3468
|
-
}) => /*#__PURE__*/
|
|
3940
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$4({
|
|
3469
3941
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3470
3942
|
width: "54",
|
|
3471
3943
|
height: "54"
|
|
3472
|
-
}, props), /*#__PURE__*/
|
|
3944
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3473
3945
|
fillRule: "evenodd",
|
|
3474
3946
|
d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-12 7h9l-4.5 6-4.5-6z"
|
|
3475
3947
|
})));
|
|
@@ -3478,11 +3950,11 @@ function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : func
|
|
|
3478
3950
|
var TextIcon = (({
|
|
3479
3951
|
styles = {},
|
|
3480
3952
|
...props
|
|
3481
|
-
}) => /*#__PURE__*/
|
|
3953
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$3({
|
|
3482
3954
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3483
3955
|
width: "54",
|
|
3484
3956
|
height: "54"
|
|
3485
|
-
}, props), /*#__PURE__*/
|
|
3957
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3486
3958
|
d: "M20.58 33.77h-3l-1.18-3.08H11l-1.1 3.08H7l5.27-13.54h2.89zm-5-5.36l-1.86-5-1.83 5zM22 20.23h5.41a15.47 15.47 0 012.4.14 3.42 3.42 0 011.41.55 3.47 3.47 0 011 1.14 3 3 0 01.42 1.58 3.26 3.26 0 01-1.91 2.94 3.63 3.63 0 011.91 1.22 3.28 3.28 0 01.66 2 4 4 0 01-.43 1.8 3.63 3.63 0 01-1.09 1.4 3.89 3.89 0 01-1.83.65q-.69.07-3.3.09H22zm2.73 2.25v3.13h3.8a1.79 1.79 0 001.1-.49 1.41 1.41 0 00.41-1 1.49 1.49 0 00-.35-1 1.54 1.54 0 00-1-.48c-.27 0-1.05-.05-2.34-.05zm0 5.39v3.62h2.57a11.52 11.52 0 001.88-.09 1.65 1.65 0 001-.54 1.6 1.6 0 00.38-1.14 1.75 1.75 0 00-.29-1 1.69 1.69 0 00-.86-.62 9.28 9.28 0 00-2.41-.23zM44.35 28.79l2.65.84a5.94 5.94 0 01-2 3.29A5.74 5.74 0 0141.38 34a5.87 5.87 0 01-4.44-1.84 7.09 7.09 0 01-1.73-5A7.43 7.43 0 0137 21.87 6 6 0 0141.54 20a5.64 5.64 0 014 1.47A5.33 5.33 0 0147 24l-2.7.65a2.8 2.8 0 00-2.86-2.27A3.09 3.09 0 0039 23.42a5.31 5.31 0 00-.93 3.5 5.62 5.62 0 00.93 3.65 3 3 0 002.4 1.09 2.72 2.72 0 001.82-.66 4 4 0 001.13-2.21z"
|
|
3487
3959
|
})));
|
|
3488
3960
|
|
|
@@ -3490,11 +3962,11 @@ function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : func
|
|
|
3490
3962
|
var TextfieldIcon = (({
|
|
3491
3963
|
styles = {},
|
|
3492
3964
|
...props
|
|
3493
|
-
}) => /*#__PURE__*/
|
|
3965
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
3494
3966
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3495
3967
|
width: "54",
|
|
3496
3968
|
height: "54"
|
|
3497
|
-
}, props), /*#__PURE__*/
|
|
3969
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3498
3970
|
fillRule: "evenodd",
|
|
3499
3971
|
d: "M45 16a3 3 0 013 3v16a3 3 0 01-3 3H9a3 3 0 01-3-3V19a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v16a1 1 0 001 1h36a1 1 0 001-1V19a1 1 0 00-1-1zm-32 4v10h-2V22h2z"
|
|
3500
3972
|
})));
|
|
@@ -3503,11 +3975,11 @@ function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : func
|
|
|
3503
3975
|
var TextareaIcon = (({
|
|
3504
3976
|
styles = {},
|
|
3505
3977
|
...props
|
|
3506
|
-
}) => /*#__PURE__*/
|
|
3978
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
3507
3979
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3508
3980
|
width: "54",
|
|
3509
3981
|
height: "54"
|
|
3510
|
-
}, props), /*#__PURE__*/
|
|
3982
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3511
3983
|
fillRule: "evenodd",
|
|
3512
3984
|
d: "M45 13a3 3 0 013 3v22a3 3 0 01-3 3H9a3 3 0 01-3-3V16a3 3 0 013-3h36zm0 2H9a1 1 0 00-1 1v22a1 1 0 001 1h36a1 1 0 001-1V16a1 1 0 00-1-1zm-1.136 15.5l.848.849-6.363 6.363-.849-.848 6.364-6.364zm.264 3.5l.849.849-2.828 2.828-.849-.849L44.128 34zM13 19v10h-2V19h2z"
|
|
3513
3985
|
})));
|
|
@@ -3516,17 +3988,17 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
3516
3988
|
var ImageIcon = (({
|
|
3517
3989
|
styles = {},
|
|
3518
3990
|
...props
|
|
3519
|
-
}) => /*#__PURE__*/
|
|
3991
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends({
|
|
3520
3992
|
width: "54",
|
|
3521
3993
|
height: "54",
|
|
3522
3994
|
fill: "none",
|
|
3523
3995
|
xmlns: "http://www.w3.org/2000/svg"
|
|
3524
|
-
}, props), /*#__PURE__*/
|
|
3996
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
3525
3997
|
fillRule: "evenodd",
|
|
3526
3998
|
clipRule: "evenodd",
|
|
3527
3999
|
d: "M34.636 21.91A3.818 3.818 0 1127 21.908a3.818 3.818 0 017.636 0zm-2 0A1.818 1.818 0 1129 21.908a1.818 1.818 0 013.636 0z",
|
|
3528
4000
|
fill: "#000"
|
|
3529
|
-
}), /*#__PURE__*/
|
|
4001
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3530
4002
|
fillRule: "evenodd",
|
|
3531
4003
|
clipRule: "evenodd",
|
|
3532
4004
|
d: "M15 13a2 2 0 00-2 2v24a2 2 0 002 2h24a2 2 0 002-2V15a2 2 0 00-2-2H15zm24 2H15v12.45l4.71-4.709a1.91 1.91 0 012.702 0l6.695 6.695 2.656-1.77a1.91 1.91 0 012.411.239L39 32.73V15zM15 39v-8.754c.06-.038.116-.083.168-.135l5.893-5.893 6.684 6.685a1.911 1.911 0 002.41.238l2.657-1.77 6.02 6.02c.052.051.108.097.168.135V39H15z",
|
|
@@ -3550,226 +4022,13 @@ const iconsByType = {
|
|
|
3550
4022
|
default: FormIcon
|
|
3551
4023
|
};
|
|
3552
4024
|
|
|
3553
|
-
const type$2 = 'text';
|
|
3554
|
-
function Text(props) {
|
|
3555
|
-
const {
|
|
3556
|
-
field,
|
|
3557
|
-
disabled
|
|
3558
|
-
} = props;
|
|
3559
|
-
const {
|
|
3560
|
-
text = ''
|
|
3561
|
-
} = field;
|
|
3562
|
-
const textValue = useExpressionValue(text) || '';
|
|
3563
|
-
return jsxRuntime.jsx("div", {
|
|
3564
|
-
class: formFieldClasses(type$2),
|
|
3565
|
-
children: renderText(field, textValue, disabled)
|
|
3566
|
-
});
|
|
3567
|
-
}
|
|
3568
|
-
Text.create = function (options = {}) {
|
|
3569
|
-
return {
|
|
3570
|
-
text: '# Text',
|
|
3571
|
-
...options
|
|
3572
|
-
};
|
|
3573
|
-
};
|
|
3574
|
-
Text.type = type$2;
|
|
3575
|
-
Text.keyed = false;
|
|
3576
|
-
|
|
3577
|
-
// helper //////////////
|
|
3578
|
-
|
|
3579
|
-
function renderText(field, content, disabled) {
|
|
3580
|
-
const {
|
|
3581
|
-
text
|
|
3582
|
-
} = field;
|
|
3583
|
-
const Icon = iconsByType['text'];
|
|
3584
|
-
if (disabled) {
|
|
3585
|
-
if (!text) {
|
|
3586
|
-
return jsxRuntime.jsxs("div", {
|
|
3587
|
-
class: "fjs-form-field-placeholder",
|
|
3588
|
-
children: [jsxRuntime.jsx(Icon, {
|
|
3589
|
-
viewBox: "0 0 54 54"
|
|
3590
|
-
}), "Text view is empty"]
|
|
3591
|
-
});
|
|
3592
|
-
}
|
|
3593
|
-
if (isExpression$2(text)) {
|
|
3594
|
-
return jsxRuntime.jsxs("div", {
|
|
3595
|
-
class: "fjs-form-field-placeholder",
|
|
3596
|
-
children: [jsxRuntime.jsx(Icon, {
|
|
3597
|
-
viewBox: "0 0 54 54"
|
|
3598
|
-
}), "Text view is populated by an expression"]
|
|
3599
|
-
});
|
|
3600
|
-
}
|
|
3601
|
-
}
|
|
3602
|
-
return jsxRuntime.jsx(Markup__default['default'], {
|
|
3603
|
-
markup: safeMarkdown(content),
|
|
3604
|
-
trim: false
|
|
3605
|
-
});
|
|
3606
|
-
}
|
|
3607
|
-
|
|
3608
|
-
const type$1 = 'textfield';
|
|
3609
|
-
function Textfield(props) {
|
|
3610
|
-
const {
|
|
3611
|
-
disabled,
|
|
3612
|
-
errors = [],
|
|
3613
|
-
field,
|
|
3614
|
-
value = ''
|
|
3615
|
-
} = props;
|
|
3616
|
-
const {
|
|
3617
|
-
description,
|
|
3618
|
-
id,
|
|
3619
|
-
label,
|
|
3620
|
-
appearance = {},
|
|
3621
|
-
validate = {}
|
|
3622
|
-
} = field;
|
|
3623
|
-
const {
|
|
3624
|
-
prefixAdorner,
|
|
3625
|
-
suffixAdorner
|
|
3626
|
-
} = appearance;
|
|
3627
|
-
const {
|
|
3628
|
-
required
|
|
3629
|
-
} = validate;
|
|
3630
|
-
const onChange = ({
|
|
3631
|
-
target
|
|
3632
|
-
}) => {
|
|
3633
|
-
props.onChange({
|
|
3634
|
-
field,
|
|
3635
|
-
value: target.value
|
|
3636
|
-
});
|
|
3637
|
-
};
|
|
3638
|
-
const {
|
|
3639
|
-
formId
|
|
3640
|
-
} = hooks.useContext(FormContext);
|
|
3641
|
-
return jsxRuntime.jsxs("div", {
|
|
3642
|
-
class: formFieldClasses(type$1, {
|
|
3643
|
-
errors,
|
|
3644
|
-
disabled
|
|
3645
|
-
}),
|
|
3646
|
-
children: [jsxRuntime.jsx(Label, {
|
|
3647
|
-
id: prefixId(id, formId),
|
|
3648
|
-
label: label,
|
|
3649
|
-
required: required
|
|
3650
|
-
}), jsxRuntime.jsx(InputAdorner, {
|
|
3651
|
-
disabled: disabled,
|
|
3652
|
-
pre: prefixAdorner,
|
|
3653
|
-
post: suffixAdorner,
|
|
3654
|
-
children: jsxRuntime.jsx("input", {
|
|
3655
|
-
class: "fjs-input",
|
|
3656
|
-
disabled: disabled,
|
|
3657
|
-
id: prefixId(id, formId),
|
|
3658
|
-
onInput: onChange,
|
|
3659
|
-
type: "text",
|
|
3660
|
-
value: value
|
|
3661
|
-
})
|
|
3662
|
-
}), jsxRuntime.jsx(Description, {
|
|
3663
|
-
description: description
|
|
3664
|
-
}), jsxRuntime.jsx(Errors, {
|
|
3665
|
-
errors: errors
|
|
3666
|
-
})]
|
|
3667
|
-
});
|
|
3668
|
-
}
|
|
3669
|
-
Textfield.create = function (options = {}) {
|
|
3670
|
-
return {
|
|
3671
|
-
...options
|
|
3672
|
-
};
|
|
3673
|
-
};
|
|
3674
|
-
Textfield.type = type$1;
|
|
3675
|
-
Textfield.label = 'Text field';
|
|
3676
|
-
Textfield.keyed = true;
|
|
3677
|
-
Textfield.emptyValue = '';
|
|
3678
|
-
Textfield.sanitizeValue = ({
|
|
3679
|
-
value
|
|
3680
|
-
}) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
|
|
3681
|
-
|
|
3682
|
-
const type = 'textarea';
|
|
3683
|
-
function Textarea(props) {
|
|
3684
|
-
const {
|
|
3685
|
-
disabled,
|
|
3686
|
-
errors = [],
|
|
3687
|
-
field,
|
|
3688
|
-
value = ''
|
|
3689
|
-
} = props;
|
|
3690
|
-
const {
|
|
3691
|
-
description,
|
|
3692
|
-
id,
|
|
3693
|
-
label,
|
|
3694
|
-
validate = {}
|
|
3695
|
-
} = field;
|
|
3696
|
-
const {
|
|
3697
|
-
required
|
|
3698
|
-
} = validate;
|
|
3699
|
-
const textareaRef = hooks.useRef();
|
|
3700
|
-
const onInput = ({
|
|
3701
|
-
target
|
|
3702
|
-
}) => {
|
|
3703
|
-
props.onChange({
|
|
3704
|
-
field,
|
|
3705
|
-
value: target.value
|
|
3706
|
-
});
|
|
3707
|
-
};
|
|
3708
|
-
const autoSizeTextarea = hooks.useCallback(textarea => {
|
|
3709
|
-
// Ensures the textarea shrinks back, and improves resizing behavior consistency
|
|
3710
|
-
textarea.style.height = '0px';
|
|
3711
|
-
const computed = window.getComputedStyle(textarea);
|
|
3712
|
-
const calculatedHeight = parseInt(computed.getPropertyValue('border-top-width')) + parseInt(computed.getPropertyValue('padding-top')) + textarea.scrollHeight + parseInt(computed.getPropertyValue('padding-bottom')) + parseInt(computed.getPropertyValue('border-bottom-width'));
|
|
3713
|
-
const minHeight = 75;
|
|
3714
|
-
const maxHeight = 350;
|
|
3715
|
-
const displayHeight = Math.max(Math.min(calculatedHeight, maxHeight), minHeight);
|
|
3716
|
-
textarea.style.height = `${displayHeight}px`;
|
|
3717
|
-
|
|
3718
|
-
// Overflow is hidden by default to hide scrollbar flickering
|
|
3719
|
-
textarea.style.overflow = calculatedHeight > maxHeight ? 'visible' : 'hidden';
|
|
3720
|
-
}, []);
|
|
3721
|
-
hooks.useEffect(() => {
|
|
3722
|
-
autoSizeTextarea(textareaRef.current);
|
|
3723
|
-
}, [autoSizeTextarea, value]);
|
|
3724
|
-
const {
|
|
3725
|
-
formId
|
|
3726
|
-
} = hooks.useContext(FormContext);
|
|
3727
|
-
return jsxRuntime.jsxs("div", {
|
|
3728
|
-
class: formFieldClasses(type, {
|
|
3729
|
-
errors,
|
|
3730
|
-
disabled
|
|
3731
|
-
}),
|
|
3732
|
-
children: [jsxRuntime.jsx(Label, {
|
|
3733
|
-
id: prefixId(id, formId),
|
|
3734
|
-
label: label,
|
|
3735
|
-
required: required
|
|
3736
|
-
}), jsxRuntime.jsx("textarea", {
|
|
3737
|
-
class: "fjs-textarea",
|
|
3738
|
-
disabled: disabled,
|
|
3739
|
-
id: prefixId(id, formId),
|
|
3740
|
-
onInput: onInput,
|
|
3741
|
-
value: value,
|
|
3742
|
-
ref: textareaRef
|
|
3743
|
-
}), jsxRuntime.jsx(Description, {
|
|
3744
|
-
description: description
|
|
3745
|
-
}), jsxRuntime.jsx(Errors, {
|
|
3746
|
-
errors: errors
|
|
3747
|
-
})]
|
|
3748
|
-
});
|
|
3749
|
-
}
|
|
3750
|
-
Textarea.create = function (options = {}) {
|
|
3751
|
-
return {
|
|
3752
|
-
...options
|
|
3753
|
-
};
|
|
3754
|
-
};
|
|
3755
|
-
Textarea.type = type;
|
|
3756
|
-
Textarea.label = 'Text area';
|
|
3757
|
-
Textarea.keyed = true;
|
|
3758
|
-
Textarea.emptyValue = '';
|
|
3759
|
-
Textarea.sanitizeValue = ({
|
|
3760
|
-
value
|
|
3761
|
-
}) => minDash.isArray(value) || minDash.isObject(value) ? '' : String(value);
|
|
3762
|
-
|
|
3763
4025
|
const formFields = [Button, Checkbox, Checklist, Default, Image, Numberfield, Datetime, Radio, Select, Taglist, Text, Textfield, Textarea];
|
|
3764
4026
|
|
|
3765
4027
|
class FormFields {
|
|
3766
4028
|
constructor() {
|
|
3767
4029
|
this._formFields = {};
|
|
3768
4030
|
formFields.forEach(formField => {
|
|
3769
|
-
|
|
3770
|
-
type
|
|
3771
|
-
} = formField;
|
|
3772
|
-
this.register(type, formField);
|
|
4031
|
+
this.register(formField.type, formField);
|
|
3773
4032
|
});
|
|
3774
4033
|
}
|
|
3775
4034
|
register(type, formField) {
|
|
@@ -3811,7 +4070,7 @@ function Renderer(config, eventBus, form, injector) {
|
|
|
3811
4070
|
if (!schema) {
|
|
3812
4071
|
return null;
|
|
3813
4072
|
}
|
|
3814
|
-
return jsxRuntime.jsx(FormContext.Provider, {
|
|
4073
|
+
return jsxRuntime.jsx(FormContext$1.Provider, {
|
|
3815
4074
|
value: formContext,
|
|
3816
4075
|
children: jsxRuntime.jsx(FormComponent, {
|
|
3817
4076
|
onChange: onChange,
|
|
@@ -3869,7 +4128,7 @@ var core = {
|
|
|
3869
4128
|
* @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
|
|
3870
4129
|
*/
|
|
3871
4130
|
|
|
3872
|
-
const ids = new
|
|
4131
|
+
const ids = new Ids([32, 36, 1]);
|
|
3873
4132
|
|
|
3874
4133
|
/**
|
|
3875
4134
|
* The form.
|
|
@@ -4212,7 +4471,7 @@ class Form {
|
|
|
4212
4471
|
}
|
|
4213
4472
|
}
|
|
4214
4473
|
|
|
4215
|
-
const schemaVersion =
|
|
4474
|
+
const schemaVersion = 7;
|
|
4216
4475
|
|
|
4217
4476
|
/**
|
|
4218
4477
|
* @typedef { import('./types').CreateFormOptions } CreateFormOptions
|
|
@@ -4249,10 +4508,10 @@ exports.Datetime = Datetime;
|
|
|
4249
4508
|
exports.Default = Default;
|
|
4250
4509
|
exports.Form = Form;
|
|
4251
4510
|
exports.FormComponent = FormComponent;
|
|
4252
|
-
exports.FormContext = FormContext;
|
|
4511
|
+
exports.FormContext = FormContext$1;
|
|
4253
4512
|
exports.FormFieldRegistry = FormFieldRegistry;
|
|
4254
4513
|
exports.FormFields = FormFields;
|
|
4255
|
-
exports.FormRenderContext = FormRenderContext;
|
|
4514
|
+
exports.FormRenderContext = FormRenderContext$1;
|
|
4256
4515
|
exports.Image = Image;
|
|
4257
4516
|
exports.MINUTES_IN_DAY = MINUTES_IN_DAY;
|
|
4258
4517
|
exports.Numberfield = Numberfield;
|
|
@@ -4281,9 +4540,12 @@ exports.findErrors = findErrors;
|
|
|
4281
4540
|
exports.formFields = formFields;
|
|
4282
4541
|
exports.generateIdForType = generateIdForType;
|
|
4283
4542
|
exports.generateIndexForType = generateIndexForType;
|
|
4543
|
+
exports.getExpressionVariableNames = getExpressionVariableNames;
|
|
4284
4544
|
exports.getSchemaVariables = getSchemaVariables;
|
|
4285
4545
|
exports.getValuesSource = getValuesSource;
|
|
4546
|
+
exports.getVariableNames = getVariableNames;
|
|
4286
4547
|
exports.iconsByType = iconsByType;
|
|
4548
|
+
exports.isExpression = isExpression$1;
|
|
4287
4549
|
exports.isRequired = isRequired;
|
|
4288
4550
|
exports.pathParse = pathParse;
|
|
4289
4551
|
exports.pathStringify = pathStringify;
|