slick-table 1.1.48 → 1.1.50

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.
Files changed (28) hide show
  1. package/dist/index.cjs.js +71 -71
  2. package/dist/index.es.js +644 -599
  3. package/dist/styles/slick-table.scss +21 -0
  4. package/dist/types/index.d.ts +1 -1
  5. package/dist/types/index.d.ts.map +1 -1
  6. package/dist/types/shared/lib/slickgrid/index.d.ts +1 -1
  7. package/dist/types/shared/lib/slickgrid/index.d.ts.map +1 -1
  8. package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/Autocomplete.d.ts +2 -1
  9. package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/Autocomplete.d.ts.map +1 -1
  10. package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/EditorAutocomplete.d.ts.map +1 -1
  11. package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/index.d.ts +0 -1
  12. package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/index.d.ts.map +1 -1
  13. package/dist/types/shared/lib/slickgrid/lib/editors/index.d.ts +1 -1
  14. package/dist/types/shared/lib/slickgrid/lib/editors/index.d.ts.map +1 -1
  15. package/dist/types/shared/lib/slickgrid/lib/index.d.ts +1 -1
  16. package/dist/types/shared/lib/slickgrid/lib/index.d.ts.map +1 -1
  17. package/package.json +3 -1
  18. package/src/app/styles/slick-table.scss +5 -3
  19. package/src/index.ts +1 -0
  20. package/src/shared/lib/slickgrid/index.ts +0 -1
  21. package/src/shared/lib/slickgrid/lib/editors/Autocomplete/Autocomplete.ts +32 -12
  22. package/src/shared/lib/slickgrid/lib/editors/Autocomplete/EditorAutocomplete.ts +3 -18
  23. package/src/shared/lib/slickgrid/lib/editors/Autocomplete/index.ts +0 -1
  24. package/src/shared/lib/slickgrid/lib/editors/index.ts +1 -5
  25. package/src/shared/lib/slickgrid/lib/index.ts +0 -1
  26. package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/EditorSelectWithSearch.d.ts +0 -15
  27. package/dist/types/shared/lib/slickgrid/lib/editors/Autocomplete/EditorSelectWithSearch.d.ts.map +0 -1
  28. package/src/shared/lib/slickgrid/lib/editors/Autocomplete/EditorSelectWithSearch.ts +0 -79
@@ -0,0 +1,21 @@
1
+ #slick-table-autocomplete {
2
+ background-color: white;
3
+ box-shadow: gray 0 0 5px 1px;
4
+ color: #1E456F;
5
+ font-size: 0.75rem;
6
+ max-height: 20em;
7
+ overflow-y: auto;
8
+ position: absolute;
9
+ z-index: 1;
10
+
11
+ strong {
12
+ color: rgb(0, 123, 255)
13
+ }
14
+
15
+ div.active,
16
+ div:hover {
17
+ cursor: pointer;
18
+ background-color: #e8f4fe;
19
+ }
20
+ }
21
+
@@ -3,7 +3,7 @@ export { PopupSummary } from './entities/popup-summary';
3
3
  export { ColumnFilters } from './features/column-filters';
4
4
  export { ContextMenu } from './features/context-menu';
5
5
  export { HeaderContextMenu } from './features/header-context-menu';
6
- export { Autocomplete, ColumnPicker, ColumnSorter, DecoratorColumnFilter, DecoratorFilter, DefaultHotKeys, DefaultPrinter, DeletedRowsFilter, FORMATTER_NUMBER, Filter, HotKeysDecorator, PreventCopying, RedoUndoOnly, SlickTable, SlickgridTable, TotalCalculator, WithSummary, WithoutHotKeys, columnIsEdited, columnCheckboxSelector, commitCurrentEdit, copySelectedRows, formatterGroupTotals, formatterCheckMark, getDisplayedRows, getFormatterNumber, getNextId, handleHeaderButtons, headerButtons, highlightCell, highlightColumns, hotKeysCopy, hotKeysDelete, hotKeysRedo, hotKeysUndo, openColumnFilter, openContextMenu, printerCheckMark, useListenIfTablesWereEdited, } from './shared/lib/slickgrid';
6
+ export { Autocomplete, ColumnPicker, ColumnSorter, DecoratorColumnFilter, DecoratorFilter, DefaultHotKeys, DefaultPrinter, DeletedRowsFilter, EditorAutocomplete, FORMATTER_NUMBER, Filter, HotKeysDecorator, PreventCopying, RedoUndoOnly, SlickTable, SlickgridTable, TotalCalculator, WithSummary, WithoutHotKeys, columnIsEdited, columnCheckboxSelector, commitCurrentEdit, copySelectedRows, formatterGroupTotals, formatterCheckMark, getDisplayedRows, getFormatterNumber, getNextId, handleHeaderButtons, headerButtons, highlightCell, highlightColumns, hotKeysCopy, hotKeysDelete, hotKeysRedo, hotKeysUndo, openColumnFilter, openContextMenu, printerCheckMark, useListenIfTablesWereEdited, } from './shared/lib/slickgrid';
7
7
  export { formatNumber } from './shared/lib/format';
