Skip to content

Commit

Permalink
update widget packages: @babel/core, @babel/preset-env, babel-loader,…
Browse files Browse the repository at this point in the history
… css-loader, html-loader, terser-webpack-plugin and webpack
  • Loading branch information
Reddine committed Nov 14, 2022
1 parent 0305fea commit 0666ada
Show file tree
Hide file tree
Showing 8 changed files with 833 additions and 1,201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,29 @@ const useTableCellForm = ({ value, contributionId, propertyId }) => {
? getConfigByType(isLiteralField ? MISC.DEFAULT_LITERAL_DATATYPE : ENTITIES.RESOURCE).inputFormType
: getConfigByClassId(valueClass.id).inputFormType,
);
const [isModelOpen, setIsModalOpen] = useState(false);
const [dialogResourceId, setDialogResourceId] = useState(null);
const [dialogResourceLabel, setDialogResourceLabel] = useState(null);

const isBlankNode = useSelector(state => {
if (valueClass && !isLiteralField) {
if (state.contributionEditor.classes[valueClass.id]?.templateIds) {
const { templateIds } = state.contributionEditor.classes[valueClass.id];
// check if it's an inline resource
for (const templateId of templateIds) {
const template = state.contributionEditor.templates[templateId];
if (template && template.hasLabelFormat) {
return template.label;
}
}
if (!state.contributionEditor.classes[valueClass.id].isFetching) {
// in case there is no templates for the class
return false;
}
}
}
return false;
});

const createBlankNode = () => {
// 1 - create a resource
Expand All @@ -75,9 +98,6 @@ const useTableCellForm = ({ value, contributionId, propertyId }) => {
})
.catch(error => {});
};
const [isModelOpen, setIsModalOpen] = useState(false);
const [dialogResourceId, setDialogResourceId] = useState(null);
const [dialogResourceLabel, setDialogResourceLabel] = useState(null);

useEffect(() => {
if (valueClass) {
Expand All @@ -99,34 +119,13 @@ const useTableCellForm = ({ value, contributionId, propertyId }) => {
validationRules: property.validationRules,
};
}
const schema = validationSchema(component);
return schema;
const _schema = validationSchema(component);
return _schema;
}
const config = getConfigByType(inputDataType);
return config.schema;
});

const isBlankNode = useSelector(state => {
if (valueClass && !isLiteralField) {
if (state.contributionEditor.classes[valueClass.id]?.templateIds) {
const { templateIds } = state.contributionEditor.classes[valueClass.id];
// check if it's an inline resource
for (const templateId of templateIds) {
const template = state.contributionEditor.templates[templateId];
if (template && template.hasLabelFormat) {
return template.label;
}
}
if (!state.contributionEditor.classes[valueClass.id].isFetching) {
// in case there is no templates for the class
return false;
}
}
} else {
return false;
}
});

/**
* Get the correct xsd datatype if it's literal
*/
Expand Down
6 changes: 3 additions & 3 deletions widget/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ORKG Widget Documentation

bundle size: **8.23 kB**
bundle size: **8.57 kB**

### How to use:

