Comparing version 0.3.0 to 0.3.1
@@ -169,3 +169,3 @@ "use strict"; | ||
try { | ||
let model = require("../../../../orm-model-config"); | ||
let model = require('../../../../orm-model-config'); | ||
return model.default; | ||
@@ -175,3 +175,3 @@ } | ||
try { | ||
let model = require("../../../../orm-model-config.cjs"); | ||
let model = require('../../../../orm-model-config.cjs'); | ||
return model; | ||
@@ -178,0 +178,0 @@ } |
@@ -28,5 +28,7 @@ "use strict"; | ||
init() { | ||
return __awaiter(this, void 0, void 0, function* () { }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// | ||
}); | ||
} | ||
} | ||
exports.default = Component; |
@@ -7,3 +7,3 @@ "use strict"; | ||
ormModelClass: null, | ||
viewPath: 'views' | ||
viewPath: 'views', | ||
}; | ||
@@ -10,0 +10,0 @@ } |
@@ -20,2 +20,13 @@ import Component from './Component'; | ||
static counter: number; | ||
/** | ||
* The HTML attributes for the container tag of the widget. | ||
* @see [[Html.renderTagAttributes]] for details on how attributes are being rendered. | ||
*/ | ||
options: { | ||
[key: string]: any; | ||
}; | ||
/** | ||
* Whether to enable [Pjax](https://github.com/MoOx/pjax) on this widget. | ||
*/ | ||
enablePjax: boolean; | ||
private _id; | ||
@@ -26,2 +37,6 @@ constructor(config: { | ||
/** | ||
* Initializes the widget. | ||
*/ | ||
init(): Promise<void>; | ||
/** | ||
* Returns the ID of the widget. | ||
@@ -28,0 +43,0 @@ * @param autoGenerate whether to generate an ID if it is not set previously |
@@ -12,2 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Application_1 = require("../base/Application"); | ||
const Component_1 = require("./Component"); | ||
@@ -24,5 +25,27 @@ /** | ||
super(config); | ||
/** | ||
* The HTML attributes for the container tag of the widget. | ||
* @see [[Html.renderTagAttributes]] for details on how attributes are being rendered. | ||
*/ | ||
this.options = {}; | ||
/** | ||
* Whether to enable [Pjax](https://github.com/MoOx/pjax) on this widget. | ||
*/ | ||
this.enablePjax = true; | ||
Object.assign(this, config); | ||
} | ||
/** | ||
* Initializes the widget. | ||
*/ | ||
init() { | ||
const _super = Object.create(null, { | ||
init: { get: () => super.init } | ||
}); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield _super.init.call(this); | ||
if (this.options.id === undefined) | ||
this.options.id = this.getId(); | ||
}); | ||
} | ||
/** | ||
* Returns the ID of the widget. | ||
@@ -54,2 +77,7 @@ * @param autoGenerate whether to generate an ID if it is not set previously | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.initialization; | ||
if (this.enablePjax) { | ||
yield Application_1.default.view.registerJs(`jQuery(document).on('submit', '#${this.options.id} form[data-pjax]', function(event){ jQuery.pjax.submit(event, {id: '${this.options.id}', container: '#${this.options.id}'})});`); | ||
yield Application_1.default.view.registerJs(`jQuery(document).pjax('#${this.options.id} a', '#${this.options.id}');`); | ||
} | ||
return ''; | ||
@@ -56,0 +84,0 @@ }); |
@@ -169,3 +169,3 @@ "use strict"; | ||
if (this.filterRowOptions.id === undefined) | ||
this.filterRowOptions.id = `${this.options.id}-filters`; | ||
this.filterRowOptions.id = `${this.options.id || this.getId()}-filters`; | ||
yield this.initColumns(); | ||
@@ -182,5 +182,5 @@ }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.initialization; | ||
yield Application_1.default.view.publishAndRegisterFile(path.join(__dirname, '/../assets/js/gridView.js')); | ||
yield Application_1.default.view.publishAndRegisterFile(path.join(__dirname, '/../assets/css/bootstrap.css')); | ||
//await this.initialization; | ||
const id = this.options.id; | ||
@@ -187,0 +187,0 @@ const options = Object.assign(Object.assign({}, this.getClientOptions()), { filterOnfocusOut: this.filterOnfocusOut }); |
@@ -10,5 +10,5 @@ "use strict"; | ||
extendableModelClass() { | ||
return (Application_1.default.ormModelClass)(); | ||
return Application_1.default.ormModelClass(); | ||
} | ||
} | ||
exports.default = ORMAdapter; |
@@ -17,3 +17,3 @@ "use strict"; | ||
pkgtest_lib_1.Application.ormAdapterClasses['mongoose'] = {}; | ||
pkgtest_lib_1.Application.setORMAdapter(new pkgtest_lib_1.Application.ormAdapterClasses['sequelize']); | ||
pkgtest_lib_1.Application.setORMAdapter(new pkgtest_lib_1.Application.ormAdapterClasses['sequelize']()); | ||
const url = require('url'); | ||
@@ -50,3 +50,3 @@ const queryString = require("querystring"); | ||
//Pwoli.orm = 'mongoose' | ||
console.log('orma', pkgtest_lib_1.Application.ormAdapterClasses, pkgtest_lib_1.Application.orm, pkgtest_lib_1.Application.getORMAdapter()); | ||
//console.log('orma', Pwoli.ormAdapterClasses, Pwoli.orm, Pwoli.getORMAdapter()) | ||
const uri = url.parse(req.url).pathname; | ||
@@ -99,3 +99,3 @@ let filename = path.join(process.cwd(), uri); | ||
const form1 = new pkgtest_lib_2.ActiveForm({ action: '/form' }); | ||
const form2 = new pkgtest_lib_2.ActiveForm({ action: '/form' }); | ||
const form2 = new pkgtest_lib_2.ActiveForm({ action: '/form', options: { 'data-pjax': 'true' } }); | ||
yield form1.initialization; | ||
@@ -112,3 +112,3 @@ yield form2.initialization; | ||
const dataProvider = filterModel.search(pkgtest_lib_2.DataHelper.parseUrl(req.url)); | ||
dataProvider.query = {}; //.include = [{ model: Event, as: 'event' }]; | ||
dataProvider.query.include = [{ model: pkgtest_models_1.Event, as: 'event' }]; | ||
let grid = new MyGridView({ | ||
@@ -126,3 +126,3 @@ dataProvider, | ||
label: 'Event Title', | ||
value: (model) => (model === null || model === void 0 ? void 0 : model.title) + '..' | ||
value: (model) => (model === null || model === void 0 ? void 0 : model.title) + '..', | ||
}, | ||
@@ -136,2 +136,5 @@ 'getter', | ||
], | ||
options: { | ||
id: 'my-grid', | ||
}, | ||
}); | ||
@@ -138,0 +141,0 @@ // res.write(await grid.render()); |
@@ -173,7 +173,2 @@ import Widget from '../base/Widget'; | ||
/** | ||
* Initializes the widget. | ||
* This renders the form open tag. | ||
*/ | ||
init(): Promise<void>; | ||
/** | ||
* Runs the widget. | ||
@@ -180,0 +175,0 @@ * @throws `Error` if `beginField()` and `endField()` calls are not matching. |
@@ -176,16 +176,2 @@ "use strict"; | ||
/** | ||
* Initializes the widget. | ||
* This renders the form open tag. | ||
*/ | ||
init() { | ||
const _super = Object.create(null, { | ||
init: { get: () => super.init } | ||
}); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield _super.init.call(this); | ||
if (this.options.id === undefined) | ||
this.options.id = this.getId(); | ||
}); | ||
} | ||
/** | ||
* Runs the widget. | ||
@@ -214,2 +200,5 @@ * @throws `Error` if `beginField()` and `endField()` calls are not matching. | ||
end() { | ||
const _super = Object.create(null, { | ||
run: { get: () => super.run } | ||
}); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -219,2 +208,3 @@ const html = Html_1.default.endForm(); | ||
yield this.registerClientScript(); | ||
yield _super.run.call(this); | ||
return html; | ||
@@ -221,0 +211,0 @@ }); |
@@ -74,3 +74,2 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield _super.init.call(this); | ||
if (this.dataProvider === undefined) | ||
@@ -80,4 +79,3 @@ throw new Error('The "dataProvider" property must be set.'); | ||
this.emptyText = 'No results found'; | ||
if (this.options.id === undefined) | ||
this.options.id = this.getId(); | ||
yield _super.init.call(this); | ||
}); | ||
@@ -89,3 +87,7 @@ } | ||
run() { | ||
const _super = Object.create(null, { | ||
run: { get: () => super.run } | ||
}); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield _super.run.call(this); | ||
let content; | ||
@@ -92,0 +94,0 @@ this._models = yield this.dataProvider.getModels(); |
{ | ||
"name": "pwoli", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1391418
35778