@revolist/revogrid 4.9.13 → 4.9.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{column.drag.plugin-e636b5af.js → column.drag.plugin-9841e68f.js} +108 -188
- package/dist/cjs/column.drag.plugin-9841e68f.js.map +1 -0
- package/dist/cjs/{column.service-15c8352d.js → column.service-2471e4f3.js} +159 -25
- package/dist/cjs/column.service-2471e4f3.js.map +1 -0
- package/dist/cjs/{edit.utils-1172677c.js → edit.utils-eef92df0.js} +2 -2
- package/dist/cjs/{edit.utils-1172677c.js.map → edit.utils-eef92df0.js.map} +1 -1
- package/dist/cjs/{header-cell-renderer-375a879f.js → header-cell-renderer-751067c0.js} +14 -14
- package/dist/cjs/header-cell-renderer-751067c0.js.map +1 -0
- package/dist/cjs/{index-28b6fdfb.js → index-8bceed03.js} +1 -2
- package/dist/cjs/index-8bceed03.js.map +1 -0
- package/dist/cjs/index.cjs.js +19 -17
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/{key.utils-c62ab1e1.js → key.utils-f548f37c.js} +2 -2
- package/dist/cjs/{key.utils-c62ab1e1.js.map → key.utils-f548f37c.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +33 -94
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revo-grid.cjs.js +1 -1
- package/dist/cjs/revogr-attribution_6.cjs.entry.js +6 -6
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +4 -4
- package/dist/cjs/revogr-data_4.cjs.entry.js +16 -15
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +17 -10
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/{row-header-utils-22ffee54.js → row-header-utils-5d0d3fab.js} +2 -2
- package/dist/cjs/{row-header-utils-22ffee54.js.map → row-header-utils-5d0d3fab.js.map} +1 -1
- package/dist/cjs/{text-editor-91a9f5b5.js → text-editor-f066d388.js} +3 -3
- package/dist/cjs/{text-editor-91a9f5b5.js.map → text-editor-f066d388.js.map} +1 -1
- package/dist/cjs/{throttle-5da5df51.js → throttle-216690f1.js} +2 -2
- package/dist/cjs/{throttle-5da5df51.js.map → throttle-216690f1.js.map} +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/data/cell-renderer.js +2 -2
- package/dist/collection/components/data/cell-renderer.js.map +1 -1
- package/dist/collection/components/data/column.service.js +22 -24
- package/dist/collection/components/data/column.service.js.map +1 -1
- package/dist/collection/components/data/revogr-data.js +7 -6
- package/dist/collection/components/data/revogr-data.js.map +1 -1
- package/dist/collection/components/header/header-cell-renderer.js +5 -4
- package/dist/collection/components/header/header-cell-renderer.js.map +1 -1
- package/dist/collection/components/header/header-renderer.js +2 -2
- package/dist/collection/components/header/header-renderer.js.map +1 -1
- package/dist/collection/components/header/resizable.directive.js.map +1 -1
- package/dist/collection/components/header/resizable.element.js +9 -10
- package/dist/collection/components/header/resizable.element.js.map +1 -1
- package/dist/collection/components/header/revogr-header.js +3 -3
- package/dist/collection/components/header/revogr-header.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid.js +6 -6
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/collection/global/global.js +2 -2
- package/dist/collection/global/global.js.map +1 -1
- package/dist/collection/plugins/filter/{filter.service.js → filter.indexed.js} +18 -18
- package/dist/collection/plugins/filter/filter.indexed.js.map +1 -0
- package/dist/collection/plugins/filter/filter.panel.js +32 -46
- package/dist/collection/plugins/filter/filter.panel.js.map +1 -1
- package/dist/collection/plugins/filter/filter.plugin.js +86 -40
- package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
- package/dist/collection/plugins/filter/filter.types.js.map +1 -1
- package/dist/collection/plugins/wcag/index.js +7 -1
- package/dist/collection/plugins/wcag/index.js.map +1 -1
- package/dist/collection/serve/controller.js +1 -1
- package/dist/collection/serve/data.js +8 -0
- package/dist/collection/services/column.data.provider.js +6 -5
- package/dist/collection/services/column.data.provider.js.map +1 -1
- package/dist/collection/themeManager/theme.compact.js +1 -1
- package/dist/collection/themeManager/theme.compact.js.map +1 -1
- package/dist/collection/themeManager/theme.default.js +1 -1
- package/dist/collection/themeManager/theme.default.js.map +1 -1
- package/dist/collection/themeManager/theme.material.js +1 -1
- package/dist/collection/themeManager/theme.material.js.map +1 -1
- package/dist/collection/themeManager/theme.service.js +9 -9
- package/dist/collection/themeManager/theme.service.js.map +1 -1
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/collection/utils/column.utils.js +10 -0
- package/dist/collection/utils/column.utils.js.map +1 -1
- package/dist/esm/{column.drag.plugin-30dc4e24.js → column.drag.plugin-c9787a50.js} +107 -181
- package/dist/esm/column.drag.plugin-c9787a50.js.map +1 -0
- package/dist/esm/{column.service-414e9cba.js → column.service-a6682d9d.js} +153 -26
- package/dist/esm/column.service-a6682d9d.js.map +1 -0
- package/dist/esm/{edit.utils-0666e5bd.js → edit.utils-c358c970.js} +2 -2
- package/dist/esm/{edit.utils-0666e5bd.js.map → edit.utils-c358c970.js.map} +1 -1
- package/dist/esm/{header-cell-renderer-ca570fcf.js → header-cell-renderer-52d9d6ba.js} +14 -14
- package/dist/esm/header-cell-renderer-52d9d6ba.js.map +1 -0
- package/dist/esm/{index-74b9801b.js → index-6c437a0d.js} +2 -2
- package/dist/esm/index-6c437a0d.js.map +1 -0
- package/dist/esm/index.js +7 -7
- package/dist/esm/{key.utils-d3df5db8.js → key.utils-5a827d12.js} +2 -2
- package/dist/esm/{key.utils-d3df5db8.js.map → key.utils-5a827d12.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/revo-grid.entry.js +26 -87
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revo-grid.js +1 -1
- package/dist/esm/revogr-attribution_6.entry.js +6 -6
- package/dist/esm/revogr-clipboard_3.entry.js +4 -4
- package/dist/esm/revogr-data_4.entry.js +16 -15
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +17 -10
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/esm/{row-header-utils-c7e3e2d5.js → row-header-utils-f5b04d1a.js} +2 -2
- package/dist/esm/{row-header-utils-c7e3e2d5.js.map → row-header-utils-f5b04d1a.js.map} +1 -1
- package/dist/esm/{text-editor-96d69516.js → text-editor-79a617b5.js} +3 -3
- package/dist/esm/{text-editor-96d69516.js.map → text-editor-79a617b5.js.map} +1 -1
- package/dist/esm/{throttle-262c3ed2.js → throttle-b94844de.js} +2 -2
- package/dist/esm/{throttle-262c3ed2.js.map → throttle-b94844de.js.map} +1 -1
- package/dist/revo-grid/column.drag.plugin-c9787a50.js +5 -0
- package/dist/revo-grid/column.drag.plugin-c9787a50.js.map +1 -0
- package/dist/revo-grid/column.service-a6682d9d.js +5 -0
- package/dist/revo-grid/column.service-a6682d9d.js.map +1 -0
- package/dist/revo-grid/{edit.utils-0666e5bd.js → edit.utils-c358c970.js} +2 -2
- package/dist/revo-grid/{header-cell-renderer-ca570fcf.js → header-cell-renderer-52d9d6ba.js} +2 -2
- package/dist/revo-grid/header-cell-renderer-52d9d6ba.js.map +1 -0
- package/dist/revo-grid/{index-74b9801b.js → index-6c437a0d.js} +2 -2
- package/dist/revo-grid/index.esm.js +1 -1
- package/dist/revo-grid/{key.utils-d3df5db8.js → key.utils-5a827d12.js} +2 -2
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revo-grid.esm.js +1 -1
- package/dist/revo-grid/revo-grid.esm.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/{row-header-utils-c7e3e2d5.js → row-header-utils-f5b04d1a.js} +2 -2
- package/dist/revo-grid/{text-editor-96d69516.js → text-editor-79a617b5.js} +2 -2
- package/dist/revo-grid/{throttle-262c3ed2.js → throttle-b94844de.js} +2 -2
- package/dist/types/components/data/column.service.d.ts +1 -2
- package/dist/types/components/header/header-cell-renderer.d.ts +7 -9
- package/dist/types/components/header/header-renderer.d.ts +2 -3
- package/dist/types/components/header/resizable.directive.d.ts +0 -1
- package/dist/types/components/header/resizable.element.d.ts +3 -2
- package/dist/types/components/revoGrid/revo-grid.d.ts +1 -1
- package/dist/types/components.d.ts +2 -8
- package/dist/types/plugins/filter/{filter.service.d.ts → filter.indexed.d.ts} +2 -2
- package/dist/types/plugins/filter/filter.panel.d.ts +3 -27
- package/dist/types/plugins/filter/filter.plugin.d.ts +14 -47
- package/dist/types/plugins/filter/filter.types.d.ts +86 -1
- package/dist/types/services/column.data.provider.d.ts +2 -1
- package/dist/types/themeManager/theme.compact.d.ts +1 -1
- package/dist/types/themeManager/theme.default.d.ts +1 -1
- package/dist/types/themeManager/theme.material.d.ts +1 -1
- package/dist/types/themeManager/theme.service.d.ts +2 -2
- package/dist/types/types/interfaces.d.ts +10 -12
- package/dist/types/utils/column.utils.d.ts +3 -1
- package/hydrate/index.js +786 -787
- package/hydrate/index.mjs +786 -787
- package/package.json +1 -1
- package/standalone/column.service.js +153 -25
- package/standalone/column.service.js.map +1 -1
- package/standalone/dimension.helpers.js +2 -216
- package/standalone/dimension.helpers.js.map +1 -1
- package/standalone/index.js +7 -6
- package/standalone/index.js.map +1 -1
- package/standalone/index2.js +2 -84
- package/standalone/index2.js.map +1 -1
- package/standalone/platform.js +89 -0
- package/standalone/platform.js.map +1 -0
- package/standalone/{data.store.js → reduce.js} +252 -38
- package/standalone/reduce.js.map +1 -0
- package/standalone/revo-grid.js +127 -261
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-data2.js +10 -8
- package/standalone/revogr-data2.js.map +1 -1
- package/standalone/revogr-edit2.js +2 -1
- package/standalone/revogr-edit2.js.map +1 -1
- package/standalone/revogr-filter-panel.js +17 -11
- package/standalone/revogr-filter-panel.js.map +1 -1
- package/standalone/revogr-focus2.js +1 -1
- package/standalone/revogr-header2.js +20 -20
- package/standalone/revogr-header2.js.map +1 -1
- package/standalone/revogr-order-editor2.js +1 -1
- package/standalone/revogr-overlay-selection2.js +3 -2
- package/standalone/revogr-overlay-selection2.js.map +1 -1
- package/standalone/revogr-row-headers2.js +1 -1
- package/standalone/selection.utils.js +1 -1
- package/dist/cjs/column.drag.plugin-e636b5af.js.map +0 -1
- package/dist/cjs/column.service-15c8352d.js.map +0 -1
- package/dist/cjs/header-cell-renderer-375a879f.js.map +0 -1
- package/dist/cjs/index-28b6fdfb.js.map +0 -1
- package/dist/collection/plugins/filter/filter.service.js.map +0 -1
- package/dist/esm/column.drag.plugin-30dc4e24.js.map +0 -1
- package/dist/esm/column.service-414e9cba.js.map +0 -1
- package/dist/esm/header-cell-renderer-ca570fcf.js.map +0 -1
- package/dist/esm/index-74b9801b.js.map +0 -1
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js +0 -5
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js.map +0 -1
- package/dist/revo-grid/column.service-414e9cba.js +0 -5
- package/dist/revo-grid/column.service-414e9cba.js.map +0 -1
- package/dist/revo-grid/header-cell-renderer-ca570fcf.js.map +0 -1
- package/standalone/data.store.js.map +0 -1
- /package/dist/revo-grid/{edit.utils-0666e5bd.js.map → edit.utils-c358c970.js.map} +0 -0
- /package/dist/revo-grid/{index-74b9801b.js.map → index-6c437a0d.js.map} +0 -0
- /package/dist/revo-grid/{key.utils-d3df5db8.js.map → key.utils-5a827d12.js.map} +0 -0
- /package/dist/revo-grid/{row-header-utils-c7e3e2d5.js.map → row-header-utils-f5b04d1a.js.map} +0 -0
- /package/dist/revo-grid/{text-editor-96d69516.js.map → text-editor-79a617b5.js.map} +0 -0
- /package/dist/revo-grid/{throttle-262c3ed2.js.map → throttle-b94844de.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.plugin.js","sourceRoot":"","sources":["../../../src/plugins/filter/filter.plugin.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,MAAM,MAAM,eAAe,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EACL,cAAc,EACd,WAAW,EAEX,WAAW,GACZ,MAAM,kBAAkB,CAAC;AA2D1B,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAC5C,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC;AAEjE,MAAM,OAAO,YAAa,SAAQ,UAAU;IAW1C,YACS,QAA6B,EACpC,SAA0B,EAC1B,MAA2B;;QAE3B,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAJpB,aAAQ,GAAR,QAAQ,CAAqB;QAVtC,qBAAgB,GAAqB,EAAE,CAAC;QACxC,qBAAgB,GAAoB,EAAE,CAAC;QACvC,oBAAe,qBAAkC,WAAW,EAAG;QAC/D,wBAAmB,qBAAgC,WAAW,EAAG;QACjE,2BAAsB,qBACjB,cAAc,EACjB;QACF,eAAU,GAAG,WAAW,CAAC;QAQvB,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC;QAED,MAAM,WAAW,GAAG,CAAC,CAAc,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAE5D,MAAM,cAAc,GAAG,KAAK,IAAI,EA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gBACH,CAAC,CAAC,6BAA6B;gBAE/B,2EAA2E;gBAC3E,IAAI,wBAAwB,KAAK,WAAW,CAAC,MAAM;oBACjD,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;YAC7B,CAAC,CAAC,yBAAyB;QAC7B,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["import { h } from '@stencil/core';\nimport reduce from 'lodash/reduce';\n\nimport { BasePlugin } from '../base.plugin';\nimport { FILTER_PROP, isFilterBtn } from './filter.button';\nimport { MultiFilterItem } from './filter.panel';\nimport {\n filterEntities,\n filterNames,\n FilterType,\n filterTypes,\n} from './filter.service';\nimport { LogicFunction } from './filter.types';\nimport { ColumnProp, ColumnRegular, DataType } from '@type';\nimport { PluginProviders } from '@type';\n\ntype CustomFilter = {\n columnFilterType: string; // property defined in column filter: string/number/abstract/enum...etc\n name: string;\n func: LogicFunction;\n};\n\nexport type FilterCaptions = {\n title: string;\n save: string;\n reset: string;\n cancel: string;\n add: string,\n placeholder: string,\n and: string,\n or: string,\n};\n\nexport type FilterLocalization = {\n captions: FilterCaptions;\n filterNames: Record<FilterType, string>;\n};\n\n/**\n * @typedef ColumnFilterConfig\n * @type {object}\n * @property {FilterCollection|undefined} collection - preserved filter data\n * @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored\n * @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.\n * @property {FilterLocalization|undefined} localization - translation for filter popup captions.\n * @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering.\n * @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering.\n * A way to define your own filter types per column\n */\n/**\n * @internal\n */\nexport type ColumnFilterConfig = {\n collection?: FilterCollection;\n include?: string[];\n customFilters?: Record<string, CustomFilter>;\n filterProp?: string;\n localization?: FilterLocalization;\n multiFilterItems?: MultiFilterItem;\n disableDynamicFiltering?: boolean;\n};\ntype HeaderEvent = CustomEvent<ColumnRegular>;\ntype FilterCollectionItem = {\n filter: LogicFunction;\n type: FilterType;\n value?: any;\n};\n\nexport type FilterCollection = Record<ColumnProp, FilterCollectionItem>;\n\nexport const FILTER_TRIMMED_TYPE = 'filter';\nexport const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';\n\nexport class FilterPlugin extends BasePlugin {\n pop?: HTMLRevogrFilterPanelElement;\n filterCollection: FilterCollection = {};\n multiFilterItems: MultiFilterItem = {};\n possibleFilters: Record<string, string[]> = { ...filterTypes };\n possibleFilterNames: Record<string, string> = { ...filterNames };\n possibleFilterEntities: Record<string, LogicFunction> = {\n ...filterEntities,\n };\n filterProp = FILTER_PROP;\n\n constructor(\n public revogrid: HTMLRevoGridElement,\n providers: PluginProviders,\n config?: ColumnFilterConfig,\n ) {\n super(revogrid, providers);\n if (config) {\n this.initConfig(config);\n }\n\n const headerclick = (e: HeaderEvent) => this.headerclick(e);\n\n const aftersourceset = async () => {\n const filterCollectionProps = Object.keys(this.filterCollection);\n if (filterCollectionProps.length > 0) {\n // handle old way of filtering by reworking FilterCollection to new MultiFilterItem\n filterCollectionProps.forEach((prop, index) => {\n if (!this.multiFilterItems[prop]) {\n this.multiFilterItems[prop] = [\n {\n id: index,\n type: this.filterCollection[prop].type,\n value: this.filterCollection[prop].value,\n relation: 'and',\n },\n ];\n }\n });\n }\n await this.runFiltering();\n };\n this.addEventListener('headerclick', headerclick);\n this.addEventListener(\n FILTER_CONFIG_CHANGED_EVENT,\n ({ detail }: CustomEvent<ColumnFilterConfig | boolean>) => {\n if (!detail) {\n this.clearFiltering();\n return;\n }\n if (typeof detail === 'object') {\n this.initConfig(detail);\n }\n aftersourceset();\n },\n );\n this.addEventListener('aftersourceset', aftersourceset);\n this.addEventListener('filter', ({ detail }: CustomEvent) =>\n this.onFilterChange(detail),\n );\n\n const existingNodes = this.revogrid.registerVNode.filter((n) => n.$tag$ !== 'revogr-filter-panel');\n this.revogrid.registerVNode = [\n ...existingNodes,\n <revogr-filter-panel\n filterItems={this.multiFilterItems}\n filterNames={this.possibleFilterNames}\n filterEntities={this.possibleFilterEntities}\n filterCaptions={config?.localization?.captions}\n onFilterChange={e => this.onFilterChange(e.detail)}\n disableDynamicFiltering={config?.disableDynamicFiltering}\n ref={e => (this.pop = e)}\n />,\n ];\n }\n\n initConfig(config: ColumnFilterConfig) {\n if (config.multiFilterItems) {\n this.multiFilterItems = { ...config.multiFilterItems };\n }\n if (config.customFilters) {\n for (let cType in config.customFilters) {\n const cFilter = config.customFilters[cType];\n if (!this.possibleFilters[cFilter.columnFilterType]) {\n this.possibleFilters[cFilter.columnFilterType] = [];\n }\n this.possibleFilters[cFilter.columnFilterType].push(cType);\n this.possibleFilterEntities[cType] = cFilter.func;\n this.possibleFilterNames[cType] = cFilter.name;\n }\n }\n\n if (config.filterProp) {\n this.filterProp = config.filterProp;\n }\n\n /**\n * which filters has to be included/excluded\n * convinient way to exclude system filters\n */\n const cfgInlcude = config.include;\n if (cfgInlcude) {\n const filters: Record<string, string[]> = {};\n\n for (let t in this.possibleFilters) {\n // validate filters, if appropriate function present\n const newTypes = this.possibleFilters[t].filter(\n f => cfgInlcude.indexOf(f) > -1,\n );\n if (newTypes.length) {\n filters[t] = newTypes;\n }\n }\n // if any valid filters provided show them\n if (Object.keys(filters).length > 0) {\n this.possibleFilters = filters;\n }\n }\n if (config.collection) {\n this.filterCollection = reduce(\n config.collection,\n (result: FilterCollection, item, prop) => {\n if (this.possibleFilterEntities[item.type]) {\n result[prop] = item;\n } else {\n console.warn(`${item.type} type is not found.`);\n }\n return result;\n },\n {},\n );\n }\n\n if (config.localization) {\n if (config.localization.filterNames) {\n Object.entries(config.localization.filterNames).forEach(([k, v]) => {\n if (this.possibleFilterNames[k] != void 0) {\n this.possibleFilterNames[k] = v;\n }\n });\n }\n }\n }\n\n async headerclick(e: HeaderEvent) {\n const el = e.detail.originalEvent?.target as HTMLElement;\n if (!isFilterBtn(el)) {\n return;\n }\n e.preventDefault();\n\n // close if same\n const changes = await this.pop?.getChanges();\n if (changes && changes?.prop === e.detail.prop) {\n this.pop?.show();\n return;\n }\n\n if (!this.pop) {\n return;\n }\n\n // filter button clicked, open filter dialog\n const gridPos = this.revogrid.getBoundingClientRect();\n const buttonPos = el.getBoundingClientRect();\n const prop = e.detail.prop;\n this.pop.filterTypes = this.getColumnFilter(e.detail.filter);\n this.pop.show({\n ...this.filterCollection[prop],\n x: buttonPos.x - gridPos.x,\n y: buttonPos.y - gridPos.y + buttonPos.height,\n autoCorrect: true,\n prop,\n });\n }\n\n getColumnFilter(\n type?: boolean | string | string[],\n ): Record<string, string[]> {\n let filterType = 'string';\n if (!type) {\n return { [filterType]: this.possibleFilters[filterType] };\n }\n\n // if custom column filter\n if (this.isValidType(type)) {\n filterType = type;\n\n // if multiple filters applied\n } else if (typeof type === 'object' && type.length) {\n return type.reduce((r: Record<string, string[]>, multiType) => {\n if (this.isValidType(multiType)) {\n r[multiType] = this.possibleFilters[multiType];\n }\n return r;\n }, {});\n }\n return { [filterType]: this.possibleFilters[filterType] };\n }\n\n isValidType(type: any): type is string {\n return !!(typeof type === 'string' && this.possibleFilters[type]);\n }\n\n // called on internal component change\n async onFilterChange(filterItems: MultiFilterItem) {\n this.multiFilterItems = filterItems;\n this.runFiltering();\n }\n\n /**\n * Triggers grid filtering\n */\n async doFiltering(\n collection: FilterCollection,\n items: DataType[],\n columns: ColumnRegular[],\n filterItems: MultiFilterItem,\n ) {\n const columnsToUpdate: ColumnRegular[] = [];\n\n columns.forEach(rgCol => {\n const column = { ...rgCol };\n const hasFilter = filterItems[column.prop];\n if (column[this.filterProp] && !hasFilter) {\n delete column[this.filterProp];\n columnsToUpdate.push(column);\n }\n if (!column[this.filterProp] && hasFilter) {\n columnsToUpdate.push(column);\n column[this.filterProp] = true;\n }\n });\n const itemsToFilter = this.getRowFilter(items, filterItems);\n // check is filter event prevented\n const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {\n collection,\n itemsToFilter,\n source: items,\n filterItems,\n });\n if (defaultPrevented) {\n return;\n }\n\n // check is trimmed event prevented\n const isAddedEvent = await this.revogrid.addTrimmed(\n detail.itemsToFilter,\n FILTER_TRIMMED_TYPE,\n );\n if (isAddedEvent.defaultPrevented) {\n return;\n }\n\n // applies the hasFilter to the columns to show filter icon\n await this.revogrid.updateColumns(columnsToUpdate);\n this.emit('afterfilterapply');\n }\n\n async clearFiltering() {\n this.multiFilterItems = {};\n await this.runFiltering();\n }\n\n async runFiltering() {\n const collection: FilterCollection = {};\n\n // handle old filterCollection to return the first filter only (if any) from multiFilterItems\n const filterProps = Object.keys(this.multiFilterItems);\n\n for (const prop of filterProps) {\n // check if we have any filter for a column\n if (this.multiFilterItems[prop].length > 0) {\n const firstFilterItem = this.multiFilterItems[prop][0];\n collection[prop] = {\n filter: filterEntities[firstFilterItem.type],\n type: firstFilterItem.type,\n value: firstFilterItem.value,\n };\n }\n }\n\n this.filterCollection = collection;\n\n const { source, columns } = await this.getData();\n const { defaultPrevented, detail } = this.emit('beforefilterapply', {\n collection: this.filterCollection,\n source,\n columns,\n filterItems: this.multiFilterItems,\n });\n if (defaultPrevented) {\n return;\n }\n this.doFiltering(\n detail.collection,\n detail.source,\n detail.columns,\n detail.filterItems,\n );\n }\n\n async getData() {\n return {\n source: await this.revogrid.getSource(),\n columns: await this.revogrid.getColumns(),\n };\n }\n\n getRowFilter(rows: DataType[], filterItems: MultiFilterItem) {\n const propKeys = Object.keys(filterItems);\n\n const trimmed: Record<number, boolean> = {};\n let propFilterSatisfiedCount = 0;\n let lastFilterResults: boolean[] = [];\n\n // each rows\n rows.forEach((model, rowIndex) => {\n // working on all props\n for (const prop of propKeys) {\n const propFilters = filterItems[prop];\n\n propFilterSatisfiedCount = 0;\n lastFilterResults = [];\n\n // testing each filter for a prop\n for (const [filterIndex, filterData] of propFilters.entries()) {\n // the filter LogicFunction based on the type\n const filter = this.possibleFilterEntities[filterData.type];\n\n // THE MAGIC OF FILTERING IS HERE\n if (filterData.relation === 'or') {\n lastFilterResults = [];\n if (filter(model[prop], filterData.value)) {\n continue;\n }\n propFilterSatisfiedCount++;\n } else {\n // 'and' relation will need to know the next filter\n // so we save this current filter to include it in the next filter\n lastFilterResults.push(!filter(model[prop], filterData.value));\n\n // check first if we have a filter on the next index to pair it with this current filter\n const nextFilterData = propFilters[filterIndex + 1];\n // stop the sequence if there is no next filter or if the next filter is not an 'and' relation\n if (!nextFilterData || nextFilterData.relation !== 'and') {\n // let's just continue since for sure propFilterSatisfiedCount cannot be satisfied\n if (lastFilterResults.indexOf(true) === -1) {\n lastFilterResults = [];\n continue;\n }\n\n // we need to add all of the lastFilterResults since we need to satisfy all\n propFilterSatisfiedCount += lastFilterResults.length;\n lastFilterResults = [];\n }\n }\n } // end of propFilters forEach\n\n // add to the list of removed/trimmed rows of filter condition is satisfied\n if (propFilterSatisfiedCount === propFilters.length)\n trimmed[rowIndex] = true;\n } // end of for-of propKeys\n });\n return trimmed;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"filter.plugin.js","sourceRoot":"","sources":["../../../src/plugins/filter/filter.plugin.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,MAAM,MAAM,eAAe,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EACL,gCAAgC,EAChC,WAAW,EACX,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;;;;;;;GAUG;AACH;;GAEG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAC5C,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC;AAEjE,MAAM,OAAO,YAAa,SAAQ,UAAU;IAgB1C,YACS,QAA6B,EACpC,SAA0B,EAC1B,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C,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["import { h } from '@stencil/core';\nimport reduce from 'lodash/reduce';\n\nimport { BasePlugin } from '../base.plugin';\nimport { FILTER_PROP, isFilterBtn } from './filter.button';\nimport {\n filterCoreFunctionsIndexedByType,\n filterNames,\n filterTypes,\n} from './filter.indexed';\nimport {\n ColumnFilterConfig,\n FilterCollection,\n LogicFunction,\n MultiFilterItem,\n} from './filter.types';\nimport { ColumnRegular, DataType, PluginProviders } from '@type';\nimport { getCellDataParsed } from 'src/utils';\n\n/**\n * @typedef ColumnFilterConfig\n * @type {object}\n * @property {FilterCollection|undefined} collection - preserved filter data\n * @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored\n * @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.\n * @property {FilterLocalization|undefined} localization - translation for filter popup captions.\n * @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering.\n * @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering.\n * A way to define your own filter types per column\n */\n/**\n * @internal\n */\n\nexport const FILTER_TRIMMED_TYPE = 'filter';\nexport const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';\n\nexport class FilterPlugin extends BasePlugin {\n pop?: HTMLRevogrFilterPanelElement;\n filterCollection: FilterCollection = {};\n multiFilterItems: MultiFilterItem = {};\n\n filterByType: Record<string, string[]> =\n { ...filterTypes };\n filterNameIndexByType: Record<string, string> = {\n ...filterNames,\n };\n filterFunctionsIndexedByType: Record<string, LogicFunction> = {\n ...filterCoreFunctionsIndexedByType,\n };\n\n filterProp = FILTER_PROP;\n\n constructor(\n public revogrid: HTMLRevoGridElement,\n providers: PluginProviders,\n config?: ColumnFilterConfig,\n ) {\n super(revogrid, providers);\n if (config) {\n this.initConfig(config);\n }\n\n const aftersourceset = async () => {\n const filterCollectionProps = Object.keys(this.filterCollection);\n if (filterCollectionProps.length > 0) {\n // handle old way of filtering by reworking FilterCollection to new MultiFilterItem\n filterCollectionProps.forEach((prop, index) => {\n if (!this.multiFilterItems[prop]) {\n this.multiFilterItems[prop] = [\n {\n id: index,\n type: this.filterCollection[prop].type,\n value: this.filterCollection[prop].value,\n relation: 'and',\n },\n ];\n }\n });\n }\n await this.runFiltering();\n };\n this.addEventListener(\n 'headerclick',\n (e: CustomEvent<HTMLRevoGridElementEventMap['headerclick']>) =>\n this.headerclick(e),\n );\n this.addEventListener(\n FILTER_CONFIG_CHANGED_EVENT,\n ({ detail }: CustomEvent<ColumnFilterConfig | boolean>) => {\n if (!detail) {\n this.clearFiltering();\n return;\n }\n if (typeof detail === 'object') {\n this.initConfig(detail);\n }\n aftersourceset();\n },\n );\n this.addEventListener('aftersourceset', aftersourceset);\n this.addEventListener('filter', ({ detail }: CustomEvent) =>\n this.onFilterChange(detail),\n );\n\n const existingNodes = this.revogrid.registerVNode.filter(\n n => n.$tag$ !== 'revogr-filter-panel',\n );\n this.revogrid.registerVNode = [\n ...existingNodes,\n <revogr-filter-panel\n filterItems={this.multiFilterItems}\n filterNames={this.filterNameIndexByType}\n filterEntities={this.filterFunctionsIndexedByType}\n filterCaptions={config?.localization?.captions}\n onFilterChange={e => this.onFilterChange(e.detail)}\n disableDynamicFiltering={config?.disableDynamicFiltering}\n ref={e => (this.pop = e)}\n />,\n ];\n }\n\n initConfig(config: ColumnFilterConfig) {\n if (config.multiFilterItems) {\n this.multiFilterItems = { ...config.multiFilterItems };\n }\n // Add custom filters\n if (config.customFilters) {\n for (let customFilterType in config.customFilters) {\n const cFilter = config.customFilters[customFilterType];\n if (!this.filterByType[cFilter.columnFilterType]) {\n this.filterByType[cFilter.columnFilterType] = [];\n }\n this.filterByType[cFilter.columnFilterType].push(customFilterType);\n this.filterFunctionsIndexedByType[customFilterType] = cFilter.func;\n this.filterNameIndexByType[customFilterType] = cFilter.name;\n }\n }\n\n // Add filterProp if provided in config\n if (config.filterProp) {\n this.filterProp = config.filterProp;\n }\n\n /**\n * which filters has to be included/excluded\n * convinient way to exclude system filters\n */\n const cfgInlcude = config.include;\n if (cfgInlcude) {\n const filters: Record<string, string[]> = {};\n\n for (let t in this.filterByType) {\n // validate filters, if appropriate function present\n const newTypes = this.filterByType[t].filter(\n f => cfgInlcude.indexOf(f) > -1,\n );\n if (newTypes.length) {\n filters[t] = newTypes;\n }\n }\n // if any valid filters provided show them\n if (Object.keys(filters).length > 0) {\n this.filterByType = filters;\n }\n }\n\n if (config.collection) {\n this.filterCollection = reduce(\n config.collection,\n (result: FilterCollection, item, prop) => {\n if (this.filterFunctionsIndexedByType[item.type]) {\n result[prop] = item;\n } else {\n console.warn(`${item.type} type is not found.`);\n }\n return result;\n },\n {},\n );\n }\n\n if (config.localization) {\n if (config.localization.filterNames) {\n Object.entries(config.localization.filterNames).forEach(([k, v]) => {\n if (this.filterNameIndexByType[k] != void 0) {\n this.filterNameIndexByType[k] = v;\n }\n });\n }\n }\n }\n\n async headerclick(e: CustomEvent<ColumnRegular>) {\n const el = e.detail.originalEvent?.target as HTMLElement;\n if (!isFilterBtn(el)) {\n return;\n }\n e.preventDefault();\n\n // close if same\n const changes = await this.pop?.getChanges();\n if (changes && changes?.prop === e.detail.prop) {\n this.pop?.show();\n return;\n }\n\n if (!this.pop) {\n return;\n }\n\n // filter button clicked, open filter dialog\n const gridPos = this.revogrid.getBoundingClientRect();\n const buttonPos = el.getBoundingClientRect();\n const prop = e.detail.prop;\n\n this.pop.show({\n ...this.filterCollection[prop],\n x: buttonPos.x - gridPos.x,\n y: buttonPos.y - gridPos.y + buttonPos.height,\n autoCorrect: true,\n prop,\n filterTypes: this.getColumnFilter(e.detail.filter),\n });\n }\n\n getColumnFilter(\n type?: boolean | string | string[],\n ): Record<string, string[]> {\n let filterType = 'string';\n if (!type) {\n return { [filterType]: this.filterByType[filterType] };\n }\n\n // if custom column filter\n if (this.isValidType(type)) {\n filterType = type;\n\n // if multiple filters applied\n } else if (typeof type === 'object' && type.length) {\n return type.reduce((r: Record<string, string[]>, multiType) => {\n if (this.isValidType(multiType)) {\n r[multiType] = this.filterByType[multiType];\n }\n return r;\n }, {});\n }\n return { [filterType]: this.filterByType[filterType] };\n }\n\n isValidType(type: any): type is string {\n return !!(typeof type === 'string' && this.filterByType[type]);\n }\n\n /**\n * Called on internal component change\n */\n async onFilterChange(filterItems: MultiFilterItem) {\n // store the filter items\n this.multiFilterItems = filterItems;\n\n // run the filtering when the items change\n this.runFiltering();\n }\n\n /**\n * Triggers grid filtering\n */\n async doFiltering(\n collection: FilterCollection,\n source: DataType[],\n columns: ColumnRegular[],\n filterItems: MultiFilterItem,\n ) {\n const columnsToUpdate: ColumnRegular[] = [];\n\n /**\n * Loop through the columns and update the columns that need to be updated with the `hasFilter` property.\n */\n const columnByProp: Record<string, ColumnRegular> = {};\n columns.forEach(rgCol => {\n const column = { ...rgCol };\n const hasFilter = filterItems[column.prop];\n columnByProp[column.prop] = column;\n\n /**\n * If the column has a filter and it's not already marked as filtered, update the column.\n */\n if (column[this.filterProp] && !hasFilter) {\n delete column[this.filterProp];\n columnsToUpdate.push(column);\n }\n\n /**\n * If the column does not have a filter and it's marked as filtered, update the column.\n */\n\n if (!column[this.filterProp] && hasFilter) {\n columnsToUpdate.push(column);\n column[this.filterProp] = true;\n }\n });\n const itemsToTrim = this.getRowFilter(source, filterItems, columnByProp);\n // check is filter event prevented\n const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {\n collection,\n itemsToFilter: itemsToTrim,\n source,\n filterItems,\n });\n if (defaultPrevented) {\n return;\n }\n\n // check is trimmed event prevented\n const isAddedEvent = await this.revogrid.addTrimmed(\n detail.itemsToFilter,\n FILTER_TRIMMED_TYPE,\n );\n if (isAddedEvent.defaultPrevented) {\n return;\n }\n\n // applies the hasFilter to the columns to show filter icon\n this.providers.column.updateColumns(columnsToUpdate);\n this.emit('afterfilterapply');\n }\n\n async clearFiltering() {\n this.multiFilterItems = {};\n await this.runFiltering();\n }\n\n async runFiltering() {\n const collection: FilterCollection = {};\n\n // handle old filterCollection to return the first filter only (if any) from multiFilterItems\n const filterProps = Object.keys(this.multiFilterItems);\n\n for (const prop of filterProps) {\n // check if we have any filter for a column\n if (this.multiFilterItems[prop].length > 0) {\n const firstFilterItem = this.multiFilterItems[prop][0];\n collection[prop] = {\n filter: this.filterFunctionsIndexedByType[firstFilterItem.type],\n type: firstFilterItem.type,\n value: firstFilterItem.value,\n };\n }\n }\n\n this.filterCollection = collection;\n\n const { source, columns } = await this.getData();\n const { defaultPrevented, detail } = this.emit('beforefilterapply', {\n collection: this.filterCollection,\n source,\n columns,\n filterItems: this.multiFilterItems,\n });\n if (defaultPrevented) {\n return;\n }\n this.doFiltering(\n detail.collection,\n detail.source,\n detail.columns,\n detail.filterItems,\n );\n }\n\n async getData() {\n return {\n source: await this.revogrid.getSource(),\n columns: await this.revogrid.getColumns(),\n };\n }\n\n /**\n * Get trimmed rows based on filter\n */\n getRowFilter(\n rows: DataType[],\n filterItems: MultiFilterItem,\n columnByProp: Record<string, ColumnRegular>\n ): Record<number, boolean> {\n const propKeys = Object.keys(filterItems);\n\n const trimmed: Record<number, boolean> = {};\n let propFilterSatisfiedCount = 0;\n let lastFilterResults: boolean[] = [];\n\n // each rows\n rows.forEach((model, rowIndex) => {\n // check filter by column properties\n for (const prop of propKeys) {\n const propFilters = filterItems[prop];\n\n // reset the count of satisfied filters\n propFilterSatisfiedCount = 0;\n // reset the array of last filter results\n lastFilterResults = [];\n\n // testing each filter for a prop\n for (const [filterIndex, filterData] of propFilters.entries()) {\n // the filter LogicFunction based on the type\n const filterFunc = this.filterFunctionsIndexedByType[filterData.type];\n\n // THE MAGIC OF FILTERING IS HERE\n const column = columnByProp[prop];\n // If there is no column but user wants to filter by a property\n const value = column ? getCellDataParsed(model, columnByProp[prop]) : model[prop];\n // OR relation\n if (filterData.relation === 'or') {\n // reset the array of last filter results\n lastFilterResults = [];\n // if the filter is satisfied, continue to the next filter\n if (filterFunc(value, filterData.value)) {\n continue;\n }\n // if the filter is not satisfied, count it\n propFilterSatisfiedCount++;\n\n // AND relation\n } else {\n // 'and' relation will need to know the next filter\n // so we save this current filter to include it in the next filter\n lastFilterResults.push(!filterFunc(value, filterData.value));\n\n // check first if we have a filter on the next index to pair it with this current filter\n const nextFilterData = propFilters[filterIndex + 1];\n // stop the sequence if there is no next filter or if the next filter is not an 'and' relation\n if (!nextFilterData || nextFilterData.relation !== 'and') {\n // let's just continue since for sure propFilterSatisfiedCount cannot be satisfied\n if (lastFilterResults.indexOf(true) === -1) {\n // reset the array of last filter results\n lastFilterResults = [];\n continue;\n }\n\n // we need to add all of the lastFilterResults since we need to satisfy all\n propFilterSatisfiedCount += lastFilterResults.length;\n // reset the array of last filter results\n lastFilterResults = [];\n }\n }\n } // end of propFilters forEach\n\n // add to the list of removed/trimmed rows of filter condition is satisfied\n if (propFilterSatisfiedCount === propFilters.length) {\n trimmed[rowIndex] = true;\n }\n } // end of for-of propKeys\n });\n return trimmed;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.types.js","sourceRoot":"","sources":["../../../src/plugins/filter/filter.types.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"filter.types.js","sourceRoot":"","sources":["../../../src/plugins/filter/filter.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ColumnProp } from '@type';\nimport { FilterType } from './filter.indexed';\n\nexport type DateEnum =\n | 'today'\n | 'yesterday'\n | 'tomorrow'\n | 'thisweek'\n | 'lastweek'\n | 'nextweek'\n | 'thismonth'\n | 'lastmonth'\n | 'nextmonth'\n | 'thisyear'\n | 'lastyear'\n | 'nextyear';\n\nexport type ExtraField = 'input' | 'select' | 'multi' | 'datepicker';\n\nexport type LogicFunctionParam = any;\nexport type LogicFunctionExtraParam =\n | 'select'\n | 'input'\n | 'multi'\n | 'datepicker'\n | number\n | Date\n | DateEnum\n | null\n | undefined\n | string\n | string[]\n | number[];\nexport type LogicFunction = {\n (value: LogicFunctionParam, extra?: LogicFunctionExtraParam): boolean;\n extra?: ExtraField;\n};\n\ntype CustomFilter = {\n columnFilterType: string; // property defined in column filter: string/number/abstract/enum...etc\n name: string;\n func: LogicFunction;\n};\n\nexport type FilterCaptions = {\n title: string;\n save: string;\n reset: string;\n cancel: string;\n add: string;\n placeholder: string;\n and: string;\n or: string;\n};\n\nexport type FilterLocalization = {\n captions: FilterCaptions;\n filterNames: Record<FilterType, string>;\n};\n/**\n * Filter configuration for a column. This is the type of the `filter` property on a column.\n */\nexport type ColumnFilterConfig = {\n /**\n * The collection of filters to be applied to the column.\n */\n collection?: FilterCollection;\n /**\n * The names of the filters to be included in the filter dropdown.\n */\n include?: string[];\n /**\n * A mapping of custom filter names to custom filter functions.\n */\n customFilters?: Record<string, CustomFilter>;\n /**\n * The property on the column idintifying which has the filter is applied.\n */\n filterProp?: string;\n /**\n * The localization for the filter dropdown.\n */\n localization?: FilterLocalization;\n /**\n * Information about the multi-filter items.\n */\n multiFilterItems?: MultiFilterItem;\n /**\n * Whether or not to disable dynamic filtering. If set to true, the filter will only be applied\n * when the user clicks on the filter button.\n */\n disableDynamicFiltering?: boolean;\n};\ntype FilterCollectionItem = {\n filter: LogicFunction;\n type: FilterType;\n value?: any;\n};\n\nexport type FilterCollection = Record<ColumnProp, FilterCollectionItem>;\n\n\nexport type FilterItem = {\n // column id\n prop?: ColumnProp;\n // filter type definition\n type?: FilterType;\n // value for additional filtering, text value or some id\n value?: any;\n};\n\nexport type FilterData = {\n id: number;\n type: FilterType;\n value?: any;\n relation: 'and' | 'or';\n};\n\nexport type MultiFilterItem = {\n [prop: string]: FilterData[];\n};\n\nexport type ShowData = {\n x: number;\n y: number;\n /**\n * Auto correct position if it is out of document bounds\n */\n autoCorrect?: boolean;\n filterTypes?: Record<string, string[]>;\n} & FilterItem;\n"]}
|
|
@@ -50,8 +50,14 @@ export class WCAGPlugin extends BasePlugin {
|
|
|
50
50
|
return result;
|
|
51
51
|
};
|
|
52
52
|
column.cellProperties = (...args) => {
|
|
53
|
+
const wcagProps = {
|
|
54
|
+
['role']: 'gridcell',
|
|
55
|
+
['aria-colindex']: index,
|
|
56
|
+
['aria-rowindex']: args[0].rowIndex,
|
|
57
|
+
['tabindex']: -1,
|
|
58
|
+
};
|
|
53
59
|
const columnProps = (cellProperties === null || cellProperties === void 0 ? void 0 : cellProperties(...args)) || {};
|
|
54
|
-
return Object.assign({
|
|
60
|
+
return Object.assign(Object.assign({}, wcagProps), columnProps);
|
|
55
61
|
};
|
|
56
62
|
});
|
|
57
63
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/wcag/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IACxC,YAAY,QAA6B,EAAE,SAA0B;QACnE,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAE3B,QAAQ,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACpC,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAC1C,QAAQ,CAAC,YAAY,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;QACpD,QAAQ,CAAC,YAAY,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;QACtD,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAEvC;;WAEG;QACH,IAAI,CAAC,gBAAgB,CACnB,kBAAkB,EAClB,CAAC,EAAE,MAAM,EAAiC,EAAE,EAAE;YAC5C,MAAM,OAAO,GAAG;gBACd,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW;gBAC7B,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK;gBACvB,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS;aAC5B,CAAC;YAEF,QAAQ,CAAC,YA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ACL,CAAC,CACF,CAAC;QAEF;;WAEG;QACH,IAAI,CAAC,gBAAgB,CACnB,iBAAiB,EACjB,CAAC,EACC,MAAM,GACsD,EAAE,EAAE;YAChE,QAAQ,CAAC,YAAY,CAAC,eAAe,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACpE,CAAC,CACF,CAAC;QACF,IAAI,CAAC,gBAAgB,CACnB,iBAAiB,EACjB,CAAC,EACC,MAAM,GACwD,EAAE,EAAE;YAClE,MAAM,CAAC,IAAI,CAAC,OAAO,mCACd,MAAM,CAAC,IAAI,CAAC,OAAO,KACtB,IAAI,EAAE,KAAK,EACX,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,GACzC,CAAC;QACJ,CAAC,CACF,CAAC;QAEF,YAAY;QACZ,IAAI,CAAC,gBAAgB,CACnB,YAAY,EACZ,KAAK,EACH,CAA4D,EAC5D,EAAE;YACF,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;gBACvB,OAAO;YACT,CAAC;YACD,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CACpC,qBAAqB,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,QAAQ,kBAAkB,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,CACjJ,CAAC;YACF,IAAI,EAAE,YAAY,WAAW,EAAE,CAAC;gBAC9B,EAAE,CAAC,KAAK,EAAE,CAAC;YACb,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { CellProps, PluginProviders } from '@type';\nimport { BasePlugin } from '../base.plugin';\nimport { ColumnCollection } from 'src/utils';\n\n/**\n * WCAG Plugin is responsible for enhancing the accessibility features of the RevoGrid component.\n * It ensures that the grid is fully compliant with Web Content Accessibility Guidelines (WCAG) 2.1.\n * This plugin should be the last plugin you add, as it modifies the grid's default behavior.\n *\n * The WCAG Plugin performs the following tasks:\n * - Sets the 'dir' attribute to 'ltr' for left-to-right text direction.\n * - Sets the 'role' attribute to 'treegrid' for treelike hierarchical structure.\n * - Sets the 'aria-keyshortcuts' attribute to 'Enter' and 'Esc' for keyboard shortcuts.\n * - Adds event listeners for keyboard navigation and editing.\n *\n * By default, the plugin adds ARIA roles and properties to the grid elements, providing semantic information\n * for assistive technologies. These roles include 'grid', 'row', and 'gridcell'. The plugin also sets\n * ARIA attributes such as 'aria-rowindex', 'aria-colindex', and 'aria-selected'.\n *\n * The WCAG Plugin ensures that the grid is fully functional and usable for users with various disabilities,\n * including visual impairments, deaf-blindness, and cognitive disabilities.\n *\n * Note: The WCAG Plugin should be added as the last plugin in the list of plugins, as it modifies the grid's\n * default behavior and may conflict with other plugins if added earlier.\n */\nexport class WCAGPlugin extends BasePlugin {\n constructor(revogrid: HTMLRevoGridElement, providers: PluginProviders) {\n super(revogrid, providers);\n\n revogrid.setAttribute('dir', 'ltr');\n revogrid.setAttribute('role', 'treegrid');\n revogrid.setAttribute('aria-keyshortcuts', 'Enter');\n revogrid.setAttribute('aria-multiselectable', 'true');\n revogrid.setAttribute('tabindex', '0');\n\n /**\n * Before Columns Set Event\n */\n this.addEventListener(\n 'beforecolumnsset',\n ({ detail }: CustomEvent<ColumnCollection>) => {\n const columns = [\n ...detail.columns.colPinStart,\n ...detail.columns.rgCol,\n ...detail.columns.colPinEnd,\n ];\n\n revogrid.setAttribute('aria-colcount', `${columns.length}`);\n\n columns.forEach((column, index) => {\n const { columnProperties, cellProperties } = column;\n\n column.columnProperties = (...args) => {\n const result = columnProperties?.(...args) || {};\n\n result.role = 'columnheader';\n result['aria-colindex'] = index;\n\n return result;\n };\n\n column.cellProperties = (...args) => {\n const wcagProps: CellProps = {\n ['role']: 'gridcell',\n ['aria-colindex']: index,\n ['aria-rowindex']: args[0].rowIndex,\n ['tabindex']: -1,\n };\n const columnProps: CellProps = cellProperties?.(...args) || {};\n\n return {\n ...wcagProps,\n ...columnProps,\n };\n };\n });\n },\n );\n\n /**\n * Before Row Set Event\n */\n this.addEventListener(\n 'beforesourceset',\n ({\n detail,\n }: CustomEvent<HTMLRevoGridElementEventMap['beforesourceset']>) => {\n revogrid.setAttribute('aria-rowcount', `${detail.source.length}`);\n },\n );\n this.addEventListener(\n 'beforerowrender',\n ({\n detail,\n }: CustomEvent<HTMLRevogrDataElementEventMap['beforerowrender']>) => {\n detail.node.$attrs$ = {\n ...detail.node.$attrs$,\n role: 'row',\n ['aria-rowindex']: detail.item.itemIndex,\n };\n },\n );\n\n // focuscell\n this.addEventListener(\n 'afterfocus',\n async (\n e: CustomEvent<HTMLRevogrFocusElementEventMap['afterfocus']>,\n ) => {\n if (e.defaultPrevented) {\n return;\n }\n const el = this.revogrid.querySelector(\n `revogr-data[type=\"${e.detail.rowType}\"][col-type=\"${e.detail.colType}\"] [data-rgrow=\"${e.detail.rowIndex}\"][data-rgcol=\"${e.detail.colIndex}\"]`,\n );\n if (el instanceof HTMLElement) {\n el.focus();\n }\n },\n );\n }\n}\n"]}
|
|
@@ -291,7 +291,7 @@ function onLoad() {
|
|
|
291
291
|
|
|
292
292
|
// events testing
|
|
293
293
|
// 'beforerange', 'setRange', 'beforefocuslost', 'beforecellfocus', 'afterfocus', 'beforeedit', 'aftercolumnresize'
|
|
294
|
-
const events = [];
|
|
294
|
+
const events = ['headerdblclick'];
|
|
295
295
|
events.forEach(e => {
|
|
296
296
|
grid.addEventListener(e, $e => {
|
|
297
297
|
if (window.eventsPrevented[e]) {
|
|
@@ -81,6 +81,14 @@ export function generateFakeDataObject(config = {}) {
|
|
|
81
81
|
size: 100,
|
|
82
82
|
// custom sorting
|
|
83
83
|
cellCompare: rgCol % 2 == 0 ? naturalSort : undefined,
|
|
84
|
+
cellProperties: ({ colIndex }) => ({
|
|
85
|
+
className: {
|
|
86
|
+
'first-column': colIndex === 0,
|
|
87
|
+
},
|
|
88
|
+
class: {
|
|
89
|
+
'first-column-class': colIndex === 0,
|
|
90
|
+
}
|
|
91
|
+
})
|
|
84
92
|
|
|
85
93
|
// custom filter
|
|
86
94
|
// filter: 'myFilterType',
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import reduce from "lodash/reduce";
|
|
5
5
|
import each from "lodash/each";
|
|
6
|
-
import find from "lodash/find";
|
|
7
6
|
import { columnTypes, DataStore, getSourceItem, getSourceItemVirtualIndexByProp, setSourceByVirtualIndex, } from "../store/index";
|
|
8
7
|
import { getColumnType } from "../utils/column.utils";
|
|
9
8
|
export default class ColumnDataProvider {
|
|
@@ -11,7 +10,7 @@ export default class ColumnDataProvider {
|
|
|
11
10
|
const order = {};
|
|
12
11
|
const sorting = this.sorting;
|
|
13
12
|
if (sorting) {
|
|
14
|
-
Object.keys(sorting).forEach(
|
|
13
|
+
Object.keys(sorting).forEach(prop => {
|
|
15
14
|
order[prop] = sorting[prop].order;
|
|
16
15
|
});
|
|
17
16
|
}
|
|
@@ -22,6 +21,7 @@ export default class ColumnDataProvider {
|
|
|
22
21
|
}
|
|
23
22
|
constructor() {
|
|
24
23
|
this.sorting = null;
|
|
24
|
+
this.collection = null;
|
|
25
25
|
this.dataSources = columnTypes.reduce((sources, k) => {
|
|
26
26
|
sources[k] = new DataStore(k);
|
|
27
27
|
return sources;
|
|
@@ -55,9 +55,9 @@ export default class ColumnDataProvider {
|
|
|
55
55
|
getColumnIndexByProp(prop, type) {
|
|
56
56
|
return getSourceItemVirtualIndexByProp(this.dataSources[type].store, prop);
|
|
57
57
|
}
|
|
58
|
-
getColumnByProp(prop
|
|
59
|
-
|
|
60
|
-
return
|
|
58
|
+
getColumnByProp(prop) {
|
|
59
|
+
var _a;
|
|
60
|
+
return (_a = this.collection) === null || _a === void 0 ? void 0 : _a.columnByProp[prop];
|
|
61
61
|
}
|
|
62
62
|
refreshByType(type) {
|
|
63
63
|
this.dataSources[type].refresh();
|
|
@@ -79,6 +79,7 @@ export default class ColumnDataProvider {
|
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
81
|
this.sorting = data.sort;
|
|
82
|
+
this.collection = data;
|
|
82
83
|
return data;
|
|
83
84
|
}
|
|
84
85
|
updateColumns(cols) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"column.data.provider.js","sourceRoot":"","sources":["../../src/services/column.data.provider.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,IAAI,MAAM,aAAa,CAAC;AAE/B,OAAO,EACL,WAAW,EACX,SAAS,EACT,aAAa,EACb,+BAA+B,EAE/B,uBAAuB,GACxB,MAAM,QAAQ,CAAC;AAOhB,OAAO,EAAoB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAUxE,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAIrC,IAAI,KAAK;QACP,MAAM,KAAK,GAAiB,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACpC,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;YACpC,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IACD;QAhBA,YAAO,GAAmB,IAAI,CAAC;QAiB7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,OAA0B,EAAE,CAAgB,EAAE,EAAE;YACrF,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;YAC9B,OAAO,OAAO,CAAC;QACjB,CAAC,EAAE,EAAuB,CA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,EAAE,EAAE;YACrC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxD,IAAI,CAAC,IAAI,EAAE,CAAC,CAAgB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;YACxD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;CACF","sourcesContent":["import reduce from 'lodash/reduce';\nimport each from 'lodash/each';\nimport find from 'lodash/find';\n\nimport {\n columnTypes,\n DataStore,\n getSourceItem,\n getSourceItemVirtualIndexByProp,\n Groups,\n setSourceByVirtualIndex,\n} from '@store';\nimport type {\n ColumnProp,\n ColumnRegular,\n DimensionCols,\n DimensionColPin,\n} from '@type';\nimport { ColumnCollection, getColumnType } from '../utils/column.utils';\n\n\nexport type ColumnDataSources = Record<\n DimensionCols,\n DataStore<ColumnRegular, DimensionCols>\n>;\ntype Sorting = Record<ColumnProp, ColumnRegular>;\ntype SortingOrder = Record<ColumnProp, 'asc' | 'desc' | undefined>;\n\nexport default class ColumnDataProvider {\n readonly dataSources: ColumnDataSources;\n sorting: Sorting | null = null;\n\n get order() {\n const order: SortingOrder = {};\n const sorting = this.sorting;\n if (sorting) {\n Object.keys(sorting).forEach((prop) => {\n order[prop] = sorting[prop].order;\n });\n }\n return order;\n }\n\n get stores() {\n return this.dataSources;\n }\n constructor() {\n this.dataSources = columnTypes.reduce((sources: ColumnDataSources, k: DimensionCols) => {\n sources[k] = new DataStore(k);\n return sources;\n }, {} as ColumnDataSources);\n }\n\n column(c: number, pin?: DimensionColPin): ColumnRegular | undefined {\n return this.getColumn(c, pin || 'rgCol');\n }\n\n getColumn(\n virtualIndex: number,\n type: DimensionCols,\n ): ColumnRegular | undefined {\n return getSourceItem(this.dataSources[type].store, virtualIndex);\n }\n\n getRawColumns() {\n return reduce(\n this.dataSources,\n (\n result: Record<DimensionCols, ColumnRegular[]>,\n item,\n type: DimensionCols,\n ) => {\n result[type] = item.store.get('source');\n return result;\n },\n {\n rgCol: [],\n colPinStart: [],\n colPinEnd: [],\n },\n );\n }\n\n getColumns(type: DimensionCols | 'all' = 'all'): ColumnRegular[] {\n if (type !== 'all') {\n return this.dataSources[type].store.get('source');\n }\n return columnTypes.reduce((r: ColumnRegular[], t) => {\n r.push(...this.dataSources[t].store.get('source'));\n return r;\n }, []);\n }\n\n getColumnIndexByProp(prop: ColumnProp, type: DimensionCols): number {\n return getSourceItemVirtualIndexByProp(this.dataSources[type].store, prop);\n }\n\n getColumnByProp(\n prop: ColumnProp,\n type: DimensionCols,\n ): ColumnRegular | undefined {\n const items = this.dataSources[type].store.get('source');\n return find(items, { prop });\n }\n\n refreshByType(type: DimensionCols) {\n this.dataSources[type].refresh();\n }\n\n setColumns(data: ColumnCollection): ColumnCollection {\n columnTypes.forEach(k => {\n // set columns data\n this.dataSources[k].updateData(data.columns[k], {\n // max depth level\n depth: data.maxLevel,\n\n // groups\n groups: data.columnGrouping[k].reduce((res: Groups, g) => {\n if (!res[g.level]) {\n res[g.level] = [];\n }\n res[g.level].push(g);\n return res;\n }, {}),\n });\n });\n this.sorting = data.sort;\n return data;\n }\n\n updateColumns(cols: ColumnRegular[]) {\n // collect column by type and propert\n const columnByKey: Partial<\n Record<DimensionCols, Record<ColumnProp, ColumnRegular>>\n > = cols.reduce(\n (\n res: Partial<Record<DimensionCols, Record<ColumnProp, ColumnRegular>>>,\n c,\n ) => {\n const type = getColumnType(c);\n if (!res[type]) {\n res[type] = {};\n }\n res[type][c.prop] = c;\n return res;\n },\n {},\n );\n\n // find indexes in source\n const colByIndex: Partial<\n Record<DimensionCols, Record<number, ColumnRegular>>\n > = {};\n for (const t in columnByKey) {\n if (!columnByKey.hasOwnProperty(t)) {\n continue;\n }\n const type = t as DimensionCols;\n const colsToUpdate = columnByKey[type];\n const items = this.dataSources[type].store.get('source');\n colByIndex[type] = {};\n for (let i = 0; i < items.length; i++) {\n const rgCol = items[i];\n const colToUpdateIfExists = colsToUpdate?.[rgCol.prop];\n if (colToUpdateIfExists) {\n colByIndex[type][i] = colToUpdateIfExists;\n }\n }\n }\n for (const t in colByIndex) {\n if (!colByIndex.hasOwnProperty(t)) {\n continue;\n }\n const type = t as DimensionCols;\n setSourceByVirtualIndex(\n this.dataSources[type].store,\n colByIndex[type] || {},\n );\n }\n }\n\n updateColumn(column: ColumnRegular, index: number) {\n const type = getColumnType(column);\n setSourceByVirtualIndex(this.dataSources[type].store, { [index]: column });\n }\n\n updateColumnSorting(\n column: ColumnRegular,\n index: number,\n sorting: 'asc' | 'desc' | undefined,\n additive: boolean,\n ): ColumnRegular {\n if (!additive) {\n this.clearSorting();\n }\n column.order = sorting;\n if (!this.sorting) {\n this.sorting = {};\n }\n this.sorting[column.prop] = column;\n this.updateColumn(column, index);\n return column;\n }\n\n clearSorting() {\n const types = reduce(\n this.sorting,\n (r: { [key in Partial<DimensionCols>]: boolean }, c: ColumnRegular) => {\n const k = getColumnType(c);\n r[k] = true;\n return r;\n },\n {} as { [key in Partial<DimensionCols>]: boolean },\n );\n each(types, (_, type: DimensionCols) => {\n const cols = this.dataSources[type].store.get('source');\n each(cols, (c: ColumnRegular) => (c.order = undefined));\n this.dataSources[type].setData({ source: [...cols] });\n });\n\n this.sorting = {};\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"column.data.provider.js","sourceRoot":"","sources":["../../src/services/column.data.provider.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,IAAI,MAAM,aAAa,CAAC;AAE/B,OAAO,EACL,WAAW,EACX,SAAS,EACT,aAAa,EACb,+BAA+B,EAE/B,uBAAuB,GACxB,MAAM,QAAQ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\nimport {\n columnTypes,\n DataStore,\n getSourceItem,\n getSourceItemVirtualIndexByProp,\n Groups,\n setSourceByVirtualIndex,\n} from '@store';\nimport type {\n ColumnProp,\n ColumnRegular,\n DimensionCols,\n DimensionColPin,\n} from '@type';\nimport { ColumnCollection, getColumnType } from '../utils/column.utils';\n\nexport type ColumnDataSources = Record<\n DimensionCols,\n DataStore<ColumnRegular, DimensionCols>\n>;\ntype Sorting = Record<ColumnProp, ColumnRegular>;\ntype SortingOrder = Record<ColumnProp, 'asc' | 'desc' | undefined>;\n\nexport default class ColumnDataProvider {\n readonly dataSources: ColumnDataSources;\n sorting: Sorting | null = null;\n collection: ColumnCollection | null = null;\n\n get order() {\n const order: SortingOrder = {};\n const sorting = this.sorting;\n if (sorting) {\n Object.keys(sorting).forEach(prop => {\n order[prop] = sorting[prop].order;\n });\n }\n return order;\n }\n\n get stores() {\n return this.dataSources;\n }\n constructor() {\n this.dataSources = columnTypes.reduce(\n (sources: ColumnDataSources, k: DimensionCols) => {\n sources[k] = new DataStore(k);\n return sources;\n },\n {} as ColumnDataSources,\n );\n }\n\n column(c: number, pin?: DimensionColPin): ColumnRegular | undefined {\n return this.getColumn(c, pin || 'rgCol');\n }\n\n getColumn(\n virtualIndex: number,\n type: DimensionCols,\n ): ColumnRegular | undefined {\n return getSourceItem(this.dataSources[type].store, virtualIndex);\n }\n\n getRawColumns() {\n return reduce(\n this.dataSources,\n (\n result: Record<DimensionCols, ColumnRegular[]>,\n item,\n type: DimensionCols,\n ) => {\n result[type] = item.store.get('source');\n return result;\n },\n {\n rgCol: [],\n colPinStart: [],\n colPinEnd: [],\n },\n );\n }\n\n getColumns(type: DimensionCols | 'all' = 'all'): ColumnRegular[] {\n if (type !== 'all') {\n return this.dataSources[type].store.get('source');\n }\n return columnTypes.reduce((r: ColumnRegular[], t) => {\n r.push(...this.dataSources[t].store.get('source'));\n return r;\n }, []);\n }\n\n getColumnIndexByProp(prop: ColumnProp, type: DimensionCols): number {\n return getSourceItemVirtualIndexByProp(this.dataSources[type].store, prop);\n }\n\n getColumnByProp(prop: ColumnProp) {\n return this.collection?.columnByProp[prop];\n }\n\n refreshByType(type: DimensionCols) {\n this.dataSources[type].refresh();\n }\n\n setColumns(data: ColumnCollection): ColumnCollection {\n columnTypes.forEach(k => {\n // set columns data\n this.dataSources[k].updateData(data.columns[k], {\n // max depth level\n depth: data.maxLevel,\n\n // groups\n groups: data.columnGrouping[k].reduce((res: Groups, g) => {\n if (!res[g.level]) {\n res[g.level] = [];\n }\n res[g.level].push(g);\n return res;\n }, {}),\n });\n });\n this.sorting = data.sort;\n this.collection = data;\n return data;\n }\n\n updateColumns(cols: ColumnRegular[]) {\n // collect column by type and propert\n const columnByKey: Partial<\n Record<DimensionCols, Record<ColumnProp, ColumnRegular>>\n > = cols.reduce(\n (\n res: Partial<Record<DimensionCols, Record<ColumnProp, ColumnRegular>>>,\n c,\n ) => {\n const type = getColumnType(c);\n if (!res[type]) {\n res[type] = {};\n }\n res[type][c.prop] = c;\n return res;\n },\n {},\n );\n\n // find indexes in source\n const colByIndex: Partial<\n Record<DimensionCols, Record<number, ColumnRegular>>\n > = {};\n for (const t in columnByKey) {\n if (!columnByKey.hasOwnProperty(t)) {\n continue;\n }\n const type = t as DimensionCols;\n const colsToUpdate = columnByKey[type];\n const items = this.dataSources[type].store.get('source');\n colByIndex[type] = {};\n for (let i = 0; i < items.length; i++) {\n const rgCol = items[i];\n const colToUpdateIfExists = colsToUpdate?.[rgCol.prop];\n if (colToUpdateIfExists) {\n colByIndex[type][i] = colToUpdateIfExists;\n }\n }\n }\n for (const t in colByIndex) {\n if (!colByIndex.hasOwnProperty(t)) {\n continue;\n }\n const type = t as DimensionCols;\n setSourceByVirtualIndex(\n this.dataSources[type].store,\n colByIndex[type] || {},\n );\n }\n }\n\n updateColumn(column: ColumnRegular, index: number) {\n const type = getColumnType(column);\n setSourceByVirtualIndex(this.dataSources[type].store, { [index]: column });\n }\n\n updateColumnSorting(\n column: ColumnRegular,\n index: number,\n sorting: 'asc' | 'desc' | undefined,\n additive: boolean,\n ): ColumnRegular {\n if (!additive) {\n this.clearSorting();\n }\n column.order = sorting;\n if (!this.sorting) {\n this.sorting = {};\n }\n this.sorting[column.prop] = column;\n this.updateColumn(column, index);\n return column;\n }\n\n clearSorting() {\n const types = reduce(\n this.sorting,\n (r: { [key in Partial<DimensionCols>]: boolean }, c: ColumnRegular) => {\n const k = getColumnType(c);\n r[k] = true;\n return r;\n },\n {} as { [key in Partial<DimensionCols>]: boolean },\n );\n each(types, (_, type: DimensionCols) => {\n const cols = this.dataSources[type].store.get('source');\n each(cols, (c: ColumnRegular) => (c.order = undefined));\n this.dataSources[type].setData({ source: [...cols] });\n });\n\n this.sorting = {};\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.compact.js","sourceRoot":"","sources":["../../src/themeManager/theme.compact.ts"],"names":[],"mappings":"AAEA,MAAM,
|
|
1
|
+
{"version":3,"file":"theme.compact.js","sourceRoot":"","sources":["../../src/themeManager/theme.compact.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IAAzB;QACE,mBAAc,GAAG,EAAE,CAAC;IACtB,CAAC;CAAA","sourcesContent":["import { ThemePackage } from '../types/theme';\n\nexport class ThemeCompact implements ThemePackage {\n defaultRowSize = 32;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.default.js","sourceRoot":"","sources":["../../src/themeManager/theme.default.ts"],"names":[],"mappings":"AAEA,MAAM,
|
|
1
|
+
{"version":3,"file":"theme.default.js","sourceRoot":"","sources":["../../src/themeManager/theme.default.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IAAzB;QACE,mBAAc,GAAG,EAAE,CAAC;IACtB,CAAC;CAAA","sourcesContent":["import { ThemePackage } from '../types/theme';\n\nexport class ThemeDefault implements ThemePackage {\n defaultRowSize = 27;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.material.js","sourceRoot":"","sources":["../../src/themeManager/theme.material.ts"],"names":[],"mappings":"AAEA,MAAM,
|
|
1
|
+
{"version":3,"file":"theme.material.js","sourceRoot":"","sources":["../../src/themeManager/theme.material.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAa;IAA1B;QACE,mBAAc,GAAG,EAAE,CAAC;IACtB,CAAC;CAAA","sourcesContent":["import { ThemePackage } from '../types/theme';\n\nexport class ThemeMaterial implements ThemePackage {\n defaultRowSize = 42;\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built by Revolist OU ❤️
|
|
3
3
|
*/
|
|
4
|
-
import ThemeCompact from "./theme.compact";
|
|
5
|
-
import ThemeDefault from "./theme.default";
|
|
6
|
-
import ThemeMaterial from "./theme.material";
|
|
4
|
+
import { ThemeCompact } from "./theme.compact";
|
|
5
|
+
import { ThemeDefault } from "./theme.default";
|
|
6
|
+
import { ThemeMaterial } from "./theme.material";
|
|
7
7
|
export const DEFAULT_THEME = 'default';
|
|
8
8
|
export const allowedThemes = [
|
|
9
9
|
DEFAULT_THEME,
|
|
@@ -28,7 +28,7 @@ export default class ThemeService {
|
|
|
28
28
|
this.register('default');
|
|
29
29
|
}
|
|
30
30
|
register(theme) {
|
|
31
|
-
const parsedTheme =
|
|
31
|
+
const parsedTheme = getTheme(theme);
|
|
32
32
|
switch (parsedTheme) {
|
|
33
33
|
case 'material':
|
|
34
34
|
case 'darkMaterial':
|
|
@@ -43,11 +43,11 @@ export default class ThemeService {
|
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return DEFAULT_THEME;
|
|
46
|
+
}
|
|
47
|
+
export function getTheme(theme) {
|
|
48
|
+
if (theme && allowedThemes.indexOf(theme) > -1) {
|
|
49
|
+
return theme;
|
|
51
50
|
}
|
|
51
|
+
return DEFAULT_THEME;
|
|
52
52
|
}
|
|
53
53
|
//# sourceMappingURL=theme.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.service.js","sourceRoot":"","sources":["../../src/themeManager/theme.service.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"theme.service.js","sourceRoot":"","sources":["../../src/themeManager/theme.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AAEvC,MAAM,CAAC,MAAM,aAAa,GAAY;IACpC,aAAa;IACb,UAAU;IACV,SAAS;IACT,cAAc;IACd,aAAa;CACd,CAAC;AACF,MAAM,CAAC,OAAO,OAAO,YAAY;IAI/B,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC;IAChE,CAAC;IAED,IAAI,OAAO,CAAC,IAAY;QACtB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED,YAAY,GAAgB;QAdpB,kBAAa,GAAG,CAAC,CAAC;QAexB,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC;QACjC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,QAAQ,CAAC,KAAY;QACnB,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpC,QAAQ,WAAW,EAAE,CAAC;YACpB,KAAK,UAAU,CAAC;YAChB,KAAK,cAAc;gBACjB,IAAI,CAAC,YAAY,GAAG,IAAI,aAAa,EAAE,CAAC;gBACxC,MAAM;YACR,KAAK,SAAS,CAAC;YACf,KAAK,aAAa;gBAChB,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;gBACvC,MAAM;YACR;gBACE,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;gBACvC,MAAM;QACV,CAAC;IACH,CAAC;CACF;AAGD,MAAM,UAAU,QAAQ,CAAC,KAAqB;IAC5C,IAAI,KAAK,IAAI,aAAa,CAAC,OAAO,CAAC,KAAc,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACxD,OAAO,KAAc,CAAC;IACxB,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import type { Theme, ThemeConfig, ThemePackage } from '../types/theme';\nimport { ThemeCompact } from './theme.compact';\nimport { ThemeDefault } from './theme.default';\nimport { ThemeMaterial } from './theme.material';\n\nexport const DEFAULT_THEME = 'default';\n\nexport const allowedThemes: Theme[] = [\n DEFAULT_THEME,\n 'material',\n 'compact',\n 'darkMaterial',\n 'darkCompact',\n];\nexport default class ThemeService {\n private currentTheme: ThemePackage;\n private customRowSize = 0;\n\n get theme() {\n return this.currentTheme;\n }\n\n get rowSize() {\n return this.customRowSize || this.currentTheme.defaultRowSize;\n }\n\n set rowSize(size: number) {\n this.customRowSize = size;\n }\n\n constructor(cfg: ThemeConfig) {\n this.customRowSize = cfg.rowSize;\n this.register('default');\n }\n\n register(theme: Theme) {\n const parsedTheme = getTheme(theme);\n switch (parsedTheme) {\n case 'material':\n case 'darkMaterial':\n this.currentTheme = new ThemeMaterial();\n break;\n case 'compact':\n case 'darkCompact':\n this.currentTheme = new ThemeCompact();\n break;\n default:\n this.currentTheme = new ThemeDefault();\n break;\n }\n }\n}\n\n\nexport function getTheme(theme?: string | null): Theme {\n if (theme && allowedThemes.indexOf(theme as Theme) > -1) {\n return theme as Theme;\n }\n return DEFAULT_THEME;\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/types/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import type { VNode } from '@stencil/core';\n\nimport {\n DimensionCols,\n DimensionRows,\n DimensionColPin,\n DimensionType,\n MultiDimensionType,\n} from './dimension';\nimport {\n Cell,\n EditorCtr,\n FocusedCells,\n OldNewRangeMapping,\n RangeArea,\n SelectionStoreState,\n} from './selection';\nimport type { Observable } from '../utils/store.utils';\n\nexport type Nullable<T> = {\n [P in keyof T]: T[P] | null;\n};\n\n/**\n * Advanced column data schema model.\n * Used for transpassing data to cell renderer and editor.\n */\nexport type ColumnDataSchemaModel = {\n /**\n * Column prop used for mapping value to cell from data source model/row\n */\n prop: ColumnProp;\n /**\n * Row data object\n */\n model: DataType;\n /**\n * Column data object\n */\n column: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n /**\n * Column type based on viewport\n */\n colType: DimensionCols;\n /**\n * Row type based on viewport\n */\n type: DimensionRows;\n /**\n * Row models based on viewport\n */\n data: DataType[];\n /**\n * Current cell data\n */\n value: any;\n};\n/**\n * Template property for each cell, extends the column data schema model.\n * Additionally, it provides access to the providers injected into the template.\n */\nexport interface CellTemplateProp extends ColumnDataSchemaModel {\n /**\n * Providers injected into the template\n */\n providers: Providers;\n}\n/**\n * The ReadOnlyFormat type is a boolean value or a function that takes ColumnDataSchemaModel\n * as a parameter and returns a boolean value.\n *\n * If it is a boolean value, it represents whether the cell in question is read-only.\n * If it is a function, it returns whether the cell in question is read-only based on the provided\n * ColumnDataSchemaModel.\n */\nexport type ReadOnlyFormat =\n | boolean\n | ((params: ColumnDataSchemaModel) => boolean);\nexport type RowDrag =\n | boolean\n | {\n (params: ColumnDataSchemaModel): boolean;\n };\n/**\n * `ColumnGrouping` type is used to define a grouping in a column.\n */\nexport type ColumnGrouping<T = any> = {\n /**\n * An array of objects that represent the children of the grouping.\n */\n children: (ColumnGrouping<T> | ColumnRegular)[];\n /**\n * A `DataFormat` object that represents the name of the grouping.\n */\n name: DataFormat<T>;\n};\n/**\n * Configuration for header inner template properties\n */\nexport interface ColumnProperties {\n /**\n * Header inner template\n * Function/component to render custom header content\n */\n columnTemplate?: ColumnTemplateFunc;\n /**\n * Header Cell properties\n * Custom function/component to render header properties\n */\n columnProperties?: ColPropertiesFunc;\n}\n/**\n * Type that represents a collection of column types.\n * The keys are the names of the column types and the values are the corresponding column type objects.\n */\nexport type ColumnTypes = {\n /**\n * The name of the column type.\n */\n [name: string]: ColumnType;\n};\n\n/**\n * Interface for custom cell renderer.\n */\nexport interface CellTemplate {\n // TODO: Add Promise support for template and all custom function so user will be able to use async render on the light speed\n (\n createElement: HyperFunc<VNode>,\n props: CellTemplateProp,\n additionalData?: any,\n ): any;\n}\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnType extends ColumnProperties {\n /**\n * Represents whether the column or cell is read-only.\n * Can be a boolean or a function that returns a boolean.\n * The function receives column data as a parameter.\n */\n readonly?: ReadOnlyFormat;\n /**\n * Represents the default column size.\n */\n size?: number;\n /**\n * Represents the minimal column size.\n * This property cannot be less than cell padding\n * in order to keep performance on top and minimize DOM elements number.\n */\n minSize?: number;\n /**\n * Represents the maximum column size.\n */\n maxSize?: number;\n /**\n * Represents a custom editor defined in @editors property.\n * Can be a string or an editor constructor function.\n */\n editor?: string | EditorCtr;\n /**\n * Represents cell properties for custom styling, classes, and events.\n */\n cellProperties?: PropertiesFunc;\n /**\n * Represents the cell template for custom rendering.\n */\n cellTemplate?: CellTemplate;\n /**\n * Represents the cell compare function for custom sorting.\n */\n cellCompare?: CellCompareFunc;\n}\nexport type Order = 'asc' | 'desc' | undefined;\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n *\n */\n/**\n * ColumnRegular interface represents regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnRegular extends ColumnType {\n /**\n * Column prop used for mapping value to cell from data source model/row, used for indexing.\n */\n prop: ColumnProp;\n /**\n * Column pin 'colPinStart'|'colPinEnd'.\n */\n pin?: DimensionColPin;\n /**\n * Column header text.\n */\n name?: any;\n /**\n * Column size would be changed based on space left.\n */\n autoSize?: boolean;\n /**\n * Filter. Require filter plugin to be installed and activated through grid config @filter.\n */\n filter?: boolean | string | string[];\n /**\n * Is column can be sorted, check @cellCompare function for custom sorting.\n */\n sortable?: boolean;\n /**\n * Sort order.\n */\n order?: Order;\n /**\n * Is cell in column or individual can be dragged.\n */\n rowDrag?: RowDrag;\n /**\n * Represents type defined in @columnTypes property through grid config.\n */\n columnType?: string;\n /**\n * Function called before column applied to the store.\n */\n beforeSetup?(rgCol: ColumnRegular): void;\n /**\n * Additional properties can be added to the column definition.\n */\n [key: string]: any;\n}\n\nexport type ColumnData = (ColumnGrouping | ColumnRegular)[];\n/**\n * Column template property.\n * Contains extended properties for column.\n */\nexport interface ColumnTemplateProp extends ColumnRegular {\n /**\n * Providers injected into the template.\n */\n providers: Providers<DimensionCols | 'rowHeaders'>;\n /**\n * Index of the column, used for mapping value to cell from data source model/row.\n */\n index: number;\n}\n\nexport type ColumnPropProp = ColumnGrouping | ColumnTemplateProp;\n// Column prop used for mapping value to cell from data source model/row, used for indexing.\nexport type ColumnProp = string | number;\n\nexport type DataFormat<T = any> = T;\n\nexport type CellProp = string | number | object | boolean | undefined;\n\n/**\n * Additional properties applied to the cell.\n * Contains style object where key is CSS property and value is CSS property value.\n * Contains class object where key is CSS class and value is boolean flag indicating if class should be applied.\n * Contains additional properties for custom cell rendering.\n */\nexport type CellProps = {\n // CSS styles applied to the cell\n style?: {\n [key: string]: string | undefined;\n };\n // CSS classes applied to the cell\n class?:\n | {\n // CSS class name\n [key: string]: boolean;\n }\n | string;\n // Additional properties for custom cell rendering\n [attr: string]: CellProp;\n};\n\n/**\n * Providers for grid which are going to be injected into each cell template\n */\nexport type Providers<T = DimensionRows> = {\n /**\n * Dimension type (e.g. row or column)\n */\n type: T;\n /**\n * Flag indicating if grid is in readonly mode\n */\n readonly: boolean;\n /**\n * Data source store\n */\n data: Observable<DataSourceState<any, any>> | ColumnRegular[];\n /**\n * Viewport store\n */\n viewport: Observable<ViewportState>;\n /**\n * Dimension store\n */\n dimension: Observable<DimensionSettingsState>;\n /**\n * Selection store\n */\n selection: Observable<SelectionStoreState>;\n};\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n // (tag: any): T;\n (tag: any): T;\n}\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, data: any): T;\n}\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: T): T;\n}\n/**\n * `FocusTemplateFunc` is a function that takes an HTML tag or component, and\n * returns a JSX element. This function is used to create JSX elements in a\n * context where JSX is not valid.\n */\nexport type FocusTemplateFunc = (\n createElement: HyperFunc<VNode>,\n detail: FocusRenderEvent,\n) => any;\n\n/**\n * `CellCompareFunc` is a function that takes the column property to compare,\n * the data of the first cell, and the data of the second cell. It returns a\n * number indicating the relative order of the two cells.\n */\nexport type CellCompareFunc = (\n // The column property to compare.\n prop: ColumnProp,\n // The data of the first cell.\n a: DataType,\n // The data of the second cell.\n b: DataType,\n) => number;\nexport type ColumnTemplateFunc = (\n createElement: HyperFunc<VNode>,\n props: ColumnTemplateProp,\n additionalData?: any,\n) => any;\nexport type PropertiesFunc = (\n props: ColumnDataSchemaModel,\n) => CellProps | void | undefined;\nexport type ColPropertiesFunc = (\n props: ColumnPropProp,\n) => CellProps | void | undefined;\nexport type DataType<D = any> = {\n [T in ColumnProp]: DataFormat<D>;\n};\n\nexport type DataLookup<T = any> = {\n [rowIndex: number]: DataType<T>;\n};\n/**\n * `RowDefinition` is a type that represents a row definition in the\n * viewport.\n */\nexport type RowDefinition = {\n /**\n * The type of the row.\n */\n type: DimensionRows;\n /**\n * The size of the row.\n */\n size: number;\n /**\n * The index of the row.\n */\n index: number;\n};\nexport interface RowHeaders extends ColumnRegular {}\n/**\n * `ViewPortResizeEvent` is an object that contains information about a resize\n * event in the viewport.\n */\nexport type ViewPortResizeEvent = {\n /* The dimension of the viewport being resized. */\n dimension: DimensionType;\n /* The new size of the viewport. */\n size: number;\n /* Indicates whether the resize event is for a row header. */\n rowHeader?: boolean;\n};\n\n/**\n * `ViewPortScrollEvent` is an object that contains information about a scroll\n * event in the viewport.\n */\nexport type ViewPortScrollEvent = {\n /**\n * The dimension of the viewport being scrolled.\n */\n dimension: DimensionType;\n /**\n * The coordinate of the scroll event.\n */\n coordinate: number;\n /**\n * The change in coordinate between scroll events.\n */\n delta?: number;\n /**\n * Indicates whether the scroll event occurred outside the viewport.\n */\n outside?: boolean;\n};\n\n/**\n * `InitialHeaderClick` represents the information needed to handle a click\n * event on the initial column header.\n */\nexport type InitialHeaderClick = {\n /**\n * The index of the column header that was clicked.\n */\n index: number;\n /**\n * The original mouse event that triggered the click.\n */\n originalEvent: MouseEvent;\n /**\n * The column that was clicked.\n */\n column: ColumnRegular;\n providers: Providers<DimensionCols | 'rowHeaders'>;\n};\n\n/**\n * `Range` is an object that represents a range of values.\n */\nexport type Range = {\n /**\n * The start of the range.\n */\n start: number;\n /**\n * The end of the range.\n */\n end: number;\n};\n\n/**\n * `ViewportStateItems` is an object that represents the items in a viewport\n * along with their corresponding range.\n */\nexport type ViewportStateItems = {\n /**\n * The items in the viewport.\n */\n items: VirtualPositionItem[];\n} & Range;\n\n/**\n * `ViewportState` is an object that represents the state of a viewport.\n */\nexport interface ViewportState extends ViewportStateItems {\n /**\n * The number of real items in the viewport.\n */\n realCount: number;\n /**\n * The virtual size of the viewport.\n */\n virtualSize: number;\n}\n\n/**\n * `ViewSettingSizeProp` is a record that maps column or row indexes to their\n * corresponding sizes.\n */\nexport type ViewSettingSizeProp = Record<string, number>;\n\n/**\n * `VirtualPositionItem` is an object that represents a virtual position item\n * in the viewport.\n */\nexport interface VirtualPositionItem extends PositionItem {\n /**\n * The size of the virtual position item.\n */\n size: number;\n}\nexport type DataSourceState<\n T extends DataType | ColumnRegular,\n ST extends DimensionRows | DimensionCols,\n> = {\n // items - index based array for mapping to source tree\n items: number[];\n // all items, used as proxy for sorting, trimming and others manipulations\n proxyItems: number[];\n // original data source\n source: T[];\n // grouping\n groupingDepth: number;\n groups: Record<any, any>;\n // data source type\n type: ST;\n // trim data, to hide entities from visible data source\n trimmed: Record<any, any>;\n};\nexport interface PositionItem {\n itemIndex: number;\n start: number;\n end: number;\n}\n/**\n * Object containing information about calculated dimensions.\n * Used for both columns and rows.\n */\nexport interface DimensionCalc {\n /**\n * Array of indexes of visible items.\n */\n indexes: number[];\n\n /**\n * Count of visible items.\n */\n count: number;\n\n /**\n * Array of indexes of visible items.\n * Used for mapping items to their position in DOM.\n */\n positionIndexes: number[];\n\n /**\n * Mapping of position to item.\n * Used for mapping position in DOM to item.\n */\n positionIndexToItem: {\n /**\n * Position in DOM.\n */\n [position: number]: PositionItem;\n };\n\n /**\n * Mapping of index to item.\n * Used for mapping index in data source to item.\n */\n indexToItem: {\n /**\n * Index in data source.\n */\n [index: number]: PositionItem;\n };\n\n /**\n * Object containing information about trimmed data.\n * Used for hiding entities from visible data source.\n */\n trimmed: Record<any, any>;\n\n /**\n * Object containing size for each visible item.\n */\n sizes: ViewSettingSizeProp;\n}\n/**\n * Represents the settings state of a dimension.\n * It extends the calculation properties of a dimension.\n * It also includes the real size and origin item size of the dimension.\n */\nexport interface DimensionSettingsState extends DimensionCalc {\n /**\n * Represents the real size of the dimension.\n */\n realSize: number;\n\n /**\n * Represents the origin item size of the dimension.\n */\n originItemSize: number;\n}\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores.\n */\nexport type DimensionStores = {\n [T in MultiDimensionType]: Observable<DimensionSettingsState>;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores for the viewport.\n */\nexport type ViewportStores = {\n [T in MultiDimensionType]: Observable<ViewportState>;\n};\n\n/**\n * Represents the event object that is emitted when the drag operation starts.\n */\nexport interface DragStartEvent {\n /**\n * Represents the original mouse event that triggered the drag operation.\n */\n originalEvent: MouseEvent;\n\n /**\n * Represents the model of the column being dragged.\n */\n model: ColumnDataSchemaModel;\n}\n\n/**\n * Represents the event object that is emitted before cell rendering.\n * It includes information about the dimension type, column, row, and model.\n */\nexport interface BeforeCellRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the column being rendered.\n */\n column: VirtualPositionItem;\n\n /**\n * Represents the row being rendered.\n */\n row: VirtualPositionItem;\n\n /**\n * Represents the model being rendered.\n */\n model: T;\n}\n\n/**\n * Represents the event object that is emitted before row rendering.\n * It includes information about the dimension type, data item, item, and node.\n */\nexport interface BeforeRowRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the data item being rendered.\n */\n model: T;\n\n /**\n * Represents the item being rendered.\n */\n item: VirtualPositionItem;\n\n /**\n * Represents the node being rendered.\n */\n node: VNode;\n}\n\n/**\n * Represents the event object that is emitted after rendering.\n * It includes information about the dimension type.\n */\nexport type AfterRendererEvent = {\n /**\n * Represents the type of dimension being rendered.\n */\n type: DimensionType;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding dimension types.\n */\nexport interface AllDimensionType {\n /**\n * Represents the dimension type for rows.\n */\n rowType: DimensionRows;\n\n /**\n * Represents the dimension type for columns.\n */\n colType: DimensionCols;\n}\n\n/**\n * Represents the event object that is emitted when applying focus.\n * It includes information about the dimension type and focused cells.\n */\nexport interface ApplyFocusEvent extends AllDimensionType, FocusedCells {}\n\n/**\n * Represents the event object that is emitted before focus rendering.\n * It includes information about the dimension type and range area.\n */\nexport interface FocusRenderEvent extends AllDimensionType {\n /**\n * Represents the range area of the focus.\n */\n range: RangeArea;\n\n /**\n * Changes for the next cell to focus. @example { y: -1 }\n */\n next?: Partial<Cell>;\n}\n\nexport interface FocusAfterRenderEvent extends AllDimensionType {\n model?: any;\n column?: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n}\n/**\n * Represents the event object that is emitted when scrolling occurs.\n * The `type` property indicates the type of dimension (row or column) being scrolled.\n * The `coordinate` property represents the current scroll position in that dimension.\n */\nexport type ScrollCoordinateEvent = {\n /**\n * Represents the type of dimension being scrolled.\n * Possible values are 'rgRow' and 'rgCol'.\n */\n type: DimensionType;\n\n /**\n * Represents the current scroll position in the specified dimension.\n * The value is a number representing the coordinate in pixels.\n */\n coordinate: number;\n};\n\n/** Range paste. */\nexport type RangeClipboardPasteEvent = {\n data: DataLookup;\n models: Partial<DataLookup>;\n range: RangeArea | null;\n} & AllDimensionType;\n\n/** Range copy. */\nexport type RangeClipboardCopyEventProps<T = any> = {\n data: DataFormat<T>[][];\n range: RangeArea;\n mapping: OldNewRangeMapping;\n} & AllDimensionType;\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/types/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import type { VNode } from '@stencil/core';\n\nimport {\n DimensionCols,\n DimensionRows,\n DimensionColPin,\n DimensionType,\n MultiDimensionType,\n} from './dimension';\nimport {\n Cell,\n EditorCtr,\n FocusedCells,\n OldNewRangeMapping,\n RangeArea,\n SelectionStoreState,\n} from './selection';\nimport type { Observable } from '../utils/store.utils';\nimport { JSXBase } from '@stencil/core/internal';\n\nexport type Nullable<T> = {\n [P in keyof T]: T[P] | null;\n};\n\n/**\n * Advanced column data schema model.\n * Used for transpassing data to cell renderer and editor.\n */\nexport type ColumnDataSchemaModel = {\n /**\n * Column prop used for mapping value to cell from data source model/row\n */\n prop: ColumnProp;\n /**\n * Row data object\n */\n model: DataType;\n /**\n * Column data object\n */\n column: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n /**\n * Column type based on viewport\n */\n colType: DimensionCols;\n /**\n * Row type based on viewport\n */\n type: DimensionRows;\n /**\n * Row models based on viewport\n */\n data: DataType[];\n /**\n * Current cell data\n */\n value: any;\n};\n/**\n * Template property for each cell, extends the column data schema model.\n * Additionally, it provides access to the providers injected into the template.\n */\nexport interface CellTemplateProp extends ColumnDataSchemaModel {\n /**\n * Providers injected into the template\n */\n providers: Providers;\n}\n/**\n * The ReadOnlyFormat type is a boolean value or a function that takes ColumnDataSchemaModel\n * as a parameter and returns a boolean value.\n *\n * If it is a boolean value, it represents whether the cell in question is read-only.\n * If it is a function, it returns whether the cell in question is read-only based on the provided\n * ColumnDataSchemaModel.\n */\nexport type ReadOnlyFormat =\n | boolean\n | ((params: ColumnDataSchemaModel) => boolean);\nexport type RowDrag =\n | boolean\n | {\n (params: ColumnDataSchemaModel): boolean;\n };\n/**\n * `ColumnGrouping` type is used to define a grouping in a column.\n */\nexport type ColumnGrouping<T = any> = {\n /**\n * An array of objects that represent the children of the grouping.\n */\n children: (ColumnGrouping<T> | ColumnRegular)[];\n /**\n * A `DataFormat` object that represents the name of the grouping.\n */\n name: DataFormat<T>;\n};\n/**\n * Configuration for header inner template properties\n */\nexport interface ColumnProperties {\n /**\n * Header inner template\n * Function/component to render custom header content\n */\n columnTemplate?: ColumnTemplateFunc;\n /**\n * Header Cell properties\n * Custom function/component to render header properties\n */\n columnProperties?: ColPropertiesFunc;\n}\n/**\n * Type that represents a collection of column types.\n * The keys are the names of the column types and the values are the corresponding column type objects.\n */\nexport type ColumnTypes = {\n /**\n * The name of the column type.\n */\n [name: string]: ColumnType;\n};\n\n/**\n * Interface for custom cell renderer.\n */\nexport interface CellTemplate {\n // TODO: Add Promise support for template and all custom function so user will be able to use async render on the light speed\n (\n createElement: HyperFunc<VNode>,\n props: CellTemplateProp,\n additionalData?: any,\n ): any;\n}\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnType extends ColumnProperties {\n /**\n * Represents whether the column or cell is read-only.\n * Can be a boolean or a function that returns a boolean.\n * The function receives column data as a parameter.\n */\n readonly?: ReadOnlyFormat;\n /**\n * Represents the default column size.\n */\n size?: number;\n /**\n * Represents the minimal column size.\n * This property cannot be less than cell padding\n * in order to keep performance on top and minimize DOM elements number.\n */\n minSize?: number;\n /**\n * Represents the maximum column size.\n */\n maxSize?: number;\n /**\n * Represents a custom editor defined in @editors property.\n * Can be a string or an editor constructor function.\n */\n editor?: string | EditorCtr;\n /**\n * Represents cell properties for custom styling, classes, and events.\n */\n cellProperties?: PropertiesFunc;\n /**\n * Represents the cell template for custom rendering.\n */\n cellTemplate?: CellTemplate;\n /**\n * Represents the cell compare function for custom sorting.\n */\n cellCompare?: CellCompareFunc;\n\n /**\n * Represents the cell value parse function for custom parsing.\n * Currently only used for filtering.\n */\n cellParser?: (model: DataType, column: ColumnRegular) => any;\n}\nexport type Order = 'asc' | 'desc' | undefined;\n/**\n * Interface for regular column definition.\n * Regular column can be any column that is not a grouping column.\n *\n */\n/**\n * ColumnRegular interface represents regular column definition.\n * Regular column can be any column that is not a grouping column.\n */\nexport interface ColumnRegular extends ColumnType {\n /**\n * Column prop used for mapping value to cell from data source model/row, used for indexing.\n */\n prop: ColumnProp;\n /**\n * Column pin 'colPinStart'|'colPinEnd'.\n */\n pin?: DimensionColPin;\n /**\n * Column header text.\n */\n name?: any;\n /**\n * Column size would be changed based on space left.\n */\n autoSize?: boolean;\n /**\n * Filter. Require filter plugin to be installed and activated through grid config @filter.\n */\n filter?: boolean | string | string[];\n /**\n * Is column can be sorted, check @cellCompare function for custom sorting.\n */\n sortable?: boolean;\n /**\n * Sort order.\n */\n order?: Order;\n /**\n * Is cell in column or individual can be dragged.\n */\n rowDrag?: RowDrag;\n /**\n * Represents type defined in @columnTypes property through grid config.\n */\n columnType?: string;\n /**\n * Function called before column applied to the store.\n */\n beforeSetup?(rgCol: ColumnRegular): void;\n /**\n * Additional properties can be added to the column definition.\n */\n [key: string]: any;\n}\n\nexport type ColumnData = (ColumnGrouping | ColumnRegular)[];\n/**\n * Column template property.\n * Contains extended properties for column.\n */\nexport interface ColumnTemplateProp extends ColumnRegular {\n /**\n * Providers injected into the template.\n */\n providers: Providers<DimensionCols | 'rowHeaders'>;\n /**\n * Index of the column, used for mapping value to cell from data source model/row.\n */\n index: number;\n}\n\nexport type ColumnPropProp = ColumnGrouping | ColumnTemplateProp;\n// Column prop used for mapping value to cell from data source model/row, used for indexing.\nexport type ColumnProp = string | number;\n\nexport type DataFormat<T = any> = T;\n\n/**\n * Additional properties applied to the cell.\n * Contains HTMLAttributes<HTMLDivElement> properties for custom cell rendering.\n */\nexport type CellProps = JSXBase.HTMLAttributes<HTMLDivElement> & {\n className?: JSXBase.HTMLAttributes<HTMLDivElement>['class'];\n // Additional properties for custom cell rendering\n [attr: string]: string | number | object | boolean | undefined;\n};\n\n\n/**\n * Providers for grid which are going to be injected into each cell template\n */\nexport type Providers<T = DimensionRows> = {\n /**\n * Dimension type (e.g. row or column)\n */\n type: T;\n /**\n * Flag indicating if grid is in readonly mode\n */\n readonly: boolean;\n /**\n * Data source store\n */\n data: Observable<DataSourceState<any, any>> | ColumnRegular[];\n /**\n * Viewport store\n */\n viewport: Observable<ViewportState>;\n /**\n * Dimension store\n */\n dimension: Observable<DimensionSettingsState>;\n /**\n * Selection store\n */\n selection: Observable<SelectionStoreState>;\n};\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n // (tag: any): T;\n (tag: any): T;\n}\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, data: any): T;\n}\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (tag: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, text: string): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: Array<T | undefined | null>): T;\n}\n\n/**\n * `HyperFunc` is a function that takes an HTML tag or component, and returns a\n * JSX element. This function is used to create JSX elements in a context where\n * JSX is not valid.\n */\nexport interface HyperFunc<T> {\n (sel: any, data: any, children: T): T;\n}\n/**\n * `FocusTemplateFunc` is a function that takes an HTML tag or component, and\n * returns a JSX element. This function is used to create JSX elements in a\n * context where JSX is not valid.\n */\nexport type FocusTemplateFunc = (\n createElement: HyperFunc<VNode>,\n detail: FocusRenderEvent,\n) => any;\n\n/**\n * `CellCompareFunc` is a function that takes the column property to compare,\n * the data of the first cell, and the data of the second cell. It returns a\n * number indicating the relative order of the two cells.\n */\nexport type CellCompareFunc = (\n // The column property to compare.\n prop: ColumnProp,\n // The data of the first cell.\n a: DataType,\n // The data of the second cell.\n b: DataType,\n) => number;\nexport type ColumnTemplateFunc = (\n createElement: HyperFunc<VNode>,\n props: ColumnTemplateProp,\n additionalData?: any,\n) => any;\nexport type PropertiesFunc = (\n props: ColumnDataSchemaModel,\n) => CellProps | void | undefined;\nexport type ColPropertiesFunc = (\n props: ColumnPropProp,\n) => CellProps | void | undefined;\nexport type DataType<D = any> = {\n [T in ColumnProp]: DataFormat<D>;\n};\n\nexport type DataLookup<T = any> = {\n [rowIndex: number]: DataType<T>;\n};\n/**\n * `RowDefinition` is a type that represents a row definition in the\n * viewport.\n */\nexport type RowDefinition = {\n /**\n * The type of the row.\n */\n type: DimensionRows;\n /**\n * The size of the row.\n */\n size: number;\n /**\n * The index of the row.\n */\n index: number;\n};\nexport interface RowHeaders extends ColumnRegular {}\n/**\n * `ViewPortResizeEvent` is an object that contains information about a resize\n * event in the viewport.\n */\nexport type ViewPortResizeEvent = {\n /* The dimension of the viewport being resized. */\n dimension: DimensionType;\n /* The new size of the viewport. */\n size: number;\n /* Indicates whether the resize event is for a row header. */\n rowHeader?: boolean;\n};\n\n/**\n * `ViewPortScrollEvent` is an object that contains information about a scroll\n * event in the viewport.\n */\nexport type ViewPortScrollEvent = {\n /**\n * The dimension of the viewport being scrolled.\n */\n dimension: DimensionType;\n /**\n * The coordinate of the scroll event.\n */\n coordinate: number;\n /**\n * The change in coordinate between scroll events.\n */\n delta?: number;\n /**\n * Indicates whether the scroll event occurred outside the viewport.\n */\n outside?: boolean;\n};\n\n/**\n * `InitialHeaderClick` represents the information needed to handle a click\n * event on the initial column header.\n */\nexport type InitialHeaderClick = {\n /**\n * The index of the column header that was clicked.\n */\n index: number;\n /**\n * The original mouse event that triggered the click.\n */\n originalEvent: MouseEvent;\n /**\n * The column that was clicked.\n */\n column: ColumnRegular;\n providers: Providers<DimensionCols | 'rowHeaders'>;\n};\n\n/**\n * `Range` is an object that represents a range of values.\n */\nexport type Range = {\n /**\n * The start of the range.\n */\n start: number;\n /**\n * The end of the range.\n */\n end: number;\n};\n\n/**\n * `ViewportStateItems` is an object that represents the items in a viewport\n * along with their corresponding range.\n */\nexport type ViewportStateItems = {\n /**\n * The items in the viewport.\n */\n items: VirtualPositionItem[];\n} & Range;\n\n/**\n * `ViewportState` is an object that represents the state of a viewport.\n */\nexport interface ViewportState extends ViewportStateItems {\n /**\n * The number of real items in the viewport.\n */\n realCount: number;\n /**\n * The virtual size of the viewport.\n */\n virtualSize: number;\n}\n\n/**\n * `ViewSettingSizeProp` is a record that maps column or row indexes to their\n * corresponding sizes.\n */\nexport type ViewSettingSizeProp = Record<string, number>;\n\n/**\n * `VirtualPositionItem` is an object that represents a virtual position item\n * in the viewport.\n */\nexport interface VirtualPositionItem extends PositionItem {\n /**\n * The size of the virtual position item.\n */\n size: number;\n}\nexport type DataSourceState<\n T extends DataType | ColumnRegular,\n ST extends DimensionRows | DimensionCols,\n> = {\n // items - index based array for mapping to source tree\n items: number[];\n // all items, used as proxy for sorting, trimming and others manipulations\n proxyItems: number[];\n // original data source\n source: T[];\n // grouping\n groupingDepth: number;\n groups: Record<any, any>;\n // data source type\n type: ST;\n // trim data, to hide entities from visible data source\n trimmed: Record<any, any>;\n};\nexport interface PositionItem {\n itemIndex: number;\n start: number;\n end: number;\n}\n/**\n * Object containing information about calculated dimensions.\n * Used for both columns and rows.\n */\nexport interface DimensionCalc {\n /**\n * Array of indexes of visible items.\n */\n indexes: number[];\n\n /**\n * Count of visible items.\n */\n count: number;\n\n /**\n * Array of indexes of visible items.\n * Used for mapping items to their position in DOM.\n */\n positionIndexes: number[];\n\n /**\n * Mapping of position to item.\n * Used for mapping position in DOM to item.\n */\n positionIndexToItem: {\n /**\n * Position in DOM.\n */\n [position: number]: PositionItem;\n };\n\n /**\n * Mapping of index to item.\n * Used for mapping index in data source to item.\n */\n indexToItem: {\n /**\n * Index in data source.\n */\n [index: number]: PositionItem;\n };\n\n /**\n * Object containing information about trimmed data.\n * Used for hiding entities from visible data source.\n */\n trimmed: Record<any, any>;\n\n /**\n * Object containing size for each visible item.\n */\n sizes: ViewSettingSizeProp;\n}\n/**\n * Represents the settings state of a dimension.\n * It extends the calculation properties of a dimension.\n * It also includes the real size and origin item size of the dimension.\n */\nexport interface DimensionSettingsState extends DimensionCalc {\n /**\n * Represents the real size of the dimension.\n */\n realSize: number;\n\n /**\n * Represents the origin item size of the dimension.\n */\n originItemSize: number;\n}\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores.\n */\nexport type DimensionStores = {\n [T in MultiDimensionType]: Observable<DimensionSettingsState>;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding observable stores for the viewport.\n */\nexport type ViewportStores = {\n [T in MultiDimensionType]: Observable<ViewportState>;\n};\n\n/**\n * Represents the event object that is emitted when the drag operation starts.\n */\nexport interface DragStartEvent {\n /**\n * Represents the original mouse event that triggered the drag operation.\n */\n originalEvent: MouseEvent;\n\n /**\n * Represents the model of the column being dragged.\n */\n model: ColumnDataSchemaModel;\n}\n\n/**\n * Represents the event object that is emitted before cell rendering.\n * It includes information about the dimension type, column, row, and model.\n */\nexport interface BeforeCellRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the column being rendered.\n */\n column: VirtualPositionItem;\n\n /**\n * Represents the row being rendered.\n */\n row: VirtualPositionItem;\n\n /**\n * Represents the model being rendered.\n */\n model: T;\n}\n\n/**\n * Represents the event object that is emitted before row rendering.\n * It includes information about the dimension type, data item, item, and node.\n */\nexport interface BeforeRowRenderEvent<T = any> extends AllDimensionType {\n /**\n * Represents the data item being rendered.\n */\n model: T;\n\n /**\n * Represents the item being rendered.\n */\n item: VirtualPositionItem;\n\n /**\n * Represents the node being rendered.\n */\n node: VNode;\n}\n\n/**\n * Represents the event object that is emitted after rendering.\n * It includes information about the dimension type.\n */\nexport type AfterRendererEvent = {\n /**\n * Represents the type of dimension being rendered.\n */\n type: DimensionType;\n};\n\n/**\n * Represents the mapping of dimension types to their corresponding dimension types.\n */\nexport interface AllDimensionType {\n /**\n * Represents the dimension type for rows.\n */\n rowType: DimensionRows;\n\n /**\n * Represents the dimension type for columns.\n */\n colType: DimensionCols;\n}\n\n/**\n * Represents the event object that is emitted when applying focus.\n * It includes information about the dimension type and focused cells.\n */\nexport interface ApplyFocusEvent extends AllDimensionType, FocusedCells {}\n\n/**\n * Represents the event object that is emitted before focus rendering.\n * It includes information about the dimension type and range area.\n */\nexport interface FocusRenderEvent extends AllDimensionType {\n /**\n * Represents the range area of the focus.\n */\n range: RangeArea;\n\n /**\n * Changes for the next cell to focus. @example { y: -1 }\n */\n next?: Partial<Cell>;\n}\n\nexport interface FocusAfterRenderEvent extends AllDimensionType {\n model?: any;\n column?: ColumnRegular;\n /**\n * Index of the row in the viewport\n */\n rowIndex: number;\n /**\n * Index of the column in the viewport\n */\n colIndex: number;\n}\n/**\n * Represents the event object that is emitted when scrolling occurs.\n * The `type` property indicates the type of dimension (row or column) being scrolled.\n * The `coordinate` property represents the current scroll position in that dimension.\n */\nexport type ScrollCoordinateEvent = {\n /**\n * Represents the type of dimension being scrolled.\n * Possible values are 'rgRow' and 'rgCol'.\n */\n type: DimensionType;\n\n /**\n * Represents the current scroll position in the specified dimension.\n * The value is a number representing the coordinate in pixels.\n */\n coordinate: number;\n};\n\n/** Range paste. */\nexport type RangeClipboardPasteEvent = {\n data: DataLookup;\n models: Partial<DataLookup>;\n range: RangeArea | null;\n} & AllDimensionType;\n\n/** Range copy. */\nexport type RangeClipboardCopyEventProps<T = any> = {\n data: DataFormat<T>[][];\n range: RangeArea;\n mapping: OldNewRangeMapping;\n} & AllDimensionType;\n"]}
|
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import isArray from "lodash/isArray";
|
|
5
5
|
import reduce from "lodash/reduce";
|
|
6
|
+
export function getCellData(val) {
|
|
7
|
+
if (typeof val === 'undefined' || val === null) {
|
|
8
|
+
return '';
|
|
9
|
+
}
|
|
10
|
+
return val;
|
|
11
|
+
}
|
|
12
|
+
export function getCellDataParsed(model, column) {
|
|
13
|
+
const val = column.cellParser ? column.cellParser(model, column) : model[column.prop];
|
|
14
|
+
return getCellData(val);
|
|
15
|
+
}
|
|
6
16
|
export function getColumnType(rgCol) {
|
|
7
17
|
if (rgCol.pin) {
|
|
8
18
|
return rgCol.pin;
|