Compare commits

...

234 Commits

Author SHA1 Message Date
Albert Backenhof
be6718ccf4 Merge pull request #73 from qlik-oss/DEB-250/ImprovedSelection
Selecting with backendApi instead of Field
2019-06-17 09:30:27 +02:00
Albert Backenhof
28e6237a43 Selecting with backendApi instead of Field
-Makes it possible to select master fields with
 different names than the original field.

-Alternate state is no longer a problem when using
 this technique to select.

Issue: DEB-250
2019-06-14 08:30:57 +02:00
Albert Backenhof
79339a8963 Merge pull request #70 from qlik-oss/QLIK-95962/SpanWidth
Add option to fit cells to chart width
2019-05-29 12:19:59 +02:00
Albert Backenhof
a6faeeb656 Add option to fit cells to chart width
-To achieve pixel perfection the container of both
 header and data needs to calculate the size of the
 child tables' cells.

Issue: QLIK-95962
2019-05-28 07:44:40 +02:00
Albert Backenhof
c22b7f5c6b Merge pull request #61 from qlik-oss/DEB-232/DoubleMeasure
Made the table cell keys more unique
2019-05-27 14:37:07 +02:00
Albert Backenhof
80f97602e4 Merge pull request #69 from qlik-oss/DEB-242/ExportInContainer
Excel export inside container
2019-05-27 14:36:31 +02:00
Albert Backenhof
f745656b4c Excel export inside container
-No tid-element available when inside native container.
 Therefore, use root element to find table cells instead.

Issue: DEB-242
2019-05-27 14:33:43 +02:00
Albert Backenhof
f7e780b92e Merge pull request #68 from qlik-oss/excelType
Specifying excel type of excel download
2019-05-27 14:28:26 +02:00
Albert Backenhof
d7a76c7db9 Merge pull request #63 from qlik-oss/QLIK-95802/AltStateFix
Fixed alternate state support
2019-05-27 14:26:58 +02:00
Albert Backenhof
16c380e1c6 Fixed alternate state support
-Previously, the shown data always followed
 default state, and not the set state.
-Previously, the selections made in smart pivot
 sometimes used the previous alternate state.

Issue: QLIK-95802
2019-05-27 14:24:02 +02:00
Albert Backenhof
072a3b80c4 Merge pull request #62 from qlik-oss/DEB-233/Selections
Handle selection toggle properly
2019-05-27 14:12:43 +02:00
Albert Backenhof
5572b7ce67 Merge pull request #64 from qlik-oss/DEB-221/WidthSlider
Slider for cell width without presets
2019-05-27 14:11:01 +02:00
Albert Backenhof
71cf92c217 Slider for cell width without presets
-Previous slider only has three presets, this new
 solution sets the actual width.

Issue: DEB-221
2019-05-27 14:08:25 +02:00
Albert Backenhof
e26d5fded8 Specifying excel type of excel download 2019-05-20 10:12:22 +02:00
Albert Backenhof
20282b0b99 Merge pull request #65 from qlik-oss/QLIK-95907/QlikFormatting
Using qlik formatting measurements
2019-05-20 10:05:48 +02:00
Albert Backenhof
5f18321ccf Merge pull request #67 from qlik-oss/DEB-136/readme
Updated github readme
2019-05-20 09:07:54 +02:00
Albert Backenhof
d14f5951ac Using qlik formatting measurements
Issue: QLIK-95907
2019-05-20 08:02:15 +02:00
Albert Backenhof
5872ee7b58 Updated github readme
Issue: DEB-136
2019-05-20 07:02:45 +02:00
Albert Backenhof
1436463f59 Made the table cell keys more unique
-This makes it possible to use the same measurement
 multiple times within the same smart-pivot chart.

Issue: DEB-232
2019-05-13 13:12:32 +02:00
Albert Backenhof
729a31920d Handle selection toggle properly
-Previously, the cell selection would toggle
 the current selection. This meant, if a column
 is already selected when making a cell selection,
 the column selection would toggle off. With this
 fix the column selection stays on.

Issue: DEB-233
2019-05-13 09:43:41 +02:00
Purwa Shrivastava
6d305b21b2 Merge pull request #60 from qlik-oss/revert-59-DEB-217/CellFormatting
Revert "Fixed cell number formatting"
2019-05-10 12:48:04 +02:00
Purwa Shrivastava
0b210e0d35 Revert "Fixed cell number formatting" 2019-05-10 12:44:32 +02:00
Albert Backenhof
c8afb83130 Merge pull request #59 from qlik-oss/DEB-217/CellFormatting
Fixed cell number formatting
2019-05-10 10:19:47 +02:00
Albert Backenhof
49981f6ae3 Fixed cell number formatting
-Now will always use the built in Qlik value format.

Issue: DEB-217, DEB-218, DEB-219, DEB-220
2019-05-09 10:09:33 +02:00
Albert Backenhof
b3b17e8d0c Merge pull request #58 from qlik-oss/DEB-173/MasterObject
Fixed master object bug
2019-05-03 09:28:27 +02:00
Albert Backenhof
5d45f57e00 Fixed master object bug
-Previously the smart pivot didn't render as
 a master object.

Issue: DEB-173
2019-05-03 09:09:44 +02:00
Albert Backenhof
2f59d97cf3 Merge pull request #55 from qlik-oss/DEB-204/NewString
Updated string according to Ralf Narfeldt
2019-05-03 08:26:36 +02:00
Albert Backenhof
b8d6b0a53e Merge pull request #53 from qlik-oss/QLIK-95019/Excel
Improved excel and snapshot export
2019-05-03 08:26:25 +02:00
Purwa Shrivastava
6cc82e7b38 Merge pull request #57 from qlik-oss/DEB-213/misalignedTable
DEB-213: Mis calculated the default, changed from 23 to 25 px.
2019-05-02 14:25:28 +02:00
Purwa Shrivastava
cc7e3e62ed DEB-213: Mis calculated the default, changed from 23 to 25 px. 2019-05-02 14:19:36 +02:00
Purwa Shrivastava
26de3b63ed Merge pull request #56 from qlik-oss/DEB-213/misalignedTable
DEB-213: Introdued a minimum height for the table rows, so even if th…
2019-05-02 13:04:17 +02:00
Purwa Shrivastava
8eafeffcec DEB-213: Introdued a minimum height for the table rows, so even if the content is null, the rows are displayed even. 2019-05-02 11:31:15 +02:00
Albert Backenhof
ef7926dd13 Updated string according to Ralf Narfeldt
Issue: DEB-204
2019-04-30 14:51:30 +02:00
Albert Backenhof
af307fd24b Improved excel and snapshot export
-KPI is now included in excel.
-Snapshots now work.

Issue: QLIK-95019
2019-04-30 13:04:42 +02:00
Albert Backenhof
98401db922 Merge pull request #52 from qlik-oss/saturateMatrix
Fixed bug that prevented row saturation
2019-04-23 07:01:34 +02:00
Albert Backenhof
75771e4815 Merge pull request #50 from qlik-oss/DEB-187/ColorMeasures
Color by measure indices
2019-04-23 07:01:25 +02:00
Albert Backenhof
a12205c840 Fixed bug that prevented row saturation 2019-04-18 09:44:07 +02:00
Albert Backenhof
ebfee69c7b Merge pull request #51 from qlik-oss/DEB-188/LimitSize
Fixed layout and styling of table
2019-04-18 08:28:26 +02:00
Albert Backenhof
05c25c72cb Fixed layout and styling of table
-Now using flexbox to make the layout more
 dynamic.
-Row selection of hover works as intended.
-Improved the way scrollbars are shown.

Issue: DEB-188, DEB-192
2019-04-17 11:02:23 +02:00
Albert Backenhof
d2a24dd256 Color by measure indices
-Used to specify what measure columns should
 use conditional coloring.

Issue: DEB-187
2019-04-15 14:15:12 +02:00
Albert Backenhof
a6a6ef24b5 Merge pull request #49 from qlik-oss/DEB-183/CellSpacing
Fixed cellspacing on IE, Edge and FF
2019-04-15 07:01:48 +02:00
Albert Backenhof
8374ecce85 Merge pull request #48 from qlik-oss/DEB-182/OverlayScrollbar
Overlay scrollbar in webkit browsers
2019-04-15 07:01:29 +02:00
Albert Backenhof
0135d4fc64 Merge pull request #43 from qlik-oss/DEB-176/EmptyMeasureCells
Show cells for single-dimension tables
2019-04-15 07:01:06 +02:00
Albert Backenhof
47d7f33cb9 Merge pull request #45 from qlik-oss/DEB-168/MissingText
If dimension value doesn't contain qText use qNum
2019-04-15 07:00:46 +02:00
Albert Backenhof
4c2e483592 Merge pull request #47 from qlik-oss/DEB-153/Icon
Updated the icon to pivot-table
2019-04-12 14:24:54 +02:00
Albert Backenhof
801c7c862e Merge pull request #46 from qlik-oss/DEB-177/ConditionalColoring
Replaced semaphores with Conditional Coloring
2019-04-12 10:56:05 +02:00
Albert Backenhof
f3bda74202 Merge pull request #44 from qlik-oss/DEB-164/FontIssue
Improved header arrangement
2019-04-12 09:43:44 +02:00
Albert Backenhof
3ec5d13ae6 Fixed cellspacing on IE, Edge and FF
Issue: DEB-183
2019-04-12 09:37:49 +02:00
Albert Backenhof
2133bb44ef Overlay scrollbar in webkit browsers
-To prevent scrollbar from offsetting the cells
 those browsers that support overlay scrollbars
 should use it.

Issue: DEB-182
2019-04-12 08:15:37 +02:00
Albert Backenhof
e447666982 Merge pull request #40 from qlik-oss/DEB-160/ErrMsg
Updated default error message
2019-04-12 07:06:57 +02:00
Albert Backenhof
7038140088 Updated the icon to pivot-table
Issue: DEB-153
2019-04-11 14:48:42 +02:00
Albert Backenhof
b5d9633496 Replaced semaphores with Conditional Coloring
-Was unclear what the two semaphores did and meant.
 Also, Concept Semaphores didn't seem to work.

Issue: DEB-177
2019-04-11 14:40:06 +02:00
Albert Backenhof
a518432db4 If dimension value doesn't contain qText use qNum
Issue: DEB-168
2019-04-11 10:31:47 +02:00
Albert Backenhof
f1875702be Improved header arrangement
-Only add elements that are displayed.
-Properly align content.
-Use correct font.

Issue: DEB-163, DEB-164
2019-04-11 09:04:53 +02:00
Albert Backenhof
b1a9130663 Show cells for single-dimension tables
-Recent commit introduced a bug that prevented
 single-dimension tables from showing any cells.

Issue: DEB-176
2019-04-10 13:41:24 +02:00
Albert Backenhof
dfb30285ab Updated default error message
-Previous isn't grammatically correct.

Issue: DEB-160
2019-04-10 12:15:28 +02:00
Albert Backenhof
c8cd78ae5f Merge pull request #37 from qlik-oss/DEB-156/OnlyTwoDims
Moved design dimension to Appearance->Table format
2019-04-10 12:14:20 +02:00
Albert Backenhof
a5bc3ecd1b Moved design dimension to Appearance->Table format
-According to the documentation it should only be
 possible to set two dimensions. Previously you
 were able to set three, where the third one was
 used for styling. This wasn't obvious to the user
 though. Now, the design field is set under
 Appearance -> Table format.

Issue: DEB-156
2019-04-10 12:12:08 +02:00
Albert Backenhof
bec68e7cd4 Merge pull request #39 from qlik-oss/DEB-159/Props
Changed order of properties and added About
2019-04-10 12:05:15 +02:00
Albert Backenhof
02bba4ad5a Merge pull request #38 from qlik-oss/DEB-157/NineMeasures
1 Dim and 9 Measures OR 2 Dim and 8 Measures
2019-04-10 11:30:44 +02:00
Albert Backenhof
57c4b12b24 Merge pull request #36 from qlik-oss/DEB-154/EmptyData
Improved setup of data matrix
2019-04-10 09:13:34 +02:00
Albert Backenhof
ca33540fd6 Merge pull request #35 from qlik-oss/DEB-152/HeaderWidth
The header width should match the table format
2019-04-10 09:13:03 +02:00
Albert Backenhof
cac3fabb2f Changed order of properties and added About
Issue: DEB-159
2019-04-10 08:13:24 +02:00
Albert Backenhof
c57b0edea8 1 Dim and 9 Measures OR 2 Dim and 8 Measures
-Dynamic max values for Dimensions and Measures.

Issue: DEB-157
2019-04-10 07:50:07 +02:00
Albert Backenhof
3862bd294c Arrange matching dim1 data on the same row
-The data is not guaranteed to be processed row
 by row. Therefore, make sure to check the entire
 matrix for the correct row (not just previous row)
 when appending new row data.

Issue: DEB-155
2019-04-09 08:29:37 +02:00
Albert Backenhof
0c18523891 Empty data should result in emtpy cells
-Previously, empty data resulted in the cells
 completely missing. This caused other cells
 to not end up in the correct column.

Issue: DEB-154
2019-04-09 07:50:33 +02:00
Albert Backenhof
629821bd6b The header width should match the table format
Issue: DEB-152
2019-04-08 10:39:02 +02:00
Albert Backenhof
08c5cf8104 Merge pull request #34 from qlik-oss/DEB-130/VersionInDesc
Aligned build to how Dashboard bundle extensions
2019-04-05 14:40:13 +02:00
Tobias Åström
d3c39bea75 Merge pull request #32 from qlik-oss/tsm-color-picker-check
Update metric-semaphores.js
2019-04-05 13:46:58 +02:00
Albert Backenhof
141be3f962 Aligned build to Dashboard bundle extensions build
-Part of the work to streamline how the extensions
 are handled, irregardless of what bundle.

Issue: DEB-130, DEB-133
2019-03-27 09:53:09 +01:00
Albert Backenhof
433a725f33 Merge pull request #33 from qlik-oss/snapshotFix
New preview image and fixed snapshot
2019-03-20 10:28:52 +01:00
Albert Backenhof
769d5cfa3f New preview image and fixed snapshot
-SnapshotApi doesn't have a getProperties
 so fetching the source properties from
 qlik-app instead.

-The snapshot still cannot be rendered in the
 "printing-snapshot" test page because of
 limitations on that page.
2019-03-19 10:38:29 +01:00
Albert Backenhof
9d925b6205 Merge pull request #29 from qlik-oss/feature/QPE-427
[QPE-427] Replace csv styling with dimension styling
2019-03-18 06:57:13 +01:00
Tobias Åström
34527c3d6d Update metric-semaphores.js
We recently had a bug on the color picker when used in extensions (QLIK-94131) so I went through all extensions to check their status, this was the only one with a potential problem.
The property notation should be as I changed it now (but after fixing the bug it will work anyway). However, there might be code elsewhere in the extension that mitigates the bug, so make sure this gets tested.
2019-03-12 09:04:43 +01:00
Kristoffer Lind
35d489c2e2 add updated demo app 2019-02-28 15:58:14 +01:00
Kristoffer Lind
9ef9981305 remove demo app 2019-02-28 15:56:44 +01:00
Kristoffer Lind
398192e057 fix indent and hide when design dimension is applied 2019-02-28 15:36:56 +01:00
Kristoffer Lind
4421217cb0 set default for metric semaphores to apply to nothing 2019-02-28 15:36:56 +01:00
Kristoffer Lind
c92be00ca7 update app with corrected colors for sheet 4 2019-02-28 15:36:56 +01:00
Kristoffer Lind
c66dfdc06c only show row colors when it does not have design dimension 2019-02-28 15:36:55 +01:00
Kristoffer Lind
a882b1d6aa update demo app so its no longer saved with faulty colors 2019-02-28 15:36:55 +01:00
Kristoffer Lind
554b029569 remove unused options include external csv file and path 2019-02-28 15:36:55 +01:00
Kristoffer Lind
4a15628325 remove csv files 2019-02-28 15:36:55 +01:00
Kristoffer Lind
fdb2aaaef4 use originHyperCubeDefinition as basis for dynamically created hyperCubes 2019-02-28 15:36:55 +01:00
Kristoffer Lind
a400e9c233 use createDimension for design cube aswell 2019-02-28 15:36:55 +01:00
Kristoffer Lind
091c564a75 apply styling from dimension 2019-02-28 15:36:54 +01:00
Kristoffer Lind
99eba8afcb split qHyperCube into two cubes, one for data and one for design 2019-02-28 15:36:54 +01:00
giovanni hanselius
cb78a2f2f9 Merge pull request #31 from qlik-oss/QPE-637-header-format-fixes
[QPE 637] Header format fixes
2019-02-28 12:48:09 +01:00
Balazs Gobel
f255efbf5d Handle medium header font size better and prevent cutting text off 2019-02-28 12:40:29 +01:00
giovanni hanselius
2f2d08fedd Merge pull request #30 from qlik-oss/QPE-636-table-format-fixes
[QPE 636] Table format fixes
2019-02-28 11:02:46 +01:00
Balazs Gobel
ac8b70bc84 Use correct fallback for all fonts 2019-02-28 10:49:24 +01:00
giovanni hanselius
0f2a4f9805 Merge pull request #27 from qlik-oss/QPE-631-IE-errors
[QPE 631] Prevent console errors in IE on cell hover
2019-02-28 09:33:55 +01:00
Balazs Gobel
85228412cc show correct color in the color picker 2019-02-27 21:43:09 +01:00
Balazs Gobel
03dfc0ce93 prevent infinite loop in angular color picker
- dualOutput must be the last line
2019-02-27 21:39:59 +01:00
Balazs Gobel
48427df559 enable changing font size in headers 2019-02-27 21:39:31 +01:00
Balazs Gobel
7fda7aa2d9 better defaults when missing font family 2019-02-27 20:54:50 +01:00
Balazs Gobel
4ba12b8b2d show user-selected font-family for the cells 2019-02-27 20:51:18 +01:00
Balazs Gobel
07af7b509e Make table format work again
- working color picker
 - working font size
 - working cell text alignment
 - this is all by preventing the infinite loop in angular
