@3t-transform/threeteeui 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{tttx-button_1_2_0.cjs.entry.js → tttx-button_1_4_0.cjs.entry.js} +2 -2
- package/dist/cjs/{tttx-checkbox-group-caption_1_2_0.cjs.entry.js → tttx-checkbox-group-caption_1_4_0.cjs.entry.js} +1 -1
- package/dist/cjs/{tttx-checkbox-group-heading_1_2_0.cjs.entry.js → tttx-checkbox-group-heading_1_4_0.cjs.entry.js} +1 -1
- package/dist/cjs/{tttx-checkbox-group_1_2_0.cjs.entry.js → tttx-checkbox-group_1_4_0.cjs.entry.js} +1 -1
- package/dist/cjs/{tttx-checkbox_1_2_0.cjs.entry.js → tttx-checkbox_1_4_0.cjs.entry.js} +2 -2
- package/dist/cjs/{tttx-data-pattern_1_2_0.cjs.entry.js → tttx-data-pattern_1_4_0.cjs.entry.js} +2 -2
- package/dist/cjs/{tttx-dialog-box_1_2_0.cjs.entry.js → tttx-dialog-box_1_4_0.cjs.entry.js} +3 -3
- package/dist/cjs/{tttx-dialog_1_2_0.cjs.entry.js → tttx-dialog_1_4_0.cjs.entry.js} +2 -2
- package/dist/cjs/{tttx-expander_1_2_0.cjs.entry.js → tttx-expander_1_4_0.cjs.entry.js} +2 -2
- package/dist/cjs/{tttx-filter_1_2_0_4.cjs.entry.js → tttx-filter_1_4_0_4.cjs.entry.js} +17 -10
- package/dist/cjs/{tttx-form_1_2_0.cjs.entry.js → tttx-form_1_4_0.cjs.entry.js} +229 -134
- package/dist/cjs/{tttx-icon_1_2_0.cjs.entry.js → tttx-icon_1_4_0.cjs.entry.js} +1 -1
- package/dist/cjs/{tttx-keyvalue-block_1_2_0.cjs.entry.js → tttx-keyvalue-block_1_4_0.cjs.entry.js} +1 -1
- package/dist/cjs/{tttx-loading-spinner_1_2_0.cjs.entry.js → tttx-loading-spinner_1_4_0.cjs.entry.js} +1 -1
- package/dist/cjs/{tttx-multiselect-box_1_2_0.cjs.entry.js → tttx-multiselect-box_1_4_0.cjs.entry.js} +6 -6
- package/dist/cjs/{tttx-percentage-bar_1_2_0.cjs.entry.js → tttx-percentage-bar_1_4_0.cjs.entry.js} +2 -2
- package/dist/cjs/{tttx-qrcode_1_2_0.cjs.entry.js → tttx-qrcode_1_4_0.cjs.entry.js} +1 -1
- package/dist/cjs/{tttx-select-box_1_2_0.cjs.entry.js → tttx-select-box_1_4_0.cjs.entry.js} +3 -3
- package/dist/cjs/tttx-standalone-input_1_4_0.cjs.entry.js +94 -0
- package/dist/cjs/{tttx-tabs_1_2_0.cjs.entry.js → tttx-tabs_1_4_0.cjs.entry.js} +4 -4
- package/dist/cjs/{tttx-tag_1_2_0.cjs.entry.js → tttx-tag_1_4_0.cjs.entry.js} +1 -1
- package/dist/cjs/{tttx-textarea_1_2_0.cjs.entry.js → tttx-textarea_1_4_0.cjs.entry.js} +2 -2
- package/dist/cjs/{tttx-tree-view_1_2_0.cjs.entry.js → tttx-tree-view_1_4_0.cjs.entry.js} +3 -3
- package/dist/cjs/tttx.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/atoms/tttx-button/tttx-button.js +2 -2
- package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +20 -20
- package/dist/collection/components/atoms/tttx-checkbox/tttx-checkbox.js +2 -2
- package/dist/collection/components/atoms/tttx-checkbox/tttx-checkbox.stories.js +1 -1
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +1 -1
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +1 -1
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +1 -1
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +6 -6
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +1 -1
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +1 -1
- package/dist/collection/components/atoms/tttx-percentage-bar/tttx-percentage-bar.js +1 -1
- package/dist/collection/components/atoms/tttx-percentage-bar/tttx-percentage-bar.stories.js +5 -5
- package/dist/collection/components/atoms/tttx-qrcode/tttx-qrcode.js +1 -1
- package/dist/collection/components/atoms/tttx-qrcode/tttx-qrcode.stories.js +1 -1
- package/dist/collection/components/atoms/tttx-tag/tttx-tag.js +1 -1
- package/dist/collection/components/atoms/tttx-tag/tttx-tag.stories.js +6 -6
- package/dist/collection/components/molecules/tttx-checkbox-group/components/tttx-checkbox-group-caption.js +1 -1
- package/dist/collection/components/molecules/tttx-checkbox-group/components/tttx-checkbox-group-heading.js +1 -1
- package/dist/collection/components/molecules/tttx-checkbox-group/tttx-checkbox-group.js +1 -1
- package/dist/collection/components/molecules/tttx-checkbox-group/tttx-checkbox-group.stories.js +10 -10
- package/dist/collection/components/molecules/tttx-dialog/tttx-dialog.js +2 -2
- package/dist/collection/components/molecules/tttx-dialog/tttx-dialog.stories.js +6 -6
- package/dist/collection/components/molecules/tttx-dialog-box/tttx-dialog-box.js +3 -3
- package/dist/collection/components/molecules/tttx-dialog-box/tttx-dialog-box.stories.js +24 -24
- package/dist/collection/components/molecules/tttx-expander/tttx-expander.js +2 -2
- package/dist/collection/components/molecules/tttx-expander/tttx-expander.stories.js +9 -9
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.js +3 -3
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.stories.js +2 -2
- package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +0 -1
- package/dist/collection/components/molecules/tttx-form/lib/timecomparatorChecks.js +64 -0
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +9 -8
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +304 -129
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +5 -5
- package/dist/collection/components/molecules/tttx-list/tttx-list.js +11 -4
- package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +46 -46
- package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.js +6 -6
- package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.stories.js +33 -33
- package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.js +3 -3
- package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.stories.js +16 -16
- package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.js +2 -2
- package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.stories.js +1 -1
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +4 -4
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +1 -1
- package/dist/collection/components/molecules/tttx-tabs/tttx-tabs.js +3 -3
- package/dist/collection/components/molecules/tttx-tabs/tttx-tabs.stories.js +4 -4
- package/dist/collection/components/molecules/tttx-textarea/tttx-textarea.js +3 -3
- package/dist/collection/components/molecules/tttx-textarea/tttx-textarea.stories.js +1 -1
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.js +1 -1
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.stories.js +37 -37
- package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.js +3 -3
- package/dist/collection/components/molecules/tttx-tree-view/tttx-tree-view.stories.js +8 -8
- package/dist/collection/components/organisms/tttx-data-pattern/tttx-data-pattern.js +2 -2
- package/dist/collection/components/organisms/tttx-data-pattern/tttx-data-pattern.stories.js +5 -5
- package/dist/components/index.d.ts +26 -26
- package/dist/components/index.js +26 -26
- package/dist/components/tttx-button.js +5 -5
- package/dist/components/{tttx-button_1_2_0.d.ts → tttx-button_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-button_1_2_0.js → tttx-button_1_4_0.js} +2 -2
- package/dist/components/tttx-checkbox-group-caption_1_4_0.d.ts +11 -0
- package/dist/components/{tttx-checkbox-group-caption_1_2_0.js → tttx-checkbox-group-caption_1_4_0.js} +5 -5
- package/dist/components/tttx-checkbox-group-heading_1_4_0.d.ts +11 -0
- package/dist/components/{tttx-checkbox-group-heading_1_2_0.js → tttx-checkbox-group-heading_1_4_0.js} +5 -5
- package/dist/components/tttx-checkbox-group_1_4_0.d.ts +11 -0
- package/dist/components/{tttx-checkbox-group_1_2_0.js → tttx-checkbox-group_1_4_0.js} +5 -5
- package/dist/components/{tttx-textarea_1_2_0.d.ts → tttx-checkbox_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-checkbox_1_2_0.js → tttx-checkbox_1_4_0.js} +7 -7
- package/dist/components/tttx-data-pattern_1_4_0.d.ts +11 -0
- package/dist/components/{tttx-data-pattern_1_2_0.js → tttx-data-pattern_1_4_0.js} +13 -13
- package/dist/components/{tttx-dialog-box_1_2_0.d.ts → tttx-dialog-box_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-dialog-box_1_2_0.js → tttx-dialog-box_1_4_0.js} +9 -9
- package/dist/components/{tttx-filter_1_2_0.d.ts → tttx-dialog_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-dialog_1_2_0.js → tttx-dialog_1_4_0.js} +8 -8
- package/dist/components/{tttx-expander_1_2_0.d.ts → tttx-expander_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-expander_1_2_0.js → tttx-expander_1_4_0.js} +7 -7
- package/dist/components/tttx-filter.js +6 -6
- package/dist/components/{tttx-qrcode_1_2_0.d.ts → tttx-filter_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-filter_1_2_0.js → tttx-filter_1_4_0.js} +2 -2
- package/dist/components/{tttx-icon_1_2_0.d.ts → tttx-form_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-form_1_2_0.js → tttx-form_1_4_0.js} +241 -142
- package/dist/components/tttx-icon.js +3 -3
- package/dist/components/{tttx-list_1_2_0.d.ts → tttx-icon_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-icon_1_2_0.js → tttx-icon_1_4_0.js} +2 -2
- package/dist/components/tttx-keyvalue-block_1_4_0.d.ts +11 -0
- package/dist/components/{tttx-keyvalue-block_1_2_0.js → tttx-keyvalue-block_1_4_0.js} +5 -5
- package/dist/components/tttx-list.js +14 -7
- package/dist/components/{tttx-form_1_2_0.d.ts → tttx-list_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-list_1_2_0.js → tttx-list_1_4_0.js} +2 -2
- package/dist/components/tttx-loading-spinner_1_4_0.d.ts +11 -0
- package/dist/components/{tttx-loading-spinner_1_2_0.js → tttx-loading-spinner_1_4_0.js} +5 -5
- package/dist/components/tttx-multiselect-box_1_4_0.d.ts +11 -0
- package/dist/components/{tttx-multiselect-box_1_2_0.js → tttx-multiselect-box_1_4_0.js} +13 -13
- package/dist/components/tttx-percentage-bar_1_4_0.d.ts +11 -0
- package/dist/components/{tttx-percentage-bar_1_2_0.js → tttx-percentage-bar_1_4_0.js} +6 -6
- package/dist/components/{tttx-dialog_1_2_0.d.ts → tttx-qrcode_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-qrcode_1_2_0.js → tttx-qrcode_1_4_0.js} +5 -5
- package/dist/components/tttx-select-box.js +7 -7
- package/dist/components/tttx-select-box_1_4_0.d.ts +11 -0
- package/dist/components/{tttx-select-box_1_2_0.js → tttx-select-box_1_4_0.js} +2 -2
- package/dist/components/tttx-sorter.js +5 -5
- package/dist/components/tttx-sorter_1_4_0.d.ts +11 -0
- package/dist/components/{tttx-sorter_1_2_0.js → tttx-sorter_1_4_0.js} +2 -2
- package/dist/components/tttx-standalone-input.js +6 -6
- package/dist/components/tttx-standalone-input_1_4_0.d.ts +11 -0
- package/dist/components/{tttx-standalone-input_1_2_0.js → tttx-standalone-input_1_4_0.js} +2 -2
- package/dist/components/{tttx-tabs_1_2_0.d.ts → tttx-tabs_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-tabs_1_2_0.js → tttx-tabs_1_4_0.js} +9 -9
- package/dist/components/{tttx-tag_1_2_0.d.ts → tttx-tag_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-tag_1_2_0.js → tttx-tag_1_4_0.js} +5 -5
- package/dist/components/{tttx-checkbox_1_2_0.d.ts → tttx-textarea_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-textarea_1_2_0.js → tttx-textarea_1_4_0.js} +6 -6
- package/dist/components/tttx-toolbar.js +3 -3
- package/dist/components/{tttx-toolbar_1_2_0.d.ts → tttx-toolbar_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-toolbar_1_2_0.js → tttx-toolbar_1_4_0.js} +2 -2
- package/dist/components/{tttx-tree-view_1_2_0.d.ts → tttx-tree-view_1_4_0.d.ts} +4 -4
- package/dist/components/{tttx-tree-view_1_2_0.js → tttx-tree-view_1_4_0.js} +9 -9
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{tttx-button_1_2_0.entry.js → tttx-button_1_4_0.entry.js} +2 -2
- package/dist/esm/{tttx-checkbox-group-caption_1_2_0.entry.js → tttx-checkbox-group-caption_1_4_0.entry.js} +1 -1
- package/dist/esm/{tttx-checkbox-group-heading_1_2_0.entry.js → tttx-checkbox-group-heading_1_4_0.entry.js} +1 -1
- package/dist/esm/{tttx-checkbox-group_1_2_0.entry.js → tttx-checkbox-group_1_4_0.entry.js} +1 -1
- package/dist/esm/{tttx-checkbox_1_2_0.entry.js → tttx-checkbox_1_4_0.entry.js} +2 -2
- package/dist/esm/{tttx-data-pattern_1_2_0.entry.js → tttx-data-pattern_1_4_0.entry.js} +2 -2
- package/dist/esm/{tttx-dialog-box_1_2_0.entry.js → tttx-dialog-box_1_4_0.entry.js} +3 -3
- package/dist/esm/{tttx-dialog_1_2_0.entry.js → tttx-dialog_1_4_0.entry.js} +2 -2
- package/dist/esm/{tttx-expander_1_2_0.entry.js → tttx-expander_1_4_0.entry.js} +2 -2
- package/dist/esm/{tttx-filter_1_2_0_4.entry.js → tttx-filter_1_4_0_4.entry.js} +14 -7
- package/dist/esm/{tttx-form_1_2_0.entry.js → tttx-form_1_4_0.entry.js} +229 -134
- package/dist/esm/{tttx-icon_1_2_0.entry.js → tttx-icon_1_4_0.entry.js} +1 -1
- package/dist/esm/{tttx-keyvalue-block_1_2_0.entry.js → tttx-keyvalue-block_1_4_0.entry.js} +1 -1
- package/dist/esm/{tttx-loading-spinner_1_2_0.entry.js → tttx-loading-spinner_1_4_0.entry.js} +1 -1
- package/dist/esm/{tttx-multiselect-box_1_2_0.entry.js → tttx-multiselect-box_1_4_0.entry.js} +6 -6
- package/dist/esm/{tttx-percentage-bar_1_2_0.entry.js → tttx-percentage-bar_1_4_0.entry.js} +2 -2
- package/dist/esm/{tttx-qrcode_1_2_0.entry.js → tttx-qrcode_1_4_0.entry.js} +1 -1
- package/dist/esm/{tttx-select-box_1_2_0.entry.js → tttx-select-box_1_4_0.entry.js} +3 -3
- package/dist/esm/tttx-standalone-input_1_4_0.entry.js +90 -0
- package/dist/esm/{tttx-tabs_1_2_0.entry.js → tttx-tabs_1_4_0.entry.js} +4 -4
- package/dist/esm/{tttx-tag_1_2_0.entry.js → tttx-tag_1_4_0.entry.js} +1 -1
- package/dist/esm/{tttx-textarea_1_2_0.entry.js → tttx-textarea_1_4_0.entry.js} +2 -2
- package/dist/esm/{tttx-tree-view_1_2_0.entry.js → tttx-tree-view_1_4_0.entry.js} +3 -3
- package/dist/esm/tttx.js +1 -1
- package/dist/tttx/p-0e515960.entry.js +1 -1
- package/dist/tttx/p-0f439f10.entry.js +1 -0
- package/dist/tttx/p-1e5ff5f8.entry.js +1 -1
- package/dist/tttx/p-23f45005.entry.js +1 -1
- package/dist/tttx/p-3676cddd.entry.js +1 -0
- package/dist/tttx/p-56c8c353.entry.js +1 -1
- package/dist/tttx/p-59c7b049.entry.js +1 -1
- package/dist/tttx/p-5d2706b1.entry.js +1 -1
- package/dist/tttx/p-63ad6fb7.entry.js +1 -1
- package/dist/tttx/p-6b1c7a21.entry.js +1 -1
- package/dist/tttx/p-6deb8699.entry.js +1 -1
- package/dist/tttx/p-796f699a.entry.js +1 -1
- package/dist/tttx/p-81aaafa0.entry.js +1 -1
- package/dist/tttx/p-884f37d3.entry.js +1 -1
- package/dist/tttx/p-9434561e.entry.js +1 -1
- package/dist/tttx/p-983d63ff.entry.js +1 -1
- package/dist/tttx/p-a01e679a.entry.js +1 -1
- package/dist/tttx/p-a8e76e78.entry.js +1 -1
- package/dist/tttx/p-c170e3b8.entry.js +1 -1
- package/dist/tttx/p-ee358ce4.entry.js +1 -1
- package/dist/tttx/p-f374e293.entry.js +1 -1
- package/dist/tttx/p-f4db1cf2.entry.js +1 -1
- package/dist/tttx/p-fe967031.entry.js +1 -1
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/molecules/tttx-form/lib/timecomparatorChecks.d.ts +4 -0
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +57 -14
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +2 -2
- package/dist/types/components/molecules/tttx-textarea/tttx-textarea.d.ts +2 -2
- package/dist/types/components.d.ts +326 -304
- package/package.json +2 -1
- package/dist/cjs/tttx-standalone-input_1_2_0.cjs.entry.js +0 -94
- package/dist/components/tttx-checkbox-group-caption_1_2_0.d.ts +0 -11
- package/dist/components/tttx-checkbox-group-heading_1_2_0.d.ts +0 -11
- package/dist/components/tttx-checkbox-group_1_2_0.d.ts +0 -11
- package/dist/components/tttx-data-pattern_1_2_0.d.ts +0 -11
- package/dist/components/tttx-keyvalue-block_1_2_0.d.ts +0 -11
- package/dist/components/tttx-loading-spinner_1_2_0.d.ts +0 -11
- package/dist/components/tttx-multiselect-box_1_2_0.d.ts +0 -11
- package/dist/components/tttx-percentage-bar_1_2_0.d.ts +0 -11
- package/dist/components/tttx-select-box_1_2_0.d.ts +0 -11
- package/dist/components/tttx-sorter_1_2_0.d.ts +0 -11
- package/dist/components/tttx-standalone-input_1_2_0.d.ts +0 -11
- package/dist/esm/tttx-standalone-input_1_2_0.entry.js +0 -90
- package/dist/tttx/p-34be6c6d.entry.js +0 -1
- package/dist/tttx/p-c8589436.entry.js +0 -1
|
@@ -37,14 +37,15 @@ function validityCheck(event) {
|
|
|
37
37
|
// and cleared with
|
|
38
38
|
// target.setCustomValidity('');
|
|
39
39
|
//handle whitespace-only input
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
if (!target.hasAttribute('custom-validation-set')) {
|
|
41
|
+
if (target.value.length && !target.value.replace(/\s/g, '').length) {
|
|
42
|
+
errorMessage = 'This field cannot be left blank';
|
|
43
|
+
target.setCustomValidity(errorMessage);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
if (target.setCustomValidity) // tests are dumb as a brick
|
|
47
|
+
target.setCustomValidity('');
|
|
48
|
+
}
|
|
48
49
|
}
|
|
49
50
|
// Check the validity of the input field and set an error message if needed
|
|
50
51
|
switch (true) {
|
|
@@ -117,7 +118,6 @@ function setErrorState(target, hasError, errorMessage, parent = undefined) {
|
|
|
117
118
|
errorBubble.innerHTML = '';
|
|
118
119
|
errorBubble.append(errorIcon);
|
|
119
120
|
errorBubble.append(errorMessage);
|
|
120
|
-
// errorBubble.replaceChildren(errorIcon, errorMessage);
|
|
121
121
|
}
|
|
122
122
|
// If no error was detected, remove the "invalid" class from the input field and clear the error bubble
|
|
123
123
|
else {
|
|
@@ -127,6 +127,70 @@ function setErrorState(target, hasError, errorMessage, parent = undefined) {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
function startEndTimeComparator(event) {
|
|
131
|
+
var _a, _b;
|
|
132
|
+
const target = event.target;
|
|
133
|
+
const formKey = target.getAttribute('data-formkey');
|
|
134
|
+
const timeFields = Array.from(target.parentElement.parentElement.parentElement.querySelectorAll(`[data-formkey=${formKey}]`));
|
|
135
|
+
if (timeFields.length === 4) {
|
|
136
|
+
const startTime = timeFields.find(t => t.name.endsWith('starttime'));
|
|
137
|
+
const endTime = timeFields.find(t => t.name.endsWith('endtime'));
|
|
138
|
+
const startDate = timeFields.find(t => t.name.endsWith('startdate'));
|
|
139
|
+
const endDate = timeFields.find(t => t.name.endsWith('enddate'));
|
|
140
|
+
if (startTime.valueAsNumber >= endTime.valueAsNumber && ((_a = startDate.valueAsDate) === null || _a === void 0 ? void 0 : _a.valueOf()) === ((_b = endDate.valueAsDate) === null || _b === void 0 ? void 0 : _b.valueOf())) {
|
|
141
|
+
setErrorState(endTime, true, 'End time cannot be the same or before the start time');
|
|
142
|
+
if (target.name.endsWith('starttime')) {
|
|
143
|
+
this.validityCheckWrapper(event);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
// clear any end time comparitor errors and perform the standard validity check on the event
|
|
148
|
+
endTime.setCustomValidity('');
|
|
149
|
+
setErrorState(endTime, false, null);
|
|
150
|
+
this.validityCheckWrapper(event);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function clearTimeComparator(event) {
|
|
155
|
+
const target = event.target;
|
|
156
|
+
const formKey = target.getAttribute('data-formkey');
|
|
157
|
+
const timeFields = Array.from(target.parentElement.parentElement.parentElement.querySelectorAll(`[type=time][data-formkey=${formKey}]`));
|
|
158
|
+
if (timeFields.length) {
|
|
159
|
+
const endTime = timeFields.find(t => t.name.endsWith('endtime'));
|
|
160
|
+
endTime.setCustomValidity('');
|
|
161
|
+
setErrorState(endTime, false, null);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function endDateComparisonValidator(event, triggeredByStartDate = false) {
|
|
165
|
+
var _a, _b, _c, _d;
|
|
166
|
+
const endDate = event.target;
|
|
167
|
+
if (!endDate.value && triggeredByStartDate) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const compareWithName = endDate.getAttribute('data-compare-with');
|
|
171
|
+
const startDate = endDate.parentElement.parentElement.parentElement.querySelector(`[name=${compareWithName}]`);
|
|
172
|
+
if (((_a = endDate.valueAsDate) === null || _a === void 0 ? void 0 : _a.valueOf()) < ((_b = startDate.valueAsDate) === null || _b === void 0 ? void 0 : _b.valueOf())) {
|
|
173
|
+
endDate.setCustomValidity(endDate.getAttribute('data-compare'));
|
|
174
|
+
setErrorState(endDate, true, endDate.getAttribute('data-compare'));
|
|
175
|
+
}
|
|
176
|
+
else if (((_c = endDate.valueAsDate) === null || _c === void 0 ? void 0 : _c.valueOf()) === ((_d = startDate.valueAsDate) === null || _d === void 0 ? void 0 : _d.valueOf())) {
|
|
177
|
+
endDate.setCustomValidity('');
|
|
178
|
+
this.validityCheckWrapper(event);
|
|
179
|
+
startEndTimeComparator.bind(this)(event);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
clearTimeComparator.bind(this)(event);
|
|
183
|
+
this.validityCheckWrapper(event);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function startDateComparisonValidator(event) {
|
|
187
|
+
const startDate = event.target;
|
|
188
|
+
const compareToName = startDate.getAttribute('data-compare-to');
|
|
189
|
+
const endDate = startDate.parentElement.parentElement.parentElement.querySelector(`[name=${compareToName}]`);
|
|
190
|
+
endDateComparisonValidator.bind(this)({ target: endDate }, true);
|
|
191
|
+
this.validityCheckWrapper(event);
|
|
192
|
+
}
|
|
193
|
+
|
|
130
194
|
const tttxFormCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}label{font-weight:500;font-size:16px;line-height:18.752px;color:#212121}label .optional{color:#757575;font-weight:normal}label .outer-container{position:relative}label .outer-container .left-icons,label .outer-container .right-icons{display:flex;position:absolute;height:24px;gap:8px}label .outer-container .left-icons tttx-icon,label .outer-container .right-icons tttx-icon{height:24px;width:24px}label .outer-container .left-icons{left:8px}label .outer-container .right-icons{right:8px}label .outer-container input,label .outer-container textarea{color:#212121;box-sizing:border-box;border:1px solid #d5d5d5;border-radius:4px;padding:0;padding-left:16px;padding-right:16px;margin-top:4px;}label .outer-container input.has-input-icon,label .outer-container textarea.has-input-icon{padding-left:40px}label .outer-container input.has-input-icon.has-left-icon,label .outer-container textarea.has-input-icon.has-left-icon{padding-left:72px}label .outer-container input.has-left-icon,label .outer-container textarea.has-left-icon{padding-left:40px}label .outer-container input.has-right-icon,label .outer-container textarea.has-right-icon{padding-right:40px}label .outer-container input.invalid,label .outer-container textarea.invalid{border:1px solid #dc0000}label .outer-container input:not([type=submit]),label .outer-container textarea:not([type=submit]){font-family:\"Roboto\", serif;width:100%;height:36px;font-size:16px;line-height:18.752px}label .outer-container input[type=radio],label .outer-container textarea[type=radio]{width:20px;height:20px}label .outer-container input[type=date],label .outer-container textarea[type=date]{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}label .outer-container input[readonly],label .outer-container textarea[readonly]{cursor:default;pointer-events:none;user-select:none;color:gray}label .outer-container input:focus,label .outer-container textarea:focus{border-color:#1479c6}label .outer-container input:focus-visible,label .outer-container textarea:focus-visible{outline:none}label .outer-container textarea{padding:8px;height:auto;min-height:100px;resize:vertical}label .outer-container.inputBlock{display:flex;align-items:center;line-height:21px}label .outer-container.inputBlock .left-icons,label .outer-container.inputBlock .right-icons{margin-top:4px}label .outer-container.inputBlock.readonly{pointer-events:none;user-select:none;color:gray}label .outer-container.inputBlock.radioBlock{display:block}label .outer-container.inputInline{display:flex;white-space:nowrap;align-items:center;margin:0}label .outer-container.inputInline input{margin-top:0}label .secondarylabel{color:#757575;font-size:14px;line-height:16.408px;font-weight:normal;display:flex;margin-top:4px}label .errorBubble{position:relative;font-size:14px;line-height:16.408px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center;margin-top:4px}label .errorBubble:not(.visible){display:none}label .errorBubble span{color:#dc0000;font-size:16px;margin-right:4px}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}button{cursor:pointer}.button{font-family:Roboto, serif;box-sizing:border-box;height:36px;min-width:36px;padding:0;margin:0;background:transparent;color:#212121;border:1px solid #c8c8c8;border-radius:4px;text-transform:uppercase;display:flex;justify-content:left;align-items:center;font-size:14px;font-weight:500}.button-content{display:block;padding:0 16px}.icon-left,.icon-right{margin-top:4px}.iconleft{padding-left:8px}.iconleft .button-content{padding-left:4px}.iconright{padding-right:8px}.iconright .button-content{padding-right:4px}.notext{padding:0 6px}.button:active{background:rgba(17, 17, 17, 0.2);border:1px solid #d5d5d5}.primary{background:#1479c6;border:1px solid #1479c6;color:white}.primary:active{background:#1464a2;border:1px solid #1464a2}.borderless{background:transparent;border:none;color:#212121}.borderless:active{background:rgba(17, 17, 17, 0.2);border:none}.borderless-circle{background:transparent;border:none;color:#212121;border-radius:50%}.borderless-circle:active{border:none}.borderless-circle:focus{border-color:transparent}.danger{background:#dc0000;border:1px solid #dc0000;color:white}.danger:active{background:#b00000;border:1px solid #b00000}.disabled{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}.disabled:active{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}@media (hover: hover){.button:hover{background:rgba(17, 17, 17, 0.1);border:1px solid #d5d5d5}.primary:hover{background:#146eb3;border:1px solid #146eb3}.borderless:hover{background:rgba(17, 17, 17, 0.1);border:none}.borderless-circle:hover{background:rgba(17, 17, 17, 0.1);border:none}.danger:hover{background:#c60000;border:1px solid #c60000}.disabled:hover{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}}:host{display:block}fieldset{margin:0;padding:0;border:none}label{display:block;position:relative;margin-bottom:16px}.inlineLabel{font-weight:400;display:inline-block;vertical-align:top;padding-top:4px}input[type=checkbox]{width:18px;height:18px}input~label{font-weight:400}select{font-family:\"Roboto\", serif;box-sizing:border-box;width:100%;height:36px;padding:0 16px;font-size:16px;border:1px solid #d5d5d5;border-radius:4px;margin-top:4px}.placeholder{color:#9e9e9e}.placeholder option{color:initial}select.invalid:invalid{border:1px solid #dc0000}select~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center}select~.errorBubble:not(.visible){visibility:hidden}select~.errorBubble span{color:#dc0000;font-size:16px;margin-right:4px;height:16px}select.invalid:invalid~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:\"Roboto\", sans-serif;color:#dc0000;visibility:visible}select:focus{border-color:#1479c6}select:focus-visible{outline:none}.button{padding:0 16px}.footer{display:flex;gap:16px;flex-direction:row-reverse}label.flex-label{display:flex;flex-direction:column;width:346px;box-sizing:border-box}label>.outer-container>input[type=date]{min-width:0;width:200px}label.flex-label input[type=time]{min-width:auto;text-align:center;width:130px;margin-left:16px}label>.outer-container>input[type=date],label.flex-label input[type=time]{line-height:36px}";
|
|
131
195
|
|
|
132
196
|
const TttxForm = class {
|
|
@@ -141,13 +205,6 @@ const TttxForm = class {
|
|
|
141
205
|
}
|
|
142
206
|
// This method is called whenever the "formschema" property changes
|
|
143
207
|
onFormSchemaChange(newValue) {
|
|
144
|
-
// If the formSchema changes and the form data is uncontrolled, store the data since the fields will be removed to avoid form duplication
|
|
145
|
-
if (!this.data && this.form && this._formSchema) {
|
|
146
|
-
const formData = new FormData(this.form);
|
|
147
|
-
this._data = Object.fromEntries(Object.keys(this._formSchema.properties).map(formKey => {
|
|
148
|
-
return [formKey, formData.get(formKey)];
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
208
|
// Check if the new value is a string, indicating that it needs to be parsed
|
|
152
209
|
if (typeof newValue === 'string') {
|
|
153
210
|
// Parse the string and set the "_formSchema" property
|
|
@@ -157,6 +214,7 @@ const TttxForm = class {
|
|
|
157
214
|
// If the new value is already an object, set the "_formSchema" property directly
|
|
158
215
|
this._formSchema = newValue;
|
|
159
216
|
}
|
|
217
|
+
return this._formSchema;
|
|
160
218
|
}
|
|
161
219
|
onDataChange(newValue) {
|
|
162
220
|
if (typeof newValue === 'string') {
|
|
@@ -165,6 +223,7 @@ const TttxForm = class {
|
|
|
165
223
|
else {
|
|
166
224
|
this._data = newValue;
|
|
167
225
|
}
|
|
226
|
+
return this._data;
|
|
168
227
|
}
|
|
169
228
|
/**
|
|
170
229
|
* Handles the focus event for a form field and emits a "dataChanged" event
|
|
@@ -204,7 +263,6 @@ const TttxForm = class {
|
|
|
204
263
|
}
|
|
205
264
|
select.replaceChildren(fragment);
|
|
206
265
|
tttxSelect.optionsData = options;
|
|
207
|
-
//await tttxSelect.setOptionsData(options);
|
|
208
266
|
await tttxSelect.setSelectedItem(options[0].value);
|
|
209
267
|
}
|
|
210
268
|
/**
|
|
@@ -216,6 +274,10 @@ const TttxForm = class {
|
|
|
216
274
|
doSubmit(event) {
|
|
217
275
|
// prevent the form from submitting normally
|
|
218
276
|
event.preventDefault();
|
|
277
|
+
const allElements = this.fieldset.querySelectorAll('[custom-validation-set=true]');
|
|
278
|
+
if (allElements.length) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
219
281
|
// create a new FormData object with the form data
|
|
220
282
|
const formData = new FormData(event.target);
|
|
221
283
|
// get a list of checkboxes, if any, so we can manually set unchecked box data
|
|
@@ -262,9 +324,10 @@ const TttxForm = class {
|
|
|
262
324
|
formProperties.options.forEach(optionProperties => {
|
|
263
325
|
this.appendOption(select, optionProperties);
|
|
264
326
|
});
|
|
265
|
-
if ((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey])
|
|
327
|
+
if ((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey]) {
|
|
266
328
|
select.classList.remove('placeholder');
|
|
267
|
-
|
|
329
|
+
}
|
|
330
|
+
const tttxSelect = document.createElement('tttx-select-box_1_4_0');
|
|
268
331
|
tttxSelect.optionsData = (_b = formProperties.options) === null || _b === void 0 ? void 0 : _b.filter(o => !o.placeholder);
|
|
269
332
|
tttxSelect.placeholder = (_d = (_c = formProperties.options) === null || _c === void 0 ? void 0 : _c.filter(o => o.placeholder)[0]) === null || _d === void 0 ? void 0 : _d.label;
|
|
270
333
|
tttxSelect.inline = false;
|
|
@@ -275,13 +338,18 @@ const TttxForm = class {
|
|
|
275
338
|
const fragment = document.createDocumentFragment();
|
|
276
339
|
fragment.append(tttxSelect);
|
|
277
340
|
select.style.display = 'none';
|
|
278
|
-
tttxSelect.addEventListener('selectItemEvent',
|
|
279
|
-
select.value = ev.detail.value;
|
|
280
|
-
select.onblur({ target: select }); // triggers validator
|
|
281
|
-
select.onchange({ target: select }); // triggers dataChanged event
|
|
282
|
-
});
|
|
341
|
+
tttxSelect.addEventListener('selectItemEvent', this.selectItemEventCallback.bind(select));
|
|
283
342
|
return { input: select, overlay: fragment };
|
|
284
343
|
}
|
|
344
|
+
selectItemEventCallback(ev) {
|
|
345
|
+
// this function MUST be bound to a HTMLSelectElement
|
|
346
|
+
// 'this' will be the select element
|
|
347
|
+
// the function was split out for testing
|
|
348
|
+
const select = this;
|
|
349
|
+
select.value = ev.detail.value;
|
|
350
|
+
select.onblur({ target: select }); // triggers validator
|
|
351
|
+
select.onchange({ target: select }); // triggers dataChanged event
|
|
352
|
+
}
|
|
285
353
|
/**
|
|
286
354
|
* Appends an option to a select element
|
|
287
355
|
*
|
|
@@ -512,7 +580,7 @@ const TttxForm = class {
|
|
|
512
580
|
* @param {HTMLDivElement} errorBubble - The error bubble element to display error messages in.
|
|
513
581
|
* @return {HTMLLabelElement} - The new label element.
|
|
514
582
|
*/
|
|
515
|
-
createLabel(formProperties, input, overlay, errorBubble) {
|
|
583
|
+
createLabel(formProperties, input, overlay = null, errorBubble) {
|
|
516
584
|
var _a;
|
|
517
585
|
const outerContainer = document.createElement('div');
|
|
518
586
|
let outerContainerClassName = 'outer-container inputBlock';
|
|
@@ -563,7 +631,7 @@ const TttxForm = class {
|
|
|
563
631
|
*/
|
|
564
632
|
createRadio(formKey, formProperties) {
|
|
565
633
|
var _a, _b;
|
|
566
|
-
const fragment =
|
|
634
|
+
const fragment = document.createDocumentFragment();
|
|
567
635
|
for (const optionProperties of formProperties.options) {
|
|
568
636
|
// Create a new <input> element with the specified name and type
|
|
569
637
|
const input = document.createElement('input');
|
|
@@ -593,8 +661,9 @@ const TttxForm = class {
|
|
|
593
661
|
populateFormFromSchema() {
|
|
594
662
|
var _a;
|
|
595
663
|
// If there is no form schema, return early
|
|
596
|
-
if (!this._formSchema)
|
|
664
|
+
if (!this._formSchema) {
|
|
597
665
|
return;
|
|
666
|
+
}
|
|
598
667
|
// Get the properties of the form schema and their keys
|
|
599
668
|
const properties = this._formSchema.properties;
|
|
600
669
|
const propertyKeys = Object.keys(properties);
|
|
@@ -662,128 +731,154 @@ const TttxForm = class {
|
|
|
662
731
|
const properties = this._formSchema.properties;
|
|
663
732
|
const propertyKeys = Object.keys(properties);
|
|
664
733
|
for (const formKey of propertyKeys) {
|
|
665
|
-
|
|
666
|
-
for (const formInput of formItemsByKey) {
|
|
667
|
-
// Bind events to form input elements
|
|
668
|
-
formInput.oninvalid = this.validityCheckWrapper.bind(this);
|
|
669
|
-
formInput.onblur = this.validityCheckWrapper.bind(this);
|
|
670
|
-
formInput.onkeyup = this.fieldChanged.bind(this);
|
|
671
|
-
formInput.onchange = this.fieldChanged.bind(this);
|
|
672
|
-
if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
|
|
673
|
-
formInput.addEventListener('change', () => {
|
|
674
|
-
formInput.classList.remove('placeholder');
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-with')) {
|
|
678
|
-
formInput.oninvalid = this.endDateComparisonValidator.bind(this);
|
|
679
|
-
formInput.onblur = this.endDateComparisonValidator.bind(this);
|
|
680
|
-
}
|
|
681
|
-
if (properties[formKey].form.type === 'startenddate' && formInput.type === 'time') {
|
|
682
|
-
formInput.oninvalid = this.startEndTimeComparitor.bind(this);
|
|
683
|
-
formInput.onblur = this.startEndTimeComparitor.bind(this);
|
|
684
|
-
}
|
|
685
|
-
if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-to')) {
|
|
686
|
-
formInput.oninvalid = this.startDateComparisonValidator.bind(this);
|
|
687
|
-
formInput.onblur = this.startDateComparisonValidator.bind(this);
|
|
688
|
-
}
|
|
689
|
-
}
|
|
734
|
+
this.applyValidationFunctionsToFormElement(formItems, formKey, properties);
|
|
690
735
|
}
|
|
691
736
|
// populate with existing form data if available
|
|
692
|
-
if (this._data && Object.keys(this._data).length > 0) {
|
|
693
|
-
|
|
694
|
-
for (const key of dataKeys) {
|
|
695
|
-
const formItemsByKey = formItems.querySelectorAll(`[name=${key}]`);
|
|
696
|
-
for (const formItem of formItemsByKey) {
|
|
697
|
-
switch (formItem.type) {
|
|
698
|
-
case 'checkbox':
|
|
699
|
-
if (this._data[key] === 'on') {
|
|
700
|
-
formItem.checked = true;
|
|
701
|
-
}
|
|
702
|
-
break;
|
|
703
|
-
case 'radio':
|
|
704
|
-
if (formItem.value === this._data[key]) {
|
|
705
|
-
formItem.checked = true;
|
|
706
|
-
}
|
|
707
|
-
break;
|
|
708
|
-
case 'select':
|
|
709
|
-
case 'select-one':
|
|
710
|
-
formItems.querySelector(`[name=overlay-${key}]`).selectedValue = this._data[key];
|
|
711
|
-
formItem.value = this._data[key];
|
|
712
|
-
break;
|
|
713
|
-
default:
|
|
714
|
-
formItem.value = this._data[key];
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
}
|
|
737
|
+
if ((this._data && Object.keys(this._data).length > 0)) {
|
|
738
|
+
this.populateFormWithExistingData(formItems);
|
|
718
739
|
}
|
|
719
740
|
// Append the cloned form elements to the fieldset
|
|
720
741
|
this.fieldset.replaceChildren(formItems);
|
|
721
742
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
743
|
+
/**
|
|
744
|
+
* Assign validation events to a given form item
|
|
745
|
+
* @param formItems The document fragment template of form items to be rendered
|
|
746
|
+
* @param formKey The key of the form item to bind events too
|
|
747
|
+
* @param properties The form item's properties, such as type and name
|
|
748
|
+
*/
|
|
749
|
+
applyValidationFunctionsToFormElement(formItems, formKey, properties) {
|
|
750
|
+
const formItemsByKey = formItems.querySelectorAll(`[name^=${formKey}]`);
|
|
751
|
+
for (const formInput of formItemsByKey) {
|
|
752
|
+
// Bind events to form input elements
|
|
753
|
+
formInput.oninvalid = this.validityCheckWrapper.bind(this);
|
|
754
|
+
formInput.onblur = this.validityCheckWrapper.bind(this);
|
|
755
|
+
formInput.onkeyup = this.fieldChanged.bind(this);
|
|
756
|
+
formInput.onchange = this.fieldChanged.bind(this);
|
|
757
|
+
if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
|
|
758
|
+
formInput.addEventListener('change', this.selectRemovePlaceholderCallback.bind(formInput));
|
|
737
759
|
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
760
|
+
if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-with')) {
|
|
761
|
+
formInput.oninvalid = endDateComparisonValidator.bind(this);
|
|
762
|
+
formInput.onblur = endDateComparisonValidator.bind(this);
|
|
763
|
+
}
|
|
764
|
+
if (properties[formKey].form.type === 'startenddate' && formInput.type === 'time') {
|
|
765
|
+
formInput.oninvalid = startEndTimeComparator.bind(this);
|
|
766
|
+
formInput.onblur = startEndTimeComparator.bind(this);
|
|
767
|
+
}
|
|
768
|
+
if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-to')) {
|
|
769
|
+
formInput.oninvalid = startDateComparisonValidator.bind(this);
|
|
770
|
+
formInput.onblur = startDateComparisonValidator.bind(this);
|
|
743
771
|
}
|
|
744
772
|
}
|
|
745
773
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
774
|
+
/**
|
|
775
|
+
* If data exists, set form input values before rendering
|
|
776
|
+
* @param formItems The document fragment template of form items to be rendered
|
|
777
|
+
*/
|
|
778
|
+
populateFormWithExistingData(formItems) {
|
|
779
|
+
const dataKeys = Object.keys(this._data);
|
|
780
|
+
for (const key of dataKeys) {
|
|
781
|
+
const formItemsByKey = formItems.querySelectorAll(`[name=${key}]`);
|
|
782
|
+
for (const formItem of formItemsByKey) {
|
|
783
|
+
switch (formItem.type) {
|
|
784
|
+
case 'checkbox':
|
|
785
|
+
if (this._data[key] === 'on') {
|
|
786
|
+
formItem.checked = true;
|
|
787
|
+
}
|
|
788
|
+
break;
|
|
789
|
+
case 'radio':
|
|
790
|
+
if (formItem.value === this._data[key]) {
|
|
791
|
+
formItem.checked = true;
|
|
792
|
+
}
|
|
793
|
+
break;
|
|
794
|
+
case 'select':
|
|
795
|
+
case 'select-one':
|
|
796
|
+
formItems.querySelector(`[name=overlay-${key}]`)['selectedValue'] = this._data[key];
|
|
797
|
+
formItem.value = this._data[key];
|
|
798
|
+
break;
|
|
799
|
+
default:
|
|
800
|
+
formItem.value = this._data[key];
|
|
801
|
+
}
|
|
802
|
+
}
|
|
754
803
|
}
|
|
755
804
|
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
805
|
+
/**
|
|
806
|
+
* Remove the placeholder class on the bound THIS select element
|
|
807
|
+
*/
|
|
808
|
+
selectRemovePlaceholderCallback() {
|
|
809
|
+
const select = this;
|
|
810
|
+
select.classList.remove('placeholder');
|
|
762
811
|
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
812
|
+
/**
|
|
813
|
+
* A wrapper around validity check and set error state
|
|
814
|
+
*/
|
|
815
|
+
validityCheckWrapper(event) {
|
|
816
|
+
const { target, hasError, errorMessage } = validityCheck(event);
|
|
817
|
+
setErrorState(target, hasError, errorMessage);
|
|
818
|
+
}
|
|
819
|
+
assignFieldsetReference(el) {
|
|
820
|
+
this.fieldset = el;
|
|
821
|
+
}
|
|
822
|
+
assignButtonReference(el) {
|
|
823
|
+
this.submitButton = el;
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* An external validation trigger to apply to a form field
|
|
827
|
+
* @param { string } fieldName The form field name to apply the validation too
|
|
828
|
+
* @param { string } message The validation message to display under the form field
|
|
829
|
+
*/
|
|
830
|
+
async setValidationFor(fieldName, message) {
|
|
831
|
+
const formField = this.fieldset.querySelector(`[name=${fieldName}]`);
|
|
832
|
+
if (formField.disabled) {
|
|
767
833
|
return;
|
|
768
|
-
const compareWithName = endDate.getAttribute('data-compare-with');
|
|
769
|
-
const startDate = endDate.parentElement.parentElement.parentElement.querySelector(`[name=${compareWithName}]`);
|
|
770
|
-
if (((_a = endDate.valueAsDate) === null || _a === void 0 ? void 0 : _a.valueOf()) < ((_b = startDate.valueAsDate) === null || _b === void 0 ? void 0 : _b.valueOf())) {
|
|
771
|
-
endDate.setCustomValidity(endDate.getAttribute('data-compare'));
|
|
772
|
-
setErrorState(endDate, true, endDate.getAttribute('data-compare'));
|
|
773
|
-
}
|
|
774
|
-
else if (((_c = endDate.valueAsDate) === null || _c === void 0 ? void 0 : _c.valueOf()) === ((_d = startDate.valueAsDate) === null || _d === void 0 ? void 0 : _d.valueOf())) {
|
|
775
|
-
endDate.setCustomValidity('');
|
|
776
|
-
this.validityCheckWrapper(event);
|
|
777
|
-
this.startEndTimeComparitor(event);
|
|
778
834
|
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
835
|
+
formField.setCustomValidity(message);
|
|
836
|
+
formField.setAttribute('custom-validation-set', 'true');
|
|
837
|
+
setErrorState(formField, true, message);
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* Clear the validation message on a given form field
|
|
841
|
+
* @param { string } fieldName The form field name to clear the validation of
|
|
842
|
+
*/
|
|
843
|
+
async clearValidationFor(fieldName) {
|
|
844
|
+
const formField = this.fieldset.querySelector(`[name=${fieldName}]`);
|
|
845
|
+
formField.setCustomValidity('');
|
|
846
|
+
formField.removeAttribute('custom-validation-set');
|
|
847
|
+
setErrorState(formField, false, '');
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Disable a form field and visually remove it from the form.
|
|
851
|
+
* If custom validation is set, this function will return without affecting the form field.
|
|
852
|
+
* @param { string } fieldName The form field name to disable
|
|
853
|
+
*/
|
|
854
|
+
async disableFormField(fieldName) {
|
|
855
|
+
const formField = this.fieldset.querySelector(`[name=${fieldName}]`);
|
|
856
|
+
if (formField.hasAttribute('custom-validation-set')) {
|
|
857
|
+
return;
|
|
782
858
|
}
|
|
859
|
+
formField.disabled = true;
|
|
860
|
+
let parent = formField.parentElement;
|
|
861
|
+
do {
|
|
862
|
+
if (parent.nodeName !== 'LABEL') {
|
|
863
|
+
parent = parent.parentElement;
|
|
864
|
+
}
|
|
865
|
+
} while (parent.nodeName !== 'LABEL');
|
|
866
|
+
parent.style.display = 'none';
|
|
783
867
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
868
|
+
/**
|
|
869
|
+
* Enable a form field and visually add it back to the form.
|
|
870
|
+
* @param { string } fieldName The form field name to enable
|
|
871
|
+
*/
|
|
872
|
+
async enableFormField(fieldName) {
|
|
873
|
+
const formField = this.fieldset.querySelector(`[name=${fieldName}]`);
|
|
874
|
+
formField.disabled = false;
|
|
875
|
+
let parent = formField.parentElement;
|
|
876
|
+
do {
|
|
877
|
+
if (parent.nodeName !== 'LABEL') {
|
|
878
|
+
parent = parent.parentElement;
|
|
879
|
+
}
|
|
880
|
+
} while (parent.nodeName !== 'LABEL');
|
|
881
|
+
parent.style.display = 'block';
|
|
787
882
|
}
|
|
788
883
|
/**
|
|
789
884
|
* Renders the component's template as a form element with a fieldset container. The form's
|
|
@@ -793,7 +888,7 @@ const TttxForm = class {
|
|
|
793
888
|
* later on.
|
|
794
889
|
*/
|
|
795
890
|
render() {
|
|
796
|
-
return (h(Host, null, h("form", {
|
|
891
|
+
return (h(Host, null, h("form", { onSubmit: this.doSubmit.bind(this) }, h("fieldset", { ref: this.assignFieldsetReference.bind(this) }), h("input", { type: "submit", ref: this.assignButtonReference.bind(this), style: { display: 'none' } }))));
|
|
797
892
|
}
|
|
798
893
|
static get watchers() { return {
|
|
799
894
|
"formschema": ["onFormSchemaChange"],
|
|
@@ -802,4 +897,4 @@ const TttxForm = class {
|
|
|
802
897
|
};
|
|
803
898
|
TttxForm.style = tttxFormCss;
|
|
804
899
|
|
|
805
|
-
export { TttxForm as
|
|
900
|
+
export { TttxForm as tttx_form_1_4_0 };
|
package/dist/esm/{tttx-multiselect-box_1_2_0.entry.js → tttx-multiselect-box_1_4_0.entry.js}
RENAMED
|
@@ -84,11 +84,11 @@ const TttxMultiselectBox = class {
|
|
|
84
84
|
const sanitisedHTML = purify.sanitize(option.html, domSanitiserOptions);
|
|
85
85
|
// This is tested in e2e tests
|
|
86
86
|
/* istanbul ignore next */
|
|
87
|
-
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${option.selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, h("tttx-
|
|
87
|
+
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${option.selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, h("tttx-icon_1_4_0", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), h("div", { innerHTML: sanitisedHTML })));
|
|
88
88
|
}
|
|
89
89
|
// This is tested in e2e tests
|
|
90
90
|
/* istanbul ignore next */
|
|
91
|
-
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${option.selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, h("tttx-
|
|
91
|
+
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${option.selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, h("tttx-icon_1_4_0", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), h("div", { class: "plaintext-option" }, option.label)));
|
|
92
92
|
}
|
|
93
93
|
// This is tested in e2e tests
|
|
94
94
|
/* istanbul ignore next */
|
|
@@ -120,11 +120,11 @@ const TttxMultiselectBox = class {
|
|
|
120
120
|
if (!this.unsavedSelectedItems)
|
|
121
121
|
this.unsavedSelectedItems = this.safelyCloneArray(this._optionsData);
|
|
122
122
|
const chevronIcon = this.open ? 'expand_less' : 'expand_more';
|
|
123
|
-
return (h(Host, { class: this.inline ? 'inline' : 'block' }, this.label && h("div", { class: "label" }, this.label), h("div", { tabindex: "0", class: "dropdown-container" }, h("div", { class: "dropdown-selector", onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent(), h("div", { class: "dropdown-selector-chevron" }, h("tttx-
|
|
123
|
+
return (h(Host, { class: this.inline ? 'inline' : 'block' }, this.label && h("div", { class: "label" }, this.label), h("div", { tabindex: "0", class: "dropdown-container" }, h("div", { class: "dropdown-selector", onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent(), h("div", { class: "dropdown-selector-chevron" }, h("tttx-icon_1_4_0", { icon: chevronIcon, color: "black" }))), this.open && (h("div", { class: "dropdown-body-container" }, h("div", { class: "dropdown-body", style: Object.assign({}, this.bodyOffset) }, this.searchEnabled &&
|
|
124
124
|
/* istanbul ignore next */
|
|
125
|
-
h("div", { class: "searchbox" }, h("tttx-standalone-
|
|
125
|
+
h("div", { class: "searchbox" }, h("tttx-standalone-input_1_4_0", { type: "text", placeholder: 'Search', label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this), inline: true })), h("div", { class: "dropdown-options-list" }, this.unsavedSelectedItems.map((option) => {
|
|
126
126
|
return this.dropdownOption(option);
|
|
127
|
-
})), h("div", { class: 'footer' }, h("tttx-
|
|
127
|
+
})), h("div", { class: 'footer' }, h("tttx-button_1_4_0", { design: "primary", onClick: this.applyChanges.bind(this) }, "Apply"), h("tttx-button_1_4_0", { onClick: this.onCancel.bind(this) }, "Cancel"))))))));
|
|
128
128
|
}
|
|
129
129
|
get el() { return getElement(this); }
|
|
130
130
|
static get watchers() { return {
|
|
@@ -133,4 +133,4 @@ const TttxMultiselectBox = class {
|
|
|
133
133
|
};
|
|
134
134
|
TttxMultiselectBox.style = tttxMultiselectBoxCss;
|
|
135
135
|
|
|
136
|
-
export { TttxMultiselectBox as
|
|
136
|
+
export { TttxMultiselectBox as tttx_multiselect_box_1_4_0 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host } from './index-88bd2f60.js';
|
|
2
2
|
|
|
3
|
-
const tttxPercentageBarCss = ".sc-tttx-percentage-
|
|
3
|
+
const tttxPercentageBarCss = ".sc-tttx-percentage-bar_1_4_0-h{display:block}.progress.sc-tttx-percentage-bar_1_4_0{width:100%;background-color:#dbdbdb}.progress.sc-tttx-percentage-bar_1_4_0 .bar.sc-tttx-percentage-bar_1_4_0{height:20px}";
|
|
4
4
|
|
|
5
5
|
const TttxPercentageBar = class {
|
|
6
6
|
constructor(hostRef) {
|
|
@@ -58,4 +58,4 @@ const TttxPercentageBar = class {
|
|
|
58
58
|
};
|
|
59
59
|
TttxPercentageBar.style = tttxPercentageBarCss;
|
|
60
60
|
|
|
61
|
-
export { TttxPercentageBar as
|
|
61
|
+
export { TttxPercentageBar as tttx_percentage_bar_1_4_0 };
|
|
@@ -61,7 +61,7 @@ const TttxSelectBox = class {
|
|
|
61
61
|
let title;
|
|
62
62
|
let subtitle;
|
|
63
63
|
const chevronIcon = this.open ? 'expand_less' : 'expand_more';
|
|
64
|
-
const icon = h("tttx-
|
|
64
|
+
const icon = h("tttx-icon_1_4_0", { icon: chevronIcon, color: "black" });
|
|
65
65
|
let chevron = h("div", { class: 'dropdown-selector-chevron' }, icon);
|
|
66
66
|
if (!this.selectedItem) {
|
|
67
67
|
title = h("div", { class: "placeholder" }, this.placeholder);
|
|
@@ -120,7 +120,7 @@ const TttxSelectBox = class {
|
|
|
120
120
|
return;
|
|
121
121
|
return (h(Host, { class: this.inline ? 'inline' : 'block' }, this.label && h("div", { class: "label" }, this.label), h("div", { tabindex: "0", class: "dropdown-container" }, h("div", { class: "dropdown-selector", ref: (el) => this.dropdownSelector = el, onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent()), this.open && (h("div", { class: "dropdown-body-container" }, h("div", { class: "dropdown-body", style: Object.assign({ width: `${this.dropdownSelector.offsetWidth}px` }, this.bodyOffset) }, this.searchEnabled &&
|
|
122
122
|
/* istanbul ignore next */
|
|
123
|
-
h("div", { class: "searchbox" }, h("tttx-standalone-
|
|
123
|
+
h("div", { class: "searchbox" }, h("tttx-standalone-input_1_4_0", { type: "text", label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this) })), h("div", { class: "dropdown-options-list" }, this._optionsData.map((option) => {
|
|
124
124
|
return this.dropdownOption(option);
|
|
125
125
|
}))))))));
|
|
126
126
|
}
|
|
@@ -131,4 +131,4 @@ const TttxSelectBox = class {
|
|
|
131
131
|
};
|
|
132
132
|
TttxSelectBox.style = tttxSelectBoxCss;
|
|
133
133
|
|
|
134
|
-
export { TttxSelectBox as
|
|
134
|
+
export { TttxSelectBox as tttx_select_box_1_4_0 };
|