apex-grid 1.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +16 -0
- package/dist/bundle.js +2069 -0
- package/dist/docs/.nojekyll +1 -0
- package/dist/docs/assets/highlight.css +22 -0
- package/dist/docs/assets/main.js +54 -0
- package/dist/docs/assets/search.js +1 -0
- package/dist/docs/assets/style.css +1257 -0
- package/dist/docs/classes/ApexGrid.html +240 -0
- package/dist/docs/index.html +79 -0
- package/dist/docs/interfaces/ApexCellContext.html +92 -0
- package/dist/docs/interfaces/ApexFilteringEvent.html +78 -0
- package/dist/docs/interfaces/ApexGridEventMap.html +101 -0
- package/dist/docs/interfaces/ApexHeaderContext.html +78 -0
- package/dist/docs/interfaces/ColumnConfiguration.html +168 -0
- package/dist/docs/interfaces/ColumnFilterConfiguration.html +76 -0
- package/dist/docs/interfaces/ColumnSortConfiguration.html +93 -0
- package/dist/docs/interfaces/FilterExpression.html +97 -0
- package/dist/docs/interfaces/GridRemoteConfig.html +78 -0
- package/dist/docs/interfaces/GridSortConfiguration.html +73 -0
- package/dist/docs/interfaces/SortExpression.html +111 -0
- package/dist/docs/modules.html +89 -0
- package/dist/docs/types/DataType.html +63 -0
- package/dist/docs/types/FilterCriteria.html +63 -0
- package/dist/docs/types/Keys.html +68 -0
- package/dist/docs/types/RemoteFilterHook.html +84 -0
- package/dist/docs/types/RemoteSortHook.html +84 -0
- package/dist/docs/types/SortState.html +68 -0
- package/dist/docs/types/SortingDirection.html +65 -0
- package/dist/docs/types/Values.html +68 -0
- package/dist/src/components/cell.d.ts +19 -0
- package/dist/src/components/cell.d.ts.map +1 -0
- package/dist/src/components/cell.js +45 -0
- package/dist/src/components/cell.js.map +1 -0
- package/dist/src/components/filter-row.d.ts +47 -0
- package/dist/src/components/filter-row.d.ts.map +1 -0
- package/dist/src/components/filter-row.js +307 -0
- package/dist/src/components/filter-row.js.map +1 -0
- package/dist/src/components/grid-body.d.ts +12 -0
- package/dist/src/components/grid-body.d.ts.map +1 -0
- package/dist/src/components/grid-body.js +27 -0
- package/dist/src/components/grid-body.js.map +1 -0
- package/dist/src/components/grid.d.ts +183 -0
- package/dist/src/components/grid.d.ts.map +1 -0
- package/dist/src/components/grid.js +303 -0
- package/dist/src/components/grid.js.map +1 -0
- package/dist/src/components/header-row.d.ts +23 -0
- package/dist/src/components/header-row.d.ts.map +1 -0
- package/dist/src/components/header-row.js +77 -0
- package/dist/src/components/header-row.js.map +1 -0
- package/dist/src/components/header.d.ts +23 -0
- package/dist/src/components/header.d.ts.map +1 -0
- package/dist/src/components/header.js +143 -0
- package/dist/src/components/header.js.map +1 -0
- package/dist/src/components/row.d.ts +21 -0
- package/dist/src/components/row.d.ts.map +1 -0
- package/dist/src/components/row.js +64 -0
- package/dist/src/components/row.js.map +1 -0
- package/dist/src/controllers/data-operation.d.ts +18 -0
- package/dist/src/controllers/data-operation.d.ts.map +1 -0
- package/dist/src/controllers/data-operation.js +37 -0
- package/dist/src/controllers/data-operation.js.map +1 -0
- package/dist/src/controllers/dom.d.ts +17 -0
- package/dist/src/controllers/dom.d.ts.map +1 -0
- package/dist/src/controllers/dom.js +31 -0
- package/dist/src/controllers/dom.js.map +1 -0
- package/dist/src/controllers/filter.d.ts +22 -0
- package/dist/src/controllers/filter.d.ts.map +1 -0
- package/dist/src/controllers/filter.js +79 -0
- package/dist/src/controllers/filter.js.map +1 -0
- package/dist/src/controllers/navigation.d.ts +31 -0
- package/dist/src/controllers/navigation.d.ts.map +1 -0
- package/dist/src/controllers/navigation.js +88 -0
- package/dist/src/controllers/navigation.js.map +1 -0
- package/dist/src/controllers/resize.d.ts +28 -0
- package/dist/src/controllers/resize.d.ts.map +1 -0
- package/dist/src/controllers/resize.js +70 -0
- package/dist/src/controllers/resize.js.map +1 -0
- package/dist/src/controllers/sort.d.ts +16 -0
- package/dist/src/controllers/sort.d.ts.map +1 -0
- package/dist/src/controllers/sort.js +90 -0
- package/dist/src/controllers/sort.js.map +1 -0
- package/dist/src/controllers/state.d.ts +22 -0
- package/dist/src/controllers/state.d.ts.map +1 -0
- package/dist/src/controllers/state.js +27 -0
- package/dist/src/controllers/state.js.map +1 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +8 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internal/constants.d.ts +9 -0
- package/dist/src/internal/constants.d.ts.map +1 -0
- package/dist/src/internal/constants.js +19 -0
- package/dist/src/internal/constants.js.map +1 -0
- package/dist/src/internal/icon-registry.d.ts +2 -0
- package/dist/src/internal/icon-registry.d.ts.map +1 -0
- package/dist/src/internal/icon-registry.js +29 -0
- package/dist/src/internal/icon-registry.js.map +1 -0
- package/dist/src/internal/is-defined.d.ts +2 -0
- package/dist/src/internal/is-defined.d.ts.map +1 -0
- package/dist/src/internal/is-defined.js +4 -0
- package/dist/src/internal/is-defined.js.map +1 -0
- package/dist/src/internal/mixins/event-emitter.d.ts +8 -0
- package/dist/src/internal/mixins/event-emitter.d.ts.map +1 -0
- package/dist/src/internal/mixins/event-emitter.js +18 -0
- package/dist/src/internal/mixins/event-emitter.js.map +1 -0
- package/dist/src/internal/normalize-case.d.ts +2 -0
- package/dist/src/internal/normalize-case.d.ts.map +1 -0
- package/dist/src/internal/normalize-case.js +4 -0
- package/dist/src/internal/normalize-case.js.map +1 -0
- package/dist/src/internal/part-map.d.ts +5 -0
- package/dist/src/internal/part-map.d.ts.map +1 -0
- package/dist/src/internal/part-map.js +6 -0
- package/dist/src/internal/part-map.js.map +1 -0
- package/dist/src/internal/tags.d.ts +8 -0
- package/dist/src/internal/tags.d.ts.map +1 -0
- package/dist/src/internal/tags.js +8 -0
- package/dist/src/internal/tags.js.map +1 -0
- package/dist/src/internal/types.d.ts +181 -0
- package/dist/src/internal/types.d.ts.map +1 -0
- package/dist/src/internal/types.js +2 -0
- package/dist/src/internal/types.js.map +1 -0
- package/dist/src/internal/utils.d.ts +10 -0
- package/dist/src/internal/utils.d.ts.map +1 -0
- package/dist/src/internal/utils.js +37 -0
- package/dist/src/internal/utils.js.map +1 -0
- package/dist/src/internal/watch.d.ts +6 -0
- package/dist/src/internal/watch.d.ts.map +1 -0
- package/dist/src/internal/watch.js +19 -0
- package/dist/src/internal/watch.js.map +1 -0
- package/dist/src/operations/base.d.ts +7 -0
- package/dist/src/operations/base.d.ts.map +1 -0
- package/dist/src/operations/base.js +11 -0
- package/dist/src/operations/base.js.map +1 -0
- package/dist/src/operations/filter/operands/base.d.ts +8 -0
- package/dist/src/operations/filter/operands/base.d.ts.map +1 -0
- package/dist/src/operations/filter/operands/base.js +15 -0
- package/dist/src/operations/filter/operands/base.js.map +1 -0
- package/dist/src/operations/filter/operands/boolean.d.ts +11 -0
- package/dist/src/operations/filter/operands/boolean.d.ts.map +1 -0
- package/dist/src/operations/filter/operands/boolean.js +36 -0
- package/dist/src/operations/filter/operands/boolean.js.map +1 -0
- package/dist/src/operations/filter/operands/number.d.ts +14 -0
- package/dist/src/operations/filter/operands/number.d.ts.map +1 -0
- package/dist/src/operations/filter/operands/number.js +51 -0
- package/dist/src/operations/filter/operands/number.js.map +1 -0
- package/dist/src/operations/filter/operands/string.d.ts +14 -0
- package/dist/src/operations/filter/operands/string.d.ts.map +1 -0
- package/dist/src/operations/filter/operands/string.js +52 -0
- package/dist/src/operations/filter/operands/string.js.map +1 -0
- package/dist/src/operations/filter/state.d.ts +17 -0
- package/dist/src/operations/filter/state.d.ts.map +1 -0
- package/dist/src/operations/filter/state.js +42 -0
- package/dist/src/operations/filter/state.js.map +1 -0
- package/dist/src/operations/filter/tree.d.ts +17 -0
- package/dist/src/operations/filter/tree.d.ts.map +1 -0
- package/dist/src/operations/filter/tree.js +44 -0
- package/dist/src/operations/filter/tree.js.map +1 -0
- package/dist/src/operations/filter/types.d.ts +44 -0
- package/dist/src/operations/filter/types.d.ts.map +1 -0
- package/dist/src/operations/filter/types.js +2 -0
- package/dist/src/operations/filter/types.js.map +1 -0
- package/dist/src/operations/filter.d.ts +9 -0
- package/dist/src/operations/filter.d.ts.map +1 -0
- package/dist/src/operations/filter.js +22 -0
- package/dist/src/operations/filter.js.map +1 -0
- package/dist/src/operations/sort/types.d.ts +38 -0
- package/dist/src/operations/sort/types.d.ts.map +1 -0
- package/dist/src/operations/sort/types.js +2 -0
- package/dist/src/operations/sort/types.js.map +1 -0
- package/dist/src/operations/sort.d.ts +10 -0
- package/dist/src/operations/sort.d.ts.map +1 -0
- package/dist/src/operations/sort.js +37 -0
- package/dist/src/operations/sort.js.map +1 -0
- package/dist/src/styles/body-cell/body-cell-styles.d.ts +3 -0
- package/dist/src/styles/body-cell/body-cell-styles.d.ts.map +1 -0
- package/dist/src/styles/body-cell/body-cell-styles.js +70 -0
- package/dist/src/styles/body-cell/body-cell-styles.js.map +1 -0
- package/dist/src/styles/body-row/body-row-styles.d.ts +3 -0
- package/dist/src/styles/body-row/body-row-styles.d.ts.map +1 -0
- package/dist/src/styles/body-row/body-row-styles.js +38 -0
- package/dist/src/styles/body-row/body-row-styles.js.map +1 -0
- package/dist/src/styles/filter-row/filter-row-styles.d.ts +3 -0
- package/dist/src/styles/filter-row/filter-row-styles.d.ts.map +1 -0
- package/dist/src/styles/filter-row/filter-row-styles.js +96 -0
- package/dist/src/styles/filter-row/filter-row-styles.js.map +1 -0
- package/dist/src/styles/grid/themes/light/grid.bootstrap-styles.d.ts +3 -0
- package/dist/src/styles/grid/themes/light/grid.bootstrap-styles.d.ts.map +1 -0
- package/dist/src/styles/grid/themes/light/grid.bootstrap-styles.js +82 -0
- package/dist/src/styles/grid/themes/light/grid.bootstrap-styles.js.map +1 -0
- package/dist/src/styles/grid/themes/light/grid.fluent-styles.d.ts +3 -0
- package/dist/src/styles/grid/themes/light/grid.fluent-styles.d.ts.map +1 -0
- package/dist/src/styles/grid/themes/light/grid.fluent-styles.js +82 -0
- package/dist/src/styles/grid/themes/light/grid.fluent-styles.js.map +1 -0
- package/dist/src/styles/grid/themes/light/grid.indigo-styles.d.ts +3 -0
- package/dist/src/styles/grid/themes/light/grid.indigo-styles.d.ts.map +1 -0
- package/dist/src/styles/grid/themes/light/grid.indigo-styles.js +82 -0
- package/dist/src/styles/grid/themes/light/grid.indigo-styles.js.map +1 -0
- package/dist/src/styles/grid/themes/light/grid.material-styles.d.ts +3 -0
- package/dist/src/styles/grid/themes/light/grid.material-styles.d.ts.map +1 -0
- package/dist/src/styles/grid/themes/light/grid.material-styles.js +82 -0
- package/dist/src/styles/grid/themes/light/grid.material-styles.js.map +1 -0
- package/dist/src/styles/header-cell/header-cell-styles.d.ts +3 -0
- package/dist/src/styles/header-cell/header-cell-styles.d.ts.map +1 -0
- package/dist/src/styles/header-cell/header-cell-styles.js +141 -0
- package/dist/src/styles/header-cell/header-cell-styles.js.map +1 -0
- package/dist/src/styles/header-row/header-row.base-styles.d.ts +3 -0
- package/dist/src/styles/header-row/header-row.base-styles.d.ts.map +1 -0
- package/dist/src/styles/header-row/header-row.base-styles.js +35 -0
- package/dist/src/styles/header-row/header-row.base-styles.js.map +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export class EventEmitterBase extends LitElement {
|
|
3
|
+
addEventListener(type, listener, options) {
|
|
4
|
+
super.addEventListener(type, listener, options);
|
|
5
|
+
}
|
|
6
|
+
removeEventListener(type, listener, options) {
|
|
7
|
+
super.removeEventListener(type, listener, options);
|
|
8
|
+
}
|
|
9
|
+
emitEvent(type, eventInitDict) {
|
|
10
|
+
return this.dispatchEvent(new CustomEvent(type, Object.assign({
|
|
11
|
+
bubbles: true,
|
|
12
|
+
cancelable: false,
|
|
13
|
+
composed: true,
|
|
14
|
+
detail: {},
|
|
15
|
+
}, eventInitDict)));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=event-emitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-emitter.js","sourceRoot":"","sources":["../../../../src/internal/mixins/event-emitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAIjC,MAAM,OAAO,gBAAoB,SAAQ,UAAU;IAMjC,gBAAgB,CAC9B,IAAY,EACZ,QAA4C,EAC5C,OAA2C;QAE3C,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAOe,mBAAmB,CACjC,IAAY,EACZ,QAA4C,EAC5C,OAAwC;QAExC,KAAK,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IACM,SAAS,CACd,IAAO,EACP,aAAkC;QAElC,OAAO,IAAI,CAAC,aAAa,CACvB,IAAI,WAAW,CACb,IAAc,EACd,MAAM,CAAC,MAAM,CACX;YACE,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE;SACX,EACD,aAAa,CACd,CACF,CACF,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { LitElement } from 'lit';\n\nexport type UnpackCustomEvent<T> = T extends CustomEvent<infer U> ? U : never;\n\nexport class EventEmitterBase<E> extends LitElement {\n public override addEventListener<K extends keyof M, M extends E & HTMLElementEventMap>(\n type: K,\n listener: (this: HTMLElement, ev: M[K]) => any,\n options?: boolean | AddEventListenerOptions,\n ): void;\n public override addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void {\n super.addEventListener(type, listener, options);\n }\n\n public override removeEventListener<K extends keyof M, M extends E & HTMLElementEventMap>(\n type: K,\n listener: (this: HTMLElement, ev: M[K]) => any,\n options?: boolean | EventListenerOptions,\n ): void;\n public override removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions,\n ): void {\n super.removeEventListener(type, listener, options);\n }\n public emitEvent<K extends keyof E, D extends UnpackCustomEvent<E[K]>>(\n type: K,\n eventInitDict?: CustomEventInit<D>,\n ): boolean {\n return this.dispatchEvent(\n new CustomEvent<D>(\n type as string,\n Object.assign(\n {\n bubbles: true,\n cancelable: false,\n composed: true,\n detail: {},\n },\n eventInitDict,\n ),\n ),\n );\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-case.d.ts","sourceRoot":"","sources":["../../../src/internal/normalize-case.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO,UAEpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-case.js","sourceRoot":"","sources":["../../../src/internal/normalize-case.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,aAAuB;IACnE,OAAO,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;AACvD,CAAC","sourcesContent":["export function normalizeCase(string: string, caseSensitive?: boolean) {\n return caseSensitive ? string : string.toLowerCase();\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"part-map.d.ts","sourceRoot":"","sources":["../../../src/internal/part-map.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;CACpD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,UAI9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"part-map.js","sourceRoot":"","sources":["../../../src/internal/part-map.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,WAAW,CAAC,KAAmB;IAC7C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;SACtB,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACzB,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC","sourcesContent":["export interface PartNameInfo {\n readonly [name: string]: string | boolean | number;\n}\n\nexport function partNameMap(parts: PartNameInfo) {\n return Object.keys(parts)\n .filter(key => parts[key])\n .join(' ');\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const GRID_TAG: "apex-grid";
|
|
2
|
+
export declare const GRID_BODY_TAG: "apex-grid-body";
|
|
3
|
+
export declare const GRID_HEADER_ROW_TAG: "apex-grid-header-row";
|
|
4
|
+
export declare const GRID_HEADER_TAG: "apex-grid-header";
|
|
5
|
+
export declare const GRID_ROW_TAG: "apex-grid-row";
|
|
6
|
+
export declare const GRID_CELL_TAG: "apex-grid-cell";
|
|
7
|
+
export declare const GRID_FILTER_ROW_TAG: "apex-filter-row";
|
|
8
|
+
//# sourceMappingURL=tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../../src/internal/tags.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,aAAuB,CAAC;AAC7C,eAAO,MAAM,aAAa,kBAA4B,CAAC;AACvD,eAAO,MAAM,mBAAmB,wBAAkC,CAAC;AACnE,eAAO,MAAM,eAAe,oBAA8B,CAAC;AAC3D,eAAO,MAAM,YAAY,iBAA2B,CAAC;AACrD,eAAO,MAAM,aAAa,kBAA4B,CAAC;AACvD,eAAO,MAAM,mBAAmB,mBAA6B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const GRID_TAG = 'apex-grid';
|
|
2
|
+
export const GRID_BODY_TAG = 'apex-grid-body';
|
|
3
|
+
export const GRID_HEADER_ROW_TAG = 'apex-grid-header-row';
|
|
4
|
+
export const GRID_HEADER_TAG = 'apex-grid-header';
|
|
5
|
+
export const GRID_ROW_TAG = 'apex-grid-row';
|
|
6
|
+
export const GRID_CELL_TAG = 'apex-grid-cell';
|
|
7
|
+
export const GRID_FILTER_ROW_TAG = 'apex-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,WAAoB,CAAC;AAC7C,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAyB,CAAC;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,sBAA+B,CAAC;AACnE,MAAM,CAAC,MAAM,eAAe,GAAG,kBAA2B,CAAC;AAC3D,MAAM,CAAC,MAAM,YAAY,GAAG,eAAwB,CAAC;AACrD,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAyB,CAAC;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAA0B,CAAC","sourcesContent":["export const GRID_TAG = 'apex-grid' as const;\nexport const GRID_BODY_TAG = 'apex-grid-body' as const;\nexport const GRID_HEADER_ROW_TAG = 'apex-grid-header-row' as const;\nexport const GRID_HEADER_TAG = 'apex-grid-header' as const;\nexport const GRID_ROW_TAG = 'apex-grid-row' as const;\nexport const GRID_CELL_TAG = 'apex-grid-cell' as const;\nexport const GRID_FILTER_ROW_TAG = 'apex-filter-row' as const;\n"]}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { ReactiveControllerHost, TemplateResult } from 'lit';
|
|
2
|
+
import type ApexGrid from '../components/grid.js';
|
|
3
|
+
import type ApexGridCell from '../components/cell.js';
|
|
4
|
+
import type ApexGridRow from '../components/row.js';
|
|
5
|
+
import type ApexGridHeader from '../components/header.js';
|
|
6
|
+
import type { BaseOperands } from '../operations/filter/operands/base.js';
|
|
7
|
+
import type { SortState } from '../operations/sort/types.js';
|
|
8
|
+
import type { FilterState } from '../operations/filter/state.js';
|
|
9
|
+
export type NavigationState = 'previous' | 'current';
|
|
10
|
+
export type GridHost<T extends object> = ReactiveControllerHost & ApexGrid<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Helper type for resolving keys of type T.
|
|
13
|
+
*/
|
|
14
|
+
export type Keys<T> = keyof T;
|
|
15
|
+
/**
|
|
16
|
+
* Helper type for resolving types of type T.
|
|
17
|
+
*/
|
|
18
|
+
export type Values<T> = T[keyof T];
|
|
19
|
+
export type PropertyType<T extends object, K extends keyof T> = T[K];
|
|
20
|
+
/** The data for the current column. */
|
|
21
|
+
export type DataType = 'number' | 'string' | 'boolean';
|
|
22
|
+
/**
|
|
23
|
+
* Configures the sort behavior for the grid.
|
|
24
|
+
*/
|
|
25
|
+
export interface GridSortConfiguration {
|
|
26
|
+
/**
|
|
27
|
+
* Whether multiple sorting is enabled.
|
|
28
|
+
*/
|
|
29
|
+
multiple: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether tri-state sorting is enabled.
|
|
32
|
+
*/
|
|
33
|
+
triState: boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Extended sort configuration for a column.
|
|
37
|
+
*/
|
|
38
|
+
export interface ColumnSortConfiguration<T extends object> {
|
|
39
|
+
/**
|
|
40
|
+
* Whether the sort operations will be case sensitive.
|
|
41
|
+
*/
|
|
42
|
+
caseSensitive?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Custom comparer function for sort operations for this column.
|
|
45
|
+
*/
|
|
46
|
+
comparer?: (a: Values<T>, b: Values<T>) => number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Extended filter configuration for a column.
|
|
50
|
+
*/
|
|
51
|
+
export interface ColumnFilterConfiguration<T> {
|
|
52
|
+
/**
|
|
53
|
+
* Whether the filter operations will be case sensitive.
|
|
54
|
+
*/
|
|
55
|
+
caseSensitive?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
strategy?: BaseOperands<T>;
|
|
61
|
+
}
|
|
62
|
+
/** Configuration object for grid columns. */
|
|
63
|
+
export interface ColumnConfiguration<T extends object> {
|
|
64
|
+
/**
|
|
65
|
+
* The field for from the data the this column will reference.
|
|
66
|
+
*/
|
|
67
|
+
key: Keys<T>;
|
|
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> | boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Whether filter operation can be applied on the column or not.
|
|
108
|
+
*/
|
|
109
|
+
filter?: ColumnFilterConfiguration<T> | boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Header template callback.
|
|
112
|
+
*/
|
|
113
|
+
headerTemplate?: (params: ApexHeaderContext<T>) => TemplateResult;
|
|
114
|
+
/**
|
|
115
|
+
* Cell template callback.
|
|
116
|
+
*/
|
|
117
|
+
cellTemplate?: (params: ApexCellContext<T>) => TemplateResult;
|
|
118
|
+
}
|
|
119
|
+
export interface ActiveNode<T> {
|
|
120
|
+
column: Keys<T>;
|
|
121
|
+
row: number;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Context object for the column header template callback.
|
|
125
|
+
*/
|
|
126
|
+
export interface ApexHeaderContext<T extends object> {
|
|
127
|
+
/**
|
|
128
|
+
* The header element parent of the template.
|
|
129
|
+
*/
|
|
130
|
+
parent: ApexGridHeader<T>;
|
|
131
|
+
/**
|
|
132
|
+
* The current configuration for the column.
|
|
133
|
+
*/
|
|
134
|
+
column: ColumnConfiguration<T>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Context object for the row cell template callback.
|
|
138
|
+
*/
|
|
139
|
+
export interface ApexCellContext<T extends object> {
|
|
140
|
+
/**
|
|
141
|
+
* The cell element parent of the template.
|
|
142
|
+
*/
|
|
143
|
+
parent: ApexGridCell<T>;
|
|
144
|
+
/**
|
|
145
|
+
* The row element containing the cell.
|
|
146
|
+
*/
|
|
147
|
+
row: ApexGridRow<T>;
|
|
148
|
+
/**
|
|
149
|
+
* The current configuration for the column.
|
|
150
|
+
*/
|
|
151
|
+
column: ColumnConfiguration<T>;
|
|
152
|
+
/**
|
|
153
|
+
* The value from the data source for this cell.
|
|
154
|
+
*/
|
|
155
|
+
value: Values<T>;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Remote sort callback function.
|
|
159
|
+
*
|
|
160
|
+
* The callback is passed the current data view state as well as the current sort state configuration of the grid.
|
|
161
|
+
*
|
|
162
|
+
*/
|
|
163
|
+
export type RemoteSortHook<T> = (data: T[], state: SortState<T>) => T[] | Promise<T[]>;
|
|
164
|
+
/**
|
|
165
|
+
* Remote filter callback function.
|
|
166
|
+
*
|
|
167
|
+
* The callback is passed the current data view state as well as the current filter state configuration of the grid.
|
|
168
|
+
*/
|
|
169
|
+
export type RemoteFilterHook<T> = (data: T[], state: FilterState<T>) => T[] | Promise<T[]>;
|
|
170
|
+
/** Configuration for grid remote operations. */
|
|
171
|
+
export interface GridRemoteConfig<T> {
|
|
172
|
+
/**
|
|
173
|
+
* Callback for remote sorting.
|
|
174
|
+
*/
|
|
175
|
+
sort?: RemoteSortHook<T>;
|
|
176
|
+
/**
|
|
177
|
+
* Callback for remote filtering.
|
|
178
|
+
*/
|
|
179
|
+
filter?: RemoteFilterHook<T>;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/internal/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/internal/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactiveControllerHost, TemplateResult } from 'lit';\nimport type ApexGrid from '../components/grid.js';\nimport type ApexGridCell from '../components/cell.js';\nimport type ApexGridRow from '../components/row.js';\nimport type ApexGridHeader from '../components/header.js';\nimport type { BaseOperands } from '../operations/filter/operands/base.js';\nimport type { SortState } from '../operations/sort/types.js';\nimport type { FilterState } from '../operations/filter/state.js';\n\nexport type NavigationState = 'previous' | 'current';\nexport type GridHost<T extends object> = ReactiveControllerHost & ApexGrid<T>;\n\n/**\n * Helper type for resolving keys of type T.\n */\nexport type Keys<T> = keyof T;\n/**\n * Helper type for resolving types of type T.\n */\nexport type Values<T> = T[keyof T];\n\nexport type PropertyType<T extends object, K extends keyof T> = T[K];\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 ColumnSortConfiguration<T extends object> {\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?: (a: Values<T>, b: Values<T>) => number;\n}\n\n/**\n * Extended filter configuration for a column.\n */\nexport interface ColumnFilterConfiguration<T> {\n /**\n * Whether the filter operations will be case sensitive.\n */\n caseSensitive?: boolean;\n /**\n *\n *\n */\n strategy?: BaseOperands<T>;\n}\n\n/** Configuration object for grid columns. */\nexport interface ColumnConfiguration<T extends object> {\n /**\n * The field for from the data the this column will reference.\n */\n key: Keys<T>;\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> | boolean;\n /**\n * Whether filter operation can be applied on the column or not.\n */\n filter?: ColumnFilterConfiguration<T> | boolean;\n /**\n * Header template callback.\n */\n headerTemplate?: (params: ApexHeaderContext<T>) => TemplateResult;\n /**\n * Cell template callback.\n */\n cellTemplate?: (params: ApexCellContext<T>) => TemplateResult;\n}\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 ApexHeaderContext<T extends object> {\n /**\n * The header element parent of the template.\n */\n parent: ApexGridHeader<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 ApexCellContext<T extends object> {\n /**\n * The cell element parent of the template.\n */\n parent: ApexGridCell<T>;\n /**\n * The row element containing the cell.\n */\n row: ApexGridRow<T>;\n /**\n * The current configuration for the column.\n */\n column: ColumnConfiguration<T>;\n /**\n * The value from the data source for this cell.\n */\n value: Values<T>;\n}\n\n/**\n * Remote sort callback function.\n *\n * The callback is passed the current data view state as well as the current sort state configuration of the grid.\n *\n */\nexport type RemoteSortHook<T> = (data: T[], state: SortState<T>) => T[] | Promise<T[]>;\n/**\n * Remote filter callback function.\n *\n * The callback is passed the current data view state as well as the current filter state configuration of the grid.\n */\nexport type RemoteFilterHook<T> = (data: T[], state: FilterState<T>) => T[] | Promise<T[]>;\n\n/** Configuration for grid remote operations. */\nexport interface GridRemoteConfig<T> {\n /**\n * Callback for remote sorting.\n */\n sort?: RemoteSortHook<T>;\n /**\n * Callback for remote filtering.\n */\n filter?: RemoteFilterHook<T>;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
import type { StyleInfo } from 'lit/directives/style-map.js';
|
|
5
|
+
import type { ColumnConfiguration, GridHost } from './types.js';
|
|
6
|
+
export declare function applyColumnWidths<T extends object>(columns: Array<ColumnConfiguration<T>>): StyleInfo;
|
|
7
|
+
export declare function autoGenerateColumns<T extends object>(grid: GridHost<T>): void;
|
|
8
|
+
export declare function asArray<T>(value: T | T[]): T[];
|
|
9
|
+
export declare function getFilterOperandsFor<T extends object>(column: ColumnConfiguration<T>): BooleanOperands<T> | NumberOperands<T> | StringOperands<T>;
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/internal/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAY,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG1E,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,OAAO,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,GACrC,SAAS,CAOX;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,QAUtE;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,OAExC;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,8DAUpF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
// TODO: Revise if this is needed
|
|
5
|
+
export function applyColumnWidths(columns) {
|
|
6
|
+
return {
|
|
7
|
+
'grid-template-columns': columns
|
|
8
|
+
.filter(each => !each.hidden)
|
|
9
|
+
.map(({ width }) => width !== null && width !== void 0 ? width : 'minmax(136px, 1fr)')
|
|
10
|
+
.join(' '),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function autoGenerateColumns(grid) {
|
|
14
|
+
var _a;
|
|
15
|
+
if (grid.autoGenerate && grid.columns.length < 1) {
|
|
16
|
+
const record = (_a = grid.data[0]) !== null && _a !== void 0 ? _a : {};
|
|
17
|
+
grid.columns = Object.entries(record).map(([key, value]) => {
|
|
18
|
+
const type = typeof value === 'boolean' ? 'boolean' : typeof value === 'number' ? 'number' : 'string';
|
|
19
|
+
return { key, type };
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function asArray(value) {
|
|
24
|
+
return Array.isArray(value) ? value : [value];
|
|
25
|
+
}
|
|
26
|
+
export function getFilterOperandsFor(column) {
|
|
27
|
+
// Check for custom class in the filter config
|
|
28
|
+
switch (column.type) {
|
|
29
|
+
case 'boolean':
|
|
30
|
+
return new BooleanOperands();
|
|
31
|
+
case 'number':
|
|
32
|
+
return new NumberOperands();
|
|
33
|
+
default:
|
|
34
|
+
return new StringOperands();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/internal/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAKzE,iCAAiC;AACjC,MAAM,UAAU,iBAAiB,CAC/B,OAAsC;IAEtC,OAAO;QACL,uBAAuB,EAAE,OAAO;aAC7B,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;aAC5B,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,oBAAoB,CAAC;aACjD,IAAI,CAAC,GAAG,CAAC;KACb,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAmB,IAAiB;;IACrE,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QAChD,MAAM,MAAM,GAAG,MAAA,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAC;QAElC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YACzD,MAAM,IAAI,GACR,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;YAC3F,OAAO,EAAE,GAAG,EAAE,IAAI,EAA4B,CAAC;QACjD,CAAC,CAAC,CAAC;KACJ;AACH,CAAC;AAED,MAAM,UAAU,OAAO,CAAI,KAAc;IACvC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAmB,MAA8B;IACnF,8CAA8C;IAC9C,QAAQ,MAAM,CAAC,IAAI,EAAE;QACnB,KAAK,SAAS;YACZ,OAAO,IAAI,eAAe,EAAK,CAAC;QAClC,KAAK,QAAQ;YACX,OAAO,IAAI,cAAc,EAAK,CAAC;QACjC;YACE,OAAO,IAAI,cAAc,EAAK,CAAC;KAClC;AACH,CAAC","sourcesContent":["import { BooleanOperands } from '../operations/filter/operands/boolean.js';\nimport { NumberOperands } from '../operations/filter/operands/number.js';\nimport { StringOperands } from '../operations/filter/operands/string.js';\n\nimport type { StyleInfo } from 'lit/directives/style-map.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 new BooleanOperands<T>();\n case 'number':\n return new NumberOperands<T>();\n default:\n return new StringOperands<T>();\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/internal/watch.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,wBAAgB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,uBACjC,GAAG,QAAQ,MAAM,KAAG,GAAG,CAoBnD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function watch(propName, options) {
|
|
2
|
+
return (protoOrDescriptor, name) => {
|
|
3
|
+
const { willUpdate } = protoOrDescriptor;
|
|
4
|
+
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 === null || options === void 0 ? void 0 : 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,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,KAAK,EAAE,EAAE,OAAO,CAAiB,CAAC;QAElF,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;gBAC9B,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;oBACzB,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,oBAAoB,CAAA,IAAI,IAAI,CAAC,UAAU,EAAE;wBACrD,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;qBAC3C;iBACF;aACF;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 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,7 @@
|
|
|
1
|
+
import type { Keys, Values } from '../internal/types.js';
|
|
2
|
+
export default abstract class DataOperation<T> {
|
|
3
|
+
protected resolveValue(record: T, key: Keys<T>): T[keyof T];
|
|
4
|
+
protected resolveCase(value: Values<T>, caseSensitive?: boolean): Values<T>;
|
|
5
|
+
abstract apply(...args: unknown[]): T[];
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/operations/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,aAAa,CAAC,CAAC;IAC3C,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IAI9C,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE,OAAO;aAM/C,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE;CAC/C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default class DataOperation {
|
|
2
|
+
resolveValue(record, key) {
|
|
3
|
+
return record[key];
|
|
4
|
+
}
|
|
5
|
+
resolveCase(value, caseSensitive) {
|
|
6
|
+
return typeof value === 'string' && !caseSensitive
|
|
7
|
+
? value.toLowerCase()
|
|
8
|
+
: value;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# 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,GAAY;QAC5C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;IAES,WAAW,CAAC,KAAgB,EAAE,aAAuB;QAC7D,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,aAAa;YAChD,CAAC,CAAE,KAAK,CAAC,WAAW,EAA2B;YAC/C,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC;CAGF","sourcesContent":["import type { Keys, Values } from '../internal/types.js';\n\nexport default abstract class DataOperation<T> {\n protected resolveValue(record: T, key: Keys<T>) {\n return record[key];\n }\n\n protected resolveCase(value: Values<T>, caseSensitive?: boolean) {\n return typeof value === 'string' && !caseSensitive\n ? (value.toLowerCase() as unknown as Values<T>)\n : value;\n }\n\n public abstract apply(...args: unknown[]): T[];\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FilterOperation } from '../types.js';
|
|
2
|
+
export declare abstract class BaseOperands<T, Type = any> {
|
|
3
|
+
get(condition: keyof this): FilterOperation<T, Type>;
|
|
4
|
+
abstract get default(): FilterOperation<T, Type>;
|
|
5
|
+
protected conditions(): string[];
|
|
6
|
+
[Symbol.iterator](): Generator<string, void, unknown>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../src/operations/filter/operands/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,8BAAsB,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,GAAG;IACvC,GAAG,CAAC,SAAS,EAAE,MAAM,IAAI;IAIhC,aAAoB,OAAO,IAAI,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAExD,SAAS,CAAC,UAAU;IAIZ,CAAC,MAAM,CAAC,QAAQ,CAAC;CAM1B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class BaseOperands {
|
|
2
|
+
get(condition) {
|
|
3
|
+
return this[condition];
|
|
4
|
+
}
|
|
5
|
+
conditions() {
|
|
6
|
+
return Object.keys(this).filter(key => key !== 'get' && key !== 'default');
|
|
7
|
+
}
|
|
8
|
+
*[Symbol.iterator]() {
|
|
9
|
+
const result = this.conditions();
|
|
10
|
+
for (const each of result) {
|
|
11
|
+
yield each;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../src/operations/filter/operands/base.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,YAAY;IACzB,GAAG,CAAC,SAAqB;QAC9B,OAAO,IAAI,CAAC,SAAS,CAA6B,CAAC;IACrD,CAAC;IAIS,UAAU;QAClB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,KAAK,IAAI,GAAG,KAAK,SAAS,CAAC,CAAC;IAC7E,CAAC;IAEM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACjC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE;YACzB,MAAM,IAAI,CAAC;SACZ;IACH,CAAC;CACF","sourcesContent":["import type { FilterOperation } from '../types.js';\n\nexport abstract class BaseOperands<T, Type = any> {\n public get(condition: keyof this) {\n return this[condition] as FilterOperation<T, Type>;\n }\n\n public abstract get default(): FilterOperation<T, Type>;\n\n protected conditions() {\n return Object.keys(this).filter(key => key !== 'get' && key !== 'default');\n }\n\n public *[Symbol.iterator]() {\n const result = this.conditions();\n for (const each of result) {\n yield each;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseOperands } from './base.js';
|
|
2
|
+
import type { FilterOperation } from '../types.js';
|
|
3
|
+
export declare class BooleanOperands<T> extends BaseOperands<T, boolean> {
|
|
4
|
+
get default(): FilterOperation<T, boolean>;
|
|
5
|
+
all: FilterOperation<T, boolean>;
|
|
6
|
+
true: FilterOperation<T, boolean>;
|
|
7
|
+
false: FilterOperation<T, boolean>;
|
|
8
|
+
empty: FilterOperation<T, boolean>;
|
|
9
|
+
notEmpty: FilterOperation<T, boolean>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=boolean.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../../../../src/operations/filter/operands/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,qBAAa,eAAe,CAAC,CAAC,CAAE,SAAQ,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC;IAC9D,IAAoB,OAAO,gCAE1B;IAEM,GAAG,EAAE,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC,CAIrC;IAEK,IAAI,EAAE,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC,CAItC;IAEK,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC,CAIvC;IAEK,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC,CAIvC;IAEK,QAAQ,EAAE,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC,CAI1C;CACH"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BaseOperands } from './base.js';
|
|
2
|
+
import { isDefined } from '../../../internal/is-defined.js';
|
|
3
|
+
export class BooleanOperands extends BaseOperands {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.all = {
|
|
7
|
+
name: 'all',
|
|
8
|
+
unary: true,
|
|
9
|
+
logic: _ => true,
|
|
10
|
+
};
|
|
11
|
+
this.true = {
|
|
12
|
+
name: 'true',
|
|
13
|
+
unary: true,
|
|
14
|
+
logic: target => target === true,
|
|
15
|
+
};
|
|
16
|
+
this.false = {
|
|
17
|
+
name: 'false',
|
|
18
|
+
unary: true,
|
|
19
|
+
logic: target => target === false,
|
|
20
|
+
};
|
|
21
|
+
this.empty = {
|
|
22
|
+
name: 'empty',
|
|
23
|
+
unary: true,
|
|
24
|
+
logic: target => !isDefined(target),
|
|
25
|
+
};
|
|
26
|
+
this.notEmpty = {
|
|
27
|
+
name: 'nonEmpty',
|
|
28
|
+
unary: true,
|
|
29
|
+
logic: target => isDefined(target),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
get default() {
|
|
33
|
+
return this.all;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# 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,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,MAAM,OAAO,eAAmB,SAAQ,YAAwB;IAAhE;;QAKS,QAAG,GAAgC;YACxC,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI;SACjB,CAAC;QAEK,SAAI,GAAgC;YACzC,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,KAAK,IAAI;SACjC,CAAC;QAEK,UAAK,GAAgC;YAC1C,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,KAAK,KAAK;SAClC,CAAC;QAEK,UAAK,GAAgC;YAC1C,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;SACpC,CAAC;QAEK,aAAQ,GAAgC;YAC7C,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC;SACnC,CAAC;IACJ,CAAC;IAjCC,IAAoB,OAAO;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CA+BF","sourcesContent":["import { BaseOperands } from './base.js';\nimport { isDefined } from '../../../internal/is-defined.js';\nimport type { FilterOperation } from '../types.js';\n\nexport class BooleanOperands<T> extends BaseOperands<T, boolean> {\n public override get default() {\n return this.all;\n }\n\n public all: FilterOperation<T, boolean> = {\n name: 'all',\n unary: true,\n logic: _ => true,\n };\n\n public true: FilterOperation<T, boolean> = {\n name: 'true',\n unary: true,\n logic: target => target === true,\n };\n\n public false: FilterOperation<T, boolean> = {\n name: 'false',\n unary: true,\n logic: target => target === false,\n };\n\n public empty: FilterOperation<T, boolean> = {\n name: 'empty',\n unary: true,\n logic: target => !isDefined(target),\n };\n\n public notEmpty: FilterOperation<T, boolean> = {\n name: 'nonEmpty',\n unary: true,\n logic: target => isDefined(target),\n };\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseOperands } from './base.js';
|
|
2
|
+
import type { FilterOperation } from '../types.js';
|
|
3
|
+
export declare class NumberOperands<T> extends BaseOperands<T, number> {
|
|
4
|
+
get default(): FilterOperation<T, number>;
|
|
5
|
+
equals: FilterOperation<T, number>;
|
|
6
|
+
doesNotEqual: FilterOperation<T, number>;
|
|
7
|
+
greaterThan: FilterOperation<T, number>;
|
|
8
|
+
lessThan: FilterOperation<T, number>;
|
|
9
|
+
greaterThanOrEqual: FilterOperation<T, number>;
|
|
10
|
+
lessThanOrEqual: FilterOperation<T, number>;
|
|
11
|
+
empty: FilterOperation<T, number>;
|
|
12
|
+
notEmpty: FilterOperation<T, number>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=number.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../../../src/operations/filter/operands/number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,qBAAa,cAAc,CAAC,CAAC,CAAE,SAAQ,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC;IAC5D,IAAoB,OAAO,+BAE1B;IAEM,MAAM,EAAE,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,CAIvC;IAEK,YAAY,EAAE,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,CAI7C;IAEK,WAAW,EAAE,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,CAI5C;IAEK,QAAQ,EAAE,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,CAIzC;IAEK,kBAAkB,EAAE,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,CAInD;IAEK,eAAe,EAAE,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,CAIhD;IAEK,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,CAItC;IAEK,QAAQ,EAAE,eAAe,CAAC,CAAC,EAAE,MAAM,CAAC,CAIzC;CACH"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BaseOperands } from './base.js';
|
|
2
|
+
import { isDefined } from '../../../internal/is-defined.js';
|
|
3
|
+
export class NumberOperands extends BaseOperands {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.equals = {
|
|
7
|
+
name: 'equals',
|
|
8
|
+
unary: false,
|
|
9
|
+
logic: (target, searchTerm) => target === searchTerm,
|
|
10
|
+
};
|
|
11
|
+
this.doesNotEqual = {
|
|
12
|
+
name: 'doesNotEqual',
|
|
13
|
+
unary: false,
|
|
14
|
+
logic: (target, searchTerm) => target !== searchTerm,
|
|
15
|
+
};
|
|
16
|
+
this.greaterThan = {
|
|
17
|
+
name: 'greaterThan',
|
|
18
|
+
unary: false,
|
|
19
|
+
logic: (target, searchTerm) => target > searchTerm,
|
|
20
|
+
};
|
|
21
|
+
this.lessThan = {
|
|
22
|
+
name: 'lessThan',
|
|
23
|
+
unary: false,
|
|
24
|
+
logic: (target, searchTerm) => target < searchTerm,
|
|
25
|
+
};
|
|
26
|
+
this.greaterThanOrEqual = {
|
|
27
|
+
name: 'greaterThanOrEqual',
|
|
28
|
+
unary: false,
|
|
29
|
+
logic: (target, searchTerm) => target >= searchTerm,
|
|
30
|
+
};
|
|
31
|
+
this.lessThanOrEqual = {
|
|
32
|
+
name: 'lessThanOrEqual',
|
|
33
|
+
unary: false,
|
|
34
|
+
logic: (target, searchTerm) => target <= searchTerm,
|
|
35
|
+
};
|
|
36
|
+
this.empty = {
|
|
37
|
+
name: 'empty',
|
|
38
|
+
unary: true,
|
|
39
|
+
logic: target => !isDefined(target) || isNaN(target),
|
|
40
|
+
};
|
|
41
|
+
this.notEmpty = {
|
|
42
|
+
name: 'notEmpty',
|
|
43
|
+
unary: true,
|
|
44
|
+
logic: target => isDefined(target) && !isNaN(target),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
get default() {
|
|
48
|
+
return this.equals;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=number.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../../../src/operations/filter/operands/number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAG5D,MAAM,OAAO,cAAkB,SAAQ,YAAuB;IAA9D;;QAKS,WAAM,GAA+B;YAC1C,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,MAAM,KAAK,UAAU;SACrD,CAAC;QAEK,iBAAY,GAA+B;YAChD,IAAI,EAAE,cAAc;YACpB,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,MAAM,KAAK,UAAU;SACrD,CAAC;QAEK,gBAAW,GAA+B;YAC/C,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,MAAM,GAAG,UAAU;SACnD,CAAC;QAEK,aAAQ,GAA+B;YAC5C,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,MAAM,GAAG,UAAU;SACnD,CAAC;QAEK,uBAAkB,GAA+B;YACtD,IAAI,EAAE,oBAAoB;YAC1B,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,MAAM,IAAI,UAAU;SACpD,CAAC;QAEK,oBAAe,GAA+B;YACnD,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,MAAM,IAAI,UAAU;SACpD,CAAC;QAEK,UAAK,GAA+B;YACzC,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC;SACrD,CAAC;QAEK,aAAQ,GAA+B;YAC5C,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;SACrD,CAAC;IACJ,CAAC;IAnDC,IAAoB,OAAO;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CAiDF","sourcesContent":["import { BaseOperands } from './base.js';\nimport { isDefined } from '../../../internal/is-defined.js';\nimport type { FilterOperation } from '../types.js';\n\nexport class NumberOperands<T> extends BaseOperands<T, number> {\n public override get default() {\n return this.equals;\n }\n\n public equals: FilterOperation<T, number> = {\n name: 'equals',\n unary: false,\n logic: (target, searchTerm) => target === searchTerm,\n };\n\n public doesNotEqual: FilterOperation<T, number> = {\n name: 'doesNotEqual',\n unary: false,\n logic: (target, searchTerm) => target !== searchTerm,\n };\n\n public greaterThan: FilterOperation<T, number> = {\n name: 'greaterThan',\n unary: false,\n logic: (target, searchTerm) => target > searchTerm,\n };\n\n public lessThan: FilterOperation<T, number> = {\n name: 'lessThan',\n unary: false,\n logic: (target, searchTerm) => target < searchTerm,\n };\n\n public greaterThanOrEqual: FilterOperation<T, number> = {\n name: 'greaterThanOrEqual',\n unary: false,\n logic: (target, searchTerm) => target >= searchTerm,\n };\n\n public lessThanOrEqual: FilterOperation<T, number> = {\n name: 'lessThanOrEqual',\n unary: false,\n logic: (target, searchTerm) => target <= searchTerm,\n };\n\n public empty: FilterOperation<T, number> = {\n name: 'empty',\n unary: true,\n logic: target => !isDefined(target) || isNaN(target),\n };\n\n public notEmpty: FilterOperation<T, number> = {\n name: 'notEmpty',\n unary: true,\n logic: target => isDefined(target) && !isNaN(target),\n };\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseOperands } from '../operands/base.js';
|
|
2
|
+
import type { FilterOperation } from '../types.js';
|
|
3
|
+
export declare class StringOperands<T> extends BaseOperands<T, string> {
|
|
4
|
+
get default(): FilterOperation<T, string>;
|
|
5
|
+
contains: FilterOperation<T, string>;
|
|
6
|
+
doesNotContain: FilterOperation<T, string>;
|
|
7
|
+
startsWith: FilterOperation<T, string>;
|
|
8
|
+
endsWith: FilterOperation<T, string>;
|
|
9
|
+
equals: FilterOperation<T, string>;
|
|
10
|
+
doesNotEqual: FilterOperation<T, string>;
|
|
11
|
+
empty: FilterOperation<T, string>;
|
|
12
|
+
notEmpty: FilterOperation<T, string>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=string.d.ts.map
|