Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: revert userSettings #370

Merged
merged 1 commit into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/picasso.js/src/core/chart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ function chartFn(definition, context) {
instance: c.instance,
resize: c.instance.resize,
preferredSize: dockConfig.computePreferredSize.bind(dockConfig),
userSettings: c.settings,
settings: c.settings,
layoutComponents: () => {}
};
});
Expand Down
3 changes: 0 additions & 3 deletions packages/picasso.js/src/core/component/component-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ function prepareContext(ctx, definition, opts) {
}

// TODO add setters and log warnings / errors to console
Object.defineProperty(ctx, 'userSettings', {
get: settings
});
Object.defineProperty(ctx, 'settings', {
get: settings
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Dock Layout', () => {
} = {}) {
const dummy = {};

dummy.userSettings = {
dummy.settings = {
key,
show,
layout: {
Expand Down Expand Up @@ -192,9 +192,9 @@ describe('Dock Layout', () => {

it('should throw an expection if needed properties are missing', () => {
const mainComp = {};
const leftComp = { userSettings: { layout: { dock: 'left' } } };
const rightComp = { userSettings: { layout: { dock: 'right' } }, resize: {} };
const asfdComp = { userSettings: { layout: { dock: 'right' } }, resize: () => {} };
const leftComp = { settings: { layout: { dock: 'left' } } };
const rightComp = { settings: { layout: { dock: 'right' } }, resize: {} };
const asfdComp = { settings: { layout: { dock: 'right' } }, resize: () => {} };
const fn = () => {
dl.layout(rect, [mainComp]);
};
Expand Down Expand Up @@ -814,7 +814,7 @@ describe('Dock Layout', () => {

const { visible, order } = dl.layout(rect, [mainComp, leftComp, onLeft, onMain]);

expect(visible.map(v => v.userSettings.key)).to.eql(['main', 'y', 'dockAtY', 'dockAtMain']);
expect(visible.map(v => v.settings.key)).to.eql(['main', 'y', 'dockAtY', 'dockAtMain']);
expect(order).to.eql([1, 3, 2, 0]);
});
});
Expand Down
6 changes: 3 additions & 3 deletions packages/picasso.js/src/core/layout/dock/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ function checkShowSettings(strategySettings, dockSettings, logicalContainerRect)
}

function validateComponent(component) {
if (!component.settings && !component.userSettings) {
if (!component.settings && !component.settings) {
throw new Error('Invalid component settings');
}
if (!component.resize || typeof component.resize !== 'function') {
Expand All @@ -367,9 +367,9 @@ function filterComponents(components, settings, rect) {
if (comp.instance) {
config = comp.instance.dockConfig();
} else {
config = dockConfig(comp.userSettings.layout);
config = dockConfig(comp.settings.layout);
}
const key = comp.userSettings.key;
const key = comp.settings.key;
const d = config.dock();
const referencedDocks = /@/.test(d) ? d.split(',').map(s => s.replace(/^\s*@/, '')) : [];
if (checkShowSettings(settings, config, rect)) {
Expand Down