carbon-components-angular 5.47.2 → 5.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/documentation/classes/NumberChange.html +34 -0
- package/docs/documentation/components/NumberComponent.html +48 -14
- package/docs/documentation/components/PaginationNav.html +262 -33
- package/docs/documentation/components/ProgressIndicator.html +2 -2
- package/docs/documentation/coverage.html +3 -3
- package/docs/documentation/interfaces/PaginationNavTranslations.html +20 -2
- package/docs/documentation/js/search/search_index.js +2 -2
- package/docs/documentation/modules/TagModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TagModule.html +4 -4
- package/docs/documentation/modules/ThemeModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ThemeModule.html +4 -4
- package/docs/documentation/modules/TilesModule/dependencies.svg +98 -98
- package/docs/documentation/modules/TilesModule.html +98 -98
- package/docs/documentation/modules/TimePickerModule/dependencies.svg +44 -40
- package/docs/documentation/modules/TimePickerModule.html +44 -40
- package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +38 -42
- package/docs/documentation/modules/TimePickerSelectModule.html +38 -42
- package/docs/documentation/modules/ToggleModule/dependencies.svg +17 -17
- package/docs/documentation/modules/ToggleModule.html +17 -17
- package/docs/documentation/modules/ToggletipModule/dependencies.svg +37 -37
- package/docs/documentation/modules/ToggletipModule.html +37 -37
- package/docs/documentation/modules/TooltipModule/dependencies.svg +28 -28
- package/docs/documentation/modules/TooltipModule.html +28 -28
- package/docs/documentation/modules/TreeviewModule/dependencies.svg +36 -36
- package/docs/documentation/modules/TreeviewModule.html +36 -36
- package/docs/documentation.json +150 -78
- package/docs/storybook/{8341.2bf88948.iframe.bundle.js → 8341.d095fdee.iframe.bundle.js} +1 -1
- package/docs/storybook/iframe.html +2 -2
- package/docs/storybook/main.css +3007 -2790
- package/docs/storybook/main.e6ee5d76.iframe.bundle.js +1 -0
- package/docs/storybook/{number-input-number-stories.6aba5a3d.iframe.bundle.js → number-input-number-stories.8d02c22f.iframe.bundle.js} +1 -1
- package/docs/storybook/pagination-pagination-nav-stories.7b305bf2.iframe.bundle.js +1 -0
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/{runtime~main.14d57f59.iframe.bundle.js → runtime~main.90978505.iframe.bundle.js} +1 -1
- package/esm2020/number-input/number.component.mjs +31 -1
- package/esm2020/pagination/pagination-nav/pagination-nav.component.mjs +32 -5
- package/esm2020/progress-indicator/progress-indicator.component.mjs +2 -2
- package/fesm2015/carbon-components-angular-number-input.mjs +30 -0
- package/fesm2015/carbon-components-angular-number-input.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-pagination.mjs +31 -4
- package/fesm2015/carbon-components-angular-pagination.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-progress-indicator.mjs +1 -1
- package/fesm2015/carbon-components-angular-progress-indicator.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-number-input.mjs +30 -0
- package/fesm2020/carbon-components-angular-number-input.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-pagination.mjs +31 -4
- package/fesm2020/carbon-components-angular-pagination.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-progress-indicator.mjs +1 -1
- package/fesm2020/carbon-components-angular-progress-indicator.mjs.map +1 -1
- package/package.json +1 -1
- package/pagination/pagination-nav/pagination-nav.component.d.ts +8 -1
- package/progress-indicator/progress-indicator.component.d.ts +1 -1
- package/docs/storybook/main.ca52fea9.iframe.bundle.js +0 -1
- package/docs/storybook/pagination-pagination-nav-stories.ace8938b.iframe.bundle.js +0 -1
package/docs/documentation.json
CHANGED
|
@@ -1461,12 +1461,12 @@
|
|
|
1461
1461
|
},
|
|
1462
1462
|
{
|
|
1463
1463
|
"name": "PaginationNavTranslations",
|
|
1464
|
-
"id": "interface-PaginationNavTranslations-
|
|
1464
|
+
"id": "interface-PaginationNavTranslations-02747b3f02dda4195eb9b8d17de227f10ddb93cd71d7303c3e81567547ccb446b5f32191b820b258e4c180ac7d7172629000d09893bd3b623c8f47837e111b52",
|
|
1465
1465
|
"file": "src/pagination/pagination-nav/pagination-nav.component.ts",
|
|
1466
1466
|
"deprecated": false,
|
|
1467
1467
|
"deprecationMessage": "",
|
|
1468
1468
|
"type": "interface",
|
|
1469
|
-
"sourceCode": "import { PaginationModel } from \"../pagination-model.class\";\nimport {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter\n} from \"@angular/core\";\n\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { ExperimentalService } from \"carbon-components-angular/experimental\";\nimport { merge } from \"carbon-components-angular/utils\";\nimport { range } from \"carbon-components-angular/common\";\n\nexport interface PaginationNavTranslations {\n\tNEXT: string;\n\tPREVIOUS: string;\n}\n\n/**\n * Use pagination when you have multiple pages of data to handle. Get started with importing the module:\n *\n * ```typescript\n * import { PaginationModule } from 'carbon-components-angular';\n * ```\n *\n * ```html\n * <cds-pagination-nav [model]=\"model\" (selectPage)=\"selectPage($event)\"></cds-pagination-nav>\n * ```\n *\n * In your `selectPage()` method set the `model.currentPage` to selected page, _after_\n * you load the page.\n *\n * ```typescript\n * selectPage(page) {\n * \t// ... your code to load the page goes here\n *\n * \tthis.model.currentPage = page;\n *\n * \t// ... anything you want to do after page selection changes goes here\n * }\n * ```\n *\n * [See demo](../../?path=/story/components-pagination-nav--basic)\n */\n@Component({\n\tselector: \"cds-pagination-nav, ibm-pagination-navm\",\n\ttemplate: `\n\t<div>\n\t\t<div class=\"cds--pagination-nav\">\n\t\t\t<ul class=\"cds--pagination-nav__list\">\n\t\t\t\t<li class=\"cds--pagination-nav__list-item\">\n\t\t\t\t\t<cds-icon-button\n\t\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t\
|
|
1469
|
+
"sourceCode": "import { PaginationModel } from \"../pagination-model.class\";\nimport {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tHostBinding\n} from \"@angular/core\";\n\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { ExperimentalService } from \"carbon-components-angular/experimental\";\nimport { merge } from \"carbon-components-angular/utils\";\nimport { range } from \"carbon-components-angular/common\";\n\nexport interface PaginationNavTranslations {\n\tNEXT: string;\n\tPREVIOUS: string;\n}\n\n/**\n * Use pagination when you have multiple pages of data to handle. Get started with importing the module:\n *\n * ```typescript\n * import { PaginationModule } from 'carbon-components-angular';\n * ```\n *\n * ```html\n * <cds-pagination-nav [model]=\"model\" (selectPage)=\"selectPage($event)\"></cds-pagination-nav>\n * ```\n *\n * In your `selectPage()` method set the `model.currentPage` to selected page, _after_\n * you load the page.\n *\n * ```typescript\n * selectPage(page) {\n * \t// ... your code to load the page goes here\n *\n * \tthis.model.currentPage = page;\n *\n * \t// ... anything you want to do after page selection changes goes here\n * }\n * ```\n *\n * [See demo](../../?path=/story/components-pagination-nav--basic)\n */\n@Component({\n\tselector: \"cds-pagination-nav, ibm-pagination-navm\",\n\ttemplate: `\n\t<div>\n\t\t<div class=\"cds--pagination-nav\">\n\t\t\t<ul class=\"cds--pagination-nav__list\">\n\t\t\t\t<li class=\"cds--pagination-nav__list-item\">\n\t\t\t\t\t<cds-icon-button\n\t\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t\t(click)=\"jumpToPrevious()\"\n\t\t\t\t\t\t[disabled]=\"leftArrowDisabled\"\n\t\t\t\t\t\t[description]=\"previousItemText.subject | async\">\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tcdsIcon=\"caret--left\"\n\t\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\t\tclass=\"cds--btn__icon\">\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</cds-icon-button>\n\t\t\t\t</li>\n\t\t\t\t<cds-pagination-nav-item\n\t\t\t\t\t*ngIf=\"this.numOfItemsToShow >= 5 || (this.numOfItemsToShow <= 4 && currentPage <= 1)\"\n\t\t\t\t\tpage=\"1\"\n\t\t\t\t\t(click)=\"currentPage = 1\"\n\t\t\t\t\t[isActive]=\"currentPage == 1\">\n\t\t\t\t</cds-pagination-nav-item>\n\t\t\t\t<cds-pagination-overflow\n\t\t\t\t\t*ngIf=\"frontCuts\"\n\t\t\t\t\t[count]=\"frontCuts\"\n\t\t\t\t\t[fromIndex]=\"startOffset\"\n\t\t\t\t\t(change)=\"handleOverflowSelection($event)\">\n\t\t\t\t</cds-pagination-overflow>\n\t\t\t\t<cds-pagination-nav-item\n\t\t\t\t\t*ngFor=\"let page of getPages();\"\n\t\t\t\t\t[page]=\"page\"\n\t\t\t\t\t(click)=\"currentPage = page\"\n\t\t\t\t\t[isActive]=\"currentPage == page\">\n\t\t\t\t</cds-pagination-nav-item>\n\t\t\t\t<cds-pagination-overflow\n\t\t\t\t\t*ngIf=\"backCuts\"\n\t\t\t\t\t[count]=\"backCuts\"\n\t\t\t\t\t[fromIndex]=\"totalNumbersArray.length - backCuts - 1\"\n\t\t\t\t\t(change)=\"handleOverflowSelection($event)\">\n\t\t\t\t</cds-pagination-overflow>\n\t\t\t\t<cds-pagination-nav-item\n\t\t\t\t\t*ngIf=\"totalDataLength > 1\"\n\t\t\t\t\t[page]=\"totalNumbersArray.length\"\n\t\t\t\t\t(click)=\"currentPage = totalNumbersArray.length\"\n\t\t\t\t\t[isActive]=\"currentPage == totalNumbersArray.length\">\n\t\t\t\t</cds-pagination-nav-item>\n\t\t\t\t<li class=\"cds--pagination-nav__list-item\">\n\t\t\t\t\t<cds-icon-button\n\t\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t\t(click)=\"jumpToNext()\"\n\t\t\t\t\t\t[disabled]=\"rightArrowDisabled\"\n\t\t\t\t\t\t[description]=\"nextItemText.subject | async\">\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tcdsIcon=\"caret--right\"\n\t\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\t\tclass=\"cds--btn__icon\">\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</cds-icon-button>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t</div>\n\t</div>\n\t`\n})\nexport class PaginationNav {\n\tstatic paginationCounter = 0;\n\t/**\n\t * `PaginationNavModel` with the information about pages you're controlling.\n\t */\n\t@Input() model: PaginationModel;\n\t/**\n\t * Set to `true` to disable the backward/forward buttons.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Number of items to show in pagination. Minimum is 4.\n\t */\n\t@Input() numOfItemsToShow = 4;\n\n\t/**\n\t * Expects an object that contains some or all of:\n\t * ```\n\t * {\n\t *\t\t\"NEXT\": \"Next\",\n\t *\t\t\"PREVIOUS\": \"Previous\",\n\t * }\n\t * ```\n\t */\n\t@Input()\n\tset translations(value: PaginationNavTranslations) {\n\t\tconst valueWithDefaults = merge(this.i18n.getMultiple(\"PAGINATION\"), value);\n\t\tthis.nextItemText.override(valueWithDefaults.NEXT);\n\t\tthis.previousItemText.override(valueWithDefaults.PREVIOUS);\n\t}\n\n\t/**\n\t * Sets the pagination nav size\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"lg\";\n\n\t// Size\n\t@HostBinding(\"class.cds--layout--size-sm\") get smallLayoutSize() {\n\t\treturn this.size === \"sm\";\n\t}\n\t@HostBinding(\"class.cds--layout--size-md\") get mediumLayoutSize() {\n\t\treturn this.size === \"md\";\n\t}\n\t@HostBinding(\"class.cds--layout--size-lg\") get largeLayoutSize() {\n\t\treturn this.size === \"lg\";\n\t}\n\n\t/**\n\t * Emits the new page number.\n\t *\n\t * You should tie into this and update `model.currentPage` once the fresh\n\t * data is finally loaded.\n\t */\n\t@Output() selectPage = new EventEmitter<number>();\n\n\tget totalNumbersArray() {\n\t\treturn range(this.totalDataLength + 1, 1);\n\t}\n\n\tget currentPage() {\n\t\treturn this.model.currentPage;\n\t}\n\n\tset currentPage(value) {\n\t\tvalue = Number(value);\n\t\t// emits the value to allow the user to update current page\n\t\t// in the model once the page is loaded\n\t\tthis.selectPage.emit(value);\n\t}\n\n\tget totalDataLength() {\n\t\treturn this.model.totalDataLength;\n\t}\n\n\tget startOffset() {\n\t\treturn this.numOfItemsToShow <= 4 && this.currentPage > 1 ? 0 : 1;\n\t}\n\n\tget frontCuts() {\n\t\tconst cuts = this.getCuts();\n\t\treturn cuts.front;\n\t}\n\n\tget backCuts() {\n\t\tconst cuts = this.getCuts();\n\t\treturn cuts.back;\n\t}\n\n\tget leftArrowDisabled() {\n\t\treturn this.disabled || this.currentPage === 1;\n\t}\n\n\tget rightArrowDisabled() {\n\t\treturn this.disabled || this.currentPage === this.totalDataLength;\n\t}\n\n\tnextItemText = this.i18n.getOverridable(\"PAGINATION.NEXT\");\n\tpreviousItemText = this.i18n.getOverridable(\"PAGINATION.PREVIOUS\");\n\n\tconstructor(protected i18n: I18n, protected experimental: ExperimentalService) {\n\t\tPaginationNav.paginationCounter++;\n\t}\n\n\thandleOverflowSelection(page) {\n\t\tif (typeof page === \"number\") {\n\t\t\tthis.currentPage = page;\n\t\t}\n\t}\n\n\tpublic jumpToNext() {\n\t\tthis.currentPage = this.currentPage < this.totalDataLength ? this.currentPage + 1 : this.totalDataLength;\n\t}\n\n\tpublic jumpToPrevious() {\n\t\tthis.currentPage = this.currentPage > 1 ? this.currentPage - 1 : 1;\n\t}\n\n\tpublic getPages() {\n\t\tif (this.totalDataLength <= 1) {\n\t\t\treturn null;\n\t\t}\n\t\tconst cuts = this.getCuts();\n\t\treturn this.totalNumbersArray.slice(this.startOffset + cuts.front, (1 + cuts.back) * -1);\n\t}\n\n\tprivate getCuts(splitPoint = null) {\n\t\tconst page = this.currentPage - 1;\n\t\tconst totalItems = this.totalDataLength;\n\t\tconst itemsThatFit = this.numOfItemsToShow;\n\n\t\tif (itemsThatFit >= totalItems) {\n\t\t\treturn {\n\t\t\t\tfront: 0,\n\t\t\t\tback: 0\n\t\t\t};\n\t\t}\n\t\tconst split = splitPoint || Math.ceil(itemsThatFit / 2) - 1;\n\t\tlet frontHidden = page + 1 - split;\n\t\tlet backHidden = totalItems - page - (itemsThatFit - split) + 1;\n\n\t\tif (frontHidden <= 1) {\n\t\t\tbackHidden -= frontHidden <= 0 ? Math.abs(frontHidden) + 1 : 0;\n\t\t\tfrontHidden = 0;\n\t\t}\n\t\tif (backHidden <= 1) {\n\t\t\tfrontHidden -= backHidden <= 0 ? Math.abs(backHidden) + 1 : 0;\n\t\t\tbackHidden = 0;\n\t\t}\n\t\treturn {\n\t\t\tfront: frontHidden,\n\t\t\tback: backHidden\n\t\t};\n\t}\n}\n",
|
|
1470
1470
|
"properties": [
|
|
1471
1471
|
{
|
|
1472
1472
|
"name": "NEXT",
|
|
@@ -1475,7 +1475,7 @@
|
|
|
1475
1475
|
"type": "string",
|
|
1476
1476
|
"optional": false,
|
|
1477
1477
|
"description": "",
|
|
1478
|
-
"line":
|
|
1478
|
+
"line": 16
|
|
1479
1479
|
},
|
|
1480
1480
|
{
|
|
1481
1481
|
"name": "PREVIOUS",
|
|
@@ -1484,7 +1484,7 @@
|
|
|
1484
1484
|
"type": "string",
|
|
1485
1485
|
"optional": false,
|
|
1486
1486
|
"description": "",
|
|
1487
|
-
"line":
|
|
1487
|
+
"line": 17
|
|
1488
1488
|
}
|
|
1489
1489
|
],
|
|
1490
1490
|
"indexSignatures": [],
|
|
@@ -7051,12 +7051,12 @@
|
|
|
7051
7051
|
},
|
|
7052
7052
|
{
|
|
7053
7053
|
"name": "NumberChange",
|
|
7054
|
-
"id": "class-NumberChange-
|
|
7054
|
+
"id": "class-NumberChange-fe20fe65939c8d249815e7b930825da7d9229c32f54dbd3496ec81d6605b4b2f291e5ea9d9ed648e5d850c504af01a335a7caf96b73baaad8c4717ab91830c1f",
|
|
7055
7055
|
"file": "src/number-input/number.component.ts",
|
|
7056
7056
|
"deprecated": false,
|
|
7057
7057
|
"deprecationMessage": "",
|
|
7058
7058
|
"type": "class",
|
|
7059
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tHostBinding,\n\tEventEmitter,\n\tOutput,\n\tTemplateRef,\n\tHostListener\n} from \"@angular/core\";\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from \"@angular/forms\";\n\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Used to emit changes performed on number input components.\n */\nexport class NumberChange {\n\t/**\n\t * Contains the `Number` that has been changed.\n\t */\n\tsource: NumberComponent;\n\t/**\n\t * The value of the `Number` field encompassed in the `NumberChange` class.\n\t */\n\tvalue: number;\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { NumberModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-number--basic)\n */\n@Component({\n\tselector: \"cds-number, ibm-number\",\n\ttemplate: `\n\t\t<label *ngIf=\"skeleton && label\" class=\"cds--label cds--skeleton\"></label>\n\t\t<div\n\t\t\tdata-numberinput\n\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\tclass=\"cds--number\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--number--light': theme === 'light',\n\t\t\t\t'cds--number--nolabel': !label,\n\t\t\t\t'cds--number--helpertext': helperText,\n\t\t\t\t'cds--skeleton' : skeleton,\n\t\t\t\t'cds--number--sm': size === 'sm',\n\t\t\t\t'cds--number--md': size === 'md',\n\t\t\t\t'cds--number--lg': size === 'lg'\n\t\t\t}\">\n\t\t\t<label\n\t\t\t\t*ngIf=\"!skeleton && label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\tclass=\"cds--number__input-wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--number__input-wrapper--warning': warn\n\t\t\t\t}\">\n\t\t\t\t<input\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t[value]=\"value\"\n\t\t\t\t\t[attr.min]=\"min\"\n\t\t\t\t\t[attr.max]=\"max\"\n\t\t\t\t\t[attr.step]=\"step\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[required]=\"required\"\n\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\t[attr.data-invalid]=\"invalid ? invalid : null\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t(focus)=\"fluid ? handleFocus($event): null\"\n\t\t\t\t\t(blur)=\"fluid ? handleFocus($event): null\"\n\t\t\t\t\t(change)=\"onNumberInputChange($event)\"/>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && invalid\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid\">\n\t\t\t\t</svg>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && !invalid && warn\"\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid cds--number__invalid--warning\">\n\t\t\t\t</svg>\n\t\t\t\t<div *ngIf=\"!skeleton\" class=\"cds--number__controls\">\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn down-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getDecrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onDecrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"subtract\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn up-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getIncrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onIncrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"add\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<hr *ngIf=\"fluid\" class=\"cds--number-input__divider\" />\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn && !fluid\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: NumberComponent,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class NumberComponent implements ControlValueAccessor {\n\t/**\n\t * Variable used for creating unique ids for number input components.\n\t */\n\tstatic numberCount = 0;\n\n\t@HostBinding(\"class.cds--form-item\") containerClass = true;\n\n\t/**\n\t * Set to `true` for readonly state.\n\t */\n\t@Input() @HostBinding(\"class.cds--number--readonly\") readonly = false;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` number input theme.\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Set to `true` for a disabled number input.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading number component.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for an invalid number component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * The unique id for the number component.\n\t */\n\t@Input() id = `number-${NumberComponent.numberCount}`;\n\t/**\n\t * Sets the placeholder attribute on the `input` element.\n\t */\n\t@Input() placeholder = \"\";\n\t/**\n\t * Number input field render size\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Reflects the required attribute of the `input` element.\n\t */\n\t@Input() required: boolean;\n\t/**\n\t * Sets the value attribute on the `input` element.\n\t */\n\t@Input() set value(v: any) {\n\t\tif (v === \"\" || v === null) {\n\t\t\tthis._value = null;\n\t\t\treturn;\n\t\t}\n\t\tthis._value = Number(v);\n\t}\n\n\tget value() {\n\t\treturn this._value;\n\t}\n\t/**\n\t * Sets the min attribute on the `input` element.\n\t */\n\t@Input() min = null;\n\t/**\n\t * Sets the max attribute on the `input` element.\n\t */\n\t@Input() max = null;\n\t/**\n\t * Sets the text inside the `label` tag.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Sets the amount the number controls increment and decrement by.\n\t */\n\t@Input() step = 1;\n\t/**\n\t * If `step` is a decimal, we may want precision to be set to go around floating point precision.\n\t */\n\t@Input() precision: number;\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\t/**\n\t * Sets the arialabel for input\n\t */\n\t@Input() ariaLabel: string;\n\t/**\n\t * Emits event notifying other classes when a change in state occurs in the input.\n\t */\n\t@Output() change = new EventEmitter<NumberChange>();\n\n\t@Input()\n\tset decrementLabel(value: string | Observable<string>) {\n\t\tthis._decrementLabel.override(value);\n\t}\n\n\tget decrementLabel() {\n\t\treturn this._decrementLabel.value;\n\t}\n\n\t@Input()\n\tset incrementLabel(value: string | Observable<string>) {\n\t\tthis._incrementLabel.override(value);\n\t}\n\n\tget incrementLabel() {\n\t\treturn this._incrementLabel.value;\n\t}\n\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@HostBinding(\"class.cds--number-input--fluid\") @Input() fluid = false;\n\n\t@HostBinding(\"class.cds--number-input--fluid--invalid\") get fluidInvalid() {\n\t\treturn this.fluid && this.invalid;\n\t}\n\n\t@HostBinding(\"class.cds--number-input--fluid--disabled\") get fluidDisabled() {\n\t\treturn this.fluid && this.disabled;\n\t}\n\n\t@HostBinding(\"class.cds--number-input--fluid--focus\") get fluidFocus() {\n\t\treturn this.fluid && this._isFocused;\n\t}\n\n\t@HostBinding(\"class.cds--text-input--fluid__skeleton\") get fluidSkeleton() {\n\t\treturn this.fluid && this.skeleton;\n\t}\n\n\tprotected _isFocused = false;\n\n\tprotected _value = 0;\n\n\tprotected _decrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.DECREMENT\");\n\tprotected _incrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.INCREMENT\");\n\n\t/**\n\t * Creates an instance of `Number`.\n\t */\n\tconstructor(protected i18n: I18n) {\n\t\tNumberComponent.numberCount++;\n\t}\n\n\t/**\n\t * This is the initial value set to the component\n\t * @param value The input value.\n\t */\n\tpublic writeValue(value: any) {\n\t\tthis.value = value;\n\t}\n\n\t/**\n\t * Sets a method in order to propagate changes back to the form.\n\t */\n\tpublic registerOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registers a callback to be triggered when the control has been touched.\n\t * @param fn Callback to be triggered when the number input is touched.\n\t */\n\tpublic registerOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\t@HostListener(\"focusout\")\n\tfocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Sets the disabled state through the model\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called when number input is blurred. Needed to properly implement `ControlValueAccessor`.\n\t */\n\tonTouched: () => any = () => { };\n\n\t/**\n\t * Method set in `registerOnChange` to propagate changes back to the form.\n\t */\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * Adds `step` to the current `value`.\n\t */\n\tonIncrement(): void {\n\t\tif (this.max === null || this.value + this.step <= this.max) {\n\t\t\tthis.value += this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\t/**\n\t * Subtracts `step` to the current `value`.\n\t */\n\tonDecrement(): void {\n\t\tif (this.min === null || this.value - this.step >= this.min) {\n\t\t\tthis.value -= this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\tgetDecrementLabel(): Observable<string> {\n\t\treturn this._decrementLabel.subject;\n\t}\n\n\tgetIncrementLabel(): Observable<string> {\n\t\treturn this._incrementLabel.subject;\n\t}\n\n\t/**\n\t * Creates a class of `NumberChange` to emit the change in the `Number`.\n\t */\n\temitChangeEvent(): void {\n\t\tlet event = new NumberChange();\n\t\tevent.source = this;\n\t\tevent.value = this.value;\n\t\tthis.change.emit(event);\n\t\tthis.propagateChange(this.value);\n\t}\n\n\tonNumberInputChange(event) {\n\t\tthis.value = event.target.value;\n\t\tthis.emitChangeEvent();\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\thandleFocus(event: FocusEvent) {\n\t\tif (\"type\" in event.target && (<HTMLInputElement>event.target).type === \"button\") {\n\t\t\tthis._isFocused = false;\n\t\t} else {\n\t\t\tthis._isFocused = event.type === \"focus\";\n\t\t}\n\t}\n}\nexport { NumberComponent as Number };\n",
|
|
7059
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tHostBinding,\n\tEventEmitter,\n\tOutput,\n\tTemplateRef,\n\tHostListener\n} from \"@angular/core\";\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from \"@angular/forms\";\n\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Used to emit changes performed on number input components.\n */\nexport class NumberChange {\n\t/**\n\t * Contains the `Number` that has been changed.\n\t */\n\tsource: NumberComponent;\n\t/**\n\t * The value of the `Number` field encompassed in the `NumberChange` class.\n\t */\n\tvalue: number;\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { NumberModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-number--basic)\n */\n@Component({\n\tselector: \"cds-number, ibm-number\",\n\ttemplate: `\n\t\t<label *ngIf=\"skeleton && label\" class=\"cds--label cds--skeleton\"></label>\n\t\t<div\n\t\t\tdata-numberinput\n\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\tclass=\"cds--number\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--number--light': theme === 'light',\n\t\t\t\t'cds--number--nolabel': !label,\n\t\t\t\t'cds--number--helpertext': helperText,\n\t\t\t\t'cds--skeleton' : skeleton,\n\t\t\t\t'cds--number--sm': size === 'sm',\n\t\t\t\t'cds--number--md': size === 'md',\n\t\t\t\t'cds--number--lg': size === 'lg'\n\t\t\t}\">\n\t\t\t<label\n\t\t\t\t*ngIf=\"!skeleton && label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\tclass=\"cds--number__input-wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--number__input-wrapper--warning': warn\n\t\t\t\t}\">\n\t\t\t\t<input\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t[value]=\"value\"\n\t\t\t\t\t[attr.min]=\"min\"\n\t\t\t\t\t[attr.max]=\"max\"\n\t\t\t\t\t[attr.step]=\"step\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[required]=\"required\"\n\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\t[attr.data-invalid]=\"invalid ? invalid : null\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t(focus)=\"fluid ? handleFocus($event): null\"\n\t\t\t\t\t(blur)=\"fluid ? handleFocus($event): null\"\n\t\t\t\t\t(change)=\"onNumberInputChange($event)\"/>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && invalid\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid\">\n\t\t\t\t</svg>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && !invalid && warn\"\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid cds--number__invalid--warning\">\n\t\t\t\t</svg>\n\t\t\t\t<div *ngIf=\"!skeleton\" class=\"cds--number__controls\">\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn down-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getDecrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onDecrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"subtract\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn up-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getIncrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onIncrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"add\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<hr *ngIf=\"fluid\" class=\"cds--number-input__divider\" />\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn && !fluid\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: NumberComponent,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class NumberComponent implements ControlValueAccessor {\n\t/**\n\t * Variable used for creating unique ids for number input components.\n\t */\n\tstatic numberCount = 0;\n\n\t@HostBinding(\"class.cds--form-item\") containerClass = true;\n\n\t/**\n\t * Set to `true` for readonly state.\n\t */\n\t@Input() @HostBinding(\"class.cds--number--readonly\") readonly = false;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` number input theme.\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Set to `true` for a disabled number input.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading number component.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for an invalid number component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * The unique id for the number component.\n\t */\n\t@Input() id = `number-${NumberComponent.numberCount}`;\n\t/**\n\t * Sets the placeholder attribute on the `input` element.\n\t */\n\t@Input() placeholder = \"\";\n\t/**\n\t * Number input field render size\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Reflects the required attribute of the `input` element.\n\t */\n\t@Input() required: boolean;\n\t/**\n\t * Sets the value attribute on the `input` element.\n\t */\n\t@Input() set value(v: any) {\n\t\tif (v === \"\" || v === null) {\n\t\t\tthis._value = null;\n\t\t\treturn;\n\t\t}\n\t\tthis._value = Number(v);\n\t}\n\n\tget value() {\n\t\treturn this._value;\n\t}\n\t/**\n\t * Sets the min attribute on the `input` element.\n\t */\n\t@Input() min = null;\n\t/**\n\t * Sets the max attribute on the `input` element.\n\t */\n\t@Input() max = null;\n\t/**\n\t * Sets the text inside the `label` tag.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Sets the amount the number controls increment and decrement by.\n\t */\n\t@Input() step = 1;\n\t/**\n\t * If `step` is a decimal, we may want precision to be set to go around floating point precision.\n\t */\n\t@Input() precision: number;\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\t/**\n\t * Sets the arialabel for input\n\t */\n\t@Input() ariaLabel: string;\n\t/**\n\t * Emits event notifying other classes when a change in state occurs in the input.\n\t */\n\t@Output() change = new EventEmitter<NumberChange>();\n\n\t@Input()\n\tset decrementLabel(value: string | Observable<string>) {\n\t\tthis._decrementLabel.override(value);\n\t}\n\n\tget decrementLabel() {\n\t\treturn this._decrementLabel.value;\n\t}\n\n\t@Input()\n\tset incrementLabel(value: string | Observable<string>) {\n\t\tthis._incrementLabel.override(value);\n\t}\n\n\tget incrementLabel() {\n\t\treturn this._incrementLabel.value;\n\t}\n\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@HostBinding(\"class.cds--number-input--fluid\") @Input() fluid = false;\n\n\t@HostBinding(\"class.cds--number-input--fluid--invalid\") get fluidInvalid() {\n\t\treturn this.fluid && this.invalid;\n\t}\n\n\t@HostBinding(\"class.cds--number-input--fluid--disabled\") get fluidDisabled() {\n\t\treturn this.fluid && this.disabled;\n\t}\n\n\t@HostBinding(\"class.cds--number-input--fluid--focus\") get fluidFocus() {\n\t\treturn this.fluid && this._isFocused;\n\t}\n\n\t@HostBinding(\"class.cds--text-input--fluid__skeleton\") get fluidSkeleton() {\n\t\treturn this.fluid && this.skeleton;\n\t}\n\n\tprotected _isFocused = false;\n\n\tprotected _value = 0;\n\n\tprotected _decrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.DECREMENT\");\n\tprotected _incrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.INCREMENT\");\n\n\t/**\n\t * Creates an instance of `Number`.\n\t */\n\tconstructor(protected i18n: I18n) {\n\t\tNumberComponent.numberCount++;\n\t}\n\n\t/**\n\t * This is the initial value set to the component\n\t * @param value The input value.\n\t */\n\tpublic writeValue(value: any) {\n\t\tthis.value = value;\n\t}\n\n\t/**\n\t * Sets a method in order to propagate changes back to the form.\n\t */\n\tpublic registerOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registers a callback to be triggered when the control has been touched.\n\t * @param fn Callback to be triggered when the number input is touched.\n\t */\n\tpublic registerOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\t@HostListener(\"focusout\")\n\tfocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Sets the disabled state through the model\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called when number input is blurred. Needed to properly implement `ControlValueAccessor`.\n\t */\n\tonTouched: () => any = () => { };\n\n\t/**\n\t * Method set in `registerOnChange` to propagate changes back to the form.\n\t */\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * Adds `step` to the current `value`.\n\t */\n\tonIncrement(): void {\n\t\t// if max is set and value + step is greater than max, set value to max\n\t\t// example: max = 100, step = 10, value = 95 , value + step = 105, value will be set to 100 (max) instead of 105\n\t\tif (this.max !== null && this.value + this.step > this.max) {\n\t\t\tthis.value = this.max;\n\t\t\tthis.emitChangeEvent();\n\t\t\treturn;\n\t\t}\n\n\t\t// if min is set and value + step is less than min, set value to min\n\t\t// example: min = 5, step = 2, value = 0, value + step = 2, value will be set to 5 (min) instead of 2\n\t\tif (this.min !== null && this.value + this.step < this.min) {\n\t\t\tthis.value = this.min;\n\t\t\tthis.emitChangeEvent();\n\t\t\treturn;\n\t\t}\n\n\t\t// if max is not set or value + step is less than max, increment value by step\n\t\tif (this.max === null || this.value + this.step <= this.max) {\n\t\t\tthis.value += this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\t/**\n\t * Subtracts `step` to the current `value`.\n\t */\n\tonDecrement(): void {\n\t\t// if max is set and value - step is greater than max, set value to max\n\t\t// example: max = 15, step = 2, value = 20, value - step = 18, value will be set to 15 (max) instead of 18\n\t\tif (this.max !== null && this.value - this.step > this.max) {\n\t\t\tthis.value = this.max;\n\t\t\tthis.emitChangeEvent();\n\t\t\treturn;\n\t\t}\n\n\t\t// if min is set and value - step is less than min, set value to min\n\t\t// example: min = 5, step = 2, value = 6, value - step = 4, value will be set to 5 (min) instead of 4\n\t\tif (this.min !== null && this.value - this.step < this.min) {\n\t\t\tthis.value = this.min;\n\t\t\tthis.emitChangeEvent();\n\t\t\treturn;\n\t\t}\n\n\t\t// if min is not set or value - step is greater than min, decrement value by step\n\t\tif (this.min === null || this.value - this.step >= this.min) {\n\t\t\tthis.value -= this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\tgetDecrementLabel(): Observable<string> {\n\t\treturn this._decrementLabel.subject;\n\t}\n\n\tgetIncrementLabel(): Observable<string> {\n\t\treturn this._incrementLabel.subject;\n\t}\n\n\t/**\n\t * Creates a class of `NumberChange` to emit the change in the `Number`.\n\t */\n\temitChangeEvent(): void {\n\t\tlet event = new NumberChange();\n\t\tevent.source = this;\n\t\tevent.value = this.value;\n\t\tthis.change.emit(event);\n\t\tthis.propagateChange(this.value);\n\t}\n\n\tonNumberInputChange(event) {\n\t\tthis.value = event.target.value;\n\t\tthis.emitChangeEvent();\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\thandleFocus(event: FocusEvent) {\n\t\tif (\"type\" in event.target && (<HTMLInputElement>event.target).type === \"button\") {\n\t\t\tthis._isFocused = false;\n\t\t} else {\n\t\t\tthis._isFocused = event.type === \"focus\";\n\t\t}\n\t}\n}\nexport { NumberComponent as Number };\n",
|
|
7060
7060
|
"inputsClass": [],
|
|
7061
7061
|
"outputsClass": [],
|
|
7062
7062
|
"properties": [
|
|
@@ -38202,7 +38202,7 @@
|
|
|
38202
38202
|
},
|
|
38203
38203
|
{
|
|
38204
38204
|
"name": "NumberComponent",
|
|
38205
|
-
"id": "component-NumberComponent-
|
|
38205
|
+
"id": "component-NumberComponent-fe20fe65939c8d249815e7b930825da7d9229c32f54dbd3496ec81d6605b4b2f291e5ea9d9ed648e5d850c504af01a335a7caf96b73baaad8c4717ab91830c1f",
|
|
38206
38206
|
"file": "src/number-input/number.component.ts",
|
|
38207
38207
|
"encapsulation": [],
|
|
38208
38208
|
"entryComponents": [],
|
|
@@ -38556,7 +38556,7 @@
|
|
|
38556
38556
|
"optional": false,
|
|
38557
38557
|
"returnType": "void",
|
|
38558
38558
|
"typeParameters": [],
|
|
38559
|
-
"line":
|
|
38559
|
+
"line": 418,
|
|
38560
38560
|
"deprecated": false,
|
|
38561
38561
|
"deprecationMessage": "",
|
|
38562
38562
|
"rawdescription": "\n\nCreates a class of `NumberChange` to emit the change in the `Number`.\n",
|
|
@@ -38587,7 +38587,7 @@
|
|
|
38587
38587
|
"optional": false,
|
|
38588
38588
|
"returnType": "Observable<string>",
|
|
38589
38589
|
"typeParameters": [],
|
|
38590
|
-
"line":
|
|
38590
|
+
"line": 407,
|
|
38591
38591
|
"deprecated": false,
|
|
38592
38592
|
"deprecationMessage": ""
|
|
38593
38593
|
},
|
|
@@ -38597,7 +38597,7 @@
|
|
|
38597
38597
|
"optional": false,
|
|
38598
38598
|
"returnType": "Observable<string>",
|
|
38599
38599
|
"typeParameters": [],
|
|
38600
|
-
"line":
|
|
38600
|
+
"line": 411,
|
|
38601
38601
|
"deprecated": false,
|
|
38602
38602
|
"deprecationMessage": ""
|
|
38603
38603
|
},
|
|
@@ -38614,7 +38614,7 @@
|
|
|
38614
38614
|
"optional": false,
|
|
38615
38615
|
"returnType": "void",
|
|
38616
38616
|
"typeParameters": [],
|
|
38617
|
-
"line":
|
|
38617
|
+
"line": 435,
|
|
38618
38618
|
"deprecated": false,
|
|
38619
38619
|
"deprecationMessage": "",
|
|
38620
38620
|
"jsdoctags": [
|
|
@@ -38642,7 +38642,7 @@
|
|
|
38642
38642
|
"optional": false,
|
|
38643
38643
|
"returnType": "boolean",
|
|
38644
38644
|
"typeParameters": [],
|
|
38645
|
-
"line":
|
|
38645
|
+
"line": 431,
|
|
38646
38646
|
"deprecated": false,
|
|
38647
38647
|
"deprecationMessage": "",
|
|
38648
38648
|
"modifierKind": [
|
|
@@ -38666,7 +38666,7 @@
|
|
|
38666
38666
|
"optional": false,
|
|
38667
38667
|
"returnType": "void",
|
|
38668
38668
|
"typeParameters": [],
|
|
38669
|
-
"line":
|
|
38669
|
+
"line": 382,
|
|
38670
38670
|
"deprecated": false,
|
|
38671
38671
|
"deprecationMessage": "",
|
|
38672
38672
|
"rawdescription": "\n\nSubtracts `step` to the current `value`.\n",
|
|
@@ -38697,7 +38697,7 @@
|
|
|
38697
38697
|
"optional": false,
|
|
38698
38698
|
"returnType": "void",
|
|
38699
38699
|
"typeParameters": [],
|
|
38700
|
-
"line":
|
|
38700
|
+
"line": 426,
|
|
38701
38701
|
"deprecated": false,
|
|
38702
38702
|
"deprecationMessage": "",
|
|
38703
38703
|
"jsdoctags": [
|
|
@@ -38932,7 +38932,7 @@
|
|
|
38932
38932
|
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { NumberModule } from 'carbon-components-angular';</code></pre></div><p><a href=\"../../?path=/story/components-number--basic\">See demo</a></p>\n",
|
|
38933
38933
|
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { NumberModule } from 'carbon-components-angular';\n```\n\n[See demo](../../?path=/story/components-number--basic)\n",
|
|
38934
38934
|
"type": "component",
|
|
38935
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tHostBinding,\n\tEventEmitter,\n\tOutput,\n\tTemplateRef,\n\tHostListener\n} from \"@angular/core\";\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from \"@angular/forms\";\n\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Used to emit changes performed on number input components.\n */\nexport class NumberChange {\n\t/**\n\t * Contains the `Number` that has been changed.\n\t */\n\tsource: NumberComponent;\n\t/**\n\t * The value of the `Number` field encompassed in the `NumberChange` class.\n\t */\n\tvalue: number;\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { NumberModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-number--basic)\n */\n@Component({\n\tselector: \"cds-number, ibm-number\",\n\ttemplate: `\n\t\t<label *ngIf=\"skeleton && label\" class=\"cds--label cds--skeleton\"></label>\n\t\t<div\n\t\t\tdata-numberinput\n\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\tclass=\"cds--number\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--number--light': theme === 'light',\n\t\t\t\t'cds--number--nolabel': !label,\n\t\t\t\t'cds--number--helpertext': helperText,\n\t\t\t\t'cds--skeleton' : skeleton,\n\t\t\t\t'cds--number--sm': size === 'sm',\n\t\t\t\t'cds--number--md': size === 'md',\n\t\t\t\t'cds--number--lg': size === 'lg'\n\t\t\t}\">\n\t\t\t<label\n\t\t\t\t*ngIf=\"!skeleton && label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\tclass=\"cds--number__input-wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--number__input-wrapper--warning': warn\n\t\t\t\t}\">\n\t\t\t\t<input\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t[value]=\"value\"\n\t\t\t\t\t[attr.min]=\"min\"\n\t\t\t\t\t[attr.max]=\"max\"\n\t\t\t\t\t[attr.step]=\"step\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[required]=\"required\"\n\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\t[attr.data-invalid]=\"invalid ? invalid : null\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t(focus)=\"fluid ? handleFocus($event): null\"\n\t\t\t\t\t(blur)=\"fluid ? handleFocus($event): null\"\n\t\t\t\t\t(change)=\"onNumberInputChange($event)\"/>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && invalid\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid\">\n\t\t\t\t</svg>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && !invalid && warn\"\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid cds--number__invalid--warning\">\n\t\t\t\t</svg>\n\t\t\t\t<div *ngIf=\"!skeleton\" class=\"cds--number__controls\">\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn down-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getDecrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onDecrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"subtract\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn up-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getIncrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onIncrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"add\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<hr *ngIf=\"fluid\" class=\"cds--number-input__divider\" />\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn && !fluid\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: NumberComponent,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class NumberComponent implements ControlValueAccessor {\n\t/**\n\t * Variable used for creating unique ids for number input components.\n\t */\n\tstatic numberCount = 0;\n\n\t@HostBinding(\"class.cds--form-item\") containerClass = true;\n\n\t/**\n\t * Set to `true` for readonly state.\n\t */\n\t@Input() @HostBinding(\"class.cds--number--readonly\") readonly = false;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` number input theme.\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Set to `true` for a disabled number input.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading number component.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for an invalid number component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * The unique id for the number component.\n\t */\n\t@Input() id = `number-${NumberComponent.numberCount}`;\n\t/**\n\t * Sets the placeholder attribute on the `input` element.\n\t */\n\t@Input() placeholder = \"\";\n\t/**\n\t * Number input field render size\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Reflects the required attribute of the `input` element.\n\t */\n\t@Input() required: boolean;\n\t/**\n\t * Sets the value attribute on the `input` element.\n\t */\n\t@Input() set value(v: any) {\n\t\tif (v === \"\" || v === null) {\n\t\t\tthis._value = null;\n\t\t\treturn;\n\t\t}\n\t\tthis._value = Number(v);\n\t}\n\n\tget value() {\n\t\treturn this._value;\n\t}\n\t/**\n\t * Sets the min attribute on the `input` element.\n\t */\n\t@Input() min = null;\n\t/**\n\t * Sets the max attribute on the `input` element.\n\t */\n\t@Input() max = null;\n\t/**\n\t * Sets the text inside the `label` tag.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Sets the amount the number controls increment and decrement by.\n\t */\n\t@Input() step = 1;\n\t/**\n\t * If `step` is a decimal, we may want precision to be set to go around floating point precision.\n\t */\n\t@Input() precision: number;\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\t/**\n\t * Sets the arialabel for input\n\t */\n\t@Input() ariaLabel: string;\n\t/**\n\t * Emits event notifying other classes when a change in state occurs in the input.\n\t */\n\t@Output() change = new EventEmitter<NumberChange>();\n\n\t@Input()\n\tset decrementLabel(value: string | Observable<string>) {\n\t\tthis._decrementLabel.override(value);\n\t}\n\n\tget decrementLabel() {\n\t\treturn this._decrementLabel.value;\n\t}\n\n\t@Input()\n\tset incrementLabel(value: string | Observable<string>) {\n\t\tthis._incrementLabel.override(value);\n\t}\n\n\tget incrementLabel() {\n\t\treturn this._incrementLabel.value;\n\t}\n\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@HostBinding(\"class.cds--number-input--fluid\") @Input() fluid = false;\n\n\t@HostBinding(\"class.cds--number-input--fluid--invalid\") get fluidInvalid() {\n\t\treturn this.fluid && this.invalid;\n\t}\n\n\t@HostBinding(\"class.cds--number-input--fluid--disabled\") get fluidDisabled() {\n\t\treturn this.fluid && this.disabled;\n\t}\n\n\t@HostBinding(\"class.cds--number-input--fluid--focus\") get fluidFocus() {\n\t\treturn this.fluid && this._isFocused;\n\t}\n\n\t@HostBinding(\"class.cds--text-input--fluid__skeleton\") get fluidSkeleton() {\n\t\treturn this.fluid && this.skeleton;\n\t}\n\n\tprotected _isFocused = false;\n\n\tprotected _value = 0;\n\n\tprotected _decrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.DECREMENT\");\n\tprotected _incrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.INCREMENT\");\n\n\t/**\n\t * Creates an instance of `Number`.\n\t */\n\tconstructor(protected i18n: I18n) {\n\t\tNumberComponent.numberCount++;\n\t}\n\n\t/**\n\t * This is the initial value set to the component\n\t * @param value The input value.\n\t */\n\tpublic writeValue(value: any) {\n\t\tthis.value = value;\n\t}\n\n\t/**\n\t * Sets a method in order to propagate changes back to the form.\n\t */\n\tpublic registerOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registers a callback to be triggered when the control has been touched.\n\t * @param fn Callback to be triggered when the number input is touched.\n\t */\n\tpublic registerOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\t@HostListener(\"focusout\")\n\tfocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Sets the disabled state through the model\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called when number input is blurred. Needed to properly implement `ControlValueAccessor`.\n\t */\n\tonTouched: () => any = () => { };\n\n\t/**\n\t * Method set in `registerOnChange` to propagate changes back to the form.\n\t */\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * Adds `step` to the current `value`.\n\t */\n\tonIncrement(): void {\n\t\tif (this.max === null || this.value + this.step <= this.max) {\n\t\t\tthis.value += this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\t/**\n\t * Subtracts `step` to the current `value`.\n\t */\n\tonDecrement(): void {\n\t\tif (this.min === null || this.value - this.step >= this.min) {\n\t\t\tthis.value -= this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\tgetDecrementLabel(): Observable<string> {\n\t\treturn this._decrementLabel.subject;\n\t}\n\n\tgetIncrementLabel(): Observable<string> {\n\t\treturn this._incrementLabel.subject;\n\t}\n\n\t/**\n\t * Creates a class of `NumberChange` to emit the change in the `Number`.\n\t */\n\temitChangeEvent(): void {\n\t\tlet event = new NumberChange();\n\t\tevent.source = this;\n\t\tevent.value = this.value;\n\t\tthis.change.emit(event);\n\t\tthis.propagateChange(this.value);\n\t}\n\n\tonNumberInputChange(event) {\n\t\tthis.value = event.target.value;\n\t\tthis.emitChangeEvent();\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\thandleFocus(event: FocusEvent) {\n\t\tif (\"type\" in event.target && (<HTMLInputElement>event.target).type === \"button\") {\n\t\t\tthis._isFocused = false;\n\t\t} else {\n\t\t\tthis._isFocused = event.type === \"focus\";\n\t\t}\n\t}\n}\nexport { NumberComponent as Number };\n",
|
|
38935
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tHostBinding,\n\tEventEmitter,\n\tOutput,\n\tTemplateRef,\n\tHostListener\n} from \"@angular/core\";\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from \"@angular/forms\";\n\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Used to emit changes performed on number input components.\n */\nexport class NumberChange {\n\t/**\n\t * Contains the `Number` that has been changed.\n\t */\n\tsource: NumberComponent;\n\t/**\n\t * The value of the `Number` field encompassed in the `NumberChange` class.\n\t */\n\tvalue: number;\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { NumberModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-number--basic)\n */\n@Component({\n\tselector: \"cds-number, ibm-number\",\n\ttemplate: `\n\t\t<label *ngIf=\"skeleton && label\" class=\"cds--label cds--skeleton\"></label>\n\t\t<div\n\t\t\tdata-numberinput\n\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\"\n\t\t\tclass=\"cds--number\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--number--light': theme === 'light',\n\t\t\t\t'cds--number--nolabel': !label,\n\t\t\t\t'cds--number--helpertext': helperText,\n\t\t\t\t'cds--skeleton' : skeleton,\n\t\t\t\t'cds--number--sm': size === 'sm',\n\t\t\t\t'cds--number--md': size === 'md',\n\t\t\t\t'cds--number--lg': size === 'lg'\n\t\t\t}\">\n\t\t\t<label\n\t\t\t\t*ngIf=\"!skeleton && label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{'cds--label--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\tclass=\"cds--number__input-wrapper\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--number__input-wrapper--warning': warn\n\t\t\t\t}\">\n\t\t\t\t<input\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t[value]=\"value\"\n\t\t\t\t\t[attr.min]=\"min\"\n\t\t\t\t\t[attr.max]=\"max\"\n\t\t\t\t\t[attr.step]=\"step\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[required]=\"required\"\n\t\t\t\t\t[attr.aria-label]=\"ariaLabel\"\n\t\t\t\t\t[attr.data-invalid]=\"invalid ? invalid : null\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t(focus)=\"fluid ? handleFocus($event): null\"\n\t\t\t\t\t(blur)=\"fluid ? handleFocus($event): null\"\n\t\t\t\t\t(change)=\"onNumberInputChange($event)\"/>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && invalid\"\n\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid\">\n\t\t\t\t</svg>\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton && !invalid && warn\"\n\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\tclass=\"cds--number__invalid cds--number__invalid--warning\">\n\t\t\t\t</svg>\n\t\t\t\t<div *ngIf=\"!skeleton\" class=\"cds--number__controls\">\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn down-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getDecrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onDecrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"subtract\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t\t<button\n\t\t\t\t\t\tclass=\"cds--number__control-btn up-icon\"\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t[attr.disabled]=\"disabled ? true : null\"\n\t\t\t\t\t\taria-live=\"polite\"\n\t\t\t\t\t\taria-atomic=\"true\"\n\t\t\t\t\t\t[attr.aria-label]=\"getIncrementLabel() | async\"\n\t\t\t\t\t\t(click)=\"onIncrement()\">\n\t\t\t\t\t\t<svg cdsIcon=\"add\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t\t<div class=\"cds--number__rule-divider\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<hr *ngIf=\"fluid\" class=\"cds--number-input__divider\" />\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn && !fluid\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{invalidText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: NumberComponent,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class NumberComponent implements ControlValueAccessor {\n\t/**\n\t * Variable used for creating unique ids for number input components.\n\t */\n\tstatic numberCount = 0;\n\n\t@HostBinding(\"class.cds--form-item\") containerClass = true;\n\n\t/**\n\t * Set to `true` for readonly state.\n\t */\n\t@Input() @HostBinding(\"class.cds--number--readonly\") readonly = false;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` number input theme.\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Set to `true` for a disabled number input.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a loading number component.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for an invalid number component.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * The unique id for the number component.\n\t */\n\t@Input() id = `number-${NumberComponent.numberCount}`;\n\t/**\n\t * Sets the placeholder attribute on the `input` element.\n\t */\n\t@Input() placeholder = \"\";\n\t/**\n\t * Number input field render size\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Reflects the required attribute of the `input` element.\n\t */\n\t@Input() required: boolean;\n\t/**\n\t * Sets the value attribute on the `input` element.\n\t */\n\t@Input() set value(v: any) {\n\t\tif (v === \"\" || v === null) {\n\t\t\tthis._value = null;\n\t\t\treturn;\n\t\t}\n\t\tthis._value = Number(v);\n\t}\n\n\tget value() {\n\t\treturn this._value;\n\t}\n\t/**\n\t * Sets the min attribute on the `input` element.\n\t */\n\t@Input() min = null;\n\t/**\n\t * Sets the max attribute on the `input` element.\n\t */\n\t@Input() max = null;\n\t/**\n\t * Sets the text inside the `label` tag.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * Sets the invalid text.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Sets the amount the number controls increment and decrement by.\n\t */\n\t@Input() step = 1;\n\t/**\n\t * If `step` is a decimal, we may want precision to be set to go around floating point precision.\n\t */\n\t@Input() precision: number;\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\t/**\n\t * Sets the arialabel for input\n\t */\n\t@Input() ariaLabel: string;\n\t/**\n\t * Emits event notifying other classes when a change in state occurs in the input.\n\t */\n\t@Output() change = new EventEmitter<NumberChange>();\n\n\t@Input()\n\tset decrementLabel(value: string | Observable<string>) {\n\t\tthis._decrementLabel.override(value);\n\t}\n\n\tget decrementLabel() {\n\t\treturn this._decrementLabel.value;\n\t}\n\n\t@Input()\n\tset incrementLabel(value: string | Observable<string>) {\n\t\tthis._incrementLabel.override(value);\n\t}\n\n\tget incrementLabel() {\n\t\treturn this._incrementLabel.value;\n\t}\n\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@HostBinding(\"class.cds--number-input--fluid\") @Input() fluid = false;\n\n\t@HostBinding(\"class.cds--number-input--fluid--invalid\") get fluidInvalid() {\n\t\treturn this.fluid && this.invalid;\n\t}\n\n\t@HostBinding(\"class.cds--number-input--fluid--disabled\") get fluidDisabled() {\n\t\treturn this.fluid && this.disabled;\n\t}\n\n\t@HostBinding(\"class.cds--number-input--fluid--focus\") get fluidFocus() {\n\t\treturn this.fluid && this._isFocused;\n\t}\n\n\t@HostBinding(\"class.cds--text-input--fluid__skeleton\") get fluidSkeleton() {\n\t\treturn this.fluid && this.skeleton;\n\t}\n\n\tprotected _isFocused = false;\n\n\tprotected _value = 0;\n\n\tprotected _decrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.DECREMENT\");\n\tprotected _incrementLabel: Overridable = this.i18n.getOverridable(\"NUMBER.INCREMENT\");\n\n\t/**\n\t * Creates an instance of `Number`.\n\t */\n\tconstructor(protected i18n: I18n) {\n\t\tNumberComponent.numberCount++;\n\t}\n\n\t/**\n\t * This is the initial value set to the component\n\t * @param value The input value.\n\t */\n\tpublic writeValue(value: any) {\n\t\tthis.value = value;\n\t}\n\n\t/**\n\t * Sets a method in order to propagate changes back to the form.\n\t */\n\tpublic registerOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registers a callback to be triggered when the control has been touched.\n\t * @param fn Callback to be triggered when the number input is touched.\n\t */\n\tpublic registerOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\t@HostListener(\"focusout\")\n\tfocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Sets the disabled state through the model\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called when number input is blurred. Needed to properly implement `ControlValueAccessor`.\n\t */\n\tonTouched: () => any = () => { };\n\n\t/**\n\t * Method set in `registerOnChange` to propagate changes back to the form.\n\t */\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * Adds `step` to the current `value`.\n\t */\n\tonIncrement(): void {\n\t\t// if max is set and value + step is greater than max, set value to max\n\t\t// example: max = 100, step = 10, value = 95 , value + step = 105, value will be set to 100 (max) instead of 105\n\t\tif (this.max !== null && this.value + this.step > this.max) {\n\t\t\tthis.value = this.max;\n\t\t\tthis.emitChangeEvent();\n\t\t\treturn;\n\t\t}\n\n\t\t// if min is set and value + step is less than min, set value to min\n\t\t// example: min = 5, step = 2, value = 0, value + step = 2, value will be set to 5 (min) instead of 2\n\t\tif (this.min !== null && this.value + this.step < this.min) {\n\t\t\tthis.value = this.min;\n\t\t\tthis.emitChangeEvent();\n\t\t\treturn;\n\t\t}\n\n\t\t// if max is not set or value + step is less than max, increment value by step\n\t\tif (this.max === null || this.value + this.step <= this.max) {\n\t\t\tthis.value += this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\t/**\n\t * Subtracts `step` to the current `value`.\n\t */\n\tonDecrement(): void {\n\t\t// if max is set and value - step is greater than max, set value to max\n\t\t// example: max = 15, step = 2, value = 20, value - step = 18, value will be set to 15 (max) instead of 18\n\t\tif (this.max !== null && this.value - this.step > this.max) {\n\t\t\tthis.value = this.max;\n\t\t\tthis.emitChangeEvent();\n\t\t\treturn;\n\t\t}\n\n\t\t// if min is set and value - step is less than min, set value to min\n\t\t// example: min = 5, step = 2, value = 6, value - step = 4, value will be set to 5 (min) instead of 4\n\t\tif (this.min !== null && this.value - this.step < this.min) {\n\t\t\tthis.value = this.min;\n\t\t\tthis.emitChangeEvent();\n\t\t\treturn;\n\t\t}\n\n\t\t// if min is not set or value - step is greater than min, decrement value by step\n\t\tif (this.min === null || this.value - this.step >= this.min) {\n\t\t\tthis.value -= this.step;\n\t\t\tthis.value = parseFloat(this.value.toPrecision(this.precision));\n\t\t\tthis.emitChangeEvent();\n\t\t}\n\t}\n\n\tgetDecrementLabel(): Observable<string> {\n\t\treturn this._decrementLabel.subject;\n\t}\n\n\tgetIncrementLabel(): Observable<string> {\n\t\treturn this._incrementLabel.subject;\n\t}\n\n\t/**\n\t * Creates a class of `NumberChange` to emit the change in the `Number`.\n\t */\n\temitChangeEvent(): void {\n\t\tlet event = new NumberChange();\n\t\tevent.source = this;\n\t\tevent.value = this.value;\n\t\tthis.change.emit(event);\n\t\tthis.propagateChange(this.value);\n\t}\n\n\tonNumberInputChange(event) {\n\t\tthis.value = event.target.value;\n\t\tthis.emitChangeEvent();\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\thandleFocus(event: FocusEvent) {\n\t\tif (\"type\" in event.target && (<HTMLInputElement>event.target).type === \"button\") {\n\t\t\tthis._isFocused = false;\n\t\t} else {\n\t\t\tthis._isFocused = event.type === \"focus\";\n\t\t}\n\t}\n}\nexport { NumberComponent as Number };\n",
|
|
38936
38936
|
"assetsDirs": [],
|
|
38937
38937
|
"styleUrlsData": "",
|
|
38938
38938
|
"stylesData": "",
|
|
@@ -41620,7 +41620,7 @@
|
|
|
41620
41620
|
},
|
|
41621
41621
|
{
|
|
41622
41622
|
"name": "PaginationNav",
|
|
41623
|
-
"id": "component-PaginationNav-
|
|
41623
|
+
"id": "component-PaginationNav-02747b3f02dda4195eb9b8d17de227f10ddb93cd71d7303c3e81567547ccb446b5f32191b820b258e4c180ac7d7172629000d09893bd3b623c8f47837e111b52",
|
|
41624
41624
|
"file": "src/pagination/pagination-nav/pagination-nav.component.ts",
|
|
41625
41625
|
"encapsulation": [],
|
|
41626
41626
|
"entryComponents": [],
|
|
@@ -41630,7 +41630,7 @@
|
|
|
41630
41630
|
"selector": "cds-pagination-nav, ibm-pagination-navm",
|
|
41631
41631
|
"styleUrls": [],
|
|
41632
41632
|
"styles": [],
|
|
41633
|
-
"template": "<div>\n\t<div class=\"cds--pagination-nav\">\n\t\t<ul class=\"cds--pagination-nav__list\">\n\t\t\t<li class=\"cds--pagination-nav__list-item\">\n\t\t\t\t<cds-icon-button\n\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\
|
|
41633
|
+
"template": "<div>\n\t<div class=\"cds--pagination-nav\">\n\t\t<ul class=\"cds--pagination-nav__list\">\n\t\t\t<li class=\"cds--pagination-nav__list-item\">\n\t\t\t\t<cds-icon-button\n\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t(click)=\"jumpToPrevious()\"\n\t\t\t\t\t[disabled]=\"leftArrowDisabled\"\n\t\t\t\t\t[description]=\"previousItemText.subject | async\">\n\t\t\t\t\t<svg\n\t\t\t\t\t\tcdsIcon=\"caret--left\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--btn__icon\">\n\t\t\t\t\t</svg>\n\t\t\t\t</cds-icon-button>\n\t\t\t</li>\n\t\t\t<cds-pagination-nav-item\n\t\t\t\t*ngIf=\"this.numOfItemsToShow >= 5 || (this.numOfItemsToShow <= 4 && currentPage <= 1)\"\n\t\t\t\tpage=\"1\"\n\t\t\t\t(click)=\"currentPage = 1\"\n\t\t\t\t[isActive]=\"currentPage == 1\">\n\t\t\t</cds-pagination-nav-item>\n\t\t\t<cds-pagination-overflow\n\t\t\t\t*ngIf=\"frontCuts\"\n\t\t\t\t[count]=\"frontCuts\"\n\t\t\t\t[fromIndex]=\"startOffset\"\n\t\t\t\t(change)=\"handleOverflowSelection($event)\">\n\t\t\t</cds-pagination-overflow>\n\t\t\t<cds-pagination-nav-item\n\t\t\t\t*ngFor=\"let page of getPages();\"\n\t\t\t\t[page]=\"page\"\n\t\t\t\t(click)=\"currentPage = page\"\n\t\t\t\t[isActive]=\"currentPage == page\">\n\t\t\t</cds-pagination-nav-item>\n\t\t\t<cds-pagination-overflow\n\t\t\t\t*ngIf=\"backCuts\"\n\t\t\t\t[count]=\"backCuts\"\n\t\t\t\t[fromIndex]=\"totalNumbersArray.length - backCuts - 1\"\n\t\t\t\t(change)=\"handleOverflowSelection($event)\">\n\t\t\t</cds-pagination-overflow>\n\t\t\t<cds-pagination-nav-item\n\t\t\t\t*ngIf=\"totalDataLength > 1\"\n\t\t\t\t[page]=\"totalNumbersArray.length\"\n\t\t\t\t(click)=\"currentPage = totalNumbersArray.length\"\n\t\t\t\t[isActive]=\"currentPage == totalNumbersArray.length\">\n\t\t\t</cds-pagination-nav-item>\n\t\t\t<li class=\"cds--pagination-nav__list-item\">\n\t\t\t\t<cds-icon-button\n\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t(click)=\"jumpToNext()\"\n\t\t\t\t\t[disabled]=\"rightArrowDisabled\"\n\t\t\t\t\t[description]=\"nextItemText.subject | async\">\n\t\t\t\t\t<svg\n\t\t\t\t\t\tcdsIcon=\"caret--right\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--btn__icon\">\n\t\t\t\t\t</svg>\n\t\t\t\t</cds-icon-button>\n\t\t\t</li>\n\t\t</ul>\n\t</div>\n</div>\n",
|
|
41634
41634
|
"templateUrl": [],
|
|
41635
41635
|
"viewProviders": [],
|
|
41636
41636
|
"hostDirectives": [],
|
|
@@ -41642,7 +41642,7 @@
|
|
|
41642
41642
|
"deprecationMessage": "",
|
|
41643
41643
|
"rawdescription": "\n\nSet to `true` to disable the backward/forward buttons.\n",
|
|
41644
41644
|
"description": "<p>Set to <code>true</code> to disable the backward/forward buttons.</p>\n",
|
|
41645
|
-
"line":
|
|
41645
|
+
"line": 124,
|
|
41646
41646
|
"type": "boolean",
|
|
41647
41647
|
"decorators": []
|
|
41648
41648
|
},
|
|
@@ -41652,7 +41652,7 @@
|
|
|
41652
41652
|
"deprecationMessage": "",
|
|
41653
41653
|
"rawdescription": "\n\n`PaginationNavModel` with the information about pages you're controlling.\n",
|
|
41654
41654
|
"description": "<p><code>PaginationNavModel</code> with the information about pages you're controlling.</p>\n",
|
|
41655
|
-
"line":
|
|
41655
|
+
"line": 120,
|
|
41656
41656
|
"type": "PaginationModel",
|
|
41657
41657
|
"decorators": []
|
|
41658
41658
|
},
|
|
@@ -41663,17 +41663,28 @@
|
|
|
41663
41663
|
"deprecationMessage": "",
|
|
41664
41664
|
"rawdescription": "\n\nNumber of items to show in pagination. Minimum is 4.\n",
|
|
41665
41665
|
"description": "<p>Number of items to show in pagination. Minimum is 4.</p>\n",
|
|
41666
|
-
"line":
|
|
41666
|
+
"line": 128,
|
|
41667
41667
|
"type": "number",
|
|
41668
41668
|
"decorators": []
|
|
41669
41669
|
},
|
|
41670
|
+
{
|
|
41671
|
+
"name": "size",
|
|
41672
|
+
"defaultValue": "\"lg\"",
|
|
41673
|
+
"deprecated": false,
|
|
41674
|
+
"deprecationMessage": "",
|
|
41675
|
+
"rawdescription": "\n\nSets the pagination nav size\n",
|
|
41676
|
+
"description": "<p>Sets the pagination nav size</p>\n",
|
|
41677
|
+
"line": 149,
|
|
41678
|
+
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
41679
|
+
"decorators": []
|
|
41680
|
+
},
|
|
41670
41681
|
{
|
|
41671
41682
|
"name": "translations",
|
|
41672
41683
|
"deprecated": false,
|
|
41673
41684
|
"deprecationMessage": "",
|
|
41674
41685
|
"rawdescription": "\n\nExpects an object that contains some or all of:\n```\n{\n\t\t\"NEXT\": \"Next\",\n\t\t\"PREVIOUS\": \"Previous\",\n}\n```\n",
|
|
41675
41686
|
"description": "<p>Expects an object that contains some or all of:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-none\">{\n "NEXT": "Next",\n "PREVIOUS": "Previous",\n}</code></pre></div>",
|
|
41676
|
-
"line":
|
|
41687
|
+
"line": 140,
|
|
41677
41688
|
"type": "PaginationNavTranslations",
|
|
41678
41689
|
"decorators": []
|
|
41679
41690
|
}
|
|
@@ -41686,7 +41697,7 @@
|
|
|
41686
41697
|
"deprecationMessage": "",
|
|
41687
41698
|
"rawdescription": "\n\nEmits the new page number.\n\nYou should tie into this and update `model.currentPage` once the fresh\ndata is finally loaded.\n",
|
|
41688
41699
|
"description": "<p>Emits the new page number.</p>\n<p>You should tie into this and update <code>model.currentPage</code> once the fresh\ndata is finally loaded.</p>\n",
|
|
41689
|
-
"line":
|
|
41700
|
+
"line": 168,
|
|
41690
41701
|
"type": "EventEmitter"
|
|
41691
41702
|
}
|
|
41692
41703
|
],
|
|
@@ -41699,7 +41710,7 @@
|
|
|
41699
41710
|
"type": "",
|
|
41700
41711
|
"optional": false,
|
|
41701
41712
|
"description": "",
|
|
41702
|
-
"line":
|
|
41713
|
+
"line": 211
|
|
41703
41714
|
},
|
|
41704
41715
|
{
|
|
41705
41716
|
"name": "paginationCounter",
|
|
@@ -41709,7 +41720,7 @@
|
|
|
41709
41720
|
"type": "number",
|
|
41710
41721
|
"optional": false,
|
|
41711
41722
|
"description": "",
|
|
41712
|
-
"line":
|
|
41723
|
+
"line": 116,
|
|
41713
41724
|
"modifierKind": [
|
|
41714
41725
|
126
|
|
41715
41726
|
]
|
|
@@ -41722,7 +41733,7 @@
|
|
|
41722
41733
|
"type": "",
|
|
41723
41734
|
"optional": false,
|
|
41724
41735
|
"description": "",
|
|
41725
|
-
"line":
|
|
41736
|
+
"line": 212
|
|
41726
41737
|
}
|
|
41727
41738
|
],
|
|
41728
41739
|
"methodsClass": [
|
|
@@ -41732,7 +41743,7 @@
|
|
|
41732
41743
|
"optional": false,
|
|
41733
41744
|
"returnType": "any",
|
|
41734
41745
|
"typeParameters": [],
|
|
41735
|
-
"line":
|
|
41746
|
+
"line": 232,
|
|
41736
41747
|
"deprecated": false,
|
|
41737
41748
|
"deprecationMessage": "",
|
|
41738
41749
|
"modifierKind": [
|
|
@@ -41752,7 +41763,7 @@
|
|
|
41752
41763
|
"optional": false,
|
|
41753
41764
|
"returnType": "void",
|
|
41754
41765
|
"typeParameters": [],
|
|
41755
|
-
"line":
|
|
41766
|
+
"line": 218,
|
|
41756
41767
|
"deprecated": false,
|
|
41757
41768
|
"deprecationMessage": "",
|
|
41758
41769
|
"jsdoctags": [
|
|
@@ -41773,7 +41784,7 @@
|
|
|
41773
41784
|
"optional": false,
|
|
41774
41785
|
"returnType": "void",
|
|
41775
41786
|
"typeParameters": [],
|
|
41776
|
-
"line":
|
|
41787
|
+
"line": 224,
|
|
41777
41788
|
"deprecated": false,
|
|
41778
41789
|
"deprecationMessage": "",
|
|
41779
41790
|
"modifierKind": [
|
|
@@ -41786,7 +41797,7 @@
|
|
|
41786
41797
|
"optional": false,
|
|
41787
41798
|
"returnType": "void",
|
|
41788
41799
|
"typeParameters": [],
|
|
41789
|
-
"line":
|
|
41800
|
+
"line": 228,
|
|
41790
41801
|
"deprecated": false,
|
|
41791
41802
|
"deprecationMessage": "",
|
|
41792
41803
|
"modifierKind": [
|
|
@@ -41796,14 +41807,39 @@
|
|
|
41796
41807
|
],
|
|
41797
41808
|
"deprecated": false,
|
|
41798
41809
|
"deprecationMessage": "",
|
|
41799
|
-
"hostBindings": [
|
|
41810
|
+
"hostBindings": [
|
|
41811
|
+
{
|
|
41812
|
+
"name": "class.cds--layout--size-lg",
|
|
41813
|
+
"deprecated": false,
|
|
41814
|
+
"deprecationMessage": "",
|
|
41815
|
+
"line": 158,
|
|
41816
|
+
"type": "boolean",
|
|
41817
|
+
"decorators": []
|
|
41818
|
+
},
|
|
41819
|
+
{
|
|
41820
|
+
"name": "class.cds--layout--size-md",
|
|
41821
|
+
"deprecated": false,
|
|
41822
|
+
"deprecationMessage": "",
|
|
41823
|
+
"line": 155,
|
|
41824
|
+
"type": "boolean",
|
|
41825
|
+
"decorators": []
|
|
41826
|
+
},
|
|
41827
|
+
{
|
|
41828
|
+
"name": "class.cds--layout--size-sm",
|
|
41829
|
+
"deprecated": false,
|
|
41830
|
+
"deprecationMessage": "",
|
|
41831
|
+
"line": 152,
|
|
41832
|
+
"type": "boolean",
|
|
41833
|
+
"decorators": []
|
|
41834
|
+
}
|
|
41835
|
+
],
|
|
41800
41836
|
"hostListeners": [],
|
|
41801
41837
|
"standalone": false,
|
|
41802
41838
|
"imports": [],
|
|
41803
41839
|
"description": "<p>Use pagination when you have multiple pages of data to handle. Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { PaginationModule } from 'carbon-components-angular';</code></pre></div><b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-html\"><cds-pagination-nav [model]="model" (selectPage)="selectPage($event)"></cds-pagination-nav></code></pre></div><p>In your <code>selectPage()</code> method set the <code>model.currentPage</code> to selected page, <em>after</em>\nyou load the page.</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">selectPage(page) {\n // ... your code to load the page goes here\n\n this.model.currentPage = page;\n\n // ... anything you want to do after page selection changes goes here\n}</code></pre></div><p><a href=\"../../?path=/story/components-pagination-nav--basic\">See demo</a></p>\n",
|
|
41804
41840
|
"rawdescription": "\n\nUse pagination when you have multiple pages of data to handle. Get started with importing the module:\n\n```typescript\nimport { PaginationModule } from 'carbon-components-angular';\n```\n\n```html\n<cds-pagination-nav [model]=\"model\" (selectPage)=\"selectPage($event)\"></cds-pagination-nav>\n```\n\nIn your `selectPage()` method set the `model.currentPage` to selected page, _after_\nyou load the page.\n\n```typescript\nselectPage(page) {\n\t// ... your code to load the page goes here\n\n\tthis.model.currentPage = page;\n\n\t// ... anything you want to do after page selection changes goes here\n}\n```\n\n[See demo](../../?path=/story/components-pagination-nav--basic)\n",
|
|
41805
41841
|
"type": "component",
|
|
41806
|
-
"sourceCode": "import { PaginationModel } from \"../pagination-model.class\";\nimport {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter\n} from \"@angular/core\";\n\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { ExperimentalService } from \"carbon-components-angular/experimental\";\nimport { merge } from \"carbon-components-angular/utils\";\nimport { range } from \"carbon-components-angular/common\";\n\nexport interface PaginationNavTranslations {\n\tNEXT: string;\n\tPREVIOUS: string;\n}\n\n/**\n * Use pagination when you have multiple pages of data to handle. Get started with importing the module:\n *\n * ```typescript\n * import { PaginationModule } from 'carbon-components-angular';\n * ```\n *\n * ```html\n * <cds-pagination-nav [model]=\"model\" (selectPage)=\"selectPage($event)\"></cds-pagination-nav>\n * ```\n *\n * In your `selectPage()` method set the `model.currentPage` to selected page, _after_\n * you load the page.\n *\n * ```typescript\n * selectPage(page) {\n * \t// ... your code to load the page goes here\n *\n * \tthis.model.currentPage = page;\n *\n * \t// ... anything you want to do after page selection changes goes here\n * }\n * ```\n *\n * [See demo](../../?path=/story/components-pagination-nav--basic)\n */\n@Component({\n\tselector: \"cds-pagination-nav, ibm-pagination-navm\",\n\ttemplate: `\n\t<div>\n\t\t<div class=\"cds--pagination-nav\">\n\t\t\t<ul class=\"cds--pagination-nav__list\">\n\t\t\t\t<li class=\"cds--pagination-nav__list-item\">\n\t\t\t\t\t<cds-icon-button\n\t\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t\
|
|
41842
|
+
"sourceCode": "import { PaginationModel } from \"../pagination-model.class\";\nimport {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tHostBinding\n} from \"@angular/core\";\n\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { ExperimentalService } from \"carbon-components-angular/experimental\";\nimport { merge } from \"carbon-components-angular/utils\";\nimport { range } from \"carbon-components-angular/common\";\n\nexport interface PaginationNavTranslations {\n\tNEXT: string;\n\tPREVIOUS: string;\n}\n\n/**\n * Use pagination when you have multiple pages of data to handle. Get started with importing the module:\n *\n * ```typescript\n * import { PaginationModule } from 'carbon-components-angular';\n * ```\n *\n * ```html\n * <cds-pagination-nav [model]=\"model\" (selectPage)=\"selectPage($event)\"></cds-pagination-nav>\n * ```\n *\n * In your `selectPage()` method set the `model.currentPage` to selected page, _after_\n * you load the page.\n *\n * ```typescript\n * selectPage(page) {\n * \t// ... your code to load the page goes here\n *\n * \tthis.model.currentPage = page;\n *\n * \t// ... anything you want to do after page selection changes goes here\n * }\n * ```\n *\n * [See demo](../../?path=/story/components-pagination-nav--basic)\n */\n@Component({\n\tselector: \"cds-pagination-nav, ibm-pagination-navm\",\n\ttemplate: `\n\t<div>\n\t\t<div class=\"cds--pagination-nav\">\n\t\t\t<ul class=\"cds--pagination-nav__list\">\n\t\t\t\t<li class=\"cds--pagination-nav__list-item\">\n\t\t\t\t\t<cds-icon-button\n\t\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t\t(click)=\"jumpToPrevious()\"\n\t\t\t\t\t\t[disabled]=\"leftArrowDisabled\"\n\t\t\t\t\t\t[description]=\"previousItemText.subject | async\">\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tcdsIcon=\"caret--left\"\n\t\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\t\tclass=\"cds--btn__icon\">\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</cds-icon-button>\n\t\t\t\t</li>\n\t\t\t\t<cds-pagination-nav-item\n\t\t\t\t\t*ngIf=\"this.numOfItemsToShow >= 5 || (this.numOfItemsToShow <= 4 && currentPage <= 1)\"\n\t\t\t\t\tpage=\"1\"\n\t\t\t\t\t(click)=\"currentPage = 1\"\n\t\t\t\t\t[isActive]=\"currentPage == 1\">\n\t\t\t\t</cds-pagination-nav-item>\n\t\t\t\t<cds-pagination-overflow\n\t\t\t\t\t*ngIf=\"frontCuts\"\n\t\t\t\t\t[count]=\"frontCuts\"\n\t\t\t\t\t[fromIndex]=\"startOffset\"\n\t\t\t\t\t(change)=\"handleOverflowSelection($event)\">\n\t\t\t\t</cds-pagination-overflow>\n\t\t\t\t<cds-pagination-nav-item\n\t\t\t\t\t*ngFor=\"let page of getPages();\"\n\t\t\t\t\t[page]=\"page\"\n\t\t\t\t\t(click)=\"currentPage = page\"\n\t\t\t\t\t[isActive]=\"currentPage == page\">\n\t\t\t\t</cds-pagination-nav-item>\n\t\t\t\t<cds-pagination-overflow\n\t\t\t\t\t*ngIf=\"backCuts\"\n\t\t\t\t\t[count]=\"backCuts\"\n\t\t\t\t\t[fromIndex]=\"totalNumbersArray.length - backCuts - 1\"\n\t\t\t\t\t(change)=\"handleOverflowSelection($event)\">\n\t\t\t\t</cds-pagination-overflow>\n\t\t\t\t<cds-pagination-nav-item\n\t\t\t\t\t*ngIf=\"totalDataLength > 1\"\n\t\t\t\t\t[page]=\"totalNumbersArray.length\"\n\t\t\t\t\t(click)=\"currentPage = totalNumbersArray.length\"\n\t\t\t\t\t[isActive]=\"currentPage == totalNumbersArray.length\">\n\t\t\t\t</cds-pagination-nav-item>\n\t\t\t\t<li class=\"cds--pagination-nav__list-item\">\n\t\t\t\t\t<cds-icon-button\n\t\t\t\t\t\tkind=\"ghost\"\n\t\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t\t(click)=\"jumpToNext()\"\n\t\t\t\t\t\t[disabled]=\"rightArrowDisabled\"\n\t\t\t\t\t\t[description]=\"nextItemText.subject | async\">\n\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\tcdsIcon=\"caret--right\"\n\t\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\t\tclass=\"cds--btn__icon\">\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t</cds-icon-button>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t</div>\n\t</div>\n\t`\n})\nexport class PaginationNav {\n\tstatic paginationCounter = 0;\n\t/**\n\t * `PaginationNavModel` with the information about pages you're controlling.\n\t */\n\t@Input() model: PaginationModel;\n\t/**\n\t * Set to `true` to disable the backward/forward buttons.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Number of items to show in pagination. Minimum is 4.\n\t */\n\t@Input() numOfItemsToShow = 4;\n\n\t/**\n\t * Expects an object that contains some or all of:\n\t * ```\n\t * {\n\t *\t\t\"NEXT\": \"Next\",\n\t *\t\t\"PREVIOUS\": \"Previous\",\n\t * }\n\t * ```\n\t */\n\t@Input()\n\tset translations(value: PaginationNavTranslations) {\n\t\tconst valueWithDefaults = merge(this.i18n.getMultiple(\"PAGINATION\"), value);\n\t\tthis.nextItemText.override(valueWithDefaults.NEXT);\n\t\tthis.previousItemText.override(valueWithDefaults.PREVIOUS);\n\t}\n\n\t/**\n\t * Sets the pagination nav size\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"lg\";\n\n\t// Size\n\t@HostBinding(\"class.cds--layout--size-sm\") get smallLayoutSize() {\n\t\treturn this.size === \"sm\";\n\t}\n\t@HostBinding(\"class.cds--layout--size-md\") get mediumLayoutSize() {\n\t\treturn this.size === \"md\";\n\t}\n\t@HostBinding(\"class.cds--layout--size-lg\") get largeLayoutSize() {\n\t\treturn this.size === \"lg\";\n\t}\n\n\t/**\n\t * Emits the new page number.\n\t *\n\t * You should tie into this and update `model.currentPage` once the fresh\n\t * data is finally loaded.\n\t */\n\t@Output() selectPage = new EventEmitter<number>();\n\n\tget totalNumbersArray() {\n\t\treturn range(this.totalDataLength + 1, 1);\n\t}\n\n\tget currentPage() {\n\t\treturn this.model.currentPage;\n\t}\n\n\tset currentPage(value) {\n\t\tvalue = Number(value);\n\t\t// emits the value to allow the user to update current page\n\t\t// in the model once the page is loaded\n\t\tthis.selectPage.emit(value);\n\t}\n\n\tget totalDataLength() {\n\t\treturn this.model.totalDataLength;\n\t}\n\n\tget startOffset() {\n\t\treturn this.numOfItemsToShow <= 4 && this.currentPage > 1 ? 0 : 1;\n\t}\n\n\tget frontCuts() {\n\t\tconst cuts = this.getCuts();\n\t\treturn cuts.front;\n\t}\n\n\tget backCuts() {\n\t\tconst cuts = this.getCuts();\n\t\treturn cuts.back;\n\t}\n\n\tget leftArrowDisabled() {\n\t\treturn this.disabled || this.currentPage === 1;\n\t}\n\n\tget rightArrowDisabled() {\n\t\treturn this.disabled || this.currentPage === this.totalDataLength;\n\t}\n\n\tnextItemText = this.i18n.getOverridable(\"PAGINATION.NEXT\");\n\tpreviousItemText = this.i18n.getOverridable(\"PAGINATION.PREVIOUS\");\n\n\tconstructor(protected i18n: I18n, protected experimental: ExperimentalService) {\n\t\tPaginationNav.paginationCounter++;\n\t}\n\n\thandleOverflowSelection(page) {\n\t\tif (typeof page === \"number\") {\n\t\t\tthis.currentPage = page;\n\t\t}\n\t}\n\n\tpublic jumpToNext() {\n\t\tthis.currentPage = this.currentPage < this.totalDataLength ? this.currentPage + 1 : this.totalDataLength;\n\t}\n\n\tpublic jumpToPrevious() {\n\t\tthis.currentPage = this.currentPage > 1 ? this.currentPage - 1 : 1;\n\t}\n\n\tpublic getPages() {\n\t\tif (this.totalDataLength <= 1) {\n\t\t\treturn null;\n\t\t}\n\t\tconst cuts = this.getCuts();\n\t\treturn this.totalNumbersArray.slice(this.startOffset + cuts.front, (1 + cuts.back) * -1);\n\t}\n\n\tprivate getCuts(splitPoint = null) {\n\t\tconst page = this.currentPage - 1;\n\t\tconst totalItems = this.totalDataLength;\n\t\tconst itemsThatFit = this.numOfItemsToShow;\n\n\t\tif (itemsThatFit >= totalItems) {\n\t\t\treturn {\n\t\t\t\tfront: 0,\n\t\t\t\tback: 0\n\t\t\t};\n\t\t}\n\t\tconst split = splitPoint || Math.ceil(itemsThatFit / 2) - 1;\n\t\tlet frontHidden = page + 1 - split;\n\t\tlet backHidden = totalItems - page - (itemsThatFit - split) + 1;\n\n\t\tif (frontHidden <= 1) {\n\t\t\tbackHidden -= frontHidden <= 0 ? Math.abs(frontHidden) + 1 : 0;\n\t\t\tfrontHidden = 0;\n\t\t}\n\t\tif (backHidden <= 1) {\n\t\t\tfrontHidden -= backHidden <= 0 ? Math.abs(backHidden) + 1 : 0;\n\t\t\tbackHidden = 0;\n\t\t}\n\t\treturn {\n\t\t\tfront: frontHidden,\n\t\t\tback: backHidden\n\t\t};\n\t}\n}\n",
|
|
41807
41843
|
"assetsDirs": [],
|
|
41808
41844
|
"styleUrlsData": "",
|
|
41809
41845
|
"stylesData": "",
|
|
@@ -41826,7 +41862,7 @@
|
|
|
41826
41862
|
"deprecationMessage": ""
|
|
41827
41863
|
}
|
|
41828
41864
|
],
|
|
41829
|
-
"line":
|
|
41865
|
+
"line": 212,
|
|
41830
41866
|
"jsdoctags": [
|
|
41831
41867
|
{
|
|
41832
41868
|
"name": "i18n",
|
|
@@ -41866,7 +41902,7 @@
|
|
|
41866
41902
|
}
|
|
41867
41903
|
],
|
|
41868
41904
|
"returnType": "void",
|
|
41869
|
-
"line":
|
|
41905
|
+
"line": 140,
|
|
41870
41906
|
"rawdescription": "\n\nExpects an object that contains some or all of:\n```\n{\n\t\t\"NEXT\": \"Next\",\n\t\t\"PREVIOUS\": \"Previous\",\n}\n```\n",
|
|
41871
41907
|
"description": "<p>Expects an object that contains some or all of:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-none\">{\n "NEXT": "Next",\n "PREVIOUS": "Previous",\n}</code></pre></div>",
|
|
41872
41908
|
"jsdoctags": [
|
|
@@ -41882,13 +41918,40 @@
|
|
|
41882
41918
|
]
|
|
41883
41919
|
}
|
|
41884
41920
|
},
|
|
41921
|
+
"smallLayoutSize": {
|
|
41922
|
+
"name": "smallLayoutSize",
|
|
41923
|
+
"getSignature": {
|
|
41924
|
+
"name": "smallLayoutSize",
|
|
41925
|
+
"type": "",
|
|
41926
|
+
"returnType": "",
|
|
41927
|
+
"line": 152
|
|
41928
|
+
}
|
|
41929
|
+
},
|
|
41930
|
+
"mediumLayoutSize": {
|
|
41931
|
+
"name": "mediumLayoutSize",
|
|
41932
|
+
"getSignature": {
|
|
41933
|
+
"name": "mediumLayoutSize",
|
|
41934
|
+
"type": "",
|
|
41935
|
+
"returnType": "",
|
|
41936
|
+
"line": 155
|
|
41937
|
+
}
|
|
41938
|
+
},
|
|
41939
|
+
"largeLayoutSize": {
|
|
41940
|
+
"name": "largeLayoutSize",
|
|
41941
|
+
"getSignature": {
|
|
41942
|
+
"name": "largeLayoutSize",
|
|
41943
|
+
"type": "",
|
|
41944
|
+
"returnType": "",
|
|
41945
|
+
"line": 158
|
|
41946
|
+
}
|
|
41947
|
+
},
|
|
41885
41948
|
"totalNumbersArray": {
|
|
41886
41949
|
"name": "totalNumbersArray",
|
|
41887
41950
|
"getSignature": {
|
|
41888
41951
|
"name": "totalNumbersArray",
|
|
41889
41952
|
"type": "",
|
|
41890
41953
|
"returnType": "",
|
|
41891
|
-
"line":
|
|
41954
|
+
"line": 170
|
|
41892
41955
|
}
|
|
41893
41956
|
},
|
|
41894
41957
|
"currentPage": {
|
|
@@ -41907,7 +41970,7 @@
|
|
|
41907
41970
|
}
|
|
41908
41971
|
],
|
|
41909
41972
|
"returnType": "void",
|
|
41910
|
-
"line":
|
|
41973
|
+
"line": 178,
|
|
41911
41974
|
"jsdoctags": [
|
|
41912
41975
|
{
|
|
41913
41976
|
"name": "value",
|
|
@@ -41924,7 +41987,7 @@
|
|
|
41924
41987
|
"name": "currentPage",
|
|
41925
41988
|
"type": "",
|
|
41926
41989
|
"returnType": "",
|
|
41927
|
-
"line":
|
|
41990
|
+
"line": 174
|
|
41928
41991
|
}
|
|
41929
41992
|
},
|
|
41930
41993
|
"totalDataLength": {
|
|
@@ -41933,7 +41996,7 @@
|
|
|
41933
41996
|
"name": "totalDataLength",
|
|
41934
41997
|
"type": "",
|
|
41935
41998
|
"returnType": "",
|
|
41936
|
-
"line":
|
|
41999
|
+
"line": 185
|
|
41937
42000
|
}
|
|
41938
42001
|
},
|
|
41939
42002
|
"startOffset": {
|
|
@@ -41942,7 +42005,7 @@
|
|
|
41942
42005
|
"name": "startOffset",
|
|
41943
42006
|
"type": "",
|
|
41944
42007
|
"returnType": "",
|
|
41945
|
-
"line":
|
|
42008
|
+
"line": 189
|
|
41946
42009
|
}
|
|
41947
42010
|
},
|
|
41948
42011
|
"frontCuts": {
|
|
@@ -41951,7 +42014,7 @@
|
|
|
41951
42014
|
"name": "frontCuts",
|
|
41952
42015
|
"type": "",
|
|
41953
42016
|
"returnType": "",
|
|
41954
|
-
"line":
|
|
42017
|
+
"line": 193
|
|
41955
42018
|
}
|
|
41956
42019
|
},
|
|
41957
42020
|
"backCuts": {
|
|
@@ -41960,7 +42023,7 @@
|
|
|
41960
42023
|
"name": "backCuts",
|
|
41961
42024
|
"type": "",
|
|
41962
42025
|
"returnType": "",
|
|
41963
|
-
"line":
|
|
42026
|
+
"line": 198
|
|
41964
42027
|
}
|
|
41965
42028
|
},
|
|
41966
42029
|
"leftArrowDisabled": {
|
|
@@ -41969,7 +42032,7 @@
|
|
|
41969
42032
|
"name": "leftArrowDisabled",
|
|
41970
42033
|
"type": "",
|
|
41971
42034
|
"returnType": "",
|
|
41972
|
-
"line":
|
|
42035
|
+
"line": 203
|
|
41973
42036
|
}
|
|
41974
42037
|
},
|
|
41975
42038
|
"rightArrowDisabled": {
|
|
@@ -41978,7 +42041,7 @@
|
|
|
41978
42041
|
"name": "rightArrowDisabled",
|
|
41979
42042
|
"type": "",
|
|
41980
42043
|
"returnType": "",
|
|
41981
|
-
"line":
|
|
42044
|
+
"line": 207
|
|
41982
42045
|
}
|
|
41983
42046
|
}
|
|
41984
42047
|
}
|
|
@@ -42062,7 +42125,7 @@
|
|
|
42062
42125
|
},
|
|
42063
42126
|
{
|
|
42064
42127
|
"name": "PaginationNavStory",
|
|
42065
|
-
"id": "component-PaginationNavStory-
|
|
42128
|
+
"id": "component-PaginationNavStory-82b8f8e304195eef384cf31fbe1fbd130e1484d237aca1ba87a29713634a23a7ee9178947747f33d4eb1186d62e6bfcaac749c07da8ef3386e92b63c27ee2ac7",
|
|
42066
42129
|
"file": "src/pagination/pagination-nav/stories/pagination-nav-story.component.ts",
|
|
42067
42130
|
"encapsulation": [],
|
|
42068
42131
|
"entryComponents": [],
|
|
@@ -42072,7 +42135,7 @@
|
|
|
42072
42135
|
"selector": "app-pagination",
|
|
42073
42136
|
"styleUrls": [],
|
|
42074
42137
|
"styles": [],
|
|
42075
|
-
"template": "<cds-pagination-nav\n\t[model]=\"model\"\n\t[disabled]=\"disabled\"\n\t(selectPage)=\"selectPage($event)\"\n\t[numOfItemsToShow]=\"numOfItemsToShow\">\n</cds-pagination-nav>\n\t",
|
|
42138
|
+
"template": "<cds-pagination-nav\n\t[model]=\"model\"\n\t[disabled]=\"disabled\"\n\t(selectPage)=\"selectPage($event)\"\n\t[numOfItemsToShow]=\"numOfItemsToShow\"\n\t[size]=\"size\">\n</cds-pagination-nav>\n\t",
|
|
42076
42139
|
"templateUrl": [],
|
|
42077
42140
|
"viewProviders": [],
|
|
42078
42141
|
"hostDirectives": [],
|
|
@@ -42082,7 +42145,7 @@
|
|
|
42082
42145
|
"defaultValue": "false",
|
|
42083
42146
|
"deprecated": false,
|
|
42084
42147
|
"deprecationMessage": "",
|
|
42085
|
-
"line":
|
|
42148
|
+
"line": 23,
|
|
42086
42149
|
"type": "boolean",
|
|
42087
42150
|
"decorators": []
|
|
42088
42151
|
},
|
|
@@ -42091,7 +42154,7 @@
|
|
|
42091
42154
|
"defaultValue": "new PaginationModel()",
|
|
42092
42155
|
"deprecated": false,
|
|
42093
42156
|
"deprecationMessage": "",
|
|
42094
|
-
"line":
|
|
42157
|
+
"line": 22,
|
|
42095
42158
|
"type": "any",
|
|
42096
42159
|
"decorators": []
|
|
42097
42160
|
},
|
|
@@ -42100,7 +42163,7 @@
|
|
|
42100
42163
|
"defaultValue": "false",
|
|
42101
42164
|
"deprecated": false,
|
|
42102
42165
|
"deprecationMessage": "",
|
|
42103
|
-
"line":
|
|
42166
|
+
"line": 25,
|
|
42104
42167
|
"type": "boolean",
|
|
42105
42168
|
"decorators": []
|
|
42106
42169
|
},
|
|
@@ -42109,15 +42172,24 @@
|
|
|
42109
42172
|
"defaultValue": "false",
|
|
42110
42173
|
"deprecated": false,
|
|
42111
42174
|
"deprecationMessage": "",
|
|
42112
|
-
"line":
|
|
42175
|
+
"line": 24,
|
|
42113
42176
|
"type": "boolean",
|
|
42114
42177
|
"decorators": []
|
|
42115
42178
|
},
|
|
42116
42179
|
{
|
|
42117
|
-
"name": "
|
|
42180
|
+
"name": "size",
|
|
42181
|
+
"defaultValue": "\"md\"",
|
|
42118
42182
|
"deprecated": false,
|
|
42119
42183
|
"deprecationMessage": "",
|
|
42120
42184
|
"line": 26,
|
|
42185
|
+
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
42186
|
+
"decorators": []
|
|
42187
|
+
},
|
|
42188
|
+
{
|
|
42189
|
+
"name": "totalDataLength",
|
|
42190
|
+
"deprecated": false,
|
|
42191
|
+
"deprecationMessage": "",
|
|
42192
|
+
"line": 28,
|
|
42121
42193
|
"type": "any",
|
|
42122
42194
|
"decorators": []
|
|
42123
42195
|
}
|
|
@@ -42138,7 +42210,7 @@
|
|
|
42138
42210
|
"optional": false,
|
|
42139
42211
|
"returnType": "void",
|
|
42140
42212
|
"typeParameters": [],
|
|
42141
|
-
"line":
|
|
42213
|
+
"line": 39,
|
|
42142
42214
|
"deprecated": false,
|
|
42143
42215
|
"deprecationMessage": "",
|
|
42144
42216
|
"jsdoctags": [
|
|
@@ -42163,7 +42235,7 @@
|
|
|
42163
42235
|
"description": "",
|
|
42164
42236
|
"rawdescription": "\n",
|
|
42165
42237
|
"type": "component",
|
|
42166
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOnInit\n} from \"@angular/core\";\n\nimport { PaginationModel } from \"../..\";\n\n@Component({\n\tselector: \"app-pagination\",\n\ttemplate: `\n\t\t<cds-pagination-nav\n\t\t\t[model]=\"model\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t(selectPage)=\"selectPage($event)\"\n\t\t\t[numOfItemsToShow]=\"numOfItemsToShow\">\n\t\t</cds-pagination-nav>\n\t`\n})\nexport class PaginationNavStory implements OnInit {\n\t@Input() model = new PaginationModel();\n\t@Input() disabled = false;\n\t@Input() pageInputDisabled = false;\n\t@Input() numOfItemsToShow = false;\n\n\t@Input() get totalDataLength() {\n\t\treturn this.model.totalDataLength;\n\t}\n\tset totalDataLength(value) {\n\t\tthis.model.totalDataLength = value;\n\t}\n\n\tngOnInit() {\n\t\tthis.model.currentPage = 1;\n\t}\n\n\tselectPage(page) {\n\t\tconsole.log(\"Loading page\", page, \"from pagination model\");\n\t\tthis.model.currentPage = page;\n\t}\n}\n",
|
|
42238
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOnInit\n} from \"@angular/core\";\n\nimport { PaginationModel } from \"../..\";\n\n@Component({\n\tselector: \"app-pagination\",\n\ttemplate: `\n\t\t<cds-pagination-nav\n\t\t\t[model]=\"model\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t(selectPage)=\"selectPage($event)\"\n\t\t\t[numOfItemsToShow]=\"numOfItemsToShow\"\n\t\t\t[size]=\"size\">\n\t\t</cds-pagination-nav>\n\t`\n})\nexport class PaginationNavStory implements OnInit {\n\t@Input() model = new PaginationModel();\n\t@Input() disabled = false;\n\t@Input() pageInputDisabled = false;\n\t@Input() numOfItemsToShow = false;\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\n\t@Input() get totalDataLength() {\n\t\treturn this.model.totalDataLength;\n\t}\n\tset totalDataLength(value) {\n\t\tthis.model.totalDataLength = value;\n\t}\n\n\tngOnInit() {\n\t\tthis.model.currentPage = 1;\n\t}\n\n\tselectPage(page) {\n\t\tconsole.log(\"Loading page\", page, \"from pagination model\");\n\t\tthis.model.currentPage = page;\n\t}\n}\n",
|
|
42167
42239
|
"assetsDirs": [],
|
|
42168
42240
|
"styleUrlsData": "",
|
|
42169
42241
|
"stylesData": "",
|
|
@@ -42188,7 +42260,7 @@
|
|
|
42188
42260
|
}
|
|
42189
42261
|
],
|
|
42190
42262
|
"returnType": "void",
|
|
42191
|
-
"line":
|
|
42263
|
+
"line": 31,
|
|
42192
42264
|
"jsdoctags": [
|
|
42193
42265
|
{
|
|
42194
42266
|
"name": "value",
|
|
@@ -42205,7 +42277,7 @@
|
|
|
42205
42277
|
"name": "totalDataLength",
|
|
42206
42278
|
"type": "",
|
|
42207
42279
|
"returnType": "",
|
|
42208
|
-
"line":
|
|
42280
|
+
"line": 28
|
|
42209
42281
|
}
|
|
42210
42282
|
}
|
|
42211
42283
|
}
|
|
@@ -44083,7 +44155,7 @@
|
|
|
44083
44155
|
},
|
|
44084
44156
|
{
|
|
44085
44157
|
"name": "ProgressIndicator",
|
|
44086
|
-
"id": "component-ProgressIndicator-
|
|
44158
|
+
"id": "component-ProgressIndicator-44188c869e43c1d9a135becb504bc44a785fca0023a6f24b962f6f49958a0b43c0f37bca4fb522cd52a3858ab9bf3f229d033dacc3ac3e586936051aa7419ba1",
|
|
44087
44159
|
"file": "src/progress-indicator/progress-indicator.component.ts",
|
|
44088
44160
|
"encapsulation": [],
|
|
44089
44161
|
"entryComponents": [],
|
|
@@ -44198,8 +44270,8 @@
|
|
|
44198
44270
|
"jsdoctags": [
|
|
44199
44271
|
{
|
|
44200
44272
|
"name": {
|
|
44201
|
-
"pos":
|
|
44202
|
-
"end":
|
|
44273
|
+
"pos": 3581,
|
|
44274
|
+
"end": 3586,
|
|
44203
44275
|
"flags": 16842752,
|
|
44204
44276
|
"modifierFlagsCache": 0,
|
|
44205
44277
|
"transformFlags": 0,
|
|
@@ -44210,8 +44282,8 @@
|
|
|
44210
44282
|
"deprecated": false,
|
|
44211
44283
|
"deprecationMessage": "",
|
|
44212
44284
|
"tagName": {
|
|
44213
|
-
"pos":
|
|
44214
|
-
"end":
|
|
44285
|
+
"pos": 3575,
|
|
44286
|
+
"end": 3580,
|
|
44215
44287
|
"flags": 16842752,
|
|
44216
44288
|
"modifierFlagsCache": 0,
|
|
44217
44289
|
"transformFlags": 0,
|
|
@@ -44222,8 +44294,8 @@
|
|
|
44222
44294
|
},
|
|
44223
44295
|
{
|
|
44224
44296
|
"tagName": {
|
|
44225
|
-
"pos":
|
|
44226
|
-
"end":
|
|
44297
|
+
"pos": 3599,
|
|
44298
|
+
"end": 3606,
|
|
44227
44299
|
"flags": 16842752,
|
|
44228
44300
|
"modifierFlagsCache": 0,
|
|
44229
44301
|
"transformFlags": 0,
|
|
@@ -44255,8 +44327,8 @@
|
|
|
44255
44327
|
"jsdoctags": [
|
|
44256
44328
|
{
|
|
44257
44329
|
"name": {
|
|
44258
|
-
"pos":
|
|
44259
|
-
"end":
|
|
44330
|
+
"pos": 3127,
|
|
44331
|
+
"end": 3132,
|
|
44260
44332
|
"flags": 16842752,
|
|
44261
44333
|
"modifierFlagsCache": 0,
|
|
44262
44334
|
"transformFlags": 0,
|
|
@@ -44267,8 +44339,8 @@
|
|
|
44267
44339
|
"deprecated": false,
|
|
44268
44340
|
"deprecationMessage": "",
|
|
44269
44341
|
"tagName": {
|
|
44270
|
-
"pos":
|
|
44271
|
-
"end":
|
|
44342
|
+
"pos": 3121,
|
|
44343
|
+
"end": 3126,
|
|
44272
44344
|
"flags": 16842752,
|
|
44273
44345
|
"modifierFlagsCache": 0,
|
|
44274
44346
|
"transformFlags": 0,
|
|
@@ -44317,10 +44389,10 @@
|
|
|
44317
44389
|
"hostListeners": [],
|
|
44318
44390
|
"standalone": false,
|
|
44319
44391
|
"imports": [],
|
|
44320
|
-
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import {
|
|
44321
|
-
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport {
|
|
44392
|
+
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { ProgressIndicatorModule } from 'carbon-components-angular';</code></pre></div><p><a href=\"../../?path=/story/components-progress-indicator--basic\">See demo</a></p>\n",
|
|
44393
|
+
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { ProgressIndicatorModule } from 'carbon-components-angular';\n```\n\n[See demo](../../?path=/story/components-progress-indicator--basic)\n",
|
|
44322
44394
|
"type": "component",
|
|
44323
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter\n} from \"@angular/core\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { Step } from \"./progress-indicator-step.interface\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import {
|
|
44395
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter\n} from \"@angular/core\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { Step } from \"./progress-indicator-step.interface\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { ProgressIndicatorModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-progress-indicator--basic)\n */\n@Component({\n\tselector: \"cds-progress-indicator, ibm-progress-indicator\",\n\ttemplate: `\n\t<ul\n\t\tdata-progress\n\t\tdata-progress-current\n\t\tclass=\"cds--progress\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--skeleton': skeleton,\n\t\t\t'cds--progress--vertical': (orientation === 'vertical'),\n\t\t\t'cds--progress--space-equal': spacing === 'equal' && orientation !== 'vertical'\n\t\t}\">\n\t\t<li\n\t\t\tclass=\"cds--progress-step\"\n\t\t\t*ngFor=\"let step of steps; let i = index\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--progress-step--disabled' : step.disabled,\n\t\t\t\t'cds--progress-step--complete' : step.complete,\n\t\t\t\t'cds--progress-step--incomplete' : !step.complete && i !== current,\n\t\t\t\t'cds--progress-step--current': i === current\n\t\t\t}\">\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cds--progress-step-button\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--progress-step-button--unclickable': !step.onClick || current === i\n\t\t\t\t}\"\n\t\t\t\t[disabled]=\"step.disabled\"\n\t\t\t\t[attr.aria-disabled]=\"step.disabled\"\n\t\t\t\t[tabindex]=\"(current !== i && step.onClick && !step.disabled) ? 0 : -1\"\n\t\t\t\t[title]=\"step.label\"\n\t\t\t\t(click)=\"onClick(i)\">\n\t\t\t\t<span class=\"cds--assistive-text\">\n\t\t\t\t\t{{this.translations[getCurrentState(i)?.toUpperCase()]}}\n\t\t\t\t</span>\n\t\t\t\t<svg\n\t\t\t\t\t[cdsIcon]=\"statusIcons[getCurrentState(i)]\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--progress__warning': step.invalid && i !== current\n\t\t\t\t\t}\">\n\t\t\t\t\t<title *ngIf=\"step.description\">{{step.description}}</title>\n\t\t\t\t</svg>\n\t\t\t\t<div class=\"cds--progress-text\">\n\t\t\t\t\t<p class=\"cds--progress-label\">{{step.label}}</p>\n\t\t\t\t\t<p *ngIf=\"step.secondaryLabel\" class=\"cds--progress-optional\">{{step.secondaryLabel}}</p>\n\t\t\t\t</div>\n\t\t\t\t<span class=\"cds--progress-line\"></span>\n\t\t\t</button>\n\t\t</li>\n\t</ul>\n\t`\n})\nexport class ProgressIndicator {\n\t@Input() get current() {\n\t\treturn this._current;\n\t}\n\tset current(current: number) {\n\t\tthis._current = current;\n\t\tthis.setProgressIndicatorStates();\n\t}\n\tstatic skeletonSteps(stepCount: number) {\n\t\tconst steps = [];\n\t\tfor (let i = 0; i < stepCount; i++) {\n\t\t\tsteps.push({ complete: false });\n\t\t}\n\n\t\treturn steps;\n\t}\n\n\t@Input() steps: Array<Step>;\n\t@Output() stepSelected = new EventEmitter<{ step: Step, index: number }>();\n\n\t@Input() translations = this.i18n.get().PROGRESS_INDICATOR;\n\t@Input() orientation: \"horizontal\" | \"vertical\" = \"horizontal\";\n\t@Input() skeleton = false;\n\t@Input() spacing: \"default\" | \"equal\" = \"default\";\n\n\t// Get icon names based for each status\n\treadonly statusIcons = {\n\t\tcurrent: \"incomplete\",\n\t\tcomplete: \"checkmark--outline\",\n\t\tinvalid: \"warning\",\n\t\tincomplete: \"circle-dash\"\n\t};\n\n\tprivate _current: number;\n\n\tconstructor(protected i18n: I18n) { }\n\n\t/**\n\t * Executes click function if `onClick` exists for step\n\t * `Current` step functions will not be executed\n\t * @param index number\n\t */\n\tonClick(index: number) {\n\t\tif (index !== this.current && typeof this.steps[index].onClick === \"function\") {\n\t\t\tthis.steps[index].onClick();\n\t\t}\n\t\tthis.stepSelected.emit({ step: this.steps[index], index });\n\t}\n\n\t/**\n\t * Gets current state based on weight of the state\n\t * Weight of state goes from error, incomplete, current, and complete\n\t *\n\t * This function is used to determine which icon & translation string to display\n\t * @param index number\n\t * @returns string\n\t */\n\tgetCurrentState(index: number) {\n\t\tif (index === this.current) {\n\t\t\treturn \"current\";\n\t\t} else if (this.steps[index].invalid) {\n\t\t\treturn \"invalid\";\n\t\t} else if (this.steps[index].complete) {\n\t\t\treturn \"complete\";\n\t\t}\n\n\t\treturn \"incomplete\";\n\t}\n\n\tprivate setProgressIndicatorStates() {\n\t\tif (this.steps === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set all preceding steps to `complete` & following to `incomplete`\n\t\tthis.steps.forEach((step: Step, index) => {\n\t\t\tif (index < this.current) {\n\t\t\t\tstep.complete = true;\n\t\t\t} else {\n\t\t\t\tstep.complete = false;\n\t\t\t}\n\t\t});\n\t}\n}\n",
|
|
44324
44396
|
"assetsDirs": [],
|
|
44325
44397
|
"styleUrlsData": "",
|
|
44326
44398
|
"stylesData": "",
|
|
@@ -74012,7 +74084,7 @@
|
|
|
74012
74084
|
"deprecated": false,
|
|
74013
74085
|
"deprecationMessage": "",
|
|
74014
74086
|
"type": "",
|
|
74015
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"[helperText]\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[min]=\"min\"\n\t\t\t[size]=\"size\"\n\t\t\t[max]=\"max\"\n\t\t\t[step]=\"step\"\n\t\t\t[precision]=\"precision\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[(ngModel)]=\"value\"\n\t\t\t[fluid]=\"fluid\">\n\t\t</cds-number>\n\t\t{{ value }}\n\t`\n})"
|
|
74087
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"[helperText]\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[min]=\"min\"\n\t\t\t[size]=\"size\"\n\t\t\t[max]=\"max\"\n\t\t\t[step]=\"step\"\n\t\t\t[precision]=\"precision\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[(ngModel)]=\"value\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(change)=\"change($event)\">\n\t\t</cds-number>\n\t\t{{ value }}\n\t`\n})"
|
|
74016
74088
|
},
|
|
74017
74089
|
{
|
|
74018
74090
|
"name": "ModelTemplate",
|
|
@@ -75069,7 +75141,7 @@
|
|
|
75069
75141
|
"deprecated": false,
|
|
75070
75142
|
"deprecationMessage": "",
|
|
75071
75143
|
"type": "",
|
|
75072
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\tlabel=\"Number input label\"\n\t\t\tskeleton=\"true\"\n\t\t\t[fluid]=\"fluid\">\n\t\t</cds-number>\n\t`\n})"
|
|
75144
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\tlabel=\"Number input label\"\n\t\t\tskeleton=\"true\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(change)=\"change($event)\">\n\t\t</cds-number>\n\t`\n})"
|
|
75073
75145
|
},
|
|
75074
75146
|
{
|
|
75075
75147
|
"name": "SkeletonTemplate",
|
|
@@ -75459,7 +75531,7 @@
|
|
|
75459
75531
|
"deprecated": false,
|
|
75460
75532
|
"deprecationMessage": "",
|
|
75461
75533
|
"type": "",
|
|
75462
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"[helperText]\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[min]=\"min\"\n\t\t\t[max]=\"max\"\n\t\t\t[step]=\"step\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[size]=\"size\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[fluid]=\"fluid\">\n\t\t</cds-number>\n\t`\n})"
|
|
75534
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"[helperText]\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[min]=\"min\"\n\t\t\t[max]=\"max\"\n\t\t\t[step]=\"step\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[size]=\"size\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(change)=\"change($event)\">\n\t\t</cds-number>\n\t`\n})"
|
|
75463
75535
|
},
|
|
75464
75536
|
{
|
|
75465
75537
|
"name": "Template",
|
|
@@ -75469,7 +75541,7 @@
|
|
|
75469
75541
|
"deprecated": false,
|
|
75470
75542
|
"deprecationMessage": "",
|
|
75471
75543
|
"type": "",
|
|
75472
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<!--\n\t\tapp-* components are for demo purposes only.\n\t\tYou can create your own implementation by using the component source found at:\n\t\thttps://github.com/IBM/carbon-components-angular/tree/master/src/pagination/pagination-nav/stories/pagination-nav-story.component.ts\n\t\t-->\n\t\t<app-pagination\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[totalDataLength]=\"totalDataLength\"\n\t\t\t[numOfItemsToShow]=\"numOfItemsToShow\"\n\t\t\t[skeleton]=\"skeleton\">\n\t\t</app-pagination>\n\t`\n})"
|
|
75544
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<!--\n\t\tapp-* components are for demo purposes only.\n\t\tYou can create your own implementation by using the component source found at:\n\t\thttps://github.com/IBM/carbon-components-angular/tree/master/src/pagination/pagination-nav/stories/pagination-nav-story.component.ts\n\t\t-->\n\t\t<app-pagination\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[totalDataLength]=\"totalDataLength\"\n\t\t\t[numOfItemsToShow]=\"numOfItemsToShow\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[size]=\"size\">\n\t\t</app-pagination>\n\t`\n})"
|
|
75473
75545
|
},
|
|
75474
75546
|
{
|
|
75475
75547
|
"name": "Template",
|
|
@@ -80419,7 +80491,7 @@
|
|
|
80419
80491
|
"deprecated": false,
|
|
80420
80492
|
"deprecationMessage": "",
|
|
80421
80493
|
"type": "",
|
|
80422
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"[helperText]\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[min]=\"min\"\n\t\t\t[size]=\"size\"\n\t\t\t[max]=\"max\"\n\t\t\t[step]=\"step\"\n\t\t\t[precision]=\"precision\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[(ngModel)]=\"value\"\n\t\t\t[fluid]=\"fluid\">\n\t\t</cds-number>\n\t\t{{ value }}\n\t`\n})"
|
|
80494
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"[helperText]\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[min]=\"min\"\n\t\t\t[size]=\"size\"\n\t\t\t[max]=\"max\"\n\t\t\t[step]=\"step\"\n\t\t\t[precision]=\"precision\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[(ngModel)]=\"value\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(change)=\"change($event)\">\n\t\t</cds-number>\n\t\t{{ value }}\n\t`\n})"
|
|
80423
80495
|
},
|
|
80424
80496
|
{
|
|
80425
80497
|
"name": "NgModel",
|
|
@@ -80449,7 +80521,7 @@
|
|
|
80449
80521
|
"deprecated": false,
|
|
80450
80522
|
"deprecationMessage": "",
|
|
80451
80523
|
"type": "",
|
|
80452
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\tlabel=\"Number input label\"\n\t\t\tskeleton=\"true\"\n\t\t\t[fluid]=\"fluid\">\n\t\t</cds-number>\n\t`\n})"
|
|
80524
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\tlabel=\"Number input label\"\n\t\t\tskeleton=\"true\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(change)=\"change($event)\">\n\t\t</cds-number>\n\t`\n})"
|
|
80453
80525
|
},
|
|
80454
80526
|
{
|
|
80455
80527
|
"name": "Template",
|
|
@@ -80459,7 +80531,7 @@
|
|
|
80459
80531
|
"deprecated": false,
|
|
80460
80532
|
"deprecationMessage": "",
|
|
80461
80533
|
"type": "",
|
|
80462
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"[helperText]\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[min]=\"min\"\n\t\t\t[max]=\"max\"\n\t\t\t[step]=\"step\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[size]=\"size\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[fluid]=\"fluid\">\n\t\t</cds-number>\n\t`\n})"
|
|
80534
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-number\n\t\t\t[label]=\"label\"\n\t\t\t[helperText]=\"[helperText]\"\n\t\t\t[theme]=\"theme\"\n\t\t\t[min]=\"min\"\n\t\t\t[max]=\"max\"\n\t\t\t[step]=\"step\"\n\t\t\t[invalid]=\"invalid\"\n\t\t\t[invalidText]=\"invalidText\"\n\t\t\t[warn]=\"warn\"\n\t\t\t[warnText]=\"warnText\"\n\t\t\t[size]=\"size\"\n\t\t\t[readonly]=\"readonly\"\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[fluid]=\"fluid\"\n\t\t\t(change)=\"change($event)\">\n\t\t</cds-number>\n\t`\n})"
|
|
80463
80535
|
}
|
|
80464
80536
|
],
|
|
80465
80537
|
"src/pagination/pagination-nav.stories.ts": [
|
|
@@ -80481,7 +80553,7 @@
|
|
|
80481
80553
|
"deprecated": false,
|
|
80482
80554
|
"deprecationMessage": "",
|
|
80483
80555
|
"type": "",
|
|
80484
|
-
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<!--\n\t\tapp-* components are for demo purposes only.\n\t\tYou can create your own implementation by using the component source found at:\n\t\thttps://github.com/IBM/carbon-components-angular/tree/master/src/pagination/pagination-nav/stories/pagination-nav-story.component.ts\n\t\t-->\n\t\t<app-pagination\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[totalDataLength]=\"totalDataLength\"\n\t\t\t[numOfItemsToShow]=\"numOfItemsToShow\"\n\t\t\t[skeleton]=\"skeleton\">\n\t\t</app-pagination>\n\t`\n})"
|
|
80556
|
+
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<!--\n\t\tapp-* components are for demo purposes only.\n\t\tYou can create your own implementation by using the component source found at:\n\t\thttps://github.com/IBM/carbon-components-angular/tree/master/src/pagination/pagination-nav/stories/pagination-nav-story.component.ts\n\t\t-->\n\t\t<app-pagination\n\t\t\t[disabled]=\"disabled\"\n\t\t\t[totalDataLength]=\"totalDataLength\"\n\t\t\t[numOfItemsToShow]=\"numOfItemsToShow\"\n\t\t\t[skeleton]=\"skeleton\"\n\t\t\t[size]=\"size\">\n\t\t</app-pagination>\n\t`\n})"
|
|
80485
80557
|
}
|
|
80486
80558
|
],
|
|
80487
80559
|
"src/pagination/pagination.stories.ts": [
|
|
@@ -87568,8 +87640,8 @@
|
|
|
87568
87640
|
"type": "component",
|
|
87569
87641
|
"linktype": "component",
|
|
87570
87642
|
"name": "PaginationNav",
|
|
87571
|
-
"coveragePercent":
|
|
87572
|
-
"coverageCount": "
|
|
87643
|
+
"coveragePercent": 38,
|
|
87644
|
+
"coverageCount": "7/18",
|
|
87573
87645
|
"status": "medium"
|
|
87574
87646
|
},
|
|
87575
87647
|
{
|
|
@@ -87596,7 +87668,7 @@
|
|
|
87596
87668
|
"linktype": "component",
|
|
87597
87669
|
"name": "PaginationNavStory",
|
|
87598
87670
|
"coveragePercent": 0,
|
|
87599
|
-
"coverageCount": "0/
|
|
87671
|
+
"coverageCount": "0/8",
|
|
87600
87672
|
"status": "low"
|
|
87601
87673
|
},
|
|
87602
87674
|
{
|