igniteui-grid-lite 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +17 -0
  3. package/components/cell.d.ts +35 -0
  4. package/components/cell.js +47 -0
  5. package/components/cell.js.map +1 -0
  6. package/components/filter-row.d.ts +47 -0
  7. package/components/filter-row.js +313 -0
  8. package/components/filter-row.js.map +1 -0
  9. package/components/grid.d.ts +226 -0
  10. package/components/grid.js +227 -0
  11. package/components/grid.js.map +1 -0
  12. package/components/header-row.d.ts +23 -0
  13. package/components/header-row.js +72 -0
  14. package/components/header-row.js.map +1 -0
  15. package/components/header.d.ts +23 -0
  16. package/components/header.js +137 -0
  17. package/components/header.js.map +1 -0
  18. package/components/row.d.ts +24 -0
  19. package/components/row.js +64 -0
  20. package/components/row.js.map +1 -0
  21. package/components/virtualizer.d.ts +12 -0
  22. package/components/virtualizer.js +21 -0
  23. package/components/virtualizer.js.map +1 -0
  24. package/controllers/data-operation.d.ts +17 -0
  25. package/controllers/data-operation.js +36 -0
  26. package/controllers/data-operation.js.map +1 -0
  27. package/controllers/dom.d.ts +19 -0
  28. package/controllers/dom.js +54 -0
  29. package/controllers/dom.js.map +1 -0
  30. package/controllers/filter.d.ts +21 -0
  31. package/controllers/filter.js +105 -0
  32. package/controllers/filter.js.map +1 -0
  33. package/controllers/navigation.d.ts +27 -0
  34. package/controllers/navigation.js +98 -0
  35. package/controllers/navigation.js.map +1 -0
  36. package/controllers/resize.d.ts +27 -0
  37. package/controllers/resize.js +52 -0
  38. package/controllers/resize.js.map +1 -0
  39. package/controllers/sort.d.ts +15 -0
  40. package/controllers/sort.js +94 -0
  41. package/controllers/sort.js.map +1 -0
  42. package/controllers/state.d.ts +24 -0
  43. package/controllers/state.js +37 -0
  44. package/controllers/state.js.map +1 -0
  45. package/custom-elements.json +4166 -0
  46. package/define.d.ts +2 -0
  47. package/define.js +4 -0
  48. package/define.js.map +1 -0
  49. package/docs/.nojekyll +1 -0
  50. package/docs/assets/hierarchy.js +1 -0
  51. package/docs/assets/highlight.css +71 -0
  52. package/docs/assets/icons.js +18 -0
  53. package/docs/assets/icons.svg +1 -0
  54. package/docs/assets/main.js +60 -0
  55. package/docs/assets/navigation.js +1 -0
  56. package/docs/assets/search.js +1 -0
  57. package/docs/assets/style.css +1633 -0
  58. package/docs/classes/IgcGridLite.html +74 -0
  59. package/docs/hierarchy.html +1 -0
  60. package/docs/index.html +11 -0
  61. package/docs/interfaces/BaseColumnConfiguration.html +28 -0
  62. package/docs/interfaces/BaseColumnSortConfiguration.html +6 -0
  63. package/docs/interfaces/BaseFilterExpression.html +15 -0
  64. package/docs/interfaces/BaseIgcCellContext.html +10 -0
  65. package/docs/interfaces/BaseSortExpression.html +12 -0
  66. package/docs/interfaces/ColumnFilterConfiguration.html +4 -0
  67. package/docs/interfaces/DataPipelineConfiguration.html +6 -0
  68. package/docs/interfaces/GridSortConfiguration.html +6 -0
  69. package/docs/interfaces/IgcFilteredEvent.html +6 -0
  70. package/docs/interfaces/IgcFilteringEvent.html +12 -0
  71. package/docs/interfaces/IgcGridLiteEventMap.html +17 -0
  72. package/docs/interfaces/IgcHeaderContext.html +6 -0
  73. package/docs/modules.html +1 -0
  74. package/docs/types/BasePropertyType.html +2 -0
  75. package/docs/types/BaseSortComparer.html +2 -0
  76. package/docs/types/ColumnConfiguration.html +2 -0
  77. package/docs/types/ColumnSortConfiguration.html +2 -0
  78. package/docs/types/DataPipelineHook.html +2 -0
  79. package/docs/types/DataPipelineParams.html +8 -0
  80. package/docs/types/DataType.html +2 -0
  81. package/docs/types/FilterCriteria.html +6 -0
  82. package/docs/types/FilterExpression.html +2 -0
  83. package/docs/types/IgcCellContext.html +2 -0
  84. package/docs/types/Keys.html +2 -0
  85. package/docs/types/PropertyType.html +2 -0
  86. package/docs/types/SortComparer.html +2 -0
  87. package/docs/types/SortExpression.html +2 -0
  88. package/docs/types/SortState.html +2 -0
  89. package/docs/types/SortingDirection.html +3 -0
  90. package/index.d.ts +8 -0
  91. package/index.js +5 -0
  92. package/index.js.map +1 -0
  93. package/internal/constants.d.ts +8 -0
  94. package/internal/constants.js +19 -0
  95. package/internal/constants.js.map +1 -0
  96. package/internal/icon-registry.d.ts +1 -0
  97. package/internal/icon-registry.js +29 -0
  98. package/internal/icon-registry.js.map +1 -0
  99. package/internal/is-defined.d.ts +1 -0
  100. package/internal/is-defined.js +4 -0
  101. package/internal/is-defined.js.map +1 -0
  102. package/internal/mixins/event-emitter.d.ts +7 -0
  103. package/internal/mixins/event-emitter.js +18 -0
  104. package/internal/mixins/event-emitter.js.map +1 -0
  105. package/internal/normalize-case.d.ts +1 -0
  106. package/internal/normalize-case.js +4 -0
  107. package/internal/normalize-case.js.map +1 -0
  108. package/internal/part-map.d.ts +4 -0
  109. package/internal/part-map.js +6 -0
  110. package/internal/part-map.js.map +1 -0
  111. package/internal/register.d.ts +6 -0
  112. package/internal/register.js +9 -0
  113. package/internal/register.js.map +1 -0
  114. package/internal/tags.d.ts +7 -0
  115. package/internal/tags.js +8 -0
  116. package/internal/tags.js.map +1 -0
  117. package/internal/theming.d.ts +34 -0
  118. package/internal/theming.js +123 -0
  119. package/internal/theming.js.map +1 -0
  120. package/internal/types.d.ts +198 -0
  121. package/internal/types.js +2 -0
  122. package/internal/types.js.map +1 -0
  123. package/internal/utils.d.ts +6 -0
  124. package/internal/utils.js +34 -0
  125. package/internal/utils.js.map +1 -0
  126. package/internal/watch.d.ts +5 -0
  127. package/internal/watch.js +19 -0
  128. package/internal/watch.js.map +1 -0
  129. package/operations/base.d.ts +6 -0
  130. package/operations/base.js +9 -0
  131. package/operations/base.js.map +1 -0
  132. package/operations/filter/operands/boolean.d.ts +3 -0
  133. package/operations/filter/operands/boolean.js +34 -0
  134. package/operations/filter/operands/boolean.js.map +1 -0
  135. package/operations/filter/operands/number.d.ts +3 -0
  136. package/operations/filter/operands/number.js +52 -0
  137. package/operations/filter/operands/number.js.map +1 -0
  138. package/operations/filter/operands/string.d.ts +3 -0
  139. package/operations/filter/operands/string.js +53 -0
  140. package/operations/filter/operands/string.js.map +1 -0
  141. package/operations/filter/state.d.ts +16 -0
  142. package/operations/filter/state.js +41 -0
  143. package/operations/filter/state.js.map +1 -0
  144. package/operations/filter/tree.d.ts +17 -0
  145. package/operations/filter/tree.js +46 -0
  146. package/operations/filter/tree.js.map +1 -0
  147. package/operations/filter/types.d.ts +57 -0
  148. package/operations/filter/types.js +2 -0
  149. package/operations/filter/types.js.map +1 -0
  150. package/operations/filter.d.ts +8 -0
  151. package/operations/filter.js +22 -0
  152. package/operations/filter.js.map +1 -0
  153. package/operations/sort/types.d.ts +49 -0
  154. package/operations/sort/types.js +2 -0
  155. package/operations/sort/types.js.map +1 -0
  156. package/operations/sort.d.ts +8 -0
  157. package/operations/sort.js +37 -0
  158. package/operations/sort.js.map +1 -0
  159. package/package.json +41 -0
  160. package/styles/_common.css.d.ts +1 -0
  161. package/styles/_common.css.js +3 -0
  162. package/styles/_common.css.js.map +1 -0
  163. package/styles/body-cell/body-cell.css.d.ts +1 -0
  164. package/styles/body-cell/body-cell.css.js +3 -0
  165. package/styles/body-cell/body-cell.css.js.map +1 -0
  166. package/styles/body-row/body-row.css.d.ts +1 -0
  167. package/styles/body-row/body-row.css.js +3 -0
  168. package/styles/body-row/body-row.css.js.map +1 -0
  169. package/styles/filter-row/filter-row.css.d.ts +1 -0
  170. package/styles/filter-row/filter-row.css.js +3 -0
  171. package/styles/filter-row/filter-row.css.js.map +1 -0
  172. package/styles/grid/themes/dark/grid.bootstrap.css.d.ts +1 -0
  173. package/styles/grid/themes/dark/grid.bootstrap.css.js +3 -0
  174. package/styles/grid/themes/dark/grid.bootstrap.css.js.map +1 -0
  175. package/styles/grid/themes/dark/grid.fluent.css.d.ts +1 -0
  176. package/styles/grid/themes/dark/grid.fluent.css.js +3 -0
  177. package/styles/grid/themes/dark/grid.fluent.css.js.map +1 -0
  178. package/styles/grid/themes/dark/grid.indigo.css.d.ts +1 -0
  179. package/styles/grid/themes/dark/grid.indigo.css.js +3 -0
  180. package/styles/grid/themes/dark/grid.indigo.css.js.map +1 -0
  181. package/styles/grid/themes/dark/grid.material.css.d.ts +1 -0
  182. package/styles/grid/themes/dark/grid.material.css.js +3 -0
  183. package/styles/grid/themes/dark/grid.material.css.js.map +1 -0
  184. package/styles/grid/themes/grid.base.css.d.ts +1 -0
  185. package/styles/grid/themes/grid.base.css.js +3 -0
  186. package/styles/grid/themes/grid.base.css.js.map +1 -0
  187. package/styles/grid/themes/light/grid.bootstrap.css.d.ts +1 -0
  188. package/styles/grid/themes/light/grid.bootstrap.css.js +3 -0
  189. package/styles/grid/themes/light/grid.bootstrap.css.js.map +1 -0
  190. package/styles/grid/themes/light/grid.fluent.css.d.ts +1 -0
  191. package/styles/grid/themes/light/grid.fluent.css.js +3 -0
  192. package/styles/grid/themes/light/grid.fluent.css.js.map +1 -0
  193. package/styles/grid/themes/light/grid.indigo.css.d.ts +1 -0
  194. package/styles/grid/themes/light/grid.indigo.css.js +3 -0
  195. package/styles/grid/themes/light/grid.indigo.css.js.map +1 -0
  196. package/styles/grid/themes/light/grid.material.css.d.ts +1 -0
  197. package/styles/grid/themes/light/grid.material.css.js +3 -0
  198. package/styles/grid/themes/light/grid.material.css.js.map +1 -0
  199. package/styles/grid/themes/themes.d.ts +2 -0
  200. package/styles/grid/themes/themes.js +39 -0
  201. package/styles/grid/themes/themes.js.map +1 -0
  202. package/styles/header-cell/header-cell.css.d.ts +1 -0
  203. package/styles/header-cell/header-cell.css.js +3 -0
  204. package/styles/header-cell/header-cell.css.js.map +1 -0
  205. package/styles/header-row/header-row.base.css.d.ts +1 -0
  206. package/styles/header-row/header-row.base.css.js +3 -0
  207. package/styles/header-row/header-row.base.css.js.map +1 -0