2019-02-27 20:45:06 +01:00
Balazs Gobel
b7ff83e1da prevent console errors in IE on cell hover 2019-02-27 20:37:02 +01:00
giovanni hanselius
621359d6f9 Merge pull request #28 from qlik-oss/QPE-634-column-width-fix
[QPE 634] Fix column width
2019-02-27 15:06:04 +01:00
Balazs Gobel
a71f80f8fa minor cleanup 2019-02-27 14:26:27 +01:00
Balazs Gobel
a6cbfcda70 Fix column width issue
- Look at the value format to determine if column is percentage based
2019-02-27 14:25:50 +01:00
giovanni hanselius
de2e9c16ac Merge pull request #25 from qlik-oss/QPE-549-tooltip-design
[QPE 549] Minor adjustments for tooltip
2019-02-27 12:30:42 +01:00
giovanni hanselius
ad0c0dacba Merge pull request #24 from qlik-oss/QPE-622-visible-scrollbar
[QPE 622] show scrollbar for easier scrolling
2019-02-27 11:14:01 +01:00
giovanni hanselius
97564cf8b1 Merge pull request #26 from qlik-oss/QPE-600-same-padding-in-single-object-mode
[QPE 600] Use same layout in single onject mode as in normal mode
2019-02-27 11:03:33 +01:00
Balazs Gobel
7fa44c06b0 Use same layout in single onject mode as in normal mode
- same padding for single object mode
2019-02-26 16:02:40 +01:00
Balazs Gobel
dae192b7af Minor adjustments for tooltip
- Added tooltip for row header
- Better vertical alignment
- Move static styling to css
2019-02-26 15:44:17 +01:00
Balazs Gobel
5abfd5b7e5 show scrollbar for easier scrolling 2019-02-26 15:10:00 +01:00
giovanni hanselius
65f5d70654 Merge pull request #23 from qlik-oss/feature/QPE-615
[QPE-615] fix metric semaphore colors
2019-02-26 14:34:17 +01:00
Kristoffer Lind
da7ba5c3a8 fix default indexes for metric colors 2019-02-26 14:23:42 +01:00
Kristoffer Lind
6e5df323d8 update sample state 2019-02-26 11:37:31 +01:00
Kristoffer Lind
aad92678db fix metric semaphore colors 2019-02-26 11:31:24 +01:00
giovanni hanselius
15226d8598 Merge pull request #17 from qlik-oss/QPE-426
[QPE-426] color pickers
2019-02-25 15:25:29 +01:00
Balazs Gobel
a5fc586859 Merge branch 'master' into QPE-426 2019-02-25 15:14:13 +01:00
giovanni hanselius
980c0387bf Merge pull request #14 from qlik-oss/feature/QPE-549
[QPE-549] tooltip
2019-02-25 14:45:13 +01:00
Balazs Gobel
710d4a8842 Fix tests 2019-02-25 13:41:11 +01:00
Balazs Gobel
ebb5a7cf16 Additional merge conflict fixes 2019-02-25 12:59:02 +01:00
Balazs Gobel
7107f485be resolve additional merge conflict: removed obsolete code 2019-02-25 12:55:48 +01:00
Balazs Gobel
633fd39b80 Merge branch 'master' into feature/QPE-549
# Conflicts:
#	src/main.less
#	src/paint.jsx
2019-02-25 12:50:47 +01:00
Christopher Lebond
9eeaecb994 Merge pull request #22 from qlik-oss/fix-merge-issues
remove some duplicated css from merge conflicts
2019-02-22 16:11:48 +01:00
Kristoffer Lind
7305175049 fix semaphore alignment 2019-02-22 16:08:51 +01:00
Kristoffer Lind
f99281ff47 hide scrollbars in firefox 2019-02-22 16:04:24 +01:00
Kristoffer Lind
557cd1aeb6 remove some duplicated css 2019-02-22 16:04:24 +01:00
Christopher Lebond
ca5f442fe0 Merge pull request #8 from qlik-oss/feature/QPE-585
[QPE 585] Minor design fixes
2019-02-22 15:37:56 +01:00
ahmed-Bazzara
585243bb73 merge confloicts solved 2019-02-22 14:49:36 +01:00
Kristoffer Lind
a25b2c40c0 removed a few more pieces of the colors library 2019-02-22 14:30:18 +01:00
ahmed-Bazzara
46d6520273 update app added
colors set to have a fallback value
2019-02-22 14:29:23 +01:00
ahmed-Bazzara
19286f6c56 color libraries deleted and Qlik's color-pickers introduced 2019-02-22 14:29:23 +01:00
Ahmed Bazzara
8b760646ab Merge pull request #12 from qlik-oss/feature/QPE-564
[QPE-564] test setup for components and some initial tests
2019-02-22 14:21:04 +01:00
ahmed-Bazzara
b5f25e5e18 babel/plugin-proposal-class-properties added to karma.conf 2019-02-22 14:17:08 +01:00
Ahmed Bazzara
b335b4883e Merge pull request #9 from qlik-oss/feature/QPE-586-stylelint
[QPE 586] Added stricter stylelint
2019-02-22 13:51:53 +01:00
ahmed-Bazzara
94e4203a0b merge conflicts solved 2019-02-22 13:51:09 +01:00
ahmed-Bazzara
221e2d365c merge conflicts solved 2019-02-22 13:45:19 +01:00
Christopher Lebond
6797f7d561 Merge pull request #13 from qlik-oss/feature/QPE-569-change-eslint-rules
[QPE-569] Fix most of the eslint warnings
2019-02-22 13:21:45 +01:00
Christopher Lebond
f843779b64 Merge pull request #21 from qlik-oss/feature/QPE-474
[QPE-474] replace jquery scroll linking
2019-02-22 13:13:57 +01:00
ahmed-Bazzara
951d534343 merge conflicts solved 2019-02-22 12:59:57 +01:00
ahmed-Bazzara
c5acb43a7a merge conflicts solved 2019-02-22 12:59:38 +01:00
ahmed-Bazzara
979c036b49 settings file reverted 2019-02-22 12:44:44 +01:00
ahmed-Bazzara
63c877face merge conflicts solved 2019-02-22 12:40:30 +01:00
ahmed-Bazzara
9809587c68 merge conflicts solved 2019-02-22 12:12:00 +01:00
ahmed-Bazzara
808f4df3e3 merge conflicts solved 2019-02-22 12:01:41 +01:00
ahmed-Bazzara
bbadc711dc merge conflicts resolved 2019-02-22 11:56:38 +01:00
Christopher Lebond
47b4d1aa5b Merge pull request #15 from qlik-oss/feature/QPE-484
[QPE-484] Edit mode interactions
2019-02-22 11:28:35 +01:00
ahmed-Bazzara
18e2b2024e fixing alignment between cells and row-headers 2019-02-22 11:26:17 +01:00
Christopher Lebond
614d768eea Merge pull request #10 from qlik-oss/QPE-477
[QPE-477] Definition object is Qlik standard
2019-02-22 10:41:36 +01:00
Kristoffer Lind
807a609a90 fix rebase issue 2019-02-22 10:24:41 +01:00
Kristoffer Lind
82257be3a8 fix review comments 2019-02-21 18:49:07 +01:00
Kristoffer Lind
734fe33537 update sample state 2019-02-21 18:48:42 +01:00
Kristoffer Lind
347e6b7408 test setup for components and some initial tests 2019-02-21 18:38:30 +01:00
ahmed-Bazzara
bdf231f88d code enhancements 2019-02-21 18:17:45 +01:00
ahmed-Bazzara
88ad73bd41 tooltip position now follow the mouse 2019-02-21 18:17:45 +01:00
ahmed-Bazzara
530f0919f1 tooltip positioning tweaked 2019-02-21 18:17:45 +01:00
ahmed-Bazzara
79b89a3b25 all logic for tooltip has been moved to it's component
data-cell & column-header components reseted to pure ones
2019-02-21 18:17:44 +01:00
ahmed-Bazzara
4520d6a48a handling tooltip logic within it 2019-02-21 18:17:44 +01:00
ahmed-Bazzara
98678d4a13 jQuery commented code deleted 2019-02-21 18:17:44 +01:00
ahmed-Bazzara
da57204c41 console log removed 2019-02-21 18:17:44 +01:00
ahmed-Bazzara
906a11c6b4 tooltip component cleaned 2019-02-21 18:17:44 +01:00
ahmed-Bazzara
c66ad78e48 tooltip added to column header
comopnent changed to normal component to hold state in it
2019-02-21 18:17:44 +01:00
ahmed-Bazzara
6994bf51a3 showTooltip boolean changed name
skipping values that are header rows
2019-02-21 18:17:44 +01:00
ahmed-Bazzara
521d508604 commented jqeury from paint.js for tooltip 2019-02-21 18:17:43 +01:00
ahmed-Bazzara
3946f6c894 mind width set to tooltip
text inside it is center aligned
2019-02-21 18:16:38 +01:00
ahmed-Bazzara
aeccbf5d17 tooltip disabled in edit state 2019-02-21 18:16:38 +01:00
ahmed-Bazzara
95e330a50d tooltip added 2019-02-21 18:16:38 +01:00
Kristoffer Lind
555000be54 fix rebase issues 2019-02-21 17:49:05 +01:00
Kristoffer Lind
c367f24dd9 replace jquery scroll linking with components (fixing some bugs and getting rid of jquery) 2019-02-21 17:38:51 +01:00
giovanni hanselius
0b3b7b3f57 Merge pull request #19 from qlik-oss/QPE-554
[QPE-554] text alignemt
2019-02-21 17:37:00 +01:00
giovanni hanselius
44b33b4c92 Merge pull request #16 from qlik-oss/feature/QPE-550
[QPE-550] fix excel export
2019-02-21 16:48:34 +01:00
giovanni hanselius
61b339b146 Merge pull request #18 from qlik-oss/QPE-479
[QPE-479] Qlik defaults
2019-02-21 15:42:31 +01:00
ahmed-Bazzara
27b84c5623 code enhancements 2019-02-21 12:29:16 +01:00
ahmed-Bazzara
24edf1c6f4 values of text alignement property set to have lowercase 2019-02-21 12:02:42 +01:00
giovanni hanselius
fc363d7739 Merge pull request #20 from qlik-oss/export
exporting image and PDF enabled
2019-02-20 16:01:27 +01:00
ahmed-Bazzara
35d4dde118 exporting image and PDF enabled 2019-02-20 15:50:54 +01:00
ahmed-Bazzara
e70e76a401 small font size is set to be default
and its value matched to Qlik defalut font size
2019-02-20 15:44:36 +01:00
ahmed-Bazzara
a804c31658 tooltip position now follow the mouse 2019-02-19 16:58:39 +01:00
ahmed-Bazzara
9efe580d18 tooltip positioning tweaked 2019-02-19 15:41:30 +01:00
ahmed-Bazzara
bcb9d30237 sending the alignment value straight from props instead of numbers 2019-02-19 14:55:50 +01:00
Kristoffer Lind
fa60dd5248 remove unused component 2019-02-19 10:25:14 +01:00
Balazs Gobel
fd653de0e1 Fix most of the eslint warnings 2019-02-19 10:23:24 +01:00
ahmed-Bazzara
ec140efc56 Text alignment property added 2019-02-18 16:42:39 +01:00
ahmed-Bazzara
34477d7ef1 qlik font added to the fonts dropdown
and was made a default value
2019-02-18 16:12:40 +01:00
Tobias Åström
b65d1c51fc Update qlik-smart-pivot.qext 2019-02-16 10:49:46 +01:00
Tobias Åström
9111ec762b Update config.yml 2019-02-16 10:48:49 +01:00
ahmed-Bazzara
48970cb4f4 all logic for tooltip has been moved to it's component
data-cell & column-header components reseted to pure ones
2019-02-15 11:33:43 +01:00
ahmed-Bazzara
fe4b5a72ec handling tooltip logic within it 2019-02-15 09:56:32 +01:00
ahmed-Bazzara
8b41022ddc jQuery commented code deleted 2019-02-15 09:32:55 +01:00
ahmed-Bazzara
9c66c09899 console log removed 2019-02-15 09:26:16 +01:00
ahmed-Bazzara
09d9055643 tooltip component cleaned 2019-02-15 08:56:26 +01:00
ahmed-Bazzara
b1204e0929 tooltip added to column header
comopnent changed to normal component to hold state in it
2019-02-15 08:56:02 +01:00
ahmed-Bazzara
d130ca266d showTooltip boolean changed name
skipping values that are header rows
2019-02-15 08:55:13 +01:00
ahmed-Bazzara
f730dc2827 commented jqeury from paint.js for tooltip 2019-02-15 08:54:11 +01:00
ahmed-Bazzara
b5f74395f7 mind width set to tooltip
text inside it is center aligned
2019-02-15 08:53:35 +01:00
Kristoffer Lind
b86806d4cd cleanup tooltips (resulted in whatever header was last hovered to be appended to each column header in xls) 2019-02-14 15:14:23 +01:00
ahmed-Bazzara
dfac9ad5e9 tooltip disabled in edit state 2019-02-14 14:04:15 +01:00
ahmed-Bazzara
db67b864ee edit mode interaction prevented 2019-02-14 13:54:17 +01:00
ahmed-Bazzara
377d642fe2 tooltip added 2019-02-14 13:02:59 +01:00
Kristoffer Lind
c3651a37da Merge branch 'master' into feature/QPE-550 2019-02-14 12:36:55 +01:00
Kristoffer Lind
8b843e028a fix excel export 2019-02-14 11:08:34 +01:00
John Lunde
2bdd98aaca Merge pull request #7 from qlik-oss/feature/QPE-563
[QPE-563] Let react handle rendering
2019-02-14 10:38:32 +01:00
Kristoffer Lind
d723451656 revert accidental design change 2019-02-13 13:52:20 +01:00
ahmed-Bazzara
c47b401a1d typo in definiton object 2019-02-12 12:05:01 +01:00
ahmed-Bazzara
3c330465dd Definition object is Qlik standard 2019-02-12 12:03:05 +01:00
Kristoffer Lind
f2f201c6e2 let react handle rendering 2019-02-12 11:26:31 +01:00
Balazs Gobel
8984affe87 minor cleanup 2019-02-12 11:25:22 +01:00
Balazs Gobel
ce1e196b78 Follow the same principle as the old application
- Restyle table cells only when metric semaphore is enabled
2019-02-12 11:25:22 +01:00
Balazs Gobel
e3b7a7640e Fixed misalignment when it's only one dimension 2019-02-12 11:25:22 +01:00
Balazs Gobel
68dccf8575 Fix pixel misalignment between table header and body 2019-02-12 11:25:22 +01:00
Balazs Gobel
8e100f286b Fix alternating colours 2019-02-12 11:25:22 +01:00
Balazs Gobel
f7ceb5c2bf Added stricter stylint rules 2019-02-12 11:24:13 +01:00
John Lunde
8e1394e898 Merge pull request #6 from qlik-oss/feature/QPE-548
[QPE-548] refactor focusing on data structure
2019-02-11 15:23:02 +01:00
Kristoffer Lind
c69cfec533 Merge branch 'master' into feature/QPE-548 2019-02-07 13:49:21 +01:00
Kristoffer Lind
c4a717bd77 fix single dimension custom style headers 2019-02-07 11:12:49 +01:00
Kristoffer Lind
31e9be5220 Merge pull request #5 from qlik-oss/feature/QPE-575-multi-load-babel
[QPE 575] Load babel only once for a page
2019-02-07 10:43:22 +01:00
Kristoffer Lind
b979a579f9 refactor row-wrapper according to new data structure 2019-02-07 10:30:41 +01:00
Kristoffer Lind
6233b9dbae refactor header-wrapper according to new data structure 2019-02-07 10:20:19 +01:00
Kristoffer Lind
9b682e62f8 create new data structure 2019-02-07 10:19:42 +01:00
Balazs Gobel
462b4a13a2 Load babel only once for a page
- Fixed when having multiple visualisations on one page
- Babel will load only once
2019-02-01 12:22:25 +01:00
Kristoffer Lind
2c6d978333 Merge pull request #4 from qlik-oss/feature/QPE-518
[QPE-518] Conversion and refactor
2019-01-30 16:10:47 +01:00
Kristoffer Lind
d669457ed9 fix the fix (messed up when removing else statement) 2019-01-30 15:16:21 +01:00
Kristoffer Lind
8ef5ef6450 rework baseCSS to reuse base object when possible 2019-01-30 15:01:09 +01:00
Kristoffer Lind
f6e629d9eb update paths to csv file and excel button 2019-01-30 12:43:54 +01:00
Kristoffer Lind
2322a5cdab fix 1-dim issue with headers 2019-01-30 11:07:27 +01:00
Kristoffer Lind
8a86fe4a30 refactor entrypoint 2019-01-30 08:44:45 +01:00
Kristoffer Lind
08cba41e18 init converted components in paint 2019-01-29 17:28:34 +01:00
Kristoffer Lind
9cfbb148fb fix eslint and review issues 2019-01-29 14:31:55 +01:00
Kristoffer Lind
4fd1cc1c3f Merge branch 'feature/QPE-555' into feature/QPE-518 2019-01-29 08:23:33 +01:00
Kristoffer Lind
2bf9259fdc some refactoring to get rid of duplicated code in row-lists 2019-01-25 18:43:02 +01:00
Kristoffer Lind
f0121b3a75 convert row-wrapper 2019-01-25 14:02:26 +01:00
Kristoffer Lind
5012db27a8 finalize component conversion 2019-01-24 09:07:36 +01:00
Kristoffer Lind
ec6713112a WIP: convert header-wrapper 2018-12-21 15:47:12 +01:00
Kristoffer Lind
86f009fd3f extract row wrapper 2018-12-21 14:24:43 +01:00
Kristoffer Lind
228053483a refactor: extract header-wrapper 2018-12-20 15:27:28 +01:00
Kristoffer Lind
76d835c15b fix messed up this references and some refactoring 2018-12-20 12:55:46 +01:00
Kristoffer Lind
22004e30c6 fix faulty css selector 2018-12-20 12:53:43 +01:00
Kristoffer Lind
d5662e2746 remove npm jquery dependency (jquery is supplied by qlik) 2018-12-20 12:52:58 +01:00
57 changed files with 3752 additions and 5544 deletions

View File

@@ -19,8 +19,13 @@ jobs:
name: Install dependencies
command: npm install
- run:
name: Run tests
command: npm run test-once
name: BlackDuck scan
command: curl -s https://blackducksoftware.github.io/hub-detect/hub-detect.sh | bash -s -- \
--blackduck.url="https://qliktech.blackducksoftware.com" \
--blackduck.trust.cert=true \
--blackduck.username="svc-blackduck" \
--blackduck.password=${svc_blackduck} \
--detect.project.name="viz-bundle-qlik-smart-pivot"
bump-version:
<<: *defaults
@@ -48,16 +53,18 @@ jobs:
command: |
export VERSION=$(scripts/get-bumped-version.sh)
echo "Version: ${VERSION}"
npm run build
npm run build:zip
sudo chmod +x scripts/verify-files.sh
scripts/verify-files.sh
environment:
NODE_ENV: production
- persist_to_workspace:
root: ~/qlik-smart-pivot
paths:
- build
- dist
- store_artifacts:
path: build
destination: build
path: dist
destination: dist
deploy:
<<: *defaults
steps:

View File

