@finsemble/finsemble-ui 6.6.0 → 7.0.0-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.
- package/package.json +13 -17
- package/react/components/common/ColorPicker.js +16 -15
- package/react/components/common/ColorPicker.js.map +1 -1
- package/react/components/common/FinsembleIcon.d.ts +1 -0
- package/react/components/common/FinsembleIcon.js +2 -1
- package/react/components/common/FinsembleIcon.js.map +1 -1
- package/react/components/common/FinsembleLink.d.ts +6 -0
- package/react/components/common/FinsembleLink.js +12 -0
- package/react/components/common/FinsembleLink.js.map +1 -0
- package/react/components/common/InputTable.d.ts +3 -3
- package/react/components/common/InputTable.js +13 -13
- package/react/components/common/InputTable.js.map +1 -1
- package/react/components/common/css/application-edit-page.css +10 -2
- package/react/components/common/helpers.js +6 -1
- package/react/components/common/helpers.js.map +1 -1
- package/react/components/common/stories/ColorPicker.stories.js +6 -11
- package/react/components/common/stories/ColorPicker.stories.js.map +1 -1
- package/react/components/common/stories/InputTable.stories.d.ts +4 -3
- package/react/components/common/stories/InputTable.stories.js +18 -8
- package/react/components/common/stories/InputTable.stories.js.map +1 -1
- package/react/components/common/tests/InputTable.spec.js +3 -3
- package/react/components/common/tests/InputTable.spec.js.map +1 -1
- package/react/components/sdd/AddApp.js +7 -1
- package/react/components/sdd/AddApp.js.map +1 -1
- package/react/components/sdd/AppEditAccess.d.ts +3 -3
- package/react/components/sdd/AppEditAccess.js.map +1 -1
- package/react/components/sdd/AppEditPage.d.ts +3 -3
- package/react/components/sdd/AppEditPage.js +19 -45
- package/react/components/sdd/AppEditPage.js.map +1 -1
- package/react/components/sdd/Appearance.d.ts +2 -1
- package/react/components/sdd/Appearance.js +15 -7
- package/react/components/sdd/Appearance.js.map +1 -1
- package/react/components/sdd/Application.d.ts +4 -4
- package/react/components/sdd/Application.js +1 -1
- package/react/components/sdd/Application.js.map +1 -1
- package/react/components/sdd/Applications.d.ts +11 -11
- package/react/components/sdd/Applications.js +1 -1
- package/react/components/sdd/Applications.js.map +1 -1
- package/react/components/sdd/Authentication.js +1 -6
- package/react/components/sdd/Authentication.js.map +1 -1
- package/react/components/sdd/AuthenticationProviderConfig.js +4 -3
- package/react/components/sdd/AuthenticationProviderConfig.js.map +1 -1
- package/react/components/sdd/EditPreload.d.ts +3 -3
- package/react/components/sdd/EditPreload.js.map +1 -1
- package/react/components/sdd/Export.d.ts +6 -6
- package/react/components/sdd/Export.js +2 -2
- package/react/components/sdd/Export.js.map +1 -1
- package/react/components/sdd/GettingStarted.js +2 -2
- package/react/components/sdd/GettingStarted.js.map +1 -1
- package/react/components/sdd/Navigation.js +1 -1
- package/react/components/sdd/Navigation.js.map +1 -1
- package/react/components/sdd/OptionalSettingsView.d.ts +5 -5
- package/react/components/sdd/OptionalSettingsView.js +2 -10
- package/react/components/sdd/OptionalSettingsView.js.map +1 -1
- package/react/components/sdd/SmartDesktopDesigner.d.ts +10 -10
- package/react/components/sdd/SmartDesktopDesigner.js +26 -27
- package/react/components/sdd/SmartDesktopDesigner.js.map +1 -1
- package/react/components/sdd/ThemePage.js +8 -5
- package/react/components/sdd/ThemePage.js.map +1 -1
- package/react/components/sdd/Themes.d.ts +2 -1
- package/react/components/sdd/Themes.js +2 -2
- package/react/components/sdd/Themes.js.map +1 -1
- package/react/components/sdd/Toolbar.d.ts +4 -4
- package/react/components/sdd/Toolbar.js +11 -9
- package/react/components/sdd/Toolbar.js.map +1 -1
- package/react/components/sdd/common/setPreloadDefaults.d.ts +1 -1
- package/react/components/sdd/common/setPreloadDefaults.js +4 -4
- package/react/components/sdd/common/setPreloadDefaults.js.map +1 -1
- package/react/components/sdd/common/views.js +41 -39
- package/react/components/sdd/common/views.js.map +1 -1
- package/react/components/sdd/fixtures/authenticationProps.js +15 -1
- package/react/components/sdd/fixtures/authenticationProps.js.map +1 -1
- package/react/components/sdd/fixtures/preloads.js +14 -12
- package/react/components/sdd/fixtures/preloads.js.map +1 -1
- package/react/components/sdd/stories/AppEditPage.stories.d.ts +1 -0
- package/react/components/sdd/stories/AppEditPage.stories.js +1 -0
- package/react/components/sdd/stories/AppEditPage.stories.js.map +1 -1
- package/react/components/sdd/stories/Appearance.stories.d.ts +1 -1
- package/react/components/sdd/stories/Appearance.stories.js +1 -0
- package/react/components/sdd/stories/Appearance.stories.js.map +1 -1
- package/react/components/sdd/stories/Authentication.stories.js +2 -16
- package/react/components/sdd/stories/Authentication.stories.js.map +1 -1
- package/react/components/sdd/stories/OptionalSettingsView.stories.js +1 -1
- package/react/components/sdd/stories/OptionalSettingsView.stories.js.map +1 -1
- package/react/components/sdd/stories/SmartDesktopDesigner.stories.js +3 -0
- package/react/components/sdd/stories/SmartDesktopDesigner.stories.js.map +1 -1
- package/react/components/sdd/stories/Themes.stories.d.ts +1 -1
- package/react/components/sdd/stories/Themes.stories.js +1 -0
- package/react/components/sdd/stories/Themes.stories.js.map +1 -1
- package/react/components/sdd/tests/AppEditPage.spec.js +36 -5
- package/react/components/sdd/tests/AppEditPage.spec.js.map +1 -1
- package/react/components/sdd/tests/Authentication.spec.js +1 -1
- package/react/components/sdd/tests/Authentication.spec.js.map +1 -1
- package/react/components/sdd/tests/EditPreload.spec.js +14 -7
- package/react/components/sdd/tests/EditPreload.spec.js.map +1 -1
- package/react/components/sdd/tests/OptionalSettingsView.spec.js +235 -0
- package/react/components/sdd/tests/OptionalSettingsView.spec.js.map +1 -1
- package/react/components/sdd/tests/ProjectErrors.spec.js +1 -1
- package/react/components/sdd/tests/ProjectErrors.spec.js.map +1 -1
- package/react/components/smartDesktopDesigner/SmartDesktopDesigner.d.ts +1 -16
- package/react/components/smartDesktopDesigner/SmartDesktopDesigner.js +0 -4
- package/react/components/smartDesktopDesigner/SmartDesktopDesigner.js.map +1 -1
- package/react/components/toolbar/dashbar/Dashbar.js +0 -1
- package/react/components/toolbar/dashbar/Dashbar.js.map +1 -1
- package/react/components/userPreferences/components/content/notificationViews/NotificationsPreferencesHome.js +2 -2
- package/react/components/userPreferences/components/content/notificationViews/NotificationsPreferencesHome.js.map +1 -1
- package/react/tsconfig.tsbuildinfo +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finsemble/finsemble-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-beta.1",
|
|
4
4
|
"description": "Ready-made React components to give you a head-start building your SmartDesktop.",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "yarn clean && yarn copy-css && tsc",
|
|
12
12
|
"do-audit": " improved-yarn-audit --min-severity high",
|
|
13
|
+
"depcheck": "depcheck",
|
|
13
14
|
"clean": "rimraf ./react & rimraf coverage",
|
|
14
15
|
"copy-css": "copyfiles -u 1 \"./src/assets/**/*\" react/ && copyfiles -u 1 \"src/**/*.css\" \"react/\"",
|
|
15
16
|
"dev": "yarn copy-css && yarn watch",
|
|
@@ -27,21 +28,18 @@
|
|
|
27
28
|
"build-storybook": "build-storybook"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@finsemble/finsemble-api": "
|
|
31
|
+
"@finsemble/finsemble-api": "7.0.0-beta.1",
|
|
31
32
|
"@q42/floating-focus-a11y": "^1.3.3",
|
|
32
33
|
"@reduxjs/toolkit": "^1.5.0",
|
|
33
34
|
"@svgr/webpack": "^5.5.0",
|
|
34
35
|
"@types/async": "3.2.12",
|
|
35
36
|
"@types/chai": "4.3.0",
|
|
36
|
-
"@types/lodash": "4.14.
|
|
37
|
-
"@types/mime-types": "^2.1.0",
|
|
37
|
+
"@types/lodash": "4.14.179",
|
|
38
38
|
"@types/mocha": "9.1.0",
|
|
39
|
-
"@types/react": "17.0.
|
|
40
|
-
"@types/react-dom": "17.0.
|
|
41
|
-
"@types/react-
|
|
42
|
-
"@types/react-redux": "7.1.22",
|
|
39
|
+
"@types/react": "17.0.40",
|
|
40
|
+
"@types/react-dom": "17.0.13",
|
|
41
|
+
"@types/react-redux": "7.1.23",
|
|
43
42
|
"@types/react-relative-portal": "^1.8.1",
|
|
44
|
-
"@types/react-syntax-highlighter": "13.5.2",
|
|
45
43
|
"async": "3.2.3",
|
|
46
44
|
"date-fns": "^2.25.0",
|
|
47
45
|
"immer": "9.0.12",
|
|
@@ -61,14 +59,13 @@
|
|
|
61
59
|
"react-dom": "17.0.2"
|
|
62
60
|
},
|
|
63
61
|
"devDependencies": {
|
|
64
|
-
"@babel/plugin-proposal-private-methods": "7.16.7",
|
|
65
62
|
"@babel/preset-env": "^7.16.0",
|
|
66
63
|
"@babel/preset-react": "^7.12.10",
|
|
67
64
|
"@babel/register": "^7.16.0",
|
|
68
|
-
"@storybook/addon-actions": "6.4.
|
|
65
|
+
"@storybook/addon-actions": "6.4.19",
|
|
69
66
|
"@storybook/addon-essentials": "6.4.19",
|
|
70
|
-
"@storybook/addon-links": "6.4.
|
|
71
|
-
"@storybook/react": "6.4.
|
|
67
|
+
"@storybook/addon-links": "6.4.19",
|
|
68
|
+
"@storybook/react": "6.4.19",
|
|
72
69
|
"@types/enzyme": "^3.10.8",
|
|
73
70
|
"@types/react-syntax-highlighter": "13.5.2",
|
|
74
71
|
"@types/react-transition-group": "4.4.4",
|
|
@@ -82,23 +79,22 @@
|
|
|
82
79
|
"concurrently": "7.0.0",
|
|
83
80
|
"copyfiles": "2.4.1",
|
|
84
81
|
"core-js": "^3.15.2",
|
|
82
|
+
"depcheck": "^1.4.3",
|
|
85
83
|
"enzyme": "^3.11.0",
|
|
86
84
|
"ignore-styles": "^5.0.1",
|
|
87
85
|
"improved-yarn-audit": "^3.0.0",
|
|
88
86
|
"jsdom": "^19.0.0",
|
|
89
|
-
"mime-types": "^2.1.28",
|
|
90
87
|
"mocha": "9.1.3",
|
|
91
88
|
"nyc": "15.1.0",
|
|
92
89
|
"react": "17.0.2",
|
|
93
90
|
"react-dom": "17.0.2",
|
|
94
91
|
"rimraf": "3.0.2",
|
|
95
|
-
"sinon": "^
|
|
96
|
-
"ts-loader": "^9.2.3",
|
|
92
|
+
"sinon": "^13.0.1",
|
|
97
93
|
"ts-mocha": "9.0.2",
|
|
98
94
|
"typescript": "4.5.5"
|
|
99
95
|
},
|
|
100
96
|
"resolutions": {
|
|
101
|
-
"@types/react-dom": "17.0.
|
|
97
|
+
"@types/react-dom": "17.0.13",
|
|
102
98
|
"ts-mocha/ts-node": "^10.1.0",
|
|
103
99
|
"trim": "0.0.3",
|
|
104
100
|
"css-what": "5.0.1",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import "./css/color-picker.css";
|
|
3
3
|
const RE_HEX_COLOR = /^#[0-9a-f]{6}$/i;
|
|
4
4
|
export var RGBA_CHANNEL;
|
|
@@ -29,23 +29,24 @@ function colorToHex(color) {
|
|
|
29
29
|
return `#${hex}`;
|
|
30
30
|
}
|
|
31
31
|
export const ColorPicker = ({ id, startColor, updateColor }) => {
|
|
32
|
-
const [
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (startColor) {
|
|
41
|
-
setColor(startColor);
|
|
42
|
-
}
|
|
43
|
-
}, [startColor]);
|
|
32
|
+
const [priorColor, setPriorColor] = useState(startColor);
|
|
33
|
+
const [inputValue, setInputValue] = useState(null);
|
|
34
|
+
if (priorColor !== startColor) {
|
|
35
|
+
setPriorColor(startColor);
|
|
36
|
+
setInputValue(null);
|
|
37
|
+
}
|
|
38
|
+
const isValid = inputValue === null || inputValue.match(RE_HEX_COLOR) !== null;
|
|
39
|
+
const color = colorToHex(startColor);
|
|
44
40
|
const onColorChanged = ({ target }) => {
|
|
45
|
-
|
|
41
|
+
const maybeNewColor = target.value;
|
|
42
|
+
setInputValue(maybeNewColor);
|
|
43
|
+
const isNewValueValid = maybeNewColor.match(RE_HEX_COLOR) !== null;
|
|
44
|
+
if (isNewValueValid) {
|
|
45
|
+
updateColor(maybeNewColor);
|
|
46
|
+
}
|
|
46
47
|
};
|
|
47
48
|
return (React.createElement("div", { className: "color-picker" },
|
|
48
49
|
React.createElement("input", { className: "theme-color-picker", type: "color", value: color, onChange: onColorChanged, "aria-hidden": "true" }),
|
|
49
|
-
React.createElement("input", Object.assign({ className: "theme-color-picker-text", type: "text", "aria-invalid": !isValid, value: color, onChange: onColorChanged }, { id }))));
|
|
50
|
+
React.createElement("input", Object.assign({ className: "theme-color-picker-text", type: "text", "aria-invalid": !isValid, value: inputValue !== null && inputValue !== void 0 ? inputValue : color, onChange: onColorChanged }, { id }))));
|
|
50
51
|
};
|
|
51
52
|
//# sourceMappingURL=ColorPicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/components/common/ColorPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/components/common/ColorPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAa,MAAM,OAAO,CAAC;AACnD,OAAO,wBAAwB,CAAC;AAEhC,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAEvC,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACvB,6CAAO,CAAA;IACP,iDAAS,CAAA;IACT,+CAAQ,CAAA;IACR,iDAAS,CAAA;AACV,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAGD,MAAM,UAAU,WAAW,CAAC,KAAa;IAOxC,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC7C,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;IACf,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAEd,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAA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AG,UAAU,KAAK,IAAI,IAAI,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;IAI/E,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAErC,MAAM,cAAc,GAAG,CAAC,EAAE,MAAM,EAAgC,EAAE,EAAE;QACnE,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC;QAEnC,aAAa,CAAC,aAAa,CAAC,CAAC;QAE7B,MAAM,eAAe,GAAG,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;QACnE,IAAI,eAAe,EAAE;YACpB,WAAW,CAAC,aAAa,CAAC,CAAC;SAC3B;IACF,CAAC,CAAC;IAEF,OAAO,CACN,6BAAK,SAAS,EAAC,cAAc;QAC5B,+BACC,SAAS,EAAC,oBAAoB,EAC9B,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,cAAc,iBACZ,MAAM,GACV;QACT,6CACC,SAAS,EAAC,yBAAyB,EACnC,IAAI,EAAC,MAAM,kBACG,CAAC,OAAO,EACtB,KAAK,EAAE,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,KAAK,EAC1B,QAAQ,EAAE,cAAc,IACpB,EAAE,EAAE,EAAE,EACF,CACJ,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["import React, { useState, useEffect } from \"react\";\nimport \"./css/color-picker.css\";\n\nconst RE_HEX_COLOR = /^#[0-9a-f]{6}$/i;\n\nexport enum RGBA_CHANNEL {\n\tRED = 0,\n\tGREEN = 1,\n\tBLUE = 2,\n\tALPHA = 3,\n}\n\n// From https://stackoverflow.com/a/24390910\nexport function colorToRGBA(color: string) {\n\t// Returns the color as an array of [r, g, b, a] -- all range from 0 - 255\n\t// color must be a valid canvas fillStyle. This will cover most anything\n\t// you'd want to use.\n\t// Examples:\n\t// colorToRGBA('red') # [255, 0, 0, 255]\n\t// colorToRGBA('#f00') # [255, 0, 0, 255]\n\tconst cvs = document.createElement(\"canvas\");\n\tcvs.height = 1;\n\tcvs.width = 1;\n\n\tconst ctx = cvs.getContext(\"2d\")!;\n\tctx.fillStyle = color;\n\tctx.fillRect(0, 0, 1, 1);\n\treturn ctx.getImageData(0, 0, 1, 1).data;\n}\n\nfunction byteToHex(num: number) {\n\t// Turns a number (0-255) into a 2-character hex number (00-ff)\n\treturn `0${num.toString(16)}`.slice(-2);\n}\n\nfunction colorToHex(color: string) {\n\t// Convert any CSS color to a hex representation\n\t// Examples:\n\t// colorToHex('red') # '#ff0000'\n\t// colorToHex('rgb(255, 0, 0)') # '#ff0000'\n\t// colorToHex('#ff0000') # '#ff0000'\n\tif (color.match(RE_HEX_COLOR) !== null) {\n\t\treturn color;\n\t}\n\tconst rgba = colorToRGBA(color);\n\tconst hex = [0, 1, 2].map((idx) => byteToHex(rgba[idx])).join(\"\");\n\treturn `#${hex}`;\n}\n\nexport interface ColorPickerProps {\n\tstartColor: string;\n\tupdateColor: (newColor: string) => void;\n\tid?: string;\n}\n\n/**\n * ColorPicker component to update theme variables. Displays a browser color input alongside a text version for hex color values.\n *\n * @param {{ [id]: string, startColor: string; updateColor: function }} { id, startColor, callback }\n */\nexport const ColorPicker = ({ id, startColor, updateColor }: ColorPickerProps) => {\n\t/**\n\t * There is a delicate ballet here between the color picket and the input box. This is because this color picker\n\t * has state (when the end user is in the midst of picking a color by editing the input field) and also\n\t * receives state (via props). When prop startColor is received, it overrides the input box. But when the user is editing,\n\t * the input box overrides the prop.\n\t */\n\tconst [priorColor, setPriorColor] = useState(startColor);\n\t/**\n\t * inputValue state is set _whenever the user is editing the input box_. Only at this time, the value in the input\n\t * box reflects the user's editing. If at any point the editing yields a valid color then it is immediately\n\t * passed up as an action, which updates the screen and resets the startColor prop. Whenever an invalid color has\n\t * been entered, the value is flagged invalid which causes the input box to be underlined red.\n\t */\n\tconst [inputValue, setInputValue] = useState<string | null>(null);\n\n\t/**\n\t * If the value of the startColor prop changes then we reset the input to the new color. This occurs for instance\n\t * when the user presses the light or dark themes on the theme page. At that point, the parent sends new values\n\t * down to all color pickers as a new prop.\n\t */\n\tif (priorColor !== startColor) {\n\t\tsetPriorColor(startColor);\n\t\tsetInputValue(null);\n\t}\n\n\t// If the value in the input box isn't valid then give UI feedback\n\tconst isValid = inputValue === null || inputValue.match(RE_HEX_COLOR) !== null;\n\n\t// The swatch always displays the current color from prop. This won't change\n\t// until a valid alternative color is picked.\n\tconst color = colorToHex(startColor);\n\n\tconst onColorChanged = ({ target }: { target: HTMLInputElement }) => {\n\t\tconst maybeNewColor = target.value;\n\t\t// Update the value in the input box\n\t\tsetInputValue(maybeNewColor);\n\t\t// If the color is valid then send an update\n\t\tconst isNewValueValid = maybeNewColor.match(RE_HEX_COLOR) !== null;\n\t\tif (isNewValueValid) {\n\t\t\tupdateColor(maybeNewColor);\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className=\"color-picker\">\n\t\t\t<input\n\t\t\t\tclassName=\"theme-color-picker\"\n\t\t\t\ttype=\"color\"\n\t\t\t\tvalue={color}\n\t\t\t\tonChange={onColorChanged}\n\t\t\t\taria-hidden=\"true\"\n\t\t\t></input>\n\t\t\t<input\n\t\t\t\tclassName=\"theme-color-picker-text\"\n\t\t\t\ttype=\"text\"\n\t\t\t\taria-invalid={!isValid}\n\t\t\t\tvalue={inputValue ?? color}\n\t\t\t\tonChange={onColorChanged}\n\t\t\t\t{...{ id }}\n\t\t\t></input>\n\t\t</div>\n\t);\n};\n"]}
|
|
@@ -81,7 +81,8 @@ const icons = {
|
|
|
81
81
|
window: WindowIcon,
|
|
82
82
|
};
|
|
83
83
|
export const FinsembleIcon = (props) => {
|
|
84
|
+
var _a;
|
|
84
85
|
const Icon = icons[props.icon];
|
|
85
|
-
return (React.createElement("span", { className: ["finsemble-icon", `finsemble-icon-${props.icon}`, props.className || ""].join(" "), role: "img", "aria-label": `${props.icon} icon`, onClick: (e) => props.onClick && props.onClick(e) }, Icon && React.createElement(Icon, null)));
|
|
86
|
+
return (React.createElement("span", { className: ["finsemble-icon", `finsemble-icon-${props.icon}`, props.className || ""].join(" "), role: "img", "aria-label": (_a = props.label) !== null && _a !== void 0 ? _a : `${props.icon} icon`, onClick: (e) => props.onClick && props.onClick(e) }, Icon && React.createElement(Icon, null)));
|
|
86
87
|
};
|
|
87
88
|
//# sourceMappingURL=FinsembleIcon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FinsembleIcon.js","sourceRoot":"","sources":["../../../src/components/common/FinsembleIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACzF,OAAO,EAAE,cAAc,IAAI,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,cAAc,IAAI,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,cAAc,IAAI,WAAW,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,cAAc,IAAI,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,EAAE,cAAc,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,cAAc,IAAI,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,cAAc,IAAI,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACrG,OAAO,EAAE,cAAc,IAAI,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,6BAA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WAAW,EAAE,YAAY;IACzB,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,UAAU;CAClB,CAAC;AASF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAE,EAAE;;IAC1D,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/B,OAAO,CACN,8BACC,SAAS,EAAE,CAAC,gBAAgB,EAAE,kBAAkB,KAAK,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAC9F,IAAI,EAAC,KAAK,gBACE,MAAA,KAAK,CAAC,KAAK,mCAAI,GAAG,KAAK,CAAC,IAAI,OAAO,EAC/C,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAEhD,IAAI,IAAI,oBAAC,IAAI,OAAQ,CAChB,CACP,CAAC;AACH,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport \"./css/icon.css\";\nimport { ReactComponent as AlwaysOnTopIcon } from \"../../assets/icons/always-on-top.svg\";\nimport { ReactComponent as Caret } from \"../../assets/icons/caret.svg\";\nimport { ReactComponent as CheckIcon } from \"../../assets/icons/check.svg\";\nimport { ReactComponent as CheckSquare } from \"../../assets/icons/check-square.svg\";\nimport { ReactComponent as ChevronLeftIcon } from \"../../assets/icons/chevron-left.svg\";\nimport { ReactComponent as ChevronRightIcon } from \"../../assets/icons/chevron-right.svg\";\nimport { ReactComponent as CloseIcon } from \"../../assets/icons/close.svg\";\nimport { ReactComponent as CodeBlockIcon } from \"../../assets/icons/code-block.svg\";\nimport { ReactComponent as CopyIcon } from \"../../assets/icons/copy.svg\";\nimport { ReactComponent as DocumentationIcon } from \"../../assets/icons/documentation.svg\";\nimport { ReactComponent as ExclaimationCircleIcon } from \"../../assets/icons/exclamation-circle.svg\";\nimport { ReactComponent as ExternalLinkIcon } from \"../../assets/icons/external-link.svg\";\nimport { ReactComponent as FlagIcon } from \"../../assets/icons/flag.svg\";\nimport { ReactComponent as FolderIcon } from \"../../assets/icons/folder.svg\";\nimport { ReactComponent as FontIcon } from \"../../assets/icons/font.svg\";\nimport { ReactComponent as GlobeIcon } from \"../../assets/icons/globe.svg\";\nimport { ReactComponent as HDDIcon } from \"../../assets/icons/hdd.svg\";\nimport { ReactComponent as KeyIcon } from \"../../assets/icons/key.svg\";\nimport { ReactComponent as LifeRingIcon } from \"../../assets/icons/life-ring.svg\";\nimport { ReactComponent as LinkerIcon } from \"../../assets/icons/linker.svg\";\nimport { ReactComponent as LockIcon } from \"../../assets/icons/lock.svg\";\nimport { ReactComponent as MagicIcon } from \"../../assets/icons/magic.svg\";\nimport { ReactComponent as MaximizeIcon } from \"../../assets/icons/maximize.svg\";\nimport { ReactComponent as MinimizeIcon } from \"../../assets/icons/minimize.svg\";\nimport { ReactComponent as MoonIcon } from \"../../assets/icons/moon.svg\";\nimport { ReactComponent as PaintRollerIcon } from \"../../assets/icons/paint-roller.svg\";\nimport { ReactComponent as PencilIcon } from \"../../assets/icons/pencil.svg\";\nimport { ReactComponent as PlusIcon } from \"../../assets/icons/plus.svg\";\nimport { ReactComponent as QuestionCircleIcon } from \"../../assets/icons/question-circle.svg\";\nimport { ReactComponent as SearchIcon } from \"../../assets/icons/search.svg\";\nimport { ReactComponent as SunIcon } from \"../../assets/icons/sun.svg\";\nimport { ReactComponent as TimesIcon } from \"../../assets/icons/times.svg\";\nimport { ReactComponent as ToggleOffIcon } from \"../../assets/icons/toggle-off.svg\";\nimport { ReactComponent as ToggleOnIcon } from \"../../assets/icons/toggle-on.svg\";\nimport { ReactComponent as ToolbarIcon } from \"../../assets/icons/toolbar.svg\";\nimport { ReactComponent as ToolsIcon } from \"../../assets/icons/tools.svg\";\nimport { ReactComponent as TrashIcon } from \"../../assets/icons/trash.svg\";\nimport { ReactComponent as UploadIcon } from \"../../assets/icons/upload.svg\";\nimport { ReactComponent as WindowIcon } from \"../../assets/icons/window.svg\";\n\nexport type FinsembleIconType =\n\t| \"alwaysOnTop\"\n\t| \"caret\"\n\t| \"check-square\"\n\t| \"check\"\n\t| \"chevron-left\"\n\t| \"chevron-right\"\n\t| \"close\"\n\t| \"code-block\"\n\t| \"copy\"\n\t| \"documentation\"\n\t| \"exclamation-circle\"\n\t| \"external-link\"\n\t| \"flag\"\n\t| \"folder\"\n\t| \"font\"\n\t| \"globe\"\n\t| \"hdd\"\n\t| \"key\"\n\t| \"life-ring\"\n\t| \"linker\"\n\t| \"lock\"\n\t| \"magic\"\n\t| \"maximize\"\n\t| \"minimize\"\n\t| \"moon\"\n\t| \"paint-roller\"\n\t| \"pencil\"\n\t| \"plus\"\n\t| \"question-circle\"\n\t| \"search\"\n\t| \"sun\"\n\t| \"times\"\n\t| \"toggle-off\"\n\t| \"toggle-on\"\n\t| \"toolbar\"\n\t| \"tools\"\n\t| \"trash\"\n\t| \"upload\"\n\t| \"window\";\n\ntype IconComponents = {\n\t[key in FinsembleIconType]: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;\n};\n\nconst icons: IconComponents = {\n\talwaysOnTop: AlwaysOnTopIcon,\n\tcaret: Caret,\n\tcheck: CheckIcon,\n\t\"check-square\": CheckSquare,\n\t\"chevron-left\": ChevronLeftIcon,\n\t\"chevron-right\": ChevronRightIcon,\n\tclose: CloseIcon,\n\t\"code-block\": CodeBlockIcon,\n\tcopy: CopyIcon,\n\tdocumentation: DocumentationIcon,\n\t\"exclamation-circle\": ExclaimationCircleIcon,\n\t\"external-link\": ExternalLinkIcon,\n\tflag: FlagIcon,\n\tfolder: FolderIcon,\n\tfont: FontIcon,\n\tglobe: GlobeIcon,\n\thdd: HDDIcon,\n\tkey: KeyIcon,\n\t\"life-ring\": LifeRingIcon,\n\tlinker: LinkerIcon,\n\tlock: LockIcon,\n\tmagic: MagicIcon,\n\tmaximize: MaximizeIcon,\n\tminimize: MinimizeIcon,\n\tmoon: MoonIcon,\n\t\"paint-roller\": PaintRollerIcon,\n\tpencil: PencilIcon,\n\tplus: PlusIcon,\n\t\"question-circle\": QuestionCircleIcon,\n\tsearch: SearchIcon,\n\tsun: SunIcon,\n\ttimes: TimesIcon,\n\t\"toggle-off\": ToggleOffIcon,\n\t\"toggle-on\": ToggleOnIcon,\n\ttoolbar: ToolbarIcon,\n\ttools: ToolsIcon,\n\ttrash: TrashIcon,\n\tupload: UploadIcon,\n\twindow: WindowIcon,\n};\n\nexport type FinsembleIconProps = {\n\ticon: FinsembleIconType;\n\tclassName?: string;\n\tonClick?: (e: React.MouseEvent) => void;\n\tlabel?: string;\n};\n\nexport const FinsembleIcon = (props: FinsembleIconProps) => {\n\tconst Icon = icons[props.icon];\n\n\treturn (\n\t\t<span\n\t\t\tclassName={[\"finsemble-icon\", `finsemble-icon-${props.icon}`, props.className || \"\"].join(\" \")}\n\t\t\trole=\"img\"\n\t\t\taria-label={props.label ?? `${props.icon} icon`}\n\t\t\tonClick={(e) => props.onClick && props.onClick(e)}\n\t\t>\n\t\t\t{Icon && <Icon></Icon>}\n\t\t</span>\n\t);\n};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const openLink = (url) => {
|
|
3
|
+
FSBL.Clients.LauncherClient.spawn("", {
|
|
4
|
+
url,
|
|
5
|
+
addToWorkspace: false,
|
|
6
|
+
}, () => { });
|
|
7
|
+
};
|
|
8
|
+
export const FinsembleLink = ({ url, text }) => (React.createElement("a", { href: "", onClick: (e) => {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
openLink(url);
|
|
11
|
+
} }, text));
|
|
12
|
+
//# sourceMappingURL=FinsembleLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FinsembleLink.js","sourceRoot":"","sources":["../../../src/components/common/FinsembleLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,EAAE;IAChC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAChC,EAAE,EACF;QACC,GAAG;QACH,cAAc,EAAE,KAAK;KACrB,EACD,GAAG,EAAE,GAAE,CAAC,CACR,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAC7E,2BACC,IAAI,EAAC,EAAE,EACP,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;QACd,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,QAAQ,CAAC,GAAG,CAAC,CAAC;IACf,CAAC,IAEA,IAAI,CACF,CACJ,CAAC","sourcesContent":["import React from \"react\";\n\nexport interface FinsembleLinkProps {\n\turl: string;\n\ttext: string;\n}\n\nconst openLink = (url: string) => {\n\tFSBL.Clients.LauncherClient.spawn(\n\t\t\"\",\n\t\t{\n\t\t\turl,\n\t\t\taddToWorkspace: false,\n\t\t},\n\t\t() => {}\n\t);\n};\n\nexport const FinsembleLink: React.FC<FinsembleLinkProps> = ({ url, text }) => (\n\t<a\n\t\thref=\"\"\n\t\tonClick={(e) => {\n\t\t\te.preventDefault();\n\t\t\topenLink(url);\n\t\t}}\n\t>\n\t\t{text}\n\t</a>\n);\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/// <reference types="react" />
|
|
6
6
|
export declare type InputTableProps = {
|
|
7
7
|
tableHeaders: (string | JSX.Element)[];
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
setData: (data: string[][]) => void;
|
|
9
|
+
data: string[][];
|
|
10
10
|
};
|
|
11
|
-
export declare const InputTable: ({ tableHeaders,
|
|
11
|
+
export declare const InputTable: ({ tableHeaders, setData, data }: InputTableProps) => JSX.Element;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright 2017 - 2020 by ChartIQ, Inc.
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
*/
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { useEffect } from "react";
|
|
6
6
|
import { ButtonIcon } from "./ButtonIcon";
|
|
7
7
|
const isLastRowEmpty = (arr) => {
|
|
8
8
|
const lastRow = arr[arr.length - 1];
|
|
@@ -14,24 +14,24 @@ const isLastRowEmpty = (arr) => {
|
|
|
14
14
|
};
|
|
15
15
|
const deepCopy = (obj) => JSON.parse(JSON.stringify(obj));
|
|
16
16
|
const emptyRow = (colCount) => Array(colCount).fill("").slice(0);
|
|
17
|
-
export const InputTable = ({ tableHeaders,
|
|
18
|
-
const [data, setData] = useState(startingData !== null && startingData !== void 0 ? startingData : [emptyRow(tableHeaders.length)]);
|
|
17
|
+
export const InputTable = ({ tableHeaders, setData, data }) => {
|
|
19
18
|
const rowCount = data.length;
|
|
20
|
-
const doSetData = (newData) => {
|
|
21
|
-
setData(newData);
|
|
22
|
-
onUpdate(newData);
|
|
23
|
-
};
|
|
24
19
|
const addRow = () => {
|
|
25
|
-
|
|
20
|
+
setData(data.concat([emptyRow(tableHeaders.length)]));
|
|
26
21
|
};
|
|
27
22
|
const deleteRow = (rowIndex) => {
|
|
28
23
|
const newData = data.splice(0);
|
|
29
24
|
newData.splice(rowIndex, 1);
|
|
30
|
-
|
|
25
|
+
setData(newData);
|
|
31
26
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (data.length === 0) {
|
|
29
|
+
setData([emptyRow(tableHeaders.length)]);
|
|
30
|
+
}
|
|
31
|
+
if (!isLastRowEmpty(data)) {
|
|
32
|
+
addRow();
|
|
33
|
+
}
|
|
34
|
+
}, [data]);
|
|
35
35
|
return (React.createElement("table", { className: "inputTable" },
|
|
36
36
|
React.createElement("thead", null,
|
|
37
37
|
React.createElement("tr", null, tableHeaders.map((th, index) => (React.createElement("th", { scope: "col", key: `th-${index}` }, th))))),
|
|
@@ -40,7 +40,7 @@ export const InputTable = ({ tableHeaders, onUpdate, startingData }) => {
|
|
|
40
40
|
React.createElement("input", { type: "text", id: `input-${rowNumber}-${colNumber}`, value: td, onChange: (e) => {
|
|
41
41
|
const newData = deepCopy(data);
|
|
42
42
|
newData[rowNumber][colNumber] = e.target.value;
|
|
43
|
-
|
|
43
|
+
setData(newData);
|
|
44
44
|
} })))),
|
|
45
45
|
rowNumber < rowCount - 1 && (React.createElement("td", null,
|
|
46
46
|
React.createElement(ButtonIcon, { icon: "times", text: "Remove row", onClick: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputTable.js","sourceRoot":"","sources":["../../../src/components/common/InputTable.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"InputTable.js","sourceRoot":"","sources":["../../../src/components/common/InputTable.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,MAAM,cAAc,GAAG,CAAC,GAAe,EAAE,EAAE;IAC1C,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACpC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC5B,OAAO,IAAI,CAAC;KACZ;IAED,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC9D,OAAO,aAAa,CAAC,MAAM,KAAK,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,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C,CACL,CAAC,CACE,CACE;QACR,mCACE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,CAC5B,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACpB,4BAAI,GAAG,EAAE,MAAM,SAAS,EAAE;YACxB,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,CAC3B,4BAAI,GAAG,EAAE,MAAM,SAAS,IAAI,SAAS,EAAE;gBACtC,+BACC,IAAI,EAAC,MAAM,EACX,EAAE,EAAE,SAAS,SAAS,IAAI,SAAS,EAAE,EACrC,KAAK,EAAE,EAAE,EACT,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;wBACf,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;wBAC/B,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;wBAC/C,OAAO,CAAC,OAAO,CAAC,CAAC;oBAClB,CAAC,GACA,CACE,CACL,CAAC;YACD,SAAS,GAAG,QAAQ,GAAG,CAAC,IAAI,CAC5B;gBACC,oBAAC,UAAU,IACV,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,YAAY,EACjB,OAAO,EAAE,GAAG,EAAE;wBACb,SAAS,CAAC,SAAS,CAAC,CAAC;oBACtB,CAAC,GACA,CACE,CACL,CACG,CACL,CAAC,CAAC,CAAC,IAAI,CACR,CACM,CACD,CACR,CAAC;AACH,CAAC,CAAC","sourcesContent":["/*!\n * Copyright 2017 - 2020 by ChartIQ, Inc.\n * All rights reserved.\n */\n\nimport React, { useEffect } from \"react\";\nimport { ButtonIcon } from \"./ButtonIcon\";\n\nexport type InputTableProps = {\n\ttableHeaders: (string | JSX.Element)[];\n\tsetData: (data: string[][]) => void;\n\tdata: string[][];\n};\n\nconst isLastRowEmpty = (arr: String[][]) => {\n\tconst lastRow = arr[arr.length - 1];\n\tif (!Array.isArray(lastRow)) {\n\t\treturn true;\n\t}\n\n\tconst nonEmptyCells = lastRow.filter((str) => str.length > 0);\n\treturn nonEmptyCells.length === 0;\n};\n\nconst deepCopy = (obj: any) => JSON.parse(JSON.stringify(obj));\nconst emptyRow = (colCount: number) => Array(colCount).fill(\"\").slice(0);\n\n/***\n * A table full on input fields. It auto-grows as users use it, and it provides \"Remove row\" functionality.\n * The number of columns in the table is determined by the number of table headers provided, which are required.\n * @param {string|JSX} tableHeaders The headers at the top of each column\n * @param {Function} onUpdate Callback providing the data in the table. This is called onInput for any input element in the table.\n * @param {string[][]} [data] Initial data for the table\n */\nexport const InputTable = ({ tableHeaders, setData, data }: InputTableProps) => {\n\tconst rowCount = data.length;\n\n\tconst addRow = () => {\n\t\tsetData(data.concat([emptyRow(tableHeaders.length)]));\n\t};\n\n\tconst deleteRow = (rowIndex: number) => {\n\t\tconst newData = data.splice(0);\n\t\tnewData.splice(rowIndex, 1);\n\t\tsetData(newData);\n\t};\n\n\tuseEffect(() => {\n\t\tif (data.length === 0) {\n\t\t\tsetData([emptyRow(tableHeaders.length)]);\n\t\t}\n\t\tif (!isLastRowEmpty(data)) {\n\t\t\taddRow();\n\t\t}\n\t}, [data]);\n\n\treturn (\n\t\t<table className=\"inputTable\">\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t{tableHeaders.map((th, index) => (\n\t\t\t\t\t\t<th scope=\"col\" key={`th-${index}`}>\n\t\t\t\t\t\t\t{th}\n\t\t\t\t\t\t</th>\n\t\t\t\t\t))}\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t\t{data.map((row, rowNumber) =>\n\t\t\t\t\tArray.isArray(row) ? (\n\t\t\t\t\t\t<tr key={`tr-${rowNumber}`}>\n\t\t\t\t\t\t\t{row.map((td, colNumber) => (\n\t\t\t\t\t\t\t\t<td key={`td-${rowNumber}-${colNumber}`}>\n\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t\t\tid={`input-${rowNumber}-${colNumber}`}\n\t\t\t\t\t\t\t\t\t\tvalue={td}\n\t\t\t\t\t\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\t\t\t\t\t\tconst newData = deepCopy(data);\n\t\t\t\t\t\t\t\t\t\t\tnewData[rowNumber][colNumber] = e.target.value;\n\t\t\t\t\t\t\t\t\t\t\tsetData(newData);\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t{rowNumber < rowCount - 1 && (\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t<ButtonIcon\n\t\t\t\t\t\t\t\t\t\ticon=\"times\"\n\t\t\t\t\t\t\t\t\t\ttext=\"Remove row\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\tdeleteRow(rowNumber);\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t) : null\n\t\t\t\t)}\n\t\t\t</tbody>\n\t\t</table>\n\t);\n};\n"]}
|
|
@@ -8,15 +8,23 @@
|
|
|
8
8
|
height: 100%;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
.app-edit-actions
|
|
11
|
+
.app-edit-actions,
|
|
12
|
+
.app-edit-actions-right {
|
|
12
13
|
display: flex;
|
|
13
|
-
justify-content: space-between;
|
|
14
14
|
margin-top: 0.65em;
|
|
15
15
|
margin-bottom: 0.65em;
|
|
16
16
|
margin-left: 22px;
|
|
17
17
|
margin-right: 3em;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
.app-edit-actions {
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.app-edit-actions-right {
|
|
25
|
+
justify-content: flex-end;
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
.app-actions-right-wrapper {
|
|
21
29
|
width: 125px;
|
|
22
30
|
display: flex;
|
|
@@ -24,8 +24,13 @@ export const initFSBL = (windowObject) => {
|
|
|
24
24
|
addEventListener: (name, callback) => {
|
|
25
25
|
callback();
|
|
26
26
|
},
|
|
27
|
+
getFSBLInfo: () => new Promise((resolve) => {
|
|
28
|
+
resolve({
|
|
29
|
+
FSBLVersion: "1.0.0",
|
|
30
|
+
});
|
|
31
|
+
}),
|
|
27
32
|
Clients: {
|
|
28
|
-
|
|
33
|
+
TmpSmartDesktopClient: {
|
|
29
34
|
checkValidURL(url) {
|
|
30
35
|
if (url.length === 0) {
|
|
31
36
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/components/common/helpers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,CAAC,MAAM,cAAc,GAAsB,CAAC,UAAgB,EAAE,EAAE,CACrE,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IACvB,OAAO,CAAC;QACP,GAAG,EAAE,EAAE;QACP,IAAI,EAAE,UAAU,CAAC,IAAI;KACrB,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,YAAkB,EAAE,EAAE;IAE9C,MAAM,WAAW,GAAQ,MAAM,CAAC;IAEhC,IAAI,CAAC,YAAY,EAAE;QAClB,YAAY,GAAG,WAAW,CAAC,MAAM,GAAG,EAAS,CAAC;KAC9C;SAAM;QACN,YAAY,GAAG,MAAM,CAAC;QAEtB,UAAU,CAAC,G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AG,EAAE,GAAE,CAAC;SAChC;KACM,CAAC;IAET,WAAW,CAAC,IAAI,CAAC,OAAO,mCACpB,WAAW,CAAC,IAAI,CAAC,OAAO,KAC3B,YAAY,EAAE;YACb,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;SACX,GACR,CAAC;IAEF,WAAW,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,GAAG;QAC5D,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;QACxB,gBAAgB,EAAE,GAAG,EAAE,GAAE,CAAC;QAC1B,mBAAmB,EAAE,GAAG,EAAE,GAAE,CAAC;KAC7B,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,UAAU,WAAW,CAAI,SAAmB,EAAE,IAAO;IAC1D,MAAM,QAAQ,GAAa,CAAC,KAAQ,EAAE,EAAE;QACvC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAEjB,OAAO,CACN,oBAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,EAAE;YAC7B,oBAAC,SAAS,oDAAU,IAAI,GAAK,KAAK,GAAM,CAC9B,CACX,CAAC;IACH,CAAC,CAAC;IAEF,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;IAErB,OAAO,QAAQ,CAAC;AACjB,CAAC","sourcesContent":["import React from \"react\";\nimport { FileInputUploadCb } from \"./FileInput\";\nimport { Story } from \"@storybook/react/types-6-0\";\n\nimport { SDServerInfo } from \"../../types/smartDesktopDesignerTypes\";\nimport { Provider } from \"react-redux\";\nimport { createStore } from \"../../store\";\n\nexport const uploadFunction: FileInputUploadCb = (fileObject: File) =>\n\tnew Promise((resolve) => {\n\t\tresolve({\n\t\t\terr: \"\",\n\t\t\tpath: fileObject.name,\n\t\t});\n\t});\n\nexport const initFSBL = (windowObject?: any) => {\n\t// Poor man's global that can take any appendage\n\tconst globalAsAny: any = global;\n\n\tif (!windowObject) {\n\t\twindowObject = globalAsAny.window = {} as any;\n\t} else {\n\t\twindowObject = window;\n\n\t\tsetTimeout(() => {\n\t\t\tconst event = window.document.createEvent(\"Event\");\n\n\t\t\tevent?.initEvent(\"FSBLReady\", true, true);\n\n\t\t\twindow.dispatchEvent(event);\n\t\t});\n\t}\n\n\tglobalAsAny.FSBL = windowObject.FSBL = {\n\t\taddEventListener: (name: String, callback: () => void) => {\n\t\t\tcallback();\n\t\t},\n\t\tgetFSBLInfo: () =>\n\t\t\tnew Promise((resolve) => {\n\t\t\t\tresolve({\n\t\t\t\t\tFSBLVersion: \"1.0.0\",\n\t\t\t\t});\n\t\t\t}),\n\t\tClients: {\n\t\t\tTmpSmartDesktopClient: {\n\t\t\t\tcheckValidURL(url: string) {\n\t\t\t\t\tif (url.length === 0) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\treturn /^https?:\\/\\/[^\\s]+$/.test(url);\n\t\t\t\t},\n\t\t\t\tcheckValidProjectName(name: string) {\n\t\t\t\t\treturn /^[a-zA-Z0-9 \\-_.]{1,}$/.test(name) && /[a-zA-Z0-9]{1,}/.test(name);\n\t\t\t\t},\n\t\t\t} as unknown,\n\t\t\tConfigClient: {\n\t\t\t\tsetPreference: () => {},\n\t\t\t\tgetValues: () => {},\n\t\t\t\tgetPreferences: () => {},\n\t\t\t},\n\t\t\tDialogManager: {\n\t\t\t\tspawnDialog: (obj1: any) => {\n\t\t\t\t\tconsole.table(obj1);\n\t\t\t\t},\n\t\t\t\tregisterDialogCallback: () => {},\n\t\t\t\trespondToOpener: () => {},\n\t\t\t},\n\t\t\tLauncherClient: {\n\t\t\t\tshowWindow: () => {},\n\t\t\t},\n\t\t\tLogger: {\n\t\t\t\tlog: () => {},\n\t\t\t\terror: () => {},\n\t\t\t\tsystem: {\n\t\t\t\t\tdebug: () => {},\n\t\t\t\t\tlog: () => {},\n\t\t\t\t\terror: () => {},\n\t\t\t\t\tverbose: () => {},\n\t\t\t\t\tdeprecated: () => {},\n\t\t\t\t},\n\t\t\t},\n\t\t\tRouterClient: {\n\t\t\t\ttransmit: () => {},\n\t\t\t\taddListener: () => {},\n\t\t\t\tsubscribe: () => {},\n\t\t\t},\n\t\t\tStorageClient: {\n\t\t\t\tsave: () => {},\n\t\t\t\tclearCache: () => {},\n\t\t\t},\n\t\t\tWindowClient: {\n\t\t\t\tfitToDOM: () => {},\n\t\t\t},\n\t\t\tWorkspaceClient: {\n\t\t\t\tbringWindowsToFront: () => {},\n\t\t\t\tminimizeAll: () => {},\n\t\t\t\tactiveWorkspace: {\n\t\t\t\t\tname: \" \",\n\t\t\t\t},\n\t\t\t\tgetWorkspaceDefinition: (obj: Object, cb: Function) => {\n\t\t\t\t\tcb(null, null);\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tonShutdown: () => {},\n\t\tSystem: {\n\t\t\tgetSDServerInfo: () =>\n\t\t\t\tnew Promise((resolve) => {\n\t\t\t\t\tresolve({} as SDServerInfo);\n\t\t\t\t}),\n\t\t},\n\t\tSystemManagerClient: {\n\t\t\tpublishCheckpointState: () => {},\n\t\t},\n\t} as any;\n\n\tglobalAsAny.FSBL.Clients = {\n\t\t...globalAsAny.FSBL.Clients,\n\t\tWindowClient: {\n\t\t\tfitToDOM: () => {},\n\t\t} as any,\n\t};\n\n\tglobalAsAny.finsembleWindow = windowObject.finsembleWindow = {\n\t\tsetAlwaysOnTop: () => {},\n\t\taddEventListener: () => {},\n\t\tremoveEventListener: () => {},\n\t};\n};\n\nexport function createStory<T>(Component: Function, args: T) {\n\tconst template: Story<T> = (props: T) => {\n\t\tinitFSBL(window);\n\n\t\treturn (\n\t\t\t<Provider store={createStore()}>\n\t\t\t\t<Component {...{ ...args, ...props }} />\n\t\t\t</Provider>\n\t\t);\n\t};\n\n\ttemplate.args = args;\n\n\treturn template;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useState } from "react";
|
|
2
2
|
import { ColorPicker } from "../ColorPicker";
|
|
3
3
|
import "../../../assets/css/finsemble.css";
|
|
4
4
|
import "../css/styles.css";
|
|
@@ -6,26 +6,21 @@ export default {
|
|
|
6
6
|
title: "Common/ColorPicker",
|
|
7
7
|
component: ColorPicker,
|
|
8
8
|
};
|
|
9
|
-
const Template = (args) =>
|
|
9
|
+
const Template = (args) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const [startColor, setColor] = useState(args.startColor);
|
|
12
|
+
return React.createElement(ColorPicker, { id: args.id, startColor: startColor, updateColor: (_a = args.updateColor) !== null && _a !== void 0 ? _a : setColor });
|
|
13
|
+
};
|
|
10
14
|
export const EmptyField = Template.bind({});
|
|
11
15
|
EmptyField.args = {
|
|
12
16
|
startColor: "",
|
|
13
|
-
updateColor: (newColor) => {
|
|
14
|
-
console.log(newColor);
|
|
15
|
-
},
|
|
16
17
|
};
|
|
17
18
|
export const ValidColor = Template.bind({});
|
|
18
19
|
ValidColor.args = {
|
|
19
20
|
startColor: "#FF0000",
|
|
20
|
-
updateColor: (newColor) => {
|
|
21
|
-
console.log(newColor);
|
|
22
|
-
},
|
|
23
21
|
};
|
|
24
22
|
export const InvalidColor = Template.bind({});
|
|
25
23
|
InvalidColor.args = {
|
|
26
24
|
startColor: "#ZZZZZZ",
|
|
27
|
-
updateColor: (newColor) => {
|
|
28
|
-
console.log(newColor);
|
|
29
|
-
},
|
|
30
25
|
};
|
|
31
26
|
//# sourceMappingURL=ColorPicker.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.stories.js","sourceRoot":"","sources":["../../../../src/components/common/stories/ColorPicker.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ColorPicker.stories.js","sourceRoot":"","sources":["../../../../src/components/common/stories/ColorPicker.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,WAAW,EAAoB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,mCAAmC,CAAC;AAC3C,OAAO,mBAAmB,CAAC;AAG3B,eAAe;IACd,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE,WAAW;CACtB,CAAC;AAEF,MAAM,QAAQ,GAA4B,CAAC,IAAsB,EAAE,EAAE;;IAIpE,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzD,OAAO,oBAAC,WAAW,IAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAA,IAAI,CAAC,WAAW,mCAAI,QAAQ,GAAI,CAAC;AACxG,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5C,UAAU,CAAC,IAAI,GAAG;IACjB,UAAU,EAAE,EAAE;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5C,UAAU,CAAC,IAAI,GAAG;IACjB,UAAU,EAAE,SAAS;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9C,YAAY,CAAC,IAAI,GAAG;IACnB,UAAU,EAAE,SAAS;CACrB,CAAC","sourcesContent":["import React, { useState } from \"react\";\nimport { ColorPicker, ColorPickerProps } from \"../ColorPicker\";\nimport \"../../../assets/css/finsemble.css\";\nimport \"../css/styles.css\";\nimport { Story } from \"@storybook/react/types-6-0\";\n\nexport default {\n\ttitle: \"Common/ColorPicker\",\n\tcomponent: ColorPicker,\n};\n\nconst Template: Story<ColorPickerProps> = (args: ColorPickerProps) => {\n\t// The colorpicker was changed to not update its internal state\n\t// but only fire the event and instead rely on props, so for the purpose of unit testing\n\t// and storybook, let's define a mock component that synchonizes them\n\tconst [startColor, setColor] = useState(args.startColor);\n\treturn <ColorPicker id={args.id} startColor={startColor} updateColor={args.updateColor ?? setColor} />;\n};\n\nexport const EmptyField = Template.bind({});\nEmptyField.args = {\n\tstartColor: \"\",\n};\n\nexport const ValidColor = Template.bind({});\nValidColor.args = {\n\tstartColor: \"#FF0000\",\n};\n\nexport const InvalidColor = Template.bind({});\nInvalidColor.args = {\n\tstartColor: \"#ZZZZZZ\",\n};\n"]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { Story } from "@storybook/react/types-6-0";
|
|
2
3
|
import { InputTableProps } from "../InputTable";
|
|
3
4
|
import "../../../assets/css/finsemble.css";
|
|
4
5
|
import "../css/styles.css";
|
|
5
6
|
import "../css/tooltip.css";
|
|
6
7
|
declare const _default: {
|
|
7
8
|
title: string;
|
|
8
|
-
component: ({ tableHeaders,
|
|
9
|
+
component: ({ tableHeaders, setData, data }: InputTableProps) => JSX.Element;
|
|
9
10
|
};
|
|
10
11
|
export default _default;
|
|
11
|
-
export declare const Basic:
|
|
12
|
-
export declare const StartingData:
|
|
12
|
+
export declare const Basic: Story<InputTableProps>;
|
|
13
|
+
export declare const StartingData: Story<InputTableProps>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { createStory } from "../helpers";
|
|
3
2
|
import { Tooltip } from "../Tooltip";
|
|
4
3
|
import { InputTable } from "../InputTable";
|
|
5
4
|
import { action } from "@storybook/addon-actions";
|
|
@@ -10,7 +9,16 @@ export default {
|
|
|
10
9
|
title: "Common/InputTable",
|
|
11
10
|
component: InputTable,
|
|
12
11
|
};
|
|
13
|
-
|
|
12
|
+
const Template = (args) => {
|
|
13
|
+
const [data, setData] = React.useState(args.data);
|
|
14
|
+
const doSetData = (updateData) => {
|
|
15
|
+
args.setData(updateData);
|
|
16
|
+
setData(updateData);
|
|
17
|
+
};
|
|
18
|
+
return React.createElement(InputTable, { tableHeaders: args.tableHeaders, data: data, setData: doSetData });
|
|
19
|
+
};
|
|
20
|
+
export const Basic = Template.bind({});
|
|
21
|
+
Basic.args = {
|
|
14
22
|
tableHeaders: [
|
|
15
23
|
React.createElement(React.Fragment, null,
|
|
16
24
|
"Contexts",
|
|
@@ -22,14 +30,16 @@ export const Basic = createStory(InputTable, {
|
|
|
22
30
|
"Name",
|
|
23
31
|
React.createElement(Tooltip, null, "Tooltip")),
|
|
24
32
|
],
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
data: [],
|
|
34
|
+
setData: action("update"),
|
|
35
|
+
};
|
|
36
|
+
export const StartingData = Template.bind({});
|
|
37
|
+
StartingData.args = {
|
|
28
38
|
tableHeaders: ["Letter", "Number"],
|
|
29
|
-
|
|
39
|
+
data: [
|
|
30
40
|
["A", "1"],
|
|
31
41
|
["B", "2"],
|
|
32
42
|
],
|
|
33
|
-
|
|
34
|
-
}
|
|
43
|
+
setData: action("update"),
|
|
44
|
+
};
|
|
35
45
|
//# sourceMappingURL=InputTable.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputTable.stories.js","sourceRoot":"","sources":["../../../../src/components/common/stories/InputTable.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"InputTable.stories.js","sourceRoot":"","sources":["../../../../src/components/common/stories/InputTable.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,UAAU,EAAmB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,mBAAmB,CAAC;AAC3B,OAAO,oBAAoB,CAAC;AAE5B,eAAe;IACd,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,UAAU;CACrB,CAAC;AAEF,MAAM,QAAQ,GAA2B,CAAC,IAAI,EAAE,EAAE;IACjD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,CAAC,UAAsB,EAAE,EAAE;QAC5C,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACzB,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC,CAAC;IACF,OAAO,oBAAC,UAAU,IAAC,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,GAAI,CAAC;AACxF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvC,KAAK,CAAC,IAAI,GAAG;IACZ,YAAY,EAAE;QACb;;YAEC,oBAAC,OAAO,kBAAkB,CACxB;QACH;;YAEC,oBAAC,OAAO,kBAAkB,CACxB;QACH;;YAEC,oBAAC,OAAO,kBAAkB,CACxB;KACH;IACD,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9C,YAAY,CAAC,IAAI,GAAG;IACnB,YAAY,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAClC,IAAI,EAAE;QACL,CAAC,GAAG,EAAE,GAAG,CAAC;QACV,CAAC,GAAG,EAAE,GAAG,CAAC;KACV;IACD,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC;CACzB,CAAC","sourcesContent":["import React from \"react\";\nimport { Story } from \"@storybook/react/types-6-0\";\nimport { Tooltip } from \"../Tooltip\";\nimport { InputTable, InputTableProps } from \"../InputTable\";\nimport { action } from \"@storybook/addon-actions\";\nimport \"../../../assets/css/finsemble.css\";\nimport \"../css/styles.css\";\nimport \"../css/tooltip.css\";\n\nexport default {\n\ttitle: \"Common/InputTable\",\n\tcomponent: InputTable,\n};\n\nconst Template: Story<InputTableProps> = (args) => {\n\tconst [data, setData] = React.useState(args.data);\n\tconst doSetData = (updateData: string[][]) => {\n\t\targs.setData(updateData);\n\t\tsetData(updateData);\n\t};\n\treturn <InputTable tableHeaders={args.tableHeaders} data={data} setData={doSetData} />;\n};\n\nexport const Basic = Template.bind({});\nBasic.args = {\n\ttableHeaders: [\n\t\t<>\n\t\t\tContexts\n\t\t\t<Tooltip>Tooltip</Tooltip>\n\t\t</>,\n\t\t<>\n\t\t\tDisplay name\n\t\t\t<Tooltip>Tooltip</Tooltip>\n\t\t</>,\n\t\t<>\n\t\t\tName\n\t\t\t<Tooltip>Tooltip</Tooltip>\n\t\t</>,\n\t],\n\tdata: [],\n\tsetData: action(\"update\"),\n};\n\nexport const StartingData = Template.bind({});\nStartingData.args = {\n\ttableHeaders: [\"Letter\", \"Number\"],\n\tdata: [\n\t\t[\"A\", \"1\"],\n\t\t[\"B\", \"2\"],\n\t],\n\tsetData: action(\"update\"),\n};\n"]}
|
|
@@ -93,7 +93,7 @@ describe("<InputTable/>", () => {
|
|
|
93
93
|
expect(wrapper.find("input").at(2).props().value).to.equal("");
|
|
94
94
|
});
|
|
95
95
|
it("onUpdate is called after an input causes a new row to be added", () => {
|
|
96
|
-
const buttonSpy = sinon.spy(StartingData.args, "
|
|
96
|
+
const buttonSpy = sinon.spy(StartingData.args, "setData");
|
|
97
97
|
const wrapper = mount(React.createElement(StartingData, Object.assign({}, StartingData.args)));
|
|
98
98
|
expect(buttonSpy.getCall(0).args[0]).to.deep.equal([
|
|
99
99
|
["A", "1"],
|
|
@@ -123,7 +123,7 @@ describe("<InputTable/>", () => {
|
|
|
123
123
|
expect(buttonSpy.getCall(3)).to.be.null;
|
|
124
124
|
});
|
|
125
125
|
it("onUpdate is called after an input is edited", () => {
|
|
126
|
-
const buttonSpy = sinon.spy(StartingData.args, "
|
|
126
|
+
const buttonSpy = sinon.spy(StartingData.args, "setData");
|
|
127
127
|
const wrapper = mount(React.createElement(StartingData, Object.assign({}, StartingData.args)));
|
|
128
128
|
expect(buttonSpy.getCall(0).args[0]).to.deep.equal([
|
|
129
129
|
["A", "1"],
|
|
@@ -147,7 +147,7 @@ describe("<InputTable/>", () => {
|
|
|
147
147
|
expect(buttonSpy.getCall(2)).to.be.null;
|
|
148
148
|
});
|
|
149
149
|
it("onUpdate is called after a row is deleted", () => {
|
|
150
|
-
const buttonSpy = sinon.spy(StartingData.args, "
|
|
150
|
+
const buttonSpy = sinon.spy(StartingData.args, "setData");
|
|
151
151
|
const wrapper = mount(React.createElement(StartingData, Object.assign({}, StartingData.args)));
|
|
152
152
|
expect(buttonSpy.getCall(0).args[0]).to.deep.equal([
|
|
153
153
|
["A", "1"],
|