@shelf/global-renderer 1.0.0 → 1.0.1-beta.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 (57) hide show
  1. package/CHANGELOG.md +2366 -44
  2. package/lib/DecisionTreeContent/DecisionTreeContent.d.ts +2 -2
  3. package/lib/DecisionTreeContent/DecisionTreeContent.js +84 -0
  4. package/lib/DecisionTreeContent/DecisionTreeContent.styled.d.ts +47 -11483
  5. package/lib/DecisionTreeContent/DecisionTreeContent.styled.js +225 -0
  6. package/lib/DecisionTreeContent/components/Condition.d.ts +2 -2
  7. package/lib/DecisionTreeContent/components/Condition.js +73 -0
  8. package/lib/DecisionTreeContent/components/ContentTable.d.ts +2 -2
  9. package/lib/DecisionTreeContent/components/ContentTable.js +26 -0
  10. package/lib/DecisionTreeContent/components/ExportedMeta.d.ts +3 -3
  11. package/lib/DecisionTreeContent/components/ExportedMeta.js +29 -0
  12. package/lib/DecisionTreeContent/components/Link.d.ts +2 -2
  13. package/lib/DecisionTreeContent/components/Link.js +18 -0
  14. package/lib/DecisionTreeContent/components/Question.d.ts +2 -2
  15. package/lib/DecisionTreeContent/components/Question.js +55 -0
  16. package/lib/DecisionTreeContent/components/Solution.d.ts +2 -2
  17. package/lib/DecisionTreeContent/components/Solution.js +20 -0
  18. package/lib/DecisionTreeContent/components/StepHeader.d.ts +2 -2
  19. package/lib/DecisionTreeContent/components/StepHeader.js +46 -0
  20. package/lib/DecisionTreeContent/components/StepTypeIcon.js +30 -0
  21. package/lib/DecisionTreeContent/helpers.d.ts +4 -4
  22. package/lib/DecisionTreeContent/helpers.js +56 -0
  23. package/lib/DecisionTreeContent/renderDTContent.js +12 -0
  24. package/lib/DecisionTreeContent/types.d.ts +1 -1
  25. package/lib/DecisionTreeDiagram/StaticTreeContainer.d.ts +2 -2
  26. package/lib/DecisionTreeDiagram/StaticTreeContainer.js +27 -0
  27. package/lib/DecisionTreeDiagram/renderStaticDTDiagram.js +26 -0
  28. package/lib/_virtual/_commonjsHelpers.js +4 -0
  29. package/lib/_virtual/advancedFormat.js +4 -0
  30. package/lib/_virtual/client.js +4 -0
  31. package/lib/_virtual/dayjs.min.js +4 -0
  32. package/lib/_virtual/index.js +4 -0
  33. package/lib/_virtual/index2.js +4 -0
  34. package/lib/_virtual/localeData.js +4 -0
  35. package/lib/_virtual/localizedFormat.js +4 -0
  36. package/lib/_virtual/react-dom.development.js +4 -0
  37. package/lib/_virtual/react-dom.production.min.js +4 -0
  38. package/lib/_virtual/scheduler.development.js +4 -0
  39. package/lib/_virtual/scheduler.production.min.js +4 -0
  40. package/lib/i18next/index.js +18 -0
  41. package/lib/index.js +4 -20383
  42. package/lib/node_modules/@shelf/datetime/lib/getDateFormatTemplates.js +15 -0
  43. package/lib/node_modules/@shelf/datetime/lib/getDateWithCustomFormat.js +10 -0
  44. package/lib/node_modules/@shelf/datetime/lib/getTimeFormatTemplates.js +17 -0
  45. package/lib/node_modules/@shelf/datetime/lib/isDate.js +4 -0
  46. package/lib/node_modules/@shelf/datetime/node_modules/dayjs/dayjs.min.js +295 -0
  47. package/lib/node_modules/@shelf/datetime/node_modules/dayjs/plugin/advancedFormat.js +54 -0
  48. package/lib/node_modules/@shelf/datetime/node_modules/dayjs/plugin/localeData.js +82 -0
  49. package/lib/node_modules/@shelf/datetime/node_modules/dayjs/plugin/localizedFormat.js +28 -0
  50. package/lib/node_modules/react-dom/cjs/react-dom.development.js +12880 -0
  51. package/lib/node_modules/react-dom/cjs/react-dom.production.min.js +5643 -0
  52. package/lib/node_modules/react-dom/client.js +28 -0
  53. package/lib/node_modules/react-dom/index.js +17 -0
  54. package/lib/node_modules/scheduler/cjs/scheduler.development.js +278 -0
  55. package/lib/node_modules/scheduler/cjs/scheduler.production.min.js +231 -0
  56. package/lib/node_modules/scheduler/index.js +12 -0
  57. package/package.json +16 -19
