From 164b9e47c2b7aeab5230fb72adf5b33594c52647 Mon Sep 17 00:00:00 2001 From: Artyom Date: Wed, 8 Sep 2021 01:38:08 +0300 Subject: [PATCH 1/3] [ADD] style option for SplitPane. Its more flexibly now --- src/layouts/SplitPaneLayout.tsx | 20 ++++++++------------ stories/TreeAndFormMktp.stories.tsx | 4 ++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/layouts/SplitPaneLayout.tsx b/src/layouts/SplitPaneLayout.tsx index 6af40d1..a3ed7f9 100644 --- a/src/layouts/SplitPaneLayout.tsx +++ b/src/layouts/SplitPaneLayout.tsx @@ -12,20 +12,13 @@ import SplitPane from 'react-split-pane'; import Pane from 'react-split-pane/lib/Pane'; import { FormsDispatchProps, FormsDispatch } from '../Form'; -import { rankWith, uiTypeIs, RankedTester } from '../testers'; +import { rankWith, uiTypeIs, RankedTester, optionIs } from '../testers'; import { withLayoutProps } from '../util/ContextToProps'; import { LayoutComponent } from './LayoutComponent'; import { Idx, RenderLayoutProps } from '../util/layout'; import { IViewKindElement } from '../models/uischema'; -const divStyle: React.CSSProperties = { - position: 'relative', - width: '300px', - flex: '1 1 auto', - margin: '1px', -}; - const renderSplitElements = ({ viewKind, viewKindElement, viewDescr, enabled, Render, form }: RenderLayoutProps) => { const elements = viewKindElement.elements; const defaultSize = viewKindElement.options && viewKindElement.options.defaultSize; @@ -35,7 +28,7 @@ const renderSplitElements = ({ viewKind, viewKindElement, viewDescr, enabled, Re const style = el.options && el.options.style; return ( -
+
@@ -55,6 +48,7 @@ export const SplitPaneLayoutRenderer: React.FC = ({ visible, }) => { //const layout = viewKindElement as Layout; + const options = viewKindElement.options || {}; const Render: React.FC = ({ idx, viewKind, viewKindElement, viewDescr, enabled }) => { return (
@@ -64,9 +58,11 @@ export const SplitPaneLayoutRenderer: React.FC = ({ }; return ( - - {renderSplitElements({ viewKind, viewKindElement, viewDescr, enabled, Render })} - +
+ + {renderSplitElements({ viewKind, viewKindElement, viewDescr, enabled, Render })} + +
); }; diff --git a/stories/TreeAndFormMktp.stories.tsx b/stories/TreeAndFormMktp.stories.tsx index 906bc1e..daa7d4e 100644 --- a/stories/TreeAndFormMktp.stories.tsx +++ b/stories/TreeAndFormMktp.stories.tsx @@ -86,6 +86,10 @@ const viewKinds = [ '@id': 'mktp:_934Jfg7', '@type': 'aldkg:SplitPaneLayout', options: { + style: { + width: '100%', + height: '100%', + }, defaultSize: { 'mktp:_85dfg67': '17%', 'mktp:_83jdv8': '40%', From b126a4152a3f423f4986f8c35b091f774249afa0 Mon Sep 17 00:00:00 2001 From: Alexey Ivanov Date: Thu, 9 Sep 2021 15:31:25 +0300 Subject: [PATCH 2/3] [refactor] GH-11 Full-screen controls in stories --- stories/TableLocalArtifacts.stories.tsx | 12 ++++++------ stories/TableRemoteArtifacts.stories.tsx | 12 ++++++------ stories/TableRemoteMktp.stories.tsx | 12 ++++++------ stories/TreeAndFormArtifact.stories.tsx | 16 ++++++++++------ stories/TreeAndFormMktp.stories.tsx | 12 ++++++------ stories/TwoTables.stories.tsx | 16 ++++++++++------ stories/TwoTablesBig.stories.tsx | 16 ++++++++++------ 7 files changed, 54 insertions(+), 42 deletions(-) diff --git a/stories/TableLocalArtifacts.stories.tsx b/stories/TableLocalArtifacts.stories.tsx index b43856f..e2247fe 100644 --- a/stories/TableLocalArtifacts.stories.tsx +++ b/stories/TableLocalArtifacts.stories.tsx @@ -937,9 +937,9 @@ const Template: Story = (args: any) => { // eslint-disable-next-line @typescript-eslint/no-var-requires connectReduxDevtools(require('remotedev'), rootStore); return ( - - -
+
+ + { }, }} /> -
- - + + +
); }; diff --git a/stories/TableRemoteArtifacts.stories.tsx b/stories/TableRemoteArtifacts.stories.tsx index 79698f4..d7f9b42 100644 --- a/stories/TableRemoteArtifacts.stories.tsx +++ b/stories/TableRemoteArtifacts.stories.tsx @@ -240,13 +240,13 @@ const Template: Story = (args: any) => { // eslint-disable-next-line @typescript-eslint/no-var-requires connectReduxDevtools(require('remotedev'), rootStore); return ( - - -
+
+ +
-
- - + + +
); }; diff --git a/stories/TableRemoteMktp.stories.tsx b/stories/TableRemoteMktp.stories.tsx index 6ca605e..fe3e538 100644 --- a/stories/TableRemoteMktp.stories.tsx +++ b/stories/TableRemoteMktp.stories.tsx @@ -303,13 +303,13 @@ const Template: Story = (args: any) => { // eslint-disable-next-line @typescript-eslint/no-var-requires connectReduxDevtools(require('remotedev'), rootStore); return ( - - -
+
+ + -
- - + + +
); }; diff --git a/stories/TreeAndFormArtifact.stories.tsx b/stories/TreeAndFormArtifact.stories.tsx index 360a007..a510765 100644 --- a/stories/TreeAndFormArtifact.stories.tsx +++ b/stories/TreeAndFormArtifact.stories.tsx @@ -64,6 +64,10 @@ const viewKinds = [ '@id': 'rm:_kf8Df7', '@type': 'aldkg:SplitPaneLayout', options: { + style: { + width: '100%', + height: '50%', + }, defaultSize: { 'rm:Folders_Coll': '17%', 'rm:_fgu778f': '83%', @@ -181,12 +185,12 @@ export const Empty: Story<{}> = () => { // eslint-disable-next-line @typescript-eslint/no-var-requires connectReduxDevtools(require('remotedev'), rootStore); return ( - - -
+
+ + -
- - + + +
); }; diff --git a/stories/TreeAndFormMktp.stories.tsx b/stories/TreeAndFormMktp.stories.tsx index daa7d4e..ea3c211 100644 --- a/stories/TreeAndFormMktp.stories.tsx +++ b/stories/TreeAndFormMktp.stories.tsx @@ -388,12 +388,12 @@ export const Empty: Story<{}> = () => { // eslint-disable-next-line @typescript-eslint/no-var-requires connectReduxDevtools(require('remotedev'), rootStore); return ( - - -
+
+ + -
- - + + +
); }; diff --git a/stories/TwoTables.stories.tsx b/stories/TwoTables.stories.tsx index 63b8b0a..0449b85 100644 --- a/stories/TwoTables.stories.tsx +++ b/stories/TwoTables.stories.tsx @@ -102,6 +102,10 @@ const viewKinds = [ '@id': 'mktp:_97hFH67', '@type': 'aldkg:SplitPaneLayout', options: { + style: { + width: '100%', + height: '100%', + }, defaultSize: { 'mktp:MarketplacesTabs': '17%', 'mktp:CategoryCardsTable': '43', @@ -599,13 +603,13 @@ const Template: Story = (args: any) => { // eslint-disable-next-line @typescript-eslint/no-var-requires connectReduxDevtools(require('remotedev'), rootStore); return ( - - -
+
+ + -
- - + + +
); }; diff --git a/stories/TwoTablesBig.stories.tsx b/stories/TwoTablesBig.stories.tsx index bba131d..ba0879e 100644 --- a/stories/TwoTablesBig.stories.tsx +++ b/stories/TwoTablesBig.stories.tsx @@ -102,6 +102,10 @@ const viewKinds = [ '@id': 'mktp:_97hFH67', '@type': 'aldkg:SplitPaneLayout', options: { + style: { + width: '100%', + height: '100%', + }, defaultSize: { 'mktp:MarketplacesTabs': '17%', 'mktp:CategoryCardsTable': '43', @@ -602,13 +606,13 @@ const Template: Story = (args: any) => { // eslint-disable-next-line @typescript-eslint/no-var-requires connectReduxDevtools(require('remotedev'), rootStore); return ( - - -
+
+ + -
- - + + +
); }; From 14cd23e1a289baa6c44c734789c93a3b182c832e Mon Sep 17 00:00:00 2001 From: Alexey Ivanov Date: Thu, 9 Sep 2021 15:51:23 +0300 Subject: [PATCH 3/3] [fix, refactor] GH-11 xhtmlText was missing in TestSchema --- stories/TableLocalArtifacts.stories.tsx | 667 +----------------------- test/schema/TestSchemas.ts | 12 + 2 files changed, 13 insertions(+), 666 deletions(-) diff --git a/stories/TableLocalArtifacts.stories.tsx b/stories/TableLocalArtifacts.stories.tsx index 732b269..e5d662a 100644 --- a/stories/TableLocalArtifacts.stories.tsx +++ b/stories/TableLocalArtifacts.stories.tsx @@ -7,7 +7,6 @@ * * SPDX-License-Identifier: GPL-3.0-only ********************************************************************************/ -import moment from 'moment'; import React from 'react'; import { Meta, Story } from '@storybook/react'; @@ -25,672 +24,8 @@ import { MstContextProvider, RendererRegistryEntry, tableRenderers, - viewDescrCollConstr, - viewKindCollConstr, } from '../src'; -const viewKinds = [ - { - '@id': 'rm:TimeSeriesViewKind', - '@type': 'rm:ViewKind', - type: 'TimeSeriesChart', // control type - options: { - // TODO: primary/secondary properties? links to collsConstrs? Pass the entire options to the to-be rendered component? - }, - mappings: { - type: { - type: 'pointer', - value: '/type', - }, - xField: 'resultTime', - yField: { - type: 'expr', - value: '(v) => v.replace(/^[^#]*#/, "")', - applyTo: '$.observedProperty', - dataProperty: 'hasSimpleResult', - }, - colorField: 'observedProperty', - adjust: { - type: 'object', - properties: { - type: 'dodge', - marginRatio: 0, - }, - }, - legend: { - type: 'object', - properties: { - link: { type: 'pointer', value: '/hasFeatureOfInterest' }, - dataField: 'hasFeatureOfInterest', - color: { type: 'pointer', value: '/options/color' }, - text: { type: 'pointer', value: '/options/label' }, - }, - wrapper: { type: 'pointer', value: '/hasFeatureOfInterest', options: true }, - }, - mapping: { - type: 'object', - properties: { - style: { - type: 'object', - properties: { - lineWidth: { type: 'pointer', value: '/options/lineWidth', default: 2 }, - stroke: { type: 'pointer', value: '/options/stroke' }, - }, - wrapper: { type: 'pointer', value: '/observedProperty' }, - }, - shape: { - type: 'pointer', - value: '/options/shape', - }, - color: { - type: 'pointer', - value: '/options/color', - wrapper: { type: 'pointer', value: '/observedProperty' }, - }, - }, - }, - }, - }, -]; - -const viewDescrs = [ - { - '@id': 'mh:ChartView', - '@type': 'rm:View', - title: 'ProductAnalysis', - description: 'Marketplace Product Analysis Time-series Charts', - viewKind: 'rm:TimeSeriesViewKind', - type: 'Chart', // control type - // child ui elements configs - options: { - dateFormat: 'DD.MM.YYYY', - timeUnit: 'day', - axes: { yAxis: { primary: ['price'], secondary: ['volume'], ratio: 0.5 } }, - }, - elements: [ - /** - * Product 1 - */ - { - '@id': 'rm:line_11', // machine-generated random UUID - '@type': 'rm:Element', - type: 'line', // TODO: +'Bar'/'Pie' (auxillary bars, auxillary lines) - resultsScope: 'sosa:Observations_11_CollConstr', // reference to data - options: { - label: 'Продукт 1', // TODO: in future should be a data-binding - color: '#4EEC1F', - lineWidth: 2, - shape: 'hvh', - // lineDash: '', - }, - }, - { - '@id': 'rm:line_12', // machine-generated random UUID - '@type': 'rm:Element', - type: 'interval', // TODO: +'Bar' (auxillary bars, auxillary lines) - resultsScope: 'sosa:Observations_12_CollConstr', // reference to data - options: { - label: 'Продукт 1', // TODO: in future should be a data-binding - color: '#4EEC1F', - lineWidth: 2, - // lineDash: '', - }, - }, - /** - * Product 2 - */ - { - '@id': 'rm:line_21', // machine-generated random UUID - '@type': 'rm:Element', - type: 'line', - resultsScope: 'sosa:Observations_21_CollConstr', // reference to data - options: { - label: 'Продукт 2', // TODO: in future should be a data-binding - color: '#0B49F2', - lineWidth: 2, - shape: 'hvh', - // lineDash: '', - }, - }, - { - '@id': 'rm:line_22', // machine-generated random UUID - '@type': 'rm:Element', - type: 'interval', - resultsScope: 'sosa:Observations_22_CollConstr', // reference to data - options: { - label: 'Продукт 2', // TODO: in future should be a data-binding - color: '#0B49F2', - lineWidth: 2, - // lineDash: '', - }, - }, - /** - * Product 3 - */ - { - '@id': 'rm:line_31', // machine-generated random UUID - '@type': 'rm:Element', - type: 'line', - resultsScope: 'sosa:Observations_31_CollConstr', // reference to data - options: { - label: 'Продукт 3', // TODO: in future should be a data-binding - color: '#F20B93', - lineWidth: 2, - shape: 'hvh', - // lineDash: '', - }, - }, - { - '@id': 'rm:line_32', // machine-generated random UUID - '@type': 'rm:Element', - type: 'interval', - resultsScope: 'sosa:Observations_32_CollConstr', // reference to data - options: { - label: 'Продукт 3', // TODO: in future should be a data-binding - color: '#F20B93', - lineWidth: 2, - // lineDash: '', - }, - }, - ], - // datasets constraints, specific to this view (UML aggregation) - collsConstrs: [ - /** - * Product 1 - */ - { - '@id': 'sosa:Observations_11_CollConstr', // machine-generated random UUID - '@type': 'rm:CollConstr', - entConstrs: [ - { - '@id': 'sosa:Observations_11_EntConstr_0', // machine-generated random UUID - '@type': 'rm:EntConstr', - schema: 'sosa:ObservationShape', - conditions: { - '@id': 'sosa:Observations_11_EntConstr_0_Condition', // machine-generated random UUID - '@type': 'rm:EntConstrCondition', - observedProperty: 'https://www.wildberries.ru/catalog/15570386#price', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15570386/detail.aspx', - }, - }, - ], - }, - { - '@id': 'sosa:Observations_12_CollConstr', - '@type': 'rm:CollConstr', - entConstrs: [ - { - '@id': 'sosa:Observations_12_EntConstr_0', - '@type': 'rm:EntConstr', - schema: 'sosa:ObservationShape', - conditions: { - '@id': 'sosa:Observations_12_EntConstr_0_Condition', - '@type': 'rm:EntConstrCondition', - observedProperty: 'https://www.wildberries.ru/catalog/15570386#volume', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15570386/detail.aspx', - }, - }, - ], - }, - /** - * Product 2 - */ - { - '@id': 'sosa:Observations_21_CollConstr', - '@type': 'rm:CollConstr', - entConstrs: [ - { - '@id': 'sosa:Observations_21_EntConstr_0', - '@type': 'rm:EntConstr', - schema: 'sosa:ObservationShape', - conditions: { - '@id': 'sosa:Observations_21_EntConstr_0_Condition', - '@type': 'rm:EntConstrCondition', - observedProperty: 'https://www.wildberries.ru/catalog/16170086#price', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/16170086/detail.aspx', - }, - }, - ], - }, - { - '@id': 'sosa:Observations_22_CollConstr', - '@type': 'rm:CollConstr', - entConstrs: [ - { - '@id': 'sosa:Observations_22_EntConstr_0', - '@type': 'rm:EntConstr', - schema: 'sosa:ObservationShape', - conditions: { - '@id': 'sosa:Observations_22_EntConstr_0_Condition', - '@type': 'rm:EntConstrCondition', - observedProperty: 'https://www.wildberries.ru/catalog/16170086#volume', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/16170086/detail.aspx', - }, - }, - ], - }, - /** - * Product 3 - */ - { - '@id': 'sosa:Observations_31_CollConstr', - '@type': 'rm:CollConstr', - entConstrs: [ - { - '@id': 'sosa:Observations_31_EntConstr_0', - '@type': 'rm:EntConstr', - schema: 'sosa:ObservationShape', - conditions: { - '@id': 'sosa:Observations_31_EntConstr_0_Condition', - '@type': 'rm:EntConstrCondition', - observedProperty: 'https://www.wildberries.ru/catalog/15622789#price', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15622789/detail.aspx', - }, - }, - ], - }, - { - '@id': 'sosa:Observations_32_CollConstr', - '@type': 'rm:CollConstr', - entConstrs: [ - { - '@id': 'sosa:Observations_32_EntConstr_0', - '@type': 'rm:EntConstr', - schema: 'sosa:ObservationShape', - conditions: { - '@id': 'sosa:Observations_32_EntConstr_0_Condition', - '@type': 'rm:EntConstrCondition', - observedProperty: 'https://www.wildberries.ru/catalog/15622789#volume', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15622789/detail.aspx', - }, - }, - ], - }, - ], - }, -]; - -/** - * Product 1 https://www.wildberries.ru/catalog/15570386/detail.aspx?targetUrl=ST - */ -const viewDataObservations11 = [ - { - '@id': 'Observation/10011', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15570386', - observedProperty: 'https://www.wildberries.ru/catalog/15570386#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 3599, - resultTime: '2020-06-06T12:36:12Z', - }, - { - '@id': 'Observation/10012', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15570386', - observedProperty: 'https://www.wildberries.ru/catalog/15570386#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 1295, - resultTime: '2020-06-07T12:36:12Z', - }, - { - '@id': 'Observation/10013', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15570386', - observedProperty: 'https://www.wildberries.ru/catalog/15570386#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 1245, - resultTime: '2020-06-08T12:36:12Z', - }, - { - '@id': 'Observation/10014', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15570386', - observedProperty: 'https://www.wildberries.ru/catalog/15570386#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 1395, - resultTime: '2020-06-09T12:36:12Z', - }, - { - '@id': 'Observation/10015', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15570386', - observedProperty: 'https://www.wildberries.ru/catalog/15570386#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 1495, - resultTime: '2020-06-10T12:36:12Z', - }, -]; - -const viewDataObservations12 = [ - { - '@id': 'Observation/10021', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15570386', - observedProperty: 'https://www.wildberries.ru/catalog/15570386#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 10000, - resultTime: '2020-06-06T12:36:12Z', - }, - { - '@id': 'Observation/10022', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15570386', - observedProperty: 'https://www.wildberries.ru/catalog/15570386#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 16000, - resultTime: '2020-06-07T12:36:12Z', - }, - { - '@id': 'Observation/10023', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15570386', - observedProperty: 'https://www.wildberries.ru/catalog/15570386#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 18000, - resultTime: '2020-06-08T12:36:12Z', - }, - { - '@id': 'Observation/10024', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15570386', - observedProperty: 'https://www.wildberries.ru/catalog/15570386#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 14000, - resultTime: '2020-06-09T12:36:12Z', - }, - { - '@id': 'Observation/10025', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15570386', - observedProperty: 'https://www.wildberries.ru/catalog/15570386#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 12800, - resultTime: '2020-06-10T12:36:12Z', - }, -]; - -/** - * Product 2 https://www.wildberries.ru/catalog/16170086/detail.aspx?targetUrl=SG - */ -const viewDataObservations21 = [ - { - '@id': 'Observation/20011', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/16170086', - observedProperty: 'https://www.wildberries.ru/catalog/16170086#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 4499, - resultTime: '2020-06-06T12:36:12Z', - }, - { - '@id': 'Observation/20012', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/16170086', - observedProperty: 'https://www.wildberries.ru/catalog/16170086#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 1259, - resultTime: '2020-06-07T12:36:12Z', - }, - { - '@id': 'Observation/20013', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/16170086', - observedProperty: 'https://www.wildberries.ru/catalog/16170086#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 1478, - resultTime: '2020-06-08T12:36:12Z', - }, - { - '@id': 'Observation/20014', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/16170086', - observedProperty: 'https://www.wildberries.ru/catalog/16170086#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 1478, - resultTime: '2020-06-09T12:36:12Z', - }, - { - '@id': 'Observation/20015', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/16170086', - observedProperty: 'https://www.wildberries.ru/catalog/16170086#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 1350, - resultTime: '2020-06-10T12:36:12Z', - }, -]; - -const viewDataObservations22 = [ - { - '@id': 'Observation/20021', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/16170086', - observedProperty: 'https://www.wildberries.ru/catalog/16170086#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 3000, - resultTime: '2020-06-06T12:36:12Z', - }, - { - '@id': 'Observation/20022', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/16170086', - observedProperty: 'https://www.wildberries.ru/catalog/16170086#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 5900, - resultTime: '2020-06-07T12:36:12Z', - }, - { - '@id': 'Observation/20023', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/16170086', - observedProperty: 'https://www.wildberries.ru/catalog/16170086#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 4800, - resultTime: '2020-06-08T12:36:12Z', - }, - { - '@id': 'Observation/20024', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/16170086', - observedProperty: 'https://www.wildberries.ru/catalog/16170086#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 4700, - resultTime: '2020-06-09T12:36:12Z', - }, - { - '@id': 'Observation/20025', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/16170086', - observedProperty: 'https://www.wildberries.ru/catalog/16170086#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 2700, - resultTime: '2020-06-10T12:36:12Z', - }, -]; - -/** - * Product 3 https://www.wildberries.ru/catalog/15622789/detail.aspx?targetUrl=ST - */ -const viewDataObservations31 = [ - { - '@id': 'Observation/30011', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15622789', - observedProperty: 'https://www.wildberries.ru/catalog/15622789#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 1465, - resultTime: '2020-06-06T12:36:12Z', - }, - { - '@id': 'Observation/30012', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15622789', - observedProperty: 'https://www.wildberries.ru/catalog/15622789#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 1195, - resultTime: '2020-06-07T12:36:12Z', - }, - { - '@id': 'Observation/30013', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15622789', - observedProperty: 'https://www.wildberries.ru/catalog/15622789#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 2020, - resultTime: '2020-06-08T12:36:12Z', - }, - { - '@id': 'Observation/30014', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15622789', - observedProperty: 'https://www.wildberries.ru/catalog/15622789#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 2300, - resultTime: '2020-06-09T12:36:12Z', - }, - { - '@id': 'Observation/30015', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15622789', - observedProperty: 'https://www.wildberries.ru/catalog/15622789#price', - madeBySensor: 'scrapers/35', - hasSimpleResult: 2350, - resultTime: '2020-06-10T12:36:12Z', - }, -]; - -const viewDataObservations32 = [ - { - '@id': 'Observation/30021', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15622789', - observedProperty: 'https://www.wildberries.ru/catalog/15622789#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 4400, - resultTime: '2020-06-06T12:36:12Z', - }, - { - '@id': 'Observation/30022', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15622789', - observedProperty: 'https://www.wildberries.ru/catalog/15622789#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 6600, - resultTime: '2020-06-07T12:36:12Z', - }, - { - '@id': 'Observation/30023', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15622789', - observedProperty: 'https://www.wildberries.ru/catalog/15622789#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 7000, - resultTime: '2020-06-08T12:36:12Z', - }, - { - '@id': 'Observation/30024', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15622789', - observedProperty: 'https://www.wildberries.ru/catalog/15622789#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 6500, - resultTime: '2020-06-09T12:36:12Z', - }, - { - '@id': 'Observation/30025', - '@type': 'sosa:Observation', - hasFeatureOfInterest: 'https://www.wildberries.ru/catalog/15622789', - observedProperty: 'https://www.wildberries.ru/catalog/15622789#volume', - madeBySensor: 'scrapers/35', - hasSimpleResult: 6100, - resultTime: '2020-06-10T12:36:12Z', - }, -]; - -const rootModelState = { - ...rootModelInitialState, - colls: { - // ViewDescr - [viewDescrCollConstr['@id']]: { - '@id': viewDescrCollConstr['@id'], - collConstr: viewDescrCollConstr, - dataIntrnl: viewDescrs, - updPeriod: undefined, - lastSynced: moment.now(), - resolveCollConstrs: false, - }, - // ViewKindDescr - [viewKindCollConstr['@id']]: { - '@id': viewKindCollConstr['@id'], - collConstr: viewKindCollConstr, - dataIntrnl: viewKinds, - updPeriod: undefined, - lastSynced: moment.now(), - resolveCollConstrs: false, - }, - - // Data - /** - * Product 1 - */ - [viewDescrs[0].collsConstrs?.[0]['@id'] || '']: { - '@id': viewDescrs[0].collsConstrs?.[0]['@id'], - collConstr: viewDescrs[0].collsConstrs?.[0]['@id'], // reference by @id - dataIntrnl: viewDataObservations11, - updPeriod: undefined, - lastSynced: moment.now(), - resolveCollConstrs: false, - }, - [viewDescrs[0].collsConstrs?.[1]['@id'] || '']: { - '@id': viewDescrs[0].collsConstrs?.[1]['@id'], - collConstr: viewDescrs[0].collsConstrs?.[1]['@id'], // reference by @id - dataIntrnl: viewDataObservations12, - updPeriod: undefined, - lastSynced: moment.now(), - resolveCollConstrs: false, - }, - /** - * Product 2 - */ - [viewDescrs[0].collsConstrs?.[2]['@id'] || '']: { - '@id': viewDescrs[0].collsConstrs?.[2]['@id'], - collConstr: viewDescrs[0].collsConstrs?.[2]['@id'], // reference by @id - dataIntrnl: viewDataObservations21, - updPeriod: undefined, - lastSynced: moment.now(), - resolveCollConstrs: false, - }, - - [viewDescrs[0].collsConstrs?.[3]['@id'] || '']: { - '@id': viewDescrs[0].collsConstrs?.[3]['@id'], - collConstr: viewDescrs[0].collsConstrs?.[3]['@id'], // reference by @id - dataIntrnl: viewDataObservations22, - updPeriod: undefined, - lastSynced: moment.now(), - resolveCollConstrs: false, - }, - /** - * Product 3 - */ - [viewDescrs[0].collsConstrs?.[4]['@id'] || '']: { - '@id': viewDescrs[0].collsConstrs?.[4]['@id'], - collConstr: viewDescrs[0].collsConstrs?.[4]['@id'], // reference by @id - dataIntrnl: viewDataObservations31, - updPeriod: undefined, - lastSynced: moment.now(), - resolveCollConstrs: false, - }, - [viewDescrs[0].collsConstrs?.[5]['@id'] || '']: { - '@id': viewDescrs[0].collsConstrs?.[5]['@id'], - collConstr: viewDescrs[0].collsConstrs?.[5]['@id'], // reference by @id - dataIntrnl: viewDataObservations32, - updPeriod: undefined, - lastSynced: moment.now(), - resolveCollConstrs: false, - }, - }, -}; - const fakeData = [ { '@id': 'reqs:collect1', @@ -932,7 +267,7 @@ const Template: Story = (args: any) => { const client = new SparqlClientImpl('https://rdf4j.agentlab.ru/rdf4j-server'); //@ts-ignore - const rootStore = MstRepository.create(rootModelState, { client }); + const rootStore = MstRepository.create(rootModelInitialState, { client }); const store: any = asReduxStore(rootStore); // eslint-disable-next-line @typescript-eslint/no-var-requires connectReduxDevtools(require('remotedev'), rootStore); diff --git a/test/schema/TestSchemas.ts b/test/schema/TestSchemas.ts index dc43a9d..72dbc06 100644 --- a/test/schema/TestSchemas.ts +++ b/test/schema/TestSchemas.ts @@ -64,6 +64,10 @@ export const artifactSchema: JSONSchema6forRdf = { '@id': 'rm:artifactFormat', '@type': 'rmUserTypes:_YwcOsRmREemK5LEaKhoOow', }, + xhtmlText: { + '@id': 'rm:xhtmlText', + '@type': 'rdf:HTML', + }, }, properties: { '@id': { @@ -153,6 +157,14 @@ export const artifactSchema: JSONSchema6forRdf = { shapeModifiability: 'system', //valueModifiability: 'user', }, + xhtmlText: { + title: 'Форматированный текст', + description: 'Форматированный текст', + type: 'string', + contentMediaType: 'text/html', + shapeModifiability: 'system', + //valueModifiability: 'user', + }, }, required: ['@id', '@type', 'title' /*, 'identifier', 'assetFolder', 'artifactFormat'*/], };