8
8
  export type { IColumn, IFilter, IFilterArguments, IFormatterNumberOptions, IHotKeysBehavior, IPrinter, ISlickTable, ITotalCalculator, } from './shared/model/types';
9
9
  export { BOLD, WINK } from './shared/model/consts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,UAAU,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EACX,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACN,aAAa,EACb,mBAAmB,EACnB,SAAS,GACT,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,UAAU,EACV,cAAc,EACd,eAAe,EACf,WAAW,EACX,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,2BAA2B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EACX,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,gBAAgB,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACN,aAAa,EACb,mBAAmB,EACnB,SAAS,GACT,MAAM,oBAAoB,CAAC"}
@@ -1,4 +1,4 @@
1
- export { Autocomplete, ColumnSorter, DateFormatter, DateValidator, EditorAmount, EditorAutocomplete, EditorDate, EditorSelectString, EditorSelectNumber, EditorSelectWithSearch, EmptyStringValidator, FORMATTER_NUMBER, LengthValidator, PercentFormatter, StringFormatter, TotalCalculator, formatterCheckMark, formatterGroupTotals, getFormatterNumber, columnSorter, commitCurrentEdit, copySelectedRows, deleteRows, getDisplayedRows, getLastRow, getNextId, getUpdates, highlightCell, highlightColumns, hotKeysCopy, hotKeysDelete, hotKeysRedo, hotKeysUndo, isDeletionDangerous, onCellChange, onRowCountChanged, onRowsChanged, openContextMenu, printerCheckMark, selectedRows, useHotKeys, useListenIfTablesWereEdited, useUpdateTotal, wereEdited, } from './lib';
1
+ export { Autocomplete, ColumnSorter, DateFormatter, DateValidator, EditorAmount, EditorAutocomplete, EditorDate, EditorSelectString, EditorSelectNumber, EmptyStringValidator, FORMATTER_NUMBER, LengthValidator, PercentFormatter, StringFormatter, TotalCalculator, formatterCheckMark, formatterGroupTotals, getFormatterNumber, columnSorter, commitCurrentEdit, copySelectedRows, deleteRows, getDisplayedRows, getLastRow, getNextId, getUpdates, highlightCell, highlightColumns, hotKeysCopy, hotKeysDelete, hotKeysRedo, hotKeysUndo, isDeletionDangerous, onCellChange, onRowCountChanged, onRowsChanged, openContextMenu, printerCheckMark, selectedRows, useHotKeys, useListenIfTablesWereEdited, useUpdateTotal, wereEdited, } from './lib';
2
2
  export { ColumnPicker, DownloadManager, DecoratorEndingDate, DecoratorFilter, DecoratorColumnFilter, DecoratorPeriod, DefaultHotKeys, DefaultPrinter, DeletedRowsFilter, Filter, HotKeysDecorator, PreventCopying, RedoUndoOnly, SlickTable, WithConfirmationOfDeletion, WithSummary, WithoutHotKeys, eventContextMenu, eventHeaderContextMenu, eventSummary, } from './model';