@@ -0,0 +1,56 @@
1
+ import { isEmpty as d, mapKeys as c, compact as x, uniq as l, sortBy as f } from "lodash";
2
+ import b from "../node_modules/@shelf/datetime/lib/getDateWithCustomFormat.js";
3
+ import T from "../node_modules/@shelf/datetime/lib/getDateFormatTemplates.js";
4
+ import y from "../node_modules/@shelf/datetime/lib/getTimeFormatTemplates.js";
5
+ const g = ["Question", "Condition"], F = (r) => r.map((o) => {
6
+ const m = r.filter(
7
+ (n) => n.linkedSteps?.map((i) => i.id).includes(o.id)
8
+ ), s = l(m.map(({ id: n, number: i }) => ({ id: n, number: i })));
9
+ return {
10
+ ...o,
11
+ parentSteps: f(s, "number")
12
+ };
13
+ }), C = (r) => {
14
+ if (d(r))
15
+ return [];
16
+ const o = r.find(({ isFirstStep: t }) => !!t), s = (o ? [o, ...r.filter(({ isFirstStep: t }) => !t)] : [...r]).map((t, p) => ({
17
+ ...t,
18
+ number: p + 1
19
+ })), n = c(s, "id"), i = s.map((t) => {
20
+ const p = t?.question?.answers, a = t?.conditions;
21
+ if (!g.includes(t?.type) || d(p) && d(a))
22
+ return t;
23
+ const u = p?.map((e) => ({
24
+ ...e,
25
+ nextStep: e?.nextStep?.id && n[e.nextStep.id] ? { ...e.nextStep, number: n[e.nextStep.id]?.number } : e.nextStep
26
+ })), S = a?.map((e) => ({
27
+ ...e,
28
+ nextStep: e?.nextStep?.id && n[e.nextStep.id] ? { ...e.nextStep, number: n[e.nextStep.id]?.number } : e.nextStep
29
+ }));
30
+ return {
31
+ ...t,
32
+ question: { ...t.question, answers: u },
33
+ linkedSteps: x(u?.map((e) => e.nextStep)),
34
+ ...a ? { conditions: S } : {},
35
+ ...t.defaultNextStep && n[t.defaultNextStep?.id] ? {
36
+ defaultNextStep: {
37
+ ...t.defaultNextStep,
38
+ number: n[t.defaultNextStep.id]?.number
39
+ }
40
+ } : {}
41
+ };
42
+ });
43
+ return F(i);
44
+ }, D = (r) => {
45
+ const o = T()?.medium ?? "MMM d, yyyy", m = y()?.short ?? "h:m a";
46
+ return b({
47
+ date: r,
48
+ dateFormat: `${o} ${m}`
49
+ });
50
+ };
51
+ export {
52
+ g as TYPES_TO_LINK,
53
+ C as convertStepToRenderFormat,
54
+ D as getDateAndTime,
55
+ F as getTreeWithParentSteps
56
+ };
@@ -0,0 +1,12 @@
1
+ import t from "react";
2
+ import "../node_modules/react-dom/client.js";
3
+ import n from "./DecisionTreeContent.js";
4
+ import i from "../i18next/index.js";
5
+ import { __exports as m } from "../_virtual/client.js";
6
+ const u = (e, o = "#root") => {
7
+ const r = document.querySelector(o);
8
+ e.language && i.changeLanguage(e.language), m.createRoot(r).render(t.createElement(n, e, null));
9
+ };
10
+ export {
11
+ u as renderDTContent
12
+ };
@@ -9,7 +9,7 @@ export type RenderDTContentData = {
9
9
  title: string;
10
10
  description: string;
11
11
  language: L10n.LanguageCode;
12
- exportedAt: string;
12
+ exportedAt: Date;
13
13
  exportedBy: string;
14
14
  createdBy: string;
15
15
  fields?: {
@@ -1,7 +1,7 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import type { DecisionTree } from '@shelf/types-ddb';
3
3
  declare const StaticTreeContainer: ({ tree, variables, }: {
4
4
  tree: DecisionTree.Step[];
5
5
  variables: DecisionTree.ContextualVariableDefaults[];
6
- }) => React.JSX.Element;
6
+ }) => JSX.Element;
7
7
  export default StaticTreeContainer;
