@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
|
@@ -3,6 +3,7 @@ import * as DOMPurify from 'dompurify';
|
|
|
3
3
|
import domSanitiserOptions from '../../../shared/domsanitiser.options';
|
|
4
4
|
import validityCheck from './lib/validityCheck';
|
|
5
5
|
import setErrorState from './lib/setErrorState';
|
|
6
|
+
import { endDateComparisonValidator, startEndTimeComparator, startDateComparisonValidator } from './lib/timecomparatorChecks';
|
|
6
7
|
export class TttxForm {
|
|
7
8
|
constructor() {
|
|
8
9
|
// Create a new template element using the HTMLTemplateElement interface.
|
|
@@ -12,13 +13,6 @@ export class TttxForm {
|
|
|
12
13
|
}
|
|
13
14
|
// This method is called whenever the "formschema" property changes
|
|
14
15
|
onFormSchemaChange(newValue) {
|
|
15
|
-
// If the formSchema changes and the form data is uncontrolled, store the data since the fields will be removed to avoid form duplication
|
|
16
|
-
if (!this.data && this.form && this._formSchema) {
|
|
17
|
-
const formData = new FormData(this.form);
|
|
18
|
-
this._data = Object.fromEntries(Object.keys(this._formSchema.properties).map(formKey => {
|
|
19
|
-
return [formKey, formData.get(formKey)];
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
16
|
// Check if the new value is a string, indicating that it needs to be parsed
|
|
23
17
|
if (typeof newValue === 'string') {
|
|
24
18
|
// Parse the string and set the "_formSchema" property
|
|
@@ -28,6 +22,7 @@ export class TttxForm {
|
|
|
28
22
|
// If the new value is already an object, set the "_formSchema" property directly
|
|
29
23
|
this._formSchema = newValue;
|
|
30
24
|
}
|
|
25
|
+
return this._formSchema;
|
|
31
26
|
}
|
|
32
27
|
onDataChange(newValue) {
|
|
33
28
|
if (typeof newValue === 'string') {
|
|
@@ -36,6 +31,7 @@ export class TttxForm {
|
|
|
36
31
|
else {
|
|
37
32
|
this._data = newValue;
|
|
38
33
|
}
|
|
34
|
+
return this._data;
|
|
39
35
|
}
|
|
40
36
|
/**
|
|
41
37
|
* Handles the focus event for a form field and emits a "dataChanged" event
|
|
@@ -75,7 +71,6 @@ export class TttxForm {
|
|
|
75
71
|
}
|
|
76
72
|
select.replaceChildren(fragment);
|
|
77
73
|
tttxSelect.optionsData = options;
|
|
78
|
-
//await tttxSelect.setOptionsData(options);
|
|
79
74
|
await tttxSelect.setSelectedItem(options[0].value);
|
|
80
75
|
}
|
|
81
76
|
/**
|
|
@@ -87,6 +82,10 @@ export class TttxForm {
|
|
|
87
82
|
doSubmit(event) {
|
|
88
83
|
// prevent the form from submitting normally
|
|
89
84
|
event.preventDefault();
|
|
85
|
+
const allElements = this.fieldset.querySelectorAll('[custom-validation-set=true]');
|
|
86
|
+
if (allElements.length) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
90
89
|
// create a new FormData object with the form data
|
|
91
90
|
const formData = new FormData(event.target);
|
|
92
91
|
// get a list of checkboxes, if any, so we can manually set unchecked box data
|
|
@@ -133,9 +132,10 @@ export class TttxForm {
|
|
|
133
132
|
formProperties.options.forEach(optionProperties => {
|
|
134
133
|
this.appendOption(select, optionProperties);
|
|
135
134
|
});
|
|
136
|
-
if ((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey])
|
|
135
|
+
if ((_a = this._data) === null || _a === void 0 ? void 0 : _a[formKey]) {
|
|
137
136
|
select.classList.remove('placeholder');
|
|
138
|
-
|
|
137
|
+
}
|
|
138
|
+
const tttxSelect = document.createElement('tttx-select-box_1_4_0');
|
|
139
139
|
tttxSelect.optionsData = (_b = formProperties.options) === null || _b === void 0 ? void 0 : _b.filter(o => !o.placeholder);
|
|
140
140
|
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;
|
|
141
141
|
tttxSelect.inline = false;
|
|
@@ -146,13 +146,18 @@ export class TttxForm {
|
|
|
146
146
|
const fragment = document.createDocumentFragment();
|
|
147
147
|
fragment.append(tttxSelect);
|
|
148
148
|
select.style.display = 'none';
|
|
149
|
-
tttxSelect.addEventListener('selectItemEvent',
|
|
150
|
-
select.value = ev.detail.value;
|
|
151
|
-
select.onblur({ target: select }); // triggers validator
|
|
152
|
-
select.onchange({ target: select }); // triggers dataChanged event
|
|
153
|
-
});
|
|
149
|
+
tttxSelect.addEventListener('selectItemEvent', this.selectItemEventCallback.bind(select));
|
|
154
150
|
return { input: select, overlay: fragment };
|
|
155
151
|
}
|
|
152
|
+
selectItemEventCallback(ev) {
|
|
153
|
+
// this function MUST be bound to a HTMLSelectElement
|
|
154
|
+
// 'this' will be the select element
|
|
155
|
+
// the function was split out for testing
|
|
156
|
+
const select = this;
|
|
157
|
+
select.value = ev.detail.value;
|
|
158
|
+
select.onblur({ target: select }); // triggers validator
|
|
159
|
+
select.onchange({ target: select }); // triggers dataChanged event
|
|
160
|
+
}
|
|
156
161
|
/**
|
|
157
162
|
* Appends an option to a select element
|
|
158
163
|
*
|
|
@@ -383,7 +388,7 @@ export class TttxForm {
|
|
|
383
388
|
* @param {HTMLDivElement} errorBubble - The error bubble element to display error messages in.
|
|
384
389
|
* @return {HTMLLabelElement} - The new label element.
|
|
385
390
|
*/
|
|
386
|
-
createLabel(formProperties, input, overlay, errorBubble) {
|
|
391
|
+
createLabel(formProperties, input, overlay = null, errorBubble) {
|
|
387
392
|
var _a;
|
|
388
393
|
const outerContainer = document.createElement('div');
|
|
389
394
|
let outerContainerClassName = 'outer-container inputBlock';
|
|
@@ -434,7 +439,7 @@ export class TttxForm {
|
|
|
434
439
|
*/
|
|
435
440
|
createRadio(formKey, formProperties) {
|
|
436
441
|
var _a, _b;
|
|
437
|
-
const fragment =
|
|
442
|
+
const fragment = document.createDocumentFragment();
|
|
438
443
|
for (const optionProperties of formProperties.options) {
|
|
439
444
|
// Create a new <input> element with the specified name and type
|
|
440
445
|
const input = document.createElement('input');
|
|
@@ -464,8 +469,9 @@ export class TttxForm {
|
|
|
464
469
|
populateFormFromSchema() {
|
|
465
470
|
var _a;
|
|
466
471
|
// If there is no form schema, return early
|
|
467
|
-
if (!this._formSchema)
|
|
472
|
+
if (!this._formSchema) {
|
|
468
473
|
return;
|
|
474
|
+
}
|
|
469
475
|
// Get the properties of the form schema and their keys
|
|
470
476
|
const properties = this._formSchema.properties;
|
|
471
477
|
const propertyKeys = Object.keys(properties);
|
|
@@ -533,129 +539,155 @@ export class TttxForm {
|
|
|
533
539
|
const properties = this._formSchema.properties;
|
|
534
540
|
const propertyKeys = Object.keys(properties);
|
|
535
541
|
for (const formKey of propertyKeys) {
|
|
536
|
-
|
|
537
|
-
for (const formInput of formItemsByKey) {
|
|
538
|
-
// Bind events to form input elements
|
|
539
|
-
formInput.oninvalid = this.validityCheckWrapper.bind(this);
|
|
540
|
-
formInput.onblur = this.validityCheckWrapper.bind(this);
|
|
541
|
-
formInput.onkeyup = this.fieldChanged.bind(this);
|
|
542
|
-
formInput.onchange = this.fieldChanged.bind(this);
|
|
543
|
-
if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
|
|
544
|
-
formInput.addEventListener('change', () => {
|
|
545
|
-
formInput.classList.remove('placeholder');
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-with')) {
|
|
549
|
-
formInput.oninvalid = this.endDateComparisonValidator.bind(this);
|
|
550
|
-
formInput.onblur = this.endDateComparisonValidator.bind(this);
|
|
551
|
-
}
|
|
552
|
-
if (properties[formKey].form.type === 'startenddate' && formInput.type === 'time') {
|
|
553
|
-
formInput.oninvalid = this.startEndTimeComparitor.bind(this);
|
|
554
|
-
formInput.onblur = this.startEndTimeComparitor.bind(this);
|
|
555
|
-
}
|
|
556
|
-
if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-to')) {
|
|
557
|
-
formInput.oninvalid = this.startDateComparisonValidator.bind(this);
|
|
558
|
-
formInput.onblur = this.startDateComparisonValidator.bind(this);
|
|
559
|
-
}
|
|
560
|
-
}
|
|
542
|
+
this.applyValidationFunctionsToFormElement(formItems, formKey, properties);
|
|
561
543
|
}
|
|
562
544
|
// populate with existing form data if available
|
|
563
|
-
if (this._data && Object.keys(this._data).length > 0) {
|
|
564
|
-
|
|
565
|
-
for (const key of dataKeys) {
|
|
566
|
-
const formItemsByKey = formItems.querySelectorAll(`[name=${key}]`);
|
|
567
|
-
for (const formItem of formItemsByKey) {
|
|
568
|
-
switch (formItem.type) {
|
|
569
|
-
case 'checkbox':
|
|
570
|
-
if (this._data[key] === 'on') {
|
|
571
|
-
formItem.checked = true;
|
|
572
|
-
}
|
|
573
|
-
break;
|
|
574
|
-
case 'radio':
|
|
575
|
-
if (formItem.value === this._data[key]) {
|
|
576
|
-
formItem.checked = true;
|
|
577
|
-
}
|
|
578
|
-
break;
|
|
579
|
-
case 'select':
|
|
580
|
-
case 'select-one':
|
|
581
|
-
formItems.querySelector(`[name=overlay-${key}]`).selectedValue = this._data[key];
|
|
582
|
-
formItem.value = this._data[key];
|
|
583
|
-
break;
|
|
584
|
-
default:
|
|
585
|
-
formItem.value = this._data[key];
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
}
|
|
545
|
+
if ((this._data && Object.keys(this._data).length > 0)) {
|
|
546
|
+
this.populateFormWithExistingData(formItems);
|
|
589
547
|
}
|
|
590
548
|
// Append the cloned form elements to the fieldset
|
|
591
549
|
this.fieldset.replaceChildren(formItems);
|
|
592
550
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
551
|
+
/**
|
|
552
|
+
* Assign validation events to a given form item
|
|
553
|
+
* @param formItems The document fragment template of form items to be rendered
|
|
554
|
+
* @param formKey The key of the form item to bind events too
|
|
555
|
+
* @param properties The form item's properties, such as type and name
|
|
556
|
+
*/
|
|
557
|
+
applyValidationFunctionsToFormElement(formItems, formKey, properties) {
|
|
558
|
+
const formItemsByKey = formItems.querySelectorAll(`[name^=${formKey}]`);
|
|
559
|
+
for (const formInput of formItemsByKey) {
|
|
560
|
+
// Bind events to form input elements
|
|
561
|
+
formInput.oninvalid = this.validityCheckWrapper.bind(this);
|
|
562
|
+
formInput.onblur = this.validityCheckWrapper.bind(this);
|
|
563
|
+
formInput.onkeyup = this.fieldChanged.bind(this);
|
|
564
|
+
formInput.onchange = this.fieldChanged.bind(this);
|
|
565
|
+
if (properties[formKey].form.type === 'select' && formInput.classList.contains('placeholder')) {
|
|
566
|
+
formInput.addEventListener('change', this.selectRemovePlaceholderCallback.bind(formInput));
|
|
567
|
+
}
|
|
568
|
+
if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-with')) {
|
|
569
|
+
formInput.oninvalid = endDateComparisonValidator.bind(this);
|
|
570
|
+
formInput.onblur = endDateComparisonValidator.bind(this);
|
|
571
|
+
}
|
|
572
|
+
if (properties[formKey].form.type === 'startenddate' && formInput.type === 'time') {
|
|
573
|
+
formInput.oninvalid = startEndTimeComparator.bind(this);
|
|
574
|
+
formInput.onblur = startEndTimeComparator.bind(this);
|
|
608
575
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
setErrorState(endTime, false, null);
|
|
613
|
-
this.validityCheckWrapper(event);
|
|
576
|
+
if (properties[formKey].form.type === 'startenddate' && formInput.hasAttribute('data-compare-to')) {
|
|
577
|
+
formInput.oninvalid = startDateComparisonValidator.bind(this);
|
|
578
|
+
formInput.onblur = startDateComparisonValidator.bind(this);
|
|
614
579
|
}
|
|
615
580
|
}
|
|
616
581
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
endDate.setCustomValidity('');
|
|
647
|
-
this.validityCheckWrapper(event);
|
|
648
|
-
this.startEndTimeComparitor(event);
|
|
649
|
-
}
|
|
650
|
-
else {
|
|
651
|
-
this.clearTimeComparitor(event);
|
|
652
|
-
this.validityCheckWrapper(event);
|
|
582
|
+
/**
|
|
583
|
+
* If data exists, set form input values before rendering
|
|
584
|
+
* @param formItems The document fragment template of form items to be rendered
|
|
585
|
+
*/
|
|
586
|
+
populateFormWithExistingData(formItems) {
|
|
587
|
+
const dataKeys = Object.keys(this._data);
|
|
588
|
+
for (const key of dataKeys) {
|
|
589
|
+
const formItemsByKey = formItems.querySelectorAll(`[name=${key}]`);
|
|
590
|
+
for (const formItem of formItemsByKey) {
|
|
591
|
+
switch (formItem.type) {
|
|
592
|
+
case 'checkbox':
|
|
593
|
+
if (this._data[key] === 'on') {
|
|
594
|
+
formItem.checked = true;
|
|
595
|
+
}
|
|
596
|
+
break;
|
|
597
|
+
case 'radio':
|
|
598
|
+
if (formItem.value === this._data[key]) {
|
|
599
|
+
formItem.checked = true;
|
|
600
|
+
}
|
|
601
|
+
break;
|
|
602
|
+
case 'select':
|
|
603
|
+
case 'select-one':
|
|
604
|
+
formItems.querySelector(`[name=overlay-${key}]`)['selectedValue'] = this._data[key];
|
|
605
|
+
formItem.value = this._data[key];
|
|
606
|
+
break;
|
|
607
|
+
default:
|
|
608
|
+
formItem.value = this._data[key];
|
|
609
|
+
}
|
|
610
|
+
}
|
|
653
611
|
}
|
|
654
612
|
}
|
|
613
|
+
/**
|
|
614
|
+
* Remove the placeholder class on the bound THIS select element
|
|
615
|
+
*/
|
|
616
|
+
selectRemovePlaceholderCallback() {
|
|
617
|
+
const select = this;
|
|
618
|
+
select.classList.remove('placeholder');
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* A wrapper around validity check and set error state
|
|
622
|
+
*/
|
|
655
623
|
validityCheckWrapper(event) {
|
|
656
624
|
const { target, hasError, errorMessage } = validityCheck(event);
|
|
657
625
|
setErrorState(target, hasError, errorMessage);
|
|
658
626
|
}
|
|
627
|
+
assignFieldsetReference(el) {
|
|
628
|
+
this.fieldset = el;
|
|
629
|
+
}
|
|
630
|
+
assignButtonReference(el) {
|
|
631
|
+
this.submitButton = el;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* An external validation trigger to apply to a form field
|
|
635
|
+
* @param { string } fieldName The form field name to apply the validation too
|
|
636
|
+
* @param { string } message The validation message to display under the form field
|
|
637
|
+
*/
|
|
638
|
+
async setValidationFor(fieldName, message) {
|
|
639
|
+
const formField = this.fieldset.querySelector(`[name=${fieldName}]`);
|
|
640
|
+
if (formField.disabled) {
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
formField.setCustomValidity(message);
|
|
644
|
+
formField.setAttribute('custom-validation-set', 'true');
|
|
645
|
+
setErrorState(formField, true, message);
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Clear the validation message on a given form field
|
|
649
|
+
* @param { string } fieldName The form field name to clear the validation of
|
|
650
|
+
*/
|
|
651
|
+
async clearValidationFor(fieldName) {
|
|
652
|
+
const formField = this.fieldset.querySelector(`[name=${fieldName}]`);
|
|
653
|
+
formField.setCustomValidity('');
|
|
654
|
+
formField.removeAttribute('custom-validation-set');
|
|
655
|
+
setErrorState(formField, false, '');
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Disable a form field and visually remove it from the form.
|
|
659
|
+
* If custom validation is set, this function will return without affecting the form field.
|
|
660
|
+
* @param { string } fieldName The form field name to disable
|
|
661
|
+
*/
|
|
662
|
+
async disableFormField(fieldName) {
|
|
663
|
+
const formField = this.fieldset.querySelector(`[name=${fieldName}]`);
|
|
664
|
+
if (formField.hasAttribute('custom-validation-set')) {
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
formField.disabled = true;
|
|
668
|
+
let parent = formField.parentElement;
|
|
669
|
+
do {
|
|
670
|
+
if (parent.nodeName !== 'LABEL') {
|
|
671
|
+
parent = parent.parentElement;
|
|
672
|
+
}
|
|
673
|
+
} while (parent.nodeName !== 'LABEL');
|
|
674
|
+
parent.style.display = 'none';
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Enable a form field and visually add it back to the form.
|
|
678
|
+
* @param { string } fieldName The form field name to enable
|
|
679
|
+
*/
|
|
680
|
+
async enableFormField(fieldName) {
|
|
681
|
+
const formField = this.fieldset.querySelector(`[name=${fieldName}]`);
|
|
682
|
+
formField.disabled = false;
|
|
683
|
+
let parent = formField.parentElement;
|
|
684
|
+
do {
|
|
685
|
+
if (parent.nodeName !== 'LABEL') {
|
|
686
|
+
parent = parent.parentElement;
|
|
687
|
+
}
|
|
688
|
+
} while (parent.nodeName !== 'LABEL');
|
|
689
|
+
parent.style.display = 'block';
|
|
690
|
+
}
|
|
659
691
|
/**
|
|
660
692
|
* Renders the component's template as a form element with a fieldset container. The form's
|
|
661
693
|
* "onSubmit" event is bound to the "doSubmit" function, which handles the form submission
|
|
@@ -664,9 +696,9 @@ export class TttxForm {
|
|
|
664
696
|
* later on.
|
|
665
697
|
*/
|
|
666
698
|
render() {
|
|
667
|
-
return (h(Host, null, h("form", {
|
|
699
|
+
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' } }))));
|
|
668
700
|
}
|
|
669
|
-
static get is() { return "tttx-
|
|
701
|
+
static get is() { return "tttx-form_1_4_0"; }
|
|
670
702
|
static get encapsulation() { return "shadow"; }
|
|
671
703
|
static get originalStyleUrls() {
|
|
672
704
|
return {
|
|
@@ -751,8 +783,8 @@ export class TttxForm {
|
|
|
751
783
|
"text": ""
|
|
752
784
|
},
|
|
753
785
|
"complexType": {
|
|
754
|
-
"original": "{ name: string; value:
|
|
755
|
-
"resolved": "{ name: string; value:
|
|
786
|
+
"original": "{ name: string; value: string }",
|
|
787
|
+
"resolved": "{ name: string; value: string; }",
|
|
756
788
|
"references": {}
|
|
757
789
|
}
|
|
758
790
|
}];
|
|
@@ -794,6 +826,10 @@ export class TttxForm {
|
|
|
794
826
|
"references": {
|
|
795
827
|
"Promise": {
|
|
796
828
|
"location": "global"
|
|
829
|
+
},
|
|
830
|
+
"TttxSelectBox": {
|
|
831
|
+
"location": "import",
|
|
832
|
+
"path": "../tttx-select-box/tttx-select-box"
|
|
797
833
|
}
|
|
798
834
|
},
|
|
799
835
|
"return": "Promise<void>"
|
|
@@ -808,6 +844,145 @@ export class TttxForm {
|
|
|
808
844
|
"text": "options a list of option values and labels"
|
|
809
845
|
}]
|
|
810
846
|
}
|
|
847
|
+
},
|
|
848
|
+
"setValidationFor": {
|
|
849
|
+
"complexType": {
|
|
850
|
+
"signature": "(fieldName: string, message: string) => Promise<void>",
|
|
851
|
+
"parameters": [{
|
|
852
|
+
"tags": [{
|
|
853
|
+
"name": "param",
|
|
854
|
+
"text": "fieldName The form field name to apply the validation too"
|
|
855
|
+
}],
|
|
856
|
+
"text": "The form field name to apply the validation too"
|
|
857
|
+
}, {
|
|
858
|
+
"tags": [{
|
|
859
|
+
"name": "param",
|
|
860
|
+
"text": "message The validation message to display under the form field"
|
|
861
|
+
}],
|
|
862
|
+
"text": "The validation message to display under the form field"
|
|
863
|
+
}],
|
|
864
|
+
"references": {
|
|
865
|
+
"Promise": {
|
|
866
|
+
"location": "global"
|
|
867
|
+
},
|
|
868
|
+
"HTMLInputElement": {
|
|
869
|
+
"location": "global"
|
|
870
|
+
},
|
|
871
|
+
"HTMLSelectElement": {
|
|
872
|
+
"location": "global"
|
|
873
|
+
}
|
|
874
|
+
},
|
|
875
|
+
"return": "Promise<void>"
|
|
876
|
+
},
|
|
877
|
+
"docs": {
|
|
878
|
+
"text": "An external validation trigger to apply to a form field",
|
|
879
|
+
"tags": [{
|
|
880
|
+
"name": "param",
|
|
881
|
+
"text": "fieldName The form field name to apply the validation too"
|
|
882
|
+
}, {
|
|
883
|
+
"name": "param",
|
|
884
|
+
"text": "message The validation message to display under the form field"
|
|
885
|
+
}]
|
|
886
|
+
}
|
|
887
|
+
},
|
|
888
|
+
"clearValidationFor": {
|
|
889
|
+
"complexType": {
|
|
890
|
+
"signature": "(fieldName: string) => Promise<void>",
|
|
891
|
+
"parameters": [{
|
|
892
|
+
"tags": [{
|
|
893
|
+
"name": "param",
|
|
894
|
+
"text": "fieldName The form field name to clear the validation of"
|
|
895
|
+
}],
|
|
896
|
+
"text": "The form field name to clear the validation of"
|
|
897
|
+
}],
|
|
898
|
+
"references": {
|
|
899
|
+
"Promise": {
|
|
900
|
+
"location": "global"
|
|
901
|
+
},
|
|
902
|
+
"HTMLInputElement": {
|
|
903
|
+
"location": "global"
|
|
904
|
+
},
|
|
905
|
+
"HTMLSelectElement": {
|
|
906
|
+
"location": "global"
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
"return": "Promise<void>"
|
|
910
|
+
},
|
|
911
|
+
"docs": {
|
|
912
|
+
"text": "Clear the validation message on a given form field",
|
|
913
|
+
"tags": [{
|
|
914
|
+
"name": "param",
|
|
915
|
+
"text": "fieldName The form field name to clear the validation of"
|
|
916
|
+
}]
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
"disableFormField": {
|
|
920
|
+
"complexType": {
|
|
921
|
+
"signature": "(fieldName: string) => Promise<void>",
|
|
922
|
+
"parameters": [{
|
|
923
|
+
"tags": [{
|
|
924
|
+
"name": "param",
|
|
925
|
+
"text": "fieldName The form field name to disable"
|
|
926
|
+
}],
|
|
927
|
+
"text": "The form field name to disable"
|
|
928
|
+
}],
|
|
929
|
+
"references": {
|
|
930
|
+
"Promise": {
|
|
931
|
+
"location": "global"
|
|
932
|
+
},
|
|
933
|
+
"HTMLInputElement": {
|
|
934
|
+
"location": "global"
|
|
935
|
+
},
|
|
936
|
+
"HTMLSelectElement": {
|
|
937
|
+
"location": "global"
|
|
938
|
+
},
|
|
939
|
+
"HTMLElement": {
|
|
940
|
+
"location": "global"
|
|
941
|
+
}
|
|
942
|
+
},
|
|
943
|
+
"return": "Promise<void>"
|
|
944
|
+
},
|
|
945
|
+
"docs": {
|
|
946
|
+
"text": "Disable a form field and visually remove it from the form.\nIf custom validation is set, this function will return without affecting the form field.",
|
|
947
|
+
"tags": [{
|
|
948
|
+
"name": "param",
|
|
949
|
+
"text": "fieldName The form field name to disable"
|
|
950
|
+
}]
|
|
951
|
+
}
|
|
952
|
+
},
|
|
953
|
+
"enableFormField": {
|
|
954
|
+
"complexType": {
|
|
955
|
+
"signature": "(fieldName: string) => Promise<void>",
|
|
956
|
+
"parameters": [{
|
|
957
|
+
"tags": [{
|
|
958
|
+
"name": "param",
|
|
959
|
+
"text": "fieldName The form field name to enable"
|
|
960
|
+
}],
|
|
961
|
+
"text": "The form field name to enable"
|
|
962
|
+
}],
|
|
963
|
+
"references": {
|
|
964
|
+
"Promise": {
|
|
965
|
+
"location": "global"
|
|
966
|
+
},
|
|
967
|
+
"HTMLInputElement": {
|
|
968
|
+
"location": "global"
|
|
969
|
+
},
|
|
970
|
+
"HTMLSelectElement": {
|
|
971
|
+
"location": "global"
|
|
972
|
+
},
|
|
973
|
+
"HTMLElement": {
|
|
974
|
+
"location": "global"
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
"return": "Promise<void>"
|
|
978
|
+
},
|
|
979
|
+
"docs": {
|
|
980
|
+
"text": "Enable a form field and visually add it back to the form.",
|
|
981
|
+
"tags": [{
|
|
982
|
+
"name": "param",
|
|
983
|
+
"text": "fieldName The form field name to enable"
|
|
984
|
+
}]
|
|
985
|
+
}
|
|
811
986
|
}
|
|
812
987
|
};
|
|
813
988
|
}
|
|
@@ -169,7 +169,7 @@ const formSchema = {
|
|
|
169
169
|
}
|
|
170
170
|
},
|
|
171
171
|
};
|
|
172
|
-
export const SingleFormItem = args => `<tttx-
|
|
172
|
+
export const SingleFormItem = args => `<tttx-form_1_4_0 formSchema='${JSON.stringify(args.formSchema)}'></tttx-form_1_4_0>`;
|
|
173
173
|
SingleFormItem.args = {
|
|
174
174
|
formSchema: {
|
|
175
175
|
properties: {
|
|
@@ -192,7 +192,7 @@ SingleFormItem.args = {
|
|
|
192
192
|
},
|
|
193
193
|
},
|
|
194
194
|
};
|
|
195
|
-
export const StartAndEndDateWithoutTime = args => `<tttx-
|
|
195
|
+
export const StartAndEndDateWithoutTime = args => `<tttx-form_1_4_0 formSchema='${JSON.stringify(args.formSchema)}'></tttx-form_1_4_0>`;
|
|
196
196
|
StartAndEndDateWithoutTime.args = {
|
|
197
197
|
formSchema: {
|
|
198
198
|
properties: {
|
|
@@ -207,7 +207,7 @@ StartAndEndDateWithoutTime.args = {
|
|
|
207
207
|
},
|
|
208
208
|
},
|
|
209
209
|
};
|
|
210
|
-
export const ExampleFormFromJSON = args => `<tttx-
|
|
210
|
+
export const ExampleFormFromJSON = args => `<tttx-form_1_4_0 id='form' formSchema='${JSON.stringify(args.formSchema)}'></tttx-form_1_4_0>
|
|
211
211
|
<hr/>
|
|
212
212
|
<button type='button' id='button'>Submit Form</button>
|
|
213
213
|
<script>
|
|
@@ -408,7 +408,7 @@ const data = {
|
|
|
408
408
|
'startend-endtime': '17:00',
|
|
409
409
|
notes: 'Some notes that were entered into this box.'
|
|
410
410
|
};
|
|
411
|
-
export const PrePopulateForm = args => `<tttx-
|
|
411
|
+
export const PrePopulateForm = args => `<tttx-form_1_4_0 id='form' formSchema='${JSON.stringify(args.formSchema)}' data='${JSON.stringify(args.data)}'></tttx-form_1_4_0>
|
|
412
412
|
<hr/>
|
|
413
413
|
<button type='button' id='button'>Submit Form</button>
|
|
414
414
|
<script>
|
|
@@ -483,7 +483,7 @@ const radioFormSchema = {
|
|
|
483
483
|
},
|
|
484
484
|
},
|
|
485
485
|
};
|
|
486
|
-
export const FormWithRadio = args => `<tttx-
|
|
486
|
+
export const FormWithRadio = args => `<tttx-form_1_4_0 id='form' formSchema='${JSON.stringify(args.formSchema)}'></tttx-form_1_4_0>
|
|
487
487
|
<hr/>
|
|
488
488
|
<button type='button' id='button'>Submit Form</button>
|
|
489
489
|
<script>
|
|
@@ -40,10 +40,17 @@ export class TttxList {
|
|
|
40
40
|
this.rowClick.emit({ key: item.key, name: this.name, data: item.rowData });
|
|
41
41
|
}
|
|
42
42
|
renderListItem(item) {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
let element;
|
|
44
|
+
if (typeof item.element === 'string') {
|
|
45
|
+
const cleanHTML = DOMPurify.sanitize(item.element, domSanitiserOptions);
|
|
46
|
+
element = h("span", { class: "item-content", innerHTML: cleanHTML });
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
element = h("span", { class: "item-content" }, item.element);
|
|
50
|
+
}
|
|
51
|
+
return (h(Fragment, null, item.hasCheckbox && (h("div", { class: "checkbox" }, h("tttx-icon_1_4_0", { icon: item.checked ? 'check_box' : 'check_box_outline_blank', color: item.checked ? 'blue' : 'grey', onClick: event => {
|
|
45
52
|
this.onRowCheckboxHandler(event, item);
|
|
46
|
-
} }))), item.element &&
|
|
53
|
+
} }))), item.element && element, item.icon && (h("span", { class: "icons" }, h("tttx-icon_1_4_0", { class: "align-right", icon: item.icon, color: 'black' })))));
|
|
47
54
|
}
|
|
48
55
|
render() {
|
|
49
56
|
if (!this._data)
|
|
@@ -56,7 +63,7 @@ export class TttxList {
|
|
|
56
63
|
this.onRowClickHandler(item);
|
|
57
64
|
} }, this.renderListItem(item))))));
|
|
58
65
|
}
|
|
59
|
-
static get is() { return "tttx-
|
|
66
|
+
static get is() { return "tttx-list_1_4_0"; }
|
|
60
67
|
static get encapsulation() { return "shadow"; }
|
|
61
68
|
static get originalStyleUrls() {
|
|
62
69
|
return {
|