@mgdis/mg-components 6.19.0 → 6.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-Bp6wZzau.js → index-C2viYwrR.js} +1757 -80
- package/dist/cjs/{index-TUElr4Wv.js → index-CCsGMNyq.js} +46 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_37.cjs.entry.js +735 -337
- package/dist/cjs/mg-alert.cjs.entry.js +17 -9
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-fieldset.cjs.entry.js +24 -7
- package/dist/cjs/mg-input-combobox.cjs.entry.js +63 -29
- package/dist/cjs/mg-input-file.cjs.entry.js +384 -0
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +30 -18
- package/dist/cjs/{mg-input.conf-D7jmj_lh.js → mg-input.conf-BNpeATnq.js} +7 -0
- package/dist/cjs/mg-loader.cjs.entry.js +8 -6
- package/dist/cjs/mg-progress.cjs.entry.js +19 -9
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +6 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +15 -11
- package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +877 -0
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +12 -12
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +72 -84
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +12 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js +12 -2
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/collection/locales/en/messages.json +11 -0
- package/dist/collection/locales/fr/messages.json +11 -0
- package/dist/components/events.utils.js +1 -23
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +1 -408
- package/dist/components/index3.js +1 -476
- package/dist/components/mg-action-more.js +1 -254
- package/dist/components/mg-alert.js +1 -224
- package/dist/components/mg-badge.js +1 -6
- package/dist/components/mg-badge2.js +1 -113
- package/dist/components/mg-button.js +1 -6
- package/dist/components/mg-button2.js +1 -275
- package/dist/components/mg-card.js +1 -6
- package/dist/components/mg-card2.js +1 -92
- package/dist/components/mg-character-left.js +1 -6
- package/dist/components/mg-character-left2.js +1 -75
- package/dist/components/mg-details.js +1 -104
- package/dist/components/mg-divider.js +1 -6
- package/dist/components/mg-divider2.js +1 -49
- package/dist/components/mg-fieldset.js +1 -209
- package/dist/components/mg-form.js +1 -302
- package/dist/components/mg-icon.js +1 -6
- package/dist/components/mg-icon2.js +1 -188
- package/dist/components/mg-illustrated-message.js +1 -129
- package/dist/components/mg-input-checkbox-paginated.js +1 -6
- package/dist/components/mg-input-checkbox-paginated2.js +1 -135
- package/dist/components/mg-input-checkbox.js +1 -762
- package/dist/components/mg-input-combobox.js +1 -936
- package/dist/components/mg-input-date.js +1 -463
- package/dist/components/mg-input-file.d.ts +11 -0
- package/dist/components/mg-input-file.js +1 -0
- package/dist/components/mg-input-numeric.js +1 -592
- package/dist/components/mg-input-password.js +1 -360
- package/dist/components/mg-input-radio.js +1 -392
- package/dist/components/mg-input-rich-text-editor.js +1 -16797
- package/dist/components/mg-input-select.js +1 -6
- package/dist/components/mg-input-select2.js +1 -481
- package/dist/components/mg-input-text.js +1 -6
- package/dist/components/mg-input-text2.js +1 -514
- package/dist/components/mg-input-textarea.js +1 -412
- package/dist/components/mg-input-title.js +1 -6
- package/dist/components/mg-input-title2.js +1 -81
- package/dist/components/mg-input-toggle.js +1 -386
- package/dist/components/mg-input.conf.js +1 -0
- package/dist/components/mg-input.js +1 -6
- package/dist/components/mg-input2.js +1 -459
- package/dist/components/mg-item-more.js +1 -6
- package/dist/components/mg-item-more2.js +1 -505
- package/dist/components/mg-loader.js +1 -6
- package/dist/components/mg-loader2.js +1 -74
- package/dist/components/mg-menu-item.js +1 -6
- package/dist/components/mg-menu-item2.js +1 -485
- package/dist/components/mg-menu.js +1 -6
- package/dist/components/mg-message.js +1 -6
- package/dist/components/mg-message2.js +1 -146
- package/dist/components/mg-modal.js +1 -184
- package/dist/components/mg-pagination.js +1 -234
- package/dist/components/mg-panel.js +1 -350
- package/dist/components/mg-popover-content.js +1 -6
- package/dist/components/mg-popover-content2.js +1 -96
- package/dist/components/mg-popover.js +1 -6
- package/dist/components/mg-popover2.js +1 -312
- package/dist/components/mg-progress.js +1 -123
- package/dist/components/mg-skip-links.js +1 -78
- package/dist/components/mg-table.js +1 -319
- package/dist/components/mg-tabs.js +1 -6
- package/dist/components/mg-tabs2.js +1 -315
- package/dist/components/mg-tag.js +1 -133
- package/dist/components/mg-tooltip-content.js +1 -6
- package/dist/components/mg-tooltip-content2.js +1 -42
- package/dist/components/mg-tooltip.js +1 -6
- package/dist/components/mg-tooltip2.js +1 -421
- package/dist/components/popper.js +1 -1790
- package/dist/esm/{index-CNX6lq0x.js → index-D-uaxCxH.js} +46 -1
- package/dist/esm/{index-BluNKQ3L.js → index-DFwaH2hS.js} +1757 -80
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_37.entry.js +735 -337
- package/dist/esm/mg-alert.entry.js +17 -9
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-fieldset.entry.js +24 -7
- package/dist/esm/mg-input-combobox.entry.js +63 -29
- package/dist/esm/mg-input-file.entry.js +382 -0
- package/dist/esm/mg-input-rich-text-editor.entry.js +30 -18
- package/dist/esm/{mg-input.conf-DDnrE1hD.js → mg-input.conf-C9rmNQIL.js} +7 -1
- package/dist/esm/mg-loader.entry.js +8 -6
- package/dist/esm/mg-progress.entry.js +19 -9
- package/dist/mg-components/locales/en/messages.json +11 -0
- package/dist/mg-components/locales/fr/messages.json +11 -0
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-d5a276eb.entry.js → p-08fa327b.entry.js} +1 -1
- package/dist/mg-components/p-4175dcbe.entry.js +1 -0
- package/dist/mg-components/p-6b57f249.entry.js +1 -0
- package/dist/mg-components/p-6b655830.entry.js +1 -0
- package/dist/mg-components/p-988c282e.entry.js +1 -0
- package/dist/mg-components/p-C9rmNQIL.js +1 -0
- package/dist/mg-components/p-D-uaxCxH.js +1 -0
- package/dist/mg-components/p-DFwaH2hS.js +2 -0
- package/dist/mg-components/p-a79b1f19.entry.js +1 -0
- package/dist/mg-components/{p-916dfb6d.entry.js → p-c3d116b9.entry.js} +1 -1
- package/dist/mg-components/p-dd1934f4.entry.js +1 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +7 -1
- package/dist/types/components/molecules/inputs/mg-input-file/mg-input-file.d.ts +210 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -4
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +13 -16
- package/dist/types/components.d.ts +217 -18
- package/dist/types/stencil-public-runtime.d.ts +76 -12
- package/ide/intellij/web-types.json +373 -26
- package/ide/vscode/css-custom-data.json +12 -0
- package/ide/vscode/html-custom-data.json +341 -79
- package/package.json +22 -22
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.scss +0 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.js +0 -1
- package/dist/mg-components/p-016bd291.entry.js +0 -1
- package/dist/mg-components/p-186a6139.entry.js +0 -1
- package/dist/mg-components/p-66a1cb83.entry.js +0 -1
- package/dist/mg-components/p-6efd819f.entry.js +0 -1
- package/dist/mg-components/p-BluNKQ3L.js +0 -2
- package/dist/mg-components/p-CNX6lq0x.js +0 -1
- package/dist/mg-components/p-DDnrE1hD.js +0 -1
- package/dist/mg-components/p-d2c72f09.entry.js +0 -1
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as s,f as i,h as e,a}from"./p-
|
|
1
|
+
import{r as t,c as s,f as i,h as e,a}from"./p-DFwaH2hS.js";import{C as h,t as o}from"./p-C7xjtdiw.js";import{i as r}from"./p-D-uaxCxH.js";const n=["info","warning","success","danger"],c=["bar-left","background"],l=class{constructor(i){t(this,i),this.componentShow=s(this,"component-show",3),this.componentHide=s(this,"component-hide",3),this.componentClose=s(this,"component-close",3),this.classCloseButton="mg-c-alert--close-button",this.storedTimer=null,this.isFocused=!1,this.isHovered=!1,this.variant="info",this.variantStyle="bar-left",this.classCollection=new h(["mg-c-alert"]),this.hasActions=!1,this.setTimer=()=>{this.storedTimer=setTimeout((()=>this.element.hidden=!0),1e3*this.delay)},this.clearTimer=()=>{clearTimeout(this.storedTimer)},this.timerEvents=t=>{this.clearTimer();const s="mouseenter"===t.type;this[s?"isHovered":"isFocused"]=!0,this.element.addEventListener(s?"mouseleave":"focusout",(t=>{this["mouseleave"===t.type?"isHovered":"isFocused"]=!1,this.isFocused||this.isHovered||this.setTimer()}),{once:!0})},this.handleClose=()=>{this.element.hidden=!0,this.componentClose.emit()}}watchDelay(t){if(void 0!==t&&t<2)throw new Error(`<mg-alert> prop "delay" must be greater than 2 seconds. Passed value: ${o(t)}.`)}watchVariant(t){if(t&&!n.includes(t))throw new Error(`<mg-alert> prop "variant" must be one of: ${n.join(", ")}. Passed value: ${o(t)}.`)}watchVariantStyle(t){if(t&&!c.includes(t))throw new Error(`<mg-alert> prop "variantStyle" must be one of: ${c.join(", ")}. Passed value: ${o(t)}.`)}watchHidden(t){"string"==typeof t&&""===t&&(t=!0),t?(this.componentHide.emit(),["focusin","mouseenter"].forEach((t=>{this.element.removeEventListener(t,this.timerEvents)})),this.clearTimer()):(this.componentShow.emit(),this.delay>1&&(this.setTimer(),["focusin","mouseenter"].forEach((t=>{this.element.addEventListener(t,this.timerEvents)})))),i(this)}componentWillLoad(){this.messages=r(this.element).messages,this.watchVariant(this.variant),this.watchVariantStyle(this.variantStyle),this.watchDelay(this.delay),this.watchHidden(this.element.hidden),this.hasActions=null!==this.element.querySelector('[slot="actions"]'),this.hasActions||this.classCollection.add(this.classCloseButton)}render(){return e("mg-message",{key:"6085a45d00c4762bae88d98e89f44c20d5f9b6c4",class:this.classCollection.join(),role:["info","success"].includes(this.variant)?"status":"alert",variant:this.variant,variantStyle:this.variantStyle},e("slot",{key:"55491d1b41609883958680c14a2ddb8dd84a3bd4"}),this.hasActions?e("span",{slot:"actions"},e("slot",{name:"actions"})):e("span",{class:"mg-c-alert__close-button"},e("mg-button",{"is-icon":!0,variant:"flat",label:this.messages.alert.closeButton,onClick:this.handleClose},e("mg-icon",{icon:"cross"}))))}get element(){return a(this)}static get watchers(){return{delay:[{watchDelay:0}],variant:[{watchVariant:0}],variantStyle:[{watchVariantStyle:0}],hidden:[{watchHidden:0}]}}};l.style=".mg-c-alert__close-button{position:absolute;top:0;right:0}.mg-c-alert.mg-c-alert--close-button{--mg-c-card-spacing:0 var(--mg-b-size-min-height) 0 0}";export{l as mg_alert}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i,a as s}from"./p-DFwaH2hS.js";import{C as e,i as h}from"./p-C7xjtdiw.js";import{i as a,c as r}from"./p-C9rmNQIL.js";const o=class{constructor(i){t(this,i),this.name=this.identifier,this.legendHide=!1,this.legendBorderDisplay=!1,this.readonly=!1,this.disabled=!1,this.classCollection=new e(["mg-c-input--fieldset"]),this.checkValidity=()=>{var t;this.valid=!(this.mgInputs.some((t=>t.invalid))||(null===(t=this.errorMessage)||void 0===t?void 0:t.length)>0)},this.setMgInputs=()=>{this.mgInputs=Array.from(this.element.querySelectorAll("*")).filter((t=>t.nodeName.startsWith("MG-INPUT"))),this.mgInputs.forEach((t=>{"MG-INPUT-FILE"===t.nodeName&&(this.readonly?t.setAttribute("hidden",""):t.removeAttribute("hidden")),this.readonly&&!a(t)?t.readonly=!0:this.disabled?t.disabled=!0:t.addEventListener("input-valid",this.checkValidity)}))}}watchLegendBorderDisplay(t){if(t&&!h(this.legendHeading))throw new Error('<mg-fieldset> prop "legendBorderDisplay" must not be paired with the prop "legendHeading".')}watchReadonly(t){t?this.classCollection.add(r):this.classCollection.delete(r)}handleAttributeChange(){this.setMgInputs()}async setCustomValidity(t){this.errorMessage=h(t)?t:void 0,this.checkValidity()}async displayError(){this.readonly||this.mgInputs.forEach((t=>{t.displayError()}))}componentWillLoad(){this.watchReadonly(this.readonly),this.watchLegendBorderDisplay(this.legendBorderDisplay),this.setMgInputs()}componentDidLoad(){const t={childList:!0,subtree:!0};new MutationObserver((i=>{i.some((i=>Object.keys(t).includes(i.type)))&&this.setMgInputs()})).observe(this.element,t)}render(){return i("mg-input",{key:"31ccb9f783687845080fc7f184cc54b7343fab65",label:this.legend,identifier:this.identifier,class:this.classCollection.join(),labelOnTop:!this.legendHide,labelHeading:this.legendHeading,labelBorderDisplay:this.legendHeading&&this.legendBorderDisplay,labelHide:this.legendHide,inputsOnBottom:void 0!==this.legendHeading,tooltip:this.tooltip,tooltipPosition:"label",helpText:this.helpText,errorMessage:!this.valid&&h(this.errorMessage)?this.errorMessage:void 0},i("span",{key:"eedf1c66eaf88bee037c11b812844bb5a92175c1",class:"mg-c-input__input-group"},i("slot",{key:"a28f6759a63873ef4a228820b4310b42fcf1d3c7"})))}get element(){return s(this)}static get watchers(){return{legendBorderDisplay:[{watchLegendBorderDisplay:0}],readonly:[{watchReadonly:0},{handleAttributeChange:0}],disabled:[{handleAttributeChange:0}]}}};export{o as mg_fieldset}
|
|
@@ -27,7 +27,13 @@ interface InputBaseMethods {
|
|
|
27
27
|
/**
|
|
28
28
|
* Possible Input types
|
|
29
29
|
*/
|
|
30
|
-
export type HTMLMgInputsElement = (HTMLMgInputElement & InputBaseMethods) | HTMLMgInputCheckboxElement | HTMLMgInputDateElement | HTMLMgInputNumericElement | HTMLMgInputPasswordElement | HTMLMgInputRadioElement | HTMLMgInputSelectElement | HTMLMgInputTextElement | HTMLMgInputTextareaElement | (HTMLMgInputToggleElement & InputBaseMethods);
|
|
30
|
+
export type HTMLMgInputsElement = (HTMLMgInputElement & InputBaseMethods) | HTMLMgInputCheckboxElement | HTMLMgInputDateElement | HTMLMgInputNumericElement | HTMLMgInputPasswordElement | HTMLMgInputRadioElement | HTMLMgInputSelectElement | HTMLMgInputTextElement | HTMLMgInputTextareaElement | HTMLMgInputFileElement | (HTMLMgInputToggleElement & InputBaseMethods);
|
|
31
|
+
/**
|
|
32
|
+
* Is HTMLMgInputElement an HTMLMgInputFileElement
|
|
33
|
+
* @param input - input element
|
|
34
|
+
* @returns true if input is an mg-input-file element
|
|
35
|
+
*/
|
|
36
|
+
export declare const isMgInputFile: (input: HTMLMgInputsElement) => input is HTMLMgInputFileElement;
|
|
31
37
|
/**
|
|
32
38
|
* Available WindowEvent types
|
|
33
39
|
*/
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { EventEmitter } from '../../../../stencil-public-runtime';
|
|
2
|
+
import { ClassList } from '@mgdis/core-ui-helpers/dist/utils';
|
|
3
|
+
import { type TooltipPosition } from '../mg-input/mg-input.conf';
|
|
4
|
+
export declare class MgInputFile {
|
|
5
|
+
/************
|
|
6
|
+
* Internal *
|
|
7
|
+
************/
|
|
8
|
+
private inputElement;
|
|
9
|
+
private fileButtonElement;
|
|
10
|
+
private locale;
|
|
11
|
+
private messages;
|
|
12
|
+
private hasDisplayedError;
|
|
13
|
+
private customErrorMessage;
|
|
14
|
+
private handlerInProgress;
|
|
15
|
+
/**************
|
|
16
|
+
* Decorators *
|
|
17
|
+
**************/
|
|
18
|
+
/**
|
|
19
|
+
* Get component DOM element
|
|
20
|
+
*/
|
|
21
|
+
element: HTMLMgInputFileElement;
|
|
22
|
+
/**
|
|
23
|
+
* Component value
|
|
24
|
+
*/
|
|
25
|
+
value: any;
|
|
26
|
+
watchValue(newValue: MgInputFile['value']): void;
|
|
27
|
+
/**
|
|
28
|
+
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
29
|
+
*/
|
|
30
|
+
identifier: string;
|
|
31
|
+
/**
|
|
32
|
+
* Input name
|
|
33
|
+
* If not set the value equals the identifier
|
|
34
|
+
*/
|
|
35
|
+
name: string;
|
|
36
|
+
/**
|
|
37
|
+
* Input label
|
|
38
|
+
*/
|
|
39
|
+
label: string;
|
|
40
|
+
/**
|
|
41
|
+
* Define if label is displayed on top
|
|
42
|
+
*/
|
|
43
|
+
labelOnTop: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Define if label is visible
|
|
46
|
+
*/
|
|
47
|
+
labelHide: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Define multiple files
|
|
50
|
+
* When the multiple Boolean attribute is specified, the file input allows the user to select more than one file.
|
|
51
|
+
* (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#multiple).
|
|
52
|
+
*/
|
|
53
|
+
multiple: boolean;
|
|
54
|
+
watchMultiple(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Define file accept format
|
|
57
|
+
* The accept property is an attribute of the file `<input>` type
|
|
58
|
+
* that defines the file types the file input should accept
|
|
59
|
+
* (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept).
|
|
60
|
+
*/
|
|
61
|
+
accept?: string;
|
|
62
|
+
watchAccept(newValue: MgInputFile['accept']): void;
|
|
63
|
+
/**
|
|
64
|
+
* Define max file size (in octets)
|
|
65
|
+
*/
|
|
66
|
+
maxSize?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Define input capture attribute
|
|
69
|
+
* The capture attribute is a Boolean attribute that specifies
|
|
70
|
+
* if the device's camera or microphone should be used to capture
|
|
71
|
+
* media directly, instead of choosing an existing file.
|
|
72
|
+
* (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#capture).
|
|
73
|
+
*/
|
|
74
|
+
capture?: 'user' | 'environment' | '';
|
|
75
|
+
/**
|
|
76
|
+
* Define if input is required
|
|
77
|
+
*/
|
|
78
|
+
required: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Define if input is disabled
|
|
81
|
+
*/
|
|
82
|
+
disabled: boolean;
|
|
83
|
+
handleValidityChange(newValue: boolean, _oldValue: boolean, prop: string): void;
|
|
84
|
+
watchDisabled(newValue: MgInputFile['disabled']): void;
|
|
85
|
+
/**
|
|
86
|
+
* Add a tooltip message next to the input
|
|
87
|
+
*/
|
|
88
|
+
tooltip?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Define tooltip position
|
|
91
|
+
*/
|
|
92
|
+
tooltipPosition: TooltipPosition;
|
|
93
|
+
/**
|
|
94
|
+
* Add a help text under the input, usually expected data format and example
|
|
95
|
+
*/
|
|
96
|
+
helpText?: string;
|
|
97
|
+
watchHelpText(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Define input valid state
|
|
100
|
+
*/
|
|
101
|
+
valid: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Define input invalid state
|
|
104
|
+
*/
|
|
105
|
+
invalid: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Component classes
|
|
108
|
+
*/
|
|
109
|
+
classCollection: ClassList;
|
|
110
|
+
/**
|
|
111
|
+
* Error message to display
|
|
112
|
+
*/
|
|
113
|
+
errorMessage: string;
|
|
114
|
+
/**
|
|
115
|
+
* Files list
|
|
116
|
+
*/
|
|
117
|
+
files: File[];
|
|
118
|
+
watchFiles(newValue: MgInputFile['files'], oldValue: MgInputFile['files']): void;
|
|
119
|
+
/**
|
|
120
|
+
* Emitted event when value change
|
|
121
|
+
*/
|
|
122
|
+
valueChange: EventEmitter<HTMLMgInputFileElement['value']>;
|
|
123
|
+
/**
|
|
124
|
+
* Emitted event when checking validity
|
|
125
|
+
*/
|
|
126
|
+
inputValid: EventEmitter<HTMLMgInputFileElement['valid']>;
|
|
127
|
+
/**
|
|
128
|
+
* Set focus on input add file button
|
|
129
|
+
*/
|
|
130
|
+
setFocus(): Promise<void>;
|
|
131
|
+
/**
|
|
132
|
+
* Display input error if it exists.
|
|
133
|
+
*/
|
|
134
|
+
displayError(): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Set an error and display a custom error message.
|
|
137
|
+
* This method can be used to set the component's error state from its context by passing a boolean value to the `valid` parameter.
|
|
138
|
+
* It must be paired with an error message to display for the given context.
|
|
139
|
+
* When used to set validity to `false`, you should use this method again to reset the validity to `true`.
|
|
140
|
+
* @param valid - value indicating the validity
|
|
141
|
+
* @param errorMessage - the error message to display
|
|
142
|
+
* @param errorMessageLock - lock the error message and validity state
|
|
143
|
+
*/
|
|
144
|
+
setError(valid: MgInputFile['valid'], errorMessage?: string, errorMessageLock?: boolean): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Reset value, validity and error state
|
|
147
|
+
*/
|
|
148
|
+
reset(): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Method to set validity values
|
|
151
|
+
* @param newValue - valid new value
|
|
152
|
+
*/
|
|
153
|
+
private setValidity;
|
|
154
|
+
/**
|
|
155
|
+
* Handle change event
|
|
156
|
+
*/
|
|
157
|
+
private handleInputChange;
|
|
158
|
+
/**
|
|
159
|
+
* Handle input focus event
|
|
160
|
+
*/
|
|
161
|
+
private handleInputFocus;
|
|
162
|
+
/**
|
|
163
|
+
* Handle input blur event
|
|
164
|
+
*/
|
|
165
|
+
private handleInputBlur;
|
|
166
|
+
/**
|
|
167
|
+
* Handle button blur event
|
|
168
|
+
*/
|
|
169
|
+
private handleButtonBlur;
|
|
170
|
+
/**
|
|
171
|
+
* Handle add file button click
|
|
172
|
+
*/
|
|
173
|
+
private handleButtonClick;
|
|
174
|
+
/**
|
|
175
|
+
* Check if input is valid
|
|
176
|
+
*/
|
|
177
|
+
private checkValidity;
|
|
178
|
+
/**
|
|
179
|
+
* Handle delete file button click
|
|
180
|
+
*/
|
|
181
|
+
private handleDeleteFileClick;
|
|
182
|
+
/**
|
|
183
|
+
* Set input error message
|
|
184
|
+
* @param fromSetErrorContext - context come from `setError` method
|
|
185
|
+
*/
|
|
186
|
+
private setErrorMessage;
|
|
187
|
+
/**
|
|
188
|
+
* Check if max size is exceeded
|
|
189
|
+
* @returns boolean - true if max size is exceeded
|
|
190
|
+
*/
|
|
191
|
+
private isMaxSizeExceeded;
|
|
192
|
+
/*************
|
|
193
|
+
* Lifecycle *
|
|
194
|
+
*************/
|
|
195
|
+
/**
|
|
196
|
+
* Check if component props are well configured on init
|
|
197
|
+
* @returns timeout
|
|
198
|
+
*/
|
|
199
|
+
componentWillLoad(): ReturnType<typeof setTimeout>;
|
|
200
|
+
/**
|
|
201
|
+
* Render files
|
|
202
|
+
* @returns formated files.
|
|
203
|
+
*/
|
|
204
|
+
private renderFiles;
|
|
205
|
+
/**
|
|
206
|
+
* Render
|
|
207
|
+
* @returns HTML Element
|
|
208
|
+
*/
|
|
209
|
+
render(): HTMLElement;
|
|
210
|
+
}
|
|
@@ -118,15 +118,15 @@ export declare class MgInputRichTextEditor {
|
|
|
118
118
|
*/
|
|
119
119
|
setFocus(): Promise<void>;
|
|
120
120
|
/**
|
|
121
|
-
* Get editor content
|
|
121
|
+
* Get editor content in HTML format
|
|
122
122
|
* @returns HTML content of the editor
|
|
123
123
|
*/
|
|
124
|
-
|
|
124
|
+
getEditorHTML(): Promise<string>;
|
|
125
125
|
/**
|
|
126
|
-
* Get editor content
|
|
126
|
+
* Get editor content in plain text format
|
|
127
127
|
* @returns Plain text content of the editor
|
|
128
128
|
*/
|
|
129
|
-
|
|
129
|
+
getEditorText(): Promise<string>;
|
|
130
130
|
/**
|
|
131
131
|
* Display input error if it exists.
|
|
132
132
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from '../../../../stencil-public-runtime';
|
|
2
2
|
import { ClassList } from '@mgdis/core-ui-helpers/dist/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { Option as ToggleOption } from '../../../../types';
|
|
4
4
|
import { type TooltipPosition } from '../mg-input/mg-input.conf';
|
|
5
5
|
/**
|
|
6
6
|
* @slot item-1 - Left option toggle content
|
|
@@ -24,13 +24,13 @@ export declare class MgInputToggle {
|
|
|
24
24
|
/**
|
|
25
25
|
* Component value
|
|
26
26
|
*/
|
|
27
|
-
value:
|
|
28
|
-
|
|
27
|
+
value: ToggleOption['value'];
|
|
28
|
+
watchValue(newValue: MgInputToggle['value'], oldValue?: MgInputToggle['value']): void;
|
|
29
29
|
/**
|
|
30
30
|
* Items are the possible options to select
|
|
31
31
|
*/
|
|
32
|
-
items: string[] |
|
|
33
|
-
|
|
32
|
+
items: string[] | ToggleOption[];
|
|
33
|
+
watchItems(newValue: MgInputToggle['items']): void;
|
|
34
34
|
/**
|
|
35
35
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
36
36
|
*/
|
|
@@ -93,7 +93,7 @@ export declare class MgInputToggle {
|
|
|
93
93
|
/**
|
|
94
94
|
* Formated items for display
|
|
95
95
|
*/
|
|
96
|
-
options:
|
|
96
|
+
options: ToggleOption[];
|
|
97
97
|
/**
|
|
98
98
|
* Error message to display
|
|
99
99
|
*/
|
|
@@ -102,11 +102,6 @@ export declare class MgInputToggle {
|
|
|
102
102
|
* Define input valid state
|
|
103
103
|
*/
|
|
104
104
|
valid: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Checked internal value
|
|
107
|
-
*/
|
|
108
|
-
checked: boolean;
|
|
109
|
-
handleChecked(newValue: MgInputToggle['checked']): void;
|
|
110
105
|
/**
|
|
111
106
|
* Emited event when value change
|
|
112
107
|
*/
|
|
@@ -138,9 +133,9 @@ export declare class MgInputToggle {
|
|
|
138
133
|
*/
|
|
139
134
|
private setErrorMessage;
|
|
140
135
|
/**
|
|
141
|
-
*
|
|
136
|
+
* Handle switch button to update value
|
|
142
137
|
*/
|
|
143
|
-
private
|
|
138
|
+
private handleSwitchButton;
|
|
144
139
|
/**
|
|
145
140
|
* Slots validation
|
|
146
141
|
*/
|
|
@@ -150,11 +145,13 @@ export declare class MgInputToggle {
|
|
|
150
145
|
* @param checked - checked item
|
|
151
146
|
* @returns toggle value
|
|
152
147
|
*/
|
|
153
|
-
private
|
|
148
|
+
private getCurrentOptionIndex;
|
|
154
149
|
/**
|
|
155
|
-
*
|
|
150
|
+
* Check if value is checked
|
|
151
|
+
* @param value - toggle value
|
|
152
|
+
* @returns truthy if value is checked
|
|
156
153
|
*/
|
|
157
|
-
private
|
|
154
|
+
private isChecked;
|
|
158
155
|
/*************
|
|
159
156
|
* Lifecycle *
|
|
160
157
|
*************/
|