@@ -15,6 +15,7 @@ module.exports = {
},
globals: {
angular: false,
beforeEach: false,
define: false,
describe: false,
document: false,
@@ -41,12 +42,12 @@ module.exports = {
"no-cond-assign": ["warn"],
"no-fallthrough": ["warn"],
"no-undef": ["error"],
"no-unused-vars": ["warn"],
"no-use-before-define": ["warn", { "functions": false, "classes": false, "variables": false }],
"no-unused-vars": ["error"],
"no-use-before-define": ["error", { "functions": false, "classes": false, "variables": false }],
"no-useless-escape": ["warn"],
"no-useless-return": ["warn"],
"no-underscore-dangle": ["warn", { "allow": ["_id"] }],
"no-redeclare": ["warn"],
"no-redeclare": ["error"],
"no-restricted-syntax": ["warn"],
"operator-linebreak": ["warn", "before"],
"prefer-promise-reject-errors": ["warn"],
@@ -57,9 +58,83 @@ module.exports = {
"no-implied-eval": ["error"],
"no-debugger": ["warn"],
"no-unreachable": ["warn"],
"quotes": ["warn", "single", { "avoidEscape": true }]
"quotes": ["warn", "single", { "avoidEscape": true }],
"sort-imports": ["off"],
"max-lines-per-function": ["off"], // marks the entire functions, a bit too noisy
"complexity": ["warn"],
"camelcase": ["warn"],
"max-statements": ["off"], // marks the entire functions, a bit too noisy
"sort-vars": ["off"], // not much value for the work
"init-declarations": ["off"],
"capitalized-comments": ["off"],
"one-var": ["off"],
"no-var": ["error"],
"no-plusplus": ["warn"],
"vars-on-top": ["off"],
"no-magic-numbers": ["off"], // useful, but also complains for reasonable checks with actual numbers
"new-cap": ["warn"],
"block-scoped-var": ["warn"],
"require-unicode-regexp": ["off"],
"no-negated-condition": ["warn"],
"operator-assignment": ["off"],
"no-extra-parens": ["off"],
"quote-props": ["off"],
"prefer-template": ["warn"],
"no-lonely-if": ["warn"],
"sort-keys": ["off"], // not much value for the work
"no-implicit-coercion": ["warn"],
"no-inline-comments": ["off"],
"spaced-comment": ["warn"],
"require-jsdoc": ["off"],
"func-style": ["off"],
"func-names": ["off"],
"id-length": ["warn"],
"prefer-arrow-callback": ["warn"],
"dot-location": ["off"],
"line-comment-position": ["off"],
"no-warning-comments": ["warn"],
"multiline-comment-style": ["off"],
"consistent-return": ["warn"],
"no-else-return": ["warn"],
"array-bracket-newline": ["warn"],
"array-element-newline": ["warn"],
"object-shorthand": ["warn"],
"eqeqeq": ["warn"],
"no-empty-function": ["off"],
"function-paren-newline": ["warn"],
"no-invalid-this": ["warn"],
"newline-per-chained-call": ["warn"],
"no-unused-expressions": ["warn"],
"strict": ["warn"],
"no-ternary": ["off"],
"multiline-ternary": ["off"],
"no-param-reassign": ["error"],
"prefer-destructuring": ["warn"],
"arrow-parens": ["off"],
"no-array-constructor": ["warn"],
"default-case": ["warn"],
"no-alert": ["warn"],
"max-params": ["warn"],
"brace-style": ["warn", "1tbs", { "allowSingleLine": true }],
"prefer-const": ["warn"],
"class-methods-use-this":["warn"],
// plugin:react
"react/jsx-indent": ["warn", 2],
"react/jsx-indent-props": ["warn", 2],
"react/forbid-prop-types": ["warn"],
"react/no-array-index-key": ["warn"],
"react/jsx-sort-props": ["warn"],
"react/require-default-props": ["warn"],
"react/sort-prop-types": ["warn"],
"react/jsx-max-props-per-line": ["warn"],
"react/jsx-no-literals": ["off"],
"react/jsx-max-depth": ["off"], // rule throws exception in single-dimension-measure
"react/jsx-filename-extension": ["warn"],
"react/prefer-stateless-function": ["warn"],
"react/no-set-state": ["warn"]
},
extends: [
"eslint:recommended"
"eslint:all",
"plugin:react/all"
]
}

1
.gitattributes vendored
View File

@@ -22,6 +22,7 @@
*.scss text eol=lf
*.html text eol=lf
*.js text eol=lf
*.jsx text eol=lf
*.json text eol=lf
*.md text eol=lf
*.sh text eol=lf

2
.gitignore vendored
View File

@@ -19,7 +19,7 @@ $RECYCLE.BIN/
# Temporary build files
node_modules/
build/
dist/
BUMPED_VERSION
# =========================

View File

@@ -1,57 +1,22 @@
# P&L Smart Pivot, a Qlik Sense Extension for Financial reporting
[![CircleCI](https://circleci.com/gh/qlik-oss/PLSmartPivot.svg?style=svg)](https://circleci.com/gh/qlik-oss/PLSmartPivot)
This extension is part of the extension bundles for Qlik Sense. The repository is maintained and moderated by Qlik RD.
This extension is useful to create reports where the look&feel is rellevantand and pivot a second dimension is needed. Based on P&L Smart.
It's specifically focused on financial reports, trying to solve some common needs of this area:
- smart export to excel
- easy creation of reports
- custom corporate reporting (bold, italic, background color, letter size, headers,...)
- selections inside the reports
- custom external templates
- analytical reports
# Manual
You'll find a manual [Qlik Sense P&LSmart Pivot Extension Manual.pdf](resources/Qlik Sense P&LSmart Pivot Extension Manual.pdf) and one app example [P&LSmartPivot_demo.qvf](resources/P&LSmartPivot_demo.qvf).
# If the import does not work at first time
- remove [Accounts.csv](resources/Accounts.csv), [Accounts2.csv](resources/Accounts2.csv) and [Excel.png](resources/Excel.png), zip it again and import.
- Then reintroduce [Accounts.csv](resources/Accounts.csv), [Accounts2.csv](resources/Accounts2.csv) and [Excel.png](resources/Excel.png), zip it again and import.
# Installation
1. Download the extension zip, `qlik-smart-pivot_<version>.zip`, from the latest release(https://github.com/qlik-oss/PLSmartPivot/releases/latest)
2. Install the extension:
a. **Qlik Sense Desktop**: unzip to a directory under [My Documents]/Qlik/Sense/Extensions.
b. **Qlik Sense Server**: import the zip file in the QMC.
Feel free to fork and suggest pull requests for improvements and bug fixes. Changes will be moderated and reviewed before inclusion in future bundle versions. Please note that emphasis is on backward compatibility, i.e. breaking changes will most likely not be approved.
Usage documentation for the extension is available at https://help.qlik.com.
# Developing the extension
If you want to do code changes to the extension follow these simple steps to get going.
1. Get Qlik Sense Desktop
1. Create a new app and add the extension to a sheet.
1. Create a new app and add P&L pivot to a sheet.
2. Clone the repository
3. Run `npm install`
4. Set the environment variable `BUILD_PATH` to your extensions directory. It will be something like `C:/Users/<user>/Documents/Qlik/Sense/Extensions/<extension_name>`.
5. You now have two options. Either run the watch task or the build task. They are explained below. Both of them default to development mode but can be run in production by setting `NODE_ENV=production` before running the npm task.
a. **Watch**: `npm run watch`. This will start a watcher which will rebuild the extension and output all needed files to the `buildFolder` for each code change you make. See your changes directly in your Qlik Sense app.
b. **Build**: `npm run build`. If you want to build the extension package. The output zip-file can be found in the `buildFolder`.
4. Run `npm run build` - to build a dev-version to the /dist folder.
5. Move the content of the /dist folder to the extension directory. Usually in `C:/Users/<user>/Documents/Qlik/Sense/Extensions/qlik-smart-pivot`.
# Original authors
[github.com/iviasensio](https://github.com/iviasensio)
# License
Released under the [MIT License](LICENSE).
Released under the [MIT License](LICENSE).

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -1,16 +0,0 @@
{
"name": "Smart pivot",
"description": "Formatted table for P&L reports.",
"type": "visualization",
"version": "X.Y.Z",
"icon": "table",
"preview": "",
"author": "Ivan Felipe Asensio <ivan.felipe@qlik.com>",
"homepage": "",
"keywords": "qlik-sense, visualization",
"license": "MIT",
"repository": "https://github.com/qlik-oss/PLSmartPivot",
"dependencies": {
"qlik-sense": ">=5.5.x"
}
}

View File

@@ -1,3 +0,0 @@
qlik-smart-pivot.js;
qlik-smart-pivot.css;
qlik-smart-pivot.qext

View File

@@ -1,23 +1,61 @@
var gulp = require('gulp');
var gutil = require('gulp-util');
var zip = require('gulp-zip');
var del = require('del');
var path = require('path');
var settings = require('./settings');
var webpackConfig = require('./webpack.config');
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var jeditor = require("gulp-json-editor");
var pkg = require('./package.json');
var srcFiles = path.resolve('./src/**/*.*');
var DIST = './dist';
var VERSION = process.env.VERSION || 'local-dev';
gulp.task('remove-build-folder', function(){
return del([settings.buildDestination], { force: true });
gulp.task('qext', function () {
var qext = {
name: 'P&L pivot',
type: 'visualization',
description: pkg.description + '\nVersion: ' + VERSION,
version: VERSION,
icon: 'pivot-table',
preview: 'qlik-smart-pivot.png',
keywords: 'qlik-sense, visualization',
author: pkg.author,
homepage: pkg.homepage,
license: pkg.license,
repository: pkg.repository,
dependencies: {
'qlik-sense': '>=5.5.x'
}
};
if (pkg.contributors) {
qext.contributors = pkg.contributors;
}
var src = require('stream').Readable({
objectMode: true
});
src._read = function () {
this.push(new gutil.File({
cwd: '',
base: '',
path: pkg.name + '.qext',
contents: Buffer.from(JSON.stringify(qext, null, 4))
}));
this.push(null);
};
return src.pipe(gulp.dest(DIST));
});
gulp.task('clean', function(){
return del([DIST], { force: true });
});
gulp.task('zip-build', function(){
return gulp.src(settings.buildDestination + '/**/*')
.pipe(zip(`${settings.name}_${settings.version}.zip`))
.pipe(gulp.dest(settings.buildDestination));
return gulp.src(DIST + '/**/*')
.pipe(zip(`${pkg.name}_${VERSION}.zip`))
.pipe(gulp.dest(DIST));
});
gulp.task('add-assets', function(){
return gulp.src('./assets/**/*').pipe(gulp.dest(DIST));
});
gulp.task('webpack-build', done => {
@@ -36,40 +74,14 @@ gulp.task('webpack-build', done => {
});
});
gulp.task('update-qext-version', function () {
return gulp.src(`${settings.buildDestination}/${settings.name}.qext`)
.pipe(jeditor({
'version': settings.version
}))
.pipe(gulp.dest(settings.buildDestination));
});
gulp.task('build',
gulp.series('remove-build-folder', 'webpack-build', 'update-qext-version', 'zip-build')
gulp.series('clean', 'webpack-build', 'qext', 'add-assets')
);
gulp.task('zip',
gulp.series('build', 'zip-build')
);
gulp.task('default',
gulp.series('build')
);
gulp.task('watch', () => new Promise((resolve, reject) => {
webpackConfig.entry.unshift('webpack-dev-server/client?http://localhost:' + settings.port);
const compiler = webpack(webpackConfig);
const originalOutputFileSystem = compiler.outputFileSystem;
const devServer = new WebpackDevServer(compiler, {
headers: {
"Access-Control-Allow-Origin": "*"
},
}).listen(settings.port, 'localhost', error => {
compiler.outputFileSystem = originalOutputFileSystem;
if (error) {
console.error(error); // eslint-disable-line no-console
return reject(error);
}
// eslint-disable-next-line no-console
console.log('Listening at localhost:' + settings.port);
resolve(null, devServer);
});
}));

View File

@@ -1,43 +0,0 @@
const settings = require('./settings');
module.exports = (config) => {
config.set({
browsers: ['SlimChromeHeadless'],
customLaunchers: {
SlimChromeHeadless: {
base: 'ChromeHeadless',
flags: ['--headless', '--disable-gpu', '--disable-translate', '--disable-extensions']
}
},
files: [
{ pattern: 'src/*.spec.js', watched: false }
],
frameworks: ['jasmine'],
preprocessors: {
'src/*.spec.js': ['webpack', 'sourcemap']
},
webpack: {
devtool: 'source-map',
mode: settings.mode,
externals: {
jquery: {
amd: 'jquery',
commonjs: 'jquery',
commonjs2: 'jquery',
root: '_'
},
},
module: {
rules: [
{
test: /\.js$/,
exclude: [/node_modules/],
loaders: ['babel-loader']
},
{ test: /\.less$/, loader: 'ignore-loader' },
{ test: /\.json$/, loader: 'ignore-loader' }
]
}
}
});
};

3123
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,48 +1,48 @@
{
"name": "qlik-smart-pivot",
"version": "0.0.1",
"description": "Formatted table for P&L reports.",
"keywords": "smart pivot qliksense extension",
"description": "Profit & Loss reporting with color and font customizations.",
"homepage": "",
"repository": "https://github.com/iviasensio/PLSmartPivot",
"author": "Ivan Felipe Asensio <ivan.felipe@qlik.com>",
"license": "MIT",
"scripts": {
"build": "gulp build",
"build:zip": "gulp zip",
"eslint": "eslint src",
"eslint:fix": "eslint --fix src",
"test": "karma start karma.conf.js",
"test-once": "karma start karma.conf.js --single-run",
"watch": "gulp watch"
"stylelint": "stylelint src/main.less"
},
"devDependencies": {
"@babel/core": "7.1.2",
"@babel/plugin-proposal-class-properties": "7.3.3",
"@babel/plugin-transform-async-to-generator": "7.1.0",
"@babel/polyfill": "7.0.0",
"@babel/preset-env": "7.1.0",
"@babel/preset-react": "7.0.0",
"babel-eslint": "10.0.1",
"babel-loader": "8.0.4",
"copy-webpack-plugin": "4.5.3",
"css-loader": "1.0.0",
"del": "2.0.2",
"enzyme": "3.8.0",
"enzyme-adapter-react-16": "1.9.1",
"eslint": "5.7.0",
"eslint-loader": "2.1.1",
"eslint-plugin-react": "7.11.1",
"gulp": "4.0.0",
"gulp-json-editor": "2.4.3",
"gulp-util": "^3.0.7",
"gulp-zip": "3.0.2",
"jasmine-core": "3.2.1",
"jquery": "3.3.1",
"karma": "3.0.0",
"karma-chrome-launcher": "2.2.0",
"karma-jasmine": "1.1.2",
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "3.0.5",
"less": "3.8.1",
"less-loader": "4.1.0",
"lodash.merge": "4.6.1",
"style-loader": "0.23.1",
"stylelint": "8.4.0",
"stylelint-webpack-plugin": "0.10.5",
"text-loader": "0.0.1",
"webpack": "4.20.2",
"webpack-cli": "3.1.2",
"webpack-dev-server": "3.1.10"
"webpack": "4.20.2"
},
"dependencies": {
"prop-types": "15.6.2",
"react": "16.7.0",
"react-dom": "16.7.0"
}
}

View File

@@ -1,44 +0,0 @@
Accounts;Bold;Background;FontStyle;LetterColor;Align;Size;Comment
Revenues;;rgb(183, 219, 255);<italic>;;<center>;;<comment>
Gross sales revenues;;;;;;;
Less return & allowances;;;;;;;
Net sales revenues;<bold>;<soft>;;;;;
Cost of goods sold;<bold>;;;;;;
Direct materials;;;;;;;
Direct labor;;;;;;;
Manufacturing overhead;;#b7dbff;<italic>;;<center>;;<comment>
Indirect labor;;;;;;;
Depreciation, manufacturing equip;;;;;;;
Other mfr overhead;;;;;;;
Net mfr overhead;<bold>;<violete>;;;;;
Net costs of goods sold;<bold>;<violete>;;;;;
Gross profit;<bold>;<dark>;;;<center>;<large>;
Operating expenses;<bold>;;<italic>;;;;
Selling expenses;;;;;;;
Sales salaries;;;;;;;
Warranty expenses;;;;;;;
Depreciation, store equipment;;;;;;;
Other selling expenses3;;;;;;;
Total selling expenses;<bold>;<violete>;;;;;
General & administrative expenses;;#b7dbff;<italic>;;<center>;;<comment>
Administration salaries;;;;;;;
Rent expenses;;;;;;;
Depreciation, computers;;;;;;;
Other general & admin expenses;;;;;;;
total general & admin expenses;<bold>;<soft>;;;;;
total operating expenses;<bold>;<violete>;;;;;
Operating income before taxes;<bold>;<dark>;;<white>;;<large>;
Financial revenue & expenses;;#b7dbff;<italic>;;<center>;;<comment>
Revenue from investments;;;;;;;
Less interest expenses;;;;;;;
Net financial gain (expense);;;;;;;
Income before tax & extraordinary items;<bold>;<dark>;;<white>;;<large>;
Less income tax on operations;;;;;;;
Income before extraordinary items;;;;;;;
Extraordinary items;;#b7dbff;<italic>;;<center>;;<comment>
Sale of land;;;;;;;
Less initial cost;;;;;;;
Net gain on sale of land;<bold>;<soft>;;;;;
Less income tax on gain;;;;;;;
Extraordinary items after tax;<bold>;<soft>;;;;;
Net Income (Profit);<bold>;<dark>;;<white>;<center>;<large>;
1 Accounts Bold Background FontStyle LetterColor Align Size Comment
2 Revenues rgb(183, 219, 255) <italic> <center> <comment>
3 Gross sales revenues
4 Less return & allowances
5 Net sales revenues <bold> <soft>
6 Cost of goods sold <bold>
7 Direct materials
8 Direct labor
9 Manufacturing overhead #b7dbff <italic> <center> <comment>
10 Indirect labor
11 Depreciation, manufacturing equip
12 Other mfr overhead
13 Net mfr overhead <bold> <violete>
14 Net costs of goods sold <bold> <violete>
15 Gross profit <bold> <dark> <center> <large>
16 Operating expenses <bold> <italic>
17 Selling expenses
18 Sales salaries
19 Warranty expenses
20 Depreciation, store equipment
21 Other selling expenses3
22 Total selling expenses <bold> <violete>
23 General & administrative expenses #b7dbff <italic> <center> <comment>
24 Administration salaries
25 Rent expenses
26 Depreciation, computers
27 Other general & admin expenses
28 total general & admin expenses <bold> <soft>
29 total operating expenses <bold> <violete>
30 Operating income before taxes <bold> <dark> <white> <large>
31 Financial revenue & expenses #b7dbff <italic> <center> <comment>
32 Revenue from investments
33 Less interest expenses
34 Net financial gain (expense)
35 Income before tax & extraordinary items <bold> <dark> <white> <large>
36 Less income tax on operations
37 Income before extraordinary items
38 Extraordinary items #b7dbff <italic> <center> <comment>
39 Sale of land
40 Less initial cost
41 Net gain on sale of land <bold> <soft>
42 Less income tax on gain
43 Extraordinary items after tax <bold> <soft>
44 Net Income (Profit) <bold> <dark> <white> <center> <large>

View File

@@ -1,21 +0,0 @@
Accounts;Bold;Background;FontStyle;LetterColor;Align;Size;Comment
Revenues;<bold>;;<italic>;;<center>;;<comment>
Net sales revenues;<bold>;rgb(128, 191, 255);;;;;
Cost of goods sold;<bold>;rgb(128, 191, 255);;;;;
Manufacturing overhead;<bold>;;<italic>;;<center>;;<comment>
Net mfr overhead;<bold>;rgb(128, 191, 255);;;;;
Net costs of goods sold;<bold>;rgb(128, 191, 255);;;;;
Gross profit;<bold>;rgb(0, 102, 204);<white>;;<center>;<large>;
Operating expenses;<bold>;;<italic>;;;;
Total selling expenses;<bold>;rgb(128, 191, 255);;;;;
General & administrative expenses;<bold>;;<italic>;;<center>;;<comment>
Other general & admin expenses;<bold>;rgb(128, 191, 255);<white>;;<center>;<large>;
total general & admin expenses;<bold>;<soft>;;;;;
total operating expenses;<bold>;rgb(128, 191, 255);;;;;
Operating income before taxes;<bold>;rgb(0, 102, 204);;<white>;;<large>;
Financial revenue & expenses;<bold>;;<italic>;;<center>;;<comment>
Income before tax & extraordinary items;<bold>;rgb(0, 102, 204);;<white>;;<large>;
Extraordinary items;<bold>;;<italic>;;<center>;;<comment>
Net gain on sale of land;<bold>;rgb(0, 102, 204);<white>;;<center>;<large>;
Extraordinary items after tax;<bold>;rgb(0, 102, 204);<white>;;<center>;<large>;
Net Income (Profit);<bold>;<night>;;<white>;<center>;<large>;
1 Accounts Bold Background FontStyle LetterColor Align Size Comment
2 Revenues <bold> <italic> <center> <comment>
3 Net sales revenues <bold> rgb(128, 191, 255)
4 Cost of goods sold <bold> rgb(128, 191, 255)
5 Manufacturing overhead <bold> <italic> <center> <comment>
6 Net mfr overhead <bold> rgb(128, 191, 255)
7 Net costs of goods sold <bold> rgb(128, 191, 255)
8 Gross profit <bold> rgb(0, 102, 204) <white> <center> <large>
9 Operating expenses <bold> <italic>
10 Total selling expenses <bold> rgb(128, 191, 255)
11 General & administrative expenses <bold> <italic> <center> <comment>
12 Other general & admin expenses <bold> rgb(128, 191, 255) <white> <center> <large>
13 total general & admin expenses <bold> <soft>
14 total operating expenses <bold> rgb(128, 191, 255)
15 Operating income before taxes <bold> rgb(0, 102, 204) <white> <large>
16 Financial revenue & expenses <bold> <italic> <center> <comment>
17 Income before tax & extraordinary items <bold> rgb(0, 102, 204) <white> <large>
18 Extraordinary items <bold> <italic> <center> <comment>
19 Net gain on sale of land <bold> rgb(0, 102, 204) <white> <center> <large>
20 Extraordinary items after tax <bold> rgb(0, 102, 204) <white> <center> <large>
21 Net Income (Profit) <bold> <night> <white> <center> <large>

Binary file not shown.

View File

@@ -1,21 +0,0 @@
Accounts;Bold;Background;FontStyle;LetterColor;Align;Size;Comment
Revenues;<bold>;;<italic>;;<center>;;<comment>
Net sales revenues;<bold>;RGB(225,226,226);;;;;
Cost of goods sold;<bold>;RGB(225,226,226);;;;;
Manufacturing overhead;<bold>;;<italic>;;<center>;;<comment>
Net mfr overhead;<bold>;RGB(225,226,226);;;;;
Net costs of goods sold;<bold>;RGB(225,226,226);;;;;
Gross profit;<bold>;RGB(193,216,47);;;<center>;<large>;
Operating expenses;<bold>;;<italic>;;;;
Total selling expenses;<bold>;RGB(225,226,226);;;;;
General & administrative expenses;<bold>;;<italic>;;<center>;;<comment>
Other general & admin expenses;<bold>;rgb(128, 191, 255);<white>;;<center>;<large>;
total general & admin expenses;<bold>;<soft>;;;;;
total operating expenses;<bold>;rgb(128, 191, 255);<white>;;;;
Operating income before taxes;<bold>;RGB(193,216,47);;;;<large>;
Financial revenue & expenses;<bold>;;<italic>;;<center>;;<comment>
Income before tax & extraordinary items;<bold>;RGB(193,216,47);;;;<large>;
Extraordinary items;<bold>;;<italic>;;<center>;;<comment>
Net gain on sale of land;<bold>;RGB(193,216,47);;;<center>;<large>;
Extraordinary items after tax;<bold>;RGB(193,216,47);;;<center>;<large>;
Net Income (Profit);<bold>;<night>;;<white>;<center>;<large>;
1 Accounts Bold Background FontStyle LetterColor Align Size Comment
2 Revenues <bold> <italic> <center> <comment>
3 Net sales revenues <bold> RGB(225,226,226)
4 Cost of goods sold <bold> RGB(225,226,226)
5 Manufacturing overhead <bold> <italic> <center> <comment>
6 Net mfr overhead <bold> RGB(225,226,226)
7 Net costs of goods sold <bold> RGB(225,226,226)
8 Gross profit <bold> RGB(193,216,47) <center> <large>
9 Operating expenses <bold> <italic>
10 Total selling expenses <bold> RGB(225,226,226)
11 General & administrative expenses <bold> <italic> <center> <comment>
12 Other general & admin expenses <bold> rgb(128, 191, 255) <white> <center> <large>
13 total general & admin expenses <bold> <soft>
14 total operating expenses <bold> rgb(128, 191, 255) <white>
15 Operating income before taxes <bold> RGB(193,216,47) <large>
16 Financial revenue & expenses <bold> <italic> <center> <comment>
17 Income before tax & extraordinary items <bold> RGB(193,216,47) <large>
18 Extraordinary items <bold> <italic> <center> <comment>
19 Net gain on sale of land <bold> RGB(193,216,47) <center> <large>
20 Extraordinary items after tax <bold> RGB(193,216,47) <center> <large>
21 Net Income (Profit) <bold> <night> <white> <center> <large>

View File

@@ -2,8 +2,8 @@
set -o errexit
echo "Creating release for version: $VERSION"
echo "Artifact name: ./build/${3}_${VERSION}.zip"
$HOME/bin/ghr -t ${ghoauth} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} "./build/${3}_${4}.zip"
echo "Artifact name: ./dist/${3}_${VERSION}.zip"
$HOME/bin/ghr -t ${ghoauth} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} "./dist/${3}_${4}.zip"
# Usage

25
scripts/verify-files.sh Normal file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
# The build script has a known race-condition that sometimes causes it to not include all files
# in the built zip. This script verifies the that the zip contains the correct number of files.
set -o errexit
echo "Verifying built file count"
while read line; do
if [[ $line =~ ^\"name\": ]]; then
name=${line#*: \"}
name=${name%\"*}
fi
done < package.json
expected_file_count=$(($(find dist -type f | wc -l)-1))
zip_file_count=$(zipinfo dist/${name}_${VERSION}.zip | grep ^- | wc -l)
if [ "${expected_file_count}" -ne "${zip_file_count}" ]; then
# File count is incorrect
echo "Expected file count ${expected_file_count}, but was ${zip_file_count}"
exit 1
fi
echo "File count OK"
exit 0

View File

@@ -1,13 +0,0 @@
const path = require('path');
const packageJSON = require('./package.json');
const defaultBuildDestination = path.resolve("./build");
module.exports = {
buildDestination: process.env.BUILD_PATH || defaultBuildDestination,
mode: process.env.NODE_ENV || 'development',
name: packageJSON.name,
version: process.env.VERSION || 'local-dev',
url: process.env.BUILD_URL || defaultBuildDestination,
port: process.env.PORT || 8085
};

View File

@@ -1,294 +0,0 @@
.qv-object-PLSmartPivot div.qv-object-content-container {
overflow-x:scroll;
overflow-y:hidden;
z-index:110
}
.qv-object-PLSmartPivot icon-xls {
text-align:left
}
.qv-object-PLSmartPivot button {
width: 100%;
}
.qv-object-PLSmartPivot table{
border-collapse:collapse;
border-spacing:0;
width:auto;
border-left:1px solid #d3d3d3;
border-right:1px solid #d3d3d3;
border-top:1px solid #d3d3d3
}
.qv-object-PLSmartPivot td, th{
border: 1px solid #ffffff;
padding:5px;
border-collapse: collapse;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
cursor: default;
}
.qv-object-PLSmartPivot .empty{
width:3%;
background:#ffffff;
min-width:4px !important;
max-width:4px !important;
/*border-right:1px solid white;
box-shadow:4px 2px 8px #e1e1e1
border-bottom:0;
border-top:0;
border-left:1px solid #d3d3d3;
border-right:1px solid #d3d3d3;
border-top:#fff 1px solid;
border-bottom:#fff 1px solid*/
}
.qv-object-PLSmartPivot th.main-kpi{
text-align:center;
vertical-align:middle;
border-bottom:1px solid #d3d3d3
}
.qv-object-PLSmartPivot .numeric{
text-align:right
}
.grid{
height:50px;
width:350px
}
.header-wrapper{
position:absolute;
top:0;
z-index:1
}
/*popups for headers*/
.tooltip
{
position: fixed!important;
color: RGB(70,70,70);
background-color: RGB(245,239,207);
text-align: center;
border: groove;
}
/*end popups*/
.row-wrapper{
position:absolute;
top:97px;
height:100%!Important;
overflow-x:hidden;
overflow-y:scroll;
padding:0;
margin-top:0;
}
/*This is for wrap text in headers*/
.qv-object-PLSmartPivot .wrapclass25{
width:100%;
height:25px;
white-space: pre-line;
overflow: hidden;
display:block;
}
.qv-object-PLSmartPivot .wrapclass45{
width:100%;
height:45px;
white-space: pre-line;
overflow: hidden;
display:block;
}
.qv-object-PLSmartPivot .wrapclass70{
width:100%;
height:70px;
white-space: pre-line;
overflow: hidden;
display:inline-block;
vertical-align: middle;
line-height: 20px;
}
.qv-object-PLSmartPivot .wrapclassEmpty{
width:100%;
}
/*******************/
/* Medium column size*/
/*******************/
/*body*/
.qv-object-PLSmartPivot .grid-cells{
min-width:70px!Important;
max-width:70px!Important;
cursor: pointer;
/*padding:5px 10px;
margin:0;*/
}
/*header*/
.qv-object-PLSmartPivot .grid-cells2{
min-width:69px!Important;
max-width:69px!Important;
cursor: pointer;
/*padding:5px 10px;
margin:0;*/
}
/*body*/
.qv-object-PLSmartPivot .grid-cells-small{
min-width:52px!Important;
max-width:52px!Important;
cursor: pointer;
/*padding:5px 10px;
margin:0;*/
}
/*header*/
.qv-object-PLSmartPivot .grid-cells2-small{
min-width:51px!Important;
max-width:51px!Important;
cursor: pointer;
/*padding:5px 10px;
margin:0;*/
}
/*******************/
/* Small column size*/
/*******************/
/*body*/
.qv-object-PLSmartPivot .grid-cells-s{
min-width:67px!Important;
max-width:67px!Important;
cursor: pointer;
/*padding:5px 10px;
margin:0;*/
}
/*header*/
.qv-object-PLSmartPivot .grid-cells2-s{
min-width:66px!Important;
max-width:66px!Important;
cursor: pointer;
/*padding:5px 10px;
margin:0;*/
}
/*body*/
.qv-object-PLSmartPivot .grid-cells-small-s{
min-width:52px!Important;
max-width:52px!Important;
cursor: pointer;
/*padding:5px 10px;
margin:0;*/
}
/*header*/
.qv-object-PLSmartPivot .grid-cells2-small-s{
min-width:51px!Important;
max-width:51px!Important;
cursor: pointer;
/*padding:5px 10px;
margin:0;*/
}
/*******************/
/* large column size*/
/*******************/
/*body*/
.qv-object-PLSmartPivot .grid-cells-l{
min-width:82px!Important;
max-width:82px!Important;
cursor: pointer;
/*padding:5px 10px;
margin:0;*/
}
/*header*/
.qv-object-PLSmartPivot .grid-cells2-l{
min-width:81px!Important;
max-width:81px!Important;
cursor: pointer;
/*padding:5px 10px;
margin:0;*/
}
/*body*/
.qv-object-PLSmartPivot .grid-cells-small-l{
min-width:66px!Important;
max-width:66px!Important;
cursor: pointer;
/*padding:5px 10px;
margin:0;*/
}
/*header*/
.qv-object-PLSmartPivot .grid-cells2-small-l{
min-width:65px!Important;
max-width:65px!Important;
cursor: pointer;
/*padding:5px 10px;
margin:0;*/
}
/*END OF GRID CELLS*/
/*First Column*/
.qv-object-PLSmartPivot .fdim-cells{
min-width:230px!Important;
max-width:230px!Important;
cursor: pointer;
background-color:white;
/*padding:0 20px*/
}
.qv-object-PLSmartPivot .fdim-cells:hover {
/*cursor: default;*/
background-color:#808080 !important;
color:#ffffff;
}
.qv-object-PLSmartPivot tbody tr:hover {
cursor: default;
background-color:#808080 !important;
color:#ffffff;
}
.qv-object-PLSmartPivot .grid-cells-header{
/*padding:15px 10px*/
padding:0px
}
.qv-object-PLSmartPivot .grid-cells-title{
min-width:522px
}
/*estos dos hcen referencia a la primera columna*/
.kpi-table .fdim-cells{
/*padding:5px 10px*/
}
.data-table .fdim-cells{
display:none
}
.kpi-table{
width:240px !important;
overflow:hidden !important;
display:table;
height:100%;
z-index:100;
/*background:white;*/
left:258px;
margin:0;
padding:0;
z-index:999;
position:absolute;
top:0;
left:0;
border-right:1px solid white;
box-shadow:4px 2px 8px #e1e1e1
}
.kpi-table .row-wrapper{
overflow:hidden
}
.data-table{
width:272px !important;
float:left;
display:table;
height:100%;
z-index:90;
position:absolute;
margin-left:253px;
-ms-overflow-style:none
}

View File

@@ -1,220 +0,0 @@
@TableBorder: 1px solid #d3d3d3;
@KpiTableWidth: 230px;
._cell(@Width: 50px) {
min-width: @Width!important;
max-width: @Width!important;
cursor: pointer;
line-height: 1em!important;
}
.qv-object-PLSmartPivot {
* {
box-sizing: border-box;
}
div.qv-object-content-container {
overflow-x: scroll;
overflow-y: hidden;
z-index: 110;
}
.icon-xls {
text-align: left;
}
button {
width: 100%;
}
table {
border-collapse: collapse;
border-spacing: 0;
width: auto;
border-left: @TableBorder;
border-right: @TableBorder;
border-top: @TableBorder;
}
td, th {
border: 1px solid #ffffff;
padding: 5px;
border-collapse: collapse;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
cursor: default;
}
.empty {
width: 3%;
background: #ffffff;
min-width: 4px !important;
max-width: 4px !important;
}
th.main-kpi {
text-align: center;
vertical-align: middle;
border-bottom: @TableBorder;
}
.numeric {
text-align: right;
}
/*This is for wrap text in headers*/
.wrapclass25 {
width: 100%;
height: 25px;
white-space: pre-line;
overflow: hidden;
display: block;
}
.wrapclass45 {
width: 100%;
height: 45px;
white-space: pre-line;
overflow: hidden;
display: block;
}
.wrapclass70 {
width: 100%;
height: 70px;
white-space: pre-line;
overflow: hidden;
display: inline-block;
vertical-align: middle;
line-height: 20px;
}
.wrapclassEmpty {
width: 100%;
}
/*******************/
/* Medium column size*/
/*******************/
.grid-cells { ._cell(70px); }
.grid-cells2 { ._cell(70px); }
.grid-cells-small { ._cell(52px); }
.grid-cells2-small { ._cell(52px); }
/*******************/
/* Small column size*/
/*******************/
.grid-cells-s { ._cell(67px); }
.grid-cells2-s { ._cell(67px); }
.grid-cells-small-s { ._cell(52px); }
.grid-cells2-small-s { ._cell(52px); }
/*******************/
/* large column size*/
/*******************/
.grid-cells-l { ._cell(82px); }
.grid-cells2-l { ._cell(82px); }
.grid-cells-small-l { ._cell(66px); }
.grid-cells2-small-l { ._cell(66px); }
/*END OF GRID CELLS*/
/*First Column*/
.fdim-cells {
min-width: 230px !Important;
max-width: 230px !Important;
cursor: pointer;
background-color: white;
}
.fdim-cells:hover {
/*cursor: default;*/
background-color: #808080 !important;
color: #ffffff;
}
tbody tr:hover {
cursor: default;
background-color: #808080 !important;
color: #ffffff;
}
.grid-cells-header {
padding: 0px;
}
.grid-cells-title {
min-width: 522px;
}
.grid-cells:before {
content: "\00a0";
}
}
.grid {
height: 50px;
width: 350px;
}
.header-wrapper {
position: absolute;
top: 0;
z-index: 1;
}
/*popups for headers*/
.tooltip {
position: fixed !important;
color: RGB(70,70,70);
background-color: RGB(245,239,207);
text-align: center;
border: groove;
}
/*end popups*/
.row-wrapper {
position: absolute;
top: 97px;
height: 100% !Important;
overflow-x: hidden;
overflow-y: scroll;
padding: 0;
margin-top: 0;
}
/*estos dos hcen referencia a la primera columna*/
.kpi-table .fdim-cells {
line-height: 1em!important;
}
.data-table .fdim-cells {
display: none;
}
.kpi-table {
width: @KpiTableWidth !important;
overflow: hidden !important;
display: table;
height: 100%;
z-index: 100;
left: 258px;
margin: 0;
padding: 0;
z-index: 999;
position: absolute;
top: 0;
left: 0;
border-right: 1px solid white;
box-shadow: 4px 2px 8px #e1e1e1;
}
.kpi-table .row-wrapper {
overflow: hidden;
}
.data-table {
width: 272px !important;
float: left;
display: table;
height: 100%;
z-index: 90;
position: absolute;
margin-left: @KpiTableWidth + 13px;
-ms-overflow-style: none;
}

View File

@@ -0,0 +1,149 @@
import React from 'react';
import PropTypes from 'prop-types';
import Tooltip from '../tooltip/index.jsx';
class DataCell extends React.PureComponent {
constructor (props) {
super(props);
this.handleSelect = this.handleSelect.bind(this);
}
handleSelect () {
const {
data: {
meta: {
dimensionCount
}
},
general: {
allowFilteringByClick
},
measurement,
component
} = this.props;
const hasSecondDimension = dimensionCount > 1;
if (!allowFilteringByClick) {
return;
}
component.backendApi.selectValues(0, [measurement.parents.dimension1.elementNumber], false);
if (hasSecondDimension) {
component.backendApi.selectValues(1, [measurement.parents.dimension2.elementNumber], false);
}
}
render () {
const {
cellWidth,
measurement,
styleBuilder,
styling
} = this.props;
let textAlignment = styling.options.textAlignment || 'Right';
let cellStyle = {
fontFamily: styling.options.fontFamily,
...styleBuilder.getStyle(),
paddingLeft: '5px',
textAlign: textAlignment,
minWidth: cellWidth,
maxWidth: cellWidth
};
const isEmptyCell = measurement.displayValue === '';
let formattedMeasurementValue;
if (isEmptyCell || styleBuilder.hasComments()) {
formattedMeasurementValue = '';
cellStyle.cursor = 'default';
} else {
formattedMeasurementValue = formatMeasurementValue(measurement, styling);
}
const { conditionalColoring } = styling;
if (conditionalColoring.enabled) {
const isValidConditionalColoringValue = !styleBuilder.hasComments() && !isNaN(measurement.value);
const isSpecifiedRow =
conditionalColoring.rows.indexOf(measurement.parents.dimension1.header) !== -1;
const isSpecifiedMeasure =
conditionalColoring.measures.indexOf(measurement.parents.measurement.index) !== -1;
const shouldHaveConditionalColoring = (conditionalColoring.colorAllRows || isSpecifiedRow)
&& (conditionalColoring.colorAllMeasures || isSpecifiedMeasure);
if (isValidConditionalColoringValue && shouldHaveConditionalColoring) {
const { color, textColor } = getConditionalColor(measurement, conditionalColoring);
cellStyle.backgroundColor = color.color;
cellStyle.color = textColor.color;
}
}
return (
<td
className="grid-cells"
onClick={isEmptyCell ? null : this.handleSelect}
style={cellStyle}
>
<Tooltip
styling={styling}
tooltipText={formattedMeasurementValue}
>
{formattedMeasurementValue}
</Tooltip>
</td>
);
}
}
DataCell.propTypes = {
cellWidth: PropTypes.string.isRequired,
data: PropTypes.shape({
headers: PropTypes.shape({
measurements: PropTypes.array.isRequired
}).isRequired,
meta: PropTypes.shape({
dimensionCount: PropTypes.number.isRequired
}).isRequired
}).isRequired,
general: PropTypes.shape({}).isRequired,
measurement: PropTypes.shape({
format: PropTypes.string,
name: PropTypes.string,
value: PropTypes.any
}).isRequired,
component: PropTypes.shape({
backendApi: PropTypes.shape({
selectValues: function (props, propName) {
if (props.isSnapshot || typeof props[propName] === 'function') {
return null;
}
return new Error('Missing implementation of qlik.backendApi.selectValues.');
}
}).isRequired
}).isRequired,
styleBuilder: PropTypes.shape({
hasComments: PropTypes.func.isRequired
}).isRequired,
styling: PropTypes.shape({
symbolForNulls: PropTypes.any.isRequired
}).isRequired
};
export default DataCell;
function formatMeasurementValue (measurement, styling) {
if (isNaN(measurement.value)) {
return styling.symbolForNulls;
}
return measurement.displayValue;
}
function getConditionalColor (measurement, conditionalColoring) {
if (measurement.value < conditionalColoring.threshold.poor) {
return conditionalColoring.colors.poor;
}
if (measurement.value < conditionalColoring.threshold.fair) {
return conditionalColoring.colors.fair;
}
return conditionalColoring.colors.good;
}

View File

@@ -0,0 +1,28 @@
import React from 'react';
import PropTypes from 'prop-types';
const HeaderPadding = ({ styleBuilder, styling }) => {
if (styling.usePadding && !styleBuilder.hasCustomFileStyle()) {
const paddingStyle = {
fontFamily: styling.options.fontFamily,
marginLeft: '15px'
};
return (
<span style={paddingStyle} />
);
}
return null;
};
HeaderPadding.propTypes = {
styleBuilder: PropTypes.shape({
hasCustomFileStyle: PropTypes.func.isRequired
}).isRequired,
styling: PropTypes.shape({
options: PropTypes.shape({
fontFamily: PropTypes.string.isRequired
}).isRequired
}).isRequired
};
export default HeaderPadding;

129
src/data-table/index.jsx Normal file
View File

@@ -0,0 +1,129 @@
import React from 'react';
import PropTypes from 'prop-types';
import StyleBuilder from '../style-builder';
import DataCell from './data-cell.jsx';
import RowHeader from './row-header.jsx';
import { injectSeparators } from '../utilities';
class DataTable extends React.PureComponent {
render () {
const {
cellWidth,
columnSeparatorWidth,
component,
data,
general,
renderData,
styling
} = this.props;
const {
headers: {
dimension1,
measurements
},
matrix
} = data;
const separatorStyle = {
minWidth: columnSeparatorWidth,
maxWidth: columnSeparatorWidth
};
return (
<div className="row-wrapper">
<table>
<tbody>
{dimension1.map((dimensionEntry, dimensionIndex) => {
const rowHeaderText = dimensionEntry.displayValue || '';
if (rowHeaderText === '-') {
return null;
}
const styleBuilder = new StyleBuilder(styling);
if (styling.hasCustomFileStyle) {
styleBuilder.parseCustomFileStyle(rowHeaderText);
} else {
styleBuilder.applyStandardAttributes(dimensionIndex);
styleBuilder.applyCustomStyle({
fontSize: `${14 + styling.options.fontSizeAdjustment}px`
});
}
const rowStyle = {
fontFamily: styling.options.fontFamily,
width: '230px',
...styleBuilder.getStyle()
};
return (
<tr key={dimensionEntry.displayValue}>
{!renderData ?
<RowHeader
component={component}
entry={dimensionEntry}
rowStyle={rowStyle}
styleBuilder={styleBuilder}
styling={styling}
/> : null
}
{renderData && injectSeparators(
matrix[dimensionIndex],
columnSeparatorWidth,
{ atEvery: measurements.length }
).map((measurementData, index) => {
if (measurementData.isSeparator) {
return (
<td
className="empty"
key={`${dimensionEntry.displayValue}-${index}-separator`}
style={separatorStyle}
/>
);
}
const { dimension1: dimension1Info, dimension2, measurement } = measurementData.parents;
const id = `${dimension1Info.elementNumber}-${dimension2 && dimension2.elementNumber}-${measurement.header}-${measurement.index}`;
return (
<DataCell
cellWidth={cellWidth}
component={component}
data={data}
general={general}
key={`${dimensionEntry.displayValue}-${id}`}
measurement={measurementData}
styleBuilder={styleBuilder}
styling={styling}
/>
);
})}
</tr>
);
})}
</tbody>
</table>
</div>
);
}
}
DataTable.defaultProps = {
renderData: true
};
DataTable.propTypes = {
cellWidth: PropTypes.string.isRequired,
columnSeparatorWidth: PropTypes.string.isRequired,
data: PropTypes.shape({
headers: PropTypes.shape({
dimension1: PropTypes.array.isRequired
}).isRequired,
matrix: PropTypes.arrayOf(PropTypes.array.isRequired).isRequired
}).isRequired,
general: PropTypes.shape({}).isRequired,
component: PropTypes.shape({}).isRequired,
renderData: PropTypes.bool,
styling: PropTypes.shape({
hasCustomFileStyle: PropTypes.bool.isRequired
}).isRequired
};
export default DataTable;

View File

@@ -0,0 +1,64 @@
import React from 'react';
import PropTypes from 'prop-types';
import HeaderPadding from './header-padding.jsx';
import Tooltip from '../tooltip/index.jsx';
class RowHeader extends React.PureComponent {
constructor (props) {
super(props);
this.handleSelect = this.handleSelect.bind(this);
}
handleSelect () {
const { component, entry } = this.props;
component.backendApi.selectValues(0, [entry.elementNumber], false);
}
render () {
const { entry, rowStyle, styleBuilder, styling, component } = this.props;
const inEditState = component.inEditState();
return (
<td
className="fdim-cells"
onClick={this.handleSelect}
style={rowStyle}
>
<Tooltip
isTooltipActive={!inEditState}
styling={styling}
tooltipText={entry.displayValue}
>
<HeaderPadding
styleBuilder={styleBuilder}
styling={styling}
/>
{entry.displayValue}
</Tooltip>
</td>
);
}
}
RowHeader.propTypes = {
entry: PropTypes.shape({
displayValue: PropTypes.string.isRequired,
elementNumber: PropTypes.number.isRequired
}).isRequired,
component: PropTypes.shape({
backendApi: PropTypes.shape({
selectValues: function (props, propName) {
if (props.isSnapshot || typeof props[propName] === 'function') {
return null;
}
return new Error('Missing implementation of qlik.backendApi.selectValues.');
}
}).isRequired
}).isRequired,
rowStyle: PropTypes.shape({}).isRequired,
styleBuilder: PropTypes.shape({}).isRequired,
styling: PropTypes.shape({}).isRequired
};
export default RowHeader;

68
src/dataset.js Normal file
View File

@@ -0,0 +1,68 @@
import qlik from 'qlik';
function createCube (definition, app) {
return new Promise(resolve => {
app.createCube(definition, resolve);
});
}
async function buildDataCube (originCubeDefinition, hasTwoDimensions, app) {
const cubeDefinition = {
...originCubeDefinition,
qInitialDataFetch: [
{
qHeight: 1000,
qWidth: 10
}
],
qDimensions: [originCubeDefinition.qDimensions[0]],
qMeasures: originCubeDefinition.qMeasures
};
if (hasTwoDimensions) {
cubeDefinition.qDimensions.push(originCubeDefinition.qDimensions[1]);
}
const cube = await createCube(cubeDefinition, app);
const cubeMatrix = cube.qHyperCube.qDataPages[0].qMatrix;
app.destroySessionObject(cube.qInfo.qId);
return cubeMatrix;
}
export async function initializeDataCube (component, layout) {
if (component.backendApi.isSnapshot) {
return layout.snapshotData.dataCube;
}
const app = qlik.currApp(component);
const properties = (await component.backendApi.getProperties());
// If this is a master object, fetch the hyperCubeDef of the original object
let hyperCubeDef = properties.qExtendsId
? (await app.getObjectProperties(properties.qExtendsId)).properties.qHyperCubeDef
: properties.qHyperCubeDef;
hyperCubeDef = JSON.parse(JSON.stringify(hyperCubeDef));
hyperCubeDef.qStateName = layout.qStateName;
return buildDataCube(hyperCubeDef, layout.qHyperCube.qDimensionInfo.length === 2, app);
}
export function initializeDesignList (component, layout) {
if (component.backendApi.isSnapshot) {
return layout.snapshotData.designList;
}
if (!layout.stylingfield) {
return null;
}
return new Promise(resolve => {
const app = qlik.currApp(component);
const stylingField = app.field(layout.stylingfield);
const listener = function () {
const data = stylingField.rows.map(row => row.qText);
stylingField.OnData.unbind(listener);
resolve(data);
};
stylingField.OnData.bind(listener);
stylingField.getData();
});
}

View File

@@ -0,0 +1,199 @@
const conditionalColoring = {
type: 'items',
label: 'Color by performance',
items: {
Enabled: {
ref: 'conditionalcoloring.enabled',
type: 'boolean',
label: 'Enabled',
component: 'switch',
defaultValue: false,
options: [
{
value: true,
label: 'On'
},
{
value: false,
label: 'Off'
}
]
},
ColorAllRows: {
ref: 'conditionalcoloring.colorall',
type: 'boolean',
label: 'Color all rows',
component: 'switch',
defaultValue: true,
options: [
{
value: true,
label: 'All rows'
},
{
value: false,
label: 'Specified rows'
}
],
show (data) {
return data.conditionalcoloring.enabled;
}
},
Rows: {
type: 'array',
ref: 'conditionalcoloring.rows',
label: 'Rows to color',
itemTitleRef: function (data) {
return data.rowname;
},
allowAdd: true,
allowRemove: true,
addTranslation: 'Add row to color',
items: {
Row: {
ref: 'rowname',
label: 'Name of row',
type: 'string',
defaultValue: ''
}
},
show (data) {
return data.conditionalcoloring.enabled && !data.conditionalcoloring.colorall;
}
},
ColorAllMeasures: {
ref: 'conditionalcoloring.colorallmeasures',
type: 'boolean',
label: 'Color all measures',
component: 'switch',
defaultValue: true,
options: [
{
value: true,
label: 'All measures'
},
{
value: false,
label: 'Specified measures'
}
],
show (data) {
return data.conditionalcoloring.enabled;
}
},
Measures: {
ref: 'conditionalcoloring.measures',
translation: 'Measures by index (ex: 0,3)',
type: 'string',
defaultValue: '',
show (data) {
return data.conditionalcoloring.enabled
&& data.conditionalcoloring.colorallmeasures === false;
}
},
ThresholdPoor: {
ref: 'conditionalcoloring.threshold_poor',
translation: 'Poor range limit',
type: 'number',
defaultValue: -0.1,
show (data) {
return data.conditionalcoloring.enabled;
}
},
ColorPoor: {
ref: 'conditionalcoloring.color_poor',
label: 'Poor background color',
type: 'object',
component: 'color-picker',
dualOutput: true,
defaultValue: {
index: 10,
color: '#f93f17'
},
show (data) {
return data.conditionalcoloring.enabled;
}
},
TextColorPoor: {
ref: 'conditionalcoloring.textcolor_poor',
label: 'Poor text color',
type: 'object',
component: 'color-picker',
dualOutput: true,
defaultValue: {
index: 1,
color: '#ffffff'
},
show (data) {
return data.conditionalcoloring.enabled;
}
},
ThresholdFair: {
ref: 'conditionalcoloring.threshold_fair',
translation: 'Fair range limit',
type: 'number',
defaultValue: 0,
show (data) {
return data.conditionalcoloring.enabled;
}
},
ColorFair: {
ref: 'conditionalcoloring.color_fair',
label: 'Fair background color',
type: 'object',
component: 'color-picker',
dualOutput: true,
defaultValue: {
index: 8,
color: '#ffcf02'
},
show (data) {
return data.conditionalcoloring.enabled;
}
},
TextColorFair: {
ref: 'conditionalcoloring.textcolor_fair',
label: 'Fair text color',
type: 'object',
component: 'color-picker',
dualOutput: true,
defaultValue: {
index: 15,
color: '#000000'
},
show (data) {
return data.conditionalcoloring.enabled;
}
},
ColorGood: {
ref: 'conditionalcoloring.color_good',
label: 'Good background color',
type: 'object',
component: 'color-picker',
dualOutput: true,
defaultValue: {
index: 3,
color: '#276e27'
},
show (data) {
return data.conditionalcoloring.enabled;
}
},
TextColorGood: {
ref: 'conditionalcoloring.textcolor_good',
label: 'Good text color',
type: 'object',
component: 'color-picker',
dualOutput: true,
defaultValue: {
index: 1,
color: '#ffffff'
},
show (data) {
return data.conditionalcoloring.enabled;
}
}
}
};
export default conditionalColoring;

68
src/definition/header.js Normal file
View File

@@ -0,0 +1,68 @@
const header = {
type: 'items',
label: 'Header format',
items: {
Align: {
ref: 'HeaderAlign',
translation: 'Header alignment',
type: 'number',
component: 'buttongroup',
options: [
{
value: 1,
label: 'Left'
},
{
value: 2,
label: 'Center'
},
{
value: 3,
label: 'Right'
}
],
defaultValue: 2
},
headercolors: {
component: 'color-picker',
defaultValue: {
index: 6,
color: '#4477aa'
},
label: 'Background color',
ref: 'HeaderColorSchema',
type: 'object',
dualOutput: true
},
HeaderTextColor: {
ref: 'HeaderTextColorSchema',
label: 'Text color',
component: 'color-picker',
defaultValue: {
index: 1,
color: '#ffffff'
},
type: 'object',
dualOutput: true
},
HeaderFontSize: {
ref: 'lettersizeheader',
translation: 'Font size',
type: 'number',
component: 'buttongroup',
options: [
{
value: 1,
label: 'Small'
},
{
value: 2,
label: 'Medium'
}
],
defaultValue: 1
}
}
};
export default header;

56
src/definition/index.js Normal file
View File

@@ -0,0 +1,56 @@
import pagination from './pagination';
import header from './header';
import tableFormat from './table-format';
import conditionalColoring from './conditional-coloring';
const definition = {
component: 'accordion',
items: {
data: {
items: {
dimensions: {
disabledRef: ''
},
measures: {
disabledRef: ''
}
},
uses: 'data'
},
sorting: {
uses: 'sorting'
},
settings: {
items: {
Formatted: tableFormat,
Header: header,
ConditionalColoring: conditionalColoring,
Pagination: pagination
},
uses: 'settings'
},
about: {
component: 'items',
label: 'About',
items: {
header: {
label: 'P&L pivot',
style: 'header',
component: 'text'
},
paragraph1: {
label: `P&L pivot is a Qlik Sense extension which allows you to display Profit & Loss
reporting with color and font customizations.`,
component: 'text'
},
paragraph2: {
label: 'P&L pivot is based upon an extension created by Ivan Felipe Asensio.',
component: 'text'
}
}
}
},
type: 'items'
};
export default definition;

View File

@@ -0,0 +1,63 @@
const pagination = {
type: 'items',
label: 'Pagination',
items: {
MaxPaginationLoops: {
ref: 'maxloops',
type: 'number',
component: 'dropdown',
label: 'Max pagination loops',
options: [
{
value: 1,
label: '10k cells'
},
{
value: 2,
label: '20k cells'
},
{
value: 3,
label: '30k cells'
},
{
value: 4,
label: '40k cells'
},
{
value: 5,
label: '50k cells'
},
{
value: 6,
label: '60k cells'
},
{
value: 7,
label: '70k cells'
},
{
value: 8,
label: '80k cells'
},
{
value: 9,
label: '90k cells'
},
{
value: 10,
label: '100k cells'
}
],
defaultValue: 2
},
ErrorMessage: {
ref: 'errormessage',
label: 'Default error message',
type: 'string',
defaultValue: 'Unable to display all the data. Apply more filters to limit the amount of displayed data.'
}
}
};
export default pagination;

View File

@@ -0,0 +1,283 @@
const qlik = window.require('qlik');
// fixes case for when there are 3 dimensions, missies the case with 1 design dimension and 1 data dimension
function hasDesignDimension (data) {
return data.qHyperCubeDef.qDimensions.length > 2;
}
function getFieldList () {
return new Promise(function (resolve) {
const app = qlik.currApp();
app.getList('FieldList').then(function (model) {
// Close the model to prevent any updates.
app.destroySessionObject(model.layout.qInfo.qId);
// This is a bit iffy, might be smarter to reject and handle empty lists on the props instead.
if (!model.layout.qFieldList.qItems) {
return resolve([]);
}
// Resolve an array with master objects.
return resolve(model.layout.qFieldList.qItems.map(function (item) {
return {
value: item.qName,
label: item.qName
};
}));
});
});
}
const tableFormat = {
type: 'items',
label: 'Table format',
items: {
StylingField: {
ref: 'stylingfield',
disabledRef: '',
type: 'string',
component: 'dropdown',
label: 'Style template field',
options: function () {
return getFieldList().then(function (items) {
items.unshift(
{
value: '',
label: 'None'
});
return items;
});
}
},
IndentBool: {
ref: 'indentbool',
type: 'boolean',
label: 'Indent',
defaultValue: false,
show: data => !hasDesignDimension(data)
},
SeparatorColumns: {
ref: 'separatorcols',
type: 'boolean',
label: 'Column separators',
defaultValue: false
},
rowEvenBGColor: {
component: 'color-picker',
defaultValue: {
color: '#fff',
index: 1
},
label: 'Even row background color',
ref: 'rowEvenBGColor',
type: 'object',
dualOutput: true,
show: data => !hasDesignDimension(data)
},
rowOddBGColor: {
component: 'color-picker',
defaultValue: {
color: '#b6d7ea',
index: 4
},
label: 'Odd row background color',
ref: 'rowOddBGColor',
type: 'object',
dualOutput: true,
show: data => !hasDesignDimension(data)
},
BodyTextColor: {
ref: 'BodyTextColorSchema',
type: 'string',
component: 'dropdown',
label: 'Text body color',
options: [
{
value: 'Black',
label: 'Black'
},
{
value: 'DimGray',
label: 'DimGray'
},
{
value: 'ForestGreen',
label: 'ForestGreen'
},
{
value: 'Gainsboro',
label: 'Gainsboro'
},
{
value: 'Indigo',
label: 'Indigo'
},
{
value: 'Navy',
label: 'Navy'
},
{
value: 'Purple',
label: 'Purple'
},
{
value: 'WhiteSmoke',
label: 'WhiteSmoke'
},
{
value: 'White',
label: 'White'
},
{
value: 'YellowGreen',
label: 'YellowGreen'
}
],
defaultValue: 'Black',
show: data => !hasDesignDimension(data)
},
FontFamily: {
ref: 'FontFamily',
type: 'string',
component: 'dropdown',
label: 'Font family',
options: [
{
value: 'QlikView Sans, -apple-system, sans-serif',
label: 'QlikView Sans'
},
{
value: 'Arial, -apple-system, sans-serif',
label: 'Arial'
},
{
value: 'Calibri, -apple-system, sans-serif',
label: 'Calibri'
},
{
value: 'Comic Sans MS, -apple-system, sans-serif',
label: 'Comic Sans MS'
},
{
value: 'MS Sans Serif, -apple-system, sans-serif',
label: 'MS Sans Serif'
},
{
value: 'Tahoma, -apple-system, sans-serif',
label: 'Tahoma'
},
{
value: 'Verdana, -apple-system, sans-serif',
label: 'Verdana'
}
],
defaultValue: 'QlikView Sans, -apple-system, sans-serif'
},
DataFontSize: {
ref: 'lettersize',
translation: 'Font size',
type: 'number',
component: 'buttongroup',
options: [
{
value: 1,
label: 'Small'
},
{
value: 2,
label: 'Medium'
}
],
defaultValue: 1
},
textAlignment: {
ref: 'cellTextAlignment',
label: 'Cell text alignment',
component: 'buttongroup',
options: [
{
value: 'left',
label: 'Left'
},
{
value: 'center',
label: 'Center'
},
{
value: 'right',
label: 'Right'
}
],
defaultValue: 'right'
},
FitChartWidth: {
ref: 'fitchartwidth',
type: 'boolean',
component: 'switch',
label: 'Fill chart width',
options: [
{
value: true,
label: 'On'
},
{
value: false,
label: 'Off'
}
],
defaultValue: false
},
ColumnWidthSlider: {
type: 'number',
component: 'slider',
label: 'Column width',
ref: 'columnwidthslider',
min: 20,
max: 250,
step: 10,
defaultValue: 50,
show: data => !data.fitchartwidth
},
SymbolForNulls: {
ref: 'symbolfornulls',
label: 'Symbol for Nulls',
type: 'string',
defaultValue: ' '
},
AllowExportXLS: {
ref: 'allowexportxls',
type: 'boolean',
component: 'switch',
label: 'Allow export to Excel',
options: [
{
value: true,
label: 'On'
},
{
value: false,
label: 'Off'
}
],
defaultValue: true
},
FilterOnCellClick: {
ref: 'filteroncellclick',
type: 'boolean',
component: 'switch',
label: 'Allow selection in cells',
options: [
{
value: true,
label: 'On'
},
{
value: false,
label: 'Off'
}
],
defaultValue: true
}
}
};
export default tableFormat;

106
src/excel-export.js Normal file
View File

@@ -0,0 +1,106 @@
function cleanupNodes (node) {
const removables = node.querySelectorAll('.tooltip,input');
[].forEach.call(removables, removeable => {
if (removeable.parentNode) {
removeable.parentNode.removeChild(removeable);
}
});
}
function buildTableHTML (containerElement, title, subtitle, footnote) {
const titleHTML = `<p style="font-size:15pt"><b>${title}</b></p>`;
const subtitleHTML = `<p style="font-size:11pt">${subtitle}</p>`;
const footnoteHTML = `<p style="font-size:11pt">${footnote}</p>`;
const kpiTableClone = containerElement[0].querySelector('.kpi-table').cloneNode(true);
const dataTableClone = containerElement[0].querySelector('.data-table').cloneNode(true);
cleanupNodes(kpiTableClone);
cleanupNodes(kpiTableClone);
const kpiTableBodies = kpiTableClone.querySelectorAll('tbody');
const dataTableBodies = dataTableClone.querySelectorAll('tbody');
const kpiHeader = kpiTableBodies[0].querySelector('tr');
const dataTableHeaders = dataTableBodies[0].querySelectorAll('tr');
const kpiRows = kpiTableBodies[1].querySelectorAll('tr');
const dataRows = dataTableBodies[1].querySelectorAll('tr');
let combinedRows = '';
for (let i = 0; i < kpiRows.length; i++) {
combinedRows += `<tr>${kpiRows[i].innerHTML}${dataRows[i].innerHTML}</tr>`;
}
const tableHTML = `
<html
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40"
>
<head>
<meta charset="UTF-8">
<!--[if gte mso 9]>
<xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>${title || 'Analyze'}</x:Name>
<x:WorksheetOptions>
<x:DisplayGridlines/>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
</x:ExcelWorkbook>
</xml>
<![endif]-->
</head>
<body>
${titleHTML.length > 0 ? titleHTML : ''}
${subtitleHTML.length > 0 ? subtitleHTML : ''}
<div>
<table>
<tbody>
<tr>
${kpiHeader.innerHTML}
${dataTableHeaders[0].innerHTML}
</tr>
${dataTableHeaders.length > 1 ? dataTableHeaders[1].outerHTML : ''}
</tbody>
</table>
<table>
<tbody>
${combinedRows}
</tbody>
</table>
</div>
${footnoteHTML.length > 0 ? footnoteHTML : ''}
</body>
</html>
`.split('>.<')
.join('><')
.split('>*<')
.join('><');
return tableHTML;
}
function downloadXLS (html) {
const filename = 'analysis.xls';
const blobObject = new Blob([html], { type: 'application/vnd.ms-excel' });
// IE/Edge
if (window.navigator.msSaveOrOpenBlob) {
return window.navigator.msSaveOrOpenBlob(blobObject, filename);
}
const link = window.document.createElement('a');
link.href = URL.createObjectURL(blobObject);
link.download = filename;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
return true;
}
export function exportXLS (containerElement, title, subtitle, footnote) {
// original was removing icon when starting export, disable and some spinner instead, shouldn't take enough time to warrant either..?
const table = buildTableHTML(containerElement, title, subtitle, footnote);
downloadXLS(table);
}

42
src/export-button.jsx Normal file
View File

@@ -0,0 +1,42 @@
import React from 'react';
import PropTypes from 'prop-types';
import { exportXLS } from './excel-export';
class ExportButton extends React.PureComponent {
constructor (props) {
super(props);
this.handleExport = this.handleExport.bind(this);
}
handleExport () {
const { component, excelExport, general } = this.props;
const { title, subtitle, footnote } = general;
if (excelExport) {
exportXLS(component.$element, title, subtitle, footnote);
}
}
render () {
const { excelExport } = this.props;
return excelExport === true && (
<input
className="icon-xls"
onClick={this.handleExport}
src="/Extensions/qlik-smart-pivot/Excel.png"
type="image"
/>
);
}
}
ExportButton.defaultProps = {
excelExport: false
};
ExportButton.propTypes = {
component: PropTypes.shape({}).isRequired,
excelExport: PropTypes.bool,
general: PropTypes.shape({}).isRequired
};
export default ExportButton;

View File

@@ -1,9 +0,0 @@
/* https://randomhaiku.com */
describe('behind the money', () => {
describe('Canada and Panda work.', () => {
it('Tiger starts blowing.', () => {
expect(true).toBeTruthy();
});
});
});

View File

@@ -0,0 +1,79 @@
import React from 'react';
import PropTypes from 'prop-types';
import { HEADER_FONT_SIZE } from '../initialize-transformed';
import Tooltip from '../tooltip/index.jsx';
class ColumnHeader extends React.PureComponent {
constructor (props) {
super(props);
this.handleSelect = this.handleSelect.bind(this);
}
handleSelect () {
const { component, entry } = this.props;
component.backendApi.selectValues(1, [entry.elementNumber], false);
}
render () {
const { baseCSS, cellWidth, colSpan, component, entry, styling } = this.props;
const inEditState = component.inEditState();
const isMediumFontSize = styling.headerOptions.fontSizeAdjustment === HEADER_FONT_SIZE.MEDIUM;
const style = {
...baseCSS,
fontSize: `${14 + styling.headerOptions.fontSizeAdjustment}px`,
height: isMediumFontSize ? '43px' : '33px',
verticalAlign: 'middle',
minWidth: cellWidth,
maxWidth: cellWidth
};
return (
<th
className="grid-cells"
colSpan={colSpan}
onClick={this.handleSelect}
style={style}
>
<Tooltip
isTooltipActive={!inEditState}
styling={styling}
tooltipText={entry.displayValue}
>
{entry.displayValue}
</Tooltip>
</th>
);
}
}
ColumnHeader.defaultProps = {
colSpan: 1
};
ColumnHeader.propTypes = {
baseCSS: PropTypes.shape({}).isRequired,
cellWidth: PropTypes.string.isRequired,
colSpan: PropTypes.number,
component: PropTypes.shape({
backendApi: PropTypes.shape({
selectValues: function (props, propName) {
if (props.isSnapshot || typeof props[propName] === 'function') {
return null;
}
return new Error('Missing implementation of qlik.backendApi.selectValues.');
}
}).isRequired
}).isRequired,
entry: PropTypes.shape({
displayValue: PropTypes.string.isRequired,
elementNumber: PropTypes.number.isRequired
}).isRequired,
styling: PropTypes.shape({
headerOptions: PropTypes.shape({
fontSizeAdjustment: PropTypes.number.isRequired
}).isRequired
}).isRequired
};
export default ColumnHeader;

View File

@@ -0,0 +1,48 @@
import React from 'react';
import PropTypes from 'prop-types';
import ExportButton from '../export-button.jsx';
import { HEADER_FONT_SIZE } from '../initialize-transformed';
const ExportColumnHeader = ({ component, baseCSS, general, title, allowExcelExport, hasSecondDimension, styling }) => {
const rowSpan = hasSecondDimension ? 2 : 1;
const isMediumFontSize = styling.headerOptions.fontSizeAdjustment === HEADER_FONT_SIZE.MEDIUM;
const style = {
...baseCSS,
cursor: 'default',
fontSize: `${16 + styling.headerOptions.fontSizeAdjustment}px`,
height: isMediumFontSize ? '90px' : '70px',
verticalAlign: 'middle',
width: '230px'
};
return (
<th
className="fdim-cells"
rowSpan={rowSpan}
style={style}
>
<ExportButton
component={component}
excelExport={allowExcelExport}
general={general}
/>
{title}
</th>
);
};
ExportColumnHeader.propTypes = {
component: PropTypes.shape({}).isRequired,
allowExcelExport: PropTypes.bool.isRequired,
baseCSS: PropTypes.shape({}).isRequired,
general: PropTypes.shape({}).isRequired,
hasSecondDimension: PropTypes.bool.isRequired,
styling: PropTypes.shape({
headerOptions: PropTypes.shape({
fontSizeAdjustment: PropTypes.number.isRequired
}).isRequired
}).isRequired,
title: PropTypes.string.isRequired
};
export default ExportColumnHeader;

View File

@@ -0,0 +1,5 @@
function Model (component) {
this.component = component;
}
export default Model;

141
src/headers-table/index.jsx Normal file
View File

@@ -0,0 +1,141 @@
import React from 'react';
import PropTypes from 'prop-types';
import ExportColumnHeader from './export-column-header.jsx';
import ColumnHeader from './column-header.jsx';
import MeasurementColumnHeader from './measurement-column-header.jsx';
import { injectSeparators } from '../utilities';
class HeadersTable extends React.PureComponent {
render () {
const {
cellWidth,
columnSeparatorWidth,
component,
data,
general,
isKpi,
styling
} = this.props;
const baseCSS = {
backgroundColor: styling.headerOptions.colorSchema,
color: styling.headerOptions.textColor,
fontFamily: styling.options.fontFamily,
textAlign: styling.headerOptions.alignment
};
const {
dimension1,
dimension2,
measurements
} = data.headers;
const hasSecondDimension = dimension2.length > 0;
const separatorStyle = {
minWidth: columnSeparatorWidth,
maxWidth: columnSeparatorWidth
};
return (
<div className="header-wrapper">
<table className="header">
<tbody>
<tr>
{isKpi ?
<ExportColumnHeader
allowExcelExport={general.allowExcelExport}
baseCSS={baseCSS}
component={component}
general={general}
hasSecondDimension={hasSecondDimension}
styling={styling}
title={dimension1[0].name}
/> : null
}
{!isKpi && !hasSecondDimension && measurements.map(measurementEntry => (
<MeasurementColumnHeader
baseCSS={baseCSS}
cellWidth={cellWidth}
hasSecondDimension={hasSecondDimension}
key={`${measurementEntry.displayValue}-${measurementEntry.name}-${measurementEntry.index}`}
measurement={measurementEntry}
styling={styling}
/>
))}
{!isKpi && hasSecondDimension && injectSeparators(dimension2, columnSeparatorWidth).map((entry, index) => {
if (entry.isSeparator) {
return (
<th
className="empty"
key={index}
style={separatorStyle}
/>
);
}
return (
<ColumnHeader
baseCSS={baseCSS}
cellWidth={cellWidth}
colSpan={measurements.length}
component={component}
entry={entry}
key={entry.displayValue}
styling={styling}
/>
);
})}
</tr>
{!isKpi && hasSecondDimension && (
<tr>
{injectSeparators(dimension2, columnSeparatorWidth).map((dimensionEntry, index) => {
if (dimensionEntry.isSeparator) {
return (
<th
className="empty"
key={index}
style={separatorStyle}
/>
);
}
return measurements.map(measurementEntry => (
<MeasurementColumnHeader
baseCSS={baseCSS}
cellWidth={cellWidth}
dimensionEntry={dimensionEntry}
hasSecondDimension={hasSecondDimension}
key={`${measurementEntry.displayValue}-${measurementEntry.name}-${measurementEntry.index}-${dimensionEntry.name}`}
measurement={measurementEntry}
styling={styling}
/>
));
})}
</tr>
)}
</tbody>
</table>
</div>
);
}
}
HeadersTable.propTypes = {
cellWidth: PropTypes.string.isRequired,
columnSeparatorWidth: PropTypes.string.isRequired,
data: PropTypes.shape({
headers: PropTypes.shape({
dimension1: PropTypes.array,
dimension2: PropTypes.array,
measurements: PropTypes.array
})
}).isRequired,
general: PropTypes.shape({}).isRequired,
component: PropTypes.shape({}).isRequired,
styling: PropTypes.shape({
headerOptions: PropTypes.shape({}),
options: PropTypes.shape({})
}).isRequired,
isKpi: PropTypes.bool.isRequired
};
export default HeadersTable;

View File

@@ -0,0 +1,43 @@
import merge from 'lodash.merge';
import Model from './index.componentModel';
import Component from './index.jsx';
import { mountedComponent } from 'test-utilities';
import sampleState from 'test-utilities/capex-sample-state';
describe('<HeadersTable />', () => {
const { data, general, styling } = sampleState;
const defaultProps = {
data,
general,
qlik: {
backendApi: {
selectValues: () => {}
},
inEditState: () => {}
},
styling
};
function setup (otherProps = {}) {
const props = merge(defaultProps, otherProps);
return mountedComponent(Model, Component, props);
}
it('should render without exploding when 2 dimensions', () => {
const model = setup();
expect(model.component).toBeDefined();
});
it('should render without exploding when 1 dimension', () => {
const noSecondDimensionProps = {
data: {
...defaultProps.data.headers,
dimension2: []
}
};
const model = setup(noSecondDimensionProps);
expect(model.component).toBeDefined();
});
});

View File

@@ -0,0 +1,77 @@
import React from 'react';
import PropTypes from 'prop-types';
import { HEADER_FONT_SIZE } from '../initialize-transformed';
import Tooltip from '../tooltip/index.jsx';
const MeasurementColumnHeader = ({ baseCSS, cellWidth, hasSecondDimension, measurement, styling }) => {
const title = `${measurement.name}`;
const { fontSizeAdjustment } = styling.headerOptions;
const isMediumFontSize = fontSizeAdjustment === HEADER_FONT_SIZE.MEDIUM;
const cellStyle = {
...baseCSS,
verticalAlign: 'middle',
minWidth: cellWidth,
maxWidth: cellWidth
};
if (hasSecondDimension) {
const isPercentageFormat = measurement.format.substring(measurement.format.length - 1) === '%';
let baseFontSize = 14;
if (isPercentageFormat) {
baseFontSize = 13;
}
cellStyle.fontSize = `${baseFontSize + fontSizeAdjustment}px`;
cellStyle.height = isMediumFontSize ? '45px' : '35px';
return (
<th
className="grid-cells"
style={cellStyle}
>
<Tooltip
tooltipText={title}
styling={styling}
>
{title}
</Tooltip>
</th>
);
}
cellStyle.fontSize = `${15 + fontSizeAdjustment}px`;
cellStyle.height = isMediumFontSize ? '90px' : '70px';
return (
<th
className="grid-cells"
style={cellStyle}
>
<Tooltip
tooltipText={title}
styling={styling}
>
{title}
</Tooltip>
</th>
);
};
MeasurementColumnHeader.defaultProps = {
hasSecondDimension: false
};
MeasurementColumnHeader.propTypes = {
baseCSS: PropTypes.shape({}).isRequired,
cellWidth: PropTypes.string.isRequired,
hasSecondDimension: PropTypes.bool,
measurement: PropTypes.shape({
name: PropTypes.string.isRequired
}).isRequired,
styling: PropTypes.shape({
headerOptions: PropTypes.shape({
fontSizeAdjustment: PropTypes.number.isRequired
}).isRequired
}).isRequired
};
export default MeasurementColumnHeader;

View File

@@ -1,791 +1,90 @@
import definition from './definition';
import { initializeDataCube, initializeDesignList } from './dataset';
import initializeStore from './store';
import React from 'react';
import ReactDOM from 'react-dom';
import Root from './root.jsx';
import './main.less';
import $ from 'jquery';
import style from 'text-loader!./PLSmartPivot.css';
import paint from './paint';
$('<style>').html(style).appendTo('head');
if (!window._babelPolyfill) { // eslint-disable-line no-underscore-dangle
require('@babel/polyfill'); // eslint-disable-line global-require
}
export default {
controller: [
'$scope',
'$timeout',
function controller () {}
],
design: {
dimensions: {
max: 1,
min: 0
}
},
data: {
dimensions: {
max: function (nMeasures) {
return nMeasures < 9 ? 2 : 1;
},
min: 1,
uses: 'dimensions'
},
measures: {
max: function (nDims) {
return nDims < 2 ? 9 : 8;
},
min: 1,
uses: 'measures'
}
},
definition,
initialProperties: {
version: 1.0,
qHyperCubeDef: {
qDimensions: [],
qMeasures: [],
qInitialDataFetch: [{
qWidth: 10,
qHeight: 1000
}]
},
},
definition: {
type: 'items',
component: 'accordion',
items: {
dimensions: {
uses: 'dimensions',
min: 1,
max: 2
},
measures: {
uses: 'measures',
min: 1,
max: 9
},
sorting: {
uses: 'sorting'
},
settings: {
uses: 'settings',
items: {
Pagination: {
type: 'items',
label: 'Pagination',
items: {
MaxPaginationLoops: {
ref: 'maxloops',
type: 'number',
component: 'dropdown',
label: 'Max Pagination Loops',
options:
[{
value: 1,
label: '10k cells'
}, {
value: 2,
label: '20k cells'
}, {
value: 3,
label: '30k cells'
}, {
value: 4,
label: '40k cells'
}, {
value: 5,
label: '50k cells'
}, {
value: 6,
label: '60k cells'
}, {
value: 7,
label: '70k cells'
}, {
value: 8,
label: '80k cells'
}, {
value: 9,
label: '90k cells'
}, {
value: 10,
label: '100k cells'
}
],
defaultValue: 2,
},
ErrorMessage: {
ref: 'errormessage',
label: 'Default error message',
type: 'string',
defaultValue: 'Ups! It seems you asked for too many data. Please filter more to see the whole picture.',
},
},
},
Header: {
type: 'items',
label: 'Header Format',
items: {
Align: {
ref: 'HeaderAlign',
translation: 'Header Alignment',
type: 'number',
component: 'buttongroup',
options: [{
value: 1,
label: 'Left'
}, {
value: 2,
label: 'Center'
}, {
value: 3,
label: 'Right'
}],
defaultValue: 2,
},
headercolors: {
ref: 'HeaderColorSchema',
type: 'string',
component: 'dropdown',
label: 'BackGround Header Color',
options:
[{
value: 'Clean',
label: 'Clean'
}, {
value: 'Soft',
label: 'Soft'
}, {
value: 'Dark',
label: 'Dark'
}, {
value: 'Night',
label: 'Night'
}, {
value: 'Blue',
label: 'Blue'
}, {
value: 'Orange',
label: 'Orange'
}, {
value: 'Red',
label: 'Red'
}, {
value: 'Green',
label: 'Green'
}, {
value: 'Violete',
label: 'Violete'
}, {
value: 'Custom',
label: 'Custom'
}
],
defaultValue: 'Night',
},
HeaderTextColor: {
ref: 'HeaderTextColorSchema',
type: 'string',
component: 'dropdown',
label: 'Text Header Color',
options:
[{
value: 'Black',
label: 'Black'
}, {
value: 'DimGray',
label: 'DimGray'
}, {
value: 'ForestGreen',
label: 'ForestGreen'
}, {
value: 'Gainsboro',
label: 'Gainsboro'
}, {
value: 'Indigo',
label: 'Indigo'
}, {
value: 'Navy',
label: 'Navy'
}, {
value: 'Purple',
label: 'Purple'
}, {
value: 'WhiteSmoke',
label: 'WhiteSmoke'
}, {
value: 'White',
label: 'White'
}, {
value: 'YellowGreen',
label: 'YellowGreen'
}
],
defaultValue: 'WhiteSmoke',
},
HeaderFontSize: {
ref: 'lettersizeheader',
translation: 'Font Size',
type: 'number',
component: 'buttongroup',
options: [{
value: 1,
label: 'Small'
}, {
value: 2,
label: 'Medium'
//}, {
// value: 3,
// label: "Large"
}],
defaultValue: 2
},
}
},
Formatted: {
type: 'items',
label: 'Table Format',
items: {
IndentBool: {
ref: 'indentbool',
type: 'boolean',
label: 'Indent',
defaultValue: true
},
SeparatorColumns: {
ref: 'separatorcols',
type: 'boolean',
label: 'Separator Columns',
defaultValue: false
},
CustomFileBool: {
ref: 'customfilebool',
type: 'boolean',
label: 'Include External File',
defaultValue: false
},
CustomFile: {
ref: 'customfile',
label: 'Name of CSV file (; separated)',
type: 'string',
defaultValue: '',
show: function (data) {
return data.customfilebool;
}
},
colors: {
ref: 'ColorSchema',
type: 'string',
component: 'dropdown',
label: 'BackGround Style',
options:
[{
value: 'Clean',
label: 'Clean'
}, {
value: 'Soft',
label: 'Soft'
}, {
value: 'Dark',
label: 'Dark'
}, {
value: 'Night',
label: 'Night'
}, {
value: 'Blue',
label: 'Blue'
}, {
value: 'Orange',
label: 'Orange'
}, {
value: 'Red',
label: 'Red'
}, {
value: 'Green',
label: 'Green'
}, {
value: 'Violete',
label: 'Violete'
}, {
value: 'Custom',
label: 'Custom'
}
],
defaultValue: 'Clean',
show: function (data) {
return data.customfilebool == false;
}
},
BodyTextColor: {
ref: 'BodyTextColorSchema',
type: 'string',
component: 'dropdown',
label: 'Text Body Color',
options:
[{
value: 'Black',
label: 'Black'
}, {
value: 'DimGray',
label: 'DimGray'
}, {
value: 'ForestGreen',
label: 'ForestGreen'
}, {
value: 'Gainsboro',
label: 'Gainsboro'
}, {
value: 'Indigo',
label: 'Indigo'
}, {
value: 'Navy',
label: 'Navy'
}, {
value: 'Purple',
label: 'Purple'
}, {
value: 'WhiteSmoke',
label: 'WhiteSmoke'
}, {
value: 'White',
label: 'White'
}, {
value: 'YellowGreen',
label: 'YellowGreen'
}
],
defaultValue: 'Black',
show: function (data) {
return data.customfilebool == false;
}
},
FontFamily: {
ref: 'FontFamily',
type: 'string',
component: 'dropdown',
label: 'FontFamily',
options:
[{
value: 'Arial',
label: 'Arial'
}, {
value: 'Calibri',
label: 'Calibri'
}, {
value: 'Comic Sans MS',
label: 'Comic Sans MS'
}, {
value: 'MS Sans Serif',
label: 'MS Sans Serif'
}, {
value: 'Tahoma',
label: 'Tahoma'
}, {
value: 'Verdana',
label: 'Verdana'
}
],
defaultValue: 'Calibri'
},
DataFontSize: {
ref: 'lettersize',
translation: 'Font Size',
type: 'number',
component: 'buttongroup',
options: [{
value: 1,
label: 'Small'
}, {
value: 2,
label: 'Medium'
//}, {
// value: 3,
// label: "Large"
}],
defaultValue: 2
},
ColumnWidthSlider: {
type: 'number',
component: 'slider',
label: 'Column Width',
ref: 'columnwidthslider',
min: 1,
max: 3,
step: 1,
defaultValue: 2
},
SymbolForNulls: {
ref: 'symbolfornulls',
label: 'Symbol for Nulls',
type: 'string',
defaultValue: ' '
},
AllowExportXLS: {
ref: 'allowexportxls',
type: 'boolean',
component: 'switch',
label: 'Allow export to Excel',
options: [{
value: true,
label: 'On'
}, {
value: false,
label: 'Off'
}],
defaultValue: true
},
FilterOnCellClick: {
ref: 'filteroncellclick',
type: 'boolean',
component: 'switch',
label: 'Filter data when cell clicked',
options: [{
value: true,
label: 'On'
}, {
value: false,
label: 'Off'
}],
defaultValue: true
}
}
},
ConceptSemaphores: {
type: 'items',
label: 'Concept Semaphores',
items: {
AllConcepts: {
ref: 'allsemaphores',
type: 'boolean',
component: 'switch',
label: 'All concepts affected',
options: [{
value: true,
label: 'On'
}, {
value: false,
label: 'Off'
}],
defaultValue: true
},
ConceptsAffected1: {
ref: 'conceptsemaphore1',
translation: 'Concept 1',
type: 'string',
defaultValue: '',
show: function (data) {
return data.allsemaphores == false;
}
},
ConceptsAffected2: {
ref: 'conceptsemaphore2',
translation: 'Concept 2',
type: 'string',
defaultValue: '',
show: function (data) {
return data.allsemaphores == false;
}
},
ConceptsAffected3: {
ref: 'conceptsemaphore3',
translation: 'Concept 3',
type: 'string',
defaultValue: '',
show: function (data) {
return data.allsemaphores == false;
}
},
ConceptsAffected4: {
ref: 'conceptsemaphore4',
translation: 'Concept 4',
type: 'string',
defaultValue: '',
show: function (data) {
return data.allsemaphores == false;
}
},
ConceptsAffected5: {
ref: 'conceptsemaphore5',
translation: 'Concept 5',
type: 'string',
defaultValue: '',
show: function (data) {
return data.allsemaphores == false;
}
},
ConceptsAffected6: {
ref: 'conceptsemaphore6',
translation: 'Concept 6',
type: 'string',
defaultValue: '',
show: function (data) {
return data.allsemaphores == false;
}
},
ConceptsAffected7: {
ref: 'conceptsemaphore7',
translation: 'Concept 7',
type: 'string',
defaultValue: '',
show: function (data) {
return data.allsemaphores == false;
}
},
ConceptsAffected8: {
ref: 'conceptsemaphore8',
translation: 'Concept 8',
type: 'string',
defaultValue: '',
show: function (data) {
return data.allsemaphores == false;
}
},
ConceptsAffected9: {
ref: 'conceptsemaphore9',
translation: 'Concept 9',
type: 'string',
defaultValue: '',
show: function (data) {
return data.allsemaphores == false;
}
},
ConceptsAffected10: {
ref: 'conceptsemaphore10',
translation: 'Concept 10',
type: 'string',
defaultValue: '',
show: function (data) {
return data.allsemaphores == false;
}
},
}
},
MetricSemaphores: {
type: 'items',
label: 'Metric Semaphores',
items: {
AllMetrics: {
ref: 'allmetrics',
type: 'boolean',
component: 'switch',
label: 'All metrics affected',
options: [{
value: true,
label: 'On'
}, {
value: false,
label: 'Off'
}],
defaultValue: false
},
MetricsAffected: {
ref: 'metricssemaphore',
translation: 'Metrics affected (1,2,4,...)',
type: 'string',
defaultValue: '0',
show: function (data) {
return data.allmetrics == false;
}
},
MetricStatus1: {
ref: 'metricsstatus1',
translation: 'Critic is less than',
type: 'number',
defaultValue: -0.1
},
ColorStatus1: {
ref: 'colorstatus1',
label: 'Critic Color Fill',
type: 'object',
component: 'color-picker',
defaultValue: {
index: 7,
color: '#f93f17'
}
},
ColorStatus1Text: {
ref: 'colorstatus1text',
label: 'Critic Color Text',
type: 'object',
component: 'color-picker',
defaultValue: {
index: 10,
color: '#ffffff'
}
},
MetricStatus2: {
ref: 'metricsstatus2',
translation: 'Medium is less than',
type: 'number',
defaultValue: 0
},
ColorStatus2: {
ref: 'colorstatus2',
label: 'Medium Color Fill',
type: 'object',
component: 'color-picker',
defaultValue: {
index: 8,
color: '#ffcf02'
}
},
ColorStatus2Text: {
ref: 'colorstatus2text',
label: 'Medium Color Text',
type: 'object',
component: 'color-picker',
defaultValue: {
index: 11,
color: '#000000'
}
},
ColorStatus3: {
ref: 'colorstatus3',
label: 'Success Color Fill',
type: 'object',
component: 'color-picker',
defaultValue: {
index: 9,
color: '#276e27'
}
},
ColorStatus3Text: {
ref: 'colorstatus3text',
label: 'Success Color Text',
type: 'object',
component: 'color-picker',
defaultValue: {
index: 10,
color: '#ffffff'
}
},
}
},
ColorLibrary: {
type: 'items',
label: 'Primary Colors Library',
items: {
ColLibClean: {
ref: 'collibclean',
translation: 'Clean',
type: 'string',
defaultValue: '#ffffff',
},
ColLibSoft: {
ref: 'collibsoft',
translation: 'Soft',
type: 'string',
defaultValue: '#efefef',
},
ColLibDark: {
ref: 'collibdark',
translation: 'Dark',
type: 'string',
defaultValue: '#c4c4c4',
},
ColLibNight: {
ref: 'collibnight',
translation: 'Night',
type: 'string',
defaultValue: '#808080',
},
ColLibRed: {
ref: 'collibred',
translation: 'Red',
type: 'string',
defaultValue: '#d58b94',
},
ColLibOrange: {
ref: 'colliborange',
translation: 'Orange',
type: 'string',
defaultValue: '#fd6600',
},
ColLibViolete: {
ref: 'collibviolete',
translation: 'Violete',
type: 'string',
defaultValue: '#ccc0ff',
},
ColLibBlue: {
ref: 'collibblue',
translation: 'Blue',
type: 'string',
defaultValue: '#4575b4',
},
ColLibGreen: {
ref: 'collibgreen',
translation: 'Green',
type: 'string',
defaultValue: '#7bb51c',
},
ColLibCustom: {
ref: 'collibcustom',
label: 'Custom',
type: 'string',
defaultValue: '#ffcccc',
},
}
},
PijamaColorLibrary: {
type: 'items',
label: 'Pijama Colors Library',
items: {
ColLibCleanP: {
ref: 'collibcleanp',
translation: 'Clean',
type: 'string',
defaultValue: '#ffffff',
},
ColLibSoftP: {
ref: 'collibsoftp',
translation: 'Soft',
type: 'string',
defaultValue: '#ffffff',
},
ColLibDarkP: {
ref: 'collibdarkp',
translation: 'Dark',
type: 'string',
defaultValue: '#efefef',
},
ColLibNightP: {
ref: 'collibnightp',
translation: 'Night',
type: 'string',
defaultValue: '#c4c4c4',
},
ColLibRedP: {
ref: 'collibredp',
translation: 'Red',
type: 'string',
defaultValue: '#ffcccc',
},
ColLibOrangeP: {
ref: 'colliborangep',
translation: 'Orange',
type: 'string',
defaultValue: '#ffcc66',
},
ColLibVioleteP: {
ref: 'collibvioletep',
translation: 'Violete',
type: 'string',
defaultValue: '#e6e6ff',
},
ColLibBlueP: {
ref: 'collibbluep',
translation: 'Blue',
type: 'string',
defaultValue: '#b3d9ff',
},
ColLibGreenP: {
ref: 'collibgreenp',
translation: 'Green',
type: 'string',
defaultValue: '#98fb98',
},
ColLibCustomP: {
ref: 'collibcustomp',
label: 'Custom',
type: 'string',
defaultValue: '#ffffff',
},
}
}
qInitialDataFetch: [
{
qHeight: 1,
qWidth: 10
}
}
],
qMeasures: []
}
},
support: {
export: true,
exportData: true,
snapshot: true
},
paint: async function ($element, layout) {
const dataCube = await initializeDataCube(this, layout);
const designList = await initializeDesignList(this, layout);
const state = await initializeStore({
$element,
component: this,
dataCube,
designList,
layout
});
const editmodeClass = this.inAnalysisState() ? '' : 'edit-mode';
const jsx = (
<Root
editmodeClass={editmodeClass}
component={this}
state={state}
/>
);
ReactDOM.render(jsx, $element[0]);
},
snapshot: {
canTakeSnapshot: true
},
controller: [
'$scope',
'$timeout',
function () { }
],
paint: function ($element) {
try {
paint($element, this);
}
catch (e) {
console.error(e); // eslint-disable-line no-console
throw e;
}
}
setSnapshotData: async function (snapshotLayout) {
snapshotLayout.snapshotData.dataCube = await initializeDataCube(this, snapshotLayout);
snapshotLayout.snapshotData.designList = await initializeDesignList(this, snapshotLayout);
return snapshotLayout;
},
version: 1.0
};

View File

@@ -0,0 +1,340 @@
import { distinctArray } from './utilities';
export const HEADER_FONT_SIZE = {
SMALL: -1,
MEDIUM: 1
};
function getAlignment (option) {
const alignmentOptions = {
1: 'left',
2: 'center',
3: 'right'
};
return alignmentOptions[option] || 'left';
}
function getFontSizeAdjustment (option) {
const fontSizeAdjustmentOptions = {
1: HEADER_FONT_SIZE.SMALL,
2: HEADER_FONT_SIZE.MEDIUM
};
return fontSizeAdjustmentOptions[option] || 0;
}
function generateMeasurements (information) {
return information.map(measurement => {
const transformedMeasurement = {
format: measurement.qNumFormat.qFmt || '#.##0',
name: measurement.qFallbackTitle
};
return transformedMeasurement;
});
}
function generateDimensionEntry (information, data) {
return {
displayValue: data.qText || data.qNum,
elementNumber: data.qElemNumber,
name: information.qFallbackTitle,
value: data.qNum
};
}
function generateMatrixCell ({ cell, dimension1Information, dimension2Information, measurementInformation }) {
const matrixCell = {
displayValue: cell.qText,
format: measurementInformation.format,
name: measurementInformation.name,
parents: {
dimension1: {
elementNumber: dimension1Information.qElemNumber,
header: dimension1Information.qText
},
measurement: {
header: measurementInformation.name,
index: measurementInformation.index
}
},
value: cell.qNum
};
if (dimension2Information) {
matrixCell.parents.dimension2 = {
elementNumber: dimension2Information.qElemNumber
};
}
return matrixCell;
}
let lastRow = 0;
function generateDataSet (
component, dimensionsInformation, measurementsInformation, dataCube) {
const measurements = generateMeasurements(measurementsInformation);
let dimension1 = [];
let dimension2 = [];
let matrix = [];
const hasSecondDimension = dimensionsInformation.length > 1;
dataCube.forEach(row => {
lastRow += 1;
const dimension1Entry = generateDimensionEntry(dimensionsInformation[0], row[0]);
dimension1.push(dimension1Entry);
let dimension2Entry;
let firstDataCell = 1;
if (hasSecondDimension) {
dimension2Entry = generateDimensionEntry(dimensionsInformation[1], row[1]);
dimension2.push(dimension2Entry);
firstDataCell = 2;
}
let matrixRow = row
.slice(firstDataCell, row.length)
.map((cell, cellIndex) => {
const measurementInformation = measurements[cellIndex];
measurementInformation.index = cellIndex;
const dimension1Information = row[0]; // eslint-disable-line prefer-destructuring
const dimension2Information = hasSecondDimension ? row[1] : null;
const generatedCell = generateMatrixCell({
cell,
dimension1Information,
dimension2Information,
measurementInformation
});
return generatedCell;
});
let appendToRowIndex = matrix.length;
if (hasSecondDimension) {
// See if there already is a row for the current dim1
for (let i = 0; i < matrix.length; i++) {
if (matrix[i][0].parents.dimension1.header === matrixRow[0].parents.dimension1.header) {
appendToRowIndex = i;
matrixRow = matrix[i].concat(matrixRow);
}
}
}
matrix[appendToRowIndex] = matrixRow;
});
// filter header dimensions to only have distinct values
dimension1 = distinctArray(dimension1);
dimension2 = distinctArray(dimension2);
// Make sure all rows are saturated, otherwise data risks being displayed in the wrong column
matrix = matrix.map((row, rowIndex) => {
if ((hasSecondDimension && row.length == (dimension2.length * measurements.length))
|| (!hasSecondDimension && row.length == measurements.length)) {
// Row is saturated
return row;
}
// Row is not saturated, so must add empty cells to fill the gaps
let newRow = [];
if (hasSecondDimension) {
// Got a second dimension, so need to add measurements for all values of the second dimension
let rowDataIndex = 0;
dimension2.forEach(dim => {
rowDataIndex = appendMissingCells(
row, newRow, rowDataIndex, measurements, rowIndex, dim.elementNumber);
});
} else {
appendMissingCells(row, newRow, 0, measurements, rowIndex);
}
return newRow;
});
return {
dimension1: dimension1,
dimension2: dimension2,
matrix,
measurements
};
}
/*
* Appends the cells of the source row, as well as those missing, to the destination row, starting
* from the given source index. Returns the source index of the next source cell after this has
* completed. If there is a second dimension the dim2ElementNumber should be set to the current
* index of the dimension2 value being processed.
*/
function appendMissingCells (
sourceRow, destRow, sourceIndex, measurements, dim1ElementNumber, dim2ElementNumber = -1) {
let index = sourceIndex;
measurements.forEach((measurement, measureIndex) => {
if (index < sourceRow.length
&& (dim2ElementNumber === -1
|| sourceRow[index].parents.dimension2.elementNumber === dim2ElementNumber)
&& sourceRow[index].parents.measurement.header === measurement.name) {
// Source contains the expected cell
destRow.push(sourceRow[index]);
index++;
} else {
// Source doesn't contain the expected cell, so add empty
destRow.push({
displayValue: '',
parents: {
dimension1: { elementNumber: dim1ElementNumber },
dimension2: { elementNumber: dim2ElementNumber },
measurement: {
header: measurement.name,
index: measureIndex
}
}
});
}
});
return index;
}
function initializeTransformed ({ $element, component, dataCube, designList, layout }) {
const dimensionsInformation = component.backendApi.getDimensionInfos();
const measurementsInformation = component.backendApi.getMeasureInfos();
const dimensionCount = layout.qHyperCube.qDimensionInfo.length;
const rowCount = component.backendApi.getRowCount();
const maxLoops = layout.maxloops;
const {
dimension1,
dimension2,
measurements,
matrix
} = generateDataSet(component, dimensionsInformation, measurementsInformation, dataCube);
const customSchemaBasic = [];
const customSchemaFull = [];
let customHeadersCount = 0;
if (designList && designList.length > 0) {
const headers = designList[0].split(';');
customHeadersCount = headers.length;
for (let lineNumber = 0; lineNumber < designList.length; lineNumber += 1) {
customSchemaFull[lineNumber] = new Array(headers.length);
const data = designList[lineNumber].split(';');
if (data.length === headers.length) {
for (let headerIndex = 0; headerIndex < headers.length; headerIndex += 1) {
[customSchemaBasic[lineNumber]] = data;
customSchemaFull[lineNumber][headerIndex] = data[headerIndex];
}
}
}
}
let cellWidth;
if (layout.fitchartwidth) {
// The widths are calculated based on the current element width. Note: this could use % to set
// the widths as percentages of the available width. However, this often results in random
// columns getting 1px wider than the others because of rounding necessary to fill the width.
// This 1px causes missalignment between the data- and header tables.
cellWidth = '';
} else {
// If using the previous solution just set 60px
cellWidth = `${layout.columnwidthslider > 10 ? layout.columnwidthslider : 60}px`;
}
// top level properties could be reducers and then components connect to grab what they want,
// possibly with reselect for some presentational transforms (moving some of the presentational logic like formatting and such)
const transformedProperties = {
data: {
headers: {
dimension1, // column headers
dimension2, // parent row headers if exists
measurements // row headers, looped for each dimension2 if exists
},
matrix, // 2d array of all rows/cells to render in body of datatable
meta: {
dimensionCount: dimensionsInformation.length
}
},
general: {
allowExcelExport: layout.allowexportxls,
allowFilteringByClick: layout.filteroncellclick,
cellWidth: cellWidth,
errorMessage: layout.errormessage,
footnote: layout.footnote,
maxLoops,
subtitle: layout.subtitle,
title: layout.title,
useColumnSeparator: layout.separatorcols && dimensionCount > 1
},
selection: {
dimensionSelectionCounts: dimensionsInformation.map(dimensionInfo => dimensionInfo.qStateCounts.qSelected)
},
styling: {
customCSV: {
basic: customSchemaBasic,
count: customHeadersCount,
full: customSchemaFull
},
hasCustomFileStyle: Boolean(designList),
headerOptions: {
alignment: getAlignment(layout.HeaderAlign),
colorSchema: layout.HeaderColorSchema.color,
fontSizeAdjustment: getFontSizeAdjustment(layout.lettersizeheader),
textColor: layout.HeaderTextColorSchema.color
},
options: {
backgroundColor: layout.rowEvenBGColor,
backgroundColorOdd: layout.rowOddBGColor,
color: layout.BodyTextColorSchema,
fontFamily: layout.FontFamily,
fontSizeAdjustment: getFontSizeAdjustment(layout.lettersize),
textAlignment: layout.cellTextAlignment
},
conditionalColoring: {
enabled: layout.conditionalcoloring.enabled,
colorAllRows: layout.conditionalcoloring.colorall,
rows: layout.conditionalcoloring.rows.map(row => row.rowname),
colorAllMeasures: typeof layout.conditionalcoloring.colorallmeasures === 'undefined'
|| layout.conditionalcoloring.colorallmeasures,
measures: !layout.conditionalcoloring.measures
? [] : layout.conditionalcoloring.measures.split(',').map(index => Number(index)),
threshold: {
poor: layout.conditionalcoloring.threshold_poor,
fair: layout.conditionalcoloring.threshold_fair
},
colors: {
poor: {
color: layout.conditionalcoloring.color_poor,
textColor: layout.conditionalcoloring.textcolor_poor
},
fair: {
color: layout.conditionalcoloring.color_fair,
textColor: layout.conditionalcoloring.textcolor_fair
},
good: {
color: layout.conditionalcoloring.color_good,
textColor: layout.conditionalcoloring.textcolor_good
}
}
},
symbolForNulls: layout.symbolfornulls,
usePadding: layout.indentbool
}
};
if (rowCount > lastRow && rowCount <= (maxLoops * 1000)) {
const requestPage = [
{
qHeight: Math.min(1000, rowCount - lastRow),
qLeft: 0,
qTop: matrix.length,
qWidth: 10 // should be # of columns
}
];
component.backendApi.getData(requestPage).then(() => {
component.paint($element, layout);
});
}
return transformedProperties;
}
export default initializeTransformed;

View File

@@ -0,0 +1,2 @@
export { default as LinkedScrollWrapper } from './linked-scroll-wrapper.jsx';
export { default as LinkedScrollSection } from './linked-scroll-section.jsx';

View File

@@ -0,0 +1,29 @@
import React from 'react';
import PropTypes from 'prop-types';
import { LinkedScrollContext } from './linked-scroll-wrapper.jsx';
class LinkedScrollSection extends React.PureComponent {
static contextType = LinkedScrollContext;
componentDidMount () {
const { link } = this.context;
link(this);
}
componentWillUnmount () {
const { unlink } = this.context;
unlink(this);
}
render () {
const { children } = this.props;
return children;
}
}
LinkedScrollSection.propTypes = {
children: PropTypes.any
};
export default LinkedScrollSection;

View File

@@ -0,0 +1,82 @@
import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
export const LinkedScrollContext = React.createContext();
class LinkedScrollWrapper extends React.PureComponent {
constructor (props) {
super(props);
this.linkComponent = this.linkComponent.bind(this);
this.unlinkComponent = this.unlinkComponent.bind(this);
this.handleScroll = this.handleScroll.bind(this);
this.scrollElements = [];
this.linkActions = {
link: this.linkComponent,
unlink: this.unlinkComponent
};
}
linkComponent (component) {
// eslint-disable-next-line react/no-find-dom-node
const node = ReactDOM.findDOMNode(component);
const element = {
component,
node
};
this.scrollElements.push(element);
node.onscroll = this.handleScroll.bind(this, element);
}
unlinkComponent (component) {
const componentIndex = this.scrollElements.map(element => element.component).indexOf(component);
if (componentIndex !== -1) {
this.scrollElements.removeAt(componentIndex);
// eslint-disable-next-line react/no-find-dom-node
const node = ReactDOM.findDOMNode(component);
node.onscroll = null;
}
}
handleScroll (element) {
window.requestAnimationFrame(() => {
this.sync(element);
});
}
sync (scrollElement) {
this.scrollElements.forEach(element => {
if (scrollElement === element) {
return;
}
element.node.onscroll = null;
if (element.component.props.linkHorizontal) {
element.node.scrollLeft = scrollElement.node.scrollLeft;
}
if (element.component.props.linkVertical) {
element.node.scrollTop = scrollElement.node.scrollTop;
}
window.requestAnimationFrame(() => {
element.node.onscroll = this.handleScroll.bind(this, element);
});
});
}
render () {
const { children } = this.props;
return (
<LinkedScrollContext.Provider value={this.linkActions}>
{children}
</LinkedScrollContext.Provider>
);
}
}
LinkedScrollWrapper.propTypes = {
children: PropTypes.any
};
export default LinkedScrollWrapper;

240
src/main.less Normal file
View File

@@ -0,0 +1,240 @@
/* eslint-disable */
.qv-object-qlik-smart-pivot {
@KpiTableWidth: 230px;
*,
*::before,
*::after {
box-sizing: border-box;
}
.edit-mode {
pointer-events: none;
}
.grid-cells {
cursor: pointer;
line-height: 1em !important;
}
div.qv-object-content-container {
z-index: 110;
}
.icon-xls {
text-align: left;
}
button {
width: 100%;
}
table {
border-collapse: separate;
border-spacing: 1px;
width: auto;
}
tr {
height: 25px;
}
td,
th {
padding: 5px !important; // prevent overwriting from single object
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
cursor: default;
> div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-family: inherit;
}
}
.empty {
background: #fff;
padding: 0 !important;
}
th.main-kpi {
text-align: center;
vertical-align: middle;
}
.numeric {
text-align: right;
}
// First Column
.fdim-cells {
min-width: 230px !Important;
max-width: 230px !Important;
cursor: pointer;
background-color: #fff;
}
tbody tr:hover td {
cursor: default;
background-color: #808080 !important;
color: #fff;
}
.grid {
height: 50px;
width: 350px;
}
.tooltip {
position: fixed !important;
color: rgb(70, 70, 70);
background-color: rgb(245, 239, 207);
text-align: center;
border: groove;
}
.root {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
height: 100%;
width: 100%;
}
.kpi-table .fdim-cells,
.data-table td {
line-height: 1em !important;
}
.kpi-table {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
flex: none;
width: @KpiTableWidth !important;
margin: 0;
padding: 0;
.header-wrapper {
flex: none;
box-shadow: 4px 2px 8px #e1e1e1;
}
.row-wrapper {
overflow: scroll;
margin: 0;
margin-bottom: 8px;
padding: 0;
box-shadow: 4px 2px 8px #e1e1e1;
min-height: 0; /* This is to make flex size-filling work */
/* Adapt for Edge */
@supports (-ms-ime-align: auto) {
margin-bottom: 16px;
}
/* Adapt for IE11 */
@media screen and (-ms-high-contrast: none) {
margin-bottom: 16px;
}
}
}
.row-wrapper .fdim-cells {
padding-left: 12px;
}
.data-table {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
margin-left: 13px;
min-width: 0; /* This is to make flex size-filling work */
.header-wrapper {
flex: none;
overflow: scroll;
margin-right: 8px;
}
.row-wrapper {
overflow: scroll;
margin: 0;
padding: 0;
min-height: 0; /* This is to make flex size-filling work */
/* Style scrollbar for FF */
scrollbar-width: thin;
scrollbar-color: #d3d3d3 transparent;
}
/* Adapt for Edge */
@supports (-ms-ime-align: auto) {
.header-wrapper {
margin-right: 16px;
}
}
/* Adapt for IE11 */
@media screen and (-ms-high-contrast: none) {
width: 100%;
height: 100%;
.header-wrapper {
margin-right: 16px;
}
}
}
// hide scrollbars
.kpi-table .header-wrapper,
.kpi-table .row-wrapper,
.data-table .header-wrapper {
// stylelint-disable-next-line property-no-unknown
scrollbar-width: none;
-ms-overflow-style: none; // IE 10+
-moz-overflow: -moz-scrollbars-none; // Firefox
&::-webkit-scrollbar {
display: none; // Safari and Chrome
}
}
.tooltip-wrapper {
min-width: 25px;
position: fixed;
padding: 5px;
padding-top: 8px;
background-color: #404040;
z-index: 100;
pointer-events: none;
border-radius: 5px;
height: 30px;
width: auto;
opacity: 0.9;
text-align: center;
transform: translate(-50%, -110%);
&::after {
content: "";
position: absolute;
bottom: -10px;
left: 50%;
border-width: 10px 10px 0;
border-style: solid;
border-color: #404040 transparent;
margin-left: -10px;
pointer-events: none;
}
> p {
color: #fff;
}
}
}
/* eslint-enable */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
function Model (component) {
this.component = component;
}
export default Model;

132
src/root.jsx Normal file
View File

@@ -0,0 +1,132 @@
import React from 'react';
import PropTypes from 'prop-types';
import HeadersTable from './headers-table/index.jsx';
import DataTable from './data-table/index.jsx';
import { LinkedScrollWrapper, LinkedScrollSection } from './linked-scroll';
class Root extends React.PureComponent {
constructor (props) {
super(props);
this.onDataTableRefSet = this.onDataTableRefSet.bind(this);
this.renderedTableWidth = 0;
}
componentDidUpdate () {
const tableWidth = this.dataTableRef.getBoundingClientRect().width;
if (this.renderedTableWidth !== tableWidth) {
this.forceUpdate();
}
}
onDataTableRefSet (element) {
this.dataTableRef = element;
this.forceUpdate();
}
render () {
const { editmodeClass, component, state } = this.props;
const { data, general, styling } = state;
// Determine cell- and column separator width
let cellWidth = '0px';
let columnSeparatorWidth = '';
if (this.dataTableRef) {
const tableWidth = this.dataTableRef.getBoundingClientRect().width;
this.renderedTableWidth = tableWidth;
if (general.cellWidth) {
cellWidth = general.cellWidth;
if (general.useColumnSeparator) {
columnSeparatorWidth = '8px';
}
} else {
const headerMarginRight = 8;
const borderWidth = 1;
const rowCellCount = data.matrix[0].length;
let separatorCount = 0;
let separatorWidth = 0;
if (general.useColumnSeparator) {
separatorCount = data.headers.dimension2.length - 1;
separatorWidth = Math.min(Math.floor(tableWidth * 0.2 / separatorCount), 8);
columnSeparatorWidth = `${separatorWidth}px`;
}
const separatorWidthSum = (separatorWidth + borderWidth) * separatorCount;
cellWidth = `${Math.floor((tableWidth - separatorWidthSum - headerMarginRight - borderWidth)
/ rowCellCount) - borderWidth}px`;
}
}
return (
<div className="root">
<LinkedScrollWrapper>
<div className={`kpi-table ${editmodeClass}`}>
<HeadersTable
cellWidth={cellWidth}
columnSeparatorWidth={columnSeparatorWidth}
component={component}
data={data}
general={general}
isKpi
styling={styling}
/>
<LinkedScrollSection linkVertical>
<DataTable
cellWidth={cellWidth}
columnSeparatorWidth={columnSeparatorWidth}
component={component}
data={data}
general={general}
renderData={false}
styling={styling}
/>
</LinkedScrollSection>
</div>
<div
className={`data-table ${editmodeClass}`}
style={{ width: general.cellWidth ? 'auto' : '100%' }}
ref={this.onDataTableRefSet}
>
<LinkedScrollSection linkHorizontal>
<HeadersTable
cellWidth={cellWidth}
columnSeparatorWidth={columnSeparatorWidth}
component={component}
data={data}
general={general}
isKpi={false}
styling={styling}
/>
</LinkedScrollSection>
<LinkedScrollSection
linkHorizontal
linkVertical
>
<DataTable
cellWidth={cellWidth}
columnSeparatorWidth={columnSeparatorWidth}
component={component}
data={data}
general={general}
styling={styling}
/>
</LinkedScrollSection>
</div>
</LinkedScrollWrapper>
</div>
);
}
}
Root.propTypes = {
component: PropTypes.shape({}).isRequired,
editmodeClass: PropTypes.string.isRequired,
state: PropTypes.shape({
data: PropTypes.object.isRequired,
general: PropTypes.object.isRequired,
styling: PropTypes.object.isRequired
}).isRequired
};
export default Root;

29
src/root.spec.js Normal file
View File

@@ -0,0 +1,29 @@
import merge from 'lodash.merge';
import Model from './root.componentModel';
import Component from './root.jsx';
import { mountedComponent } from 'test-utilities';
import sampleState from 'test-utilities/capex-sample-state';
describe('<Root />', () => {
const state = sampleState;
const defaultProps = {
qlik: {
backendApi: {
selectValues: () => {}
},
inEditState: () => {}
},
state
};
function setup (otherProps = {}) {
const props = merge(defaultProps, otherProps);
return mountedComponent(Model, Component, props);
}
it('should render without exploding', () => {
const model = setup();
expect(model.component).toBeDefined();
});
});

15
src/store.js Normal file
View File

@@ -0,0 +1,15 @@
import initializeTransformed from './initialize-transformed';
async function initialize ({ $element, layout, component, dataCube, designList }) {
const transformedProperties = await initializeTransformed({
$element,
component,
dataCube,
designList,
layout
});
return transformedProperties;
}
export default initialize;

103
src/style-builder.js Normal file
View File

@@ -0,0 +1,103 @@
function StyleBuilder (styling) {
const {
customCSV,
options
} = styling;
let style = {
fontSize: `${14 + options.fontSizeAdjustment}px`
};
let hasComments = false;
let commentColor;
let hasCustomFileStyle = false;
function applyStandardAttributes (rowNumber) {
const hasBackgroundColor = options.backgroundColor && options.backgroundColor.color;
const hasOddBackgroundColor = options.backgroundColorOdd && options.backgroundColorOdd.color;
if (hasBackgroundColor && hasOddBackgroundColor) {
const isEven = rowNumber % 2 === 0;
style.backgroundColor = isEven ? options.backgroundColor.color : options.backgroundColorOdd.color;
style.color = options.color;
}
style.fontSize = `${13 + options.fontSizeAdjustment}px`;
}
function applyColor (color) {
style.backgroundColor = color;
commentColor = color;
}
/* eslint-disable sort-keys*/
const properties = {
'<comment>': () => { hasComments = true; },
// text
'<bold>': () => { style.fontWeight = 'bold'; },
'<italic>': () => { style.fontStyle = 'italic'; },
'<oblique>': () => { style.fontStyle = 'oblique'; },
// font color
'<white>': () => { style.color = 'white'; },
// font size
'<large>': () => { style.fontSize = `${15 + options.fontSizeAdjustment}px`; },
'<medium>': () => { style.fontSize = `${14 + options.fontSizeAdjustment}px`; },
'<small>': () => { style.fontSize = `${13 + options.fontSizeAdjustment}px`; },
// text alignment
'<center>': () => { style.textAlign = 'center'; }
};
/* eslint-enable sort-keys */
// TODO: need to improve this, it has way too many false positives
function isCSSColor (property) {
const isHexColor = property.substring(0, 1) === '#';
const isRGBColor = property.substring(0, 3).toUpperCase() === 'RGB';
return isHexColor || isRGBColor;
}
function applyProperty (property) {
if (!property || property === 'none') {
return;
}
if (isCSSColor(property)) {
applyColor(property);
return;
}
if (properties[property]) {
properties[property]();
} else {
console.error(`Custom property ${property} does not exist`); // eslint-disable-line no-console
}
}
function applyCustomStyle (customStyle) {
style = {
...style,
...customStyle
};
}
function parseCustomFileStyle (columnText) {
for (let csvAttribute = 1; csvAttribute < customCSV.count; csvAttribute += 1) {
let customAttribute = '';
if (customCSV.basic.indexOf(columnText) < 0) {
customAttribute = 'none';
} else {
hasCustomFileStyle = true;
customAttribute = customCSV.full[customCSV.basic.indexOf(columnText)][csvAttribute];
}
applyProperty(customAttribute);
}
}
return {
applyCustomStyle,
applyProperty,
applyStandardAttributes,
getCommentColor: () => commentColor,
getStyle: () => style,
hasComments: () => hasComments,
hasCustomFileStyle: () => hasCustomFileStyle,
hasFontSize: () => Boolean(style.fontSize),
parseCustomFileStyle
};
}
export default StyleBuilder;

65
src/tooltip/index.jsx Normal file
View File

@@ -0,0 +1,65 @@
import React from 'react';
import PropTypes from 'prop-types';
const handleCalculateTooltipPosition = (event) => {
const tooltip = document.querySelector('.tooltip-wrapper');
if (!tooltip) {
return;
}
tooltip.style.left = `${event.clientX}px`;
tooltip.style.top = `${event.clientY}px`;
};
class Tooltip extends React.PureComponent {
constructor (props) {
super(props);
this.state = {
showTooltip: false
};
this.handleRenderTooltip = this.handleRenderTooltip.bind(this);
}
handleRenderTooltip () {
const { showTooltip } = this.state;
this.setState({ showTooltip: !showTooltip });
}
render () {
const { children, styling, tooltipText } = this.props;
const { showTooltip } = this.state;
return (
<div
onMouseMove={handleCalculateTooltipPosition}
onMouseOut={this.handleRenderTooltip}
onMouseOver={this.handleRenderTooltip}
style={{ fontFamily: styling.options.fontFamily }}
>
{children}
{showTooltip
? (
<div className="tooltip-wrapper">
<p style={{ fontFamily: styling.options.fontFamily }}>
{tooltipText}
</p>
</div>
) : null}
</div>
);
}
}
Tooltip.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
]).isRequired,
styling: PropTypes.shape({
options: PropTypes.shape({
fontFamily: PropTypes.string.isRequired
}).isRequired
}).isRequired,
tooltipText: PropTypes.string.isRequired
};
export default Tooltip;

39
src/utilities.js Normal file
View File

@@ -0,0 +1,39 @@
export function onlyUnique (value, index, self) {
return self.indexOf(value) === index;
}
export function distinctArray (array) {
return array
.map(entry => JSON.stringify(entry))
.filter(onlyUnique)
.map(entry => JSON.parse(entry));
}
export function Deferred () {
this.promise = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
}
export function injectSeparators (array, columnSeparatorWidth, suppliedOptions) {
const defaultOptions = {
atEvery: 1,
separator: { isSeparator: true }
};
const options = {
...defaultOptions,
...suppliedOptions
};
if (!columnSeparatorWidth) {
return array;
}
return array.reduce((result, entry, index) => {
result.push(entry);
if (index < array.length - 1 && (index + 1) % options.atEvery === 0) {
result.push(options.separator);
}
return result;
}, []);
}

View File

@@ -1,35 +1,129 @@
"use strict";
module.exports = {
rules: {
"at-rule-no-unknown": true,
"block-no-empty": true,
"color-no-invalid-hex": true,
"comment-no-empty": true,
"declaration-block-no-duplicate-properties": [
true,
'rules': {
'at-rule-empty-line-before': [
'always',
{
ignore: ["consecutive-duplicates-with-different-values"]
except: [
'blockless-after-same-name-blockless',
'first-nested'
],
ignore: ['after-comment']
}
],
"declaration-block-no-shorthand-property-overrides": true,
"font-family-no-duplicate-names": true,
"font-family-no-missing-generic-family-keyword": true,
"function-calc-no-unspaced-operator": true,
"function-linear-gradient-no-nonstandard-direction": true,
"keyframe-declaration-no-important": true,
"media-feature-name-no-unknown": true,
"no-descending-specificity": true,
"no-duplicate-at-import-rules": true,
"no-duplicate-selectors": true,
"no-empty-source": true,
"no-extra-semicolons": true,
"no-invalid-double-slash-comments": true,
"property-no-unknown": true,
"selector-pseudo-class-no-unknown": true,
"selector-pseudo-element-no-unknown": true,
"selector-type-no-unknown": true,
"string-no-newline": true,
"unit-no-unknown": true
'at-rule-name-case': 'lower',
'at-rule-name-space-after': 'always-single-line',
'at-rule-semicolon-newline-after': 'always',
'block-closing-brace-empty-line-before': 'never',
'block-closing-brace-newline-after': 'always',
'block-closing-brace-newline-before': 'always-multi-line',
'block-closing-brace-space-before': 'always-single-line',
'block-opening-brace-newline-after': 'always-multi-line',
'block-opening-brace-space-after': 'always-single-line',
'block-opening-brace-space-before': 'always',
'color-hex-case': 'lower',
'color-hex-length': 'short',
'color-named': 'never',
'comment-empty-line-before': [
'always',
{
except: ['first-nested'],
ignore: ['stylelint-commands']
}
],
'comment-whitespace-inside': 'always',
'custom-property-empty-line-before': [
'always',
{
except: [
'after-custom-property',
'first-nested'
],
ignore: [
'after-comment',
'inside-single-line-block'
]
}
],
'declaration-bang-space-after': 'never',
'declaration-bang-space-before': 'always',
'declaration-block-semicolon-newline-after': 'always-multi-line',
'declaration-block-semicolon-space-after': 'always-single-line',
'declaration-block-semicolon-space-before': 'never',
'declaration-block-single-line-max-declarations': 1,
'declaration-block-trailing-semicolon': 'always',
'declaration-colon-newline-after': 'always-multi-line',
'declaration-colon-space-after': 'always-single-line',
'declaration-colon-space-before': 'never',
'declaration-empty-line-before': [
'always',
{
except: [
'after-declaration',
'first-nested'
],
ignore: [
'after-comment',
'inside-single-line-block'
]
}
],
'declaration-no-important': [
true,
{
severity: 'warning'
}
],
'function-comma-newline-after': 'always-multi-line',
'function-comma-space-after': 'always-single-line',
'function-comma-space-before': 'never',
'function-max-empty-lines': 0,
'function-name-case': 'lower',
'function-parentheses-newline-inside': 'always-multi-line',
'function-parentheses-space-inside': 'never-single-line',
'function-whitespace-after': 'always',
'indentation': 2,
'length-zero-no-unit': true,
'max-empty-lines': 1,
'max-nesting-depth': 5,
'media-feature-colon-space-after': 'always',
'media-feature-colon-space-before': 'never',
'media-feature-name-case': 'lower',
'media-feature-parentheses-space-inside': 'never',
'media-feature-range-operator-space-after': 'always',
'media-feature-range-operator-space-before': 'always',
'media-query-list-comma-newline-after': 'always-multi-line',
'media-query-list-comma-space-after': 'always-single-line',
'media-query-list-comma-space-before': 'never',
'no-extra-semicolons': true,
'no-missing-end-of-source-newline': true,
'number-leading-zero': 'always',
'number-no-trailing-zeros': true,
'property-case': 'lower',
'rule-empty-line-before': [
'always-multi-line',
{
except: ['first-nested'],
ignore: ['after-comment']
}
],
'selector-attribute-brackets-space-inside': 'never',
'selector-attribute-operator-space-after': 'never',
'selector-attribute-operator-space-before': 'never',
'selector-combinator-space-after': 'always',
'selector-combinator-space-before': 'always',
'selector-descendant-combinator-no-non-space': true,
'selector-list-comma-newline-after': 'always',
'selector-list-comma-space-before': 'never',
'selector-max-empty-lines': 0,
'selector-pseudo-class-case': 'lower',
'selector-pseudo-class-parentheses-space-inside': 'never',
'selector-pseudo-element-case': 'lower',
'selector-pseudo-element-colon-notation': 'double',
'selector-type-case': 'lower',
'unit-case': 'lower',
'value-list-comma-newline-after': 'always-multi-line',
'value-list-comma-space-after': 'always-single-line',
'value-list-comma-space-before': 'never',
'value-list-max-empty-lines': 0
}
};

View File

@@ -1,20 +1,15 @@
const CopyWebpackPlugin = require('copy-webpack-plugin');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const settings = require('./settings');
const packageJSON = require('./package.json');
const path = require('path');
console.log('Webpack mode:', settings.mode); // eslint-disable-line no-console
const DIST = path.resolve("./dist");
const MODE = process.env.NODE_ENV || 'development';
console.log('Webpack mode:', MODE); // eslint-disable-line no-console
const config = {
devtool: 'source-map',
entry: [
'./src/index.js'
],
mode: settings.mode,
output: {
path: settings.buildDestination,
filename: settings.name + '.js',
libraryTarget: 'amd'
},
entry: ['./src/index.js'],
externals: {
jquery: {
amd: 'jquery',
@@ -22,47 +17,61 @@ const config = {
commonjs2: 'jquery',
root: '_'
},
qlik: {
amd: 'qlik',
commonjs: 'qlik',
commonjs2: 'qlik',
root: '_'
}
},
mode: MODE,
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
exclude: /(node_modules|Library)/,
loader: 'eslint-loader',
options: {
failOnError: true
}
},
test: /\.(js|jsx)$/
},
{
test: /.js$/,
exclude: /node_modules/,
test: /\.(js|jsx)$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
plugins: [
'@babel/plugin-transform-async-to-generator',
'@babel/plugin-proposal-class-properties'
],
presets: [
'@babel/preset-env',
'@babel/preset-react'
]
}
}
},
{
test: /.less$/,
use: ['style-loader', 'css-loader', 'less-loader']
use: [
'style-loader',
'css-loader',
'less-loader'
]
}
]
},
output: {
filename: `${packageJSON.name}.js`,
libraryTarget: 'amd',
path: DIST
},
plugins: [
new CopyWebpackPlugin([
'assets/' + settings.name + '.qext',
'assets/' + settings.name + '.png',
'assets/wbfolder.wbl',
// TODO: remove entries below this line
'resources/Accounts.csv',
'resources/Accounts2.csv',
'resources/QlikLook.csv',
'resources/Excel.png',
], {}),
new StyleLintPlugin()
new StyleLintPlugin({
files: '**/*.less'
})
]
};