3
3
  export { SlickgridTable, WithTableStyles, columnCheckboxSelector, columnIsEdited, eventOpenColumnFilters, handleHeaderButtons, headerButtons, openColumnFilter, } from './ui';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/lib/slickgrid/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,2BAA2B,EAC3B,cAAc,EACd,UAAU,GACV,MAAM,OAAO,CAAC;AACf,OAAO,EACN,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,UAAU,EACV,0BAA0B,EAC1B,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GAChB,MAAM,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/shared/lib/slickgrid/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,2BAA2B,EAC3B,cAAc,EACd,UAAU,GACV,MAAM,OAAO,CAAC;AACf,OAAO,EACN,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,UAAU,EACV,0BAA0B,EAC1B,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GAChB,MAAM,MAAM,CAAC"}
@@ -11,12 +11,13 @@ export declare abstract class Autocomplete implements Editor {
11
11
  protected navOnLR?: boolean;
12
12
  applyValue(item: any, state: any): void;
13
13
  closeAllList(): void;
14
+ createList(): void;
14
15
  destroy(): void;
15
16
  focus(): void;
16
17
  init(): void;
17
18
  isValueChanged(): boolean;
18
19
  loadValue(item: ISlickRow): void;
19
- makeVisible(list: HTMLDivElement): void;
20
+ makeVisible(): void;
20
21
  abstract onClick(event: MouseEvent): void;
21
22
  abstract onInput(event: Event): void;
22
23
  onKeydown(event: KeyboardEvent): void;
@@ -1 +1 @@
1
- {"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/lib/editors/Autocomplete/Autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,EACN,eAAe,EACf,sBAAsB,EAEtB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,8BAAsB,YAAa,YAAW,MAAM;IACnD,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC9C,SAAS,CAAC,YAAY,SAAM;IAC5B,SAAS,CAAC,YAAY,SAAM;IAC5B,SAAS,CAAC,EAAE,SAA8B;IAC1C,SAAS,CAAC,KAAK,EAAE,gBAAgB,CAAmC;IAC7D,cAAc,EAAE,MAAM,EAAE,CAA6C;IAC5E,SAAS,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC;IAChC,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE5B,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAGvC,YAAY,IAAI,IAAI;IAKpB,OAAO,IAAI,IAAI;IAMf,KAAK,IAAI,IAAI;IAGb,IAAI,IAAI,IAAI;IAWZ,cAAc,IAAI,OAAO;IAMzB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAOhC,WAAW,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAsBvC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IACzC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IACpC,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IA8BrC,YAAY,CAAC,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;IAKvD,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAW5C,cAAc,IAAI,MAAM;IAGxB,SAAS,CAAC,IAAI,EAAE,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;IASvD,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAC1C,QAAQ,IAAI,sBAAsB;CAelC"}
1
+ {"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/lib/editors/Autocomplete/Autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,EACN,eAAe,EACf,sBAAsB,EAGtB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,8BAAsB,YAAa,YAAW,MAAM;IACnD,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC9C,SAAS,CAAC,YAAY,SAAM;IAC5B,SAAS,CAAC,YAAY,SAAM;IAC5B,SAAS,CAAC,EAAE,SAA8B;IAC1C,SAAS,CAAC,KAAK,EAAE,gBAAgB,CAAmC;IAC7D,cAAc,EAAE,MAAM,EAAE,CAA6C;IAC5E,SAAS,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC;IAChC,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE5B,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAGvC,YAAY,IAAI,IAAI;IAKpB,UAAU;IAaV,OAAO,IAAI,IAAI;IAMf,KAAK,IAAI,IAAI;IAGb,IAAI,IAAI,IAAI;IAkBZ,cAAc,IAAI,OAAO;IAMzB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAOhC,WAAW,IAAI,IAAI;IAqBnB,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IACzC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IACpC,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IA8BrC,YAAY,CAAC,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;IAKvD,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAW5C,cAAc,IAAI,MAAM;IAGxB,SAAS,CAAC,IAAI,EAAE,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;IASvD,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAC1C,QAAQ,IAAI,sBAAsB;CAelC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorAutocomplete.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/lib/editors/Autocomplete/EditorAutocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,EACN,eAAe,EAEf,UAAU,EAEV,MAAM,WAAW,CAAC;AAKnB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBAAa,kBAAkB,CAC9B,KAAK,GAAG,GAAG,EACX,CAAC,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,EACvC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CACtC,SAAQ,YAAY;IAGF,IAAI,EAAE,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAFrD,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;gBAEpB,IAAI,EAAE,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAuBrD,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAK3B,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAShC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAyBjC"}
1
+ {"version":3,"file":"EditorAutocomplete.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/lib/editors/Autocomplete/EditorAutocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAC;AAK/E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBAAa,kBAAkB,CAC9B,KAAK,GAAG,GAAG,EACX,CAAC,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,EACvC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CACtC,SAAQ,YAAY;IAGF,IAAI,EAAE,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAFrD,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;gBAEpB,IAAI,EAAE,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAuBrD,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAK3B,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAShC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAgBjC"}
@@ -1,4 +1,3 @@
1
1
  export { Autocomplete } from './Autocomplete';
2
2
  export { EditorAutocomplete } from './EditorAutocomplete';
3
- export { EditorSelectWithSearch } from './EditorSelectWithSearch';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/lib/editors/Autocomplete/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/lib/editors/Autocomplete/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export { EditorAmount } from './EditorAmount';
2
- export { Autocomplete, EditorAutocomplete, EditorSelectWithSearch, } from './Autocomplete';
2
+ export { Autocomplete, EditorAutocomplete } from './Autocomplete';
3
3
  export { EditorDate } from './EditorDate';
4
4
  export { EditorSelectString } from './EditorSelectString';
5
5
  export { EditorSelectNumber } from './EditorSelectNumber';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/lib/slickgrid/lib/editors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACN,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/lib/slickgrid/lib/editors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -3,7 +3,7 @@ export { openContextMenu } from './contextMenu';
3
3
  export { openHeaderContextMenu } from './header-context-menu';
4
4
  export { useHotKeys, useListenIfTablesWereEdited, useResizeCanvas, useUpdateTotal, } from './hooks';
5
5
  export { hotKeysCopy, hotKeysDelete, hotKeysOpenSummary, hotKeysRedo, hotKeysReverse, hotKeysUndo, nothingToCopy, positionToPaste, } from './hotKeys';
6
- export { Autocomplete, EditorAmount, EditorAutocomplete, EditorDate, EditorSelectString, EditorSelectNumber, EditorSelectWithSearch, } from './editors';
6
+ export { Autocomplete, EditorAmount, EditorAutocomplete, EditorDate, EditorSelectString, EditorSelectNumber, } from './editors';
7
7
  export { FORMATTER_NUMBER, DateFormatter, formatterCheckMark, getFormatterNumber, PercentFormatter, StringFormatter, } from './formatters';
8
8
  export { commitCurrentEdit, copySelectedRows, deleteRows, getActiveRowId, getDisplayedRows, getLastRow, getNextId, isDeletionDangerous, wereEdited, } from './functions';
9
9
  export { formatterGroupTotals } from './grouping';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/shared/lib/slickgrid/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACN,UAAU,EACV,2BAA2B,EAC3B,eAAe,EACf,cAAc,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,eAAe,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,UAAU,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACN,aAAa,EACb,oBAAoB,EACpB,eAAe,GACf,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/shared/lib/slickgrid/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACN,UAAU,EACV,2BAA2B,EAC3B,eAAe,EACf,cAAc,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,eAAe,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,UAAU,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACN,aAAa,EACb,oBAAoB,EACpB,eAAe,GACf,MAAM,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slick-table",
3
- "version": "1.1.48",
3
+ "version": "1.1.50",
4
4
  "description": "Enhanced version of SlickGrid library",
5
5
  "private": false,
6
6
  "type": "module",
@@ -13,6 +13,7 @@
13
13
  "import": "./dist/index.es.js",
14
14
  "require": "./dist/index.cjs.js"
15
15
  },
