@spectric/ui 0.0.21 → 0.0.22

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 (45) hide show
  1. package/dist/components/dialog/dialog.d.ts +1 -0
  2. package/dist/components/pagination/pagination.d.ts +1 -1
  3. package/dist/components/query_bar/QueryBar.d.ts +30 -10
  4. package/dist/components/query_bar/dateTimePopup.d.ts +2 -0
  5. package/dist/components/query_bar/geojsonPopup.d.ts +2 -0
  6. package/dist/components/query_bar/querylanguage/kuery/functions/geospatial.d.ts +19 -0
  7. package/dist/components/query_bar/querylanguage/outputTypes/toCQL.d.ts +2 -1
  8. package/dist/components/query_bar/querylanguage/outputTypes/toMongo.d.ts +6 -1
  9. package/dist/components/symbols.d.ts +6 -0
  10. package/dist/components/table/cell.d.ts +1 -1
  11. package/dist/components/table/table.d.ts +5 -1
  12. package/dist/custom-elements.json +5 -5
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.es.js +4382 -2795
  15. package/dist/index.es.js.map +1 -1
  16. package/dist/index.umd.js +349 -248
  17. package/dist/index.umd.js.map +1 -1
  18. package/dist/style.css +1 -1
  19. package/package.json +6 -1
  20. package/src/components/dialog/dialog.css.ts +29 -29
  21. package/src/components/dialog/dialog.ts +3 -1
  22. package/src/components/input.ts +49 -39
  23. package/src/components/pagination/pagination.ts +167 -113
  24. package/src/components/query_bar/QueryBar.ts +438 -187
  25. package/src/components/query_bar/dateTimePopup.ts +54 -0
  26. package/src/components/query_bar/geojsonPopup.ts +44 -0
  27. package/src/components/query_bar/querylanguage/kuery/ast/_generated_/kuery.js +1836 -2745
  28. package/src/components/query_bar/querylanguage/kuery/ast/ast.ts +15 -13
  29. package/src/components/query_bar/querylanguage/kuery/ast/kuery.peg +92 -126
  30. package/src/components/query_bar/querylanguage/kuery/functions/geospatial.ts +25 -0
  31. package/src/components/query_bar/querylanguage/kuery/functions/index.ts +9 -7
  32. package/src/components/query_bar/querylanguage/outputTypes/toCQL.ts +56 -34
  33. package/src/components/query_bar/querylanguage/outputTypes/toMongo.ts +46 -34
  34. package/src/components/symbols.ts +6 -0
  35. package/src/components/table/__tests__/table.spec.ts +2 -2
  36. package/src/components/table/cell.ts +7 -3
  37. package/src/components/table/header.ts +3 -2
  38. package/src/components/table/table.css +4 -2
  39. package/src/components/table/table.ts +61 -5
  40. package/src/components/table/virtualBody.ts +8 -3
  41. package/src/components/tooltip/popover.ts +263 -225
  42. package/src/stories/Dialog.stories.ts +59 -0
  43. package/src/stories/QueryBar.stories.ts +46 -37
  44. package/src/stories/fixtures/data.ts +195 -36
  45. package/src/stories/table.stories.ts +70 -22
@@ -0,0 +1,54 @@
1
+ import { html } from "lit";
2
+ import { DialogElement } from "../dialog/dialog";
3
+ import { createRef, ref } from "lit/directives/ref.js";
4
+ import { SpectricButton } from "../Button";
5
+ import { LabelValuesOrStrings, toLabelValue } from "./QueryBar";
6
+
7
+ export const DateTimePopup = async (values: LabelValuesOrStrings) => {
8
+ let value: string | undefined;
9
+ let buttonRef = createRef<SpectricButton>();
10
+
11
+ await new Promise((resolve) => {
12
+ let dialog = DialogElement.display(
13
+ {},
14
+ html`
15
+ <div class="query-bar-date-quick-select">
16
+ ${values.map((v) => {
17
+ let labelValue = toLabelValue(v);
18
+ return html`<a
19
+ href="#"
20
+ @click=${(e: MouseEvent) => {
21
+ e.preventDefault();
22
+ value = `"${labelValue.label}"`;
23
+ resolve(value);
24
+ dialog.open = false;
25
+ }}
26
+ >${labelValue.value}</a
27
+ >`;
28
+ })}
29
+ </div>
30
+ <spectric-input
31
+ variant="datetime-local"
32
+ @change=${(e: any) => {
33
+ if (!e.target) {
34
+ return;
35
+ }
36
+ let date = new Date(e.target.value + ":00.000Z").toISOString();
37
+ value = `"${date}"`;
38
+ buttonRef.value!.disabled = value === undefined;
39
+ }}
40
+ ></spectric-input>
41
+ <spectric-button
42
+ ${ref(buttonRef)}
43
+ .disabled=${true}
44
+ @click=${() => {
45
+ resolve(value);
46
+ dialog.open = false;
47
+ }}
48
+ >Submit</spectric-button
49
+ >
50
+ `
51
+ );
52
+ });
53
+ return value;
54
+ };
@@ -0,0 +1,44 @@
1
+ import { html } from "lit";
2
+ import { DialogElement } from "../dialog/dialog";
3
+ import { createRef, ref } from "lit/directives/ref.js";
4
+ import { SpectricButton } from "../Button";
5
+ import { LabelValuesOrStrings, toLabelValue } from "./QueryBar";
6
+
7
+ export const GeoJSONPopup = async (values: LabelValuesOrStrings) => {
8
+ let value: string | undefined;
9
+ let buttonRef = createRef<SpectricButton>();
10
+
11
+ await new Promise((resolve) => {
12
+ let dialog = DialogElement.display(
13
+ {},
14
+ html`
15
+ <div class="query-bar-date-quick-select">
16
+ ${values.map((v) => {
17
+ let labelValue = toLabelValue(v);
18
+ return html`<a
19
+ href="#"
20
+ @click=${(e: MouseEvent) => {
21
+ e.preventDefault();
22
+ value = `"${labelValue.value}"`;
23
+ resolve(value);
24
+ dialog.open = false;
25
+ }}
26
+ >${labelValue.label}</a
27
+ >`;
28
+ })}
29
+ </div>
30
+ <div>TODO DISPLAY MAP with drawing tools HERE!!</div>
31
+ <spectric-button
32
+ ${ref(buttonRef)}
33
+ .disabled=${true}
34
+ @click=${() => {
35
+ resolve(value);
36
+ dialog.open = false;
37
+ }}
38
+ >Submit</spectric-button
39
+ >
40
+ `
41
+ );
42
+ });
43
+ return value;
44
+ };