carbon-components-angular 5.60.0 → 5.61.1
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/docs/documentation/components/DatePicker.html +24 -21
- package/docs/documentation/components/FileComponent.html +26 -24
- package/docs/documentation/js/search/search_index.js +2 -2
- package/docs/documentation/modules/ComboBoxModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ComboBoxModule.html +4 -4
- package/docs/documentation/modules/DatePickerInputModule/dependencies.svg +41 -37
- package/docs/documentation/modules/DatePickerInputModule.html +41 -37
- package/docs/documentation/modules/DialogModule/dependencies.svg +34 -34
- package/docs/documentation/modules/DialogModule.html +34 -34
- package/docs/documentation/modules/FileUploaderModule/dependencies.svg +36 -36
- package/docs/documentation/modules/FileUploaderModule.html +36 -36
- package/docs/documentation/modules/NumberModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NumberModule.html +4 -4
- package/docs/documentation/modules/RadioModule/dependencies.svg +48 -48
- package/docs/documentation/modules/RadioModule.html +48 -48
- package/docs/documentation/modules/SelectModule/dependencies.svg +43 -43
- package/docs/documentation/modules/SelectModule.html +43 -43
- package/docs/documentation/modules/SliderModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SliderModule.html +4 -4
- package/docs/documentation/modules/TabsModule/dependencies.svg +69 -69
- package/docs/documentation/modules/TabsModule.html +69 -69
- package/docs/documentation/modules/TagModule/dependencies.svg +37 -37
- package/docs/documentation/modules/TagModule.html +37 -37
- package/docs/documentation/modules/ThemeModule/dependencies.svg +13 -13
- package/docs/documentation/modules/ThemeModule.html +13 -13
- package/docs/documentation/modules/TilesModule/dependencies.svg +106 -106
- package/docs/documentation/modules/TilesModule.html +106 -106
- package/docs/documentation/modules/TimePickerModule/dependencies.svg +44 -40
- package/docs/documentation/modules/TimePickerModule.html +44 -40
- package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +45 -49
- package/docs/documentation/modules/TimePickerSelectModule.html +45 -49
- package/docs/documentation/modules/TreeviewModule/dependencies.svg +36 -36
- package/docs/documentation/modules/TreeviewModule.html +36 -36
- package/docs/documentation/modules/UIShellModule/dependencies.svg +4 -4
- package/docs/documentation/modules/UIShellModule.html +4 -4
- package/docs/documentation.json +145 -68
- package/docs/storybook/1335.988334fd.iframe.bundle.js +1 -0
- package/docs/storybook/{datepicker-datepicker-stories.de27eb4c.iframe.bundle.js → datepicker-datepicker-stories.f8d8ab21.iframe.bundle.js} +1 -1
- package/docs/storybook/iframe.html +2 -2
- package/docs/storybook/{main.eff7657a.iframe.bundle.js → main.cd96fcb5.iframe.bundle.js} +1 -1
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/{runtime~main.4bbe449f.iframe.bundle.js → runtime~main.9a552d4e.iframe.bundle.js} +1 -1
- package/esm2020/datepicker/datepicker.component.mjs +6 -3
- package/esm2020/file-uploader/file.component.mjs +5 -3
- package/fesm2015/carbon-components-angular-datepicker.mjs +5 -2
- package/fesm2015/carbon-components-angular-datepicker.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-file-uploader.mjs +4 -2
- package/fesm2015/carbon-components-angular-file-uploader.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-datepicker.mjs +5 -2
- package/fesm2020/carbon-components-angular-datepicker.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-file-uploader.mjs +4 -2
- package/fesm2020/carbon-components-angular-file-uploader.mjs.map +1 -1
- package/package.json +1 -1
- package/docs/storybook/1335.04cb3625.iframe.bundle.js +0 -1
package/docs/documentation.json
CHANGED
|
@@ -27337,7 +27337,7 @@
|
|
|
27337
27337
|
},
|
|
27338
27338
|
{
|
|
27339
27339
|
"name": "DatePicker",
|
|
27340
|
-
"id": "component-DatePicker-
|
|
27340
|
+
"id": "component-DatePicker-ff293c0c2be8fdf9f555fef4cc23b2d966c09514751aa2b5096d1048e9e522081e4eea33b5742cb1b40faa6f6419aee019237c2a4d2a430c52e0455c939f3877",
|
|
27341
27341
|
"file": "src/datepicker/datepicker.component.ts",
|
|
27342
27342
|
"encapsulation": [
|
|
27343
27343
|
"ViewEncapsulation.None"
|
|
@@ -28018,7 +28018,7 @@
|
|
|
28018
28018
|
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { DatePickerModule } from 'carbon-components-angular';</code></pre></div><p><a href=\"../../?path=/story/components-date-picker--single\">See demo</a></p>\n",
|
|
28019
28019
|
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { DatePickerModule } from 'carbon-components-angular';\n```\n\n[See demo](../../?path=/story/components-date-picker--single)\n",
|
|
28020
28020
|
"type": "component",
|
|
28021
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tViewEncapsulation,\n\tElementRef,\n\tOnDestroy,\n\tHostListener,\n\tTemplateRef,\n\tOnChanges,\n\tSimpleChanges,\n\tAfterViewChecked,\n\tAfterViewInit,\n\tViewChild,\n\tOnInit,\n\tSimpleChange\n} from \"@angular/core\";\nimport rangePlugin from \"flatpickr/dist/plugins/rangePlugin\";\nimport flatpickr from \"flatpickr\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { carbonFlatpickrMonthSelectPlugin } from \"./carbon-flatpickr-month-select\";\nimport * as languages from \"flatpickr/dist/l10n/index\";\nimport { Options } from \"flatpickr/dist/types/options\";\nimport { DatePickerInput } from \"carbon-components-angular/datepicker-input\";\nimport { I18n } from \"carbon-components-angular/i18n\";\n\n/**\n * Due to type error, we have to use square brackets property accessor\n * There is a webpack issue when attempting to access exported languages from flatpickr l10n Angular 14+ apps\n * languages.default[locale] fails in app consuming CCA library but passes in test\n * languages.default.default[locale] fails in test but works in app consuming CCA library.\n *\n * To please both scenarios, we are adding a condition to prevent tests from failing\n */\nif (languages.default?.default[\"en\"]?.weekdays) {\n\t(languages.default.default[\"en\"].weekdays.shorthand as string[]) = languages.default.default[\"en\"].weekdays.longhand.map(day => {\n\t\tif (day === \"Thursday\") {\n\t\t\treturn \"Th\";\n\t\t}\n\t\treturn day.charAt(0);\n\t});\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { DatePickerModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-date-picker--single)\n */\n@Component({\n\tselector: \"cds-date-picker, ibm-date-picker\",\n\ttemplate: `\n\t<div class=\"cds--form-item\">\n\t\t<div\n\t\t\tclass=\"cds--date-picker\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--date-picker--range' : range,\n\t\t\t\t'cds--date-picker--single' : !range,\n\t\t\t\t'cds--date-picker--light' : theme === 'light',\n\t\t\t\t'cds--skeleton' : skeleton\n\t\t\t}\">\n\t\t\t<div class=\"cds--date-picker-container\">\n\t\t\t\t<cds-date-picker-input\n\t\t\t\t\t#input\n\t\t\t\t\t[label]=\"label\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t[pattern]=\"inputPattern\"\n\t\t\t\t\t[id]=\"id + '-input'\"\n\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t[type]=\"(range ? 'range' : 'single')\"\n\t\t\t\t\t[hasIcon]=\"(range ? false : true)\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t\t[warn]=\"warn\"\n\t\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t\t(valueChange)=\"onValueChange($event)\"\n\t\t\t\t\t(click)=\"openCalendar(input)\">\n\t\t\t\t</cds-date-picker-input>\n\t\t\t</div>\n\n\t\t\t<div *ngIf=\"range\" class=\"cds--date-picker-container\">\n\t\t\t\t<cds-date-picker-input\n\t\t\t\t\t#rangeInput\n\t\t\t\t\t[label]=\"rangeLabel\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t[pattern]=\"inputPattern\"\n\t\t\t\t\t[id]=\"id + '-rangeInput'\"\n\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t[type]=\"(range ? 'range' : 'single')\"\n\t\t\t\t\t[hasIcon]=\"(range ? true : null)\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[invalid]=\"rangeInvalid\"\n\t\t\t\t\t[invalidText]=\"rangeInvalidText\"\n\t\t\t\t\t[warn]=\"rangeWarn\"\n\t\t\t\t\t[warnText]=\"rangeWarnText\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[helperText]=\"rangeHelperText\"\n\t\t\t\t\t(valueChange)=\"onRangeValueChange($event)\"\n\t\t\t\t\t(click)=\"openCalendar(rangeInput)\">\n\t\t\t\t</cds-date-picker-input>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: DatePicker,\n\t\t\tmulti: true\n\t\t}\n\t],\n\tencapsulation: ViewEncapsulation.None\n})\nexport class DatePicker implements\n\tOnInit,\n\tOnDestroy,\n\tOnChanges,\n\tAfterViewChecked,\n\tAfterViewInit {\n\tprivate static datePickerCount = 0;\n\n\t/**\n\t * Select calendar range mode\n\t */\n\t@Input() range = false;\n\n\t/**\n\t * Format of date\n\t *\n\t * For reference: https://flatpickr.js.org/formatting/\n\t */\n\t@Input() dateFormat = \"m/d/Y\";\n\n\t/**\n\t * Language of the flatpickr calendar.\n\t *\n\t * For reference of the possible locales:\n\t * https://github.com/flatpickr/flatpickr/blob/master/src/l10n/index.ts\n\t */\n\t@Input() language = \"en\";\n\n\t@Input() label: string | TemplateRef<any>;\n\t@Input() helperText: string | TemplateRef<any>;\n\t@Input() rangeHelperText: string | TemplateRef<any>;\n\t@Input() rangeLabel: string;\n\n\t@Input() placeholder = \"mm/dd/yyyy\";\n\n\t/**\n\t * Aria label added to datepicker's calendar container.\n\t */\n\t@Input() ariaLabel = \"calendar container\";\n\n\t/**\n\t * The pattern for the underlying input element\n\t */\n\t@Input() inputPattern = \"^\\\\d{1,2}/\\\\d{1,2}/\\\\d{4}$\";\n\n\t@Input() id = `datepicker-${DatePicker.datePickerCount++}`;\n\n\t@Input() set value(v: (Date | string)[]) {\n\t\tif (!v) {\n\t\t\tv = [];\n\t\t}\n\t\tthis._value = v;\n\t}\n\n\tget value() {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * Set to `\"light\"` to apply the light style\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\n\t@Input() disabled = false;\n\n\t@Input() readonly = false;\n\t/**\n\t * Set to `true` to display the invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if datepicker is in an invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\n\t */\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Set to `true` to display the invalid state for the second datepicker input.\n\t */\n\t@Input() rangeInvalid = false;\n\t/**\n\t * Value displayed if the second datepicker input is in an invalid state.\n\t */\n\t@Input() rangeInvalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` to show a warning in the second datepicker input (contents set by rangeWarningText)\n\t */\n\t@Input() rangeWarn = false;\n\t/**\n\t * Sets the warning text for the second datepicker input\n\t */\n\t@Input() rangeWarnText: string | TemplateRef<any>;\n\n\t@Input() skeleton = false;\n\n\t@Input() plugins = [];\n\n\t@Input()\n\tset flatpickrOptions(options: Partial<Options>) {\n\t\tthis._flatpickrOptions = Object.assign({}, this._flatpickrOptions, options);\n\t}\n\tget flatpickrOptions(): Partial<Options> {\n\t\tconst plugins = [...this.plugins, carbonFlatpickrMonthSelectPlugin];\n\t\tif (this.range) {\n\t\t\tplugins.push(rangePlugin({ input: `#${this.id}-rangeInput`, position: \"left\" }));\n\t\t}\n\t\treturn Object.assign({}, this._flatpickrOptions, this.flatpickrBaseOptions, {\n\t\t\tmode: this.range ? \"range\" : \"single\",\n\t\t\tplugins,\n\t\t\tdateFormat: this.dateFormat,\n\t\t\tlocale: languages.default?.default[this.language] || languages.default[this.language],\n\t\t\t// Little trick force \"readonly mode\" on datepicker input.\n\t\t\t// Docs: Whether clicking on the input should open the picker.\n\t\t\t// You could disable this if you wish to open the calendar manually with.open().\n\t\t\tclickOpens: !this.readonly\n\t\t});\n\t}\n\n\t@ViewChild(\"input\", { static: true }) input: DatePickerInput;\n\t@ViewChild(\"rangeInput\") rangeInput: DatePickerInput;\n\n\t@Output() valueChange: EventEmitter<any> = new EventEmitter();\n\n\t/**\n\t * We are overriding onClose event even if users pass it via flatpickr options\n\t * Emits an event when date picker closes\n\t */\n\t@Output() onClose: EventEmitter<any> = new EventEmitter();\n\n\tprotected _value = [];\n\n\tprotected _flatpickrOptions: Partial<Options> = {\n\t\tallowInput: true\n\t};\n\n\tprotected flatpickrBaseOptions = {\n\t\tmode: \"single\",\n\t\tdateFormat: \"m/d/Y\",\n\t\tplugins: this.plugins,\n\t\tonOpen: () => {\n\t\t\tthis.updateClassNames();\n\t\t\tthis.updateAttributes();\n\t\t\tthis.updateCalendarListeners();\n\t\t},\n\t\tonClose: (date) => {\n\t\t\t// This makes sure that the `flatpickrInstance selectedDates` are in sync with the values of\n\t\t\t// the inputs when the calendar closes.\n\t\t\tif (this.range && this.flatpickrInstance) {\n\t\t\t\tconst inputValue = this.input.input.nativeElement.value;\n\t\t\t\tconst rangeInputValue = this.rangeInput.input.nativeElement.value;\n\t\t\t\tif (inputValue || rangeInputValue) {\n\t\t\t\t\tconst parseDate = (date: string) => this.flatpickrInstance.parseDate(date, this.dateFormat);\n\t\t\t\t\tthis.setDateValues([parseDate(inputValue), parseDate(rangeInputValue || inputValue)]);\n\t\t\t\t\tthis.doSelect(this.flatpickrInstance.selectedDates);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.onClose.emit(date);\n\t\t},\n\t\tonDayCreate: (_dObj, _dStr, _fp, dayElem) => {\n\t\t\tdayElem.classList.add(\"cds--date-picker__day\");\n\t\t},\n\t\tnextArrow: this.rightArrowHTML(),\n\t\tprevArrow: this.leftArrowHTML(),\n\t\tvalue: this.value\n\t};\n\n\tprotected flatpickrInstance = null;\n\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected i18n: I18n\n\t) { }\n\n\tngOnInit() {\n\t\t// if i18n is set to anything other than en we'll want to change the language\n\t\t// otherwise we'll just use the local setting\n\t\tif (this.i18n.getLocale() !== \"en\") {\n\t\t\tthis.i18n.getLocaleObservable().subscribe(locale => {\n\t\t\t\tthis.language = locale;\n\t\t\t\tthis.resetFlatpickrInstance();\n\t\t\t});\n\t\t}\n\t}\n\n\tngOnChanges(changes: SimpleChanges) {\n\t\t// Reset the flatpickr instance on input changes that affect flatpickr.\n\t\tconst flatpickrChangeKeys = [\n\t\t\t\"range\",\n\t\t\t\"dateFormat\",\n\t\t\t\"language\",\n\t\t\t\"id\",\n\t\t\t\"value\",\n\t\t\t\"plugins\",\n\t\t\t\"flatpickrOptions\",\n\t\t\t\"readonly\"\n\t\t];\n\t\tconst changeKeys = Object.keys(changes);\n\t\tif (changeKeys.some(key => flatpickrChangeKeys.includes(key))) {\n\t\t\tthis.resetFlatpickrInstance(changes.value);\n\t\t}\n\t}\n\n\tngAfterViewInit() {\n\t\tif (!this.skeleton) {\n\t\t\tthis.input.input.nativeElement.value = this._value[0] ?? \"\";\n\t\t\tif (this.range) {\n\t\t\t\tthis.rangeInput.input.nativeElement.value = this._value[1] ?? \"\";\n\t\t\t}\n\t\t}\n\t\tsetTimeout(() => {\n\t\t\tthis.addInputListeners();\n\t\t}, 0);\n\t}\n\n\t// because the actual view may be delayed in loading (think projection into a tab pane)\n\t// and because we rely on a library that operates outside the Angular view of the world\n\t// we need to keep trying to load the library, until the relevant DOM is actually live\n\tngAfterViewChecked() {\n\t\tif (!this.isFlatpickrLoaded()) {\n\t\t\t// @ts-ignore ts is unhappy with the below call to `flatpickr`\n\t\t\tthis.flatpickrInstance = flatpickr(`#${this.id}-input`, this.flatpickrOptions);\n\t\t\t// if (and only if) the initialization succeeded, we can set the date values\n\t\t\tif (this.isFlatpickrLoaded()) {\n\t\t\t\tif (this.value.length > 0) {\n\t\t\t\t\tthis.setDateValues(this.value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t@HostListener(\"focusin\")\n\tonFocus() {\n\t\t// Updates the month manually when calendar mode is range because month\n\t\t// will not update properly without manually updating them on focus.\n\t\tif (this.range) {\n\t\t\tif (this.rangeInput.input.nativeElement === document.activeElement && this.flatpickrInstance.selectedDates[1]) {\n\t\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[1].getMonth();\n\t\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\t\t\t} else if (this.input.input.nativeElement === document.activeElement && this.flatpickrInstance.selectedDates[0]) {\n\t\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[0].getMonth();\n\t\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\t\t\t}\n\t\t}\n\t}\n\n\t@HostListener(\"focusout\")\n\tonFocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Writes a value from the model to the component. Expects the value to be `null` or `(Date | string)[]`\n\t * @param value value received from the model\n\t */\n\twriteValue(value: (Date | string)[]) {\n\t\tthis.value = value;\n\t\tsetTimeout(() => {\n\t\t\tif (this.isFlatpickrLoaded() && this.flatpickrInstance.config) {\n\t\t\t\tthis.setDateValues(this.value);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the DatePicker.\n\t *\n\t * ex: `this.formGroup.get(\"myDatePicker\").disable();`\n\t *\n\t * @param isDisabled `true` to disable the DatePicker\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\tonTouched: () => any = () => { };\n\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * Cleans up our flatpickr instance\n\t */\n\tngOnDestroy() {\n\t\tif (!this.isFlatpickrLoaded()) { return; }\n\t\tthis.flatpickrInstance.destroy();\n\t}\n\n\t/**\n\t * Handles the `valueChange` event from the primary/single input\n\t */\n\tonValueChange(event: string) {\n\t\tif (this.isFlatpickrLoaded()) {\n\t\t\tconst date = this.flatpickrInstance.parseDate(event, this.dateFormat);\n\t\t\tif (this.range) {\n\t\t\t\tthis.setDateValues([date, this.flatpickrInstance.selectedDates[1]]);\n\t\t\t} else {\n\t\t\t\tthis.setDateValues([date]);\n\t\t\t}\n\t\t\tthis.doSelect(this.flatpickrInstance.selectedDates);\n\t\t}\n\t}\n\n\t/**\n\t * Handles the `valueChange` event from the range input\n\t */\n\tonRangeValueChange(event: string) {\n\t\tif (this.isFlatpickrLoaded() && this.flatpickrInstance.isOpen) {\n\t\t\tconst date = this.flatpickrInstance.parseDate(event, this.dateFormat);\n\t\t\tthis.setDateValues([this.flatpickrInstance.selectedDates[0], date]);\n\t\t\tthis.doSelect(this.flatpickrInstance.selectedDates);\n\t\t}\n\t}\n\n\t/**\n\t * Handles opening the calendar \"properly\" when the calendar icon is clicked.\n\t */\n\topenCalendar(datepickerInput: DatePickerInput) {\n\t\tif (this.readonly || this.skeleton) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.range) {\n\t\t\tdatepickerInput.input.nativeElement.click();\n\n\t\t\t// If the first input's calendar icon is clicked when calendar is in range mode, then\n\t\t\t// the month and year needs to be manually changed to the current selected month and\n\t\t\t// year otherwise the calendar view will not be updated upon opening.\n\t\t\tif (datepickerInput === this.input && this.flatpickrInstance.selectedDates[0]) {\n\t\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[0].getMonth();\n\n\t\t\t\tthis.flatpickrInstance.currentYear = this.flatpickrInstance.selectedDates[0].getFullYear();\n\t\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\t\t\t}\n\t\t} else {\n\t\t\t// Single-mode flatpickr handles mousedown but not click, so nativeElement.click() won't\n\t\t\t// work when the calendar icon is clicked. In this case we simply use flatpickr.open().\n\t\t\tthis.flatpickrInstance.open();\n\t\t}\n\t}\n\n\tprotected updateCalendarListeners() {\n\t\tconst calendarContainer = document.querySelectorAll(\".flatpickr-calendar\");\n\t\tArray.from(calendarContainer).forEach(calendar => {\n\t\t\tcalendar.removeEventListener(\"click\", this.preventCalendarClose);\n\t\t\tcalendar.addEventListener(\"click\", this.preventCalendarClose);\n\t\t});\n\t}\n\n\t/**\n\t * Handles the initialization of event listeners for the datepicker input and range input fields.\n\t */\n\tprotected addInputListeners() {\n\t\tif (!this.isFlatpickrLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Allows focus transition from the datepicker input or range input field to\n\t\t// flatpickr calendar using a keyboard.\n\t\tconst addFocusCalendarListener = (element: HTMLInputElement) => {\n\t\t\telement.addEventListener(\"keydown\", (event: KeyboardEvent) => {\n\t\t\t\t// Listeners are added just once, so a check is needed here.\n\t\t\t\tif (this.readonly) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\tthis.flatpickrInstance.close();\n\t\t\t\t}\n\t\t\t\tif (event.key === \"ArrowDown\") {\n\t\t\t\t\tif (!this.flatpickrInstance.isOpen) {\n\t\t\t\t\t\tthis.flatpickrInstance.open();\n\t\t\t\t\t}\n\n\t\t\t\t\tconst calendarContainer = this.flatpickrInstance.calendarContainer;\n\t\t\t\t\tconst dayElement = calendarContainer && calendarContainer.querySelector(\".flatpickr-day[tabindex]\");\n\n\t\t\t\t\tif (dayElement) {\n\t\t\t\t\t\tdayElement.focus();\n\n\t\t\t\t\t\t// If the user manually inputs a value into the date field and presses arrow down,\n\t\t\t\t\t\t// datepicker input onchange will be triggered when focus is removed from it and\n\t\t\t\t\t\t// `flatpickrInstance.setDate` and `flatpickrInstance.changeMonth` will be invoked\n\t\t\t\t\t\t// which will automatically change focus to the beginning of the document.\n\t\t\t\t\t\tif (document.activeElement !== dayElement && this.flatpickrInstance.selectedDateElem) {\n\t\t\t\t\t\t\tthis.flatpickrInstance.selectedDateElem.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tif (this.input && this.input.input) {\n\t\t\taddFocusCalendarListener(this.input.input.nativeElement);\n\t\t}\n\n\t\tif (this.rangeInput && this.rangeInput.input) {\n\t\t\taddFocusCalendarListener(this.rangeInput.input.nativeElement);\n\t\t}\n\t}\n\n\t/**\n\t * Resets the flatpickr instance while keeping the date values (or updating them if newDates is provided)\n\t *\n\t * Used to pick up input changes or locale changes.\n\t *\n\t * @param newDates An optional SimpleChange of date values\n\t */\n\tprotected resetFlatpickrInstance(newDates?: SimpleChange) {\n\t\tif (this.isFlatpickrLoaded()) {\n\t\t\tlet dates = this.flatpickrInstance.selectedDates;\n\t\t\tif (newDates && this.didDateValueChange(newDates.currentValue, newDates.previousValue)) {\n\t\t\t\tdates = newDates.currentValue;\n\t\t\t}\n\t\t\t// only reset the flatpickr instance on Input changes\n\t\t\t// @ts-ignore ts is unhappy with the below call to `flatpickr`\n\t\t\tthis.flatpickrInstance = flatpickr(`#${this.id}-input`, this.flatpickrOptions);\n\t\t\tthis.setDateValues(dates);\n\t\t}\n\t}\n\n\t/**\n\t * Carbon uses a number of specific classnames for parts of the flatpickr - this idempotent method applies them if needed.\n\t */\n\tprotected updateClassNames() {\n\t\tif (!this.elementRef) { return; }\n\t\t// get all the possible flatpickrs in the document - we need to add classes to (potentially) all of them\n\t\tconst calendarContainer = document.querySelectorAll(\".flatpickr-calendar\");\n\t\tconst monthContainer = document.querySelectorAll(\".flatpickr-month\");\n\t\tconst weekdaysContainer = document.querySelectorAll(\".flatpickr-weekdays\");\n\t\tconst weekdayContainer = document.querySelectorAll(\".flatpickr-weekday\");\n\t\tconst daysContainer = document.querySelectorAll(\".flatpickr-days\");\n\t\tconst dayContainer = document.querySelectorAll(\".flatpickr-day\");\n\n\t\t// add classes to lists of elements\n\t\tconst addClassIfNotExists = (classname: string, elementList: NodeListOf<Element>) => {\n\t\t\tArray.from(elementList).forEach(element => {\n\t\t\t\tif (!element.classList.contains(classname)) {\n\t\t\t\t\telement.classList.add(classname);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\t// add classes (but only if they don't exist, small perf win)\n\t\taddClassIfNotExists(\"cds--date-picker__calendar\", calendarContainer);\n\t\taddClassIfNotExists(\"cds--date-picker__month\", monthContainer);\n\t\taddClassIfNotExists(\"cds--date-picker__weekdays\", weekdaysContainer);\n\t\taddClassIfNotExists(\"cds--date-picker__days\", daysContainer);\n\n\t\t// add weekday classes and format the text\n\t\tArray.from(weekdayContainer).forEach(element => {\n\t\t\telement.innerHTML = element.innerHTML.replace(/\\s+/g, \"\");\n\t\t\telement.classList.add(\"cds--date-picker__weekday\");\n\t\t});\n\n\t\t// add day classes and special case the \"today\" element based on `this.value`\n\t\tArray.from(dayContainer).forEach(element => {\n\t\t\telement.classList.add(\"cds--date-picker__day\");\n\t\t\tif (!this.value) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (element.classList.contains(\"today\") && this.value.length > 0) {\n\t\t\t\telement.classList.add(\"no-border\");\n\t\t\t} else if (element.classList.contains(\"today\") && this.value.length === 0) {\n\t\t\t\telement.classList.remove(\"no-border\");\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected updateAttributes() {\n\t\tconst calendarContainer = document.querySelectorAll(\".flatpickr-calendar\");\n\t\tArray.from(calendarContainer).forEach(calendar => {\n\t\t\tcalendar.setAttribute(\"role\", \"region\");\n\t\t\tcalendar.setAttribute(\"aria-label\", this.ariaLabel);\n\t\t});\n\t}\n\n\t/**\n\t * Applies the given date value array to both the flatpickr instance and the `input`(s)\n\t * @param dates the date values to apply\n\t */\n\tprotected setDateValues(dates: (Date | string)[]) {\n\t\tif (this.isFlatpickrLoaded()) {\n\t\t\tconst singleInput = this.elementRef.nativeElement.querySelector(`#${this.id}-input`);\n\t\t\tconst rangeInput = this.elementRef.nativeElement.querySelector(`#${this.id}-rangeInput`);\n\n\t\t\t// `flatpickrInstance.setDate` removes the focus on the selected date element and will\n\t\t\t// automatically change focus to the beginning of the document. If a selected date is\n\t\t\t// focused before `flatpickrInstance.setDate` is invoked then it should remain focused.\n\t\t\tlet shouldRefocusDateElement = this.flatpickrInstance.selectedDateElem === document.activeElement;\n\n\t\t\t// set the date on the instance\n\t\t\tthis.flatpickrInstance.setDate(dates);\n\n\t\t\tif (shouldRefocusDateElement) {\n\t\t\t\tthis.flatpickrInstance.selectedDateElem.focus();\n\t\t\t}\n\n\t\t\t// we can either set a date value or an empty string, so we start with an empty string\n\t\t\tlet singleDate = \"\";\n\t\t\t// if date is a string, parse and format\n\t\t\tif (typeof this.flatpickrInstance.selectedDates[0] === \"string\") {\n\t\t\t\tsingleDate = this.flatpickrInstance.parseDate(this.flatpickrInstance.selectedDates[0], this.dateFormat);\n\t\t\t\tsingleDate = this.flatpickrInstance.formatDate(singleDate, this.dateFormat);\n\t\t\t// if date is not a string we can assume it's a Date and we should format\n\t\t\t} else if (!!this.flatpickrInstance.selectedDates[0]) {\n\t\t\t\tsingleDate = this.flatpickrInstance.formatDate(this.flatpickrInstance.selectedDates[0], this.dateFormat);\n\t\t\t}\n\n\t\t\tif (rangeInput) {\n\t\t\t\t// we can either set a date value or an empty string, so we start with an empty string\n\t\t\t\tlet rangeDate = \"\";\n\t\t\t\t// if date is a string, parse and format\n\t\t\t\tif (typeof this.flatpickrInstance.selectedDates[1] === \"string\") {\n\t\t\t\t\trangeDate = this.flatpickrInstance.parseDate(this.flatpickrInstance.selectedDates[1].toString(), this.dateFormat);\n\t\t\t\t\trangeDate = this.flatpickrInstance.formatDate(rangeDate, this.dateFormat);\n\t\t\t\t// if date is not a string we can assume it's a Date and we should format\n\t\t\t\t} else if (!!this.flatpickrInstance.selectedDates[1]) {\n\t\t\t\t\trangeDate = this.flatpickrInstance.formatDate(this.flatpickrInstance.selectedDates[1], this.dateFormat);\n\t\t\t\t}\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t// apply the values\n\t\t\t\t\trangeInput.value = rangeDate;\n\t\t\t\t\tsingleInput.value = singleDate;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected preventCalendarClose = event => event.stopPropagation();\n\n\tprotected doSelect(selectedValue: (Date | string)[]) {\n\t\t// In range mode, if a date is selected from the first calendar that is from the previous month,\n\t\t// the month will not be updated on the calendar until the calendar is re-opened.\n\t\t// This will make sure the calendar is updated with the correct month.\n\t\tif (this.range && this.flatpickrInstance.selectedDates[0]) {\n\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[0].getMonth();\n\n\t\t\t// `flatpickrInstance.changeMonth` removes the focus on the selected date element and will\n\t\t\t// automatically change focus to the beginning of the document. If a selected date is\n\t\t\t// focused before `flatpickrInstance.changeMonth` is invoked then it should remain focused.\n\t\t\tlet shouldRefocusDateElement = this.flatpickrInstance.selectedDateElem === document.activeElement;\n\n\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\n\t\t\tif (shouldRefocusDateElement) {\n\t\t\t\tthis.flatpickrInstance.selectedDateElem.focus();\n\t\t\t}\n\n\t\t}\n\t\tthis.valueChange.emit(selectedValue);\n\t\tthis.propagateChange(selectedValue);\n\t}\n\n\tprotected didDateValueChange(currentValue, previousValue) {\n\t\treturn currentValue[0] !== previousValue[0] || currentValue[1] !== previousValue[1];\n\t}\n\n\t/**\n\t * More advanced checking of the loaded state of flatpickr\n\t */\n\tprotected isFlatpickrLoaded() {\n\t\t// cast the instance to a boolean, and some method that has to exist for the library to be loaded in this case `setDate`\n\t\treturn !!this.flatpickrInstance && !!this.flatpickrInstance.setDate;\n\t}\n\n\t/**\n\t * Right arrow HTML passed to flatpickr\n\t */\n\tprotected rightArrowHTML() {\n\t\treturn `\n\t\t\t<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n\t\t\t\t<polygon points=\"11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 \"/>\n\t\t\t\t<rect width=\"16\" height=\"16\" style=\"fill:none\" />\n\t\t\t</svg>`;\n\t}\n\n\t/**\n\t * Left arrow HTML passed to flatpickr\n\t */\n\tprotected leftArrowHTML() {\n\t\treturn `\n\t\t\t<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n\t\t\t\t<polygon points=\"5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 \"/>\n\t\t\t\t<rect width=\"16\" height=\"16\" style=\"fill:none\" />\n\t\t\t</svg>`;\n\t}\n}\n",
|
|
28021
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tViewEncapsulation,\n\tElementRef,\n\tOnDestroy,\n\tHostListener,\n\tTemplateRef,\n\tOnChanges,\n\tSimpleChanges,\n\tAfterViewChecked,\n\tAfterViewInit,\n\tViewChild,\n\tOnInit,\n\tSimpleChange\n} from \"@angular/core\";\nimport rangePlugin from \"flatpickr/dist/plugins/rangePlugin\";\nimport flatpickr from \"flatpickr\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { carbonFlatpickrMonthSelectPlugin } from \"./carbon-flatpickr-month-select\";\nimport * as languages from \"flatpickr/dist/l10n/index\";\nimport { Options } from \"flatpickr/dist/types/options\";\nimport { DatePickerInput } from \"carbon-components-angular/datepicker-input\";\nimport { I18n } from \"carbon-components-angular/i18n\";\n\n/**\n * Due to type error, we have to use square brackets property accessor\n * There is a webpack issue when attempting to access exported languages from flatpickr l10n Angular 14+ apps\n * languages.default[locale] fails in app consuming CCA library but passes in test\n * languages.default.default[locale] fails in test but works in app consuming CCA library.\n *\n * To please both scenarios, we are adding a condition to prevent tests from failing\n */\nif (languages.default?.default[\"en\"]?.weekdays) {\n\t(languages.default.default[\"en\"].weekdays.shorthand as string[]) = languages.default.default[\"en\"].weekdays.longhand.map(day => {\n\t\tif (day === \"Thursday\") {\n\t\t\treturn \"Th\";\n\t\t}\n\t\treturn day.charAt(0);\n\t});\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { DatePickerModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-date-picker--single)\n */\n@Component({\n\tselector: \"cds-date-picker, ibm-date-picker\",\n\ttemplate: `\n\t<div class=\"cds--form-item\">\n\t\t<div\n\t\t\tclass=\"cds--date-picker\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--date-picker--range' : range,\n\t\t\t\t'cds--date-picker--single' : !range,\n\t\t\t\t'cds--date-picker--light' : theme === 'light',\n\t\t\t\t'cds--skeleton' : skeleton\n\t\t\t}\">\n\t\t\t<div class=\"cds--date-picker-container\">\n\t\t\t\t<cds-date-picker-input\n\t\t\t\t\t#input\n\t\t\t\t\t[label]=\"label\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t[pattern]=\"inputPattern\"\n\t\t\t\t\t[id]=\"id + '-input'\"\n\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t[type]=\"(range ? 'range' : 'single')\"\n\t\t\t\t\t[hasIcon]=\"(range ? false : true)\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t\t[warn]=\"warn\"\n\t\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t\t(valueChange)=\"onValueChange($event)\"\n\t\t\t\t\t(click)=\"openCalendar(input)\">\n\t\t\t\t</cds-date-picker-input>\n\t\t\t</div>\n\n\t\t\t<div *ngIf=\"range\" class=\"cds--date-picker-container\">\n\t\t\t\t<cds-date-picker-input\n\t\t\t\t\t#rangeInput\n\t\t\t\t\t[label]=\"rangeLabel\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t[pattern]=\"inputPattern\"\n\t\t\t\t\t[id]=\"id + '-rangeInput'\"\n\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t[type]=\"(range ? 'range' : 'single')\"\n\t\t\t\t\t[hasIcon]=\"(range ? true : null)\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[invalid]=\"rangeInvalid\"\n\t\t\t\t\t[invalidText]=\"rangeInvalidText\"\n\t\t\t\t\t[warn]=\"rangeWarn\"\n\t\t\t\t\t[warnText]=\"rangeWarnText\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[helperText]=\"rangeHelperText\"\n\t\t\t\t\t(valueChange)=\"onRangeValueChange($event)\"\n\t\t\t\t\t(click)=\"openCalendar(rangeInput)\">\n\t\t\t\t</cds-date-picker-input>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: DatePicker,\n\t\t\tmulti: true\n\t\t}\n\t],\n\tencapsulation: ViewEncapsulation.None\n})\nexport class DatePicker implements\n\tOnInit,\n\tOnDestroy,\n\tOnChanges,\n\tAfterViewChecked,\n\tAfterViewInit {\n\tprivate static datePickerCount = 0;\n\n\t/**\n\t * Select calendar range mode\n\t */\n\t@Input() range = false;\n\n\t/**\n\t * Format of date\n\t *\n\t * For reference: https://flatpickr.js.org/formatting/\n\t */\n\t@Input() dateFormat = \"m/d/Y\";\n\n\t/**\n\t * Language of the flatpickr calendar.\n\t *\n\t * For reference of the possible locales:\n\t * https://github.com/flatpickr/flatpickr/blob/master/src/l10n/index.ts\n\t */\n\t@Input() language = \"en\";\n\n\t@Input() label: string | TemplateRef<any>;\n\t@Input() helperText: string | TemplateRef<any>;\n\t@Input() rangeHelperText: string | TemplateRef<any>;\n\t@Input() rangeLabel: string;\n\n\t@Input() placeholder = \"mm/dd/yyyy\";\n\n\t/**\n\t * Aria label added to datepicker's calendar container.\n\t */\n\t@Input() ariaLabel = \"calendar container\";\n\n\t/**\n\t * The pattern for the underlying input element\n\t */\n\t@Input() inputPattern = \"^\\\\d{1,2}/\\\\d{1,2}/\\\\d{4}$\";\n\n\t@Input() id = `datepicker-${DatePicker.datePickerCount++}`;\n\n\t@Input() set value(v: (Date | string)[]) {\n\t\tif (!v) {\n\t\t\tv = [];\n\t\t}\n\t\tthis._value = v;\n\t}\n\n\tget value() {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * Set to `\"light\"` to apply the light style\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\n\t@Input() disabled = false;\n\n\t@Input() readonly = false;\n\t/**\n\t * Set to `true` to display the invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if datepicker is in an invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\n\t */\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Set to `true` to display the invalid state for the second datepicker input.\n\t */\n\t@Input() rangeInvalid = false;\n\t/**\n\t * Value displayed if the second datepicker input is in an invalid state.\n\t */\n\t@Input() rangeInvalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` to show a warning in the second datepicker input (contents set by rangeWarningText)\n\t */\n\t@Input() rangeWarn = false;\n\t/**\n\t * Sets the warning text for the second datepicker input\n\t */\n\t@Input() rangeWarnText: string | TemplateRef<any>;\n\n\t@Input() skeleton = false;\n\n\t@Input() plugins = [];\n\n\t@Input()\n\tset flatpickrOptions(options: Partial<Options>) {\n\t\tthis._flatpickrOptions = Object.assign({}, this._flatpickrOptions, options);\n\t}\n\tget flatpickrOptions(): Partial<Options> {\n\t\tconst plugins = [...this.plugins, carbonFlatpickrMonthSelectPlugin];\n\t\tif (this.range) {\n\t\t\tplugins.push(rangePlugin({ input: `#${this.id}-rangeInput`, position: \"left\" }));\n\t\t}\n\t\treturn Object.assign({}, this._flatpickrOptions, this.flatpickrBaseOptions, {\n\t\t\tmode: this.range ? \"range\" : \"single\",\n\t\t\tplugins,\n\t\t\tdateFormat: this.dateFormat,\n\t\t\tlocale: languages.default?.default[this.language] || languages.default[this.language],\n\t\t\t// Little trick force \"readonly mode\" on datepicker input.\n\t\t\t// Docs: Whether clicking on the input should open the picker.\n\t\t\t// You could disable this if you wish to open the calendar manually with.open().\n\t\t\tclickOpens: !this.readonly\n\t\t});\n\t}\n\n\t@ViewChild(\"input\", { static: true }) input: DatePickerInput;\n\t@ViewChild(\"rangeInput\") rangeInput: DatePickerInput;\n\n\t@Output() valueChange: EventEmitter<any> = new EventEmitter();\n\n\t/**\n\t * We are overriding onClose event even if users pass it via flatpickr options\n\t * Emits an event when date picker closes\n\t */\n\t@Output() onClose: EventEmitter<any> = new EventEmitter();\n\n\tprotected _value = [];\n\n\tprotected _flatpickrOptions: Partial<Options> = {\n\t\tallowInput: true\n\t};\n\n\tprotected flatpickrBaseOptions = {\n\t\tmode: \"single\",\n\t\tdateFormat: \"m/d/Y\",\n\t\tplugins: this.plugins,\n\t\tonOpen: () => {\n\t\t\tthis.updateClassNames();\n\t\t\tthis.updateAttributes();\n\t\t\tthis.updateCalendarListeners();\n\t\t},\n\t\tonClose: (date) => {\n\t\t\t// This makes sure that the `flatpickrInstance selectedDates` are in sync with the values of\n\t\t\t// the inputs when the calendar closes.\n\t\t\tif (this.range && this.flatpickrInstance) {\n\t\t\t\tconst inputValue = this.input.input.nativeElement.value;\n\t\t\t\tconst rangeInputValue = this.rangeInput.input.nativeElement.value;\n\t\t\t\tif (inputValue || rangeInputValue) {\n\t\t\t\t\tconst parseDate = (date: string) => this.flatpickrInstance.parseDate(date, this.dateFormat);\n\t\t\t\t\tthis.setDateValues([parseDate(inputValue), parseDate(rangeInputValue || inputValue)]);\n\t\t\t\t\tthis.doSelect(this.flatpickrInstance.selectedDates);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.onClose.emit(date);\n\t\t},\n\t\tonDayCreate: (_dObj, _dStr, _fp, dayElem) => {\n\t\t\tdayElem.classList.add(\"cds--date-picker__day\");\n\t\t},\n\t\tnextArrow: this.rightArrowHTML(),\n\t\tprevArrow: this.leftArrowHTML(),\n\t\tvalue: this.value\n\t};\n\n\tprotected flatpickrInstance = null;\n\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected i18n: I18n\n\t) { }\n\n\tngOnInit() {\n\t\t// if i18n is set to anything other than en we'll want to change the language\n\t\t// otherwise we'll just use the local setting\n\t\tif (this.i18n.getLocale() !== \"en\") {\n\t\t\tthis.i18n.getLocaleObservable().subscribe(locale => {\n\t\t\t\tthis.language = locale;\n\t\t\t\tthis.resetFlatpickrInstance();\n\t\t\t});\n\t\t}\n\t}\n\n\tngOnChanges(changes: SimpleChanges) {\n\t\t// Reset the flatpickr instance on input changes that affect flatpickr.\n\t\tconst flatpickrChangeKeys = [\n\t\t\t\"range\",\n\t\t\t\"dateFormat\",\n\t\t\t\"language\",\n\t\t\t\"id\",\n\t\t\t\"value\",\n\t\t\t\"plugins\",\n\t\t\t\"flatpickrOptions\",\n\t\t\t\"readonly\"\n\t\t];\n\t\tconst changeKeys = Object.keys(changes);\n\t\tif (changeKeys.some(key => flatpickrChangeKeys.includes(key))) {\n\t\t\tthis.resetFlatpickrInstance(changes.value);\n\t\t}\n\t}\n\n\tngAfterViewInit() {\n\t\tif (!this.skeleton) {\n\t\t\tthis.input.input.nativeElement.value = this._value[0] ?? \"\";\n\t\t\tif (this.range) {\n\t\t\t\tthis.rangeInput.input.nativeElement.value = this._value[1] ?? \"\";\n\t\t\t}\n\t\t}\n\t\tsetTimeout(() => {\n\t\t\tthis.addInputListeners();\n\t\t}, 0);\n\t}\n\n\t// because the actual view may be delayed in loading (think projection into a tab pane)\n\t// and because we rely on a library that operates outside the Angular view of the world\n\t// we need to keep trying to load the library, until the relevant DOM is actually live\n\tngAfterViewChecked() {\n\t\tif (!this.isFlatpickrLoaded()) {\n\t\t\t// @ts-ignore ts is unhappy with the below call to `flatpickr`\n\t\t\tthis.flatpickrInstance = flatpickr(`#${this.id}-input`, this.flatpickrOptions);\n\t\t\t// if (and only if) the initialization succeeded, we can set the date values\n\t\t\tif (this.isFlatpickrLoaded()) {\n\t\t\t\tif (this.value.length > 0) {\n\t\t\t\t\tthis.setDateValues(this.value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t@HostListener(\"focusin\")\n\tonFocus() {\n\t\t// Updates the month manually when calendar mode is range because month\n\t\t// will not update properly without manually updating them on focus.\n\t\tif (this.range) {\n\t\t\tif (this.rangeInput.input.nativeElement === document.activeElement && this.flatpickrInstance.selectedDates[1]) {\n\t\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[1].getMonth();\n\t\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\t\t\t} else if (this.input.input.nativeElement === document.activeElement && this.flatpickrInstance.selectedDates[0]) {\n\t\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[0].getMonth();\n\t\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\t\t\t}\n\t\t}\n\t}\n\n\t@HostListener(\"focusout\")\n\tonFocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Writes a value from the model to the component. Expects the value to be `null` or `(Date | string)[]`\n\t * @param value value received from the model\n\t */\n\twriteValue(value: (Date | string)[]) {\n\t\tthis.value = value;\n\t\tsetTimeout(() => {\n\t\t\tif (this.isFlatpickrLoaded() && this.flatpickrInstance.config) {\n\t\t\t\tthis.setDateValues(this.value);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the DatePicker.\n\t *\n\t * ex: `this.formGroup.get(\"myDatePicker\").disable();`\n\t *\n\t * @param isDisabled `true` to disable the DatePicker\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\tonTouched: () => any = () => { };\n\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * Cleans up our flatpickr instance\n\t */\n\tngOnDestroy() {\n\t\tif (!this.isFlatpickrLoaded()) { return; }\n\t\tthis.flatpickrInstance.destroy();\n\t}\n\n\t/**\n\t * Handles the `valueChange` event from the primary/single input\n\t */\n\tonValueChange(event: string) {\n\t\tif (this.isFlatpickrLoaded()) {\n\t\t\tconst date = this.flatpickrInstance.parseDate(event, this.dateFormat);\n\t\t\tif (this.range) {\n\t\t\t\tthis.setDateValues([date, this.flatpickrInstance.selectedDates[1]]);\n\t\t\t} else {\n\t\t\t\tthis.setDateValues([date]);\n\t\t\t}\n\t\t\tthis.doSelect(this.flatpickrInstance.selectedDates);\n\t\t}\n\t}\n\n\t/**\n\t * Handles the `valueChange` event from the range input\n\t */\n\tonRangeValueChange(event: string) {\n\t\tif (this.isFlatpickrLoaded() && this.flatpickrInstance.isOpen) {\n\t\t\tconst date = this.flatpickrInstance.parseDate(event, this.dateFormat);\n\t\t\tthis.setDateValues([this.flatpickrInstance.selectedDates[0], date]);\n\t\t\tthis.doSelect(this.flatpickrInstance.selectedDates);\n\t\t}\n\t}\n\n\t/**\n\t * Handles opening the calendar \"properly\" when the calendar icon is clicked.\n\t */\n\topenCalendar(datepickerInput: DatePickerInput) {\n\t\tif (this.readonly || this.skeleton) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.range) {\n\t\t\tdatepickerInput.input.nativeElement.click();\n\n\t\t\t// If the first input's calendar icon is clicked when calendar is in range mode, then\n\t\t\t// the month and year needs to be manually changed to the current selected month and\n\t\t\t// year otherwise the calendar view will not be updated upon opening.\n\t\t\tif (datepickerInput === this.input && this.flatpickrInstance.selectedDates[0]) {\n\t\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[0].getMonth();\n\n\t\t\t\tthis.flatpickrInstance.currentYear = this.flatpickrInstance.selectedDates[0].getFullYear();\n\t\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\t\t\t}\n\t\t} else {\n\t\t\t// Single-mode flatpickr handles mousedown but not click, so nativeElement.click() won't\n\t\t\t// work when the calendar icon is clicked. In this case we simply use flatpickr.open().\n\t\t\tthis.flatpickrInstance.open();\n\t\t}\n\t}\n\n\tprotected updateCalendarListeners() {\n\t\tconst calendarContainer = document.querySelectorAll(\".flatpickr-calendar\");\n\t\tArray.from(calendarContainer).forEach(calendar => {\n\t\t\tcalendar.removeEventListener(\"click\", this.preventCalendarClose);\n\t\t\tcalendar.addEventListener(\"click\", this.preventCalendarClose);\n\t\t});\n\t}\n\n\t/**\n\t * Handles the initialization of event listeners for the datepicker input and range input fields.\n\t */\n\tprotected addInputListeners() {\n\t\tif (!this.isFlatpickrLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Allows focus transition from the datepicker input or range input field to\n\t\t// flatpickr calendar using a keyboard.\n\t\tconst addFocusCalendarListener = (element: HTMLInputElement) => {\n\t\t\telement.addEventListener(\"keydown\", (event: KeyboardEvent) => {\n\t\t\t\t// Listeners are added just once, so a check is needed here.\n\t\t\t\tif (this.readonly) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\tthis.flatpickrInstance.close();\n\t\t\t\t}\n\t\t\t\tif (event.key === \"ArrowDown\") {\n\t\t\t\t\tif (!this.flatpickrInstance.isOpen) {\n\t\t\t\t\t\tthis.flatpickrInstance.open();\n\t\t\t\t\t}\n\n\t\t\t\t\tconst calendarContainer = this.flatpickrInstance.calendarContainer;\n\t\t\t\t\tconst dayElement = calendarContainer && calendarContainer.querySelector(\".flatpickr-day[tabindex]\");\n\t\t\t\t\tconst selectedDateElem = calendarContainer && calendarContainer.querySelector('.selected');\n\t\t\t\t\tconst todayDateElem = calendarContainer && calendarContainer.querySelector('.today');\n\n\t\t\t\t\tif (dayElement) {\n\t\t\t\t\t\t(todayDateElem || selectedDateElem || dayElement).focus();\n\n\t\t\t\t\t\t// If the user manually inputs a value into the date field and presses arrow down,\n\t\t\t\t\t\t// datepicker input onchange will be triggered when focus is removed from it and\n\t\t\t\t\t\t// `flatpickrInstance.setDate` and `flatpickrInstance.changeMonth` will be invoked\n\t\t\t\t\t\t// which will automatically change focus to the beginning of the document.\n\t\t\t\t\t\tif (document.activeElement !== dayElement && this.flatpickrInstance.selectedDateElem) {\n\t\t\t\t\t\t\tthis.flatpickrInstance.selectedDateElem.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tif (this.input && this.input.input) {\n\t\t\taddFocusCalendarListener(this.input.input.nativeElement);\n\t\t}\n\n\t\tif (this.rangeInput && this.rangeInput.input) {\n\t\t\taddFocusCalendarListener(this.rangeInput.input.nativeElement);\n\t\t}\n\t}\n\n\t/**\n\t * Resets the flatpickr instance while keeping the date values (or updating them if newDates is provided)\n\t *\n\t * Used to pick up input changes or locale changes.\n\t *\n\t * @param newDates An optional SimpleChange of date values\n\t */\n\tprotected resetFlatpickrInstance(newDates?: SimpleChange) {\n\t\tif (this.isFlatpickrLoaded()) {\n\t\t\tlet dates = this.flatpickrInstance.selectedDates;\n\t\t\tif (newDates && this.didDateValueChange(newDates.currentValue, newDates.previousValue)) {\n\t\t\t\tdates = newDates.currentValue;\n\t\t\t}\n\t\t\t// only reset the flatpickr instance on Input changes\n\t\t\t// @ts-ignore ts is unhappy with the below call to `flatpickr`\n\t\t\tthis.flatpickrInstance = flatpickr(`#${this.id}-input`, this.flatpickrOptions);\n\t\t\tthis.setDateValues(dates);\n\t\t}\n\t}\n\n\t/**\n\t * Carbon uses a number of specific classnames for parts of the flatpickr - this idempotent method applies them if needed.\n\t */\n\tprotected updateClassNames() {\n\t\tif (!this.elementRef) { return; }\n\t\t// get all the possible flatpickrs in the document - we need to add classes to (potentially) all of them\n\t\tconst calendarContainer = document.querySelectorAll(\".flatpickr-calendar\");\n\t\tconst monthContainer = document.querySelectorAll(\".flatpickr-month\");\n\t\tconst weekdaysContainer = document.querySelectorAll(\".flatpickr-weekdays\");\n\t\tconst weekdayContainer = document.querySelectorAll(\".flatpickr-weekday\");\n\t\tconst daysContainer = document.querySelectorAll(\".flatpickr-days\");\n\t\tconst dayContainer = document.querySelectorAll(\".flatpickr-day\");\n\n\t\t// add classes to lists of elements\n\t\tconst addClassIfNotExists = (classname: string, elementList: NodeListOf<Element>) => {\n\t\t\tArray.from(elementList).forEach(element => {\n\t\t\t\tif (!element.classList.contains(classname)) {\n\t\t\t\t\telement.classList.add(classname);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\t// add classes (but only if they don't exist, small perf win)\n\t\taddClassIfNotExists(\"cds--date-picker__calendar\", calendarContainer);\n\t\taddClassIfNotExists(\"cds--date-picker__month\", monthContainer);\n\t\taddClassIfNotExists(\"cds--date-picker__weekdays\", weekdaysContainer);\n\t\taddClassIfNotExists(\"cds--date-picker__days\", daysContainer);\n\n\t\t// add weekday classes and format the text\n\t\tArray.from(weekdayContainer).forEach(element => {\n\t\t\telement.innerHTML = element.innerHTML.replace(/\\s+/g, \"\");\n\t\t\telement.classList.add(\"cds--date-picker__weekday\");\n\t\t});\n\n\t\t// add day classes and special case the \"today\" element based on `this.value`\n\t\tArray.from(dayContainer).forEach(element => {\n\t\t\telement.setAttribute('role', 'button');\n\t\t\telement.classList.add(\"cds--date-picker__day\");\n\t\t\tif (!this.value) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (element.classList.contains(\"today\") && this.value.length > 0) {\n\t\t\t\telement.classList.add(\"no-border\");\n\t\t\t} else if (element.classList.contains(\"today\") && this.value.length === 0) {\n\t\t\t\telement.classList.remove(\"no-border\");\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected updateAttributes() {\n\t\tconst calendarContainer = document.querySelectorAll(\".flatpickr-calendar\");\n\t\tArray.from(calendarContainer).forEach(calendar => {\n\t\t\tcalendar.setAttribute(\"role\", \"application\");\n\t\t\tcalendar.setAttribute(\"aria-label\", this.ariaLabel);\n\t\t});\n\t}\n\n\t/**\n\t * Applies the given date value array to both the flatpickr instance and the `input`(s)\n\t * @param dates the date values to apply\n\t */\n\tprotected setDateValues(dates: (Date | string)[]) {\n\t\tif (this.isFlatpickrLoaded()) {\n\t\t\tconst singleInput = this.elementRef.nativeElement.querySelector(`#${this.id}-input`);\n\t\t\tconst rangeInput = this.elementRef.nativeElement.querySelector(`#${this.id}-rangeInput`);\n\n\t\t\t// `flatpickrInstance.setDate` removes the focus on the selected date element and will\n\t\t\t// automatically change focus to the beginning of the document. If a selected date is\n\t\t\t// focused before `flatpickrInstance.setDate` is invoked then it should remain focused.\n\t\t\tlet shouldRefocusDateElement = this.flatpickrInstance.selectedDateElem === document.activeElement;\n\n\t\t\t// set the date on the instance\n\t\t\tthis.flatpickrInstance.setDate(dates);\n\n\t\t\tif (shouldRefocusDateElement) {\n\t\t\t\tthis.flatpickrInstance.selectedDateElem.focus();\n\t\t\t}\n\n\t\t\t// we can either set a date value or an empty string, so we start with an empty string\n\t\t\tlet singleDate = \"\";\n\t\t\t// if date is a string, parse and format\n\t\t\tif (typeof this.flatpickrInstance.selectedDates[0] === \"string\") {\n\t\t\t\tsingleDate = this.flatpickrInstance.parseDate(this.flatpickrInstance.selectedDates[0], this.dateFormat);\n\t\t\t\tsingleDate = this.flatpickrInstance.formatDate(singleDate, this.dateFormat);\n\t\t\t// if date is not a string we can assume it's a Date and we should format\n\t\t\t} else if (!!this.flatpickrInstance.selectedDates[0]) {\n\t\t\t\tsingleDate = this.flatpickrInstance.formatDate(this.flatpickrInstance.selectedDates[0], this.dateFormat);\n\t\t\t}\n\n\t\t\tif (rangeInput) {\n\t\t\t\t// we can either set a date value or an empty string, so we start with an empty string\n\t\t\t\tlet rangeDate = \"\";\n\t\t\t\t// if date is a string, parse and format\n\t\t\t\tif (typeof this.flatpickrInstance.selectedDates[1] === \"string\") {\n\t\t\t\t\trangeDate = this.flatpickrInstance.parseDate(this.flatpickrInstance.selectedDates[1].toString(), this.dateFormat);\n\t\t\t\t\trangeDate = this.flatpickrInstance.formatDate(rangeDate, this.dateFormat);\n\t\t\t\t// if date is not a string we can assume it's a Date and we should format\n\t\t\t\t} else if (!!this.flatpickrInstance.selectedDates[1]) {\n\t\t\t\t\trangeDate = this.flatpickrInstance.formatDate(this.flatpickrInstance.selectedDates[1], this.dateFormat);\n\t\t\t\t}\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t// apply the values\n\t\t\t\t\trangeInput.value = rangeDate;\n\t\t\t\t\tsingleInput.value = singleDate;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected preventCalendarClose = event => event.stopPropagation();\n\n\tprotected doSelect(selectedValue: (Date | string)[]) {\n\t\t// In range mode, if a date is selected from the first calendar that is from the previous month,\n\t\t// the month will not be updated on the calendar until the calendar is re-opened.\n\t\t// This will make sure the calendar is updated with the correct month.\n\t\tif (this.range && this.flatpickrInstance.selectedDates[0]) {\n\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[0].getMonth();\n\n\t\t\t// `flatpickrInstance.changeMonth` removes the focus on the selected date element and will\n\t\t\t// automatically change focus to the beginning of the document. If a selected date is\n\t\t\t// focused before `flatpickrInstance.changeMonth` is invoked then it should remain focused.\n\t\t\tlet shouldRefocusDateElement = this.flatpickrInstance.selectedDateElem === document.activeElement;\n\n\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\n\t\t\tif (shouldRefocusDateElement) {\n\t\t\t\tthis.flatpickrInstance.selectedDateElem.focus();\n\t\t\t}\n\n\t\t}\n\t\tthis.valueChange.emit(selectedValue);\n\t\tthis.propagateChange(selectedValue);\n\t}\n\n\tprotected didDateValueChange(currentValue, previousValue) {\n\t\treturn currentValue[0] !== previousValue[0] || currentValue[1] !== previousValue[1];\n\t}\n\n\t/**\n\t * More advanced checking of the loaded state of flatpickr\n\t */\n\tprotected isFlatpickrLoaded() {\n\t\t// cast the instance to a boolean, and some method that has to exist for the library to be loaded in this case `setDate`\n\t\treturn !!this.flatpickrInstance && !!this.flatpickrInstance.setDate;\n\t}\n\n\t/**\n\t * Right arrow HTML passed to flatpickr\n\t */\n\tprotected rightArrowHTML() {\n\t\treturn `\n\t\t\t<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n\t\t\t\t<polygon points=\"11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 \"/>\n\t\t\t\t<rect width=\"16\" height=\"16\" style=\"fill:none\" />\n\t\t\t</svg>`;\n\t}\n\n\t/**\n\t * Left arrow HTML passed to flatpickr\n\t */\n\tprotected leftArrowHTML() {\n\t\treturn `\n\t\t\t<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n\t\t\t\t<polygon points=\"5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 \"/>\n\t\t\t\t<rect width=\"16\" height=\"16\" style=\"fill:none\" />\n\t\t\t</svg>`;\n\t}\n}\n",
|
|
28022
28022
|
"assetsDirs": [],
|
|
28023
28023
|
"styleUrlsData": "",
|
|
28024
28024
|
"stylesData": "",
|
|
@@ -32307,7 +32307,7 @@
|
|
|
32307
32307
|
},
|
|
32308
32308
|
{
|
|
32309
32309
|
"name": "FileComponent",
|
|
32310
|
-
"id": "component-FileComponent-
|
|
32310
|
+
"id": "component-FileComponent-440115d0b6a1699c9f9ba3afba9480f35137ac947fc32748424cfe59df7a65bb98ffb9040c93924b474f4baeb50d2d3ec7e350407e2c17583347548f24dfcac6",
|
|
32311
32311
|
"file": "src/file-uploader/file.component.ts",
|
|
32312
32312
|
"encapsulation": [],
|
|
32313
32313
|
"entryComponents": [],
|
|
@@ -32317,7 +32317,7 @@
|
|
|
32317
32317
|
"selector": "cds-file, ibm-file",
|
|
32318
32318
|
"styleUrls": [],
|
|
32319
32319
|
"styles": [],
|
|
32320
|
-
"template": "<p class=\"cds--file-filename\" [title]=\"fileItem.file.name\">\n\t<ng-template\n\t\t*ngIf=\"isTemplate(nameTpl); else defaultName\"\n\t\t[ngTemplateOutlet]=\"nameTpl\"\n\t\t[ngTemplateOutletContext]=\"{ $implicit: fileItem }\">\n\t</ng-template>\n\t<ng-template #defaultName>{{ fileItem.file.name }}</ng-template>\n</p>\n<span *ngIf=\"fileItem.state === 'edit'\" class=\"cds--file__state-container\">\n\t<svg\n\t\t*ngIf=\"isInvalidText\"\n\t\tcdsIcon=\"warning--filled\"\n\t\tclass=\"cds--file--invalid\"\n\t\tsize=\"16\">\n\t</svg>\n\t<ng-template\n\t\t*ngIf=\"isTemplate(actionsTpl); else defaultActions\"\n\t\t[ngTemplateOutlet]=\"actionsTpl\">\n\t</ng-template>\n\t<ng-template #defaultActions>\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tcdsButton=\"ghost\"\n\t\t\ticonOnly=\"true\"\n\t\t\t[size]=\"size\"\n\t\t\t[attr.aria-label]=\"translations.REMOVE_BUTTON\"\n\t\t\t(click)=\"remove.emit()\"\n\t\t\t(keyup.enter)=\"remove.emit()\"\n\t\t\t(keyup.space)=\"remove.emit()\">\n\t\t\t<svg cdsIcon=\"trash-can\" size=\"16\"></svg>\n\t\t</button>\n\t</ng-template>\n</span>\n<span *ngIf=\"fileItem.state === 'upload'\">\n\t<div class=\"cds--inline-loading__animation\">\n\t\t<cds-loading size=\"sm\"></cds-loading>\n\t</div>\n</span>\n<span\n\t*ngIf=\"fileItem.state === 'complete'\"\n\tclass=\"cds--file__state-container\">\n\t<svg\n\t\tcdsIcon=\"checkmark--filled\"\n\t\tsize=\"16\"\n\t\tclass=\"cds--file-complete\"\n\t\t[ariaLabel]=\"translations.CHECKMARK\">\n\t</svg>\n</span>\n<div\n\tclass=\"cds--form-requirement\"\n\trole=\"alert\"\n\t*ngIf=\"fileItem.invalid\">\n\t<div class=\"cds--form-requirement__title\">\n\t\t{{ fileItem.invalidTitle }}\n\t</div>\n\t<p class=\"cds--form-requirement__supplement\">\n\t\t{{ fileItem.invalidText }}\n\t</p>\n</div>\n\t",
|
|
32320
|
+
"template": "<p class=\"cds--file-filename\" [title]=\"fileItem.file.name\">\n\t<ng-template\n\t\t*ngIf=\"isTemplate(nameTpl); else defaultName\"\n\t\t[ngTemplateOutlet]=\"nameTpl\"\n\t\t[ngTemplateOutletContext]=\"{ $implicit: fileItem }\">\n\t</ng-template>\n\t<ng-template #defaultName>{{ fileItem.file.name }}</ng-template>\n</p>\n<span *ngIf=\"fileItem.state === 'edit'\" class=\"cds--file__state-container\">\n\t<svg\n\t\t*ngIf=\"isInvalidText\"\n\t\tcdsIcon=\"warning--filled\"\n\t\tclass=\"cds--file--invalid\"\n\t\tsize=\"16\">\n\t</svg>\n\t<ng-template\n\t\t*ngIf=\"isTemplate(actionsTpl); else defaultActions\"\n\t\t[ngTemplateOutlet]=\"actionsTpl\"\n\t\t[ngTemplateOutletContext]=\"{ $implicit: fileItem }\">\n\t</ng-template>\n\t<ng-template #defaultActions>\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tcdsButton=\"ghost\"\n\t\t\ticonOnly=\"true\"\n\t\t\t[size]=\"size\"\n\t\t\t[attr.aria-label]=\"translations.REMOVE_BUTTON\"\n\t\t\t(click)=\"remove.emit()\"\n\t\t\t(keyup.enter)=\"remove.emit()\"\n\t\t\t(keyup.space)=\"remove.emit()\">\n\t\t\t<svg cdsIcon=\"trash-can\" size=\"16\"></svg>\n\t\t</button>\n\t</ng-template>\n</span>\n<span *ngIf=\"fileItem.state === 'upload'\">\n\t<div class=\"cds--inline-loading__animation\">\n\t\t<cds-loading size=\"sm\"></cds-loading>\n\t</div>\n</span>\n<span\n\t*ngIf=\"fileItem.state === 'complete'\"\n\tclass=\"cds--file__state-container\">\n\t<svg\n\t\tcdsIcon=\"checkmark--filled\"\n\t\tsize=\"16\"\n\t\tclass=\"cds--file-complete\"\n\t\t[ariaLabel]=\"translations.CHECKMARK\">\n\t</svg>\n</span>\n<div\n\tclass=\"cds--form-requirement\"\n\trole=\"alert\"\n\t*ngIf=\"fileItem.invalid\">\n\t<div class=\"cds--form-requirement__title\">\n\t\t{{ fileItem.invalidTitle }}\n\t</div>\n\t<p class=\"cds--form-requirement__supplement\">\n\t\t{{ fileItem.invalidText }}\n\t</p>\n</div>\n\t",
|
|
32321
32321
|
"templateUrl": [],
|
|
32322
32322
|
"viewProviders": [],
|
|
32323
32323
|
"hostDirectives": [],
|
|
@@ -32328,7 +32328,7 @@
|
|
|
32328
32328
|
"deprecationMessage": "",
|
|
32329
32329
|
"rawdescription": "\n\nA custom template for the available file actions\n",
|
|
32330
32330
|
"description": "<p>A custom template for the available file actions</p>\n",
|
|
32331
|
-
"line":
|
|
32331
|
+
"line": 99,
|
|
32332
32332
|
"type": "TemplateRef<>",
|
|
32333
32333
|
"decorators": []
|
|
32334
32334
|
},
|
|
@@ -32338,7 +32338,7 @@
|
|
|
32338
32338
|
"deprecationMessage": "",
|
|
32339
32339
|
"rawdescription": "\n\nA single `FileItem` from the set of `FileItem`s\n",
|
|
32340
32340
|
"description": "<p>A single <code>FileItem</code> from the set of <code>FileItem</code>s</p>\n",
|
|
32341
|
-
"line":
|
|
32341
|
+
"line": 87,
|
|
32342
32342
|
"type": "FileItem",
|
|
32343
32343
|
"decorators": []
|
|
32344
32344
|
},
|
|
@@ -32348,7 +32348,7 @@
|
|
|
32348
32348
|
"deprecationMessage": "",
|
|
32349
32349
|
"rawdescription": "\n\nA custom template for the file name\n",
|
|
32350
32350
|
"description": "<p>A custom template for the file name</p>\n",
|
|
32351
|
-
"line":
|
|
32351
|
+
"line": 94,
|
|
32352
32352
|
"type": "TemplateRef<>",
|
|
32353
32353
|
"decorators": []
|
|
32354
32354
|
},
|
|
@@ -32357,7 +32357,7 @@
|
|
|
32357
32357
|
"defaultValue": "\"lg\"",
|
|
32358
32358
|
"deprecated": false,
|
|
32359
32359
|
"deprecationMessage": "",
|
|
32360
|
-
"line":
|
|
32360
|
+
"line": 89,
|
|
32361
32361
|
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
32362
32362
|
"decorators": []
|
|
32363
32363
|
},
|
|
@@ -32368,7 +32368,7 @@
|
|
|
32368
32368
|
"deprecationMessage": "",
|
|
32369
32369
|
"rawdescription": "\n\nAccessible translations for the close and complete icons\n",
|
|
32370
32370
|
"description": "<p>Accessible translations for the close and complete icons</p>\n",
|
|
32371
|
-
"line":
|
|
32371
|
+
"line": 83,
|
|
32372
32372
|
"type": "any",
|
|
32373
32373
|
"decorators": []
|
|
32374
32374
|
}
|
|
@@ -32379,7 +32379,7 @@
|
|
|
32379
32379
|
"defaultValue": "new EventEmitter()",
|
|
32380
32380
|
"deprecated": false,
|
|
32381
32381
|
"deprecationMessage": "",
|
|
32382
|
-
"line":
|
|
32382
|
+
"line": 101,
|
|
32383
32383
|
"type": "EventEmitter"
|
|
32384
32384
|
}
|
|
32385
32385
|
],
|
|
@@ -32392,7 +32392,7 @@
|
|
|
32392
32392
|
"type": "",
|
|
32393
32393
|
"optional": false,
|
|
32394
32394
|
"description": "",
|
|
32395
|
-
"line":
|
|
32395
|
+
"line": 103,
|
|
32396
32396
|
"decorators": [
|
|
32397
32397
|
{
|
|
32398
32398
|
"name": "HostBinding",
|
|
@@ -32418,7 +32418,7 @@
|
|
|
32418
32418
|
"optional": false,
|
|
32419
32419
|
"returnType": "boolean",
|
|
32420
32420
|
"typeParameters": [],
|
|
32421
|
-
"line":
|
|
32421
|
+
"line": 123,
|
|
32422
32422
|
"deprecated": false,
|
|
32423
32423
|
"deprecationMessage": "",
|
|
32424
32424
|
"modifierKind": [
|
|
@@ -32445,7 +32445,7 @@
|
|
|
32445
32445
|
"defaultValue": "true",
|
|
32446
32446
|
"deprecated": false,
|
|
32447
32447
|
"deprecationMessage": "",
|
|
32448
|
-
"line":
|
|
32448
|
+
"line": 103,
|
|
32449
32449
|
"type": "boolean",
|
|
32450
32450
|
"decorators": []
|
|
32451
32451
|
},
|
|
@@ -32453,7 +32453,7 @@
|
|
|
32453
32453
|
"name": "class.cds--file__selected-file--invalid",
|
|
32454
32454
|
"deprecated": false,
|
|
32455
32455
|
"deprecationMessage": "",
|
|
32456
|
-
"line":
|
|
32456
|
+
"line": 105,
|
|
32457
32457
|
"type": "any",
|
|
32458
32458
|
"decorators": []
|
|
32459
32459
|
},
|
|
@@ -32461,7 +32461,7 @@
|
|
|
32461
32461
|
"name": "class.cds--file__selected-file--lg",
|
|
32462
32462
|
"deprecated": false,
|
|
32463
32463
|
"deprecationMessage": "",
|
|
32464
|
-
"line":
|
|
32464
|
+
"line": 117,
|
|
32465
32465
|
"type": "boolean",
|
|
32466
32466
|
"decorators": []
|
|
32467
32467
|
},
|
|
@@ -32469,7 +32469,7 @@
|
|
|
32469
32469
|
"name": "class.cds--file__selected-file--md",
|
|
32470
32470
|
"deprecated": false,
|
|
32471
32471
|
"deprecationMessage": "",
|
|
32472
|
-
"line":
|
|
32472
|
+
"line": 113,
|
|
32473
32473
|
"type": "boolean",
|
|
32474
32474
|
"decorators": []
|
|
32475
32475
|
},
|
|
@@ -32477,7 +32477,7 @@
|
|
|
32477
32477
|
"name": "class.cds--file__selected-file--sm",
|
|
32478
32478
|
"deprecated": false,
|
|
32479
32479
|
"deprecationMessage": "",
|
|
32480
|
-
"line":
|
|
32480
|
+
"line": 109,
|
|
32481
32481
|
"type": "boolean",
|
|
32482
32482
|
"decorators": []
|
|
32483
32483
|
}
|
|
@@ -32488,7 +32488,7 @@
|
|
|
32488
32488
|
"description": "",
|
|
32489
32489
|
"rawdescription": "\n",
|
|
32490
32490
|
"type": "component",
|
|
32491
|
-
"sourceCode": "import {\n\tComponent,\n\tEventEmitter,\n\tHostBinding,\n\tInput,\n\tOnDestroy,\n\tOutput,\n\tTemplateRef\n} from \"@angular/core\";\n\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { FileItem } from \"./file-item.interface\";\n\n@Component({\n\tselector: \"cds-file, ibm-file\",\n\ttemplate: `\n\t\t<p class=\"cds--file-filename\" [title]=\"fileItem.file.name\">\n\t\t\t<ng-template\n\t\t\t\t*ngIf=\"isTemplate(nameTpl); else defaultName\"\n\t\t\t\t[ngTemplateOutlet]=\"nameTpl\"\n\t\t\t\t[ngTemplateOutletContext]=\"{ $implicit: fileItem }\">\n\t\t\t</ng-template>\n\t\t\t<ng-template #defaultName>{{ fileItem.file.name }}</ng-template>\n\t\t</p>\n\t\t<span *ngIf=\"fileItem.state === 'edit'\" class=\"cds--file__state-container\">\n\t\t\t<svg\n\t\t\t\t*ngIf=\"isInvalidText\"\n\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\tclass=\"cds--file--invalid\"\n\t\t\t\tsize=\"16\">\n\t\t\t</svg>\n\t\t\t<ng-template\n\t\t\t\t*ngIf=\"isTemplate(actionsTpl); else defaultActions\"\n\t\t\t\t[ngTemplateOutlet]=\"actionsTpl\">\n\t\t\t</ng-template>\n\t\t\t<ng-template #defaultActions>\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tcdsButton=\"ghost\"\n\t\t\t\t\ticonOnly=\"true\"\n\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t[attr.aria-label]=\"translations.REMOVE_BUTTON\"\n\t\t\t\t\t(click)=\"remove.emit()\"\n\t\t\t\t\t(keyup.enter)=\"remove.emit()\"\n\t\t\t\t\t(keyup.space)=\"remove.emit()\">\n\t\t\t\t\t<svg cdsIcon=\"trash-can\" size=\"16\"></svg>\n\t\t\t\t</button>\n\t\t\t</ng-template>\n\t\t</span>\n\t\t<span *ngIf=\"fileItem.state === 'upload'\">\n\t\t\t<div class=\"cds--inline-loading__animation\">\n\t\t\t\t<cds-loading size=\"sm\"></cds-loading>\n\t\t\t</div>\n\t\t</span>\n\t\t<span\n\t\t\t*ngIf=\"fileItem.state === 'complete'\"\n\t\t\tclass=\"cds--file__state-container\">\n\t\t\t<svg\n\t\t\t\tcdsIcon=\"checkmark--filled\"\n\t\t\t\tsize=\"16\"\n\t\t\t\tclass=\"cds--file-complete\"\n\t\t\t\t[ariaLabel]=\"translations.CHECKMARK\">\n\t\t\t</svg>\n\t\t</span>\n\t\t<div\n\t\t\tclass=\"cds--form-requirement\"\n\t\t\trole=\"alert\"\n\t\t\t*ngIf=\"fileItem.invalid\">\n\t\t\t<div class=\"cds--form-requirement__title\">\n\t\t\t\t{{ fileItem.invalidTitle }}\n\t\t\t</div>\n\t\t\t<p class=\"cds--form-requirement__supplement\">\n\t\t\t\t{{ fileItem.invalidText }}\n\t\t\t</p>\n\t\t</div>\n\t`\n})\nexport class FileComponent implements OnDestroy {\n\t/**\n\t * Accessible translations for the close and complete icons\n\t */\n\t@Input() translations = this.i18n.get().FILE_UPLOADER;\n\t/**\n\t * A single `FileItem` from the set of `FileItem`s\n\t */\n\t@Input() fileItem: FileItem;\n\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"lg\";\n\n\t/**\n\t * A custom template for the file name\n\t */\n\t@Input() nameTpl: TemplateRef<unknown>;\n\n\t/**\n\t * A custom template for the available file actions\n\t */\n\t@Input() actionsTpl: TemplateRef<unknown>;\n\n\t@Output() remove = new EventEmitter();\n\n\t@HostBinding(\"class.cds--file__selected-file\") selectedFile = true;\n\n\t@HostBinding(\"class.cds--file__selected-file--invalid\") get isInvalidText() {\n\t\treturn this.fileItem.invalidText;\n\t}\n\n\t@HostBinding(\"class.cds--file__selected-file--sm\") get fileSizeSmall() {\n\t\treturn this.size === \"sm\";\n\t}\n\n\t@HostBinding(\"class.cds--file__selected-file--md\") get fileSizeMedium() {\n\t\treturn this.size === \"md\";\n\t}\n\n\t@HostBinding(\"class.cds--file__selected-file--lg\") get fileSizeLarge() {\n\t\treturn this.size === \"lg\";\n\t}\n\n\tconstructor(protected i18n: I18n) {}\n\n\tpublic isTemplate(value: unknown): boolean {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\tngOnDestroy() {\n\t\tthis.remove.emit();\n\t}\n}\n",
|
|
32491
|
+
"sourceCode": "import {\n\tComponent,\n\tEventEmitter,\n\tHostBinding,\n\tInput,\n\tOnDestroy,\n\tOutput,\n\tTemplateRef\n} from \"@angular/core\";\n\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { FileItem } from \"./file-item.interface\";\n\n@Component({\n\tselector: \"cds-file, ibm-file\",\n\ttemplate: `\n\t\t<p class=\"cds--file-filename\" [title]=\"fileItem.file.name\">\n\t\t\t<ng-template\n\t\t\t\t*ngIf=\"isTemplate(nameTpl); else defaultName\"\n\t\t\t\t[ngTemplateOutlet]=\"nameTpl\"\n\t\t\t\t[ngTemplateOutletContext]=\"{ $implicit: fileItem }\">\n\t\t\t</ng-template>\n\t\t\t<ng-template #defaultName>{{ fileItem.file.name }}</ng-template>\n\t\t</p>\n\t\t<span *ngIf=\"fileItem.state === 'edit'\" class=\"cds--file__state-container\">\n\t\t\t<svg\n\t\t\t\t*ngIf=\"isInvalidText\"\n\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\tclass=\"cds--file--invalid\"\n\t\t\t\tsize=\"16\">\n\t\t\t</svg>\n\t\t\t<ng-template\n\t\t\t\t*ngIf=\"isTemplate(actionsTpl); else defaultActions\"\n\t\t\t\t[ngTemplateOutlet]=\"actionsTpl\"\n\t\t\t\t[ngTemplateOutletContext]=\"{ $implicit: fileItem }\">\n\t\t\t</ng-template>\n\t\t\t<ng-template #defaultActions>\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tcdsButton=\"ghost\"\n\t\t\t\t\ticonOnly=\"true\"\n\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t[attr.aria-label]=\"translations.REMOVE_BUTTON\"\n\t\t\t\t\t(click)=\"remove.emit()\"\n\t\t\t\t\t(keyup.enter)=\"remove.emit()\"\n\t\t\t\t\t(keyup.space)=\"remove.emit()\">\n\t\t\t\t\t<svg cdsIcon=\"trash-can\" size=\"16\"></svg>\n\t\t\t\t</button>\n\t\t\t</ng-template>\n\t\t</span>\n\t\t<span *ngIf=\"fileItem.state === 'upload'\">\n\t\t\t<div class=\"cds--inline-loading__animation\">\n\t\t\t\t<cds-loading size=\"sm\"></cds-loading>\n\t\t\t</div>\n\t\t</span>\n\t\t<span\n\t\t\t*ngIf=\"fileItem.state === 'complete'\"\n\t\t\tclass=\"cds--file__state-container\">\n\t\t\t<svg\n\t\t\t\tcdsIcon=\"checkmark--filled\"\n\t\t\t\tsize=\"16\"\n\t\t\t\tclass=\"cds--file-complete\"\n\t\t\t\t[ariaLabel]=\"translations.CHECKMARK\">\n\t\t\t</svg>\n\t\t</span>\n\t\t<div\n\t\t\tclass=\"cds--form-requirement\"\n\t\t\trole=\"alert\"\n\t\t\t*ngIf=\"fileItem.invalid\">\n\t\t\t<div class=\"cds--form-requirement__title\">\n\t\t\t\t{{ fileItem.invalidTitle }}\n\t\t\t</div>\n\t\t\t<p class=\"cds--form-requirement__supplement\">\n\t\t\t\t{{ fileItem.invalidText }}\n\t\t\t</p>\n\t\t</div>\n\t`\n})\nexport class FileComponent implements OnDestroy {\n\t/**\n\t * Accessible translations for the close and complete icons\n\t */\n\t@Input() translations = this.i18n.get().FILE_UPLOADER;\n\t/**\n\t * A single `FileItem` from the set of `FileItem`s\n\t */\n\t@Input() fileItem: FileItem;\n\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"lg\";\n\n\t/**\n\t * A custom template for the file name\n\t */\n\t@Input() nameTpl: TemplateRef<unknown>;\n\n\t/**\n\t * A custom template for the available file actions\n\t */\n\t@Input() actionsTpl: TemplateRef<unknown>;\n\n\t@Output() remove = new EventEmitter();\n\n\t@HostBinding(\"class.cds--file__selected-file\") selectedFile = true;\n\n\t@HostBinding(\"class.cds--file__selected-file--invalid\") get isInvalidText() {\n\t\treturn this.fileItem.invalidText;\n\t}\n\n\t@HostBinding(\"class.cds--file__selected-file--sm\") get fileSizeSmall() {\n\t\treturn this.size === \"sm\";\n\t}\n\n\t@HostBinding(\"class.cds--file__selected-file--md\") get fileSizeMedium() {\n\t\treturn this.size === \"md\";\n\t}\n\n\t@HostBinding(\"class.cds--file__selected-file--lg\") get fileSizeLarge() {\n\t\treturn this.size === \"lg\";\n\t}\n\n\tconstructor(protected i18n: I18n) {}\n\n\tpublic isTemplate(value: unknown): boolean {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\tngOnDestroy() {\n\t\tthis.remove.emit();\n\t}\n}\n",
|
|
32492
32492
|
"assetsDirs": [],
|
|
32493
32493
|
"styleUrlsData": "",
|
|
32494
32494
|
"stylesData": "",
|
|
@@ -32505,7 +32505,7 @@
|
|
|
32505
32505
|
"deprecationMessage": ""
|
|
32506
32506
|
}
|
|
32507
32507
|
],
|
|
32508
|
-
"line":
|
|
32508
|
+
"line": 119,
|
|
32509
32509
|
"jsdoctags": [
|
|
32510
32510
|
{
|
|
32511
32511
|
"name": "i18n",
|
|
@@ -32529,7 +32529,7 @@
|
|
|
32529
32529
|
"name": "isInvalidText",
|
|
32530
32530
|
"type": "",
|
|
32531
32531
|
"returnType": "",
|
|
32532
|
-
"line":
|
|
32532
|
+
"line": 105
|
|
32533
32533
|
}
|
|
32534
32534
|
},
|
|
32535
32535
|
"fileSizeSmall": {
|
|
@@ -32538,7 +32538,7 @@
|
|
|
32538
32538
|
"name": "fileSizeSmall",
|
|
32539
32539
|
"type": "",
|
|
32540
32540
|
"returnType": "",
|
|
32541
|
-
"line":
|
|
32541
|
+
"line": 109
|
|
32542
32542
|
}
|
|
32543
32543
|
},
|
|
32544
32544
|
"fileSizeMedium": {
|
|
@@ -32547,7 +32547,7 @@
|
|
|
32547
32547
|
"name": "fileSizeMedium",
|
|
32548
32548
|
"type": "",
|
|
32549
32549
|
"returnType": "",
|
|
32550
|
-
"line":
|
|
32550
|
+
"line": 113
|
|
32551
32551
|
}
|
|
32552
32552
|
},
|
|
32553
32553
|
"fileSizeLarge": {
|
|
@@ -32556,7 +32556,7 @@
|
|
|
32556
32556
|
"name": "fileSizeLarge",
|
|
32557
32557
|
"type": "",
|
|
32558
32558
|
"returnType": "",
|
|
32559
|
-
"line":
|
|
32559
|
+
"line": 117
|
|
32560
32560
|
}
|
|
32561
32561
|
}
|
|
32562
32562
|
}
|
|
@@ -33377,7 +33377,7 @@
|
|
|
33377
33377
|
},
|
|
33378
33378
|
{
|
|
33379
33379
|
"name": "FileUploaderWithCustomFileStory",
|
|
33380
|
-
"id": "component-FileUploaderWithCustomFileStory-
|
|
33380
|
+
"id": "component-FileUploaderWithCustomFileStory-0847324b80e43514c99f8d3049887fd5a8bab42e124aa234f95fb03e851093db1cfe78bce857276e36f3abc13f15e0f9488b20345b9ba859884e165ab9389f39",
|
|
33381
33381
|
"file": "src/file-uploader/stories/uploader-custom-file.component.ts",
|
|
33382
33382
|
"encapsulation": [],
|
|
33383
33383
|
"entryComponents": [],
|
|
@@ -33387,7 +33387,7 @@
|
|
|
33387
33387
|
"selector": "app-file-uploader-with-custom-file",
|
|
33388
33388
|
"styleUrls": [],
|
|
33389
33389
|
"styles": [],
|
|
33390
|
-
"template": "<cds-file-uploader\n\t[title]=\"title\"\n\t[description]=\"description\"\n\t[buttonText]=\"buttonText\"\n\t[buttonType]=\"buttonType\"\n\t[accept]=\"accept\"\n\t[multiple]=\"multiple\"\n\t[skeleton]=\"skeleton\"\n\t[(files)]=\"files\"\n\t[size]=\"size\"\n\t[fileItemSize]=\"fileItemSize\"\n\t[disabled]=\"disabled\"\n\t[fileNameTpl]=\"nameTpl\"\n\t[fileActionsTpl]=\"actionsTpl\">\n</cds-file-uploader>\n<button\n\tcdsButton\n\t*ngIf=\"files && files.size > 0\"\n\t(click)=\"onUpload()\"\n\tstyle=\"margin-top:20px\">\n\tUpload\n</button>\n\n<ng-template #nameTpl let-fileItem>\n\t<a href=\"#\" cdsLink>{{ fileItem.file.name }}</a>\n</ng-template>\n\n<ng-template #actionsTpl>\n\t<button\n\t\tibmButton=\"ghost\"\n\t\ticonOnly=\"true\"\n\t\taria-label=\"View\"\n\t\t[size]=\"fileItemSize\">\n\t\t<svg ibmIcon=\"view\" size=\"16\"></svg>\n\t</button>\n\t<button\n\t\tibmButton=\"ghost\"\n\t\ticonOnly=\"true\"\n\t\taria-label=\"Download\"\n\t\t[size]=\"fileItemSize\">\n\t\t<svg ibmIcon=\"download\" size=\"16\"></svg>\n\t</button>\n</ng-template>\n\t",
|
|
33390
|
+
"template": "<p *ngIf=\"lastViewedFile\">Last viewed file: {{ lastViewedFile | json }}</p>\n<p *ngIf=\"lastDownloadedFile\">Last downloaded file: {{ lastDownloadedFile | json }}</p>\n<cds-file-uploader\n\t[title]=\"title\"\n\t[description]=\"description\"\n\t[buttonText]=\"buttonText\"\n\t[buttonType]=\"buttonType\"\n\t[accept]=\"accept\"\n\t[multiple]=\"multiple\"\n\t[skeleton]=\"skeleton\"\n\t[(files)]=\"files\"\n\t[size]=\"size\"\n\t[fileItemSize]=\"fileItemSize\"\n\t[disabled]=\"disabled\"\n\t[fileNameTpl]=\"nameTpl\"\n\t[fileActionsTpl]=\"actionsTpl\">\n</cds-file-uploader>\n<button\n\tcdsButton\n\t*ngIf=\"files && files.size > 0\"\n\t(click)=\"onUpload()\"\n\tstyle=\"margin-top:20px\">\n\tUpload\n</button>\n\n<ng-template #nameTpl let-fileItem>\n\t<a href=\"#\" cdsLink>{{ fileItem.file.name }}</a>\n</ng-template>\n\n<ng-template #actionsTpl let-fileItem>\n\t<button\n\t\tibmButton=\"ghost\"\n\t\ticonOnly=\"true\"\n\t\taria-label=\"View\"\n\t\t[size]=\"fileItemSize\"\n\t\t(click)=\"onViewClick(fileItem)\">\n\t\t<svg ibmIcon=\"view\" size=\"16\"></svg>\n\t</button>\n\t<button\n\t\tibmButton=\"ghost\"\n\t\ticonOnly=\"true\"\n\t\taria-label=\"Download\"\n\t\t[size]=\"fileItemSize\"\n\t\t(click)=\"onDownloadClick(fileItem)\">\n\t\t<svg ibmIcon=\"download\" size=\"16\"></svg>\n\t</button>\n</ng-template>\n\t",
|
|
33391
33391
|
"templateUrl": [],
|
|
33392
33392
|
"viewProviders": [],
|
|
33393
33393
|
"hostDirectives": [],
|
|
@@ -33397,7 +33397,7 @@
|
|
|
33397
33397
|
"defaultValue": "[\".jpg\", \".png\"]",
|
|
33398
33398
|
"deprecated": false,
|
|
33399
33399
|
"deprecationMessage": "",
|
|
33400
|
-
"line":
|
|
33400
|
+
"line": 66,
|
|
33401
33401
|
"type": "{}",
|
|
33402
33402
|
"decorators": []
|
|
33403
33403
|
},
|
|
@@ -33405,7 +33405,7 @@
|
|
|
33405
33405
|
"name": "buttonText",
|
|
33406
33406
|
"deprecated": false,
|
|
33407
33407
|
"deprecationMessage": "",
|
|
33408
|
-
"line":
|
|
33408
|
+
"line": 64,
|
|
33409
33409
|
"type": "any",
|
|
33410
33410
|
"decorators": []
|
|
33411
33411
|
},
|
|
@@ -33414,7 +33414,7 @@
|
|
|
33414
33414
|
"defaultValue": "\"primary\"",
|
|
33415
33415
|
"deprecated": false,
|
|
33416
33416
|
"deprecationMessage": "",
|
|
33417
|
-
"line":
|
|
33417
|
+
"line": 65,
|
|
33418
33418
|
"type": "string",
|
|
33419
33419
|
"decorators": []
|
|
33420
33420
|
},
|
|
@@ -33422,7 +33422,7 @@
|
|
|
33422
33422
|
"name": "description",
|
|
33423
33423
|
"deprecated": false,
|
|
33424
33424
|
"deprecationMessage": "",
|
|
33425
|
-
"line":
|
|
33425
|
+
"line": 63,
|
|
33426
33426
|
"type": "any",
|
|
33427
33427
|
"decorators": []
|
|
33428
33428
|
},
|
|
@@ -33431,7 +33431,7 @@
|
|
|
33431
33431
|
"defaultValue": "false",
|
|
33432
33432
|
"deprecated": false,
|
|
33433
33433
|
"deprecationMessage": "",
|
|
33434
|
-
"line":
|
|
33434
|
+
"line": 70,
|
|
33435
33435
|
"type": "boolean",
|
|
33436
33436
|
"decorators": []
|
|
33437
33437
|
},
|
|
@@ -33440,7 +33440,7 @@
|
|
|
33440
33440
|
"defaultValue": "\"lg\"",
|
|
33441
33441
|
"deprecated": false,
|
|
33442
33442
|
"deprecationMessage": "",
|
|
33443
|
-
"line":
|
|
33443
|
+
"line": 71,
|
|
33444
33444
|
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
33445
33445
|
"decorators": []
|
|
33446
33446
|
},
|
|
@@ -33449,7 +33449,7 @@
|
|
|
33449
33449
|
"defaultValue": "new Set<FileItem>()",
|
|
33450
33450
|
"deprecated": false,
|
|
33451
33451
|
"deprecationMessage": "",
|
|
33452
|
-
"line":
|
|
33452
|
+
"line": 61,
|
|
33453
33453
|
"type": "any",
|
|
33454
33454
|
"decorators": []
|
|
33455
33455
|
},
|
|
@@ -33457,7 +33457,7 @@
|
|
|
33457
33457
|
"name": "multiple",
|
|
33458
33458
|
"deprecated": false,
|
|
33459
33459
|
"deprecationMessage": "",
|
|
33460
|
-
"line":
|
|
33460
|
+
"line": 67,
|
|
33461
33461
|
"type": "any",
|
|
33462
33462
|
"decorators": []
|
|
33463
33463
|
},
|
|
@@ -33466,7 +33466,7 @@
|
|
|
33466
33466
|
"defaultValue": "\"md\"",
|
|
33467
33467
|
"deprecated": false,
|
|
33468
33468
|
"deprecationMessage": "",
|
|
33469
|
-
"line":
|
|
33469
|
+
"line": 69,
|
|
33470
33470
|
"type": "string",
|
|
33471
33471
|
"decorators": []
|
|
33472
33472
|
},
|
|
@@ -33475,7 +33475,7 @@
|
|
|
33475
33475
|
"defaultValue": "false",
|
|
33476
33476
|
"deprecated": false,
|
|
33477
33477
|
"deprecationMessage": "",
|
|
33478
|
-
"line":
|
|
33478
|
+
"line": 68,
|
|
33479
33479
|
"type": "boolean",
|
|
33480
33480
|
"decorators": []
|
|
33481
33481
|
},
|
|
@@ -33483,23 +33483,100 @@
|
|
|
33483
33483
|
"name": "title",
|
|
33484
33484
|
"deprecated": false,
|
|
33485
33485
|
"deprecationMessage": "",
|
|
33486
|
-
"line":
|
|
33486
|
+
"line": 62,
|
|
33487
33487
|
"type": "any",
|
|
33488
33488
|
"decorators": []
|
|
33489
33489
|
}
|
|
33490
33490
|
],
|
|
33491
33491
|
"outputsClass": [],
|
|
33492
|
-
"propertiesClass": [
|
|
33492
|
+
"propertiesClass": [
|
|
33493
|
+
{
|
|
33494
|
+
"name": "lastDownloadedFile",
|
|
33495
|
+
"defaultValue": "null",
|
|
33496
|
+
"deprecated": false,
|
|
33497
|
+
"deprecationMessage": "",
|
|
33498
|
+
"type": "FileItem | null",
|
|
33499
|
+
"optional": false,
|
|
33500
|
+
"description": "",
|
|
33501
|
+
"line": 59
|
|
33502
|
+
},
|
|
33503
|
+
{
|
|
33504
|
+
"name": "lastViewedFile",
|
|
33505
|
+
"defaultValue": "null",
|
|
33506
|
+
"deprecated": false,
|
|
33507
|
+
"deprecationMessage": "",
|
|
33508
|
+
"type": "FileItem | null",
|
|
33509
|
+
"optional": false,
|
|
33510
|
+
"description": "",
|
|
33511
|
+
"line": 58
|
|
33512
|
+
}
|
|
33513
|
+
],
|
|
33493
33514
|
"methodsClass": [
|
|
33515
|
+
{
|
|
33516
|
+
"name": "onDownloadClick",
|
|
33517
|
+
"args": [
|
|
33518
|
+
{
|
|
33519
|
+
"name": "file",
|
|
33520
|
+
"type": "FileItem",
|
|
33521
|
+
"deprecated": false,
|
|
33522
|
+
"deprecationMessage": ""
|
|
33523
|
+
}
|
|
33524
|
+
],
|
|
33525
|
+
"optional": false,
|
|
33526
|
+
"returnType": "void",
|
|
33527
|
+
"typeParameters": [],
|
|
33528
|
+
"line": 79,
|
|
33529
|
+
"deprecated": false,
|
|
33530
|
+
"deprecationMessage": "",
|
|
33531
|
+
"jsdoctags": [
|
|
33532
|
+
{
|
|
33533
|
+
"name": "file",
|
|
33534
|
+
"type": "FileItem",
|
|
33535
|
+
"deprecated": false,
|
|
33536
|
+
"deprecationMessage": "",
|
|
33537
|
+
"tagName": {
|
|
33538
|
+
"text": "param"
|
|
33539
|
+
}
|
|
33540
|
+
}
|
|
33541
|
+
]
|
|
33542
|
+
},
|
|
33494
33543
|
{
|
|
33495
33544
|
"name": "onUpload",
|
|
33496
33545
|
"args": [],
|
|
33497
33546
|
"optional": false,
|
|
33498
33547
|
"returnType": "void",
|
|
33499
33548
|
"typeParameters": [],
|
|
33500
|
-
"line":
|
|
33549
|
+
"line": 83,
|
|
33501
33550
|
"deprecated": false,
|
|
33502
33551
|
"deprecationMessage": ""
|
|
33552
|
+
},
|
|
33553
|
+
{
|
|
33554
|
+
"name": "onViewClick",
|
|
33555
|
+
"args": [
|
|
33556
|
+
{
|
|
33557
|
+
"name": "file",
|
|
33558
|
+
"type": "FileItem",
|
|
33559
|
+
"deprecated": false,
|
|
33560
|
+
"deprecationMessage": ""
|
|
33561
|
+
}
|
|
33562
|
+
],
|
|
33563
|
+
"optional": false,
|
|
33564
|
+
"returnType": "void",
|
|
33565
|
+
"typeParameters": [],
|
|
33566
|
+
"line": 75,
|
|
33567
|
+
"deprecated": false,
|
|
33568
|
+
"deprecationMessage": "",
|
|
33569
|
+
"jsdoctags": [
|
|
33570
|
+
{
|
|
33571
|
+
"name": "file",
|
|
33572
|
+
"type": "FileItem",
|
|
33573
|
+
"deprecated": false,
|
|
33574
|
+
"deprecationMessage": "",
|
|
33575
|
+
"tagName": {
|
|
33576
|
+
"text": "param"
|
|
33577
|
+
}
|
|
33578
|
+
}
|
|
33579
|
+
]
|
|
33503
33580
|
}
|
|
33504
33581
|
],
|
|
33505
33582
|
"deprecated": false,
|
|
@@ -33511,7 +33588,7 @@
|
|
|
33511
33588
|
"description": "",
|
|
33512
33589
|
"rawdescription": "\n",
|
|
33513
33590
|
"type": "component",
|
|
33514
|
-
"sourceCode": "import { Component, Input } from \"@angular/core\";\n\nimport { FileItem } from \"../\";\n\n@Component({\n\tselector: \"app-file-uploader-with-custom-file\",\n\ttemplate: `\n\t\t<cds-file-uploader\n\t\t\t[title]=\"title\"\n\t\t\t[description]=\"description\"\n\t\t\t[buttonText]=\"buttonText\"\n\t\t\t[buttonType]=\"buttonType\"\n\t\t\t[accept]=\"accept\"\n\t\t\t[multiple]=\"multiple\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[(files)]=\"files\"\n\t\t\t[size]=\"size\"\n\t\t\t[fileItemSize]=\"fileItemSize\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[fileNameTpl]=\"nameTpl\"\n\t\t\t[fileActionsTpl]=\"actionsTpl\">\n\t\t</cds-file-uploader>\n\t\t<button\n\t\t\tcdsButton\n\t\t\t*ngIf=\"files && files.size > 0\"\n\t\t\t(click)=\"onUpload()\"\n\t\t\tstyle=\"margin-top:20px\">\n\t\t\tUpload\n\t\t</button>\n\n\t\t<ng-template #nameTpl let-fileItem>\n\t\t\t<a href=\"#\" cdsLink>{{ fileItem.file.name }}</a>\n\t\t</ng-template>\n\n\t\t<ng-template #actionsTpl>\n\t\t\t<button\n\t\t\t\tibmButton=\"ghost\"\n\t\t\t\ticonOnly=\"true\"\n\t\t\t\taria-label=\"View\"\n\t\t\t\t[size]=\"fileItemSize\">\n\t\t\t\t<svg ibmIcon=\"view\" size=\"16\"></svg>\n\t\t\t</button>\n\t\t\t<button\n\t\t\t\tibmButton=\"ghost\"\n\t\t\t\ticonOnly=\"true\"\n\t\t\t\taria-label=\"Download\"\n\t\t\t\t[size]=\"fileItemSize\">\n\t\t\t\t<svg ibmIcon=\"download\" size=\"16\"></svg>\n\t\t\t</button>\n\t\t</ng-template>\n\t`\n})\nexport class FileUploaderWithCustomFileStory {\n\t@Input() files = new Set<FileItem>();\n\t@Input() title;\n\t@Input() description;\n\t@Input() buttonText;\n\t@Input() buttonType = \"primary\";\n\t@Input() accept = [\".jpg\", \".png\"];\n\t@Input() multiple;\n\t@Input() skeleton = false;\n\t@Input() size = \"md\";\n\t@Input() disabled = false;\n\t@Input() fileItemSize: \"sm\" | \"md\" | \"lg\" = \"lg\";\n\n\tprotected maxSize = 500000;\n\n\tonUpload() {\n\t\tthis.files.forEach((fileItem) => {\n\t\t\tif (!fileItem.uploaded) {\n\t\t\t\tif (fileItem.file.size < this.maxSize) {\n\t\t\t\t\tfileItem.state = \"upload\";\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tfileItem.state = \"complete\";\n\t\t\t\t\t\tfileItem.uploaded = true;\n\t\t\t\t\t\tconsole.log(fileItem);\n\t\t\t\t\t}, 1500);\n\t\t\t\t}\n\n\t\t\t\tif (fileItem.file.size > this.maxSize) {\n\t\t\t\t\tfileItem.state = \"upload\";\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tfileItem.state = \"edit\";\n\t\t\t\t\t\tfileItem.invalid = true;\n\t\t\t\t\t\tfileItem.invalidTitle = \"File size exceeds limit\";\n\t\t\t\t\t\tfileItem.invalidText =\n\t\t\t\t\t\t\t\"500kb max file size. Select a new file and try again.\";\n\t\t\t\t\t}, 1500);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n",
|
|
33591
|
+
"sourceCode": "import { Component, Input } from \"@angular/core\";\n\nimport { FileItem } from \"../\";\n\n@Component({\n\tselector: \"app-file-uploader-with-custom-file\",\n\ttemplate: `\n\t\t<p *ngIf=\"lastViewedFile\">Last viewed file: {{ lastViewedFile | json }}</p>\n\t\t<p *ngIf=\"lastDownloadedFile\">Last downloaded file: {{ lastDownloadedFile | json }}</p>\n\t\t<cds-file-uploader\n\t\t\t[title]=\"title\"\n\t\t\t[description]=\"description\"\n\t\t\t[buttonText]=\"buttonText\"\n\t\t\t[buttonType]=\"buttonType\"\n\t\t\t[accept]=\"accept\"\n\t\t\t[multiple]=\"multiple\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[(files)]=\"files\"\n\t\t\t[size]=\"size\"\n\t\t\t[fileItemSize]=\"fileItemSize\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[fileNameTpl]=\"nameTpl\"\n\t\t\t[fileActionsTpl]=\"actionsTpl\">\n\t\t</cds-file-uploader>\n\t\t<button\n\t\t\tcdsButton\n\t\t\t*ngIf=\"files && files.size > 0\"\n\t\t\t(click)=\"onUpload()\"\n\t\t\tstyle=\"margin-top:20px\">\n\t\t\tUpload\n\t\t</button>\n\n\t\t<ng-template #nameTpl let-fileItem>\n\t\t\t<a href=\"#\" cdsLink>{{ fileItem.file.name }}</a>\n\t\t</ng-template>\n\n\t\t<ng-template #actionsTpl let-fileItem>\n\t\t\t<button\n\t\t\t\tibmButton=\"ghost\"\n\t\t\t\ticonOnly=\"true\"\n\t\t\t\taria-label=\"View\"\n\t\t\t\t[size]=\"fileItemSize\"\n\t\t\t\t(click)=\"onViewClick(fileItem)\">\n\t\t\t\t<svg ibmIcon=\"view\" size=\"16\"></svg>\n\t\t\t</button>\n\t\t\t<button\n\t\t\t\tibmButton=\"ghost\"\n\t\t\t\ticonOnly=\"true\"\n\t\t\t\taria-label=\"Download\"\n\t\t\t\t[size]=\"fileItemSize\"\n\t\t\t\t(click)=\"onDownloadClick(fileItem)\">\n\t\t\t\t<svg ibmIcon=\"download\" size=\"16\"></svg>\n\t\t\t</button>\n\t\t</ng-template>\n\t`\n})\nexport class FileUploaderWithCustomFileStory {\n\tlastViewedFile: FileItem | null = null;\n\tlastDownloadedFile: FileItem | null = null;\n\n\t@Input() files = new Set<FileItem>();\n\t@Input() title;\n\t@Input() description;\n\t@Input() buttonText;\n\t@Input() buttonType = \"primary\";\n\t@Input() accept = [\".jpg\", \".png\"];\n\t@Input() multiple;\n\t@Input() skeleton = false;\n\t@Input() size = \"md\";\n\t@Input() disabled = false;\n\t@Input() fileItemSize: \"sm\" | \"md\" | \"lg\" = \"lg\";\n\n\tprotected maxSize = 500000;\n\n\tonViewClick(file: FileItem) {\n\t\tthis.lastViewedFile = file;\n\t}\n\n\tonDownloadClick(file: FileItem) {\n\t\tthis.lastDownloadedFile = file;\n\t}\n\n\tonUpload() {\n\t\tthis.files.forEach((fileItem) => {\n\t\t\tif (!fileItem.uploaded) {\n\t\t\t\tif (fileItem.file.size < this.maxSize) {\n\t\t\t\t\tfileItem.state = \"upload\";\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tfileItem.state = \"complete\";\n\t\t\t\t\t\tfileItem.uploaded = true;\n\t\t\t\t\t\tconsole.log(fileItem);\n\t\t\t\t\t}, 1500);\n\t\t\t\t}\n\n\t\t\t\tif (fileItem.file.size > this.maxSize) {\n\t\t\t\t\tfileItem.state = \"upload\";\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tfileItem.state = \"edit\";\n\t\t\t\t\t\tfileItem.invalid = true;\n\t\t\t\t\t\tfileItem.invalidTitle = \"File size exceeds limit\";\n\t\t\t\t\t\tfileItem.invalidText =\n\t\t\t\t\t\t\t\"500kb max file size. Select a new file and try again.\";\n\t\t\t\t\t}, 1500);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}\n",
|
|
33515
33592
|
"assetsDirs": [],
|
|
33516
33593
|
"styleUrlsData": "",
|
|
33517
33594
|
"stylesData": "",
|
|
@@ -75417,7 +75494,7 @@
|
|
|
75417
75494
|
"name": "Basic",
|
|
75418
75495
|
"ctype": "miscellaneous",
|
|
75419
75496
|
"subtype": "variable",
|
|
75420
|
-
"file": "src/
|
|
75497
|
+
"file": "src/content-switcher/content-switcher.stories.ts",
|
|
75421
75498
|
"deprecated": false,
|
|
75422
75499
|
"deprecationMessage": "",
|
|
75423
75500
|
"type": "",
|
|
@@ -75427,7 +75504,7 @@
|
|
|
75427
75504
|
"name": "Basic",
|
|
75428
75505
|
"ctype": "miscellaneous",
|
|
75429
75506
|
"subtype": "variable",
|
|
75430
|
-
"file": "src/
|
|
75507
|
+
"file": "src/combobox/combobox.stories.ts",
|
|
75431
75508
|
"deprecated": false,
|
|
75432
75509
|
"deprecationMessage": "",
|
|
75433
75510
|
"type": "",
|
|
@@ -78329,21 +78406,21 @@
|
|
|
78329
78406
|
"name": "Template",
|
|
78330
78407
|
"ctype": "miscellaneous",
|
|
78331
78408
|
"subtype": "variable",
|
|
78332
|
-
"file": "src/
|
|
78409
|
+
"file": "src/content-switcher/content-switcher.stories.ts",
|
|
78333
78410
|
"deprecated": false,
|
|
78334
78411
|
"deprecationMessage": "",
|
|
78335
78412
|
"type": "",
|
|
78336
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-
|
|
78413
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-content-switcher (selected)=\"selected($event)\">\n\t\t\t<button cdsContentOption name=\"First\">First section</button>\n\t\t\t<button cdsContentOption name=\"Second\">Second section</button>\n\t\t\t<button cdsContentOption name=\"Third\">Third section</button>\n\t\t</cds-content-switcher>\n\t`\n})"
|
|
78337
78414
|
},
|
|
78338
78415
|
{
|
|
78339
78416
|
"name": "Template",
|
|
78340
78417
|
"ctype": "miscellaneous",
|
|
78341
78418
|
"subtype": "variable",
|
|
78342
|
-
"file": "src/
|
|
78419
|
+
"file": "src/combobox/combobox.stories.ts",
|
|
78343
78420
|
"deprecated": false,
|
|
78344
78421
|
"deprecationMessage": "",
|
|
78345
78422
|
"type": "",
|
|
78346
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-
|
|
78423
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\t[(ngModel)]=\"model\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[size]=\"size\"\n\t\t\t[appendInline]=\"appendInline\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(submit)=\"submit($event)\"\n\t\t\t(search)=\"search($event)\"\n\t\t\t(clear)=\"clear($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t\t<span>{{model | json}}</span>\n\t`\n})"
|
|
78347
78424
|
},
|
|
78348
78425
|
{
|
|
78349
78426
|
"name": "Template",
|
|
@@ -82482,6 +82559,28 @@
|
|
|
82482
82559
|
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-combo-button\n\t\t\t[size]=\"size\"\n\t\t\t[menuAlignment]=\"menuAlignment\"\n\t\t\t[label]=\"label\"\n\t\t\t[description]=\"description\"\n\t\t\t[tooltipAutoAlign]=\"tooltipAutoAlign\"\n\t\t\t[tooltipPlacement]=\"tooltipPlacement\">\n\t\t\t<cds-menu-item label=\"First action with a long label description\"></cds-menu-item>\n\t\t\t<cds-menu-item label=\"Second action\" (click)=\"onClick($event)\"></cds-menu-item>\n\t\t\t<cds-menu-item label=\"Third action\" [disabled]=\"true\"></cds-menu-item>\n\t\t\t<cds-menu-divider></cds-menu-divider>\n\t\t\t<cds-menu-item label=\"Cut\" info=\"⌘X\"></cds-menu-item>\n\t\t\t<cds-menu-item label=\"Option with icon\" icon=\"calendar\"></cds-menu-item>\n\t\t\t<cds-menu-divider></cds-menu-divider>\n\t\t\t<cds-menu-item label=\"Danger action\" [danger]=\"true\"></cds-menu-item>\n\t\t</cds-combo-button>\n\t`\n})"
|
|
82483
82560
|
}
|
|
82484
82561
|
],
|
|
82562
|
+
"src/content-switcher/content-switcher.stories.ts": [
|
|
82563
|
+
{
|
|
82564
|
+
"name": "Basic",
|
|
82565
|
+
"ctype": "miscellaneous",
|
|
82566
|
+
"subtype": "variable",
|
|
82567
|
+
"file": "src/content-switcher/content-switcher.stories.ts",
|
|
82568
|
+
"deprecated": false,
|
|
82569
|
+
"deprecationMessage": "",
|
|
82570
|
+
"type": "",
|
|
82571
|
+
"defaultValue": "Template.bind({})"
|
|
82572
|
+
},
|
|
82573
|
+
{
|
|
82574
|
+
"name": "Template",
|
|
82575
|
+
"ctype": "miscellaneous",
|
|
82576
|
+
"subtype": "variable",
|
|
82577
|
+
"file": "src/content-switcher/content-switcher.stories.ts",
|
|
82578
|
+
"deprecated": false,
|
|
82579
|
+
"deprecationMessage": "",
|
|
82580
|
+
"type": "",
|
|
82581
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-content-switcher (selected)=\"selected($event)\">\n\t\t\t<button cdsContentOption name=\"First\">First section</button>\n\t\t\t<button cdsContentOption name=\"Second\">Second section</button>\n\t\t\t<button cdsContentOption name=\"Third\">Third section</button>\n\t\t</cds-content-switcher>\n\t`\n})"
|
|
82582
|
+
}
|
|
82583
|
+
],
|
|
82485
82584
|
"src/combobox/combobox.stories.ts": [
|
|
82486
82585
|
{
|
|
82487
82586
|
"name": "Basic",
|
|
@@ -82614,28 +82713,6 @@
|
|
|
82614
82713
|
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-combo-box\n\t\t\t[(ngModel)]=\"model\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[size]=\"size\"\n\t\t\t[appendInline]=\"appendInline\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[label]=\"label\"\n\t\t\t[hideLabel]=\"hideLabel\"\n\t\t\t[helperText]=\"helperText\"\n\t\t\t[items]=\"items\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[dropUp]=\"dropUp\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(selected)=\"selected($event)\"\n\t\t\t(submit)=\"submit($event)\"\n\t\t\t(search)=\"search($event)\"\n\t\t\t(clear)=\"clear($event)\">\n\t\t\t<cds-dropdown-list></cds-dropdown-list>\n\t\t</cds-combo-box>\n\t\t<span>{{model | json}}</span>\n\t`\n})"
|
|
82615
82714
|
}
|
|
82616
82715
|
],
|
|
82617
|
-
"src/content-switcher/content-switcher.stories.ts": [
|
|
82618
|
-
{
|
|
82619
|
-
"name": "Basic",
|
|
82620
|
-
"ctype": "miscellaneous",
|
|
82621
|
-
"subtype": "variable",
|
|
82622
|
-
"file": "src/content-switcher/content-switcher.stories.ts",
|
|
82623
|
-
"deprecated": false,
|
|
82624
|
-
"deprecationMessage": "",
|
|
82625
|
-
"type": "",
|
|
82626
|
-
"defaultValue": "Template.bind({})"
|
|
82627
|
-
},
|
|
82628
|
-
{
|
|
82629
|
-
"name": "Template",
|
|
82630
|
-
"ctype": "miscellaneous",
|
|
82631
|
-
"subtype": "variable",
|
|
82632
|
-
"file": "src/content-switcher/content-switcher.stories.ts",
|
|
82633
|
-
"deprecated": false,
|
|
82634
|
-
"deprecationMessage": "",
|
|
82635
|
-
"type": "",
|
|
82636
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-content-switcher (selected)=\"selected($event)\">\n\t\t\t<button cdsContentOption name=\"First\">First section</button>\n\t\t\t<button cdsContentOption name=\"Second\">Second section</button>\n\t\t\t<button cdsContentOption name=\"Third\">Third section</button>\n\t\t</cds-content-switcher>\n\t`\n})"
|
|
82637
|
-
}
|
|
82638
|
-
],
|
|
82639
82716
|
"src/context-menu/context-menu.stories.ts": [
|
|
82640
82717
|
{
|
|
82641
82718
|
"name": "Basic",
|
|
@@ -89364,7 +89441,7 @@
|
|
|
89364
89441
|
"linktype": "component",
|
|
89365
89442
|
"name": "FileUploaderWithCustomFileStory",
|
|
89366
89443
|
"coveragePercent": 0,
|
|
89367
|
-
"coverageCount": "0/
|
|
89444
|
+
"coverageCount": "0/17",
|
|
89368
89445
|
"status": "low"
|
|
89369
89446
|
},
|
|
89370
89447
|
{
|