@@ -0,0 +1,9 @@
1
+ export function registerComponent(component, ...dependencies) {
2
+ for (const dependency of dependencies) {
3
+ dependency.register();
4
+ }
5
+ if (!customElements.get(component.tagName)) {
6
+ customElements.define(component.tagName, component);
7
+ }
8
+ }
9
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/internal/register.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,iBAAiB,CAAC,SAAuB,EAAE,GAAG,YAA4B;IACxF,KAAK,MAAM,UAAU,IAAI,YAAY,EAAE,CAAC;QACtC,UAAU,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3C,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACtD,CAAC;AACH,CAAC","sourcesContent":["type IgcComponent = CustomElementConstructor & {\n tagName: string;\n register: () => void;\n};\n\nexport function registerComponent(component: IgcComponent, ...dependencies: IgcComponent[]): void {\n for (const dependency of dependencies) {\n dependency.register();\n }\n\n if (!customElements.get(component.tagName)) {\n customElements.define(component.tagName, component);\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ export declare const GRID_TAG: "igc-grid-lite";
2
+ export declare const GRID_BODY: "igc-virtualizer";
3
+ export declare const GRID_HEADER_ROW_TAG: "igc-grid-lite-header-row";
4
+ export declare const GRID_HEADER_TAG: "igc-grid-lite-header";
5
+ export declare const GRID_ROW_TAG: "igc-grid-lite-row";
6
+ export declare const GRID_CELL_TAG: "igc-grid-lite-cell";
7
+ export declare const GRID_FILTER_ROW_TAG: "igc-filter-row";
@@ -0,0 +1,8 @@
1
+ export const GRID_TAG = 'igc-grid-lite';
2
+ export const GRID_BODY = 'igc-virtualizer';
3
+ export const GRID_HEADER_ROW_TAG = 'igc-grid-lite-header-row';
4
+ export const GRID_HEADER_TAG = 'igc-grid-lite-header';
5
+ export const GRID_ROW_TAG = 'igc-grid-lite-row';
6
+ export const GRID_CELL_TAG = 'igc-grid-lite-cell';
7
+ export const GRID_FILTER_ROW_TAG = 'igc-filter-row';
8
+ //# sourceMappingURL=tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/internal/tags.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAwB,CAAC;AACjD,MAAM,CAAC,MAAM,SAAS,GAAG,iBAA0B,CAAC;AACpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,0BAAmC,CAAC;AACvE,MAAM,CAAC,MAAM,eAAe,GAAG,sBAA+B,CAAC;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,mBAA4B,CAAC;AACzD,MAAM,CAAC,MAAM,aAAa,GAAG,oBAA6B,CAAC;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAyB,CAAC","sourcesContent":["export const GRID_TAG = 'igc-grid-lite' as const;\nexport const GRID_BODY = 'igc-virtualizer' as const;\nexport const GRID_HEADER_ROW_TAG = 'igc-grid-lite-header-row' as const;\nexport const GRID_HEADER_TAG = 'igc-grid-lite-header' as const;\nexport const GRID_ROW_TAG = 'igc-grid-lite-row' as const;\nexport const GRID_CELL_TAG = 'igc-grid-lite-cell' as const;\nexport const GRID_FILTER_ROW_TAG = 'igc-filter-row' as const;\n"]}
@@ -0,0 +1,34 @@
1
+ import type { CSSResult, ReactiveController, ReactiveControllerHost, ReactiveElement } from 'lit';
2
+ type Theme = 'material' | 'bootstrap' | 'indigo' | 'fluent';
3
+ export type Themes = {
4
+ light: {
5
+ [K in Theme | 'shared']?: CSSResult;
6
+ };
7
+ dark: {
8
+ [K in Theme | 'shared']?: CSSResult;
9
+ };
10
+ };
11
+ type ThemeChangedCallback = (theme: Theme) => unknown;
12
+ type ThemingControllerConfig = {
13
+ themeChange?: ThemeChangedCallback;
14
+ };
15
+ declare class ThemingController implements ReactiveController {
16
+ private readonly _host;
17
+ private readonly _themes;
18
+ private readonly _options?;
19
+ private _theme;
20
+ private _variant;
21
+ get theme(): Theme;
22
+ constructor(host: ReactiveControllerHost & ReactiveElement, themes: Themes, config?: ThemingControllerConfig);
23
+ /** @internal */
24
+ hostConnected(): void;
25
+ /** @internal */
26
+ hostDisconnected(): void;
27
+ /** @internal */
28
+ handleEvent(): void;
29
+ private _getStyles;
30
+ protected _adoptStyles(): void;
31
+ private _handleThemeChanged;
32
+ }
33
+ export declare function addThemingController(host: ReactiveControllerHost & ReactiveElement, themes: Themes, config?: ThemingControllerConfig): ThemingController;
34
+ export type { ThemingController };
@@ -0,0 +1,123 @@
1
+ import { adoptStyles, css, isServer } from 'lit';
2
+ const CHANGE_THEME_EVENT = 'igc-change-theme';
3
+ let theme;
4
+ let themeVariant;
5
+ function isStyleRule(rule) {
6
+ return rule != null && 'style' in rule;
7
+ }
8
+ function cssKeyToJsKey(key) {
9
+ return key.replace(/^--|-./g, (match) => {
10
+ return match.startsWith('--') ? '' : match.charAt(1).toUpperCase();
11
+ });
12
+ }
13
+ function getAllCssVariableNames() {
14
+ const cssVars = new Set();
15
+ const styleSheets = Array.from(document.styleSheets);
16
+ for (const sheet of styleSheets) {
17
+ let rules;
18
+ try {
19
+ rules = sheet.cssRules;
20
+ }
21
+ catch {
22
+ continue;
23
+ }
24
+ if (!rules) {
25
+ continue;
26
+ }
27
+ for (const rule of Array.from(rules)) {
28
+ if (isStyleRule(rule)) {
29
+ const length = rule.style.length;
30
+ for (let i = 0; i < length; i++) {
31
+ const style = rule.style[i];
32
+ if (style.startsWith('--')) {
33
+ cssVars.add(style);
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+ return cssVars;
40
+ }
41
+ function getElementCssVariables(allCssVars, element, pseudo) {
42
+ const cssVars = {};
43
+ const styles = getComputedStyle(element, pseudo);
44
+ for (const key of allCssVars) {
45
+ const value = styles.getPropertyValue(key);
46
+ if (value) {
47
+ cssVars[cssKeyToJsKey(key)] = value.trim();
48
+ }
49
+ }
50
+ return cssVars;
51
+ }
52
+ function getAllCssVariables() {
53
+ return isServer ? {} : getElementCssVariables(getAllCssVariableNames(), document.documentElement);
54
+ }
55
+ function isOfTypeTheme(theme) {
56
+ return ['bootstrap', 'material', 'indigo', 'fluent'].includes(theme);
57
+ }
58
+ function isOfTypeThemeVariant(variant) {
59
+ return ['light', 'dark'].includes(variant);
60
+ }
61
+ function getTheme() {
62
+ if (!(theme && themeVariant)) {
63
+ const cssVars = getAllCssVariables();
64
+ const foundTheme = cssVars.igTheme;
65
+ const foundVariant = cssVars.igThemeVariant;
66
+ theme = isOfTypeTheme(foundTheme) ? foundTheme : 'bootstrap';
67
+ themeVariant = isOfTypeThemeVariant(foundVariant) ? foundVariant : 'light';
68
+ }
69
+ return { theme, themeVariant };
70
+ }
71
+ class ThemingController {
72
+ get theme() {
73
+ return this._theme;
74
+ }
75
+ constructor(host, themes, config) {
76
+ this._theme = 'bootstrap';
77
+ this._variant = 'light';
78
+ this._host = host;
79
+ this._themes = themes;
80
+ this._options = config;
81
+ this._host.addController(this);
82
+ }
83
+ hostConnected() {
84
+ this._handleThemeChanged();
85
+ globalThis.addEventListener(CHANGE_THEME_EVENT, this);
86
+ }
87
+ hostDisconnected() {
88
+ globalThis.addEventListener(CHANGE_THEME_EVENT, this);
89
+ }
90
+ handleEvent() {
91
+ this._handleThemeChanged();
92
+ }
93
+ _getStyles() {
94
+ const props = this._themes[this._variant];
95
+ const styles = { shared: css ``, theme: css `` };
96
+ for (const [name, sheet] of Object.entries(props)) {
97
+ if (name === 'shared') {
98
+ styles.shared = sheet;
99
+ }
100
+ if (name === this.theme) {
101
+ styles.theme = sheet;
102
+ }
103
+ }
104
+ return styles;
105
+ }
106
+ _adoptStyles() {
107
+ const { theme: currentTheme, themeVariant } = getTheme();
108
+ this._theme = currentTheme;
109
+ this._variant = themeVariant;
110
+ const ctor = this._host.constructor;
111
+ const { shared, theme } = this._getStyles();
112
+ adoptStyles(this._host.shadowRoot, [...ctor.elementStyles, shared, theme]);
113
+ }
114
+ _handleThemeChanged() {
115
+ this._adoptStyles();
116
+ this._options?.themeChange?.call(this._host, this._theme);
117
+ this._host.requestUpdate();
118
+ }
119
+ }
120
+ export function addThemingController(host, themes, config) {
121
+ return new ThemingController(host, themes, config);
122
+ }
123
+ //# sourceMappingURL=theming.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theming.js","sourceRoot":"","sources":["../../src/internal/theming.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAmBjD,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAC9C,IAAI,KAAY,CAAC;AACjB,IAAI,YAA0B,CAAC;AAE/B,SAAS,WAAW,CAAC,IAAa;IAChC,OAAO,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,IAAI,CAAC;AACzC,CAAC;AAED,SAAS,aAAa,CAAC,GAAW;IAChC,OAAO,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QACtC,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,sBAAsB;IAC7B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAErD,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,KAA8B,CAAC;QAGnC,IAAI,CAAC;YACH,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC;QACzB,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QAED,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,SAAS;QACX,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,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AAC,MAAM,CAAC,CAAC;QAC1D,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,UAAU,oBAAoB,CAClC,IAA8C,EAC9C,MAAc,EACd,MAAgC;IAEhC,OAAO,IAAI,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import type {\n CSSResult,\n LitElement,\n ReactiveController,\n ReactiveControllerHost,\n ReactiveElement,\n} from 'lit';\nimport { adoptStyles, css, isServer } from 'lit';\n\ntype Theme = 'material' | 'bootstrap' | 'indigo' | 'fluent';\ntype ThemeVariant = 'light' | 'dark';\n\nexport type Themes = {\n light: {\n [K in Theme | 'shared']?: CSSResult;\n };\n dark: {\n [K in Theme | 'shared']?: CSSResult;\n };\n};\n\ntype ThemeChangedCallback = (theme: Theme) => unknown;\ntype ThemingControllerConfig = {\n themeChange?: ThemeChangedCallback;\n};\n\nconst CHANGE_THEME_EVENT = 'igc-change-theme';\nlet theme: Theme;\nlet themeVariant: ThemeVariant;\n\nfunction isStyleRule(rule: CSSRule): rule is CSSStyleRule {\n return rule != null && 'style' in rule;\n}\n\nfunction cssKeyToJsKey(key: string): string {\n return key.replace(/^--|-./g, (match) => {\n return match.startsWith('--') ? '' : match.charAt(1).toUpperCase();\n });\n}\n\nfunction getAllCssVariableNames(): Set<string> {\n const cssVars = new Set<string>();\n const styleSheets = Array.from(document.styleSheets);\n\n for (const sheet of styleSheets) {\n let rules: CSSRuleList | undefined;\n\n // Potential CORS or access errors\n try {\n rules = sheet.cssRules;\n } catch {\n continue;\n }\n\n if (!rules) {\n continue;\n }\n\n for (const rule of Array.from(rules)) {\n if (isStyleRule(rule)) {\n const length = rule.style.length;\n\n for (let i = 0; i < length; i++) {\n const style = rule.style[i];\n\n if (style.startsWith('--')) {\n cssVars.add(style);\n }\n }\n }\n }\n }\n\n return cssVars;\n}\n\nfunction getElementCssVariables(\n allCssVars: Set<string>,\n element: HTMLElement,\n pseudo?: string\n): Record<string, string> {\n const cssVars: Record<string, string> = {};\n const styles = getComputedStyle(element, pseudo);\n\n for (const key of allCssVars) {\n const value = styles.getPropertyValue(key);\n\n if (value) {\n cssVars[cssKeyToJsKey(key)] = value.trim();\n }\n }\n\n return cssVars;\n}\n\nfunction getAllCssVariables(): Record<string, string> {\n /* c8 ignore next 2 */\n return isServer ? {} : getElementCssVariables(getAllCssVariableNames(), document.documentElement);\n}\n\nfunction isOfTypeTheme(theme: string): theme is Theme {\n return ['bootstrap', 'material', 'indigo', 'fluent'].includes(theme);\n}\n\nfunction isOfTypeThemeVariant(variant: string): variant is ThemeVariant {\n return ['light', 'dark'].includes(variant);\n}\n\nfunction getTheme() {\n if (!(theme && themeVariant)) {\n const cssVars = getAllCssVariables();\n const foundTheme = cssVars.igTheme;\n const foundVariant = cssVars.igThemeVariant;\n\n theme = isOfTypeTheme(foundTheme) ? foundTheme : 'bootstrap';\n themeVariant = isOfTypeThemeVariant(foundVariant) ? foundVariant : 'light';\n }\n\n return { theme, themeVariant };\n}\n\nclass ThemingController implements ReactiveController {\n private readonly _host: ReactiveControllerHost & ReactiveElement;\n private readonly _themes: Themes;\n private readonly _options?: ThemingControllerConfig;\n\n private _theme: Theme = 'bootstrap';\n private _variant: ThemeVariant = 'light';\n\n public get theme(): Theme {\n return this._theme;\n }\n\n constructor(\n host: ReactiveControllerHost & ReactiveElement,\n themes: Themes,\n config?: ThemingControllerConfig\n ) {\n this._host = host;\n this._themes = themes;\n this._options = config;\n this._host.addController(this);\n }\n\n /** @internal */\n public hostConnected(): void {\n this._handleThemeChanged();\n globalThis.addEventListener(CHANGE_THEME_EVENT, this);\n }\n\n /** @internal */\n public hostDisconnected(): void {\n globalThis.addEventListener(CHANGE_THEME_EVENT, this);\n }\n\n /** @internal */\n public handleEvent(): void {\n this._handleThemeChanged();\n }\n\n private _getStyles() {\n const props = this._themes[this._variant];\n const styles = { shared: css``, theme: css`` };\n\n for (const [name, sheet] of Object.entries(props)) {\n if (name === 'shared') {\n styles.shared = sheet;\n }\n if (name === this.theme) {\n styles.theme = sheet;\n }\n }\n\n return styles;\n }\n\n protected _adoptStyles(): void {\n const { theme: currentTheme, themeVariant } = getTheme();\n this._theme = currentTheme;\n this._variant = themeVariant;\n\n const ctor = this._host.constructor as typeof LitElement;\n const { shared, theme } = this._getStyles();\n\n adoptStyles(this._host.shadowRoot!, [...ctor.elementStyles, shared, theme]);\n }\n\n private _handleThemeChanged(): void {\n this._adoptStyles();\n this._options?.themeChange?.call(this._host, this._theme);\n this._host.requestUpdate();\n }\n}\n\nexport function addThemingController(\n host: ReactiveControllerHost & ReactiveElement,\n themes: Themes,\n config?: ThemingControllerConfig\n): ThemingController {\n return new ThemingController(host, themes, config);\n}\n\nexport type { ThemingController };\n"]}
@@ -0,0 +1,198 @@
1
+ import type { ReactiveControllerHost, TemplateResult } from 'lit';
2
+ import type IgcGridLiteCell from '../components/cell.js';
3
+ import type { IgcGridLite } from '../components/grid.js';
4
+ import type IgcGridLiteHeader from '../components/header.js';
5
+ import type IgcGridLiteRow from '../components/row.js';
6
+ import type { SortComparer } from '../operations/sort/types.js';
7
+ export type NavigationState = 'previous' | 'current';
8
+ export type GridHost<T extends object> = ReactiveControllerHost & IgcGridLite<T>;
9
+ /**
10
+ * Helper type for resolving keys of type T.
11
+ */
12
+ export type Keys<T> = keyof T;
13
+ /**
14
+ * Helper type for resolving types of type T.
15
+ */
16
+ export type BasePropertyType<T, K extends Keys<T> = Keys<T>> = T[K];
17
+ /**
18
+ * Helper type for resolving types of type T.
19
+ */
20
+ export type PropertyType<T, K extends Keys<T> = Keys<T>> = K extends Keys<T> ? BasePropertyType<T, K> : never;
21
+ /** The data for the current column. */
22
+ export type DataType = 'number' | 'string' | 'boolean';
23
+ /**
24
+ * Configures the sort behavior for the grid.
25
+ */
26
+ export interface GridSortConfiguration {
27
+ /**
28
+ * Whether multiple sorting is enabled.
29
+ */
30
+ multiple: boolean;
31
+ /**
32
+ * Whether tri-state sorting is enabled.
33
+ */
34
+ triState: boolean;
35
+ }
36
+ /**
37
+ * Extended sort configuration for a column.
38
+ */
39
+ export interface BaseColumnSortConfiguration<T, K extends Keys<T> = Keys<T>> {
40
+ /**
41
+ * Whether the sort operations will be case sensitive.
42
+ */
43
+ caseSensitive?: boolean;
44
+ /**
45
+ * Custom comparer function for sort operations for this column.
46
+ */
47
+ comparer?: SortComparer<T, K>;
48
+ }
49
+ /**
50
+ * See {@link BaseColumnSortConfiguration} for the full documentation.
51
+ */
52
+ export type ColumnSortConfiguration<T, K extends Keys<T> = Keys<T>> = K extends Keys<T> ? BaseColumnSortConfiguration<T, K> : never;
53
+ /**
54
+ * Extended filter configuration for a column.
55
+ */
56
+ export interface ColumnFilterConfiguration {
57
+ /**
58
+ * Whether the filter operations will be case sensitive.
59
+ */
60
+ caseSensitive?: boolean;
61
+ }
62
+ /** Configuration object for grid columns. */
63
+ export interface BaseColumnConfiguration<T extends object, K extends Keys<T> = Keys<T>> {
64
+ /**
65
+ * The field for from the data the this column will reference.
66
+ */
67
+ key: K;
68
+ /**
69
+ * The type of data this column will reference.
70
+ *
71
+ * Affects the default filter operands if the column is with filtering enabled.
72
+ *
73
+ * @remarks
74
+ * If not passed, `string` is assumed to be the default type.
75
+ *
76
+ */
77
+ type?: DataType;
78
+ /**
79
+ * Optional text to display in the column header. By default, the column key is used
80
+ * to render the header text.
81
+ */
82
+ headerText?: string;
83
+ /**
84
+ * Width for the current column.
85
+ *
86
+ * Accepts most CSS units for controlling width.
87
+ *
88
+ * @remarks
89
+ * If not passed, the column will try to size itself based on the number of other
90
+ * columns and the total width of the grid.
91
+ *
92
+ */
93
+ width?: string;
94
+ /**
95
+ * Whether the column is hidden or not.
96
+ */
97
+ hidden?: boolean;
98
+ /**
99
+ * Whether the the column can be resized or not.
100
+ */
101
+ resizable?: boolean;
102
+ /**
103
+ * Whether the column can be sorted or not.
104
+ */
105
+ sort?: ColumnSortConfiguration<T, K> | boolean;
106
+ /**
107
+ * Whether filter operation can be applied on the column or not.
108
+ */
109
+ filter?: ColumnFilterConfiguration | boolean;
110
+ /**
111
+ * Header template callback.
112
+ */
113
+ headerTemplate?: (params: IgcHeaderContext<T>) => TemplateResult | unknown;
114
+ /**
115
+ * Cell template callback.
116
+ */
117
+ cellTemplate?: (params: IgcCellContext<T, K>) => TemplateResult | unknown;
118
+ }
119
+ /**
120
+ * See {@link BaseColumnConfiguration} for the full documentation.
121
+ */
122
+ export type ColumnConfiguration<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T> ? BaseColumnConfiguration<T, K> : never;
123
+ export interface ActiveNode<T> {
124
+ column: Keys<T>;
125
+ row: number;
126
+ }
127
+ /**
128
+ * Context object for the column header template callback.
129
+ */
130
+ export interface IgcHeaderContext<T extends object> {
131
+ /**
132
+ * The header element parent of the template.
133
+ */
134
+ parent: IgcGridLiteHeader<T>;
135
+ /**
136
+ * The current configuration for the column.
137
+ */
138
+ column: ColumnConfiguration<T>;
139
+ }
140
+ /**
141
+ * Context object for the row cell template callback.
142
+ */
143
+ export interface BaseIgcCellContext<T extends object, K extends Keys<T> = Keys<T>> {
144
+ /**
145
+ * The cell element parent of the template.
146
+ */
147
+ parent: IgcGridLiteCell<T>;
148
+ /**
149
+ * The row element containing the cell.
150
+ */
151
+ row: IgcGridLiteRow<T>;
152
+ /**
153
+ * The current configuration for the column.
154
+ */
155
+ column: ColumnConfiguration<T, K>;
156
+ /**
157
+ * The value from the data source for this cell.
158
+ */
159
+ value: PropertyType<T, K>;
160
+ }
161
+ /**
162
+ * See {@link BaseIgcCellContext} for the full documentation.
163
+ */
164
+ export type IgcCellContext<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T> ? BaseIgcCellContext<T, K> : never;
165
+ /**
166
+ * The parameters passed to a {@link DataPipelineHook} callback.
167
+ */
168
+ export type DataPipelineParams<T extends object> = {
169
+ /**
170
+ * The current data state of the grid.
171
+ */
172
+ data: T[];
173
+ /**
174
+ * The grid component itself.
175
+ */
176
+ grid: IgcGridLite<T>;
177
+ /**
178
+ * The type of data operation being performed.
179
+ */
180
+ type: 'sort' | 'filter';
181
+ };
182
+ /**
183
+ * Callback function for customizing data operations in the grid.
184
+ */
185
+ export type DataPipelineHook<T extends object> = (state: DataPipelineParams<T>) => T[] | Promise<T[]>;
186
+ /**
187
+ * Configuration for customizing the various data operations of the grid.
188
+ */
189
+ export interface DataPipelineConfiguration<T extends object> {
190
+ /**
191
+ * Hook for customizing sort operations.
192
+ */
193
+ sort?: DataPipelineHook<T>;
194
+ /**
195
+ * Hook for customizing filter operations.
196
+ */
197
+ filter?: DataPipelineHook<T>;
198
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactiveControllerHost, TemplateResult } from 'lit';\nimport type IgcGridLiteCell from '../components/cell.js';\nimport type { IgcGridLite } from '../components/grid.js';\nimport type IgcGridLiteHeader from '../components/header.js';\nimport type IgcGridLiteRow from '../components/row.js';\nimport type { SortComparer } from '../operations/sort/types.js';\n\nexport type NavigationState = 'previous' | 'current';\nexport type GridHost<T extends object> = ReactiveControllerHost & IgcGridLite<T>;\n\n/**\n * Helper type for resolving keys of type T.\n */\nexport type Keys<T> = keyof T;\n\n/**\n * Helper type for resolving types of type T.\n */\nexport type BasePropertyType<T, K extends Keys<T> = Keys<T>> = T[K];\n\n/**\n * Helper type for resolving types of type T.\n */\nexport type PropertyType<T, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BasePropertyType<T, K>\n : never;\n\n/** The data for the current column. */\nexport type DataType = 'number' | 'string' | 'boolean';\n\n/**\n * Configures the sort behavior for the grid.\n */\nexport interface GridSortConfiguration {\n /**\n * Whether multiple sorting is enabled.\n */\n multiple: boolean;\n /**\n * Whether tri-state sorting is enabled.\n */\n triState: boolean;\n}\n\n/**\n * Extended sort configuration for a column.\n */\nexport interface BaseColumnSortConfiguration<T, K extends Keys<T> = Keys<T>> {\n /**\n * Whether the sort operations will be case sensitive.\n */\n caseSensitive?: boolean;\n /**\n * Custom comparer function for sort operations for this column.\n */\n comparer?: SortComparer<T, K>;\n}\n\n/**\n * See {@link BaseColumnSortConfiguration} for the full documentation.\n */\nexport type ColumnSortConfiguration<T, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BaseColumnSortConfiguration<T, K>\n : never;\n\n/**\n * Extended filter configuration for a column.\n */\nexport interface ColumnFilterConfiguration {\n /**\n * Whether the filter operations will be case sensitive.\n */\n caseSensitive?: boolean;\n}\n\n/** Configuration object for grid columns. */\nexport interface BaseColumnConfiguration<T extends object, K extends Keys<T> = Keys<T>> {\n /**\n * The field for from the data the this column will reference.\n */\n key: K;\n /**\n * The type of data this column will reference.\n *\n * Affects the default filter operands if the column is with filtering enabled.\n *\n * @remarks\n * If not passed, `string` is assumed to be the default type.\n *\n */\n type?: DataType;\n /**\n * Optional text to display in the column header. By default, the column key is used\n * to render the header text.\n */\n headerText?: string;\n /**\n * Width for the current column.\n *\n * Accepts most CSS units for controlling width.\n *\n * @remarks\n * If not passed, the column will try to size itself based on the number of other\n * columns and the total width of the grid.\n *\n */\n width?: string;\n /**\n * Whether the column is hidden or not.\n */\n hidden?: boolean;\n /**\n * Whether the the column can be resized or not.\n */\n resizable?: boolean;\n /**\n * Whether the column can be sorted or not.\n */\n sort?: ColumnSortConfiguration<T, K> | boolean;\n /**\n * Whether filter operation can be applied on the column or not.\n */\n filter?: ColumnFilterConfiguration | boolean;\n /**\n * Header template callback.\n */\n headerTemplate?: (params: IgcHeaderContext<T>) => TemplateResult | unknown;\n /**\n * Cell template callback.\n */\n cellTemplate?: (params: IgcCellContext<T, K>) => TemplateResult | unknown;\n}\n\n/**\n * See {@link BaseColumnConfiguration} for the full documentation.\n */\nexport type ColumnConfiguration<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BaseColumnConfiguration<T, K>\n : never;\n\nexport interface ActiveNode<T> {\n column: Keys<T>;\n row: number;\n}\n\n/**\n * Context object for the column header template callback.\n */\nexport interface IgcHeaderContext<T extends object> {\n /**\n * The header element parent of the template.\n */\n parent: IgcGridLiteHeader<T>;\n /**\n * The current configuration for the column.\n */\n column: ColumnConfiguration<T>;\n}\n\n/**\n * Context object for the row cell template callback.\n */\nexport interface BaseIgcCellContext<T extends object, K extends Keys<T> = Keys<T>> {\n /**\n * The cell element parent of the template.\n */\n parent: IgcGridLiteCell<T>;\n /**\n * The row element containing the cell.\n */\n row: IgcGridLiteRow<T>;\n /**\n * The current configuration for the column.\n */\n column: ColumnConfiguration<T, K>;\n /**\n * The value from the data source for this cell.\n */\n value: PropertyType<T, K>;\n}\n\n/**\n * See {@link BaseIgcCellContext} for the full documentation.\n */\nexport type IgcCellContext<T extends object, K extends Keys<T> = Keys<T>> = K extends Keys<T>\n ? BaseIgcCellContext<T, K>\n : never;\n\n/**\n * The parameters passed to a {@link DataPipelineHook} callback.\n */\nexport type DataPipelineParams<T extends object> = {\n /**\n * The current data state of the grid.\n */\n data: T[];\n /**\n * The grid component itself.\n */\n grid: IgcGridLite<T>;\n /**\n * The type of data operation being performed.\n */\n type: 'sort' | 'filter';\n};\n\n/**\n * Callback function for customizing data operations in the grid.\n */\nexport type DataPipelineHook<T extends object> = (\n state: DataPipelineParams<T>\n) => T[] | Promise<T[]>;\n\n/**\n * Configuration for customizing the various data operations of the grid.\n */\nexport interface DataPipelineConfiguration<T extends object> {\n /**\n * Hook for customizing sort operations.\n */\n sort?: DataPipelineHook<T>;\n /**\n * Hook for customizing filter operations.\n */\n filter?: DataPipelineHook<T>;\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import type { StyleInfo } from 'lit/directives/style-map.js';
2
+ import type { ColumnConfiguration, GridHost } from './types.js';
3
+ export declare function applyColumnWidths<T extends object>(columns: Array<ColumnConfiguration<T>>): StyleInfo;
4
+ export declare function autoGenerateColumns<T extends object>(grid: GridHost<T>): void;
5
+ export declare function asArray<T>(value: T | T[]): T[];
6
+ export declare function getFilterOperandsFor<T extends object>(column: ColumnConfiguration<T>): Readonly<import("../operations/filter/types.js").FilterOperands<number, import("../operations/filter/operands/number.js").NumberKeys>> | Readonly<import("../operations/filter/types.js").FilterOperands<string, import("../operations/filter/operands/string.js").StringKeys>> | Readonly<import("../operations/filter/types.js").FilterOperands<boolean, import("../operations/filter/operands/boolean.js").BooleanKeys>>;
@@ -0,0 +1,34 @@
1
+ import { BooleanOperands } from '../operations/filter/operands/boolean.js';
2
+ import { NumberOperands } from '../operations/filter/operands/number.js';
3
+ import { StringOperands } from '../operations/filter/operands/string.js';
4
+ export function applyColumnWidths(columns) {
5
+ return {
6
+ 'grid-template-columns': columns
7
+ .filter((each) => !each.hidden)
8
+ .map(({ width }) => width ?? 'minmax(136px, 1fr)')
9
+ .join(' '),
10
+ };
11
+ }
12
+ export function autoGenerateColumns(grid) {
13
+ if (grid.autoGenerate && grid.columns.length < 1) {
14
+ const record = grid.data[0] ?? {};
15
+ grid.columns = Object.entries(record).map(([key, value]) => {
16
+ const type = typeof value === 'boolean' ? 'boolean' : typeof value === 'number' ? 'number' : 'string';
17
+ return { key, type };
18
+ });
19
+ }
20
+ }
21
+ export function asArray(value) {
22
+ return Array.isArray(value) ? value : [value];
23
+ }
24
+ export function getFilterOperandsFor(column) {
25
+ switch (column.type) {
26
+ case 'boolean':
27
+ return BooleanOperands;
28
+ case 'number':
29
+ return NumberOperands;
30
+ default:
31
+ return StringOperands;
32
+ }
33
+ }
34
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/internal/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAIzE,M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xB;YACE,OAAO,cAAc,CAAC;IAC1B,CAAC;AACH,CAAC","sourcesContent":["import type { StyleInfo } from 'lit/directives/style-map.js';\nimport { BooleanOperands } from '../operations/filter/operands/boolean.js';\nimport { NumberOperands } from '../operations/filter/operands/number.js';\nimport { StringOperands } from '../operations/filter/operands/string.js';\nimport type { ColumnConfiguration, DataType, GridHost } from './types.js';\n\n// TODO: Revise if this is needed\nexport function applyColumnWidths<T extends object>(\n columns: Array<ColumnConfiguration<T>>\n): StyleInfo {\n return {\n 'grid-template-columns': columns\n .filter((each) => !each.hidden)\n .map(({ width }) => width ?? 'minmax(136px, 1fr)')\n .join(' '),\n };\n}\n\nexport function autoGenerateColumns<T extends object>(grid: GridHost<T>) {\n if (grid.autoGenerate && grid.columns.length < 1) {\n const record = grid.data[0] ?? {};\n\n grid.columns = Object.entries(record).map(([key, value]) => {\n const type: DataType =\n typeof value === 'boolean' ? 'boolean' : typeof value === 'number' ? 'number' : 'string';\n return { key, type } as ColumnConfiguration<T>;\n });\n }\n}\n\nexport function asArray<T>(value: T | T[]) {\n return Array.isArray(value) ? value : [value];\n}\n\nexport function getFilterOperandsFor<T extends object>(column: ColumnConfiguration<T>) {\n // Check for custom class in the filter config\n switch (column.type) {\n case 'boolean':\n return BooleanOperands;\n case 'number':\n return NumberOperands;\n default:\n return StringOperands;\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ interface WatchOptions {
2
+ waitUntilFirstUpdate?: boolean;
3
+ }
4
+ export declare function watch(propName: string, options?: WatchOptions): (protoOrDescriptor: any, name: string) => any;
5
+ export {};
@@ -0,0 +1,19 @@
1
+ export function watch(propName, options) {
2
+ return (protoOrDescriptor, name) => {
3
+ const { willUpdate } = protoOrDescriptor;
4
+ const _options = Object.assign({ waitUntilFirstUpdate: false }, options);
5
+ protoOrDescriptor.willUpdate = function (changedProps) {
6
+ willUpdate.call(this, changedProps);
7
+ if (changedProps.has(propName)) {
8
+ const oldValue = changedProps.get(propName);
9
+ const newValue = this[propName];
10
+ if (oldValue !== newValue) {
11
+ if (!_options?.waitUntilFirstUpdate || this.hasUpdated) {
12
+ this[name].call(this, oldValue, newValue);
13
+ }
14
+ }
15
+ }
16
+ };
17
+ };
18
+ }
19
+ //# sourceMappingURL=watch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/internal/watch.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,KAAK,CAAC,QAAgB,EAAE,OAAsB;IAC5D,OAAO,CAAC,iBAAsB,EAAE,IAAY,EAAO,EAAE;QACnD,MAAM,EAAE,UAAU,EAAE,GAAG,iBAAiB,CAAC;QAEzC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,KAAK,EAAE,EAAE,OAAO,CAAiB,CAAC;QAEzF,iBAAiB,CAAC,UAAU,GAAG,UAAU,YAA8B;YACrE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YAEpC,IAAI,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC/B,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAEhC,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;oBAC1B,IAAI,CAAC,QAAQ,EAAE,oBAAoB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;wBACvD,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAC5C,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["interface WatchOptions {\n waitUntilFirstUpdate?: boolean;\n}\n\nexport function watch(propName: string, options?: WatchOptions) {\n return (protoOrDescriptor: any, name: string): any => {\n const { willUpdate } = protoOrDescriptor;\n\n const _options = Object.assign({ waitUntilFirstUpdate: false }, options) as WatchOptions;\n\n protoOrDescriptor.willUpdate = function (changedProps: Map<string, any>) {\n willUpdate.call(this, changedProps);\n\n if (changedProps.has(propName)) {\n const oldValue = changedProps.get(propName);\n const newValue = this[propName];\n\n if (oldValue !== newValue) {\n if (!_options?.waitUntilFirstUpdate || this.hasUpdated) {\n this[name].call(this, oldValue, newValue);\n }\n }\n }\n };\n };\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import type { Keys } from '../internal/types.js';
2
+ export default abstract class DataOperation<T, K extends Keys<T> = Keys<T>> {
3
+ protected resolveValue(record: T, key: K): T[K];
4
+ protected resolveCase<U = T[K]>(value: U, caseSensitive?: boolean): U;
5
+ abstract apply(...args: unknown[]): T[];
6
+ }
@@ -0,0 +1,9 @@
1
+ export default class DataOperation {
2
+ resolveValue(record, key) {
3
+ return record[key];
4
+ }
5
+ resolveCase(value, caseSensitive) {
6
+ return typeof value === 'string' && !caseSensitive ? value.toLowerCase() : value;
7
+ }
8
+ }
9
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/operations/base.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAgB,aAAa;IAC/B,YAAY,CAAC,MAAS,EAAE,GAAM;QACtC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAES,WAAW,CAAW,KAAQ,EAAE,aAAuB;QAC/D,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,aAAa,CAAC,CAAC,CAAE,KAAK,CAAC,WAAW,EAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1F,CAAC;CAGF","sourcesContent":["import type { Keys } from '../internal/types.js';\n\nexport default abstract class DataOperation<T, K extends Keys<T> = Keys<T>> {\n protected resolveValue(record: T, key: K) {\n return record[key];\n }\n\n protected resolveCase<U = T[K]>(value: U, caseSensitive?: boolean) {\n return typeof value === 'string' && !caseSensitive ? (value.toLowerCase() as U) : value;\n }\n\n public abstract apply(...args: unknown[]): T[];\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { FilterOperands } from '../types.js';
2
+ export type BooleanKeys = 'all' | 'true' | 'false' | 'empty' | 'notEmpty';
3
+ export declare const BooleanOperands: Readonly<FilterOperands<boolean, BooleanKeys>>;
@@ -0,0 +1,34 @@
1
+ import { isDefined } from '../../../internal/is-defined.js';
2
+ export const BooleanOperands = Object.freeze({
3
+ all: {
4
+ name: 'all',
5
+ label: 'All',
6
+ unary: true,
7
+ logic: (_) => true,
8
+ },
9
+ true: {
10
+ name: 'true',
11
+ label: 'True',
12
+ unary: true,
13
+ logic: (target) => target === true,
14
+ },
15
+ false: {
16
+ name: 'false',
17
+ label: 'False',
18
+ unary: true,
19
+ logic: (target) => target === false,
20
+ },
21
+ empty: {
22
+ name: 'empty',
23
+ label: 'Empty',
24
+ unary: true,
25
+ logic: (target) => !isDefined(target),
26
+ },
27
+ notEmpty: {
28
+ name: 'notEmpty',
29
+ label: 'Not empty',
30
+ unary: true,
31
+ logic: (target) => isDefined(target),
32
+ },
33
+ });
34
+ //# sourceMappingURL=boolean.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../../src/operations/filter/operands/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAK5D,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAuC;IACjF,GAAG,EAAE;QACH,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI;KACnB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI;KACnC;IACD,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,KAAK;KACpC;IACD,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;KACtC;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC;KACrC;CACF,CAAC,CAAC","sourcesContent":["import { isDefined } from '../../../internal/is-defined.js';\nimport type { FilterOperands } from '../types.js';\n\nexport type BooleanKeys = 'all' | 'true' | 'false' | 'empty' | 'notEmpty';\n\nexport const BooleanOperands = Object.freeze<FilterOperands<boolean, BooleanKeys>>({\n all: {\n name: 'all',\n label: 'All',\n unary: true,\n logic: (_) => true,\n },\n true: {\n name: 'true',\n label: 'True',\n unary: true,\n logic: (target) => target === true,\n },\n false: {\n name: 'false',\n label: 'False',\n unary: true,\n logic: (target) => target === false,\n },\n empty: {\n name: 'empty',\n label: 'Empty',\n unary: true,\n logic: (target) => !isDefined(target),\n },\n notEmpty: {\n name: 'notEmpty',\n label: 'Not empty',\n unary: true,\n logic: (target) => isDefined(target),\n },\n});\n"]}
@@ -0,0 +1,3 @@
1
+ import type { FilterOperands } from '../types.js';
2
+ export type NumberKeys = 'equals' | 'doesNotEqual' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual' | 'empty' | 'notEmpty';
3
+ export declare const NumberOperands: Readonly<FilterOperands<number, NumberKeys>>;
@@ -0,0 +1,52 @@
1
+ import { isDefined } from '../../../internal/is-defined.js';
2
+ export const NumberOperands = Object.freeze({
3
+ equals: {
4
+ name: 'equals',
5
+ label: 'Equals',
6
+ unary: false,
7
+ logic: (target, term) => target === term,
8
+ },
9
+ doesNotEqual: {
10
+ name: 'doesNotEqual',
11
+ label: 'Does not equal',
12
+ unary: false,
13
+ logic: (target, term) => target !== term,
14
+ },
15
+ greaterThan: {
16
+ name: 'greaterThan',
17
+ label: 'Greater than',
18
+ unary: false,
19
+ logic: (target, term) => target > term,
20
+ },
21
+ lessThan: {
22
+ name: 'lessThan',
23
+ label: 'Less than',
24
+ unary: false,
25
+ logic: (target, term) => target < term,
26
+ },
27
+ greaterThanOrEqual: {
28
+ name: 'greaterThanOrEqual',
29
+ label: 'Greater than or equal',
30
+ unary: false,
31
+ logic: (target, term) => target >= term,
32
+ },
33
+ lessThanOrEqual: {
34
+ name: 'lessThanOrEqual',
35
+ label: 'Less than or equal',
36
+ unary: false,
37
+ logic: (target, term) => target <= term,
38
+ },
39
+ empty: {
40
+ name: 'empty',
41
+ label: 'Empty',
42
+ unary: true,
43
+ logic: (target) => !isDefined(target) || Number.isNaN(target),
44
+ },
45
+ notEmpty: {
46
+ name: 'notEmpty',
47
+ label: 'Not empty',
48
+ unary: true,
49
+ logic: (target) => isDefined(target) && !Number.isNaN(target),
50
+ },
51
+ });
52
+ //# sourceMappingURL=number.js.map