@@ -0,0 +1,27 @@
1
+ import { I18nextProvider as n } from "react-i18next";
2
+ import { StaticTree as a } from "@shelf/decision-tree-editor-components";
3
+ import t from "../i18next/index.js";
4
+ import { jsx as e } from "react/jsx-runtime";
5
+ const p = ({
6
+ tree: r,
7
+ variables: o
8
+ }) => {
9
+ const i = {
10
+ conditionDefaultTitle: t.t("pdf-viewer.exportDTPDF.conditionDefaultTitle"),
11
+ containsLabel: t.t("pdf-viewer.exportDTPDF.contains"),
12
+ notContainsLabel: t.t("pdf-viewer.exportDTPDF.notContains"),
13
+ andOperator: t.t("pdf-viewer.exportDTPDF.andOperator"),
14
+ orOperator: t.t("pdf-viewer.exportDTPDF.orOperator")
15
+ };
16
+ return /* @__PURE__ */ e(n, {
17
+ i18n: t,
18
+ children: /* @__PURE__ */ e(a, {
19
+ tree: r,
20
+ ...i,
21
+ variables: o
22
+ })
23
+ });
24
+ }, s = p;
25
+ export {
26
+ s as default
27
+ };
@@ -0,0 +1,26 @@
1
+ import n from "react";
2
+ import "../node_modules/react-dom/client.js";
3
+ import m from "./StaticTreeContainer.js";
4
+ import a from "../i18next/index.js";
5
+ import { __exports as c } from "../_virtual/client.js";
6
+ const u = ({
7
+ language: r,
8
+ tree: e,
9
+ variables: t,
10
+ containerSelector: o = "#diagram-container"
11
+ }) => {
12
+ const i = document.querySelector(o);
13
+ r && a.changeLanguage(r), c.createRoot(i).render(
14
+ n.createElement(
15
+ m,
16
+ {
17
+ tree: e,
18
+ variables: t
19
+ },
20
+ null
21
+ )
22
+ );
23
+ };
24
+ export {
25
+ u as renderStaticDTDiagram
26
+ };
@@ -0,0 +1,4 @@
1
+ var e = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
2
+ export {
3
+ e as commonjsGlobal
4
+ };
@@ -0,0 +1,4 @@
1
+ var a = { exports: {} };
2
+ export {
3
+ a
4
+ };
@@ -0,0 +1,4 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var a = { exports: {} };
2
+ export {
3
+ a as d
4
+ };
@@ -0,0 +1,4 @@
1
+ var r = { exports: {} };
2
+ export {
3
+ r
4
+ };
@@ -0,0 +1,4 @@
1
+ var e = { exports: {} };
2
+ export {
3
+ e as s
4
+ };
@@ -0,0 +1,4 @@
1
+ var a = { exports: {} };
2
+ export {
3
+ a as l
4
+ };
@@ -0,0 +1,4 @@
1
+ var a = { exports: {} };
2
+ export {
3
+ a as l
4
+ };
@@ -0,0 +1,4 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var o = {};
2
+ export {
3
+ o as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var r = {};
2
+ export {
3
+ r as __exports
4
+ };
@@ -0,0 +1,18 @@
1
+ import { resources as n } from "@shelf/i18n/lib/bundles/pdf-viewer";
2
+ import { initReactI18next as e } from "react-i18next";
3
+ import r from "i18next";
4
+ import { defaultInterpolation as i } from "@shelf/i18n/lib/helpers";
5
+ const t = r.createInstance();
6
+ t.init({
7
+ lng: "en",
8
+ resources: n,
9
+ fallbackLng: "en",
10
+ interpolation: i,
11
+ missingKeyHandler: () => "\u26D4\uFE0F"
12
+ });
13
+ t.use(e);
14
+ const l = t;
15
+ export {
16
+ l as default,
17
+ t as i18next
18
+ };