Expand All @@ -9,11 +9,11 @@ Place the following code on your website and set the parameter data-doi.
```html
<div class="orkg-widget" data-doi="10.1007/s00799-015-0158-y"></div>
<script>
(function(w, d, s, o, f, js, fjs) {
(function (w, d, s, o, f, js, fjs) {
w['ORKG-Widget'] = o;
w[o] =
w[o] ||
function() {
function () {
(w[o].q = w[o].q || []).push(arguments);
};
(js = d.createElement(s)), (fjs = d.getElementsByTagName(s)[0]);
Expand Down
16 changes: 8 additions & 8 deletions widget/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,17 @@ <h1>Website Example</h1>
<div class="side">
<h2>About Me</h2>
<h5>Photo of me:</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<div class="fakeimg" style="height: 200px">Image</div>
<p>Some text about me in culpa qui officia deserunt mollit anim..</p>
<h3>More Text</h3>
<!-- ORKG HTML Snippet-->
<div class="orkg-widget" data-doi="10.1007/s00799-015-0158-y"></div>
<script>
(function(w, d, s, o, f, js, fjs) {
(function (w, d, s, o, f, js, fjs) {
w['ORKG-Widget'] = o;
w[o] =
w[o] ||
function() {
function () {
(w[o].q = w[o].q || []).push(arguments);
};
(js = d.createElement(s)), (fjs = d.getElementsByTagName(s)[0]);
Expand All @@ -159,16 +159,16 @@ <h3>More Text</h3>
</script>
<!-- END ORKG HTML Snippet-->
<p>Lorem ipsum dolor sit amet</p>
<div class="fakeimg" style="height:60px;">Image</div>
<div class="fakeimg" style="height: 60px">Image</div>
<br />
<div class="fakeimg" style="height:60px;">Image</div>
<div class="fakeimg" style="height: 60px">Image</div>
<br />
<div class="fakeimg" style="height:60px;">Image</div>
<div class="fakeimg" style="height: 60px">Image</div>
</div>
<div class="main">
<h2>TITLE HEADING</h2>
<h5>Title description, Dec 7, 2020</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<div class="fakeimg" style="height: 200px">Image</div>
<p>Some text..</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut laoreet elementum nulla, vitae viverra sem ultricies vitae. Nullam a
Expand All @@ -180,7 +180,7 @@ <h5>Title description, Dec 7, 2020</h5>
<br />
<h2>TITLE HEADING</h2>
<h5>Title description, Sep 2, 2020</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<div class="fakeimg" style="height: 200px">Image</div>
<p>Some text..</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut laoreet elementum nulla, vitae viverra sem ultricies vitae. Nullam a
Expand Down
16 changes: 8 additions & 8 deletions widget/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,17 @@ <h1>Website Example</h1>
<div class="side">
<h2>About Me</h2>
<h5>Photo of me:</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<div class="fakeimg" style="height: 200px">Image</div>
<p>Some text about me in culpa qui officia deserunt mollit anim..</p>
<h3>More Text</h3>
<!-- ORKG HTML Snippet-->
<div class="orkg-widget" data-doi="10.1007/s00799-015-0158-y"></div>
<script>
(function(w, d, s, o, f, js, fjs) {
(function (w, d, s, o, f, js, fjs) {
w['ORKG-Widget'] = o;
w[o] =
w[o] ||
function() {
function () {
(w[o].q = w[o].q || []).push(arguments);
};
(js = d.createElement(s)), (fjs = d.getElementsByTagName(s)[0]);
Expand All @@ -159,16 +159,16 @@ <h3>More Text</h3>
</script>
<!-- END ORKG HTML Snippet-->
<p>Lorem ipsum dolor sit amet</p>
<div class="fakeimg" style="height:60px;">Image</div>
<div class="fakeimg" style="height: 60px">Image</div>
<br />
<div class="fakeimg" style="height:60px;">Image</div>
<div class="fakeimg" style="height: 60px">Image</div>
<br />
<div class="fakeimg" style="height:60px;">Image</div>
<div class="fakeimg" style="height: 60px">Image</div>
</div>
<div class="main">
<h2>TITLE HEADING</h2>
<h5>Title description, Dec 7, 2020</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<div class="fakeimg" style="height: 200px">Image</div>
<p>Some text..</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut laoreet elementum nulla, vitae viverra sem ultricies vitae. Nullam a
Expand All @@ -180,7 +180,7 @@ <h5>Title description, Dec 7, 2020</h5>
<br />
<h2>TITLE HEADING</h2>
<h5>Title description, Sep 2, 2020</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<div class="fakeimg" style="height: 200px">Image</div>
<p>Some text..</p>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut laoreet elementum nulla, vitae viverra sem ultricies vitae. Nullam a
Expand Down
Loading

0 comments on commit 0666ada

Please sign in to comment.