16
+ "./styles": "./dist/styles/slick-table.scss",
16
17
  "./package.json": "./package.json"
17
18
  },
18
19
  "files": [
@@ -36,6 +37,7 @@
36
37
  "scripts": {
37
38
  "dev": "vite",
38
39
  "build": "vite build",
40
+ "postbuild": "node scripts/copy-styles.mjs",
39
41
  "lint": "eslint .",
40
42
  "pack": "npm pack --dry-run",
41
43
  "version:patch": "npm version patch",
@@ -1,10 +1,12 @@
1
1
  #slick-table-autocomplete {
2
2
  background-color: white;
3
- z-index: 1;
4
- position: absolute;
3
+ box-shadow: gray 0 0 5px 1px;
5
4
  color: #1E456F;
6
- box-shadow: gray 0px 0px 5px 1px;
7
5
  font-size: 0.75rem;
6
+ max-height: 20em;
7
+ overflow-y: auto;
8
+ position: absolute;
9
+ z-index: 1;
8
10
 
9
11
  strong {
10
12
  color: rgb(0, 123, 255)
package/src/index.ts CHANGED
@@ -12,6 +12,7 @@ export {
12
12
  DefaultHotKeys,
13
13
  DefaultPrinter,
14
14
  DeletedRowsFilter,
15
+ EditorAutocomplete,
15
16
  FORMATTER_NUMBER,
16
17
  Filter,
17
18
  HotKeysDecorator,
@@ -8,7 +8,6 @@ export {
8
8
  EditorDate,
9
9
  EditorSelectString,
10
10
  EditorSelectNumber,
11
- EditorSelectWithSearch,
12
11
  EmptyStringValidator,
13
12
  FORMATTER_NUMBER,
14
13
  LengthValidator,
@@ -2,6 +2,7 @@ import {
2
2
  Editor,
3
3
  EditorArguments,
4
4
  EditorValidationResult,
5
+ ElementPosition,
5
6
  keyCode,
6
7
  } from "slickgrid";
7
8
 
@@ -26,6 +27,19 @@ export abstract class Autocomplete implements Editor {
26
27
  this.list = undefined;
27
28
  this.currentFocus = -1;
28
29
  }
30
+ createList() {
31
+ this.list = document.createElement("div");
32
+ const container = document.getElementById("root");
33
+ if (!container) return;
34
+ container.appendChild(this.list);
35
+ this.list.setAttribute("tabIndex", "0"); // this.input.addEventListener("blur", ...) doesn't work without it
36
+ this.list.setAttribute("id", this.id);
37
+ const { top, left, right } = this.args.position as ElementPosition;
38
+ const rowHeight = this.args.grid.getOptions().rowHeight || 25;
39
+ this.list.style.top = `${top + rowHeight}px`;
40
+ this.list.style.left = `${left}px`;
41
+ this.list.style.minWidth = `${right - left}px`;
42
+ }
29
43
  destroy(): void {
30
44
  this.input.removeEventListener("input", this.onInput.bind(this));
31
45
  this.input.removeEventListener("keydown", this.onKeydown.bind(this));
@@ -43,6 +57,13 @@ export abstract class Autocomplete implements Editor {
43
57
 
44
58
  this.input.addEventListener("input", this.onInput.bind(this));
45
59
  this.input.addEventListener("keydown", this.onKeydown.bind(this));
60
+ this.input.addEventListener("blur", ({ relatedTarget }) => {
61
+ if ((relatedTarget as HTMLDivElement | null)?.id === this.id) {
62
+ this.focus();
63
+ } else {
64
+ this.closeAllList();
65
+ }
66
+ });
46
67
  this.input.focus();
47
68
  this.input.select();
48
69
  }
@@ -59,26 +80,25 @@ export abstract class Autocomplete implements Editor {
59
80
  this.input.focus();
60
81
  this.input.select();
61
82
  }
62
- makeVisible(list: HTMLDivElement): void {
63
- const canvas = this.args.container.closest(".slick-viewport");
64
- if (!canvas) return;
83
+ makeVisible(): void {
84
+ if (!this.list) return;
65
85
  const {
66
86
  bottom: listBottom,
67
87
  left: listLeft,
68
88
  right: listRight,
69
89
  top: listTop,
70
- } = list.getBoundingClientRect();
71
- const { bottom: canvasBottom, right: canvasRight } =
72
- canvas.getBoundingClientRect();
73
- if (listBottom >= canvasBottom) {
90
+ } = this.list.getBoundingClientRect();
91
+ const { bottom: bodyBottom, right: bodyRight } =
92
+ document.body.getBoundingClientRect();
93
+ if (listBottom >= bodyBottom) {
74
94
  const rowHeight = this.args.grid.getOptions().rowHeight || 25;
75
95
  const listHeight = listBottom - listTop;
76
- list.style.top = `${listTop - listHeight - rowHeight}px`;
96
+ this.list.style.top = `${listTop - listHeight - rowHeight}px`;
77
97
  }
78
- if (listRight >= canvasRight) {
98
+ if (listRight >= bodyRight) {
79
99
  const { right: cellRight } = this.args.container.getBoundingClientRect();
80
100
  const exceeding = listRight - cellRight;
81
- list.style.left = `${listLeft - exceeding}px`;
101
+ this.list.style.left = `${listLeft - exceeding}px`;
82
102
  }
83
103
  }
84
104
  abstract onClick(event: MouseEvent): void;
@@ -108,8 +128,8 @@ export abstract class Autocomplete implements Editor {
108
128
  this.currentFocus = 0;
109
129
  }
110
130
  if (this.currentFocus > -1) {
111
- /* simulate click on the "active" item */
112
- if (items) items[this.currentFocus].click();
131
+ event.stopImmediatePropagation(); // prevent navigating next two times at a time
132
+ if (items) items[this.currentFocus].click(); // simulate click on the "active" item
113
133
  }
114
134
  }
115
135
  }
@@ -1,10 +1,4 @@
1
- import {
2
- Column,
3
- EditorArguments,
4
- ElementPosition,
5
- GridOption,
6
- SlickDataView,
7
- } from "slickgrid";
1
+ import { Column, EditorArguments, GridOption, SlickDataView } from "slickgrid";
8
2
 
9
3
  import { escapeSpecialChar } from "shared/lib/regexp";
10
4
  import { IColumn } from "shared/model/types";
@@ -56,16 +50,7 @@ export class EditorAutocomplete<
56
50
  this.args.grid.navigateNext();
57
51
  }
58
52
  showOptions(search: string): void {
59
- this.list = document.createElement("div");
60
- const container = document.getElementById("root");
61
- if (!container) return;
62
- container.appendChild(this.list);
63
- this.list.setAttribute("id", this.id);
64
- const { top, left, right } = this.args.position as ElementPosition;
65
- const rowHeight = this.args.grid.getOptions().rowHeight || 25;
66
- this.list.style.top = `${top + rowHeight}px`;
67
- this.list.style.left = `${left}px`;
68
- this.list.style.minWidth = `${right - left}px`;
53
+ this.createList();
69
54
  this.suggestionsList.forEach((name: string) => {
70
55
  const hasOverlap = name.match(new RegExp(escapeSpecialChar(search), "i"));
71
56
  if (hasOverlap) {
@@ -78,6 +63,6 @@ export class EditorAutocomplete<
78
63
  this.list?.appendChild(listItem);
79
64
  }
80
65
  });
81
- this.makeVisible(this.list);
66
+ this.makeVisible();
82
67
  }
83
68
  }
@@ -1,3 +1,2 @@
1
1
  export { Autocomplete } from "./Autocomplete";
2
2
  export { EditorAutocomplete } from "./EditorAutocomplete";
3
- export { EditorSelectWithSearch } from "./EditorSelectWithSearch";
@@ -1,9 +1,5 @@
1
1
  export { EditorAmount } from "./EditorAmount";
2
- export {
3
- Autocomplete,
4
- EditorAutocomplete,
5
- EditorSelectWithSearch,
6
- } from "./Autocomplete";
2
+ export { Autocomplete, EditorAutocomplete } from "./Autocomplete";
7
3
  export { EditorDate } from "./EditorDate";
8
4
  export { EditorSelectString } from "./EditorSelectString";
9
5
  export { EditorSelectNumber } from "./EditorSelectNumber";
@@ -29,7 +29,6 @@ export {
29
29
  EditorDate,
30
30
  EditorSelectString,
31
31
  EditorSelectNumber,
32
- EditorSelectWithSearch,
33
32
  } from "./editors";
34
33
  export {
35
34
  FORMATTER_NUMBER,
@@ -1,15 +0,0 @@
1
- import { Column, EditorArguments, GridOption } from 'slickgrid';
2
- import { ISlickRow } from '../../../../../model/types';
3
- import { Autocomplete } from './Autocomplete';
4
- export declare class EditorSelectWithSearch<TData = any, C extends Column<TData> = Column<TData>, O extends GridOption<C> = GridOption<C>> extends Autocomplete {
5
- args: EditorArguments<TData, C, O>;
6
- protected hash: Record<string, string>;
7
- protected reversedHash: Record<string, string>;
8
- constructor(args: EditorArguments<TData, C, O>);
9
- applyValue(item: any, state: any): void;
10
- loadValue(item: ISlickRow): void;
11
- onInput(event: Event): void;
12
- onClick(event: MouseEvent): void;
13
- showOptions(search: string): void;
14
- }
15
- //# sourceMappingURL=EditorSelectWithSearch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditorSelectWithSearch.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/lib/slickgrid/lib/editors/Autocomplete/EditorSelectWithSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGhE,OAAO,EAAW,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBAAa,sBAAsB,CAClC,KAAK,GAAG,GAAG,EACX,CAAC,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,EACvC,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CACtC,SAAQ,YAAY;IAIF,IAAI,EAAE,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAHrD,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAE5B,IAAI,EAAE,eAAe,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAmBrD,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAIvC,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAQhC,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAK3B,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAKhC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAsBjC"}
@@ -1,79 +0,0 @@
1
- import { Column, EditorArguments, GridOption } from "slickgrid";
2
-
3
- import { escapeSpecialChar } from "shared/lib/regexp";
4
- import { IColumn, ISlickRow } from "shared/model/types";
5
-
6
- import { Autocomplete } from "./Autocomplete";
7
-
8
- export class EditorSelectWithSearch<
9
- TData = any,
10
- C extends Column<TData> = Column<TData>,
11
- O extends GridOption<C> = GridOption<C>,
12
- > extends Autocomplete {
13
- protected hash: Record<string, string>;
14
- protected reversedHash: Record<string, string>;
15
-
16
- constructor(public args: EditorArguments<TData, C, O>) {
17
- super();
18
- const column: IColumn = this.args.column;
19
- this.hash = column.selectOptions as Record<string, string>;
20
- this.reversedHash = Object.entries(this.hash).reduce(
21
- (acc: Record<string, string>, [key, value]) => {
22
- acc[value] = key;
23
- return acc;
24
- },
25
- {},
26
- );
27
- this.init();
28
- const item = this.args.item;
29
- const initialValue = item[column.field];
30
- if (!initialValue) {
31
- this.showOptions("");
32
- }
33
- }
34
-
35
- applyValue(item: any, state: any): void {
36
- item[this.args.column.field] = this.reversedHash[state];
37
- }
38
-
39
- loadValue(item: ISlickRow): void {
40
- this.defaultValue = this.hash[item[this.args.column.id]] || "";
41
- this.input.value = this.defaultValue;
42
- this.input.defaultValue = this.defaultValue;
43
- this.input.focus();
44
- this.input.select();
45
- }
46
-
47
- onInput(event: Event): void {
48
- this.closeAllList();
49
- this.currentFocus = -1;
50
- this.showOptions((event.target as HTMLInputElement).value);
51
- }
52
- onClick(event: MouseEvent): void {
53
- const div = (event.target as HTMLElement).closest("div") as HTMLDivElement;
54
- this.input.value = this.hash[div.getElementsByTagName("input")[0].value];
55
- this.closeAllList();
56
- }
57
- showOptions(search: string): void {
58
- this.list = document.createElement("div");
59
- this.list.setAttribute("id", this.id);
60
- this.list.style.width = "fit-content";
61
- this.list.style.textAlign = "left";
62
- this.args.container.appendChild(this.list);
63
- Object.entries(this.hash).forEach(([key, value]) => {
64
- const hasOverlap = value.match(
65
- new RegExp(escapeSpecialChar(search), "i"),
66
- );
67
- if (hasOverlap) {
68
- const overlap = hasOverlap[0];
69
- const listItem = document.createElement("div");
70
- listItem.innerHTML = `${value.replaceAll(overlap, `<strong>${overlap}</strong>`)}`;
71
- // insert an input field that will hold the current array item's value
72
- listItem.innerHTML += `<input type="hidden" value="${key}">`;
73
- listItem.addEventListener("click", this.onClick.bind(this));
74
- this.list?.appendChild(listItem);
75
- }
76
- });
77
- this.makeVisible(this.list);
78
- }
79
- }