@mgdis/mg-components 5.19.2 → 5.19.3
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/{components.utils-dc9c8a53.js → components.utils-69435877.js} +2 -2
- package/dist/cjs/components.utils-69435877.js.map +1 -0
- package/dist/cjs/{index-c042e24b.js → index-60dd0c56.js} +143 -58
- package/dist/cjs/index-60dd0c56.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_34.cjs.entry.js +306 -238
- package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-components.cjs.js.map +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +2 -2
- package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
- package/dist/collection/assets/icons/index.js +190 -182
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/atoms/mg-button/mg-button.js +15 -0
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js +1 -1
- package/dist/collection/components/atoms/mg-button/test/mg-button.e2e.js.map +1 -1
- package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js +54 -4
- package/dist/collection/components/atoms/mg-button/test/mg-button.spec.js.map +1 -1
- package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js +2 -2
- package/dist/collection/components/atoms/mg-card/test/mg-card.e2e.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/test/mg-tooltip.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +8 -0
- package/dist/collection/components/molecules/inputs/MgInput.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +13 -12
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js +4 -10
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/test/mg-input-checkbox.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +9 -2
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/test/mg-input-date.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +11 -4
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/test/mg-input-numeric.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +9 -2
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-password/test/mg-input-password.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +7 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-radio/test/mg-input-radio.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +9 -2
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js +0 -4
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +9 -2
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js +2 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +9 -2
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js +2 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/test/mg-input-textarea.spec.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/test/mg-input-toggle.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js +2 -2
- package/dist/collection/components/molecules/menu/mg-menu-item/test/mg-menu-item.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js +8 -0
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js +8 -0
- package/dist/collection/components/molecules/mg-action-more/test/mg-action-more.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +1 -9
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js +44 -29
- package/dist/collection/components/molecules/mg-form/test/mg-form.spec.js.map +1 -1
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js +1 -1
- package/dist/collection/components/molecules/mg-modal/test/mg-modal.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js +1 -1
- package/dist/collection/components/molecules/mg-panel/test/mg-panel.e2e.playwright.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
- package/dist/collection/utils/behaviors.utils.js.map +1 -1
- package/dist/collection/utils/components.utils.js +1 -1
- package/dist/collection/utils/components.utils.js.map +1 -1
- package/dist/collection/utils/components.utils.spec.js +5 -0
- package/dist/collection/utils/components.utils.spec.js.map +1 -1
- package/dist/components/MgInput.js +9 -1
- package/dist/components/MgInput.js.map +1 -1
- package/dist/components/components.utils.js +1 -1
- package/dist/components/components.utils.js.map +1 -1
- package/dist/components/mg-action-more.js +1 -1
- package/dist/components/mg-action-more.js.map +1 -1
- package/dist/components/mg-button2.js +15 -0
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-form.js +1 -9
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-icon2.js +198 -182
- package/dist/components/mg-icon2.js.map +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js +2 -2
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +13 -12
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.js +9 -3
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +11 -5
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +9 -3
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +8 -3
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-select2.js +9 -3
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +9 -3
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +9 -3
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-item-more.js.map +1 -1
- package/dist/components/mg-menu-item2.js +2 -2
- package/dist/components/mg-menu-item2.js.map +1 -1
- package/dist/components/mg-message.js +1 -1
- package/dist/components/mg-message.js.map +1 -1
- package/dist/components/mg-popover-content2.js +1 -1
- package/dist/components/mg-popover-content2.js.map +1 -1
- package/dist/components/popper.js +6 -12
- package/dist/components/popper.js.map +1 -1
- package/dist/esm/{components.utils-0f76010d.js → components.utils-6cf27db1.js} +2 -2
- package/dist/esm/components.utils-6cf27db1.js.map +1 -0
- package/dist/esm/{index-ce01e63b.js → index-0f833068.js} +143 -58
- package/dist/esm/index-0f833068.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_34.entry.js +306 -238
- package/dist/esm/mg-action-more_34.entry.js.map +1 -1
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-components.js.map +1 -1
- package/dist/esm/mg-item-more.entry.js +2 -2
- package/dist/esm/mg-item-more.entry.js.map +1 -1
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/p-10ed4425.entry.js +2 -0
- package/dist/mg-components/p-10ed4425.entry.js.map +1 -0
- package/dist/mg-components/{p-c9e2c669.js → p-36a51c5e.js} +2 -2
- package/dist/mg-components/p-36a51c5e.js.map +1 -0
- package/dist/mg-components/{p-01ebc95a.entry.js → p-91feda5a.entry.js} +2 -2
- package/dist/mg-components/p-91feda5a.entry.js.map +1 -0
- package/dist/mg-components/p-9b12021b.js +3 -0
- package/dist/mg-components/p-9b12021b.js.map +1 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +4 -0
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +7 -0
- package/dist/types/components/molecules/inputs/MgInput.d.ts +2 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.conf.d.ts +1 -6
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +1 -0
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +1 -1
- package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +1 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +0 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +35 -35
- package/dist/cjs/components.utils-dc9c8a53.js.map +0 -1
- package/dist/cjs/index-c042e24b.js.map +0 -1
- package/dist/esm/components.utils-0f76010d.js.map +0 -1
- package/dist/esm/index-ce01e63b.js.map +0 -1
- package/dist/mg-components/p-01ebc95a.entry.js.map +0 -1
- package/dist/mg-components/p-1aa89acf.js +0 -3
- package/dist/mg-components/p-1aa89acf.js.map +0 -1
- package/dist/mg-components/p-71a5a848.entry.js +0 -2
- package/dist/mg-components/p-71a5a848.entry.js.map +0 -1
- package/dist/mg-components/p-c9e2c669.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mg-input-select.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-select/mg-input-select.tsx"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,uDAAuD;AACvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CAAC,MAAe,EAA0B,EAAE,CAAC,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAQ,MAAuB,CAAC,KAAK,KAAK,QAAQ,CAAC;AAE/I;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,CAAC,KAAgB,EAA2B,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAEtI;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,QAAiB,EAAwB,EAAE,CAC7D,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAQ,QAAqB,CAAC,KAAK,KAAK,QAAQ,IAAI,kBAAkB,CAAE,QAAqB,CAAC,OAAO,CAAC,CAAC;AAEzI;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,GAAgC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,Q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IAAI,IAAI,CAAC,UAAU,IACnE,IAAI,CAAC,WAAW,CACV,CACV;QACA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CACzB,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CACnB,gBAAU,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,IAC7C,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAC7B,CACZ,CAAC,CAAC,CAAC,CACF,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAC9C,CACF,CACM,CACD,CACX,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Component, Element, Event, h, Prop, State, EventEmitter, Watch, Method } from '@stencil/core';\nimport { MgInput } from '../MgInput';\nimport { Width } from '../MgInput.conf';\nimport { ClassList, allItemsAreString, isValidString } from '../../../../utils/components.utils';\nimport { initLocales } from '../../../../locales';\nimport { SelectOption, OptGroup } from './mg-input-select.conf';\n\n/**\n * Check if item is a well configured option\n * @param option - select option\n * @returns select option type is valid\n */\nconst isOption = (option: unknown): option is SelectOption => typeof option === 'object' && typeof (option as SelectOption).title === 'string';\n\n/**\n * Check if items[] is SelectOption\n * @param items - select option\n * @returns select option array type is valid\n */\nconst allItemsAreOptions = (items: unknown[]): items is SelectOption[] => Array.isArray(items) && items.every(item => isOption(item));\n\n/**\n * Check if item is a well configured optgroup\n * @param optgroup - select option\n * @returns select optgroup type is valid\n */\nconst isOptGroup = (optgroup: unknown): optgroup is OptGroup =>\n typeof optgroup === 'object' && typeof (optgroup as OptGroup).group === 'string' && allItemsAreOptions((optgroup as OptGroup).options);\n\n/**\n * Group options\n * @param acc - reduce accumulator\n * @param item - item to add\n * @returns grouped options\n */\nconst groupOptions = (acc: (SelectOption | OptGroup)[], { group, title, value, disabled }: SelectOption): (SelectOption | OptGroup)[] => {\n if (group !== undefined) {\n // Check if group is already created\n const optGroup: OptGroup = (acc as OptGroup[]).find(grp => grp.group === group);\n // Add to group\n if (optGroup !== undefined) {\n optGroup.options.push({ title, value, disabled });\n }\n // Create group\n else {\n acc.push({ group, options: [{ title, value, disabled }] });\n }\n } else {\n acc.push({ title, value, disabled });\n }\n return acc;\n};\n\n@Component({\n tag: 'mg-input-select',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input-select.css',\n shadow: true,\n})\nexport class MgInputSelect {\n /************\n * Internal *\n ************/\n\n // HTML selector\n private input: HTMLSelectElement;\n\n // Locales\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputSelectElement;\n\n /**\n * Component value\n */\n @Prop({ mutable: true }) value: any;\n @Watch('value')\n validateValue(newValue: MgInputSelect['value']): void {\n if (allItemsAreString(this.items) && typeof newValue === 'string') {\n this.readonlyValue = this.input?.value ? this.input.value : newValue;\n } else if (allItemsAreOptions(this.items)) {\n this.readonlyValue = this.items.find(item => item.value === newValue)?.title;\n } else {\n this.readonlyValue = null;\n }\n this.valueChange.emit(newValue);\n }\n\n /**\n * Items are the possible options to select\n */\n @Prop() items!: (string | SelectOption)[];\n @Watch('items')\n validateItems(newValue: MgInputSelect['items']): void {\n // Empty options\n if (newValue.length === 0) {\n this.options = [];\n }\n // String array\n else if (allItemsAreString(newValue)) {\n if (typeof this.value === 'string') this.valueExist = newValue.includes(this.value);\n this.options = newValue.map(item => ({ title: item, value: item }));\n }\n // Object array\n else if (allItemsAreOptions(newValue)) {\n this.valueExist = newValue.map(item => item.value).includes(this.value);\n // Grouped object options\n if (newValue.some(item => Boolean(item.group))) {\n this.options = newValue.reduce(groupOptions, []);\n }\n // Standart object options\n else {\n this.options = newValue;\n }\n } else {\n throw new Error('<mg-input-select> prop \"items\" is required, can be an empty Array or all items must be the same type: string or Option.');\n }\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n\n /**\n * Input name\n * If not set the value equals the identifier\n */\n @Prop() name = this.identifier;\n\n /**\n * Input label\n */\n @Prop() label!: string;\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop: boolean;\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide = false;\n\n /**\n * Input placeholder.\n * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text.\n */\n @Prop({ mutable: true }) placeholder: string;\n\n /**\n * Option to remove placeholder\n */\n @Prop() placeholderHide = false;\n\n /**\n * Option to disable placeholder\n */\n @Prop() placeholderDisabled = false;\n\n /**\n * Define if input is required\n */\n @Prop() required = false;\n\n /**\n * Define if input is readonly\n */\n @Prop() readonly = false;\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n handleValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void {\n if (this.input !== undefined) {\n this.input[prop] = newValue;\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n this.hasDisplayedError = false;\n }\n }\n }\n\n /**\n * Define input width\n */\n @Prop({ reflect: true }) mgWidth: Width;\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip: string;\n\n /**\n * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText: string;\n\n /**\n * Define input valid state\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input invalid state\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-input--select']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Formated items for display\n */\n @State() options: (SelectOption | OptGroup)[];\n\n /**\n * Does value match any item option\n */\n @State() valueExist: boolean;\n\n /**\n * Does value match any item option\n */\n @State() readonlyValue: string;\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<MgInputSelect['value']>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<boolean>;\n\n /**\n * Display input error if it exists.\n */\n @Method()\n async displayError(): Promise<void> {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n }\n\n /**\n * Set an error and display a custom error message.\n * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\n * It must be paired with an error message to display for the given context.\n * When used to set validity to `false`, you should use this method again to reset the validity to `true`.\n * @param valid - value indicating the validity\n * @param errorMessage - the error message to display\n */\n @Method()\n async setError(valid: MgInputSelect['valid'], errorMessage: string): Promise<void> {\n if (typeof valid !== 'boolean') {\n throw new Error('<mg-input-select> method \"setError()\" param \"valid\" must be a boolean');\n } else if (!isValidString(errorMessage)) {\n throw new Error('<mg-input-select> method \"setError()\" param \"errorMessage\" must be a string');\n } else {\n this.setValidity(valid);\n this.setErrorMessage(valid ? undefined : errorMessage);\n this.hasDisplayedError = this.invalid;\n }\n }\n\n /**\n * Method to set validity values\n * @param newValue - valid new value\n */\n private setValidity(newValue: MgInputSelect['valid']) {\n this.valid = newValue;\n this.invalid = !this.valid;\n // We need to send valid event even if it is the same value\n this.inputValid.emit(this.valid);\n }\n /**\n * Handle input event\n */\n private handleInput = (): void => {\n this.updateValue();\n if (this.hasDisplayedError) this.setErrorMessage();\n };\n\n /**\n * Method to compare item.title with input.value\n * @param item - item to compare with\n * @returns truthy if input.value is an item\n */\n private isInputValue = (item: SelectOption): boolean => item.title === this.input?.value;\n\n /**\n * value props setter\n * @param newValue - value to update with\n */\n private setValue = (newValue: MgInputSelect['value']): void => {\n this.checkValidity();\n this.value = newValue;\n };\n\n /**\n * Update value from input.value\n */\n private updateValue = (): void => {\n if (this.input.value === '') {\n this.setValue(null);\n } else if (allItemsAreString(this.items) && this.items.includes(this.input.value)) {\n this.setValue(this.input.value);\n } else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {\n this.setValue(this.items.find(this.isInputValue).value);\n } else {\n // before set newValue with push to options[] the unknown input.value with a disable satus\n this.options.push({ title: this.input.value, value: this.input.value, disabled: true });\n this.setValue(this.input.value);\n }\n };\n\n /**\n * Handle blur event\n */\n private handleBlur = (): void => {\n this.displayError();\n };\n\n /**\n * Input value is disabled\n * @returns truthy if input value is disabled\n */\n private isDisabledValue = (): boolean => allItemsAreOptions(this.options) && this.options.find(this.isInputValue)?.disabled === true;\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.setValidity(!this.isDisabledValue() && (this.readonly || this.disabled || (this.input?.checkValidity !== undefined ? this.input.checkValidity() : true)));\n };\n\n /**\n * Set input error message\n * @param errorMessage - errorMessage override\n */\n private setErrorMessage = (errorMessage?: string): void => {\n // Set error message\n this.errorMessage = undefined;\n if (!this.valid) {\n if (errorMessage !== undefined) {\n this.errorMessage = errorMessage;\n } else if (this.input.validity.valueMissing) {\n this.errorMessage = this.messages.errors.required;\n }\n }\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n * @returns timeout\n */\n componentWillLoad(): ReturnType<typeof setTimeout> {\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Validate\n this.validateItems(this.items);\n this.validateValue(this.value);\n // Set default placeholder\n if (this.placeholder === undefined || this.placeholder === '') {\n this.placeholder = this.messages.input.select.placeholder;\n }\n // Check validity when component is ready\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n this.checkValidity();\n }, 0);\n }\n\n /**\n * Render option\n * @param option - to render\n * @returns render option\n */\n private renderOption = (option: SelectOption): HTMLElement => (\n <option key={option.title} value={option.title} selected={JSON.stringify(this.value) === JSON.stringify(option.value)} disabled={option.disabled}>\n {option.title}\n </option>\n );\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <MgInput\n identifier={this.identifier}\n classCollection={this.classCollection}\n ariaDescribedbyIDs={[]}\n label={this.label}\n labelOnTop={this.labelOnTop}\n labelHide={this.labelHide}\n required={this.required}\n readonly={this.readonly}\n mgWidth={this.mgWidth}\n disabled={this.disabled}\n value={undefined}\n readonlyValue={this.readonlyValue}\n tooltip={this.tooltip}\n helpText={this.helpText}\n errorMessage={this.errorMessage}\n isFieldset={false}\n >\n <select\n class=\"mg-c-input__box\"\n id={this.identifier}\n name={this.name}\n title={this.placeholder}\n disabled={this.disabled}\n required={this.required}\n aria-invalid={(this.invalid === true).toString()}\n onInput={this.handleInput}\n onBlur={this.handleBlur}\n ref={(el: HTMLSelectElement) => {\n if (el !== null) this.input = el;\n }}\n >\n {(!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder\n <option value=\"\" disabled={this.placeholderDisabled && this.valueExist}>\n {this.placeholder}\n </option>\n )}\n {this.options.map(option =>\n isOptGroup(option) ? (\n <optgroup label={option.group} key={option.group}>\n {option.options.map(this.renderOption)}\n </optgroup>\n ) : (\n isOption(option) && this.renderOption(option)\n ),\n )}\n </select>\n </MgInput>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mg-input-select.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-select/mg-input-select.tsx"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,uDAAuD;AACvD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,OAAO,EAAS,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CAAC,MAAe,EAA0B,EAAE,CAAC,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAQ,MAAuB,CAAC,KAAK,KAAK,QAAQ,CAAC;AAE/I;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,CAAC,KAAgB,EAA2B,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAEtI;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,QAAiB,EAAwB,EAAE,CAC7D,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAQ,QAAqB,CAAC,KAAK,KAAK,QAAQ,IAAI,kBAAkB,CAAE,QAAqB,CAAC,OAAO,CAAC,CAAC;AAEzI;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,GAAgC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAgB,EAA+B,EAAE;EACtI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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Component, Element, Event, h, Prop, State, EventEmitter, Watch, Method } from '@stencil/core';\nimport { MgInput } from '../MgInput';\nimport { Handler, Width } from '../MgInput.conf';\nimport { ClassList, allItemsAreString, isValidString } from '../../../../utils/components.utils';\nimport { initLocales } from '../../../../locales';\nimport { SelectOption, OptGroup } from './mg-input-select.conf';\n\n/**\n * Check if item is a well configured option\n * @param option - select option\n * @returns select option type is valid\n */\nconst isOption = (option: unknown): option is SelectOption => typeof option === 'object' && typeof (option as SelectOption).title === 'string';\n\n/**\n * Check if items[] is SelectOption\n * @param items - select option\n * @returns select option array type is valid\n */\nconst allItemsAreOptions = (items: unknown[]): items is SelectOption[] => Array.isArray(items) && items.every(item => isOption(item));\n\n/**\n * Check if item is a well configured optgroup\n * @param optgroup - select option\n * @returns select optgroup type is valid\n */\nconst isOptGroup = (optgroup: unknown): optgroup is OptGroup =>\n typeof optgroup === 'object' && typeof (optgroup as OptGroup).group === 'string' && allItemsAreOptions((optgroup as OptGroup).options);\n\n/**\n * Group options\n * @param acc - reduce accumulator\n * @param item - item to add\n * @returns grouped options\n */\nconst groupOptions = (acc: (SelectOption | OptGroup)[], { group, title, value, disabled }: SelectOption): (SelectOption | OptGroup)[] => {\n if (group !== undefined) {\n // Check if group is already created\n const optGroup: OptGroup = (acc as OptGroup[]).find(grp => grp.group === group);\n // Add to group\n if (optGroup !== undefined) {\n optGroup.options.push({ title, value, disabled });\n }\n // Create group\n else {\n acc.push({ group, options: [{ title, value, disabled }] });\n }\n } else {\n acc.push({ title, value, disabled });\n }\n return acc;\n};\n\n@Component({\n tag: 'mg-input-select',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input-select.css',\n shadow: true,\n})\nexport class MgInputSelect {\n /************\n * Internal *\n ************/\n\n // HTML selector\n private input: HTMLSelectElement;\n\n // Locales\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n private handlerInProgress: Handler;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputSelectElement;\n\n /**\n * Component value\n */\n @Prop({ mutable: true }) value: any;\n @Watch('value')\n validateValue(newValue: MgInputSelect['value']): void {\n if (allItemsAreString(this.items) && typeof newValue === 'string') {\n this.readonlyValue = this.input?.value ? this.input.value : newValue;\n } else if (allItemsAreOptions(this.items)) {\n this.readonlyValue = this.items.find(item => item.value === newValue)?.title;\n } else {\n this.readonlyValue = null;\n }\n this.valueChange.emit(newValue);\n }\n\n /**\n * Items are the possible options to select\n */\n @Prop() items!: (string | SelectOption)[];\n @Watch('items')\n validateItems(newValue: MgInputSelect['items']): void {\n // Empty options\n if (newValue.length === 0) {\n this.options = [];\n }\n // String array\n else if (allItemsAreString(newValue)) {\n if (typeof this.value === 'string') this.valueExist = newValue.includes(this.value);\n this.options = newValue.map(item => ({ title: item, value: item }));\n }\n // Object array\n else if (allItemsAreOptions(newValue)) {\n this.valueExist = newValue.map(item => item.value).includes(this.value);\n // Grouped object options\n if (newValue.some(item => Boolean(item.group))) {\n this.options = newValue.reduce(groupOptions, []);\n }\n // Standart object options\n else {\n this.options = newValue;\n }\n } else {\n throw new Error('<mg-input-select> prop \"items\" is required, can be an empty Array or all items must be the same type: string or Option.');\n }\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n\n /**\n * Input name\n * If not set the value equals the identifier\n */\n @Prop() name = this.identifier;\n\n /**\n * Input label\n */\n @Prop() label!: string;\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop: boolean;\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide = false;\n\n /**\n * Input placeholder.\n * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text.\n */\n @Prop({ mutable: true }) placeholder: string;\n\n /**\n * Option to remove placeholder\n */\n @Prop() placeholderHide = false;\n\n /**\n * Option to disable placeholder\n */\n @Prop() placeholderDisabled = false;\n\n /**\n * Define if input is required\n */\n @Prop() required = false;\n\n /**\n * Define if input is readonly\n */\n @Prop() readonly = false;\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n handleValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void {\n if (this.input !== undefined) {\n this.input[prop] = newValue;\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n this.hasDisplayedError = false;\n }\n }\n }\n\n /**\n * Define input width\n */\n @Prop({ reflect: true }) mgWidth: Width;\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip: string;\n\n /**\n * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText: string;\n\n /**\n * Define input valid state\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input invalid state\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-input--select']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Formated items for display\n */\n @State() options: (SelectOption | OptGroup)[];\n\n /**\n * Does value match any item option\n */\n @State() valueExist: boolean;\n\n /**\n * Does value match any item option\n */\n @State() readonlyValue: string;\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<MgInputSelect['value']>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<boolean>;\n\n /**\n * Display input error if it exists.\n */\n @Method()\n async displayError(): Promise<void> {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n }\n\n /**\n * Set an error and display a custom error message.\n * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\n * It must be paired with an error message to display for the given context.\n * When used to set validity to `false`, you should use this method again to reset the validity to `true`.\n * @param valid - value indicating the validity\n * @param errorMessage - the error message to display\n */\n @Method()\n async setError(valid: MgInputSelect['valid'], errorMessage: string): Promise<void> {\n if (typeof valid !== 'boolean') {\n throw new Error('<mg-input-select> method \"setError()\" param \"valid\" must be a boolean');\n } else if (!isValidString(errorMessage)) {\n throw new Error('<mg-input-select> method \"setError()\" param \"errorMessage\" must be a string');\n } else {\n this.setValidity(valid);\n this.setErrorMessage(valid ? undefined : errorMessage);\n this.hasDisplayedError = this.invalid;\n }\n }\n\n /**\n * Method to set validity values\n * @param newValue - valid new value\n */\n private setValidity(newValue: MgInputSelect['valid']) {\n const oldValidValue = this.valid;\n this.valid = newValue;\n this.invalid = !this.valid;\n // We need to send valid event even if it is the same value\n if (this.handlerInProgress === undefined || (this.handlerInProgress === Handler.BLUR && this.valid !== oldValidValue)) this.inputValid.emit(this.valid);\n }\n /**\n * Handle input event\n */\n private handleInput = (): void => {\n this.updateValue();\n if (this.hasDisplayedError) this.setErrorMessage();\n };\n\n /**\n * Method to compare item.title with input.value\n * @param item - item to compare with\n * @returns truthy if input.value is an item\n */\n private isInputValue = (item: SelectOption): boolean => item.title === this.input?.value;\n\n /**\n * value props setter\n * @param newValue - value to update with\n */\n private setValue = (newValue: MgInputSelect['value']): void => {\n this.checkValidity();\n this.value = newValue;\n };\n\n /**\n * Update value from input.value\n */\n private updateValue = (): void => {\n if (this.input.value === '') {\n this.setValue(null);\n } else if (allItemsAreString(this.items) && this.items.includes(this.input.value)) {\n this.setValue(this.input.value);\n } else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {\n this.setValue(this.items.find(this.isInputValue).value);\n } else {\n // before set newValue with push to options[] the unknown input.value with a disable satus\n this.options.push({ title: this.input.value, value: this.input.value, disabled: true });\n this.setValue(this.input.value);\n }\n };\n\n /**\n * Handle blur event\n */\n private handleBlur = (): void => {\n this.handlerInProgress = Handler.BLUR;\n this.displayError().finally(() => {\n // reset guard\n this.handlerInProgress = undefined;\n });\n };\n\n /**\n * Input value is disabled\n * @returns truthy if input value is disabled\n */\n private isDisabledValue = (): boolean => allItemsAreOptions(this.options) && this.options.find(this.isInputValue)?.disabled === true;\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.setValidity(!this.isDisabledValue() && (this.readonly || this.disabled || (this.input?.checkValidity !== undefined ? this.input.checkValidity() : true)));\n };\n\n /**\n * Set input error message\n * @param errorMessage - errorMessage override\n */\n private setErrorMessage = (errorMessage?: string): void => {\n // Set error message\n this.errorMessage = undefined;\n if (!this.valid) {\n if (errorMessage !== undefined) {\n this.errorMessage = errorMessage;\n } else if (this.input.validity.valueMissing) {\n this.errorMessage = this.messages.errors.required;\n }\n }\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n * @returns timeout\n */\n componentWillLoad(): ReturnType<typeof setTimeout> {\n // Get locales\n this.messages = initLocales(this.element).messages;\n // Validate\n this.validateItems(this.items);\n this.validateValue(this.value);\n // Set default placeholder\n if (this.placeholder === undefined || this.placeholder === '') {\n this.placeholder = this.messages.input.select.placeholder;\n }\n // Check validity when component is ready\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n this.checkValidity();\n }, 0);\n }\n\n /**\n * Render option\n * @param option - to render\n * @returns render option\n */\n private renderOption = (option: SelectOption): HTMLElement => (\n <option key={option.title} value={option.title} selected={JSON.stringify(this.value) === JSON.stringify(option.value)} disabled={option.disabled}>\n {option.title}\n </option>\n );\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <MgInput\n identifier={this.identifier}\n classCollection={this.classCollection}\n ariaDescribedbyIDs={[]}\n label={this.label}\n labelOnTop={this.labelOnTop}\n labelHide={this.labelHide}\n required={this.required}\n readonly={this.readonly}\n mgWidth={this.mgWidth}\n disabled={this.disabled}\n value={undefined}\n readonlyValue={this.readonlyValue}\n tooltip={this.tooltip}\n helpText={this.helpText}\n errorMessage={this.errorMessage}\n isFieldset={false}\n >\n <select\n class=\"mg-c-input__box\"\n id={this.identifier}\n name={this.name}\n title={this.placeholder}\n disabled={this.disabled}\n required={this.required}\n aria-invalid={(this.invalid === true).toString()}\n onInput={this.handleInput}\n onBlur={this.handleBlur}\n ref={(el: HTMLSelectElement) => {\n if (el !== null) this.input = el;\n }}\n >\n {(!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder\n <option value=\"\" disabled={this.placeholderDisabled && this.valueExist}>\n {this.placeholder}\n </option>\n )}\n {this.options.map(option =>\n isOptGroup(option) ? (\n <optgroup label={option.group} key={option.group}>\n {option.options.map(this.renderOption)}\n </optgroup>\n ) : (\n isOption(option) && this.renderOption(option)\n ),\n )}\n </select>\n </MgInput>\n );\n }\n}\n"]}
|
package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js
CHANGED
|
@@ -166,6 +166,7 @@ describe('mg-input-select', () => {
|
|
|
166
166
|
})),
|
|
167
167
|
});
|
|
168
168
|
jest.spyOn(page.rootInstance.valueChange, 'emit');
|
|
169
|
+
const inputValidSpy = jest.spyOn(page.rootInstance.inputValid, 'emit');
|
|
169
170
|
input.dispatchEvent(new CustomEvent('focus', { bubbles: true }));
|
|
170
171
|
await page.waitForChanges();
|
|
171
172
|
expect(page.root).toMatchSnapshot(); //Snapshot on focus
|
|
@@ -174,6 +175,9 @@ describe('mg-input-select', () => {
|
|
|
174
175
|
await page.waitForChanges();
|
|
175
176
|
const expectedEmitValue = selectedOption !== '' ? (typeof items[selectedOption] === 'object' ? items[selectedOption].value : items[selectedOption]) : null;
|
|
176
177
|
expect(page.rootInstance.valueChange.emit).toHaveBeenCalledWith(expectedEmitValue);
|
|
178
|
+
input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
|
|
179
|
+
await page.waitForChanges();
|
|
180
|
+
expect(inputValidSpy).toHaveBeenCalledTimes(1);
|
|
177
181
|
});
|
|
178
182
|
describe.each(['readonly', 'disabled'])('validity, case next state is %s', nextState => {
|
|
179
183
|
test.each([
|
package/dist/collection/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mg-input-select.spec.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,QAAQ,MAAM,yCAAyC,CAAC;AAE/D,MAAM,OAAO,GAAG,KAAK,EAAC,IAAI,EAAC,EAAE;EAC3B,MAAM,IAAI,GAAG,WAAW,CAAC;IACvB,UAAU,EAAE,CAAC,aAAa,CAAC;IAC3B,QAAQ,EAAE,GAAG,EAAE,CAAC,uCAAqB,IAAI,EAAoB;GAC9D,CAAC,CAAC;EAEH,IAAI,CAAC,YAAY,EAAE,CAAC;EAEpB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;EAC/B,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;EACvC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;EAC7C,IAAI,CAAC,IAAI,CAAC;IACR,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,EAAE;IACvD,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE;IACjF,EAAE,KAAK,EAAE,OAAO,EAAE,UAA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CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;EACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgInputSelect } from '../mg-input-select';\nimport { SelectOption } from '../mg-input-select.conf';\nimport messages from '../../../../../locales/en/messages.json';\n\nconst getPage = async args => {\n const page = newSpecPage({\n components: [MgInputSelect],\n template: () => <mg-input-select {...args}></mg-input-select>,\n });\n\n jest.runAllTimers();\n\n return page;\n};\n\ndescribe('mg-input-select', () => {\n beforeEach(() => jest.useFakeTimers());\n afterEach(() => jest.runOnlyPendingTimers());\n test.each([\n { label: 'label', identifier: 'identifier', items: [] },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'] },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], labelHide: true },\n {\n label: 'label',\n identifier: 'identifier',\n items: [\n { title: 'blu', value: 'u' },\n { title: 'bli', value: 'i' },\n { title: 'blo', value: 'o' },\n { title: 'bla', value: 'a' },\n ],\n },\n {\n label: 'label',\n identifier: 'identifier',\n items: [\n { title: 'blu', value: 'u', group: 'blu' },\n { title: 'bli', value: 'i', group: 'blu' },\n { title: 'blo', value: 'o', group: 'blo' },\n { title: 'bla', value: 'a' },\n ],\n },\n {\n label: 'label',\n identifier: 'identifier',\n items: [\n { title: 'blu', value: 'u' },\n { title: 'bli', value: 'i' },\n { title: 'blo', value: 'o' },\n { title: 'bla', value: 'a' },\n ],\n readonly: true,\n value: 'o',\n },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], labelOnTop: true },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], readonly: true },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], readonly: true, labelOnTop: true, tooltip: 'Tooltip message' },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], required: true, helpText: 'My help text', value: 'blu' },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], required: true, readonly: true, helpText: 'My help text', value: 'blu' },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], required: true, disabled: true, helpText: 'My help text', value: 'blu' },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], tooltip: 'My Tooltip Message' },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], tooltip: 'My Tooltip Message', labelOnTop: true },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], placeholder: 'placeholder' },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], placeholder: 'placeholder', placeholderHide: true },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], placeholder: 'placeholder', placeholderDisabled: true },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], placeholder: 'placeholder', placeholderDisabled: true, value: 'ble' },\n ])('Should render with args %s:', async args => {\n const { root } = await getPage(args);\n expect(root).toMatchSnapshot();\n });\n\n test.each(['', ' ', undefined])('Should not render with invalid identifier property: %s', async identifier => {\n expect.assertions(1);\n try {\n await getPage({ identifier, items: ['blu', 'bli', 'blo', 'bla'] });\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"identifier\" is required.');\n }\n });\n\n test.each(['', ' ', undefined])('Should throw error with invalid label property: %s', async label => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', label, items: ['blu', 'bli', 'blo', 'bla'] });\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"label\" is required.');\n }\n });\n\n test('Should throw an error with labelOnTop & labelHide set to true', async () => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', label: 'batman', labelOnTop: true, labelHide: true, items: ['batman', 'joker'] });\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"labelOnTop\" must not be paired with the prop \"labelHide\"');\n }\n });\n\n test.each([[['blu', { title: 'blu', value: 'blu' }]], [['blu', { blu: 'blu' }]], [[{ title: 'blu', value: 'blu' }, { blu: 'blu' }]]])(\n 'Should throw error with invalid items property: %s',\n async items => {\n expect.assertions(1);\n try {\n await getPage({ label: 'Label', items });\n } catch (err) {\n expect(err.message).toMatch('<mg-input-select> prop \"items\" is required, can be an empty Array or all items must be the same type: string or Option.');\n }\n },\n );\n\n test.each([\n { items: ['batman', 'robin', 'joker', 'bane'], selectedOption: '' },\n { items: ['batman', 'robin', 'joker', 'bane'], selectedOption: 3 },\n {\n items: [\n { title: 'batman', value: 'u' },\n { title: 'robin', value: 'i' },\n { title: 'joker', value: 'o' },\n { title: 'bane', value: 'a' },\n ],\n selectedOption: 2,\n },\n {\n items: [\n { title: 'batman', value: 1 },\n { title: 'robin', value: 2 },\n { title: 'joker', value: 3 },\n { title: 'bane', value: 4 },\n ],\n selectedOption: 1,\n },\n {\n items: [\n { title: 'batman', value: true },\n { title: 'robin', value: false },\n ],\n selectedOption: 0,\n },\n {\n items: [\n { title: 'blu', value: undefined },\n { title: 'bli', value: 42 },\n ],\n selectedOption: 0,\n },\n {\n items: [\n { title: 'batman', value: { name: 'Batman' } },\n { title: 'robin', value: { name: 'Robin' } },\n ],\n selectedOption: 1,\n },\n {\n items: [\n { title: 'Batman', value: { name: 'Batman', group: 'Heroes' } },\n { title: 'Robin', value: { name: 'Robin', group: 'Heroes' } },\n { title: 'Joker', value: { name: 'Joker', group: 'Super Vilains' } },\n { title: 'Bane', value: { name: 'Bane', group: 'Super Vilains' } },\n ],\n selectedOption: 2,\n },\n ])('Should trigger events for (%s)', async ({ items, selectedOption }) => {\n const args = { label: 'label', items, identifier: 'identifier', helpText: 'My help text', value: 'blu' };\n const page = await getPage(args);\n\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n input.checkValidity = jest.fn(() => true);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: false,\n })),\n });\n\n jest.spyOn(page.rootInstance.valueChange, 'emit');\n\n input.dispatchEvent(new CustomEvent('focus', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot(); //Snapshot on focus\n\n input.value = items[selectedOption]?.title || items[selectedOption] || selectedOption;\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n await page.waitForChanges();\n const expectedEmitValue = selectedOption !== '' ? (typeof items[selectedOption] === 'object' ? (items[selectedOption] as SelectOption).value : items[selectedOption]) : null;\n expect(page.rootInstance.valueChange.emit).toHaveBeenCalledWith(expectedEmitValue);\n });\n\n describe.each(['readonly', 'disabled'])('validity, case next state is %s', nextState => {\n test.each([\n { validity: true, valueMissing: false },\n { validity: false, valueMissing: true },\n ])('validity (%s), valueMissing (%s)', async ({ validity, valueMissing }) => {\n const args = { label: 'label', items: ['blu', 'bli', 'blo', 'bla'], identifier: 'identifier', patternErrorMessage: 'Non' };\n const page = await getPage(args);\n\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n input.checkValidity = jest.fn(() => validity);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing,\n })),\n });\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n if (validity) {\n expect(page.rootInstance.errorMessage).toBeUndefined();\n } else if (valueMissing) {\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n }\n expect(page.rootInstance.valid).toEqual(validity);\n expect(page.rootInstance.invalid).toEqual(!validity);\n if (valueMissing) {\n expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled FALSE\n element[nextState] = true;\n await page.waitForChanges();\n expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled TRUE\n }\n });\n });\n\n test(\"display error with displayError component's public method\", async () => {\n const page = await getPage({ label: 'label', items: ['batman', 'robin', 'joker', 'bane'], identifier: 'identifier', required: true });\n\n expect(page.root).toMatchSnapshot();\n\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n input.checkValidity = jest.fn(() => false);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: true,\n })),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test.each([\n {\n valid: true,\n errorMessage: 'Override error',\n },\n {\n valid: false,\n errorMessage: 'Override error',\n },\n ])(\"should display override error with setError component's public method\", async params => {\n const page = await getPage({ label: 'label', identifier: 'identifier', items: ['batman', 'robin', 'joker', 'bane'], required: true });\n\n expect(page.root).toMatchSnapshot();\n\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n Object.defineProperty(input, 'validity', {\n get: () => ({}),\n });\n\n await element.setError(params.valid, params.errorMessage);\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test.each([\n {\n valid: '',\n errorMessage: 'Override error',\n error: '<mg-input-select> method \"setError()\" param \"valid\" must be a boolean',\n },\n {\n valid: undefined,\n errorMessage: 'Override error',\n error: '<mg-input-select> method \"setError()\" param \"valid\" must be a boolean',\n },\n {\n valid: true,\n errorMessage: ' ',\n error: '<mg-input-select> method \"setError()\" param \"errorMessage\" must be a string',\n },\n {\n valid: true,\n errorMessage: true,\n error: '<mg-input-select> method \"setError()\" param \"errorMessage\" must be a string',\n },\n ])(\"shloud throw error with setError component's public method invalid params\", async params => {\n expect.assertions(1);\n try {\n const page = await getPage({ label: 'label', identifier: 'identifier', items: ['batman', 'robin', 'joker', 'bane'], required: true });\n const element = page.doc.querySelector('mg-input-select');\n\n await element.setError(params.valid as unknown as boolean, params.errorMessage as unknown as string);\n await page.waitForChanges();\n } catch (err) {\n expect(err.message).toMatch(params.error);\n }\n });\n\n test.each(['fr', 'xx'])('display error message with locale: %s', async lang => {\n const page = await getPage({ label: 'label', items: ['batman', 'robin', 'joker', 'bane'], identifier: 'identifier', required: true, lang });\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n input.checkValidity = jest.fn(() => false);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: true,\n })),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test('Should remove error on input', async () => {\n const page = await getPage({ label: 'label', items: ['batman', 'robin', 'joker', 'bane'], identifier: 'identifier', required: true });\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);\n Object.defineProperty(input, 'validity', {\n get: jest\n .fn()\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n }),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n\n input.value = 'batman';\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n });\n\n test('Should remove error on input when required change dynamically', async () => {\n const page = await getPage({ label: 'label', items: ['batman', 'robin', 'joker', 'bane'], identifier: 'identifier', required: true });\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);\n Object.defineProperty(input, 'validity', {\n get: jest\n .fn()\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n }),\n });\n\n await element.displayError();\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n\n element.required = false;\n await page.waitForChanges();\n\n // Error message should disapear and change the hasDisplayedError status\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n\n element.required = true;\n await page.waitForChanges();\n\n // If back on required the message is still not displayed\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n });\n\n test.each([[['batman']], [[{ title: 'batman', value: 'b' }]]])('Should not update value with invalid input value: %s', async items => {\n const page = await getPage({ identifier: 'identifier', label: 'batman', items });\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n input.checkValidity = jest.fn().mockReturnValueOnce(true);\n jest.spyOn(page.rootInstance.inputValid, 'emit');\n\n input.value = 'hello';\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n\n await page.waitForChanges();\n\n expect(element.value).toBe('hello');\n expect(page.rootInstance.inputValid.emit).toHaveBeenCalledWith(false);\n });\n\n test('Should update mg-width', async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], mgWidth: undefined });\n const element = page.doc.querySelector('mg-input-select');\n\n element.mgWidth = 2;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n element.mgWidth = 4;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n element.mgWidth = 16;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n element.mgWidth = 'full';\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"mg-input-select.spec.js","sourceRoot":"","sources":["../../../../../../src/components/molecules/inputs/mg-input-select/test/mg-input-select.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,QAAQ,MAAM,yCAAyC,CAAC;AAE/D,MAAM,OAAO,GAAG,KAAK,EAAC,IAAI,EAAC,EAAE;EAC3B,MAAM,IAAI,GAAG,WAAW,CAAC;IACvB,UAAU,EAAE,CAAC,aAAa,CAAC;IAC3B,QAAQ,EAAE,GAAG,EAAE,CAAC,uCAAqB,IAAI,EAAoB;GAC9D,CAAC,CAAC;EAEH,IAAI,CAAC,YAAY,EAAE,CAAC;EAEpB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;EAC/B,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;EACvC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;EAC7C,IAAI,CAAC,IAAI,CAAC;IACR,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,EAAE;IACvD,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE;IACjF,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE;IAClG;MACE,KAAK,EAAE,OAAO;MACd,UAAU,EAAE,YAAY;MACxB,KAAK,EA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,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;IAEpC,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC;IACzB,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;EACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { h } from '@stencil/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { MgInputSelect } from '../mg-input-select';\nimport { SelectOption } from '../mg-input-select.conf';\nimport messages from '../../../../../locales/en/messages.json';\n\nconst getPage = async args => {\n const page = newSpecPage({\n components: [MgInputSelect],\n template: () => <mg-input-select {...args}></mg-input-select>,\n });\n\n jest.runAllTimers();\n\n return page;\n};\n\ndescribe('mg-input-select', () => {\n beforeEach(() => jest.useFakeTimers());\n afterEach(() => jest.runOnlyPendingTimers());\n test.each([\n { label: 'label', identifier: 'identifier', items: [] },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'] },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], labelHide: true },\n {\n label: 'label',\n identifier: 'identifier',\n items: [\n { title: 'blu', value: 'u' },\n { title: 'bli', value: 'i' },\n { title: 'blo', value: 'o' },\n { title: 'bla', value: 'a' },\n ],\n },\n {\n label: 'label',\n identifier: 'identifier',\n items: [\n { title: 'blu', value: 'u', group: 'blu' },\n { title: 'bli', value: 'i', group: 'blu' },\n { title: 'blo', value: 'o', group: 'blo' },\n { title: 'bla', value: 'a' },\n ],\n },\n {\n label: 'label',\n identifier: 'identifier',\n items: [\n { title: 'blu', value: 'u' },\n { title: 'bli', value: 'i' },\n { title: 'blo', value: 'o' },\n { title: 'bla', value: 'a' },\n ],\n readonly: true,\n value: 'o',\n },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], labelOnTop: true },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], readonly: true },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], readonly: true, labelOnTop: true, tooltip: 'Tooltip message' },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], required: true, helpText: 'My help text', value: 'blu' },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], required: true, readonly: true, helpText: 'My help text', value: 'blu' },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], required: true, disabled: true, helpText: 'My help text', value: 'blu' },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], tooltip: 'My Tooltip Message' },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], tooltip: 'My Tooltip Message', labelOnTop: true },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], placeholder: 'placeholder' },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], placeholder: 'placeholder', placeholderHide: true },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], placeholder: 'placeholder', placeholderDisabled: true },\n { label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], placeholder: 'placeholder', placeholderDisabled: true, value: 'ble' },\n ])('Should render with args %s:', async args => {\n const { root } = await getPage(args);\n expect(root).toMatchSnapshot();\n });\n\n test.each(['', ' ', undefined])('Should not render with invalid identifier property: %s', async identifier => {\n expect.assertions(1);\n try {\n await getPage({ identifier, items: ['blu', 'bli', 'blo', 'bla'] });\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"identifier\" is required.');\n }\n });\n\n test.each(['', ' ', undefined])('Should throw error with invalid label property: %s', async label => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', label, items: ['blu', 'bli', 'blo', 'bla'] });\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"label\" is required.');\n }\n });\n\n test('Should throw an error with labelOnTop & labelHide set to true', async () => {\n expect.assertions(1);\n try {\n await getPage({ identifier: 'identifier', label: 'batman', labelOnTop: true, labelHide: true, items: ['batman', 'joker'] });\n } catch (err) {\n expect(err.message).toMatch('<mg-input> prop \"labelOnTop\" must not be paired with the prop \"labelHide\"');\n }\n });\n\n test.each([[['blu', { title: 'blu', value: 'blu' }]], [['blu', { blu: 'blu' }]], [[{ title: 'blu', value: 'blu' }, { blu: 'blu' }]]])(\n 'Should throw error with invalid items property: %s',\n async items => {\n expect.assertions(1);\n try {\n await getPage({ label: 'Label', items });\n } catch (err) {\n expect(err.message).toMatch('<mg-input-select> prop \"items\" is required, can be an empty Array or all items must be the same type: string or Option.');\n }\n },\n );\n\n test.each([\n { items: ['batman', 'robin', 'joker', 'bane'], selectedOption: '' },\n { items: ['batman', 'robin', 'joker', 'bane'], selectedOption: 3 },\n {\n items: [\n { title: 'batman', value: 'u' },\n { title: 'robin', value: 'i' },\n { title: 'joker', value: 'o' },\n { title: 'bane', value: 'a' },\n ],\n selectedOption: 2,\n },\n {\n items: [\n { title: 'batman', value: 1 },\n { title: 'robin', value: 2 },\n { title: 'joker', value: 3 },\n { title: 'bane', value: 4 },\n ],\n selectedOption: 1,\n },\n {\n items: [\n { title: 'batman', value: true },\n { title: 'robin', value: false },\n ],\n selectedOption: 0,\n },\n {\n items: [\n { title: 'blu', value: undefined },\n { title: 'bli', value: 42 },\n ],\n selectedOption: 0,\n },\n {\n items: [\n { title: 'batman', value: { name: 'Batman' } },\n { title: 'robin', value: { name: 'Robin' } },\n ],\n selectedOption: 1,\n },\n {\n items: [\n { title: 'Batman', value: { name: 'Batman', group: 'Heroes' } },\n { title: 'Robin', value: { name: 'Robin', group: 'Heroes' } },\n { title: 'Joker', value: { name: 'Joker', group: 'Super Vilains' } },\n { title: 'Bane', value: { name: 'Bane', group: 'Super Vilains' } },\n ],\n selectedOption: 2,\n },\n ])('Should trigger events for (%s)', async ({ items, selectedOption }) => {\n const args = { label: 'label', items, identifier: 'identifier', helpText: 'My help text', value: 'blu' };\n const page = await getPage(args);\n\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n input.checkValidity = jest.fn(() => true);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: false,\n })),\n });\n\n jest.spyOn(page.rootInstance.valueChange, 'emit');\n const inputValidSpy = jest.spyOn(page.rootInstance.inputValid, 'emit');\n\n input.dispatchEvent(new CustomEvent('focus', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot(); //Snapshot on focus\n\n input.value = items[selectedOption]?.title || items[selectedOption] || selectedOption;\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n await page.waitForChanges();\n const expectedEmitValue = selectedOption !== '' ? (typeof items[selectedOption] === 'object' ? (items[selectedOption] as SelectOption).value : items[selectedOption]) : null;\n expect(page.rootInstance.valueChange.emit).toHaveBeenCalledWith(expectedEmitValue);\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n expect(inputValidSpy).toHaveBeenCalledTimes(1);\n });\n\n describe.each(['readonly', 'disabled'])('validity, case next state is %s', nextState => {\n test.each([\n { validity: true, valueMissing: false },\n { validity: false, valueMissing: true },\n ])('validity (%s), valueMissing (%s)', async ({ validity, valueMissing }) => {\n const args = { label: 'label', items: ['blu', 'bli', 'blo', 'bla'], identifier: 'identifier', patternErrorMessage: 'Non' };\n const page = await getPage(args);\n\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n input.checkValidity = jest.fn(() => validity);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing,\n })),\n });\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n if (validity) {\n expect(page.rootInstance.errorMessage).toBeUndefined();\n } else if (valueMissing) {\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n }\n expect(page.rootInstance.valid).toEqual(validity);\n expect(page.rootInstance.invalid).toEqual(!validity);\n if (valueMissing) {\n expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled FALSE\n element[nextState] = true;\n await page.waitForChanges();\n expect(page.root).toMatchSnapshot(); //Snapshot with readonly/disabled TRUE\n }\n });\n });\n\n test(\"display error with displayError component's public method\", async () => {\n const page = await getPage({ label: 'label', items: ['batman', 'robin', 'joker', 'bane'], identifier: 'identifier', required: true });\n\n expect(page.root).toMatchSnapshot();\n\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n input.checkValidity = jest.fn(() => false);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: true,\n })),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test.each([\n {\n valid: true,\n errorMessage: 'Override error',\n },\n {\n valid: false,\n errorMessage: 'Override error',\n },\n ])(\"should display override error with setError component's public method\", async params => {\n const page = await getPage({ label: 'label', identifier: 'identifier', items: ['batman', 'robin', 'joker', 'bane'], required: true });\n\n expect(page.root).toMatchSnapshot();\n\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n Object.defineProperty(input, 'validity', {\n get: () => ({}),\n });\n\n await element.setError(params.valid, params.errorMessage);\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test.each([\n {\n valid: '',\n errorMessage: 'Override error',\n error: '<mg-input-select> method \"setError()\" param \"valid\" must be a boolean',\n },\n {\n valid: undefined,\n errorMessage: 'Override error',\n error: '<mg-input-select> method \"setError()\" param \"valid\" must be a boolean',\n },\n {\n valid: true,\n errorMessage: ' ',\n error: '<mg-input-select> method \"setError()\" param \"errorMessage\" must be a string',\n },\n {\n valid: true,\n errorMessage: true,\n error: '<mg-input-select> method \"setError()\" param \"errorMessage\" must be a string',\n },\n ])(\"shloud throw error with setError component's public method invalid params\", async params => {\n expect.assertions(1);\n try {\n const page = await getPage({ label: 'label', identifier: 'identifier', items: ['batman', 'robin', 'joker', 'bane'], required: true });\n const element = page.doc.querySelector('mg-input-select');\n\n await element.setError(params.valid as unknown as boolean, params.errorMessage as unknown as string);\n await page.waitForChanges();\n } catch (err) {\n expect(err.message).toMatch(params.error);\n }\n });\n\n test.each(['fr', 'xx'])('display error message with locale: %s', async lang => {\n const page = await getPage({ label: 'label', items: ['batman', 'robin', 'joker', 'bane'], identifier: 'identifier', required: true, lang });\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n input.checkValidity = jest.fn(() => false);\n Object.defineProperty(input, 'validity', {\n get: jest.fn(() => ({\n valueMissing: true,\n })),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n\n test('Should remove error on input', async () => {\n const page = await getPage({ label: 'label', items: ['batman', 'robin', 'joker', 'bane'], identifier: 'identifier', required: true });\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);\n Object.defineProperty(input, 'validity', {\n get: jest\n .fn()\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n }),\n });\n\n await element.displayError();\n\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n\n input.value = 'batman';\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n\n input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n });\n\n test('Should remove error on input when required change dynamically', async () => {\n const page = await getPage({ label: 'label', items: ['batman', 'robin', 'joker', 'bane'], identifier: 'identifier', required: true });\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n //mock validity\n input.checkValidity = jest.fn().mockReturnValueOnce(false).mockReturnValueOnce(true).mockReturnValueOnce(true);\n Object.defineProperty(input, 'validity', {\n get: jest\n .fn()\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: true,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n })\n .mockReturnValueOnce({\n valueMissing: false,\n }),\n });\n\n await element.displayError();\n await page.waitForChanges();\n\n expect(page.rootInstance.hasDisplayedError).toEqual(true);\n expect(page.rootInstance.errorMessage).toEqual(messages.errors.required);\n\n element.required = false;\n await page.waitForChanges();\n\n // Error message should disapear and change the hasDisplayedError status\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n\n element.required = true;\n await page.waitForChanges();\n\n // If back on required the message is still not displayed\n expect(page.rootInstance.hasDisplayedError).toEqual(false);\n expect(page.rootInstance.errorMessage).toBeUndefined();\n });\n\n test.each([[['batman']], [[{ title: 'batman', value: 'b' }]]])('Should not update value with invalid input value: %s', async items => {\n const page = await getPage({ identifier: 'identifier', label: 'batman', items });\n const element = page.doc.querySelector('mg-input-select');\n const input = element.shadowRoot.querySelector('select');\n\n input.checkValidity = jest.fn().mockReturnValueOnce(true);\n jest.spyOn(page.rootInstance.inputValid, 'emit');\n\n input.value = 'hello';\n input.dispatchEvent(new CustomEvent('input', { bubbles: true }));\n\n await page.waitForChanges();\n\n expect(element.value).toBe('hello');\n expect(page.rootInstance.inputValid.emit).toHaveBeenCalledWith(false);\n });\n\n test('Should update mg-width', async () => {\n const page = await getPage({ label: 'label', identifier: 'identifier', items: ['blu', 'bli', 'blo', 'bla'], mgWidth: undefined });\n const element = page.doc.querySelector('mg-input-select');\n\n element.mgWidth = 2;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n element.mgWidth = 4;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n element.mgWidth = 16;\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n\n element.mgWidth = 'full';\n await page.waitForChanges();\n\n expect(page.root).toMatchSnapshot();\n });\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mg-input-text.conf.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-text/mg-input-text.conf.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mg-input-text.conf.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-text/mg-input-text.conf.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * TextType from text types\n */\nexport type TextType = 'text' | 'search';\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { MgInput } from "../MgInput";
|
|
3
|
+
import { Handler } from "../MgInput.conf";
|
|
3
4
|
import { ClassList, isValidString } from "../../../../utils/components.utils";
|
|
4
5
|
import { initLocales } from "../../../../locales";
|
|
5
6
|
const isDatalistOption = (options) => Array.isArray(options) && options.every(option => typeof option === 'string');
|
|
@@ -39,7 +40,11 @@ export class MgInputText {
|
|
|
39
40
|
this.classCollection.delete(this.classFocus);
|
|
40
41
|
this.classCollection = new ClassList(this.classCollection.classes);
|
|
41
42
|
// Display Error
|
|
42
|
-
this.
|
|
43
|
+
this.handlerInProgress = Handler.BLUR;
|
|
44
|
+
this.displayError().finally(() => {
|
|
45
|
+
// reset guard
|
|
46
|
+
this.handlerInProgress = undefined;
|
|
47
|
+
});
|
|
43
48
|
};
|
|
44
49
|
/**
|
|
45
50
|
* Check if input is valid
|
|
@@ -182,10 +187,12 @@ export class MgInputText {
|
|
|
182
187
|
* @param newValue - valid new value
|
|
183
188
|
*/
|
|
184
189
|
setValidity(newValue) {
|
|
190
|
+
const oldValidValue = this.valid;
|
|
185
191
|
this.valid = newValue;
|
|
186
192
|
this.invalid = !this.valid;
|
|
187
193
|
// We need to send valid event even if it is the same value
|
|
188
|
-
this.
|
|
194
|
+
if (this.handlerInProgress === undefined || (this.handlerInProgress === Handler.BLUR && this.valid !== oldValidValue))
|
|
195
|
+
this.inputValid.emit(this.valid);
|
|
189
196
|
}
|
|
190
197
|
/*************
|
|
191
198
|
* Lifecycle *
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mg-input-text.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-text/mg-input-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAgB,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,MAAM,gBAAgB,GAAG,CAAC,OAAkB,EAAuB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC;AAOpJ,MAAM,OAAO,WAAW;;IACtB;;kBAEc;IAEd,UAAU;IACF,eAAU,GAAG,iBAAiB,CAAC;IAC/B,4BAAuB,GAAG,mCAAmC,CAAC;IAC9D,iBAAY,GAAG,sBAAsB,CAAC;IAY9C,8CAA8C;IACtC,sBAAiB,GAAG,KAAK,CAAC;IAuOlC;;OAEG;IACK,gBAAW,GAAG,GAAS,EAAE;MAC/B,IAAI,CAAC,aAAa,EAAE,CAAC;MACrB,IAAI,IAAI,CAAC,iBAAiB,E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'@stencil/core';\nimport { MgInput } from '../MgInput';\nimport { Width } from '../MgInput.conf';\nimport { ClassList, isValidString } from '../../../../utils/components.utils';\nimport { initLocales } from '../../../../locales';\nimport { TextType } from './mg-input-text.conf';\n\nconst isDatalistOption = (options: unknown[]): options is string[] => Array.isArray(options) && options.every(option => typeof option === 'string');\n\n@Component({\n tag: 'mg-input-text',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input-text.css',\n shadow: true,\n})\nexport class MgInputText {\n /************\n * Internal *\n ************/\n\n // Classes\n private classFocus = 'mg-u-is-focused';\n private classIsInputGroupAppend = 'mg-c-input--is-input-group-append';\n private classHasIcon = 'mg-c-input--has-icon';\n\n // IDs\n private characterLeftId;\n private datalistId;\n\n // HTML selector\n private input: HTMLInputElement;\n\n // Locales\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputTextElement;\n\n /**\n * Component value\n */\n @Prop({ mutable: true, reflect: true }) value: string;\n @Watch('value')\n handleValue(newValue: string): void {\n this.valueChange.emit(newValue);\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n\n /**\n * Input name\n * If not set the value equals the identifier\n */\n @Prop() name: string = this.identifier;\n\n /**\n * Input label\n */\n @Prop() label!: string;\n\n /**\n * Input type\n */\n @Prop() type: TextType = 'text';\n\n /**\n * Input icon\n */\n @Prop() icon: string;\n @Watch('icon')\n validateIcon(newValue: string): void {\n if (newValue !== undefined) {\n this.classCollection.add(this.classHasIcon);\n } else {\n this.classCollection.delete(this.classHasIcon);\n }\n }\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop: boolean;\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide = false;\n\n /**\n * Input placeholder.\n * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text.\n */\n @Prop() placeholder: string;\n\n /**\n * Define datalist options\n */\n @Prop() datalistoptions: string[];\n @Watch('datalistoptions')\n validateDatalistoptions(newValue: MgInputText['datalistoptions']) {\n if (Boolean(newValue) && !isDatalistOption(newValue)) {\n throw new Error('<mg-input-text> prop \"datalistoptions\" values must be the same type, string.');\n }\n }\n\n /**\n * Input max length\n */\n @Prop() maxlength = 400;\n\n /**\n * Define if input is required\n */\n @Prop() required = false;\n\n /**\n * Define if input is readonly\n */\n @Prop() readonly = false;\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n handleValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void {\n if (this.input !== undefined) {\n this.input[prop] = newValue;\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n this.hasDisplayedError = false;\n }\n }\n }\n\n /**\n * Define input width\n */\n @Prop() mgWidth: Width = 'full';\n\n /**\n * Define input pattern to validate\n */\n @Prop() pattern: string;\n\n /**\n * Define input pattern error message\n */\n @Prop() patternErrorMessage: string;\n @Watch('pattern')\n @Watch('patternErrorMessage')\n validatePattern(newValue: string): void {\n if (newValue !== undefined && !(isValidString(this.pattern) && isValidString(this.patternErrorMessage))) {\n throw new Error('<mg-input-text> props \"pattern\" and \"patternErrorMessage\" must be non-empty string and paired.');\n }\n }\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip: string;\n\n /**\n * Define if component should display character left\n */\n @Prop() displayCharacterLeft = true;\n\n /**\n * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText: string;\n\n /**\n * Define input valid state\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input invalid state\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-input--text']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<string>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<boolean>;\n\n /**\n * Public method to play input focus\n */\n @Method()\n async setFocus(): Promise<void> {\n this.input.focus();\n }\n\n /**\n * Display input error if it exists.\n */\n @Method()\n async displayError(): Promise<void> {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n }\n\n /**\n * Set an error and display a custom error message.\n * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\n * It must be paired with an error message to display for the given context.\n * When used to set validity to `false`, you should use this method again to reset the validity to `true`.\n * @param valid - value indicating the validity\n * @param errorMessage - the error message to display\n */\n @Method()\n async setError(valid: MgInputText['valid'], errorMessage: string): Promise<void> {\n if (typeof valid !== 'boolean') {\n throw new Error('<mg-input-text> method \"setError()\" param \"valid\" must be a boolean');\n } else if (!isValidString(errorMessage)) {\n throw new Error('<mg-input-text> method \"setError()\" param \"errorMessage\" must be a string');\n } else {\n this.setValidity(valid);\n this.setErrorMessage(valid ? undefined : errorMessage);\n this.hasDisplayedError = this.invalid;\n }\n }\n\n /**\n * Method to set validity values\n * @param newValue - valid new value\n */\n private setValidity(newValue: MgInputText['valid']) {\n this.valid = newValue;\n this.invalid = !this.valid;\n // We need to send valid event even if it is the same value\n this.inputValid.emit(this.valid);\n }\n\n /**\n * Handle input event\n */\n private handleInput = (): void => {\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n }\n this.value = this.input.value;\n };\n\n /**\n * Handle focus event\n */\n private handleFocus = (): void => {\n this.classCollection.add(this.classFocus);\n this.classCollection = new ClassList(this.classCollection.classes);\n };\n\n /**\n * Handle blur event\n */\n private handleBlur = (): void => {\n // Manage focus\n this.classCollection.delete(this.classFocus);\n this.classCollection = new ClassList(this.classCollection.classes);\n // Display Error\n this.displayError();\n };\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.setValidity(this.readonly || this.disabled || (this.input?.checkValidity !== undefined ? this.input.checkValidity() : true));\n };\n\n /**\n * Set input error message\n * @param errorMessage - errorMessage override\n */\n private setErrorMessage = (errorMessage?: string): void => {\n // Set error message\n this.errorMessage = undefined;\n // Does have a custom error message\n if (!this.valid && errorMessage !== undefined) {\n this.errorMessage = errorMessage;\n }\n // Does not match pattern\n else if (!this.valid && this.input.validity.patternMismatch) {\n this.errorMessage = this.patternErrorMessage;\n }\n // required\n else if (!this.valid && this.input.validity.valueMissing) {\n this.errorMessage = this.messages.errors.required;\n }\n };\n\n /**\n * Validate append slot\n */\n private validateAppendSlot = (): void => {\n const slotAppendInput: HTMLSlotElement[] = Array.from(this.element.querySelectorAll('[slot=\"append-input\"]'));\n\n if (slotAppendInput.length === 1) {\n this.classCollection.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : 'mg-c-input--is-append-input-slot-content');\n } else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {\n this.classCollection.add(this.classIsInputGroupAppend);\n this.classCollection.add('mg-c-input--has-buttons-group-append');\n }\n };\n\n /**\n * Methode to control datalist display condition\n * @returns true if display condition success\n */\n private hasDatalist = (): boolean => isDatalistOption(this.datalistoptions) && this.datalistoptions.length > 0;\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n * @returns timeout\n */\n componentWillLoad(): ReturnType<typeof setTimeout> {\n // Get locales\n this.messages = initLocales(this.element).messages;\n this.characterLeftId = `${this.identifier}-character-left`;\n this.datalistId = `${this.identifier}-datalist`;\n // Validate\n this.validateIcon(this.icon);\n this.validateDatalistoptions(this.datalistoptions);\n this.validatePattern(this.pattern);\n this.validatePattern(this.patternErrorMessage);\n this.validateAppendSlot();\n // Check validity when component is ready\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n this.checkValidity();\n }, 0);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <MgInput\n identifier={this.identifier}\n classCollection={this.classCollection}\n ariaDescribedbyIDs={[this.characterLeftId]}\n label={this.label}\n labelOnTop={this.labelOnTop}\n labelHide={this.labelHide}\n required={this.required}\n readonly={this.readonly}\n mgWidth={this.mgWidth}\n disabled={this.disabled}\n value={this.value}\n readonlyValue={undefined}\n tooltip={this.tooltip}\n helpText={this.helpText}\n errorMessage={this.errorMessage}\n isFieldset={false}\n >\n <div\n class=\"mg-c-input__with-character-left\"\n style={{\n '--mg-character-left-message-length': (this.displayCharacterLeft\n ? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1\n : 0\n ).toString(),\n }}\n >\n {this.icon !== undefined && <mg-icon icon={this.icon}></mg-icon>}\n <input\n type={this.type}\n class=\"mg-c-input__box\"\n value={this.value}\n id={this.identifier}\n list={this.hasDatalist() ? this.datalistId : undefined}\n autocomplete={this.hasDatalist() ? 'off' : undefined}\n name={this.name}\n placeholder={this.placeholder}\n title={this.placeholder}\n maxlength={this.maxlength}\n disabled={this.disabled}\n required={this.required}\n aria-invalid={(this.invalid === true).toString()}\n pattern={this.pattern}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n ref={(el: HTMLInputElement) => {\n if (el !== null) this.input = el;\n }}\n />\n {this.hasDatalist() && (\n <datalist id={this.datalistId}>\n {this.datalistoptions.map(option => (\n <option value={option} key={option}></option>\n ))}\n </datalist>\n )}\n {this.displayCharacterLeft && this.maxlength > 0 && (\n <mg-character-left identifier={this.characterLeftId} characters={this.value} maxlength={this.maxlength}></mg-character-left>\n )}\n </div>\n <slot name=\"append-input\"></slot>\n </MgInput>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mg-input-text.js","sourceRoot":"","sources":["../../../../../src/components/molecules/inputs/mg-input-text/mg-input-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAgB,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM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CAAC,MAAM,CAAC,EAAE,CAAC,CAClC,cAAQ,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAW,CAC9C,CAAC,CACO,CACZ;QACA,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAClD,yBAAmB,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,GAAsB,CAC7H,CACG;MACN,YAAM,IAAI,EAAC,cAAc,GAAQ,CACzB,CACX,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, h, Prop, EventEmitter, State, Element, Method, Watch } from '@stencil/core';\nimport { MgInput } from '../MgInput';\nimport { Handler, Width } from '../MgInput.conf';\nimport { ClassList, isValidString } from '../../../../utils/components.utils';\nimport { initLocales } from '../../../../locales';\nimport { TextType } from './mg-input-text.conf';\n\nconst isDatalistOption = (options: unknown[]): options is string[] => Array.isArray(options) && options.every(option => typeof option === 'string');\n\n@Component({\n tag: 'mg-input-text',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input-text.css',\n shadow: true,\n})\nexport class MgInputText {\n /************\n * Internal *\n ************/\n\n // Classes\n private classFocus = 'mg-u-is-focused';\n private classIsInputGroupAppend = 'mg-c-input--is-input-group-append';\n private classHasIcon = 'mg-c-input--has-icon';\n\n // IDs\n private characterLeftId;\n private datalistId;\n\n // HTML selector\n private input: HTMLInputElement;\n\n // Locales\n private messages;\n\n // hasDisplayedError (triggered by blur event)\n private hasDisplayedError = false;\n\n private handlerInProgress: Handler;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputTextElement;\n\n /**\n * Component value\n */\n @Prop({ mutable: true, reflect: true }) value: string;\n @Watch('value')\n handleValue(newValue: string): void {\n this.valueChange.emit(newValue);\n }\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n\n /**\n * Input name\n * If not set the value equals the identifier\n */\n @Prop() name: string = this.identifier;\n\n /**\n * Input label\n */\n @Prop() label!: string;\n\n /**\n * Input type\n */\n @Prop() type: TextType = 'text';\n\n /**\n * Input icon\n */\n @Prop() icon: string;\n @Watch('icon')\n validateIcon(newValue: string): void {\n if (newValue !== undefined) {\n this.classCollection.add(this.classHasIcon);\n } else {\n this.classCollection.delete(this.classHasIcon);\n }\n }\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop: boolean;\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide = false;\n\n /**\n * Input placeholder.\n * It should be a word or short phrase that demonstrates the expected type of data, not a replacement for labels or help text.\n */\n @Prop() placeholder: string;\n\n /**\n * Define datalist options\n */\n @Prop() datalistoptions: string[];\n @Watch('datalistoptions')\n validateDatalistoptions(newValue: MgInputText['datalistoptions']) {\n if (Boolean(newValue) && !isDatalistOption(newValue)) {\n throw new Error('<mg-input-text> prop \"datalistoptions\" values must be the same type, string.');\n }\n }\n\n /**\n * Input max length\n */\n @Prop() maxlength = 400;\n\n /**\n * Define if input is required\n */\n @Prop() required = false;\n\n /**\n * Define if input is readonly\n */\n @Prop() readonly = false;\n\n /**\n * Define if input is disabled\n */\n @Prop() disabled = false;\n @Watch('required')\n @Watch('readonly')\n @Watch('disabled')\n handleValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void {\n if (this.input !== undefined) {\n this.input[prop] = newValue;\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n this.hasDisplayedError = false;\n }\n }\n }\n\n /**\n * Define input width\n */\n @Prop() mgWidth: Width = 'full';\n\n /**\n * Define input pattern to validate\n */\n @Prop() pattern: string;\n\n /**\n * Define input pattern error message\n */\n @Prop() patternErrorMessage: string;\n @Watch('pattern')\n @Watch('patternErrorMessage')\n validatePattern(newValue: string): void {\n if (newValue !== undefined && !(isValidString(this.pattern) && isValidString(this.patternErrorMessage))) {\n throw new Error('<mg-input-text> props \"pattern\" and \"patternErrorMessage\" must be non-empty string and paired.');\n }\n }\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip: string;\n\n /**\n * Define if component should display character left\n */\n @Prop() displayCharacterLeft = true;\n\n /**\n * Add a help text under the input, usually expected data format and example\n */\n @Prop() helpText: string;\n\n /**\n * Define input valid state\n */\n @Prop({ mutable: true }) valid: boolean;\n\n /**\n * Define input invalid state\n */\n @Prop({ mutable: true }) invalid: boolean;\n\n /**\n * Component classes\n */\n @State() classCollection: ClassList = new ClassList(['mg-c-input--text']);\n\n /**\n * Error message to display\n */\n @State() errorMessage: string;\n\n /**\n * Emited event when value change\n */\n @Event({ eventName: 'value-change' }) valueChange: EventEmitter<string>;\n\n /**\n * Emited event when checking validity\n */\n @Event({ eventName: 'input-valid' }) inputValid: EventEmitter<boolean>;\n\n /**\n * Public method to play input focus\n */\n @Method()\n async setFocus(): Promise<void> {\n this.input.focus();\n }\n\n /**\n * Display input error if it exists.\n */\n @Method()\n async displayError(): Promise<void> {\n this.checkValidity();\n this.setErrorMessage();\n this.hasDisplayedError = this.invalid;\n }\n\n /**\n * Set an error and display a custom error message.\n * This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.\n * It must be paired with an error message to display for the given context.\n * When used to set validity to `false`, you should use this method again to reset the validity to `true`.\n * @param valid - value indicating the validity\n * @param errorMessage - the error message to display\n */\n @Method()\n async setError(valid: MgInputText['valid'], errorMessage: string): Promise<void> {\n if (typeof valid !== 'boolean') {\n throw new Error('<mg-input-text> method \"setError()\" param \"valid\" must be a boolean');\n } else if (!isValidString(errorMessage)) {\n throw new Error('<mg-input-text> method \"setError()\" param \"errorMessage\" must be a string');\n } else {\n this.setValidity(valid);\n this.setErrorMessage(valid ? undefined : errorMessage);\n this.hasDisplayedError = this.invalid;\n }\n }\n\n /**\n * Method to set validity values\n * @param newValue - valid new value\n */\n private setValidity(newValue: MgInputText['valid']) {\n const oldValidValue = this.valid;\n this.valid = newValue;\n this.invalid = !this.valid;\n // We need to send valid event even if it is the same value\n if (this.handlerInProgress === undefined || (this.handlerInProgress === Handler.BLUR && this.valid !== oldValidValue)) this.inputValid.emit(this.valid);\n }\n\n /**\n * Handle input event\n */\n private handleInput = (): void => {\n this.checkValidity();\n if (this.hasDisplayedError) {\n this.setErrorMessage();\n }\n this.value = this.input.value;\n };\n\n /**\n * Handle focus event\n */\n private handleFocus = (): void => {\n this.classCollection.add(this.classFocus);\n this.classCollection = new ClassList(this.classCollection.classes);\n };\n\n /**\n * Handle blur event\n */\n private handleBlur = (): void => {\n // Manage focus\n this.classCollection.delete(this.classFocus);\n this.classCollection = new ClassList(this.classCollection.classes);\n // Display Error\n this.handlerInProgress = Handler.BLUR;\n this.displayError().finally(() => {\n // reset guard\n this.handlerInProgress = undefined;\n });\n };\n\n /**\n * Check if input is valid\n */\n private checkValidity = (): void => {\n this.setValidity(this.readonly || this.disabled || (this.input?.checkValidity !== undefined ? this.input.checkValidity() : true));\n };\n\n /**\n * Set input error message\n * @param errorMessage - errorMessage override\n */\n private setErrorMessage = (errorMessage?: string): void => {\n // Set error message\n this.errorMessage = undefined;\n // Does have a custom error message\n if (!this.valid && errorMessage !== undefined) {\n this.errorMessage = errorMessage;\n }\n // Does not match pattern\n else if (!this.valid && this.input.validity.patternMismatch) {\n this.errorMessage = this.patternErrorMessage;\n }\n // required\n else if (!this.valid && this.input.validity.valueMissing) {\n this.errorMessage = this.messages.errors.required;\n }\n };\n\n /**\n * Validate append slot\n */\n private validateAppendSlot = (): void => {\n const slotAppendInput: HTMLSlotElement[] = Array.from(this.element.querySelectorAll('[slot=\"append-input\"]'));\n\n if (slotAppendInput.length === 1) {\n this.classCollection.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : 'mg-c-input--is-append-input-slot-content');\n } else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {\n this.classCollection.add(this.classIsInputGroupAppend);\n this.classCollection.add('mg-c-input--has-buttons-group-append');\n }\n };\n\n /**\n * Methode to control datalist display condition\n * @returns true if display condition success\n */\n private hasDatalist = (): boolean => isDatalistOption(this.datalistoptions) && this.datalistoptions.length > 0;\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n * @returns timeout\n */\n componentWillLoad(): ReturnType<typeof setTimeout> {\n // Get locales\n this.messages = initLocales(this.element).messages;\n this.characterLeftId = `${this.identifier}-character-left`;\n this.datalistId = `${this.identifier}-datalist`;\n // Validate\n this.validateIcon(this.icon);\n this.validateDatalistoptions(this.datalistoptions);\n this.validatePattern(this.pattern);\n this.validatePattern(this.patternErrorMessage);\n this.validateAppendSlot();\n // Check validity when component is ready\n // return a promise to process action only in the FIRST render().\n // https://stenciljs.com/docs/component-lifecycle#componentwillload\n return setTimeout(() => {\n this.checkValidity();\n }, 0);\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <MgInput\n identifier={this.identifier}\n classCollection={this.classCollection}\n ariaDescribedbyIDs={[this.characterLeftId]}\n label={this.label}\n labelOnTop={this.labelOnTop}\n labelHide={this.labelHide}\n required={this.required}\n readonly={this.readonly}\n mgWidth={this.mgWidth}\n disabled={this.disabled}\n value={this.value}\n readonlyValue={undefined}\n tooltip={this.tooltip}\n helpText={this.helpText}\n errorMessage={this.errorMessage}\n isFieldset={false}\n >\n <div\n class=\"mg-c-input__with-character-left\"\n style={{\n '--mg-character-left-message-length': (this.displayCharacterLeft\n ? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1\n : 0\n ).toString(),\n }}\n >\n {this.icon !== undefined && <mg-icon icon={this.icon}></mg-icon>}\n <input\n type={this.type}\n class=\"mg-c-input__box\"\n value={this.value}\n id={this.identifier}\n list={this.hasDatalist() ? this.datalistId : undefined}\n autocomplete={this.hasDatalist() ? 'off' : undefined}\n name={this.name}\n placeholder={this.placeholder}\n title={this.placeholder}\n maxlength={this.maxlength}\n disabled={this.disabled}\n required={this.required}\n aria-invalid={(this.invalid === true).toString()}\n pattern={this.pattern}\n onInput={this.handleInput}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n ref={(el: HTMLInputElement) => {\n if (el !== null) this.input = el;\n }}\n />\n {this.hasDatalist() && (\n <datalist id={this.datalistId}>\n {this.datalistoptions.map(option => (\n <option value={option} key={option}></option>\n ))}\n </datalist>\n )}\n {this.displayCharacterLeft && this.maxlength > 0 && (\n <mg-character-left identifier={this.characterLeftId} characters={this.value} maxlength={this.maxlength}></mg-character-left>\n )}\n </div>\n <slot name=\"append-input\"></slot>\n </MgInput>\n );\n }\n}\n"]}
|
package/dist/collection/components/molecules/inputs/mg-input-text/test/mg-input-text.spec.js
CHANGED
|
@@ -116,6 +116,7 @@ describe('mg-input-text', () => {
|
|
|
116
116
|
})),
|
|
117
117
|
});
|
|
118
118
|
jest.spyOn(page.rootInstance.valueChange, 'emit');
|
|
119
|
+
const inputValidSpy = jest.spyOn(page.rootInstance.inputValid, 'emit');
|
|
119
120
|
input.dispatchEvent(new CustomEvent('focus', { bubbles: true }));
|
|
120
121
|
await page.waitForChanges();
|
|
121
122
|
expect(page.rootInstance.classCollection.has('mg-u-is-focused')).toEqual(true);
|
|
@@ -127,6 +128,7 @@ describe('mg-input-text', () => {
|
|
|
127
128
|
input.dispatchEvent(new CustomEvent('blur', { bubbles: true }));
|
|
128
129
|
await page.waitForChanges();
|
|
129
130
|
expect(page.rootInstance.classCollection.has('mg-u-is-focused')).toEqual(false);
|
|
131
|
+
expect(inputValidSpy).toHaveBeenCalledTimes(1);
|
|
130
132
|
});
|
|
131
133
|
describe.each(['readonly', 'disabled'])('validity, case next state is %s', nextState => {
|
|
132
134
|
test.each([
|