@limetech/lime-elements 37.53.0 → 37.53.2
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/CHANGELOG.md +19 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-date-picker.cjs.entry.js +5 -20
- package/dist/cjs/limel-date-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +24 -20
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-table.cjs.entry.js +32 -10
- package/dist/cjs/limel-table.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/date-picker/date-picker.js +5 -24
- package/dist/collection/components/date-picker/date-picker.js.map +1 -1
- package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.js +4 -1
- package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.js.map +1 -1
- package/dist/collection/components/date-picker/pickers/Picker.js +20 -19
- package/dist/collection/components/date-picker/pickers/Picker.js.map +1 -1
- package/dist/collection/components/table/table-selection.js +16 -8
- package/dist/collection/components/table/table-selection.js.map +1 -1
- package/dist/collection/components/table/table.js +24 -6
- package/dist/collection/components/table/table.js.map +1 -1
- package/dist/collection/components/table/table.types.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-date-picker.entry.js +5 -20
- package/dist/esm/limel-date-picker.entry.js.map +1 -1
- package/dist/esm/limel-flatpickr-adapter.entry.js +24 -20
- package/dist/esm/limel-flatpickr-adapter.entry.js.map +1 -1
- package/dist/esm/limel-table.entry.js +32 -10
- package/dist/esm/limel-table.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/index.esm.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js.map +1 -1
- package/dist/lime-elements/p-5224d7bb.entry.js +2 -0
- package/dist/lime-elements/p-5224d7bb.entry.js.map +1 -0
- package/dist/lime-elements/{p-42b6ba6d.entry.js → p-5a035a41.entry.js} +3 -3
- package/dist/lime-elements/p-5a035a41.entry.js.map +1 -0
- package/dist/lime-elements/{p-cc5d8b3f.entry.js → p-852e7a2b.entry.js} +2 -2
- package/dist/lime-elements/p-852e7a2b.entry.js.map +1 -0
- package/dist/types/components/date-picker/date-picker.d.ts +0 -2
- package/dist/types/components/date-picker/pickers/Picker.d.ts +3 -2
- package/dist/types/components/table/table-selection.d.ts +4 -2
- package/dist/types/components/table/table.d.ts +4 -3
- package/dist/types/components/table/table.types.d.ts +7 -0
- package/dist/types/components.d.ts +4 -4
- package/package.json +1 -1
- package/dist/lime-elements/p-42b6ba6d.entry.js.map +0 -1
- package/dist/lime-elements/p-b76d8f4f.entry.js +0 -2
- package/dist/lime-elements/p-b76d8f4f.entry.js.map +0 -1
- package/dist/lime-elements/p-cc5d8b3f.entry.js.map +0 -1
|
@@ -126,7 +126,9 @@ export class Table {
|
|
|
126
126
|
this.formatRows();
|
|
127
127
|
}
|
|
128
128
|
updateData(newData = [], oldData = []) {
|
|
129
|
-
|
|
129
|
+
const newIds = new Set(newData.map((item) => { var _a; return (_a = item.id) !== null && _a !== void 0 ? _a : item; }));
|
|
130
|
+
if (oldData.every((item) => { var _a; return newIds.has((_a = item.id) !== null && _a !== void 0 ? _a : item); })) {
|
|
131
|
+
this.tabulator.updateOrAddData(newData);
|
|
130
132
|
return;
|
|
131
133
|
}
|
|
132
134
|
this.pool.releaseAll();
|
|
@@ -405,7 +407,7 @@ export class Table {
|
|
|
405
407
|
// Not a data row, probably a CalcComponent
|
|
406
408
|
return;
|
|
407
409
|
}
|
|
408
|
-
if (this.
|
|
410
|
+
if (this.isActiveRow(row)) {
|
|
409
411
|
this.activeRow = null;
|
|
410
412
|
}
|
|
411
413
|
else {
|
|
@@ -417,7 +419,7 @@ export class Table {
|
|
|
417
419
|
this.tabulator.getRows().forEach(this.formatRow);
|
|
418
420
|
}
|
|
419
421
|
formatRow(row) {
|
|
420
|
-
if (this.
|
|
422
|
+
if (this.isActiveRow(row)) {
|
|
421
423
|
row.getElement().classList.add('active');
|
|
422
424
|
}
|
|
423
425
|
else {
|
|
@@ -432,6 +434,17 @@ export class Table {
|
|
|
432
434
|
row.getElement().prepend(element);
|
|
433
435
|
}
|
|
434
436
|
}
|
|
437
|
+
isActiveRow(row) {
|
|
438
|
+
var _a;
|
|
439
|
+
if (!this.activeRow) {
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
const activeRowId = (_a = this.activeRow.id) !== null && _a !== void 0 ? _a : null;
|
|
443
|
+
if (activeRowId !== null) {
|
|
444
|
+
return activeRowId === row.getData().id;
|
|
445
|
+
}
|
|
446
|
+
return this.activeRow === row.getData();
|
|
447
|
+
}
|
|
435
448
|
calculatePageCount() {
|
|
436
449
|
let total = this.totalRows;
|
|
437
450
|
if (!total) {
|
|
@@ -617,9 +630,14 @@ export class Table {
|
|
|
617
630
|
"type": "unknown",
|
|
618
631
|
"mutable": true,
|
|
619
632
|
"complexType": {
|
|
620
|
-
"original": "
|
|
621
|
-
"resolved": "
|
|
622
|
-
"references": {
|
|
633
|
+
"original": "RowData",
|
|
634
|
+
"resolved": "{ id?: string | number; }",
|
|
635
|
+
"references": {
|
|
636
|
+
"RowData": {
|
|
637
|
+
"location": "import",
|
|
638
|
+
"path": "./table.types"
|
|
639
|
+
}
|
|
640
|
+
}
|
|
623
641
|
},
|
|
624
642
|
"required": false,
|
|
625
643
|
"optional": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/components/table/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,CAAC,EACD,IAAI,EACJ,OAAO,EACP,KAAK,EAEL,KAAK,EACL,IAAI,GACP,MAAM,eAAe,CAAC;AACv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AAO,EAAE,MAAA,IAAI,CAAC,cAAc,0CAAE,YAAY,EAC1C,aAAa,EACT,CAAA,MAAA,IAAI,CAAC,cAAc,0CAAE,YAAY;UACjC,CAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,MAAM,IAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAE/C,CACA,CACT,CAAC;EACN,CAAC;EAEO,kBAAkB;IACtB,MAAM,gBAAgB,GAClB,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC;IAE5D,OAAO,CACH,WACI,EAAE,EAAC,sBAAsB,EACzB,KAAK,EAAE,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE;MAEtD,gBAAO,IAAI,CAAC,YAAY,CAAQ,CAC9B,CACT,CAAC;EACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n h,\n Prop,\n Element,\n Watch,\n EventEmitter,\n Event,\n Host,\n} from '@stencil/core';\nimport TabulatorTable from 'tabulator-tables';\nimport {\n Column,\n TableParams,\n ColumnSorter,\n ColumnAggregate,\n} from './table.types';\nimport { ColumnDefinitionFactory, createColumnSorter } from './columns';\nimport { isEqual, has } from 'lodash-es';\nimport { ElementPool } from './element-pool';\nimport { TableSelection } from './table-selection';\nimport { mapLayout, Layout } from './layout';\n\nconst FIRST_PAGE = 1;\n\n/**\n * @exampleComponent limel-example-table\n * @exampleComponent limel-example-table-custom-components\n * @exampleComponent limel-example-table-header-menu\n * @exampleComponent limel-example-table-movable-columns\n * @exampleComponent limel-example-table-sorting-disabled\n * @exampleComponent limel-example-table-local\n * @exampleComponent limel-example-table-remote\n * @exampleComponent limel-example-table-activate-row\n * @exampleComponent limel-example-table-selectable-rows\n * @exampleComponent limel-example-table-default-sorted\n * @exampleComponent limel-example-table-layout-default\n * @exampleComponent limel-example-table-layout-stretch-last-column\n * @exampleComponent limel-example-table-layout-stretch-columns\n * @exampleComponent limel-example-table-layout-low-density\n * @exampleComponent limel-example-table-interactive-rows\n */\n@Component({\n tag: 'limel-table',\n styleUrl: 'table.scss',\n shadow: true,\n})\nexport class Table {\n /**\n * Data to be displayed in the table\n */\n @Prop()\n public data: object[] = [];\n\n /**\n * Columns used to display the data\n */\n @Prop()\n public columns: Column[] = [];\n\n /**\n * Set to either `local` or `remote` to change how the table handles the\n * loaded data. When in `local` mode, all sorting and pagination will be\n * done locally with the data given. When in `remote` mode, the consumer\n * is responsible to give the table new data when a `load` event occurs\n */\n @Prop()\n public mode: 'local' | 'remote' = 'local';\n\n /**\n * Defines the layout of the table, based on how width of the columns are calculated.\n *\n * - `default`: makes columns as wide as their contents.\n * - `stretchLastColumn`: makes columns as wide as their contents, stretch the last column to fill up the remaining table width.\n * - `stretchColumns`: stretches all columns to fill the available width when possible.\n * - `lowDensity`: makes columns as wide as their contents, and creates a low density and airy layout.\n */\n @Prop()\n public layout: Layout;\n\n /**\n * Number of rows per page\n */\n @Prop()\n public pageSize: number;\n\n /**\n * The number of total rows available for the data\n */\n @Prop()\n public totalRows: number;\n\n /**\n * The initial sorted columns\n */\n @Prop()\n public sorting: ColumnSorter[] = [];\n\n /**\n * Active row in the table\n */\n @Prop({ mutable: true })\n public activeRow: object;\n\n /**\n * Set to `true` to enable reordering of the columns by dragging them\n */\n @Prop()\n public movableColumns: boolean;\n\n /**\n * Set to `true` to trigger loading animation\n */\n @Prop()\n public loading: boolean = false;\n\n /**\n * The page to show\n */\n @Prop()\n public page: number = FIRST_PAGE;\n\n /**\n * Emitted when `mode` is `local` the data is sorted\n */\n @Event()\n public sort: EventEmitter<ColumnSorter[]>;\n\n /**\n * Emitted when a new page has been set\n */\n @Event()\n public changePage: EventEmitter<number>;\n\n /**\n * A message to display when the table has no data\n */\n @Prop()\n public emptyMessage: string;\n\n /**\n * Column aggregates to be displayed in the table\n */\n @Prop()\n public aggregates: ColumnAggregate[];\n\n /**\n * Enables row selection\n */\n @Prop()\n public selectable: boolean;\n\n /**\n * Selected data. Requires `selectable` to be true.\n */\n @Prop()\n public selection: object[];\n\n /**\n * Emitted when `mode` is `remote` and the table is loading new data. The\n * consumer is responsible for giving the table new data\n */\n @Event()\n public load: EventEmitter<TableParams>;\n\n /**\n * Emitted when a row is activated\n */\n @Event()\n public activate: EventEmitter<object>;\n\n /**\n * Emitted when the columns have been changed\n */\n @Event()\n public changeColumns: EventEmitter<Column[]>;\n\n /**\n * Emitted when the row selection has been changed\n */\n @Event()\n public select: EventEmitter<object[]>;\n\n /**\n * Emitted when the select all rows state is toggled\n */\n @Event()\n public selectAll: EventEmitter<boolean>;\n\n @Element()\n private host: HTMLLimelTableElement;\n\n private currentLoad: { page: number; sorters: ColumnSorter[] };\n\n private tabulator: Tabulator;\n\n private pool: ElementPool;\n private columnFactory: ColumnDefinitionFactory;\n private firstRequest: boolean;\n private currentSorting: ColumnSorter[];\n private tableSelection: TableSelection;\n\n constructor() {\n this.handleDataSorting = this.handleDataSorting.bind(this);\n this.handlePageLoaded = this.handlePageLoaded.bind(this);\n this.handleAjaxRequesting = this.handleAjaxRequesting.bind(this);\n this.requestData = this.requestData.bind(this);\n this.onClickRow = this.onClickRow.bind(this);\n this.formatRow = this.formatRow.bind(this);\n this.formatRows = this.formatRows.bind(this);\n this.updateMaxPage = this.updateMaxPage.bind(this);\n this.initTabulatorComponent = this.initTabulatorComponent.bind(this);\n this.setSelection = this.setSelection.bind(this);\n this.addColumnAggregator = this.addColumnAggregator.bind(this);\n this.pool = new ElementPool(document);\n this.columnFactory = new ColumnDefinitionFactory(this.pool);\n }\n\n public componentWillLoad() {\n this.firstRequest = this.mode === 'remote';\n this.initTableSelection();\n }\n\n public componentDidLoad() {\n this.init();\n }\n\n public disconnectedCallback() {\n this.pool.clear();\n }\n\n @Watch('totalRows')\n protected totalRowsChanged() {\n this.updateMaxPage();\n }\n\n @Watch('pageSize')\n protected pageSizeChanged() {\n this.updateMaxPage();\n }\n\n @Watch('page')\n protected pageChanged() {\n if (!this.tabulator) {\n return;\n }\n\n if (this.tabulator.getPage() === this.page) {\n return;\n }\n\n this.tabulator.setPage(this.page);\n }\n\n @Watch('activeRow')\n protected activeRowChanged() {\n if (!this.tabulator) {\n return;\n }\n\n this.formatRows();\n }\n\n @Watch('data')\n protected updateData(newData = [], oldData = []) {\n if (isEqual(newData, oldData)) {\n return;\n }\n\n this.pool.releaseAll();\n\n setTimeout(() => {\n if (!this.tabulator) {\n return;\n }\n\n this.tabulator.replaceData(this.data);\n this.setSelection();\n });\n }\n\n @Watch('columns')\n protected updateColumns(newColumns: Column[], oldColumns: Column[]) {\n if (!this.tabulator) {\n return;\n }\n\n if (this.areSameColumns(newColumns, oldColumns)) {\n return;\n }\n\n const columnsInTable = this.tabulator\n .getColumns()\n .filter((c) => c.getField());\n\n const oldColumnsInTable = columnsInTable.map((c) =>\n oldColumns.find((old) => old.field === c.getField()),\n );\n\n if (this.areSameColumns(newColumns, oldColumnsInTable)) {\n return;\n }\n\n // Updating columns requires a reinitialization otherwise sorting will not work\n // afterwards\n this.init();\n }\n\n @Watch('aggregates')\n protected updateAggregates(\n newAggregates: ColumnAggregate[],\n oldAggregates: ColumnAggregate[],\n ) {\n if (!this.tabulator) {\n return;\n }\n\n if (isEqual(newAggregates, oldAggregates)) {\n return;\n }\n\n if (!this.haveSameAggregateFields(newAggregates, oldAggregates)) {\n this.init();\n\n return;\n }\n\n this.tabulator.recalc();\n this.tabulator.rowManager.redraw();\n }\n\n @Watch('selection')\n protected updateSelection(newSelection: any[]) {\n if (!this.tableSelection) {\n return;\n }\n\n this.tableSelection.setSelection(newSelection);\n }\n\n @Watch('selectable')\n protected updateSelectable() {\n if (this.tableSelection && !this.selectable) {\n this.tableSelection = null;\n }\n\n this.initTableSelection();\n this.init();\n }\n\n @Watch('sorting')\n protected updateSorting(\n newValue: ColumnSorter[],\n oldValue: ColumnSorter[],\n ) {\n const newSorting = this.getColumnSorter(newValue);\n const oldSorting = this.getColumnSorter(oldValue);\n if (isEqual(newSorting, oldSorting)) {\n return;\n }\n\n this.tabulator.setSort(newSorting);\n }\n\n private areSameColumns(newColumns: Column[], oldColumns: Column[]) {\n return (\n newColumns.length === oldColumns.length &&\n newColumns.every((column) => oldColumns.includes(column))\n );\n }\n\n private haveSameAggregateFields(\n newAggregates: ColumnAggregate[],\n oldAggregates: ColumnAggregate[],\n ) {\n const oldAggregateFields = oldAggregates?.map((a) => a.field) || [];\n\n return (\n newAggregates?.length === oldAggregates?.length &&\n !!newAggregates?.every((a) => oldAggregateFields.includes(a.field))\n );\n }\n\n private init() {\n if (this.tabulator) {\n this.pool.releaseAll();\n this.tabulator.destroy();\n }\n\n const table: HTMLElement =\n this.host.shadowRoot.querySelector('#tabulator-table');\n this.initTabulatorComponent(table);\n }\n\n /*\n * Tabulator requires that the html element it's rendered inside\n * has a size before it's created, otherwise it doesn't consider\n * it self renderedy completely. (the callback \"renderComplete\"\n * is never run).\n *\n * @param table {HTMLElement}\n *\n */\n private initTabulatorComponent(table: HTMLElement) {\n // Some browsers do not implement the ResizeObserver API...\n // If that's the case lets just create the table no\n // matter if its rendered or not.\n if (!('ResizeObserver' in window)) {\n this.tabulator = new TabulatorTable(table, this.getOptions());\n this.setSelection();\n\n return;\n }\n\n const observer = new ResizeObserver(() => {\n this.tabulator = new TabulatorTable(table, this.getOptions());\n this.setSelection();\n observer.unobserve(table);\n });\n observer.observe(table);\n }\n\n private initTableSelection() {\n if (this.selectable) {\n this.tableSelection = new TableSelection(\n () => this.tabulator,\n this.pool,\n this.select,\n );\n this.tableSelection.setSelection(this.selection);\n }\n }\n\n private setSelection() {\n if (!(this.tabulator && this.tableSelection)) {\n return;\n }\n\n this.tableSelection.setSelection(this.selection);\n }\n\n private updateMaxPage() {\n this.tabulator?.setMaxPage(this.calculatePageCount());\n }\n\n private getOptions(): Tabulator.Options {\n const ajaxOptions = this.getAjaxOptions();\n const paginationOptions = this.getPaginationOptions();\n const columnOptions = this.getColumnOptions();\n\n return {\n data: this.data,\n layout: mapLayout(this.layout),\n columns: this.getColumnDefinitions(),\n dataSorting: this.handleDataSorting,\n pageLoaded: this.handlePageLoaded,\n ...ajaxOptions,\n ...paginationOptions,\n rowClick: this.onClickRow,\n rowFormatter: this.formatRow,\n initialSort: this.getInitialSorting(),\n nestedFieldSeparator: false,\n ...columnOptions,\n };\n }\n\n private getInitialSorting(): Tabulator.Sorter[] {\n if (this.currentSorting && this.currentSorting.length) {\n return this.getColumnSorter(this.currentSorting);\n }\n\n return this.getColumnSorter(this.sorting);\n }\n\n private getColumnSorter(sorting: ColumnSorter[]): Tabulator.Sorter[] {\n return sorting.map((sorter: ColumnSorter) => {\n return {\n column: String(sorter.column.field),\n dir: sorter.direction.toLocaleLowerCase() as Tabulator.SortDirection,\n };\n });\n }\n\n private getColumnDefinitions(): Tabulator.ColumnDefinition[] {\n const columnDefinitions = this.columns\n .map(this.addColumnAggregator)\n .map(this.columnFactory.create);\n\n if (this.tableSelection) {\n return this.tableSelection.getColumnDefinitions(columnDefinitions);\n }\n\n return columnDefinitions;\n }\n\n private addColumnAggregator(column: Column<any>): Column<any> {\n if (!this.aggregates?.length || column.aggregator) {\n return column;\n }\n\n const aggregate = this.aggregates.find((a) => a.field === column.field);\n if (aggregate) {\n column.aggregator = (\n col?: Column,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _values?: any[],\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _data?: any[],\n ) => {\n if (!col) {\n return undefined;\n }\n\n const value = this.aggregates.find(\n (a) => a.field === col.field,\n )?.value;\n\n if (col.formatter) {\n return col.formatter(value);\n }\n\n return value;\n };\n }\n\n return column;\n }\n\n private getAjaxOptions(): Tabulator.OptionsData {\n if (!this.isRemoteMode()) {\n return {};\n }\n\n // Tabulator needs a URL to be set, even though this one will never be\n // used since we have our own custom `ajaxRequestFunc`\n const remoteUrl = 'https://localhost';\n\n return {\n ajaxSorting: true,\n ajaxURL: remoteUrl,\n ajaxRequestFunc: this.requestData,\n ajaxRequesting: this.handleAjaxRequesting,\n };\n }\n\n /*\n * The ajaxRequesting callback is triggered when ever an ajax request is made.\n *\n * Tabulator is requesting data with an AJAX request even though it has been\n * given data when it was created.\n *\n * It seems unnecessary for us to emit the `load` event as well when this\n * happens, since we can just initialize the table with the data that has been\n * given to us. Therefore, we abort the request if:\n *\n * * its the first time this method is called and,\n * * data has been sent in to the component as a prop\n *\n */\n private handleAjaxRequesting() {\n const abortRequest = this.firstRequest && !!this.data?.length;\n this.firstRequest = false;\n\n if (abortRequest) {\n setTimeout(() => {\n this.updateMaxPage();\n this.tabulator.replaceData(this.data);\n });\n\n return false;\n }\n\n return true;\n }\n\n private getPaginationOptions(): Tabulator.OptionsPagination {\n if (!this.pageSize) {\n return {};\n }\n\n return {\n pagination: this.isRemoteMode() ? 'remote' : 'local',\n paginationSize: this.pageSize,\n paginationInitialPage: this.page,\n };\n }\n\n private requestData(_, __, params: any): Promise<object> {\n const sorters = params.sorters;\n const currentPage = params.page;\n\n if (this.page !== currentPage) {\n this.changePage.emit(currentPage);\n }\n\n const columnSorters = sorters.map(createColumnSorter(this.columns));\n\n const load = {\n page: currentPage,\n sorters: columnSorters,\n };\n\n // In order to make limel-table behave more like a controlled component,\n // we always return the existing data from this function, therefore\n // relying on the consumer component to handle the loading\n // state via the loading prop, if it actually decides to load new data.\n const resolveExistingData = Promise.resolve({\n last_page: this.calculatePageCount(), // eslint-disable-line camelcase\n data: this.data,\n });\n\n if (isEqual(this.currentLoad, load)) {\n return resolveExistingData;\n }\n\n this.currentSorting = columnSorters;\n this.currentLoad = load;\n this.load.emit(load);\n\n return resolveExistingData;\n }\n\n private isRemoteMode(): boolean {\n return this.mode === 'remote';\n }\n\n private handleDataSorting(sorters: Tabulator.Sorter[]): void {\n if (this.isRemoteMode()) {\n return;\n }\n\n const columnSorters = sorters.map(createColumnSorter(this.columns));\n if (columnSorters.length === 0) {\n return;\n }\n\n this.sort.emit(columnSorters);\n }\n\n private handlePageLoaded(page: number): void {\n if (this.isRemoteMode()) {\n return;\n }\n\n this.changePage.emit(page);\n }\n\n private onClickRow(_ev, row: Tabulator.RowComponent): void {\n if (typeof row.getPosition === 'undefined') {\n // Not a data row, probably a CalcComponent\n return;\n }\n\n if (this.activeRow === row.getData()) {\n this.activeRow = null;\n } else {\n this.activeRow = row.getData();\n }\n\n this.activate.emit(this.activeRow);\n }\n\n private getActiveRows: () => Tabulator.RowComponent[] = () => {\n if (!this.tabulator) {\n return [];\n }\n\n return this.tabulator.getRows('active');\n };\n\n private getActiveRowsData: () => object[] = () => {\n // Note: Tabulator.getData() creates copies of each data object\n // and will break this.selection.has checks, hence why this function\n // intentionally retrieves the data using the row components\n return this.getActiveRows().map((row) => row.getData());\n };\n\n private selectAllOnChange = (ev: CustomEvent<boolean>) => {\n const selectAll = ev.detail;\n\n ev.stopPropagation();\n ev.preventDefault();\n\n const newSelection = selectAll ? this.getActiveRowsData() : [];\n this.select.emit(newSelection);\n this.tableSelection.setSelection(newSelection);\n this.selectAll.emit(selectAll);\n };\n\n private formatRows() {\n this.tabulator.getRows().forEach(this.formatRow);\n }\n\n private formatRow(row: Tabulator.RowComponent) {\n if (this.activeRow === row.getData()) {\n row.getElement().classList.add('active');\n } else {\n row.getElement().classList.remove('active');\n }\n\n const interactiveFeedbackElement = row\n .getElement()\n .getElementsByClassName('interactive-feedback');\n if (interactiveFeedbackElement.length === 0) {\n const element = row.getElement().ownerDocument.createElement('div');\n element.classList.add('interactive-feedback');\n row.getElement().prepend(element);\n }\n }\n\n private calculatePageCount(): number {\n let total = this.totalRows;\n if (!total) {\n total = this.data.length;\n }\n\n return Math.ceil(total / this.pageSize);\n }\n\n private hasAggregation(columns: Column[]): boolean {\n return columns.some((column) => has(column, 'aggregator'));\n }\n\n private getColumnOptions = (): Tabulator.OptionsColumns => {\n if (!this.movableColumns) {\n return {};\n }\n\n return {\n movableColumns: true,\n columnMoved: this.handleMoveColumn,\n };\n };\n\n private handleMoveColumn = (_, components: Tabulator.ColumnComponent[]) => {\n const columns = components.map(this.findColumn).filter((c) => c);\n this.changeColumns.emit(columns);\n };\n\n private findColumn = (component: Tabulator.ColumnComponent): Column => {\n return this.columns.find((column) => {\n return (\n column.field === component.getField() &&\n column.title === component.getDefinition().title\n );\n });\n };\n\n render() {\n return (\n <Host\n class={{\n 'has-low-density': this.layout === 'lowDensity',\n }}\n >\n <div\n id=\"tabulator-container\"\n class={{\n 'has-pagination': this.totalRows > this.pageSize,\n 'has-aggregation': this.hasAggregation(this.columns),\n 'has-movable-columns': this.movableColumns,\n 'has-rowselector': this.selectable,\n 'has-selection': this.tableSelection?.hasSelection,\n }}\n >\n {/* Toggle style instead of removing the loader\n because removing the element will cause a rerender, breaking the\n tabulator table */}\n <div\n id=\"tabulator-loader\"\n style={{ display: this.loading ? 'flex' : 'none' }}\n >\n <limel-spinner size=\"large\" />\n </div>\n {this.renderEmptyMessage()}\n {this.renderSelectAll()}\n <div id=\"tabulator-table\" />\n </div>\n </Host>\n );\n }\n\n private renderSelectAll() {\n if (!this.selectable) {\n return;\n }\n\n const showSelectAll = !this.loading && this.tableSelection;\n\n return (\n <div\n class=\"select-all\"\n style={{ display: showSelectAll ? 'inline-block' : 'none' }}\n >\n <limel-checkbox\n onChange={this.selectAllOnChange}\n disabled={!this.data.length}\n checked={this.tableSelection?.hasSelection}\n indeterminate={\n this.tableSelection?.hasSelection &&\n this.selection?.length < this.data.length\n }\n />\n </div>\n );\n }\n\n private renderEmptyMessage() {\n const showEmptyMessage =\n !this.loading && !this.data.length && this.emptyMessage;\n\n return (\n <div\n id=\"tabulator-empty-text\"\n style={{ display: showEmptyMessage ? 'flex' : 'none' }}\n >\n <span>{this.emptyMessage}</span>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/components/table/table.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,CAAC,EACD,IAAI,EACJ,OAAO,EACP,KAAK,EAEL,KAAK,EACL,IAAI,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAQ9C,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAU,MAAM,UAAU,CAAC;AAE7C,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB;;;;;;;;;;;;;;;;GAgBG;AAMH,MAAM,OAAO,KAAK;EA2Jd;IAgdQ,kBAAa,GAAmC,GAAG,EAAE;MACzD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;QACjB,OAAO,EAAE,CAAC;OACb;MAED,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC,CAAC;IAEM,sBAAiB,GAAmB,GAAG,EAAE;MAC7C,+DAA+D;MAC/D,oEAAoE;MACpE,4DAA4D;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AAA,IAAI,CAAC,cAAc,0CAAE,YAAY,EAC1C,aAAa,EACT,CAAA,MAAA,IAAI,CAAC,cAAc,0CAAE,YAAY;UACjC,CAAA,MAAA,IAAI,CAAC,SAAS,0CAAE,MAAM,IAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAE/C,CACA,CACT,CAAC;EACN,CAAC;EAEO,kBAAkB;IACtB,MAAM,gBAAgB,GAClB,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC;IAE5D,OAAO,CACH,WACI,EAAE,EAAC,sBAAsB,EACzB,KAAK,EAAE,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE;MAEtD,gBAAO,IAAI,CAAC,YAAY,CAAQ,CAC9B,CACT,CAAC;EACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n h,\n Prop,\n Element,\n Watch,\n EventEmitter,\n Event,\n Host,\n} from '@stencil/core';\nimport TabulatorTable from 'tabulator-tables';\nimport {\n Column,\n TableParams,\n ColumnSorter,\n ColumnAggregate,\n RowData,\n} from './table.types';\nimport { ColumnDefinitionFactory, createColumnSorter } from './columns';\nimport { isEqual, has } from 'lodash-es';\nimport { ElementPool } from './element-pool';\nimport { TableSelection } from './table-selection';\nimport { mapLayout, Layout } from './layout';\n\nconst FIRST_PAGE = 1;\n\n/**\n * @exampleComponent limel-example-table\n * @exampleComponent limel-example-table-custom-components\n * @exampleComponent limel-example-table-header-menu\n * @exampleComponent limel-example-table-movable-columns\n * @exampleComponent limel-example-table-sorting-disabled\n * @exampleComponent limel-example-table-local\n * @exampleComponent limel-example-table-remote\n * @exampleComponent limel-example-table-activate-row\n * @exampleComponent limel-example-table-selectable-rows\n * @exampleComponent limel-example-table-default-sorted\n * @exampleComponent limel-example-table-layout-default\n * @exampleComponent limel-example-table-layout-stretch-last-column\n * @exampleComponent limel-example-table-layout-stretch-columns\n * @exampleComponent limel-example-table-layout-low-density\n * @exampleComponent limel-example-table-interactive-rows\n */\n@Component({\n tag: 'limel-table',\n styleUrl: 'table.scss',\n shadow: true,\n})\nexport class Table {\n /**\n * Data to be displayed in the table\n */\n @Prop()\n public data: object[] = [];\n\n /**\n * Columns used to display the data\n */\n @Prop()\n public columns: Column[] = [];\n\n /**\n * Set to either `local` or `remote` to change how the table handles the\n * loaded data. When in `local` mode, all sorting and pagination will be\n * done locally with the data given. When in `remote` mode, the consumer\n * is responsible to give the table new data when a `load` event occurs\n */\n @Prop()\n public mode: 'local' | 'remote' = 'local';\n\n /**\n * Defines the layout of the table, based on how width of the columns are calculated.\n *\n * - `default`: makes columns as wide as their contents.\n * - `stretchLastColumn`: makes columns as wide as their contents, stretch the last column to fill up the remaining table width.\n * - `stretchColumns`: stretches all columns to fill the available width when possible.\n * - `lowDensity`: makes columns as wide as their contents, and creates a low density and airy layout.\n */\n @Prop()\n public layout: Layout;\n\n /**\n * Number of rows per page\n */\n @Prop()\n public pageSize: number;\n\n /**\n * The number of total rows available for the data\n */\n @Prop()\n public totalRows: number;\n\n /**\n * The initial sorted columns\n */\n @Prop()\n public sorting: ColumnSorter[] = [];\n\n /**\n * Active row in the table\n */\n @Prop({ mutable: true })\n public activeRow: RowData;\n\n /**\n * Set to `true` to enable reordering of the columns by dragging them\n */\n @Prop()\n public movableColumns: boolean;\n\n /**\n * Set to `true` to trigger loading animation\n */\n @Prop()\n public loading: boolean = false;\n\n /**\n * The page to show\n */\n @Prop()\n public page: number = FIRST_PAGE;\n\n /**\n * Emitted when `mode` is `local` the data is sorted\n */\n @Event()\n public sort: EventEmitter<ColumnSorter[]>;\n\n /**\n * Emitted when a new page has been set\n */\n @Event()\n public changePage: EventEmitter<number>;\n\n /**\n * A message to display when the table has no data\n */\n @Prop()\n public emptyMessage: string;\n\n /**\n * Column aggregates to be displayed in the table\n */\n @Prop()\n public aggregates: ColumnAggregate[];\n\n /**\n * Enables row selection\n */\n @Prop()\n public selectable: boolean;\n\n /**\n * Selected data. Requires `selectable` to be true.\n */\n @Prop()\n public selection: object[];\n\n /**\n * Emitted when `mode` is `remote` and the table is loading new data. The\n * consumer is responsible for giving the table new data\n */\n @Event()\n public load: EventEmitter<TableParams>;\n\n /**\n * Emitted when a row is activated\n */\n @Event()\n public activate: EventEmitter<object>;\n\n /**\n * Emitted when the columns have been changed\n */\n @Event()\n public changeColumns: EventEmitter<Column[]>;\n\n /**\n * Emitted when the row selection has been changed\n */\n @Event()\n public select: EventEmitter<object[]>;\n\n /**\n * Emitted when the select all rows state is toggled\n */\n @Event()\n public selectAll: EventEmitter<boolean>;\n\n @Element()\n private host: HTMLLimelTableElement;\n\n private currentLoad: { page: number; sorters: ColumnSorter[] };\n\n private tabulator: Tabulator;\n\n private pool: ElementPool;\n private columnFactory: ColumnDefinitionFactory;\n private firstRequest: boolean;\n private currentSorting: ColumnSorter[];\n private tableSelection: TableSelection;\n\n constructor() {\n this.handleDataSorting = this.handleDataSorting.bind(this);\n this.handlePageLoaded = this.handlePageLoaded.bind(this);\n this.handleAjaxRequesting = this.handleAjaxRequesting.bind(this);\n this.requestData = this.requestData.bind(this);\n this.onClickRow = this.onClickRow.bind(this);\n this.formatRow = this.formatRow.bind(this);\n this.formatRows = this.formatRows.bind(this);\n this.updateMaxPage = this.updateMaxPage.bind(this);\n this.initTabulatorComponent = this.initTabulatorComponent.bind(this);\n this.setSelection = this.setSelection.bind(this);\n this.addColumnAggregator = this.addColumnAggregator.bind(this);\n this.pool = new ElementPool(document);\n this.columnFactory = new ColumnDefinitionFactory(this.pool);\n }\n\n public componentWillLoad() {\n this.firstRequest = this.mode === 'remote';\n this.initTableSelection();\n }\n\n public componentDidLoad() {\n this.init();\n }\n\n public disconnectedCallback() {\n this.pool.clear();\n }\n\n @Watch('totalRows')\n protected totalRowsChanged() {\n this.updateMaxPage();\n }\n\n @Watch('pageSize')\n protected pageSizeChanged() {\n this.updateMaxPage();\n }\n\n @Watch('page')\n protected pageChanged() {\n if (!this.tabulator) {\n return;\n }\n\n if (this.tabulator.getPage() === this.page) {\n return;\n }\n\n this.tabulator.setPage(this.page);\n }\n\n @Watch('activeRow')\n protected activeRowChanged() {\n if (!this.tabulator) {\n return;\n }\n\n this.formatRows();\n }\n\n @Watch('data')\n protected updateData(newData: RowData[] = [], oldData: RowData[] = []) {\n const newIds = new Set(newData.map((item) => item.id ?? item));\n\n if (oldData.every((item) => newIds.has(item.id ?? item))) {\n this.tabulator.updateOrAddData(newData);\n\n return;\n }\n\n this.pool.releaseAll();\n\n setTimeout(() => {\n if (!this.tabulator) {\n return;\n }\n\n this.tabulator.replaceData(this.data);\n this.setSelection();\n });\n }\n\n @Watch('columns')\n protected updateColumns(newColumns: Column[], oldColumns: Column[]) {\n if (!this.tabulator) {\n return;\n }\n\n if (this.areSameColumns(newColumns, oldColumns)) {\n return;\n }\n\n const columnsInTable = this.tabulator\n .getColumns()\n .filter((c) => c.getField());\n\n const oldColumnsInTable = columnsInTable.map((c) =>\n oldColumns.find((old) => old.field === c.getField()),\n );\n\n if (this.areSameColumns(newColumns, oldColumnsInTable)) {\n return;\n }\n\n // Updating columns requires a reinitialization otherwise sorting will not work\n // afterwards\n this.init();\n }\n\n @Watch('aggregates')\n protected updateAggregates(\n newAggregates: ColumnAggregate[],\n oldAggregates: ColumnAggregate[],\n ) {\n if (!this.tabulator) {\n return;\n }\n\n if (isEqual(newAggregates, oldAggregates)) {\n return;\n }\n\n if (!this.haveSameAggregateFields(newAggregates, oldAggregates)) {\n this.init();\n\n return;\n }\n\n this.tabulator.recalc();\n this.tabulator.rowManager.redraw();\n }\n\n @Watch('selection')\n protected updateSelection(newSelection: any[]) {\n if (!this.tableSelection) {\n return;\n }\n\n this.tableSelection.setSelection(newSelection);\n }\n\n @Watch('selectable')\n protected updateSelectable() {\n if (this.tableSelection && !this.selectable) {\n this.tableSelection = null;\n }\n\n this.initTableSelection();\n this.init();\n }\n\n @Watch('sorting')\n protected updateSorting(\n newValue: ColumnSorter[],\n oldValue: ColumnSorter[],\n ) {\n const newSorting = this.getColumnSorter(newValue);\n const oldSorting = this.getColumnSorter(oldValue);\n if (isEqual(newSorting, oldSorting)) {\n return;\n }\n\n this.tabulator.setSort(newSorting);\n }\n\n private areSameColumns(newColumns: Column[], oldColumns: Column[]) {\n return (\n newColumns.length === oldColumns.length &&\n newColumns.every((column) => oldColumns.includes(column))\n );\n }\n\n private haveSameAggregateFields(\n newAggregates: ColumnAggregate[],\n oldAggregates: ColumnAggregate[],\n ) {\n const oldAggregateFields = oldAggregates?.map((a) => a.field) || [];\n\n return (\n newAggregates?.length === oldAggregates?.length &&\n !!newAggregates?.every((a) => oldAggregateFields.includes(a.field))\n );\n }\n\n private init() {\n if (this.tabulator) {\n this.pool.releaseAll();\n this.tabulator.destroy();\n }\n\n const table: HTMLElement =\n this.host.shadowRoot.querySelector('#tabulator-table');\n this.initTabulatorComponent(table);\n }\n\n /*\n * Tabulator requires that the html element it's rendered inside\n * has a size before it's created, otherwise it doesn't consider\n * it self renderedy completely. (the callback \"renderComplete\"\n * is never run).\n *\n * @param table {HTMLElement}\n *\n */\n private initTabulatorComponent(table: HTMLElement) {\n // Some browsers do not implement the ResizeObserver API...\n // If that's the case lets just create the table no\n // matter if its rendered or not.\n if (!('ResizeObserver' in window)) {\n this.tabulator = new TabulatorTable(table, this.getOptions());\n this.setSelection();\n\n return;\n }\n\n const observer = new ResizeObserver(() => {\n this.tabulator = new TabulatorTable(table, this.getOptions());\n this.setSelection();\n observer.unobserve(table);\n });\n observer.observe(table);\n }\n\n private initTableSelection() {\n if (this.selectable) {\n this.tableSelection = new TableSelection(\n () => this.tabulator,\n this.pool,\n this.select,\n );\n this.tableSelection.setSelection(this.selection);\n }\n }\n\n private setSelection() {\n if (!(this.tabulator && this.tableSelection)) {\n return;\n }\n\n this.tableSelection.setSelection(this.selection);\n }\n\n private updateMaxPage() {\n this.tabulator?.setMaxPage(this.calculatePageCount());\n }\n\n private getOptions(): Tabulator.Options {\n const ajaxOptions = this.getAjaxOptions();\n const paginationOptions = this.getPaginationOptions();\n const columnOptions = this.getColumnOptions();\n\n return {\n data: this.data,\n layout: mapLayout(this.layout),\n columns: this.getColumnDefinitions(),\n dataSorting: this.handleDataSorting,\n pageLoaded: this.handlePageLoaded,\n ...ajaxOptions,\n ...paginationOptions,\n rowClick: this.onClickRow,\n rowFormatter: this.formatRow,\n initialSort: this.getInitialSorting(),\n nestedFieldSeparator: false,\n ...columnOptions,\n };\n }\n\n private getInitialSorting(): Tabulator.Sorter[] {\n if (this.currentSorting && this.currentSorting.length) {\n return this.getColumnSorter(this.currentSorting);\n }\n\n return this.getColumnSorter(this.sorting);\n }\n\n private getColumnSorter(sorting: ColumnSorter[]): Tabulator.Sorter[] {\n return sorting.map((sorter: ColumnSorter) => {\n return {\n column: String(sorter.column.field),\n dir: sorter.direction.toLocaleLowerCase() as Tabulator.SortDirection,\n };\n });\n }\n\n private getColumnDefinitions(): Tabulator.ColumnDefinition[] {\n const columnDefinitions = this.columns\n .map(this.addColumnAggregator)\n .map(this.columnFactory.create);\n\n if (this.tableSelection) {\n return this.tableSelection.getColumnDefinitions(columnDefinitions);\n }\n\n return columnDefinitions;\n }\n\n private addColumnAggregator(column: Column<any>): Column<any> {\n if (!this.aggregates?.length || column.aggregator) {\n return column;\n }\n\n const aggregate = this.aggregates.find((a) => a.field === column.field);\n if (aggregate) {\n column.aggregator = (\n col?: Column,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _values?: any[],\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _data?: any[],\n ) => {\n if (!col) {\n return undefined;\n }\n\n const value = this.aggregates.find(\n (a) => a.field === col.field,\n )?.value;\n\n if (col.formatter) {\n return col.formatter(value);\n }\n\n return value;\n };\n }\n\n return column;\n }\n\n private getAjaxOptions(): Tabulator.OptionsData {\n if (!this.isRemoteMode()) {\n return {};\n }\n\n // Tabulator needs a URL to be set, even though this one will never be\n // used since we have our own custom `ajaxRequestFunc`\n const remoteUrl = 'https://localhost';\n\n return {\n ajaxSorting: true,\n ajaxURL: remoteUrl,\n ajaxRequestFunc: this.requestData,\n ajaxRequesting: this.handleAjaxRequesting,\n };\n }\n\n /*\n * The ajaxRequesting callback is triggered when ever an ajax request is made.\n *\n * Tabulator is requesting data with an AJAX request even though it has been\n * given data when it was created.\n *\n * It seems unnecessary for us to emit the `load` event as well when this\n * happens, since we can just initialize the table with the data that has been\n * given to us. Therefore, we abort the request if:\n *\n * * its the first time this method is called and,\n * * data has been sent in to the component as a prop\n *\n */\n private handleAjaxRequesting() {\n const abortRequest = this.firstRequest && !!this.data?.length;\n this.firstRequest = false;\n\n if (abortRequest) {\n setTimeout(() => {\n this.updateMaxPage();\n this.tabulator.replaceData(this.data);\n });\n\n return false;\n }\n\n return true;\n }\n\n private getPaginationOptions(): Tabulator.OptionsPagination {\n if (!this.pageSize) {\n return {};\n }\n\n return {\n pagination: this.isRemoteMode() ? 'remote' : 'local',\n paginationSize: this.pageSize,\n paginationInitialPage: this.page,\n };\n }\n\n private requestData(_, __, params: any): Promise<object> {\n const sorters = params.sorters;\n const currentPage = params.page;\n\n if (this.page !== currentPage) {\n this.changePage.emit(currentPage);\n }\n\n const columnSorters = sorters.map(createColumnSorter(this.columns));\n\n const load = {\n page: currentPage,\n sorters: columnSorters,\n };\n\n // In order to make limel-table behave more like a controlled component,\n // we always return the existing data from this function, therefore\n // relying on the consumer component to handle the loading\n // state via the loading prop, if it actually decides to load new data.\n const resolveExistingData = Promise.resolve({\n last_page: this.calculatePageCount(), // eslint-disable-line camelcase\n data: this.data,\n });\n\n if (isEqual(this.currentLoad, load)) {\n return resolveExistingData;\n }\n\n this.currentSorting = columnSorters;\n this.currentLoad = load;\n this.load.emit(load);\n\n return resolveExistingData;\n }\n\n private isRemoteMode(): boolean {\n return this.mode === 'remote';\n }\n\n private handleDataSorting(sorters: Tabulator.Sorter[]): void {\n if (this.isRemoteMode()) {\n return;\n }\n\n const columnSorters = sorters.map(createColumnSorter(this.columns));\n if (columnSorters.length === 0) {\n return;\n }\n\n this.sort.emit(columnSorters);\n }\n\n private handlePageLoaded(page: number): void {\n if (this.isRemoteMode()) {\n return;\n }\n\n this.changePage.emit(page);\n }\n\n private onClickRow(_ev, row: Tabulator.RowComponent): void {\n if (typeof row.getPosition === 'undefined') {\n // Not a data row, probably a CalcComponent\n return;\n }\n\n if (this.isActiveRow(row)) {\n this.activeRow = null;\n } else {\n this.activeRow = row.getData();\n }\n\n this.activate.emit(this.activeRow);\n }\n\n private getActiveRows: () => Tabulator.RowComponent[] = () => {\n if (!this.tabulator) {\n return [];\n }\n\n return this.tabulator.getRows('active');\n };\n\n private getActiveRowsData: () => object[] = () => {\n // Note: Tabulator.getData() creates copies of each data object\n // and will break this.selection.has checks, hence why this function\n // intentionally retrieves the data using the row components\n return this.getActiveRows().map((row) => row.getData());\n };\n\n private selectAllOnChange = (ev: CustomEvent<boolean>) => {\n const selectAll = ev.detail;\n\n ev.stopPropagation();\n ev.preventDefault();\n\n const newSelection = selectAll ? this.getActiveRowsData() : [];\n this.select.emit(newSelection);\n this.tableSelection.setSelection(newSelection);\n this.selectAll.emit(selectAll);\n };\n\n private formatRows() {\n this.tabulator.getRows().forEach(this.formatRow);\n }\n\n private formatRow(row: Tabulator.RowComponent) {\n if (this.isActiveRow(row)) {\n row.getElement().classList.add('active');\n } else {\n row.getElement().classList.remove('active');\n }\n\n const interactiveFeedbackElement = row\n .getElement()\n .getElementsByClassName('interactive-feedback');\n if (interactiveFeedbackElement.length === 0) {\n const element = row.getElement().ownerDocument.createElement('div');\n element.classList.add('interactive-feedback');\n row.getElement().prepend(element);\n }\n }\n\n private isActiveRow(row: Tabulator.RowComponent) {\n if (!this.activeRow) {\n return false;\n }\n\n const activeRowId = this.activeRow.id ?? null;\n\n if (activeRowId !== null) {\n return activeRowId === row.getData().id;\n }\n\n return this.activeRow === row.getData();\n }\n\n private calculatePageCount(): number {\n let total = this.totalRows;\n if (!total) {\n total = this.data.length;\n }\n\n return Math.ceil(total / this.pageSize);\n }\n\n private hasAggregation(columns: Column[]): boolean {\n return columns.some((column) => has(column, 'aggregator'));\n }\n\n private getColumnOptions = (): Tabulator.OptionsColumns => {\n if (!this.movableColumns) {\n return {};\n }\n\n return {\n movableColumns: true,\n columnMoved: this.handleMoveColumn,\n };\n };\n\n private handleMoveColumn = (_, components: Tabulator.ColumnComponent[]) => {\n const columns = components.map(this.findColumn).filter((c) => c);\n this.changeColumns.emit(columns);\n };\n\n private findColumn = (component: Tabulator.ColumnComponent): Column => {\n return this.columns.find((column) => {\n return (\n column.field === component.getField() &&\n column.title === component.getDefinition().title\n );\n });\n };\n\n render() {\n return (\n <Host\n class={{\n 'has-low-density': this.layout === 'lowDensity',\n }}\n >\n <div\n id=\"tabulator-container\"\n class={{\n 'has-pagination': this.totalRows > this.pageSize,\n 'has-aggregation': this.hasAggregation(this.columns),\n 'has-movable-columns': this.movableColumns,\n 'has-rowselector': this.selectable,\n 'has-selection': this.tableSelection?.hasSelection,\n }}\n >\n {/* Toggle style instead of removing the loader\n because removing the element will cause a rerender, breaking the\n tabulator table */}\n <div\n id=\"tabulator-loader\"\n style={{ display: this.loading ? 'flex' : 'none' }}\n >\n <limel-spinner size=\"large\" />\n </div>\n {this.renderEmptyMessage()}\n {this.renderSelectAll()}\n <div id=\"tabulator-table\" />\n </div>\n </Host>\n );\n }\n\n private renderSelectAll() {\n if (!this.selectable) {\n return;\n }\n\n const showSelectAll = !this.loading && this.tableSelection;\n\n return (\n <div\n class=\"select-all\"\n style={{ display: showSelectAll ? 'inline-block' : 'none' }}\n >\n <limel-checkbox\n onChange={this.selectAllOnChange}\n disabled={!this.data.length}\n checked={this.tableSelection?.hasSelection}\n indeterminate={\n this.tableSelection?.hasSelection &&\n this.selection?.length < this.data.length\n }\n />\n </div>\n );\n }\n\n private renderEmptyMessage() {\n const showEmptyMessage =\n !this.loading && !this.data.length && this.emptyMessage;\n\n return (\n <div\n id=\"tabulator-empty-text\"\n style={{ display: showEmptyMessage ? 'flex' : 'none' }}\n >\n <span>{this.emptyMessage}</span>\n </div>\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.types.js","sourceRoot":"","sources":["../../../src/components/table/table.types.ts"],"names":[],"mappings":"AAqJA;;;GAGG;AACH,MAAM,CAAN,IAAY,oBAyBX;AAzBD,WAAY,oBAAoB;EAC5B;;KAEG;EACH,uCAAe,CAAA;EAEf;;KAEG;EACH,uCAAe,CAAA;EAEf;;KAEG;EACH,uCAAe,CAAA;EAEf;;KAEG;EACH,mCAAW,CAAA;EAEX;;KAEG;EACH,uCAAe,CAAA;AACnB,CAAC,EAzBW,oBAAoB,KAApB,oBAAoB,QAyB/B","sourcesContent":["/**\n * Defines the data for a table\n * @public\n */\nexport interface Column<T extends object = any> {\n /**\n * Column title to be displayed\n */\n title: string;\n\n /**\n * Name of the field in the data\n */\n field: keyof T;\n\n /**\n * Function to format the value before rendering\n */\n formatter?: TableFormatter;\n\n /**\n * Component used to render the field value\n */\n component?: TableComponentDefinition;\n\n /**\n * Type of aggregator to use for the column\n */\n aggregator?: ColumnAggregatorType | ColumnAggregatorFunction<T>;\n\n /**\n * A component used to render inside the column header\n */\n headerComponent?: TableComponentDefinition;\n\n /**\n * Sets the horizontal text alignment for the column\n */\n horizontalAlign?: 'left' | 'center' | 'right';\n\n /**\n * Defines whether end-user can sort a column\n */\n headerSort?: boolean;\n}\n\n/**\n * Definition for a formatter function\n * @param value - The value to be formatted\n * @param data - The data for the current row\n * @returns The formatted value\n * @public\n */\nexport type TableFormatter = (value: any, data?: object) => string;\n\n/**\n * The `component` key in the schema uses this interface to define a\n * component to be rendered inside a cell in the table.\n *\n * @note The table will display the component as `inline-block` in order\n * to give the column the correct size. If the component should have the\n * full width of the column, this might have to be overridden by setting\n * the display mode to `block`, e.g.\n *\n * ```css\n * :host(*) {\n * display: block !important;\n * }\n * ```\n * @public\n */\nexport interface TableComponentDefinition {\n /**\n * Name of the component\n */\n name: string;\n\n /**\n * Properties to send to the component\n */\n props?: Record<string, any>;\n\n /**\n * Factory for creating properties dynamically for a custom component.\n *\n * The properties returned from this function will be merged with the\n * `props` properties when the component is created.\n *\n * When the propsFactory is used for header components there will be no data available.\n *\n * @param data - The data for the current row\n * @returns Properties for the component\n */\n propsFactory?: (data: object) => Record<string, any>;\n}\n\n/**\n * Interface for custom components rendered inside a `limel-table`.\n * @public\n */\nexport interface TableComponent<T extends object = any> {\n /**\n * Name of the field being rendered\n */\n field?: string;\n\n /**\n * Value being rendered\n */\n value?: any;\n\n /**\n * Data for the current row of the table\n */\n data?: T;\n}\n\n/**\n * Indicates whether the specified column is sorted ascending or descending.\n * @public\n */\nexport interface ColumnSorter {\n /**\n * The column being sorted\n */\n column: Column;\n\n /**\n * The direction to sort on\n */\n direction: 'ASC' | 'DESC';\n}\n\n/**\n * Specifies the current page, and which columns the table is currently sorted on.\n * @public\n */\nexport interface TableParams {\n /**\n * The current page being set\n */\n page: number;\n\n /**\n * Sorters applied to the current page\n */\n sorters?: ColumnSorter[];\n}\n\n/**\n * The built-in aggregators available for columns\n * @public\n */\nexport enum ColumnAggregatorType {\n /**\n * Calculates the average value of all numerical cells in the column\n */\n Average = 'avg',\n\n /**\n * Displays the maximum value from all numerical cells in the column\n */\n Maximum = 'max',\n\n /**\n * Displays the minimum value from all numerical cells in the column\n */\n Minimum = 'min',\n\n /**\n * Displays the sum of all numerical cells in the column\n */\n Sum = 'sum',\n\n /**\n * Counts the number of non empty cells in the column\n */\n Count = 'count',\n}\n\n/**\n * Instead of using one of the built-in aggregators, it is possible to\n * define a custom aggregator function.\n *\n * @param column - the configuration for the column\n * @param values - list of all values to be aggregated\n * @param data - list of all objects to be aggregated\n * @returns the aggregated data\n *\n * @public\n */\nexport type ColumnAggregatorFunction<T = object> = (\n column?: Column,\n values?: any[],\n data?: T[],\n) => any;\n\n/**\n * Defines aggregate values for columns\n * @public\n */\nexport interface ColumnAggregate {\n /**\n * The name of the `Column` field\n */\n field: string;\n /**\n * The aggregate value\n */\n value: any;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"table.types.js","sourceRoot":"","sources":["../../../src/components/table/table.types.ts"],"names":[],"mappings":"AAqJA;;;GAGG;AACH,MAAM,CAAN,IAAY,oBAyBX;AAzBD,WAAY,oBAAoB;EAC5B;;KAEG;EACH,uCAAe,CAAA;EAEf;;KAEG;EACH,uCAAe,CAAA;EAEf;;KAEG;EACH,uCAAe,CAAA;EAEf;;KAEG;EACH,mCAAW,CAAA;EAEX;;KAEG;EACH,uCAAe,CAAA;AACnB,CAAC,EAzBW,oBAAoB,KAApB,oBAAoB,QAyB/B","sourcesContent":["/**\n * Defines the data for a table\n * @public\n */\nexport interface Column<T extends object = any> {\n /**\n * Column title to be displayed\n */\n title: string;\n\n /**\n * Name of the field in the data\n */\n field: keyof T;\n\n /**\n * Function to format the value before rendering\n */\n formatter?: TableFormatter;\n\n /**\n * Component used to render the field value\n */\n component?: TableComponentDefinition;\n\n /**\n * Type of aggregator to use for the column\n */\n aggregator?: ColumnAggregatorType | ColumnAggregatorFunction<T>;\n\n /**\n * A component used to render inside the column header\n */\n headerComponent?: TableComponentDefinition;\n\n /**\n * Sets the horizontal text alignment for the column\n */\n horizontalAlign?: 'left' | 'center' | 'right';\n\n /**\n * Defines whether end-user can sort a column\n */\n headerSort?: boolean;\n}\n\n/**\n * Definition for a formatter function\n * @param value - The value to be formatted\n * @param data - The data for the current row\n * @returns The formatted value\n * @public\n */\nexport type TableFormatter = (value: any, data?: object) => string;\n\n/**\n * The `component` key in the schema uses this interface to define a\n * component to be rendered inside a cell in the table.\n *\n * @note The table will display the component as `inline-block` in order\n * to give the column the correct size. If the component should have the\n * full width of the column, this might have to be overridden by setting\n * the display mode to `block`, e.g.\n *\n * ```css\n * :host(*) {\n * display: block !important;\n * }\n * ```\n * @public\n */\nexport interface TableComponentDefinition {\n /**\n * Name of the component\n */\n name: string;\n\n /**\n * Properties to send to the component\n */\n props?: Record<string, any>;\n\n /**\n * Factory for creating properties dynamically for a custom component.\n *\n * The properties returned from this function will be merged with the\n * `props` properties when the component is created.\n *\n * When the propsFactory is used for header components there will be no data available.\n *\n * @param data - The data for the current row\n * @returns Properties for the component\n */\n propsFactory?: (data: object) => Record<string, any>;\n}\n\n/**\n * Interface for custom components rendered inside a `limel-table`.\n * @public\n */\nexport interface TableComponent<T extends object = any> {\n /**\n * Name of the field being rendered\n */\n field?: string;\n\n /**\n * Value being rendered\n */\n value?: any;\n\n /**\n * Data for the current row of the table\n */\n data?: T;\n}\n\n/**\n * Indicates whether the specified column is sorted ascending or descending.\n * @public\n */\nexport interface ColumnSorter {\n /**\n * The column being sorted\n */\n column: Column;\n\n /**\n * The direction to sort on\n */\n direction: 'ASC' | 'DESC';\n}\n\n/**\n * Specifies the current page, and which columns the table is currently sorted on.\n * @public\n */\nexport interface TableParams {\n /**\n * The current page being set\n */\n page: number;\n\n /**\n * Sorters applied to the current page\n */\n sorters?: ColumnSorter[];\n}\n\n/**\n * The built-in aggregators available for columns\n * @public\n */\nexport enum ColumnAggregatorType {\n /**\n * Calculates the average value of all numerical cells in the column\n */\n Average = 'avg',\n\n /**\n * Displays the maximum value from all numerical cells in the column\n */\n Maximum = 'max',\n\n /**\n * Displays the minimum value from all numerical cells in the column\n */\n Minimum = 'min',\n\n /**\n * Displays the sum of all numerical cells in the column\n */\n Sum = 'sum',\n\n /**\n * Counts the number of non empty cells in the column\n */\n Count = 'count',\n}\n\n/**\n * Instead of using one of the built-in aggregators, it is possible to\n * define a custom aggregator function.\n *\n * @param column - the configuration for the column\n * @param values - list of all values to be aggregated\n * @param data - list of all objects to be aggregated\n * @returns the aggregated data\n *\n * @public\n */\nexport type ColumnAggregatorFunction<T = object> = (\n column?: Column,\n values?: any[],\n data?: T[],\n) => any;\n\n/**\n * Defines aggregate values for columns\n * @public\n */\nexport interface ColumnAggregate {\n /**\n * The name of the `Column` field\n */\n field: string;\n /**\n * The aggregate value\n */\n value: any;\n}\n\n/**\n * Data for identifying a row of the table\n * @public\n */\nexport type RowData = {\n id?: string | number;\n};\n"]}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"index.js","mappings":"AAwSA;;;;IAIY;AAAZ,WAAY,cAAc;;;;EAItB,qCAAmB,CAAA;;;;EAKnB,+BAAa,CAAA;;;;;;;;EASb,6BAAW,CAAA;AACf,CAAC,EAnBW,cAAc,KAAd,cAAc;;ACvJ1B;;;;IAIY;AAAZ,WAAY,oBAAoB;;;;EAI5B,uCAAe,CAAA;;;;EAKf,uCAAe,CAAA;;;;EAKf,uCAAe,CAAA;;;;EAKf,mCAAW,CAAA;;;;EAKX,uCAAe,CAAA;AACnB,CAAC,EAzBW,oBAAoB,KAApB,oBAAoB;;;;","names":[],"sources":["./src/components/form/form.types.ts","./src/components/table/table.types.ts"],"sourcesContent":["import { JSONSchema7 } from 'json-schema';\nimport { Help } from '../help/help.types';\nimport { EventEmitter } from '@stencil/core';\n\n/**\n * EventEmitter from `@stencil/core`.\n *\n * @public\n */\nexport { EventEmitter } from '@stencil/core';\n\ndeclare module 'json-schema' {\n interface JSONSchema7 {\n /**\n * @internal\n * Unique identifier for the schema\n */\n id?: string;\n\n /**\n * Lime elements specific options that can be specified in a schema\n */\n lime?: Omit<LimeSchemaOptions, 'layout'> & {\n layout?: Partial<LimeLayoutOptions>;\n };\n }\n}\n\n/**\n * @public\n */\nexport interface ValidationStatus {\n /**\n * True if the form is valid, false otherwise\n *\n * If the form is invalid, any errors can be found on the `errors` property\n */\n valid: boolean;\n\n /**\n * List of validation errors\n */\n errors?: FormError[];\n}\n\n/**\n * @public\n */\nexport interface FormError {\n /**\n * Name of the error\n */\n name: string;\n\n /**\n * Params of the error\n */\n params?: unknown;\n\n /**\n * Name of the invalid property\n */\n property: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath: string;\n\n /**\n * String describing the error\n */\n message: string;\n}\n\n/**\n * @public\n */\nexport type ValidationError = {\n /**\n * Name of the field the error belongs to\n */\n [key: string]: string[] | ValidationError;\n};\n\n/**\n * @public\n */\nexport interface FormComponent<T = any> {\n /**\n * The value of the current property\n */\n value: T;\n\n /**\n * Whether or not the current property is required\n */\n required?: boolean;\n\n /**\n * Whether or not the current property is readonly\n */\n readonly?: boolean;\n\n /**\n * Whether or not the current property is disabled\n */\n disabled?: boolean;\n\n /**\n * The label of the current property\n */\n label?: string;\n\n /**\n * The helper text for the current property\n */\n helperText?: string;\n\n /**\n * Additional contextual information about the form\n */\n formInfo?: FormInfo;\n\n /**\n * The event to emit when the value of the current property has changed\n */\n change: EventEmitter<T>;\n}\n\n/**\n * @public\n */\nexport interface FormInfo {\n /**\n * The schema of the current property\n */\n schema?: FormSchema;\n\n /**\n * The schema of the whole form\n */\n rootSchema?: FormSchema;\n\n /**\n * A tree of errors for this property and its children\n */\n errorSchema?: object;\n\n /**\n * The value of the whole form\n */\n rootValue?: any;\n\n /**\n * The name of the current property\n */\n name?: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath?: string[];\n}\n\n/**\n * Lime elements specific options that can be specified under the `lime` key in\n * a schema, e.g.\n *\n * ```ts\n * const schema = {\n * type: 'object',\n * lime: {\n * collapsible: true,\n * },\n * };\n * ```\n *\n * @public\n */\nexport interface LimeSchemaOptions {\n /**\n * When specified on an object it will render all sub components inside a\n * collapsible section\n */\n collapsible?: boolean;\n\n /**\n * When `collapsible` is `true`, set this to `false` to make the\n * collapsible section load in the open state.\n * Defaults to `true`.\n */\n collapsed?: boolean;\n\n /**\n * Will render the field using the specified component. The component\n * should implement the `FormComponent` interface\n */\n component?: FormComponentOptions;\n\n /**\n * When specified on an object it will render the sub components with the\n * specified layout\n */\n layout?: LimeLayoutOptions;\n\n /**\n * Mark the field as disabled\n */\n disabled?: boolean;\n\n help?: string | Partial<Help>;\n}\n\n/**\n * Options for a layout to be used in a form\n * @public\n */\nexport type LimeLayoutOptions = GridLayoutOptions & RowLayoutOptions;\n\n/**\n * Options for a component to be rendered inside a form\n *\n * @public\n */\nexport interface FormComponentOptions {\n /**\n * Name of the component\n */\n name?: string;\n\n /**\n * Extra properties to give the component in addition to the properties\n * specified on the `FormComponent` interface\n */\n props?: Record<string, any>;\n}\n\n/**\n * @public\n */\nexport interface FormLayoutOptions<\n T extends FormLayoutType | `${FormLayoutType}` = FormLayoutType.Default,\n> {\n /**\n * The type of layout to use\n */\n type: T;\n}\n\n/**\n * Layout options for a grid layout\n * @public\n */\nexport interface GridLayoutOptions\n extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of columns in the form\n */\n // eslint-disable-next-line no-magic-numbers\n colSpan?: 1 | 2 | 3 | 4 | 5 | 'all';\n\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of rows in the form\n */\n rowSpan?: number;\n\n /**\n * Number of columns to use in the layout\n */\n // eslint-disable-next-line no-magic-numbers\n columns?: 1 | 2 | 3 | 4 | 5;\n\n /**\n * Attempts to fill in holes earlier in the grid, if smaller items come up\n * later. This may cause items to appear out-of-order, when doing so would\n * fill holes left by larger items. Defaults to `true`.\n */\n dense?: boolean;\n}\n\n/**\n * Layout options for a row layout\n * @public\n */\nexport interface RowLayoutOptions\n extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {\n /**\n * When specified on a field, the chosen icon will be displayed\n * on the left side of the row, beside the title.\n */\n icon?: string;\n}\n\n/**\n * Represents the layout types for a form.\n * @public\n */\nexport enum FormLayoutType {\n /**\n * The default layout\n */\n Default = 'default',\n\n /**\n * Render the form fields using a responsive grid layout\n */\n Grid = 'grid',\n\n /**\n * Render the form fields in full-width rows.\n * Each row can have a leading `icon`, and a field.\n * `title` and `description` provided by the schema will be placed\n * on the row itself, and not on the field.\n * This layout is good for creating UIs for user settings pages.\n */\n Row = 'row',\n}\n\n/**\n * Represents the JSON schema with Lime specific options\n * @public\n */\nexport interface FormSchema<T extends Record<string, any> = any>\n extends JSONSchema7 {\n /**\n * The value of \"items\" MUST be either a valid JSON Schema or an array\n * of valid JSON Schemas.\n *\n * This keyword determines how child instances validate for arrays, and\n * does not directly validate the immediate instance itself.\n *\n * If \"items\" is a schema, validation succeeds if all elements in the\n * array successfully validate against that schema.\n *\n * If \"items\" is an array of schemas, validation succeeds if each\n * element of the instance validates against the schema at the same\n * position, if any.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.1\n */\n items?: FormSchemaArrayItem<T> | Array<FormSchemaArrayItem<T>>;\n\n /**\n * The value of \"items\" MUST be either a valid JSON Schema or an array\n * of valid JSON Schemas.\n *\n * This keyword determines how child instances validate for arrays, and\n * does not directly validate the immediate instance itself.\n *\n * If \"items\" is a schema, validation succeeds if all elements in the\n * array successfully validate against that schema.\n *\n * If \"items\" is an array of schemas, validation succeeds if each\n * element of the instance validates against the schema at the same\n * position, if any.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.2\n */\n additionalItems?: FormSchemaArrayItem<T>;\n\n /**\n * The value of this keyword MUST be a valid JSON Schema.\n *\n * An array instance is valid against \"contains\" if at least one of its\n * elements is valid against the given schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.6\n */\n contains?: FormSchemaArrayItem<T>;\n\n /**\n * The value of this keyword MUST be an array. Elements of this array,\n * if any, MUST be strings, and MUST be unique.\n *\n * An object instance is valid against this keyword if every item in the\n * array is the name of a property in the instance.\n *\n * Omitting this keyword has the same behavior as an empty array.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.3\n */\n required?: Array<ReplaceObjectType<T, Extract<keyof T, string>, string>>;\n\n /**\n * The value of \"properties\" MUST be an object. Each value of this\n * object MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself.\n *\n * Validation succeeds if, for each name that appears in both the\n * instance and as a name within this keyword's value, the child\n * instance for that name successfully validates against the\n * corresponding schema.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.4\n */\n properties?: ReplaceObjectType<\n T,\n FormSubKeySchema<T>,\n Record<string, FormSchema>\n >;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against all schemas defined by this keyword's\n * value.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.1\n */\n allOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against at least one schema defined by this\n * keyword's value.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.2\n */\n anyOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against exactly one schema defined by this\n * keyword's value.\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.3\n */\n oneOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * The value of \"patternProperties\" MUST be an object. Each property\n * name of this object SHOULD be a valid regular expression, according\n * to the ECMA 262 regular expression dialect. Each property value of\n * this object MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself. Validation\n * of the primitive instance type against this keyword always succeeds.\n *\n * Validation succeeds if, for each instance name that matches any\n * regular expressions that appear as a property name in this keyword's\n * value, the child instance for that name successfully validates\n * against each schema that corresponds to a matching regular\n * expression.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.5\n */\n patternProperties?: Record<string, FormSchema>;\n\n /**\n * The value of \"additionalProperties\" MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself.\n *\n * Validation with \"additionalProperties\" applies only to the child\n * values of instance names that do not match any names in \"properties\",\n * and do not match any regular expression in \"patternProperties\".\n *\n * For all such properties, validation succeeds if the child instance\n * validates against the \"additionalProperties\" schema.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.6\n */\n additionalProperties?: FormSchema | boolean;\n\n /**\n * This keyword specifies rules that are evaluated if the instance is an\n * object and contains a certain property.\n *\n * This keyword's value MUST be an object. Each property specifies a\n * dependency. Each dependency value MUST be an array or a valid JSON\n * Schema.\n *\n * If the dependency value is a subschema, and the dependency key is a\n * property in the instance, the entire instance must validate against\n * the dependency value.\n *\n * If the dependency value is an array, each element in the array, if\n * any, MUST be a string, and MUST be unique. If the dependency key is\n * a property in the instance, each of the items in the dependency value\n * must be a property that exists in the instance.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.7\n */\n dependencies?: Record<string, FormSchema | string[]>;\n\n /**\n * The value of \"propertyNames\" MUST be a valid JSON Schema.\n *\n * If the instance is an object, this keyword validates if every\n * property name in the instance validates against the provided schema.\n * Note the property name that the schema is testing will always be a\n * string.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.8\n */\n propertyNames?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * This validation outcome of this keyword's subschema has no direct\n * effect on the overall validation result. Rather, it controls which\n * of the \"then\" or \"else\" keywords are evaluated.\n *\n * Instances that successfully validate against this keyword's subschema\n * MUST also be valid against the subschema value of the \"then\" keyword,\n * if present.\n *\n * Instances that fail to validate against this keyword's subschema MUST\n * also be valid against the subschema value of the \"else\" keyword, if\n * present.\n *\n * If annotations (Section 3.3) are being collected, they are collected\n * from this keyword's subschema in the usual way, including when the\n * keyword is present without either \"then\" or \"else\".\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.1\n */\n if?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * This validation outcome of this keyword's subschema has no direct\n * effect on the overall validation result. Rather, it controls which\n * of the \"then\" or \"else\" keywords are evaluated.\n *\n * Instances that successfully validate against this keyword's subschema\n * MUST also be valid against the subschema value of the \"then\" keyword,\n * if present.\n *\n * Instances that fail to validate against this keyword's subschema MUST\n * also be valid against the subschema value of the \"else\" keyword, if\n * present.\n *\n * If annotations (Section 3.3) are being collected, they are collected\n * from this keyword's subschema in the usual way, including when the\n * keyword is present without either \"then\" or \"else\".\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.2\n */\n then?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * When \"if\" is present, and the instance fails to validate against its\n * subschema, then valiation succeeds against this keyword if the\n * instance successfully validates against this keyword's subschema.\n *\n * This keyword has no effect when \"if\" is absent, or when the instance\n * successfully validates against its subschema. Implementations MUST\n * NOT evaluate the instance against this keyword, for either validation\n * or annotation collection purposes, in such cases.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.3\n */\n else?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * An instance is valid against this keyword if it fails to validate\n * successfully against the schema defined by this keyword.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.4\n */\n not?: FormSchema;\n\n /**\n * The \"$defs\" keywords provides a standardized location for\n * schema authors to inline re-usable JSON Schemas into a more general\n * schema. The keyword does not directly affect the validation result.\n *\n * This keyword's value MUST be an object. Each member value of this\n * object MUST be a valid JSON Schema.\n *\n * As an example, here is a schema describing an array of positive\n * integers, where the positive integer constraint is a subschema in\n * \"definitions\":\n * ```\n * {\n * \"type\": \"array\",\n * \"items\": { \"$ref\": \"#/definitions/positiveInteger\" },\n * \"definitions\": {\n * \"positiveInteger\": {\n * \"type\": \"integer\",\n * \"exclusiveMinimum\": 0\n * }\n * }\n * }\n * ```\n *\n * $defs is the newer keyword introduced in the JSON Schema Draft 2019-09, while definitions is from the older drafts.\n *\n * The main difference is that definitions is no longer an official keyword in the latest JSON Schema specification (Draft 2019-09 and later),\n * but it is still widely supported for backward compatibility.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-9\n */\n $defs?: Record<string, FormSchema>;\n\n /**\n * The \"definitions\" keywords provides a standardized location for\n * schema authors to inline re-usable JSON Schemas into a more general\n * schema. The keyword does not directly affect the validation result.\n *\n * This keyword's value MUST be an object. Each member value of this\n * object MUST be a valid JSON Schema.\n *\n * As an example, here is a schema describing an array of positive\n * integers, where the positive integer constraint is a subschema in\n * \"definitions\":\n * ```\n * {\n * \"type\": \"array\",\n * \"items\": { \"$ref\": \"#/definitions/positiveInteger\" },\n * \"definitions\": {\n * \"positiveInteger\": {\n * \"type\": \"integer\",\n * \"exclusiveMinimum\": 0\n * }\n * }\n * }\n * ```\n *\n * $defs is the newer keyword introduced in the JSON Schema Draft 2019-09, while definitions is from the older drafts.\n *\n * The main difference is that definitions is no longer an official keyword in the latest JSON Schema specification (Draft 2019-09 and later),\n * but it is still widely supported for backward compatibility.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-9\n */\n definitions?: Record<string, FormSchema>;\n}\n\n/**\n * Utility type for replacing object types with a specified type\n * @public\n */\nexport type ReplaceObjectType<T, AllowedType, ElseType> = T extends any[]\n ? ElseType\n : T extends Record<string, any>\n ? AllowedType\n : ElseType;\n\n/**\n * Utility type for supporting nested sub items in arrays\n * @public\n */\nexport type FormSchemaArrayItem<T> = T extends any[]\n ? FormSchema<T[Extract<keyof T, number>]>\n : FormSchema;\n\n/**\n * Utility type for recursive properties in a schema\n * @public\n */\nexport type FormSubKeySchema<TObj> = Partial<{\n [Key in Extract<keyof TObj, any>]: FormSchema<TObj[Key]>;\n}>;\n","/**\n * Defines the data for a table\n * @public\n */\nexport interface Column<T extends object = any> {\n /**\n * Column title to be displayed\n */\n title: string;\n\n /**\n * Name of the field in the data\n */\n field: keyof T;\n\n /**\n * Function to format the value before rendering\n */\n formatter?: TableFormatter;\n\n /**\n * Component used to render the field value\n */\n component?: TableComponentDefinition;\n\n /**\n * Type of aggregator to use for the column\n */\n aggregator?: ColumnAggregatorType | ColumnAggregatorFunction<T>;\n\n /**\n * A component used to render inside the column header\n */\n headerComponent?: TableComponentDefinition;\n\n /**\n * Sets the horizontal text alignment for the column\n */\n horizontalAlign?: 'left' | 'center' | 'right';\n\n /**\n * Defines whether end-user can sort a column\n */\n headerSort?: boolean;\n}\n\n/**\n * Definition for a formatter function\n * @param value - The value to be formatted\n * @param data - The data for the current row\n * @returns The formatted value\n * @public\n */\nexport type TableFormatter = (value: any, data?: object) => string;\n\n/**\n * The `component` key in the schema uses this interface to define a\n * component to be rendered inside a cell in the table.\n *\n * @note The table will display the component as `inline-block` in order\n * to give the column the correct size. If the component should have the\n * full width of the column, this might have to be overridden by setting\n * the display mode to `block`, e.g.\n *\n * ```css\n * :host(*) {\n * display: block !important;\n * }\n * ```\n * @public\n */\nexport interface TableComponentDefinition {\n /**\n * Name of the component\n */\n name: string;\n\n /**\n * Properties to send to the component\n */\n props?: Record<string, any>;\n\n /**\n * Factory for creating properties dynamically for a custom component.\n *\n * The properties returned from this function will be merged with the\n * `props` properties when the component is created.\n *\n * When the propsFactory is used for header components there will be no data available.\n *\n * @param data - The data for the current row\n * @returns Properties for the component\n */\n propsFactory?: (data: object) => Record<string, any>;\n}\n\n/**\n * Interface for custom components rendered inside a `limel-table`.\n * @public\n */\nexport interface TableComponent<T extends object = any> {\n /**\n * Name of the field being rendered\n */\n field?: string;\n\n /**\n * Value being rendered\n */\n value?: any;\n\n /**\n * Data for the current row of the table\n */\n data?: T;\n}\n\n/**\n * Indicates whether the specified column is sorted ascending or descending.\n * @public\n */\nexport interface ColumnSorter {\n /**\n * The column being sorted\n */\n column: Column;\n\n /**\n * The direction to sort on\n */\n direction: 'ASC' | 'DESC';\n}\n\n/**\n * Specifies the current page, and which columns the table is currently sorted on.\n * @public\n */\nexport interface TableParams {\n /**\n * The current page being set\n */\n page: number;\n\n /**\n * Sorters applied to the current page\n */\n sorters?: ColumnSorter[];\n}\n\n/**\n * The built-in aggregators available for columns\n * @public\n */\nexport enum ColumnAggregatorType {\n /**\n * Calculates the average value of all numerical cells in the column\n */\n Average = 'avg',\n\n /**\n * Displays the maximum value from all numerical cells in the column\n */\n Maximum = 'max',\n\n /**\n * Displays the minimum value from all numerical cells in the column\n */\n Minimum = 'min',\n\n /**\n * Displays the sum of all numerical cells in the column\n */\n Sum = 'sum',\n\n /**\n * Counts the number of non empty cells in the column\n */\n Count = 'count',\n}\n\n/**\n * Instead of using one of the built-in aggregators, it is possible to\n * define a custom aggregator function.\n *\n * @param column - the configuration for the column\n * @param values - list of all values to be aggregated\n * @param data - list of all objects to be aggregated\n * @returns the aggregated data\n *\n * @public\n */\nexport type ColumnAggregatorFunction<T = object> = (\n column?: Column,\n values?: any[],\n data?: T[],\n) => any;\n\n/**\n * Defines aggregate values for columns\n * @public\n */\nexport interface ColumnAggregate {\n /**\n * The name of the `Column` field\n */\n field: string;\n /**\n * The aggregate value\n */\n value: any;\n}\n"],"version":3}
|
|
1
|
+
{"file":"index.js","mappings":"AAwSA;;;;IAIY;AAAZ,WAAY,cAAc;;;;EAItB,qCAAmB,CAAA;;;;EAKnB,+BAAa,CAAA;;;;;;;;EASb,6BAAW,CAAA;AACf,CAAC,EAnBW,cAAc,KAAd,cAAc;;ACvJ1B;;;;IAIY;AAAZ,WAAY,oBAAoB;;;;EAI5B,uCAAe,CAAA;;;;EAKf,uCAAe,CAAA;;;;EAKf,uCAAe,CAAA;;;;EAKf,mCAAW,CAAA;;;;EAKX,uCAAe,CAAA;AACnB,CAAC,EAzBW,oBAAoB,KAApB,oBAAoB;;;;","names":[],"sources":["./src/components/form/form.types.ts","./src/components/table/table.types.ts"],"sourcesContent":["import { JSONSchema7 } from 'json-schema';\nimport { Help } from '../help/help.types';\nimport { EventEmitter } from '@stencil/core';\n\n/**\n * EventEmitter from `@stencil/core`.\n *\n * @public\n */\nexport { EventEmitter } from '@stencil/core';\n\ndeclare module 'json-schema' {\n interface JSONSchema7 {\n /**\n * @internal\n * Unique identifier for the schema\n */\n id?: string;\n\n /**\n * Lime elements specific options that can be specified in a schema\n */\n lime?: Omit<LimeSchemaOptions, 'layout'> & {\n layout?: Partial<LimeLayoutOptions>;\n };\n }\n}\n\n/**\n * @public\n */\nexport interface ValidationStatus {\n /**\n * True if the form is valid, false otherwise\n *\n * If the form is invalid, any errors can be found on the `errors` property\n */\n valid: boolean;\n\n /**\n * List of validation errors\n */\n errors?: FormError[];\n}\n\n/**\n * @public\n */\nexport interface FormError {\n /**\n * Name of the error\n */\n name: string;\n\n /**\n * Params of the error\n */\n params?: unknown;\n\n /**\n * Name of the invalid property\n */\n property: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath: string;\n\n /**\n * String describing the error\n */\n message: string;\n}\n\n/**\n * @public\n */\nexport type ValidationError = {\n /**\n * Name of the field the error belongs to\n */\n [key: string]: string[] | ValidationError;\n};\n\n/**\n * @public\n */\nexport interface FormComponent<T = any> {\n /**\n * The value of the current property\n */\n value: T;\n\n /**\n * Whether or not the current property is required\n */\n required?: boolean;\n\n /**\n * Whether or not the current property is readonly\n */\n readonly?: boolean;\n\n /**\n * Whether or not the current property is disabled\n */\n disabled?: boolean;\n\n /**\n * The label of the current property\n */\n label?: string;\n\n /**\n * The helper text for the current property\n */\n helperText?: string;\n\n /**\n * Additional contextual information about the form\n */\n formInfo?: FormInfo;\n\n /**\n * The event to emit when the value of the current property has changed\n */\n change: EventEmitter<T>;\n}\n\n/**\n * @public\n */\nexport interface FormInfo {\n /**\n * The schema of the current property\n */\n schema?: FormSchema;\n\n /**\n * The schema of the whole form\n */\n rootSchema?: FormSchema;\n\n /**\n * A tree of errors for this property and its children\n */\n errorSchema?: object;\n\n /**\n * The value of the whole form\n */\n rootValue?: any;\n\n /**\n * The name of the current property\n */\n name?: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath?: string[];\n}\n\n/**\n * Lime elements specific options that can be specified under the `lime` key in\n * a schema, e.g.\n *\n * ```ts\n * const schema = {\n * type: 'object',\n * lime: {\n * collapsible: true,\n * },\n * };\n * ```\n *\n * @public\n */\nexport interface LimeSchemaOptions {\n /**\n * When specified on an object it will render all sub components inside a\n * collapsible section\n */\n collapsible?: boolean;\n\n /**\n * When `collapsible` is `true`, set this to `false` to make the\n * collapsible section load in the open state.\n * Defaults to `true`.\n */\n collapsed?: boolean;\n\n /**\n * Will render the field using the specified component. The component\n * should implement the `FormComponent` interface\n */\n component?: FormComponentOptions;\n\n /**\n * When specified on an object it will render the sub components with the\n * specified layout\n */\n layout?: LimeLayoutOptions;\n\n /**\n * Mark the field as disabled\n */\n disabled?: boolean;\n\n help?: string | Partial<Help>;\n}\n\n/**\n * Options for a layout to be used in a form\n * @public\n */\nexport type LimeLayoutOptions = GridLayoutOptions & RowLayoutOptions;\n\n/**\n * Options for a component to be rendered inside a form\n *\n * @public\n */\nexport interface FormComponentOptions {\n /**\n * Name of the component\n */\n name?: string;\n\n /**\n * Extra properties to give the component in addition to the properties\n * specified on the `FormComponent` interface\n */\n props?: Record<string, any>;\n}\n\n/**\n * @public\n */\nexport interface FormLayoutOptions<\n T extends FormLayoutType | `${FormLayoutType}` = FormLayoutType.Default,\n> {\n /**\n * The type of layout to use\n */\n type: T;\n}\n\n/**\n * Layout options for a grid layout\n * @public\n */\nexport interface GridLayoutOptions\n extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of columns in the form\n */\n // eslint-disable-next-line no-magic-numbers\n colSpan?: 1 | 2 | 3 | 4 | 5 | 'all';\n\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of rows in the form\n */\n rowSpan?: number;\n\n /**\n * Number of columns to use in the layout\n */\n // eslint-disable-next-line no-magic-numbers\n columns?: 1 | 2 | 3 | 4 | 5;\n\n /**\n * Attempts to fill in holes earlier in the grid, if smaller items come up\n * later. This may cause items to appear out-of-order, when doing so would\n * fill holes left by larger items. Defaults to `true`.\n */\n dense?: boolean;\n}\n\n/**\n * Layout options for a row layout\n * @public\n */\nexport interface RowLayoutOptions\n extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {\n /**\n * When specified on a field, the chosen icon will be displayed\n * on the left side of the row, beside the title.\n */\n icon?: string;\n}\n\n/**\n * Represents the layout types for a form.\n * @public\n */\nexport enum FormLayoutType {\n /**\n * The default layout\n */\n Default = 'default',\n\n /**\n * Render the form fields using a responsive grid layout\n */\n Grid = 'grid',\n\n /**\n * Render the form fields in full-width rows.\n * Each row can have a leading `icon`, and a field.\n * `title` and `description` provided by the schema will be placed\n * on the row itself, and not on the field.\n * This layout is good for creating UIs for user settings pages.\n */\n Row = 'row',\n}\n\n/**\n * Represents the JSON schema with Lime specific options\n * @public\n */\nexport interface FormSchema<T extends Record<string, any> = any>\n extends JSONSchema7 {\n /**\n * The value of \"items\" MUST be either a valid JSON Schema or an array\n * of valid JSON Schemas.\n *\n * This keyword determines how child instances validate for arrays, and\n * does not directly validate the immediate instance itself.\n *\n * If \"items\" is a schema, validation succeeds if all elements in the\n * array successfully validate against that schema.\n *\n * If \"items\" is an array of schemas, validation succeeds if each\n * element of the instance validates against the schema at the same\n * position, if any.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.1\n */\n items?: FormSchemaArrayItem<T> | Array<FormSchemaArrayItem<T>>;\n\n /**\n * The value of \"items\" MUST be either a valid JSON Schema or an array\n * of valid JSON Schemas.\n *\n * This keyword determines how child instances validate for arrays, and\n * does not directly validate the immediate instance itself.\n *\n * If \"items\" is a schema, validation succeeds if all elements in the\n * array successfully validate against that schema.\n *\n * If \"items\" is an array of schemas, validation succeeds if each\n * element of the instance validates against the schema at the same\n * position, if any.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.2\n */\n additionalItems?: FormSchemaArrayItem<T>;\n\n /**\n * The value of this keyword MUST be a valid JSON Schema.\n *\n * An array instance is valid against \"contains\" if at least one of its\n * elements is valid against the given schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.6\n */\n contains?: FormSchemaArrayItem<T>;\n\n /**\n * The value of this keyword MUST be an array. Elements of this array,\n * if any, MUST be strings, and MUST be unique.\n *\n * An object instance is valid against this keyword if every item in the\n * array is the name of a property in the instance.\n *\n * Omitting this keyword has the same behavior as an empty array.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.3\n */\n required?: Array<ReplaceObjectType<T, Extract<keyof T, string>, string>>;\n\n /**\n * The value of \"properties\" MUST be an object. Each value of this\n * object MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself.\n *\n * Validation succeeds if, for each name that appears in both the\n * instance and as a name within this keyword's value, the child\n * instance for that name successfully validates against the\n * corresponding schema.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.4\n */\n properties?: ReplaceObjectType<\n T,\n FormSubKeySchema<T>,\n Record<string, FormSchema>\n >;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against all schemas defined by this keyword's\n * value.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.1\n */\n allOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against at least one schema defined by this\n * keyword's value.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.2\n */\n anyOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against exactly one schema defined by this\n * keyword's value.\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.3\n */\n oneOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * The value of \"patternProperties\" MUST be an object. Each property\n * name of this object SHOULD be a valid regular expression, according\n * to the ECMA 262 regular expression dialect. Each property value of\n * this object MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself. Validation\n * of the primitive instance type against this keyword always succeeds.\n *\n * Validation succeeds if, for each instance name that matches any\n * regular expressions that appear as a property name in this keyword's\n * value, the child instance for that name successfully validates\n * against each schema that corresponds to a matching regular\n * expression.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.5\n */\n patternProperties?: Record<string, FormSchema>;\n\n /**\n * The value of \"additionalProperties\" MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself.\n *\n * Validation with \"additionalProperties\" applies only to the child\n * values of instance names that do not match any names in \"properties\",\n * and do not match any regular expression in \"patternProperties\".\n *\n * For all such properties, validation succeeds if the child instance\n * validates against the \"additionalProperties\" schema.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.6\n */\n additionalProperties?: FormSchema | boolean;\n\n /**\n * This keyword specifies rules that are evaluated if the instance is an\n * object and contains a certain property.\n *\n * This keyword's value MUST be an object. Each property specifies a\n * dependency. Each dependency value MUST be an array or a valid JSON\n * Schema.\n *\n * If the dependency value is a subschema, and the dependency key is a\n * property in the instance, the entire instance must validate against\n * the dependency value.\n *\n * If the dependency value is an array, each element in the array, if\n * any, MUST be a string, and MUST be unique. If the dependency key is\n * a property in the instance, each of the items in the dependency value\n * must be a property that exists in the instance.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.7\n */\n dependencies?: Record<string, FormSchema | string[]>;\n\n /**\n * The value of \"propertyNames\" MUST be a valid JSON Schema.\n *\n * If the instance is an object, this keyword validates if every\n * property name in the instance validates against the provided schema.\n * Note the property name that the schema is testing will always be a\n * string.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.8\n */\n propertyNames?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * This validation outcome of this keyword's subschema has no direct\n * effect on the overall validation result. Rather, it controls which\n * of the \"then\" or \"else\" keywords are evaluated.\n *\n * Instances that successfully validate against this keyword's subschema\n * MUST also be valid against the subschema value of the \"then\" keyword,\n * if present.\n *\n * Instances that fail to validate against this keyword's subschema MUST\n * also be valid against the subschema value of the \"else\" keyword, if\n * present.\n *\n * If annotations (Section 3.3) are being collected, they are collected\n * from this keyword's subschema in the usual way, including when the\n * keyword is present without either \"then\" or \"else\".\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.1\n */\n if?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * This validation outcome of this keyword's subschema has no direct\n * effect on the overall validation result. Rather, it controls which\n * of the \"then\" or \"else\" keywords are evaluated.\n *\n * Instances that successfully validate against this keyword's subschema\n * MUST also be valid against the subschema value of the \"then\" keyword,\n * if present.\n *\n * Instances that fail to validate against this keyword's subschema MUST\n * also be valid against the subschema value of the \"else\" keyword, if\n * present.\n *\n * If annotations (Section 3.3) are being collected, they are collected\n * from this keyword's subschema in the usual way, including when the\n * keyword is present without either \"then\" or \"else\".\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.2\n */\n then?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * When \"if\" is present, and the instance fails to validate against its\n * subschema, then valiation succeeds against this keyword if the\n * instance successfully validates against this keyword's subschema.\n *\n * This keyword has no effect when \"if\" is absent, or when the instance\n * successfully validates against its subschema. Implementations MUST\n * NOT evaluate the instance against this keyword, for either validation\n * or annotation collection purposes, in such cases.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.3\n */\n else?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * An instance is valid against this keyword if it fails to validate\n * successfully against the schema defined by this keyword.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.4\n */\n not?: FormSchema;\n\n /**\n * The \"$defs\" keywords provides a standardized location for\n * schema authors to inline re-usable JSON Schemas into a more general\n * schema. The keyword does not directly affect the validation result.\n *\n * This keyword's value MUST be an object. Each member value of this\n * object MUST be a valid JSON Schema.\n *\n * As an example, here is a schema describing an array of positive\n * integers, where the positive integer constraint is a subschema in\n * \"definitions\":\n * ```\n * {\n * \"type\": \"array\",\n * \"items\": { \"$ref\": \"#/definitions/positiveInteger\" },\n * \"definitions\": {\n * \"positiveInteger\": {\n * \"type\": \"integer\",\n * \"exclusiveMinimum\": 0\n * }\n * }\n * }\n * ```\n *\n * $defs is the newer keyword introduced in the JSON Schema Draft 2019-09, while definitions is from the older drafts.\n *\n * The main difference is that definitions is no longer an official keyword in the latest JSON Schema specification (Draft 2019-09 and later),\n * but it is still widely supported for backward compatibility.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-9\n */\n $defs?: Record<string, FormSchema>;\n\n /**\n * The \"definitions\" keywords provides a standardized location for\n * schema authors to inline re-usable JSON Schemas into a more general\n * schema. The keyword does not directly affect the validation result.\n *\n * This keyword's value MUST be an object. Each member value of this\n * object MUST be a valid JSON Schema.\n *\n * As an example, here is a schema describing an array of positive\n * integers, where the positive integer constraint is a subschema in\n * \"definitions\":\n * ```\n * {\n * \"type\": \"array\",\n * \"items\": { \"$ref\": \"#/definitions/positiveInteger\" },\n * \"definitions\": {\n * \"positiveInteger\": {\n * \"type\": \"integer\",\n * \"exclusiveMinimum\": 0\n * }\n * }\n * }\n * ```\n *\n * $defs is the newer keyword introduced in the JSON Schema Draft 2019-09, while definitions is from the older drafts.\n *\n * The main difference is that definitions is no longer an official keyword in the latest JSON Schema specification (Draft 2019-09 and later),\n * but it is still widely supported for backward compatibility.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-9\n */\n definitions?: Record<string, FormSchema>;\n}\n\n/**\n * Utility type for replacing object types with a specified type\n * @public\n */\nexport type ReplaceObjectType<T, AllowedType, ElseType> = T extends any[]\n ? ElseType\n : T extends Record<string, any>\n ? AllowedType\n : ElseType;\n\n/**\n * Utility type for supporting nested sub items in arrays\n * @public\n */\nexport type FormSchemaArrayItem<T> = T extends any[]\n ? FormSchema<T[Extract<keyof T, number>]>\n : FormSchema;\n\n/**\n * Utility type for recursive properties in a schema\n * @public\n */\nexport type FormSubKeySchema<TObj> = Partial<{\n [Key in Extract<keyof TObj, any>]: FormSchema<TObj[Key]>;\n}>;\n","/**\n * Defines the data for a table\n * @public\n */\nexport interface Column<T extends object = any> {\n /**\n * Column title to be displayed\n */\n title: string;\n\n /**\n * Name of the field in the data\n */\n field: keyof T;\n\n /**\n * Function to format the value before rendering\n */\n formatter?: TableFormatter;\n\n /**\n * Component used to render the field value\n */\n component?: TableComponentDefinition;\n\n /**\n * Type of aggregator to use for the column\n */\n aggregator?: ColumnAggregatorType | ColumnAggregatorFunction<T>;\n\n /**\n * A component used to render inside the column header\n */\n headerComponent?: TableComponentDefinition;\n\n /**\n * Sets the horizontal text alignment for the column\n */\n horizontalAlign?: 'left' | 'center' | 'right';\n\n /**\n * Defines whether end-user can sort a column\n */\n headerSort?: boolean;\n}\n\n/**\n * Definition for a formatter function\n * @param value - The value to be formatted\n * @param data - The data for the current row\n * @returns The formatted value\n * @public\n */\nexport type TableFormatter = (value: any, data?: object) => string;\n\n/**\n * The `component` key in the schema uses this interface to define a\n * component to be rendered inside a cell in the table.\n *\n * @note The table will display the component as `inline-block` in order\n * to give the column the correct size. If the component should have the\n * full width of the column, this might have to be overridden by setting\n * the display mode to `block`, e.g.\n *\n * ```css\n * :host(*) {\n * display: block !important;\n * }\n * ```\n * @public\n */\nexport interface TableComponentDefinition {\n /**\n * Name of the component\n */\n name: string;\n\n /**\n * Properties to send to the component\n */\n props?: Record<string, any>;\n\n /**\n * Factory for creating properties dynamically for a custom component.\n *\n * The properties returned from this function will be merged with the\n * `props` properties when the component is created.\n *\n * When the propsFactory is used for header components there will be no data available.\n *\n * @param data - The data for the current row\n * @returns Properties for the component\n */\n propsFactory?: (data: object) => Record<string, any>;\n}\n\n/**\n * Interface for custom components rendered inside a `limel-table`.\n * @public\n */\nexport interface TableComponent<T extends object = any> {\n /**\n * Name of the field being rendered\n */\n field?: string;\n\n /**\n * Value being rendered\n */\n value?: any;\n\n /**\n * Data for the current row of the table\n */\n data?: T;\n}\n\n/**\n * Indicates whether the specified column is sorted ascending or descending.\n * @public\n */\nexport interface ColumnSorter {\n /**\n * The column being sorted\n */\n column: Column;\n\n /**\n * The direction to sort on\n */\n direction: 'ASC' | 'DESC';\n}\n\n/**\n * Specifies the current page, and which columns the table is currently sorted on.\n * @public\n */\nexport interface TableParams {\n /**\n * The current page being set\n */\n page: number;\n\n /**\n * Sorters applied to the current page\n */\n sorters?: ColumnSorter[];\n}\n\n/**\n * The built-in aggregators available for columns\n * @public\n */\nexport enum ColumnAggregatorType {\n /**\n * Calculates the average value of all numerical cells in the column\n */\n Average = 'avg',\n\n /**\n * Displays the maximum value from all numerical cells in the column\n */\n Maximum = 'max',\n\n /**\n * Displays the minimum value from all numerical cells in the column\n */\n Minimum = 'min',\n\n /**\n * Displays the sum of all numerical cells in the column\n */\n Sum = 'sum',\n\n /**\n * Counts the number of non empty cells in the column\n */\n Count = 'count',\n}\n\n/**\n * Instead of using one of the built-in aggregators, it is possible to\n * define a custom aggregator function.\n *\n * @param column - the configuration for the column\n * @param values - list of all values to be aggregated\n * @param data - list of all objects to be aggregated\n * @returns the aggregated data\n *\n * @public\n */\nexport type ColumnAggregatorFunction<T = object> = (\n column?: Column,\n values?: any[],\n data?: T[],\n) => any;\n\n/**\n * Defines aggregate values for columns\n * @public\n */\nexport interface ColumnAggregate {\n /**\n * The name of the `Column` field\n */\n field: string;\n /**\n * The aggregate value\n */\n value: any;\n}\n\n/**\n * Data for identifying a row of the table\n * @public\n */\nexport type RowData = {\n id?: string | number;\n};\n"],"version":3}
|
|
@@ -17,7 +17,7 @@ const patchBrowser = () => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(options => {
|
|
20
|
-
return bootstrapLazy(JSON.parse("[[\"limel-text-editor\",[[1,\"limel-text-editor\",{\"contentType\":[1,\"content-type\"],\"language\":[513],\"disabled\":[516],\"readonly\":[516],\"helperText\":[513,\"helper-text\"],\"placeholder\":[513],\"label\":[513],\"invalid\":[516],\"value\":[513],\"required\":[516],\"allowResize\":[516,\"allow-resize\"]}]]],[\"limel-file\",[[1,\"limel-file\",{\"value\":[16],\"label\":[513],\"required\":[516],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"accept\":[513],\"language\":[1]}]]],[\"limel-picker\",[[1,\"limel-picker\",{\"disabled\":[4],\"readonly\":[516],\"label\":[1],\"searchLabel\":[1,\"search-label\"],\"helperText\":[513,\"helper-text\"],\"leadingIcon\":[1,\"leading-icon\"],\"emptyResultMessage\":[1,\"empty-result-message\"],\"required\":[4],\"invalid\":[516],\"value\":[16],\"searcher\":[16],\"multiple\":[4],\"delimiter\":[513],\"actions\":[16],\"actionPosition\":[1,\"action-position\"],\"actionScrollBehavior\":[1,\"action-scroll-behavior\"],\"badgeIcons\":[516,\"badge-icons\"],\"items\":[32],\"textValue\":[32],\"loading\":[32],\"chips\":[32]}]]],[\"limel-split-button\",[[17,\"limel-split-button\",{\"label\":[513],\"primary\":[516],\"icon\":[513],\"disabled\":[516],\"items\":[16]}]]],[\"limel-file-viewer\",[[1,\"limel-file-viewer\",{\"url\":[513],\"filename\":[513],\"alt\":[513],\"allowFullscreen\":[516,\"allow-fullscreen\"],\"allowOpenInNewTab\":[516,\"allow-open-in-new-tab\"],\"allowDownload\":[516,\"allow-download\"],\"language\":[1],\"officeViewer\":[513,\"office-viewer\"],\"actions\":[16],\"isFullscreen\":[32],\"fileType\":[32],\"loading\":[32],\"fileUrl\":[32]}]]],[\"limel-color-picker\",[[1,\"limel-color-picker\",{\"value\":[513],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"tooltipLabel\":[513,\"tooltip-label\"],\"required\":[516],\"readonly\":[516],\"isOpen\":[32]}]]],[\"limel-date-picker\",[[1,\"limel-date-picker\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"placeholder\":[513],\"helperText\":[513,\"helper-text\"],\"required\":[516],\"value\":[16],\"type\":[513],\"format\":[513],\"language\":[513],\"formatter\":[16],\"formattedValue\":[32],\"internalFormat\":[32],\"showPortal\":[32]}]]],[\"limel-dock\",[[1,\"limel-dock\",{\"dockItems\":[16],\"dockFooterItems\":[16],\"accessibleLabel\":[513,\"accessible-label\"],\"expanded\":[516],\"allowResize\":[516,\"allow-resize\"],\"mobileBreakPoint\":[514,\"mobile-break-point\"],\"useMobileLayout\":[32]}]]],[\"limel-snackbar\",[[1,\"limel-snackbar\",{\"message\":[1],\"timeout\":[2],\"actionText\":[1,\"action-text\"],\"dismissible\":[4],\"multiline\":[4],\"language\":[1],\"show\":[64]}]]],[\"limel-tab-panel\",[[1,\"limel-tab-panel\",{\"tabs\":[1040]}]]],[\"limel-select\",[[1,\"limel-select\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"required\":[516],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"value\":[16],\"options\":[16],\"multiple\":[4],\"menuOpen\":[32]}]]],[\"limel-button-group\",[[1,\"limel-button-group\",{\"value\":[16],\"disabled\":[516],\"selectedButtonId\":[32]}]]],[\"limel-collapsible-section\",[[1,\"limel-collapsible-section\",{\"isOpen\":[1540,\"is-open\"],\"header\":[513],\"actions\":[16]}]]],[\"limel-help\",[[1,\"limel-help\",{\"value\":[1],\"trigger\":[1],\"readMoreLink\":[16],\"openDirection\":[513,\"open-direction\"],\"isOpen\":[32]}]]],[\"limel-dynamic-label_4\",[[17,\"limel-list\",{\"items\":[16],\"badgeIcons\":[4,\"badge-icons\"],\"iconSize\":[1,\"icon-size\"],\"type\":[1],\"maxLinesSecondaryText\":[2,\"max-lines-secondary-text\"]}],[1,\"limel-menu-surface\",{\"open\":[4],\"allowClicksElement\":[16]}],[1,\"limel-dynamic-label\",{\"value\":[8],\"defaultLabel\":[16],\"labels\":[16]}],[1,\"limel-helper-line\",{\"helperText\":[513,\"helper-text\"],\"length\":[514],\"maxLength\":[514,\"max-length\"],\"invalid\":[516],\"helperTextId\":[513,\"helper-text-id\"]}]]],[\"limel-checkbox\",[[1,\"limel-checkbox\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"checked\":[516],\"indeterminate\":[516],\"required\":[516],\"readonlyLabels\":[16],\"modified\":[32]}]]],[\"limel-table\",[[1,\"limel-table\",{\"data\":[16],\"columns\":[16],\"mode\":[1],\"layout\":[1],\"pageSize\":[2,\"page-size\"],\"totalRows\":[2,\"total-rows\"],\"sorting\":[16],\"activeRow\":[1040],\"movableColumns\":[4,\"movable-columns\"],\"loading\":[4],\"page\":[2],\"emptyMessage\":[1,\"empty-message\"],\"aggregates\":[16],\"selectable\":[4],\"selection\":[16]}]]],[\"limel-info-tile\",[[1,\"limel-info-tile\",{\"value\":[520],\"icon\":[1],\"label\":[513],\"prefix\":[513],\"suffix\":[513],\"disabled\":[516],\"badge\":[520],\"loading\":[516],\"link\":[16],\"progress\":[16]}]]],[\"limel-switch\",[[1,\"limel-switch\",{\"label\":[513],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"value\":[516],\"helperText\":[513,\"helper-text\"],\"readonlyLabels\":[16],\"fieldId\":[32]}]]],[\"limel-dialog\",[[1,\"limel-dialog\",{\"heading\":[1],\"fullscreen\":[516],\"open\":[1540],\"closingActions\":[16]}]]],[\"limel-progress-flow\",[[1,\"limel-progress-flow\",{\"flowItems\":[16],\"disabled\":[4],\"readonly\":[4]}]]],[\"limel-shortcut\",[[1,\"limel-shortcut\",{\"icon\":[513],\"label\":[513],\"disabled\":[516],\"badge\":[520],\"link\":[16]}]]],[\"limel-banner\",[[1,\"limel-banner\",{\"message\":[513],\"icon\":[513],\"isOpen\":[32],\"open\":[64],\"close\":[64]}]]],[\"limel-callout\",[[1,\"limel-callout\",{\"heading\":[513],\"icon\":[513],\"type\":[513],\"language\":[1]}]]],[\"limel-slider\",[[1,\"limel-slider\",{\"disabled\":[516],\"readonly\":[516],\"factor\":[514],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"unit\":[513],\"value\":[514],\"valuemax\":[514],\"valuemin\":[514],\"step\":[514],\"percentageClass\":[32]}]]],[\"limel-code-editor\",[[1,\"limel-code-editor\",{\"value\":[1],\"language\":[1],\"readonly\":[4],\"lineNumbers\":[4,\"line-numbers\"],\"fold\":[4],\"lint\":[4],\"colorScheme\":[1,\"color-scheme\"],\"random\":[32]}]]],[\"limel-config\",[[1,\"limel-config\",{\"config\":[16]}]]],[\"limel-flex-container\",[[1,\"limel-flex-container\",{\"direction\":[513],\"justify\":[513],\"align\":[513],\"reverse\":[516]}]]],[\"limel-form\",[[1,\"limel-form\",{\"schema\":[16],\"value\":[16],\"disabled\":[4],\"propsFactory\":[16],\"transformErrors\":[16],\"errors\":[16]}]]],[\"limel-grid\",[[1,\"limel-grid\"]]],[\"limel-action-bar_4\",[[1,\"limel-action-bar\",{\"actions\":[16],\"accessibleLabel\":[513,\"accessible-label\"],\"layout\":[513],\"openDirection\":[513,\"open-direction\"],\"overflowCutoff\":[32]}],[1,\"limel-text-editor-link-menu\",{\"link\":[16],\"language\":[513],\"isOpen\":[516,\"is-open\"],\"invalidLink\":[32]}],[0,\"limel-action-bar-overflow-menu\",{\"items\":[16],\"openDirection\":[513,\"open-direction\"]}],[0,\"limel-action-bar-item\",{\"item\":[16],\"isVisible\":[516,\"is-visible\"],\"selected\":[516]}]]],[\"limel-prosemirror-adapter\",[[1,\"limel-prosemirror-adapter\",{\"contentType\":[1,\"content-type\"],\"value\":[1],\"language\":[513],\"view\":[32],\"actionBarItems\":[32],\"link\":[32],\"isLinkMenuOpen\":[32]}]]],[\"limel-color-picker-palette\",[[17,\"limel-color-picker-palette\",{\"value\":[513],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"required\":[516]}]]],[\"limel-popover_2\",[[1,\"limel-popover\",{\"open\":[4],\"openDirection\":[513,\"open-direction\"]}],[1,\"limel-popover-surface\",{\"contentCollection\":[16]}]]],[\"limel-dock-button\",[[0,\"limel-dock-button\",{\"item\":[16],\"expanded\":[516],\"useMobileLayout\":[516,\"use-mobile-layout\"],\"isOpen\":[32]}]]],[\"limel-tab-bar\",[[1,\"limel-tab-bar\",{\"tabs\":[1040],\"canScrollLeft\":[32],\"canScrollRight\":[32]},[[9,\"resize\",\"handleWindowResize\"]]]]],[\"limel-header\",[[1,\"limel-header\",{\"icon\":[1],\"heading\":[1],\"subheading\":[1],\"supportingText\":[1,\"supporting-text\"],\"subheadingDivider\":[1,\"subheading-divider\"]}]]],[\"limel-help-content\",[[1,\"limel-help-content\",{\"value\":[1],\"readMoreLink\":[16]}]]],[\"limel-progress-flow-item\",[[0,\"limel-progress-flow-item\",{\"item\":[16],\"disabled\":[4],\"readonly\":[4],\"currentStep\":[4,\"current-step\"]}]]],[\"limel-circular-progress\",[[1,\"limel-circular-progress\",{\"value\":[2],\"maxValue\":[2,\"max-value\"],\"prefix\":[513],\"suffix\":[1],\"displayPercentageColors\":[4,\"display-percentage-colors\"],\"size\":[513]}]]],[\"limel-flatpickr-adapter\",[[1,\"limel-flatpickr-adapter\",{\"value\":[16],\"type\":[1],\"format\":[1],\"isOpen\":[4,\"is-open\"],\"inputElement\":[16],\"language\":[1],\"formatter\":[16]}]]],[\"limel-file-dropzone_2\",[[1,\"limel-file-dropzone\",{\"accept\":[513],\"disabled\":[4],\"text\":[1],\"helperText\":[1,\"helper-text\"],\"hasFileToDrop\":[32]}],[1,\"limel-file-input\",{\"accept\":[513],\"disabled\":[516],\"multiple\":[516]}]]],[\"limel-markdown\",[[1,\"limel-markdown\",{\"value\":[1]}]]],[\"limel-icon_2\",[[1,\"limel-portal\",{\"openDirection\":[513,\"open-direction\"],\"position\":[513],\"containerId\":[513,\"container-id\"],\"containerStyle\":[16],\"parent\":[16],\"inheritParentWidth\":[516,\"inherit-parent-width\"],\"visible\":[516],\"anchor\":[16]}],[1,\"limel-icon\",{\"size\":[513],\"name\":[513],\"badge\":[516]}]]],[\"limel-icon-button\",[[17,\"limel-icon-button\",{\"icon\":[513],\"elevated\":[516],\"label\":[513],\"disabled\":[516]}]]],[\"limel-linear-progress\",[[1,\"limel-linear-progress\",{\"value\":[514],\"indeterminate\":[516]}]]],[\"limel-badge_3\",[[1,\"limel-badge\",{\"label\":[520]}],[1,\"limel-tooltip\",{\"elementId\":[513,\"element-id\"],\"label\":[513],\"helperLabel\":[513,\"helper-label\"],\"maxlength\":[514],\"openDirection\":[513,\"open-direction\"],\"open\":[32]}],[1,\"limel-tooltip-content\",{\"label\":[513],\"helperLabel\":[513,\"helper-label\"],\"maxlength\":[514]}]]],[\"limel-breadcrumbs_5\",[[1,\"limel-menu\",{\"items\":[16],\"disabled\":[516],\"openDirection\":[513,\"open-direction\"],\"surfaceWidth\":[513,\"surface-width\"],\"open\":[1540],\"badgeIcons\":[516,\"badge-icons\"],\"gridLayout\":[516,\"grid-layout\"],\"loading\":[516],\"currentSubMenu\":[1040],\"rootItem\":[16],\"searcher\":[16],\"emptyResultMessage\":[1,\"empty-result-message\"],\"loadingSubItems\":[32],\"searchValue\":[32],\"searchResults\":[32]}],[1,\"limel-breadcrumbs\",{\"items\":[16],\"divider\":[1]}],[17,\"limel-menu-list\",{\"items\":[16],\"badgeIcons\":[4,\"badge-icons\"],\"iconSize\":[1,\"icon-size\"],\"type\":[1],\"maxLinesSecondaryText\":[2,\"max-lines-secondary-text\"]}],[1,\"limel-input-field\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"placeholder\":[513],\"helperText\":[513,\"helper-text\"],\"prefix\":[513],\"suffix\":[513],\"required\":[516],\"value\":[513],\"trailingIcon\":[513,\"trailing-icon\"],\"leadingIcon\":[513,\"leading-icon\"],\"pattern\":[513],\"type\":[513],\"formatNumber\":[516,\"format-number\"],\"step\":[520],\"max\":[514],\"min\":[514],\"maxlength\":[514],\"minlength\":[514],\"completions\":[16],\"showLink\":[516,\"show-link\"],\"locale\":[513],\"isFocused\":[32],\"wasInvalid\":[32],\"showCompletions\":[32]}],[1,\"limel-spinner\",{\"size\":[513],\"limeBranded\":[4,\"lime-branded\"]}]]],[\"limel-chip_2\",[[1,\"limel-chip-set\",{\"value\":[16],\"type\":[513],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"inputType\":[513,\"input-type\"],\"maxItems\":[514,\"max-items\"],\"required\":[516],\"searchLabel\":[513,\"search-label\"],\"emptyInputOnBlur\":[516,\"empty-input-on-blur\"],\"clearAllButton\":[4,\"clear-all-button\"],\"leadingIcon\":[513,\"leading-icon\"],\"delimiter\":[513],\"language\":[1],\"editMode\":[32],\"textValue\":[32],\"blurred\":[32],\"inputChipIndexSelected\":[32],\"selectedChipIds\":[32],\"getEditMode\":[64],\"setFocus\":[64],\"emptyInput\":[64]}],[17,\"limel-chip\",{\"language\":[513],\"text\":[513],\"icon\":[1],\"image\":[16],\"link\":[16],\"badge\":[520],\"disabled\":[516],\"readonly\":[516],\"selected\":[516],\"invalid\":[516],\"removable\":[516],\"type\":[513],\"loading\":[516],\"progress\":[514],\"identifier\":[520],\"menuItems\":[16]}]]],[\"limel-button\",[[17,\"limel-button\",{\"label\":[513],\"primary\":[516],\"outlined\":[516],\"icon\":[513],\"disabled\":[516],\"loading\":[516],\"loadingFailed\":[516,\"loading-failed\"],\"justLoaded\":[32]}]]]]"), options);
|
|
20
|
+
return bootstrapLazy(JSON.parse("[[\"limel-text-editor\",[[1,\"limel-text-editor\",{\"contentType\":[1,\"content-type\"],\"language\":[513],\"disabled\":[516],\"readonly\":[516],\"helperText\":[513,\"helper-text\"],\"placeholder\":[513],\"label\":[513],\"invalid\":[516],\"value\":[513],\"required\":[516],\"allowResize\":[516,\"allow-resize\"]}]]],[\"limel-file\",[[1,\"limel-file\",{\"value\":[16],\"label\":[513],\"required\":[516],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"accept\":[513],\"language\":[1]}]]],[\"limel-picker\",[[1,\"limel-picker\",{\"disabled\":[4],\"readonly\":[516],\"label\":[1],\"searchLabel\":[1,\"search-label\"],\"helperText\":[513,\"helper-text\"],\"leadingIcon\":[1,\"leading-icon\"],\"emptyResultMessage\":[1,\"empty-result-message\"],\"required\":[4],\"invalid\":[516],\"value\":[16],\"searcher\":[16],\"multiple\":[4],\"delimiter\":[513],\"actions\":[16],\"actionPosition\":[1,\"action-position\"],\"actionScrollBehavior\":[1,\"action-scroll-behavior\"],\"badgeIcons\":[516,\"badge-icons\"],\"items\":[32],\"textValue\":[32],\"loading\":[32],\"chips\":[32]}]]],[\"limel-split-button\",[[17,\"limel-split-button\",{\"label\":[513],\"primary\":[516],\"icon\":[513],\"disabled\":[516],\"items\":[16]}]]],[\"limel-file-viewer\",[[1,\"limel-file-viewer\",{\"url\":[513],\"filename\":[513],\"alt\":[513],\"allowFullscreen\":[516,\"allow-fullscreen\"],\"allowOpenInNewTab\":[516,\"allow-open-in-new-tab\"],\"allowDownload\":[516,\"allow-download\"],\"language\":[1],\"officeViewer\":[513,\"office-viewer\"],\"actions\":[16],\"isFullscreen\":[32],\"fileType\":[32],\"loading\":[32],\"fileUrl\":[32]}]]],[\"limel-color-picker\",[[1,\"limel-color-picker\",{\"value\":[513],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"tooltipLabel\":[513,\"tooltip-label\"],\"required\":[516],\"readonly\":[516],\"isOpen\":[32]}]]],[\"limel-date-picker\",[[1,\"limel-date-picker\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"placeholder\":[513],\"helperText\":[513,\"helper-text\"],\"required\":[516],\"value\":[16],\"type\":[513],\"format\":[513],\"language\":[513],\"formatter\":[16],\"internalFormat\":[32],\"showPortal\":[32]}]]],[\"limel-dock\",[[1,\"limel-dock\",{\"dockItems\":[16],\"dockFooterItems\":[16],\"accessibleLabel\":[513,\"accessible-label\"],\"expanded\":[516],\"allowResize\":[516,\"allow-resize\"],\"mobileBreakPoint\":[514,\"mobile-break-point\"],\"useMobileLayout\":[32]}]]],[\"limel-snackbar\",[[1,\"limel-snackbar\",{\"message\":[1],\"timeout\":[2],\"actionText\":[1,\"action-text\"],\"dismissible\":[4],\"multiline\":[4],\"language\":[1],\"show\":[64]}]]],[\"limel-tab-panel\",[[1,\"limel-tab-panel\",{\"tabs\":[1040]}]]],[\"limel-select\",[[1,\"limel-select\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"required\":[516],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"value\":[16],\"options\":[16],\"multiple\":[4],\"menuOpen\":[32]}]]],[\"limel-button-group\",[[1,\"limel-button-group\",{\"value\":[16],\"disabled\":[516],\"selectedButtonId\":[32]}]]],[\"limel-collapsible-section\",[[1,\"limel-collapsible-section\",{\"isOpen\":[1540,\"is-open\"],\"header\":[513],\"actions\":[16]}]]],[\"limel-help\",[[1,\"limel-help\",{\"value\":[1],\"trigger\":[1],\"readMoreLink\":[16],\"openDirection\":[513,\"open-direction\"],\"isOpen\":[32]}]]],[\"limel-dynamic-label_4\",[[17,\"limel-list\",{\"items\":[16],\"badgeIcons\":[4,\"badge-icons\"],\"iconSize\":[1,\"icon-size\"],\"type\":[1],\"maxLinesSecondaryText\":[2,\"max-lines-secondary-text\"]}],[1,\"limel-menu-surface\",{\"open\":[4],\"allowClicksElement\":[16]}],[1,\"limel-dynamic-label\",{\"value\":[8],\"defaultLabel\":[16],\"labels\":[16]}],[1,\"limel-helper-line\",{\"helperText\":[513,\"helper-text\"],\"length\":[514],\"maxLength\":[514,\"max-length\"],\"invalid\":[516],\"helperTextId\":[513,\"helper-text-id\"]}]]],[\"limel-checkbox\",[[1,\"limel-checkbox\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"checked\":[516],\"indeterminate\":[516],\"required\":[516],\"readonlyLabels\":[16],\"modified\":[32]}]]],[\"limel-table\",[[1,\"limel-table\",{\"data\":[16],\"columns\":[16],\"mode\":[1],\"layout\":[1],\"pageSize\":[2,\"page-size\"],\"totalRows\":[2,\"total-rows\"],\"sorting\":[16],\"activeRow\":[1040],\"movableColumns\":[4,\"movable-columns\"],\"loading\":[4],\"page\":[2],\"emptyMessage\":[1,\"empty-message\"],\"aggregates\":[16],\"selectable\":[4],\"selection\":[16]}]]],[\"limel-info-tile\",[[1,\"limel-info-tile\",{\"value\":[520],\"icon\":[1],\"label\":[513],\"prefix\":[513],\"suffix\":[513],\"disabled\":[516],\"badge\":[520],\"loading\":[516],\"link\":[16],\"progress\":[16]}]]],[\"limel-switch\",[[1,\"limel-switch\",{\"label\":[513],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"value\":[516],\"helperText\":[513,\"helper-text\"],\"readonlyLabels\":[16],\"fieldId\":[32]}]]],[\"limel-dialog\",[[1,\"limel-dialog\",{\"heading\":[1],\"fullscreen\":[516],\"open\":[1540],\"closingActions\":[16]}]]],[\"limel-progress-flow\",[[1,\"limel-progress-flow\",{\"flowItems\":[16],\"disabled\":[4],\"readonly\":[4]}]]],[\"limel-shortcut\",[[1,\"limel-shortcut\",{\"icon\":[513],\"label\":[513],\"disabled\":[516],\"badge\":[520],\"link\":[16]}]]],[\"limel-banner\",[[1,\"limel-banner\",{\"message\":[513],\"icon\":[513],\"isOpen\":[32],\"open\":[64],\"close\":[64]}]]],[\"limel-callout\",[[1,\"limel-callout\",{\"heading\":[513],\"icon\":[513],\"type\":[513],\"language\":[1]}]]],[\"limel-slider\",[[1,\"limel-slider\",{\"disabled\":[516],\"readonly\":[516],\"factor\":[514],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"unit\":[513],\"value\":[514],\"valuemax\":[514],\"valuemin\":[514],\"step\":[514],\"percentageClass\":[32]}]]],[\"limel-code-editor\",[[1,\"limel-code-editor\",{\"value\":[1],\"language\":[1],\"readonly\":[4],\"lineNumbers\":[4,\"line-numbers\"],\"fold\":[4],\"lint\":[4],\"colorScheme\":[1,\"color-scheme\"],\"random\":[32]}]]],[\"limel-config\",[[1,\"limel-config\",{\"config\":[16]}]]],[\"limel-flex-container\",[[1,\"limel-flex-container\",{\"direction\":[513],\"justify\":[513],\"align\":[513],\"reverse\":[516]}]]],[\"limel-form\",[[1,\"limel-form\",{\"schema\":[16],\"value\":[16],\"disabled\":[4],\"propsFactory\":[16],\"transformErrors\":[16],\"errors\":[16]}]]],[\"limel-grid\",[[1,\"limel-grid\"]]],[\"limel-action-bar_4\",[[1,\"limel-action-bar\",{\"actions\":[16],\"accessibleLabel\":[513,\"accessible-label\"],\"layout\":[513],\"openDirection\":[513,\"open-direction\"],\"overflowCutoff\":[32]}],[1,\"limel-text-editor-link-menu\",{\"link\":[16],\"language\":[513],\"isOpen\":[516,\"is-open\"],\"invalidLink\":[32]}],[0,\"limel-action-bar-overflow-menu\",{\"items\":[16],\"openDirection\":[513,\"open-direction\"]}],[0,\"limel-action-bar-item\",{\"item\":[16],\"isVisible\":[516,\"is-visible\"],\"selected\":[516]}]]],[\"limel-prosemirror-adapter\",[[1,\"limel-prosemirror-adapter\",{\"contentType\":[1,\"content-type\"],\"value\":[1],\"language\":[513],\"view\":[32],\"actionBarItems\":[32],\"link\":[32],\"isLinkMenuOpen\":[32]}]]],[\"limel-color-picker-palette\",[[17,\"limel-color-picker-palette\",{\"value\":[513],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"required\":[516]}]]],[\"limel-popover_2\",[[1,\"limel-popover\",{\"open\":[4],\"openDirection\":[513,\"open-direction\"]}],[1,\"limel-popover-surface\",{\"contentCollection\":[16]}]]],[\"limel-dock-button\",[[0,\"limel-dock-button\",{\"item\":[16],\"expanded\":[516],\"useMobileLayout\":[516,\"use-mobile-layout\"],\"isOpen\":[32]}]]],[\"limel-tab-bar\",[[1,\"limel-tab-bar\",{\"tabs\":[1040],\"canScrollLeft\":[32],\"canScrollRight\":[32]},[[9,\"resize\",\"handleWindowResize\"]]]]],[\"limel-header\",[[1,\"limel-header\",{\"icon\":[1],\"heading\":[1],\"subheading\":[1],\"supportingText\":[1,\"supporting-text\"],\"subheadingDivider\":[1,\"subheading-divider\"]}]]],[\"limel-help-content\",[[1,\"limel-help-content\",{\"value\":[1],\"readMoreLink\":[16]}]]],[\"limel-progress-flow-item\",[[0,\"limel-progress-flow-item\",{\"item\":[16],\"disabled\":[4],\"readonly\":[4],\"currentStep\":[4,\"current-step\"]}]]],[\"limel-circular-progress\",[[1,\"limel-circular-progress\",{\"value\":[2],\"maxValue\":[2,\"max-value\"],\"prefix\":[513],\"suffix\":[1],\"displayPercentageColors\":[4,\"display-percentage-colors\"],\"size\":[513]}]]],[\"limel-flatpickr-adapter\",[[1,\"limel-flatpickr-adapter\",{\"value\":[16],\"type\":[1],\"format\":[1],\"isOpen\":[4,\"is-open\"],\"inputElement\":[16],\"language\":[1],\"formatter\":[16]}]]],[\"limel-file-dropzone_2\",[[1,\"limel-file-dropzone\",{\"accept\":[513],\"disabled\":[4],\"text\":[1],\"helperText\":[1,\"helper-text\"],\"hasFileToDrop\":[32]}],[1,\"limel-file-input\",{\"accept\":[513],\"disabled\":[516],\"multiple\":[516]}]]],[\"limel-markdown\",[[1,\"limel-markdown\",{\"value\":[1]}]]],[\"limel-icon_2\",[[1,\"limel-portal\",{\"openDirection\":[513,\"open-direction\"],\"position\":[513],\"containerId\":[513,\"container-id\"],\"containerStyle\":[16],\"parent\":[16],\"inheritParentWidth\":[516,\"inherit-parent-width\"],\"visible\":[516],\"anchor\":[16]}],[1,\"limel-icon\",{\"size\":[513],\"name\":[513],\"badge\":[516]}]]],[\"limel-icon-button\",[[17,\"limel-icon-button\",{\"icon\":[513],\"elevated\":[516],\"label\":[513],\"disabled\":[516]}]]],[\"limel-linear-progress\",[[1,\"limel-linear-progress\",{\"value\":[514],\"indeterminate\":[516]}]]],[\"limel-badge_3\",[[1,\"limel-badge\",{\"label\":[520]}],[1,\"limel-tooltip\",{\"elementId\":[513,\"element-id\"],\"label\":[513],\"helperLabel\":[513,\"helper-label\"],\"maxlength\":[514],\"openDirection\":[513,\"open-direction\"],\"open\":[32]}],[1,\"limel-tooltip-content\",{\"label\":[513],\"helperLabel\":[513,\"helper-label\"],\"maxlength\":[514]}]]],[\"limel-breadcrumbs_5\",[[1,\"limel-menu\",{\"items\":[16],\"disabled\":[516],\"openDirection\":[513,\"open-direction\"],\"surfaceWidth\":[513,\"surface-width\"],\"open\":[1540],\"badgeIcons\":[516,\"badge-icons\"],\"gridLayout\":[516,\"grid-layout\"],\"loading\":[516],\"currentSubMenu\":[1040],\"rootItem\":[16],\"searcher\":[16],\"emptyResultMessage\":[1,\"empty-result-message\"],\"loadingSubItems\":[32],\"searchValue\":[32],\"searchResults\":[32]}],[1,\"limel-breadcrumbs\",{\"items\":[16],\"divider\":[1]}],[17,\"limel-menu-list\",{\"items\":[16],\"badgeIcons\":[4,\"badge-icons\"],\"iconSize\":[1,\"icon-size\"],\"type\":[1],\"maxLinesSecondaryText\":[2,\"max-lines-secondary-text\"]}],[1,\"limel-input-field\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"placeholder\":[513],\"helperText\":[513,\"helper-text\"],\"prefix\":[513],\"suffix\":[513],\"required\":[516],\"value\":[513],\"trailingIcon\":[513,\"trailing-icon\"],\"leadingIcon\":[513,\"leading-icon\"],\"pattern\":[513],\"type\":[513],\"formatNumber\":[516,\"format-number\"],\"step\":[520],\"max\":[514],\"min\":[514],\"maxlength\":[514],\"minlength\":[514],\"completions\":[16],\"showLink\":[516,\"show-link\"],\"locale\":[513],\"isFocused\":[32],\"wasInvalid\":[32],\"showCompletions\":[32]}],[1,\"limel-spinner\",{\"size\":[513],\"limeBranded\":[4,\"lime-branded\"]}]]],[\"limel-chip_2\",[[1,\"limel-chip-set\",{\"value\":[16],\"type\":[513],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"inputType\":[513,\"input-type\"],\"maxItems\":[514,\"max-items\"],\"required\":[516],\"searchLabel\":[513,\"search-label\"],\"emptyInputOnBlur\":[516,\"empty-input-on-blur\"],\"clearAllButton\":[4,\"clear-all-button\"],\"leadingIcon\":[513,\"leading-icon\"],\"delimiter\":[513],\"language\":[1],\"editMode\":[32],\"textValue\":[32],\"blurred\":[32],\"inputChipIndexSelected\":[32],\"selectedChipIds\":[32],\"getEditMode\":[64],\"setFocus\":[64],\"emptyInput\":[64]}],[17,\"limel-chip\",{\"language\":[513],\"text\":[513],\"icon\":[1],\"image\":[16],\"link\":[16],\"badge\":[520],\"disabled\":[516],\"readonly\":[516],\"selected\":[516],\"invalid\":[516],\"removable\":[516],\"type\":[513],\"loading\":[516],\"progress\":[514],\"identifier\":[520],\"menuItems\":[16]}]]],[\"limel-button\",[[17,\"limel-button\",{\"label\":[513],\"primary\":[516],\"outlined\":[516],\"icon\":[513],\"disabled\":[516],\"loading\":[516],\"loadingFailed\":[516,\"loading-failed\"],\"justLoaded\":[32]}]]]]"), options);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
//# sourceMappingURL=lime-elements.js.map
|
|
@@ -95,7 +95,6 @@ const DatePicker = class {
|
|
|
95
95
|
this.format = undefined;
|
|
96
96
|
this.language = 'en';
|
|
97
97
|
this.formatter = undefined;
|
|
98
|
-
this.formattedValue = undefined;
|
|
99
98
|
this.internalFormat = undefined;
|
|
100
99
|
this.showPortal = false;
|
|
101
100
|
this.handleCalendarChange = this.handleCalendarChange.bind(this);
|
|
@@ -113,7 +112,6 @@ const DatePicker = class {
|
|
|
113
112
|
componentWillLoad() {
|
|
114
113
|
this.useNative = !this.readonly && (isIOSDevice() || isAndroidDevice());
|
|
115
114
|
this.updateInternalFormatAndType();
|
|
116
|
-
this.formattedValue = this.formatValue(this.value);
|
|
117
115
|
}
|
|
118
116
|
componentWillUpdate() {
|
|
119
117
|
this.updateInternalFormatAndType();
|
|
@@ -126,29 +124,22 @@ const DatePicker = class {
|
|
|
126
124
|
inputProps.trailingIcon = 'clear_symbol';
|
|
127
125
|
}
|
|
128
126
|
if (this.useNative) {
|
|
129
|
-
return (h("limel-input-field", { disabled: this.disabled, readonly: this.readonly, invalid: this.invalid, label: this.label, helperText: this.helperText, required: this.required, value: this.
|
|
127
|
+
return (h("limel-input-field", { disabled: this.disabled, readonly: this.readonly, invalid: this.invalid, label: this.label, helperText: this.helperText, required: this.required, value: this.formatValue(this.value), type: this.nativeType, onChange: this.nativeChangeHandler }));
|
|
130
128
|
}
|
|
131
129
|
const dropdownZIndex = getComputedStyle(this.host).getPropertyValue('--dropdown-z-index');
|
|
130
|
+
const formatter = this.formatter || this.formatValue;
|
|
132
131
|
return [
|
|
133
|
-
h("limel-input-field", Object.assign({ disabled: this.disabled, readonly: this.readonly, invalid: this.invalid, label: this.label, placeholder: this.placeholder, helperText: this.helperText, required: this.required, value: this.
|
|
134
|
-
h("limel-portal", { containerId: this.portalId, visible: this.showPortal, containerStyle: { 'z-index': dropdownZIndex } }, h("limel-flatpickr-adapter", { format: this.internalFormat, language: this.language, type: this.type, value: this.value, ref: (el) => (this.datePickerCalendar = el), isOpen: this.showPortal, formatter:
|
|
132
|
+
h("limel-input-field", Object.assign({ disabled: this.disabled, readonly: this.readonly, invalid: this.invalid, label: this.label, placeholder: this.placeholder, helperText: this.helperText, required: this.required, value: this.value ? formatter(this.value) : '', onFocus: this.showCalendar, onBlur: this.hideCalendar, onClick: this.onInputClick, onChange: this.handleInputElementChange, ref: (el) => (this.textField = el) }, inputProps)),
|
|
133
|
+
h("limel-portal", { containerId: this.portalId, visible: this.showPortal, containerStyle: { 'z-index': dropdownZIndex } }, h("limel-flatpickr-adapter", { format: this.internalFormat, language: this.language, type: this.type, value: this.value, ref: (el) => (this.datePickerCalendar = el), isOpen: this.showPortal, formatter: formatter, onChange: this.handleCalendarChange })),
|
|
135
134
|
];
|
|
136
135
|
}
|
|
137
|
-
onValueChange(newValue, oldValue) {
|
|
138
|
-
if (newValue !== oldValue && newValue !== this.formattedValue) {
|
|
139
|
-
this.formattedValue = this.formatValue(this.value);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
136
|
updateInternalFormatAndType() {
|
|
143
137
|
this.nativeType = nativeTypeForConsumerType[this.type || 'default'];
|
|
144
138
|
this.nativeFormat = nativeFormatForType[this.nativeType];
|
|
145
139
|
if (this.useNative) {
|
|
146
140
|
this.internalFormat = this.nativeFormat;
|
|
147
141
|
}
|
|
148
|
-
else if (this.formatter) {
|
|
149
|
-
this.formatValue = this.formatter;
|
|
150
|
-
}
|
|
151
|
-
else if (this.format) {
|
|
142
|
+
else if (this.formatter || this.format) {
|
|
152
143
|
this.internalFormat = this.format;
|
|
153
144
|
}
|
|
154
145
|
else {
|
|
@@ -158,7 +149,6 @@ const DatePicker = class {
|
|
|
158
149
|
nativeChangeHandler(event) {
|
|
159
150
|
event.stopPropagation();
|
|
160
151
|
const date = this.dateFormatter.parseDate(event.detail, this.internalFormat);
|
|
161
|
-
this.formattedValue = event.detail;
|
|
162
152
|
this.change.emit(date);
|
|
163
153
|
}
|
|
164
154
|
showCalendar(event) {
|
|
@@ -203,7 +193,6 @@ const DatePicker = class {
|
|
|
203
193
|
}
|
|
204
194
|
handleCalendarChange(event) {
|
|
205
195
|
const date = event.detail;
|
|
206
|
-
this.formattedValue = this.formatValue(date);
|
|
207
196
|
event.stopPropagation();
|
|
208
197
|
if (this.pickerIsAutoClosing()) {
|
|
209
198
|
this.hideCalendar();
|
|
@@ -229,13 +218,9 @@ const DatePicker = class {
|
|
|
229
218
|
return this.type !== 'datetime' && this.type !== 'time';
|
|
230
219
|
}
|
|
231
220
|
clearValue() {
|
|
232
|
-
this.formattedValue = '';
|
|
233
221
|
this.change.emit(null);
|
|
234
222
|
}
|
|
235
223
|
get host() { return getElement(this); }
|
|
236
|
-
static get watchers() { return {
|
|
237
|
-
"value": ["onValueChange"]
|
|
238
|
-
}; }
|
|
239
224
|
};
|
|
240
225
|
DatePicker.style = datePickerCss;
|
|
241
226
|
|