@spectric/ui 0.0.21 → 0.0.23

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 (46) 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 +14 -1
  12. package/dist/custom-elements.json +6 -6
  13. package/dist/index.d.ts +4 -0
  14. package/dist/index.es.js +4405 -2803
  15. package/dist/index.es.js.map +1 -1
  16. package/dist/index.umd.js +361 -252
  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.css +5 -0
  23. package/src/components/input.ts +50 -41
  24. package/src/components/pagination/pagination.ts +167 -113
  25. package/src/components/query_bar/QueryBar.ts +438 -187
  26. package/src/components/query_bar/dateTimePopup.ts +54 -0
  27. package/src/components/query_bar/geojsonPopup.ts +44 -0
  28. package/src/components/query_bar/querylanguage/kuery/ast/_generated_/kuery.js +1836 -2745
  29. package/src/components/query_bar/querylanguage/kuery/ast/ast.ts +15 -13
  30. package/src/components/query_bar/querylanguage/kuery/ast/kuery.peg +92 -126
  31. package/src/components/query_bar/querylanguage/kuery/functions/geospatial.ts +25 -0
  32. package/src/components/query_bar/querylanguage/kuery/functions/index.ts +9 -7
  33. package/src/components/query_bar/querylanguage/outputTypes/toCQL.ts +56 -34
  34. package/src/components/query_bar/querylanguage/outputTypes/toMongo.ts +46 -34
  35. package/src/components/symbols.ts +6 -0
  36. package/src/components/table/__tests__/table.spec.ts +2 -2
  37. package/src/components/table/cell.ts +28 -11
  38. package/src/components/table/header.ts +3 -2
  39. package/src/components/table/table.css +11 -4
  40. package/src/components/table/table.ts +75 -5
  41. package/src/components/table/virtualBody.ts +8 -3
  42. package/src/components/tooltip/popover.ts +263 -225
  43. package/src/stories/Dialog.stories.ts +59 -0
  44. package/src/stories/QueryBar.stories.ts +46 -37
  45. package/src/stories/fixtures/data.ts +229 -37
  46. package/src/stories/table.stories.ts +77 -29
@@ -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
+ };