@pie-element/charting 13.0.4-next.20261011174919 → 13.0.4

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.
@@ -1,43 +1,20 @@
1
+ import { type DeleteDone, type ImageHandler, type SoundHandler } from '@pie-element/shared-configure-events';
2
+ import { type AuthorModel } from './configure.js';
3
+ import type { ChartingConfiguration, ChartingModel } from '../types.js';
1
4
  export default class GraphLinesConfigure extends HTMLElement {
2
- static createDefaultModel: (model?: {}) => {
3
- addCategoryEnabled: boolean;
4
- changeAddCategoryEnabled: boolean;
5
- changeEditableEnabled: boolean;
6
- changeInteractiveEnabled: boolean;
7
- chartType: string;
8
- correctAnswer: {};
9
- data: never[];
10
- domain: {};
11
- graph: {
12
- width: number;
13
- height: number;
14
- };
15
- prompt: string;
16
- promptEnabled: boolean;
17
- range: {
18
- label: string;
19
- max: number;
20
- min: number;
21
- labelStep: number;
22
- };
23
- rationale: string;
24
- rationaleEnabled: boolean;
25
- scoringType: string;
26
- studentInstructionsEnabled: boolean;
27
- studentNewCategoryDefaultLabel: string;
28
- teacherInstructions: string;
29
- teacherInstructionsEnabled: boolean;
30
- title: string;
31
- };
5
+ private _root;
6
+ private _model;
7
+ private _configuration;
8
+ static createDefaultModel: (model?: Partial<ChartingModel>) => AuthorModel;
32
9
  constructor();
33
- set model(m: any);
34
- set configuration(c: any);
35
- onModelChanged(model: any): void;
36
- onConfigurationChanged(config: any): void;
37
- insertImage(handler: any): void;
38
- onDeleteImage(src: any, done: any): void;
39
- insertSound(handler: any): void;
40
- onDeleteSound(src: any, done: any): void;
10
+ set model(m: Partial<ChartingModel>);
11
+ set configuration(c: ChartingConfiguration);
12
+ onModelChanged(model: AuthorModel): void;
13
+ onConfigurationChanged(config: ChartingConfiguration): void;
14
+ insertImage(handler: ImageHandler): void;
15
+ onDeleteImage(src: string, done: DeleteDone): void;
16
+ insertSound(handler: SoundHandler): void;
17
+ onDeleteSound(src: string, done: DeleteDone): void;
41
18
  _render(): void;
42
19
  connectedCallback(): void;
43
20
  disconnectedCallback(): void;
@@ -7,6 +7,9 @@ import a from "debug";
7
7
  import { DeleteImageEvent as o, DeleteSoundEvent as s, InsertImageEvent as c, InsertSoundEvent as l, ModelUpdatedEvent as u } from "@pie-element/shared-configure-events";
8
8
  //#region src/author/index.ts
9
9
  var d = a("pie-elements:graphing:configure"), f = class a extends HTMLElement {
10
+ _root;
11
+ _model;
12
+ _configuration;
10
13
  static createDefaultModel = (e = {}) => ({
11
14
  ...t.model,
12
15
  ...e
@@ -22,10 +25,15 @@ var d = a("pie-elements:graphing:configure"), f = class a extends HTMLElement {
22
25
  ...t.configuration,
23
26
  ...e
24
27
  };
25
- this._configuration = n, n?.language?.enabled ? n?.languageChoices?.options?.length && (this._model.language = n?.languageChoices.options[0].value) : n.language.settings && this._model.language ? (this._configuration.language.enabled = !0, (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) && (this._configuration.languageChoices.options = []), this._configuration.languageChoices.options.find((e) => e.value === this._model.language) || this._configuration.languageChoices.options.push({
26
- value: this._model.language,
27
- label: this._model.language
28
- })) : delete this._model.language, this._render();
28
+ if (this._configuration = n, n?.language?.enabled) n?.languageChoices?.options?.length && (this._model.language = n?.languageChoices.options[0].value);
29
+ else if (n.language.settings && this._model.language) {
30
+ let e = this._model.language, t = n.languageChoices;
31
+ n.language.enabled = !0, (!t.options || !t.options.length) && (t.options = []), t.options.find((t) => t.value === e) || t.options.push({
32
+ value: e,
33
+ label: e
34
+ });
35
+ } else delete this._model.language;
36
+ this._render();
29
37
  }
30
38
  onModelChanged(e) {
31
39
  this._model = e, this._render(), d("[onModelChanged]: ", this._model), this.dispatchEvent(new u(this._model));
@@ -1911,15 +1911,12 @@ var Xn = class extends K.Component {
1911
1911
  }), er = (e) => typeof e == "string" ? {
1912
1912
  label: e,
1913
1913
  value: e
1914
- } : e, tr = function() {
1915
- let [e, t, n = !1] = Array.prototype.slice.call(arguments);
1916
- return {
1917
- type: "radio",
1918
- label: e,
1919
- choices: t && t.map((e) => er(e)),
1920
- isConfigProperty: n
1921
- };
1922
- }, nr = (e, t, n = !1) => ({
1914
+ } : e, tr = (e, t, n = !1) => ({
1915
+ type: "radio",
1916
+ label: e,
1917
+ choices: t && t.map((e) => er(e)),
1918
+ isConfigProperty: n
1919
+ }), nr = (e, t, n = !1) => ({
1923
1920
  type: "dropdown",
1924
1921
  label: e,
1925
1922
  choices: t,
@@ -2770,15 +2767,6 @@ var Dr = class e extends CustomEvent {
2770
2767
  E.DotPlot(),
2771
2768
  E.LinePlot()
2772
2769
  ], ui = class extends K.Component {
2773
- static propTypes = {
2774
- onModelChanged: Z.default.func,
2775
- onConfigurationChanged: Z.default.func,
2776
- imageSupport: Z.default.object,
2777
- uploadSoundSupport: Z.default.object,
2778
- model: Z.default.object.isRequired,
2779
- configuration: Z.default.object.isRequired,
2780
- chartingOptions: Z.default.object
2781
- };
2782
2770
  constructor(e) {
2783
2771
  super(e);
2784
2772
  let { range: t = {}, graph: n } = e.model || {}, r = { range: Qr(t, n.height, !0) }, i = { range: $r(t.step || 1) };
@@ -2807,10 +2795,10 @@ var Dr = class e extends CustomEvent {
2807
2795
  let { model: t, onModelChanged: n } = this.props, { gridValues: r, labelValues: i } = this.state, a = {
2808
2796
  ...t,
2809
2797
  ...e
2810
- }, { graph: o, range: s } = a, c = {}, l = {}, u = ei(s, o.height, r.range, i.range);
2811
- c.range = u.gridValues, l.range = u.labelValues, this.setState({
2812
- gridValues: c,
2813
- labelValues: l
2798
+ }, { graph: o, range: s } = a, c = ei(s, o.height, r.range, i.range), l = { range: c.gridValues }, u = { range: c.labelValues };
2799
+ this.setState({
2800
+ gridValues: l,
2801
+ labelValues: u
2814
2802
  }), n(a);
2815
2803
  };
2816
2804
  render() {
@@ -2896,7 +2884,6 @@ var Dr = class e extends CustomEvent {
2896
2884
  gridValues: V,
2897
2885
  labelValues: re,
2898
2886
  chartDimensions: l,
2899
- charts: li,
2900
2887
  studentNewCategoryDefaultLabel: I,
2901
2888
  availableChartTypes: T,
2902
2889
  chartTypeLabel: D
@@ -3126,6 +3113,9 @@ var Dr = class e extends CustomEvent {
3126
3113
  }
3127
3114
  }
3128
3115
  }, fi = (0, Je.default)("pie-elements:graphing:configure"), pi = class e extends HTMLElement {
3116
+ _root;
3117
+ _model;
3118
+ _configuration;
3129
3119
  static createDefaultModel = (e = {}) => ({
3130
3120
  ...di.model,
3131
3121
  ...e
@@ -3141,10 +3131,15 @@ var Dr = class e extends CustomEvent {
3141
3131
  ...di.configuration,
3142
3132
  ...e
3143
3133
  };
3144
- this._configuration = t, t?.language?.enabled ? t?.languageChoices?.options?.length && (this._model.language = t?.languageChoices.options[0].value) : t.language.settings && this._model.language ? (this._configuration.language.enabled = !0, (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) && (this._configuration.languageChoices.options = []), this._configuration.languageChoices.options.find((e) => e.value === this._model.language) || this._configuration.languageChoices.options.push({
3145
- value: this._model.language,
3146
- label: this._model.language
3147
- })) : delete this._model.language, this._render();
3134
+ if (this._configuration = t, t?.language?.enabled) t?.languageChoices?.options?.length && (this._model.language = t?.languageChoices.options[0].value);
3135
+ else if (t.language.settings && this._model.language) {
3136
+ let e = this._model.language, n = t.languageChoices;
3137
+ t.language.enabled = !0, (!n.options || !n.options.length) && (n.options = []), n.options.find((t) => t.value === e) || n.options.push({
3138
+ value: e,
3139
+ label: e
3140
+ });
3141
+ } else delete this._model.language;
3142
+ this._render();
3148
3143
  }
3149
3144
  onModelChanged(e) {
3150
3145
  this._model = e, this._render(), fi("[onModelChanged]: ", this._model), this.dispatchEvent(new Dr(this._model));