@panneau/app 1.0.1-alpha.0 → 1.0.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/css/styles.css +7 -0
- package/es/index.js +1812 -5
- package/lib/index.js +1842 -15
- package/package.json +66 -54
- package/scss/styles.scss +3 -0
- package/es/Panneau.js +0 -318
- package/es/actions/AuthActions.js +0 -16
- package/es/actions/LayoutActions.js +0 -14
- package/es/components/App.js +0 -129
- package/es/components/Layout.js +0 -68
- package/es/components/Panneau.js +0 -79
- package/es/components/index.js +0 -3
- package/es/components/pages/Account.js +0 -38
- package/es/components/pages/Home.js +0 -12
- package/es/components/pages/ResourceCreate.js +0 -44
- package/es/components/pages/ResourceDelete.js +0 -11
- package/es/components/pages/ResourceEdit.js +0 -28
- package/es/components/pages/ResourceForm.js +0 -343
- package/es/components/pages/ResourceIndex.js +0 -261
- package/es/components/pages/ResourceShow.js +0 -15
- package/es/components/partials/ResourceFormHeader.js +0 -111
- package/es/components/partials/ResourceIndexHeader.js +0 -71
- package/es/defaults/routes.json +0 -10
- package/es/lib/createStore.js +0 -30
- package/es/reducers/AuthReducer.js +0 -32
- package/es/reducers/index.js +0 -4
- package/lib/Panneau.js +0 -340
- package/lib/actions/AuthActions.js +0 -25
- package/lib/actions/LayoutActions.js +0 -25
- package/lib/components/App.js +0 -159
- package/lib/components/Layout.js +0 -87
- package/lib/components/Panneau.js +0 -103
- package/lib/components/index.js +0 -23
- package/lib/components/pages/Account.js +0 -54
- package/lib/components/pages/Home.js +0 -23
- package/lib/components/pages/ResourceCreate.js +0 -65
- package/lib/components/pages/ResourceDelete.js +0 -22
- package/lib/components/pages/ResourceEdit.js +0 -44
- package/lib/components/pages/ResourceForm.js +0 -376
- package/lib/components/pages/ResourceIndex.js +0 -289
- package/lib/components/pages/ResourceShow.js +0 -28
- package/lib/components/partials/ResourceFormHeader.js +0 -137
- package/lib/components/partials/ResourceIndexHeader.js +0 -87
- package/lib/defaults/routes.json +0 -10
- package/lib/lib/createStore.js +0 -46
- package/lib/reducers/AuthReducer.js +0 -43
- package/lib/reducers/index.js +0 -15
- package/src/Panneau.js +0 -274
- package/src/actions/AuthActions.js +0 -17
- package/src/actions/LayoutActions.js +0 -12
- package/src/components/App.jsx +0 -121
- package/src/components/Layout.jsx +0 -51
- package/src/components/Panneau.jsx +0 -95
- package/src/components/index.js +0 -7
- package/src/components/pages/Account.jsx +0 -34
- package/src/components/pages/Home.jsx +0 -19
- package/src/components/pages/ResourceCreate.jsx +0 -50
- package/src/components/pages/ResourceDelete.jsx +0 -18
- package/src/components/pages/ResourceEdit.jsx +0 -39
- package/src/components/pages/ResourceForm.jsx +0 -361
- package/src/components/pages/ResourceIndex.jsx +0 -256
- package/src/components/pages/ResourceShow.jsx +0 -23
- package/src/components/partials/ResourceFormHeader.jsx +0 -137
- package/src/components/partials/ResourceIndexHeader.jsx +0 -84
- package/src/defaults/routes.json +0 -10
- package/src/index.js +0 -9
- package/src/lib/createStore.js +0 -21
- package/src/reducers/AuthReducer.js +0 -23
- package/src/reducers/index.js +0 -5
- package/src/styles/layout.scss +0 -5
- package/src/styles/pages/resource-form.scss +0 -42
- package/src/styles/pages/resource-index.scss +0 -43
- package/src/styles/partials/resource-form-header.scss +0 -7
- package/src/styles/partials/resource-index-header.scss +0 -13
- package/src/styles/vendor.global.scss +0 -5
package/package.json
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@panneau/app",
|
3
|
-
"version": "1.0.
|
4
|
-
"description": "
|
3
|
+
"version": "1.0.3-alpha.0",
|
4
|
+
"description": "",
|
5
5
|
"keywords": [
|
6
|
-
"
|
7
|
-
"javascript",
|
8
|
-
"form",
|
9
|
-
"dashboard"
|
6
|
+
"javascript"
|
10
7
|
],
|
11
8
|
"homepage": "https://github.com/folkloreinc/panneau-js",
|
12
9
|
"repository": {
|
@@ -25,66 +22,81 @@
|
|
25
22
|
{
|
26
23
|
"name": "Nicolas Roy-Bourdages",
|
27
24
|
"email": "nrb@folklore.email"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"name": "Julien Carignan",
|
28
|
+
"email": "jc@folklore.email"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"name": "Théo Gjini",
|
32
|
+
"email": "tg@folklore.email"
|
28
33
|
}
|
29
34
|
],
|
35
|
+
"license": "ISC",
|
30
36
|
"main": "lib/index.js",
|
31
37
|
"module": "es/index.js",
|
38
|
+
"exports": {
|
39
|
+
".": "./lib/index.js",
|
40
|
+
"./scss/styles": "./scss/styles.scss",
|
41
|
+
"./scss/styles.scss": "./scss/styles.scss",
|
42
|
+
"./assets/css/styles.css": "./assets/css/styles.css"
|
43
|
+
},
|
32
44
|
"files": [
|
33
45
|
"lib",
|
34
46
|
"es",
|
35
|
-
"
|
36
|
-
"
|
47
|
+
"assets",
|
48
|
+
"scss"
|
37
49
|
],
|
38
50
|
"scripts": {
|
39
|
-
"
|
40
|
-
"clean": "rm -rf dist && rm -rf lib && rm -rf es",
|
41
|
-
"webpack:dist": "../../node_modules/.bin/webpack --config ./webpack.config.js --progress --colors",
|
42
|
-
"webpack": "npm run webpack:dist",
|
43
|
-
"babel:es": "BABEL_ENV=es ../../node_modules/.bin/babel src --out-dir es --ignore src/**/*.story.jsx,src/**/*.test.jsx",
|
44
|
-
"babel:cjs": "BABEL_ENV=cjs ../../node_modules/.bin/babel src --out-dir lib --ignore src/**/*.story.jsx,src/**/*.test.jsx",
|
45
|
-
"babel": "npm run babel:es && npm run babel:cjs",
|
46
|
-
"copy:json": "rsync -a --include '*/' --include '*.json' --exclude '*' src/ lib/ && rsync -a --include '*/' --include '*.json' --exclude '*' src/ es/",
|
47
|
-
"intl": "node ../../scripts/buildPackageTranslations",
|
48
|
-
"build": "npm run babel && npm run intl && npm run copy:json",
|
49
|
-
"prepare": "npm run clean && npm run build",
|
50
|
-
"start": "npm run storybook"
|
51
|
-
},
|
52
|
-
"dependencies": {
|
53
|
-
"@babel/runtime": "^7.5.5",
|
54
|
-
"@fortawesome/fontawesome-free": "^5.7.1",
|
55
|
-
"@panneau/core": "^1.0.1-alpha.0",
|
56
|
-
"bootstrap": "^4.3.1",
|
57
|
-
"classnames": "^2.2.5",
|
58
|
-
"history": "^4.9.0",
|
59
|
-
"hoist-non-react-statics": "^3.3.0",
|
60
|
-
"invariant": "^2.2.2",
|
61
|
-
"jquery": "^3.4.1",
|
62
|
-
"js-cookie": "^2.2.0",
|
63
|
-
"lodash": "^4.17.15",
|
64
|
-
"moment": "^2.22.1",
|
65
|
-
"popper": "^1.0.1",
|
66
|
-
"popper.js": "^1.15.0",
|
67
|
-
"prop-types": "^15.7.0",
|
68
|
-
"query-string": "^6.8.2",
|
69
|
-
"react-intl": "^3.1.6",
|
70
|
-
"react-redux": "^7.1.0",
|
71
|
-
"react-router": "^5.0.1",
|
72
|
-
"react-router-dom": "^5.0.1",
|
73
|
-
"redux": "^4.0.4",
|
74
|
-
"redux-promise": "^0.6.0",
|
75
|
-
"redux-thunk": "^2.3.0",
|
76
|
-
"whatwg-fetch": "^3.0.0",
|
77
|
-
"wolfy87-eventemitter": "^5.2.4"
|
51
|
+
"prepare": "../../scripts/prepare-package.sh --scss"
|
78
52
|
},
|
79
53
|
"devDependencies": {
|
80
|
-
"
|
81
|
-
"react": "^16.
|
82
|
-
"react-dom": "^16.9.0",
|
83
|
-
"redux-devtools-extension": "^2.13.8"
|
54
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
55
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
84
56
|
},
|
85
57
|
"peerDependencies": {
|
86
|
-
"react": "^16.8.0",
|
87
|
-
"react-dom": "^16.8.0"
|
58
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
59
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
60
|
+
},
|
61
|
+
"dependencies": {
|
62
|
+
"@babel/runtime": "^7.12.5",
|
63
|
+
"@fortawesome/fontawesome-svg-core": "^1.2.35",
|
64
|
+
"@fortawesome/free-solid-svg-icons": "^5.15.3",
|
65
|
+
"@fortawesome/react-fontawesome": "^0.1.14",
|
66
|
+
"@panneau/auth": "^1.0.3-alpha.0",
|
67
|
+
"@panneau/core": "^1.0.3-alpha.0",
|
68
|
+
"@panneau/data": "^1.0.3-alpha.0",
|
69
|
+
"@panneau/displays": "^1.0.3-alpha.0",
|
70
|
+
"@panneau/element-alert": "^1.0.3-alpha.0",
|
71
|
+
"@panneau/element-button": "^1.0.3-alpha.0",
|
72
|
+
"@panneau/element-buttons": "^1.0.3-alpha.0",
|
73
|
+
"@panneau/element-dropdown": "^1.0.3-alpha.0",
|
74
|
+
"@panneau/element-form": "^1.0.3-alpha.0",
|
75
|
+
"@panneau/element-form-group": "^1.0.3-alpha.0",
|
76
|
+
"@panneau/element-label": "^1.0.3-alpha.0",
|
77
|
+
"@panneau/element-link": "^1.0.3-alpha.0",
|
78
|
+
"@panneau/element-loading": "^1.0.3-alpha.0",
|
79
|
+
"@panneau/element-menu": "^1.0.3-alpha.0",
|
80
|
+
"@panneau/element-navbar": "^1.0.3-alpha.0",
|
81
|
+
"@panneau/element-pagination": "^1.0.3-alpha.0",
|
82
|
+
"@panneau/element-radios": "^1.0.3-alpha.0",
|
83
|
+
"@panneau/fields": "^1.0.3-alpha.0",
|
84
|
+
"@panneau/filters": "^1.0.3-alpha.0",
|
85
|
+
"@panneau/forms": "^1.0.3-alpha.0",
|
86
|
+
"@panneau/intl": "^1.0.3-alpha.0",
|
87
|
+
"@panneau/lists": "^1.0.3-alpha.0",
|
88
|
+
"@panneau/modals": "^1.0.3-alpha.0",
|
89
|
+
"@panneau/themes": "^1.0.3-alpha.0",
|
90
|
+
"classnames": "^2.2.6",
|
91
|
+
"lodash": "^4.17.21",
|
92
|
+
"prop-types": "^15.7.2",
|
93
|
+
"query-string": "^7.0.0",
|
94
|
+
"react-intl": "^5.15.8||^6.0.0",
|
95
|
+
"react-router": "^6.2.1",
|
96
|
+
"react-router-dom": "^6.2.1"
|
97
|
+
},
|
98
|
+
"publishConfig": {
|
99
|
+
"access": "public"
|
88
100
|
},
|
89
|
-
"gitHead": "
|
101
|
+
"gitHead": "7f9c472b97c79a5c81da30730549acdde2de5c9f"
|
90
102
|
}
|
package/scss/styles.scss
ADDED
package/es/Panneau.js
DELETED
@@ -1,318 +0,0 @@
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
6
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
7
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
8
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
9
|
-
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
11
|
-
|
12
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
13
|
-
|
14
|
-
import React from 'react';
|
15
|
-
import { render as renderReact, hydrate as hydrateReact } from 'react-dom';
|
16
|
-
import EventEmitter from 'wolfy87-eventemitter';
|
17
|
-
import isObject from 'lodash/isObject';
|
18
|
-
import moment from 'moment';
|
19
|
-
import { ComponentsCollection } from '@panneau/core';
|
20
|
-
import PanneauComponent from './components/Panneau';
|
21
|
-
/**
|
22
|
-
* Panneau Application
|
23
|
-
*/
|
24
|
-
|
25
|
-
var Panneau =
|
26
|
-
/*#__PURE__*/
|
27
|
-
function (_EventEmitter) {
|
28
|
-
_inherits(Panneau, _EventEmitter);
|
29
|
-
|
30
|
-
_createClass(Panneau, null, [{
|
31
|
-
key: "setDefaultComponentsCollection",
|
32
|
-
value: function setDefaultComponentsCollection(componentsCollection, namespace) {
|
33
|
-
if (typeof namespace !== 'undefined') {
|
34
|
-
Panneau.defaultComponentsCollection.setComponents(componentsCollection, namespace);
|
35
|
-
} else {
|
36
|
-
Panneau.defaultComponentsCollection = componentsCollection;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
}, {
|
40
|
-
key: "setDefaultLocaleMessages",
|
41
|
-
value: function setDefaultLocaleMessages(locale, messages) {
|
42
|
-
if (isObject(locale)) {
|
43
|
-
Panneau.defaultLocaleMessages = _objectSpread({}, locale);
|
44
|
-
} else {
|
45
|
-
Panneau.defaultLocaleMessages = _objectSpread({}, Panneau.defaultLocaleMessages, _defineProperty({}, locale, _objectSpread({}, messages)));
|
46
|
-
}
|
47
|
-
}
|
48
|
-
/**
|
49
|
-
* Create a new panneau environment
|
50
|
-
* @param {object} definition The definition of the Panneau instance
|
51
|
-
* @param {object} options Options for the new Panneau instance
|
52
|
-
*/
|
53
|
-
|
54
|
-
}]);
|
55
|
-
|
56
|
-
function Panneau(definition, options) {
|
57
|
-
var _this;
|
58
|
-
|
59
|
-
_classCallCheck(this, Panneau);
|
60
|
-
|
61
|
-
_this = _possibleConstructorReturn(this, _getPrototypeOf(Panneau).call(this));
|
62
|
-
_this.options = {};
|
63
|
-
_this.onRendered = _this.onRendered.bind(_assertThisInitialized(_this));
|
64
|
-
_this.onHydrated = _this.onHydrated.bind(_assertThisInitialized(_this));
|
65
|
-
_this.element = null;
|
66
|
-
_this.rendered = false;
|
67
|
-
_this.definition = definition;
|
68
|
-
_this.user = null;
|
69
|
-
_this.locale = 'en';
|
70
|
-
_this.messages = {};
|
71
|
-
_this.componentsCollection = Panneau.defaultComponentsCollection;
|
72
|
-
|
73
|
-
_this.setOptions(options);
|
74
|
-
|
75
|
-
return _this;
|
76
|
-
}
|
77
|
-
|
78
|
-
_createClass(Panneau, [{
|
79
|
-
key: "onRendered",
|
80
|
-
value: function onRendered() {
|
81
|
-
this.emit('rendered', this.element);
|
82
|
-
}
|
83
|
-
}, {
|
84
|
-
key: "onHydrated",
|
85
|
-
value: function onHydrated() {
|
86
|
-
this.emit('hydrated', this.element);
|
87
|
-
}
|
88
|
-
}, {
|
89
|
-
key: "render",
|
90
|
-
value: function render(element) {
|
91
|
-
this.rendered = true;
|
92
|
-
this.element = element || this.element;
|
93
|
-
var root = this.getRootElement();
|
94
|
-
renderReact(root, this.element, this.onRendered);
|
95
|
-
this.emit('render', this.element);
|
96
|
-
}
|
97
|
-
}, {
|
98
|
-
key: "hydrate",
|
99
|
-
value: function hydrate(element) {
|
100
|
-
this.rendered = false;
|
101
|
-
this.element = element || this.element;
|
102
|
-
var root = this.getRootElement();
|
103
|
-
hydrateReact(root, this.element, this.onHydrated);
|
104
|
-
this.emit('hydrate', this.element);
|
105
|
-
}
|
106
|
-
}, {
|
107
|
-
key: "getRootProps",
|
108
|
-
value: function getRootProps() {
|
109
|
-
return {
|
110
|
-
componentsCollection: this.componentsCollection,
|
111
|
-
definition: this.definition,
|
112
|
-
user: this.user,
|
113
|
-
locale: this.locale,
|
114
|
-
messages: _objectSpread({}, this.messages)
|
115
|
-
};
|
116
|
-
}
|
117
|
-
}, {
|
118
|
-
key: "getRootElement",
|
119
|
-
value: function getRootElement() {
|
120
|
-
var rootProps = this.getRootProps();
|
121
|
-
var rootElement = React.createElement(PanneauComponent, rootProps);
|
122
|
-
return rootElement;
|
123
|
-
}
|
124
|
-
/**
|
125
|
-
* Set the options
|
126
|
-
* @param {object} options The new options
|
127
|
-
* @return {this}
|
128
|
-
*/
|
129
|
-
|
130
|
-
}, {
|
131
|
-
key: "setOptions",
|
132
|
-
value: function setOptions() {
|
133
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
134
|
-
|
135
|
-
var user = options.user,
|
136
|
-
locale = options.locale,
|
137
|
-
messages = options.messages,
|
138
|
-
componentsCollection = options.componentsCollection,
|
139
|
-
otherOptions = _objectWithoutProperties(options, ["user", "locale", "messages", "componentsCollection"]);
|
140
|
-
|
141
|
-
this.options = _objectSpread({}, this.options, {}, otherOptions);
|
142
|
-
|
143
|
-
if (typeof locale !== 'undefined') {
|
144
|
-
this.setLocale(locale);
|
145
|
-
}
|
146
|
-
|
147
|
-
if (typeof componentsCollection !== 'undefined') {
|
148
|
-
this.setComponentsCollection(componentsCollection);
|
149
|
-
}
|
150
|
-
|
151
|
-
if (typeof messages !== 'undefined') {
|
152
|
-
this.setMessages(messages);
|
153
|
-
}
|
154
|
-
|
155
|
-
if (typeof user !== 'undefined') {
|
156
|
-
this.setUser(user);
|
157
|
-
}
|
158
|
-
|
159
|
-
if (this.rendered) {
|
160
|
-
this.render();
|
161
|
-
}
|
162
|
-
|
163
|
-
return this;
|
164
|
-
}
|
165
|
-
/**
|
166
|
-
* Get the options
|
167
|
-
* @return {object} The options
|
168
|
-
*/
|
169
|
-
|
170
|
-
}, {
|
171
|
-
key: "getOptions",
|
172
|
-
value: function getOptions() {
|
173
|
-
return this.options;
|
174
|
-
}
|
175
|
-
/**
|
176
|
-
* Set the definition
|
177
|
-
* @param {object} definition The new definition
|
178
|
-
* @return {this}
|
179
|
-
*/
|
180
|
-
|
181
|
-
}, {
|
182
|
-
key: "setDefinition",
|
183
|
-
value: function setDefinition(definition) {
|
184
|
-
this.definition = definition;
|
185
|
-
return this;
|
186
|
-
}
|
187
|
-
/**
|
188
|
-
* Get the definition
|
189
|
-
* @return {object} The definition
|
190
|
-
*/
|
191
|
-
|
192
|
-
}, {
|
193
|
-
key: "getDefinition",
|
194
|
-
value: function getDefinition() {
|
195
|
-
return this.definition;
|
196
|
-
}
|
197
|
-
/**
|
198
|
-
* Set the user
|
199
|
-
* @param {object} user The new user
|
200
|
-
* @return {this}
|
201
|
-
*/
|
202
|
-
|
203
|
-
}, {
|
204
|
-
key: "setUser",
|
205
|
-
value: function setUser(user) {
|
206
|
-
this.user = user;
|
207
|
-
return this;
|
208
|
-
}
|
209
|
-
/**
|
210
|
-
* Get the user
|
211
|
-
* @return {object} The user
|
212
|
-
*/
|
213
|
-
|
214
|
-
}, {
|
215
|
-
key: "getUser",
|
216
|
-
value: function getUser() {
|
217
|
-
return this.user;
|
218
|
-
}
|
219
|
-
/**
|
220
|
-
* Set the locale
|
221
|
-
* @param {string} locale The new locale
|
222
|
-
* @return {this}
|
223
|
-
*/
|
224
|
-
|
225
|
-
}, {
|
226
|
-
key: "setLocale",
|
227
|
-
value: function setLocale(locale) {
|
228
|
-
this.locale = locale;
|
229
|
-
moment.locale(locale);
|
230
|
-
return this;
|
231
|
-
}
|
232
|
-
/**
|
233
|
-
* Get the locale
|
234
|
-
* @return {string} The locale
|
235
|
-
*/
|
236
|
-
|
237
|
-
}, {
|
238
|
-
key: "getLocale",
|
239
|
-
value: function getLocale() {
|
240
|
-
return this.locale;
|
241
|
-
}
|
242
|
-
/**
|
243
|
-
* Set the messages
|
244
|
-
* @param {object} messages The new messages
|
245
|
-
* @return {this}
|
246
|
-
*/
|
247
|
-
|
248
|
-
}, {
|
249
|
-
key: "setMessages",
|
250
|
-
value: function setMessages(messages) {
|
251
|
-
this.messages = Object.keys(messages || {}).reduce(function (allMessages, key) {
|
252
|
-
return _objectSpread({}, allMessages, _defineProperty({}, key, isObject(messages[key]) ? _objectSpread({}, isObject(allMessages[key] || null) ? allMessages[key] : null, {}, messages[key]) : messages[key]));
|
253
|
-
}, _objectSpread({}, Panneau.defaultLocaleMessages));
|
254
|
-
return this;
|
255
|
-
}
|
256
|
-
/**
|
257
|
-
* Get the messages
|
258
|
-
* @return {object} The messages
|
259
|
-
*/
|
260
|
-
|
261
|
-
}, {
|
262
|
-
key: "getMessages",
|
263
|
-
value: function getMessages() {
|
264
|
-
return this.messages;
|
265
|
-
}
|
266
|
-
/**
|
267
|
-
* Alias to work with components collection
|
268
|
-
* @return {ComponentsCollection} The components collection
|
269
|
-
*/
|
270
|
-
|
271
|
-
}, {
|
272
|
-
key: "components",
|
273
|
-
value: function components(key, value) {
|
274
|
-
if (typeof value !== 'undefined') {
|
275
|
-
this.componentsCollection.addComponent(key, value);
|
276
|
-
return this;
|
277
|
-
}
|
278
|
-
|
279
|
-
if (typeof key !== 'undefined') {
|
280
|
-
return this.componentsCollection.getComponent(key);
|
281
|
-
}
|
282
|
-
|
283
|
-
return this.componentsCollection;
|
284
|
-
}
|
285
|
-
/**
|
286
|
-
* Set the components collection
|
287
|
-
* @param {ComponentsCollection} fieldsCollection The new fields collection
|
288
|
-
*/
|
289
|
-
|
290
|
-
}, {
|
291
|
-
key: "setComponentsCollection",
|
292
|
-
value: function setComponentsCollection(componentsCollection, namespace) {
|
293
|
-
if (typeof namespace !== 'undefined') {
|
294
|
-
this.componentsCollection.setComponents(componentsCollection, namespace);
|
295
|
-
} else {
|
296
|
-
this.componentsCollection = componentsCollection;
|
297
|
-
}
|
298
|
-
|
299
|
-
return this;
|
300
|
-
}
|
301
|
-
/**
|
302
|
-
* Get the components collection
|
303
|
-
* @return {ComponentsCollection} The fields collection used by this instance
|
304
|
-
*/
|
305
|
-
|
306
|
-
}, {
|
307
|
-
key: "getComponentsCollection",
|
308
|
-
value: function getComponentsCollection(namespace) {
|
309
|
-
return typeof namespace !== 'undefined' ? this.componentsCollection.getCollection(namespace) : this.componentsCollection;
|
310
|
-
}
|
311
|
-
}]);
|
312
|
-
|
313
|
-
return Panneau;
|
314
|
-
}(EventEmitter);
|
315
|
-
|
316
|
-
Panneau.defaultComponentsCollection = new ComponentsCollection();
|
317
|
-
Panneau.defaultLocaleMessages = {};
|
318
|
-
export default Panneau;
|
package/es/components/App.js
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
2
|
-
import React, { useCallback } from 'react'; // import PropTypes from 'prop-types';
|
3
|
-
|
4
|
-
import { Route, Switch, Redirect, withRouter } from 'react-router';
|
5
|
-
import { connect } from 'react-redux';
|
6
|
-
import queryString from 'query-string';
|
7
|
-
import { PropTypes as PanneauPropTypes } from '@panneau/core';
|
8
|
-
import { useUrlGenerator, useDefinition } from '@panneau/core/contexts';
|
9
|
-
import 'bootstrap';
|
10
|
-
import Layout from './Layout';
|
11
|
-
import Home from './pages/Home';
|
12
|
-
import Account from './pages/Account';
|
13
|
-
import ResourceIndex from './pages/ResourceIndex';
|
14
|
-
import ResourceCreate from './pages/ResourceCreate';
|
15
|
-
import ResourceShow from './pages/ResourceShow';
|
16
|
-
import ResourceEdit from './pages/ResourceEdit';
|
17
|
-
import ResourceDelete from './pages/ResourceDelete';
|
18
|
-
var ResourcePages = {
|
19
|
-
index: ResourceIndex,
|
20
|
-
create: ResourceCreate,
|
21
|
-
show: ResourceShow,
|
22
|
-
edit: ResourceEdit,
|
23
|
-
"delete": ResourceDelete
|
24
|
-
};
|
25
|
-
var propTypes = {
|
26
|
-
history: PanneauPropTypes.history.isRequired,
|
27
|
-
user: PanneauPropTypes.user
|
28
|
-
};
|
29
|
-
var defaultProps = {
|
30
|
-
user: null
|
31
|
-
};
|
32
|
-
|
33
|
-
var App = function App(_ref) {
|
34
|
-
var history = _ref.history,
|
35
|
-
user = _ref.user;
|
36
|
-
var urlGenerator = useUrlGenerator();
|
37
|
-
var definition = useDefinition();
|
38
|
-
var resources = definition.resources();
|
39
|
-
|
40
|
-
var _getResourceActionUrl = useCallback(function (resource, action, id) {
|
41
|
-
return urlGenerator.resource(resource, action, id);
|
42
|
-
}, [urlGenerator]);
|
43
|
-
|
44
|
-
var _gotoResourceAction = function gotoResourceAction() {
|
45
|
-
return history.push(_getResourceActionUrl.apply(void 0, arguments));
|
46
|
-
};
|
47
|
-
|
48
|
-
var renderResourceRoutes = function renderResourceRoutes() {
|
49
|
-
var resource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
50
|
-
var id = resource !== null ? resource.id() : 'default';
|
51
|
-
return Object.keys(ResourcePages).map(function (action) {
|
52
|
-
return React.createElement(Route, {
|
53
|
-
key: "resource-".concat(id, "-").concat(action),
|
54
|
-
exact: true,
|
55
|
-
path: urlGenerator.resource(resource, action),
|
56
|
-
render: function render(_ref2) {
|
57
|
-
var _ref2$match$params = _ref2.match.params,
|
58
|
-
_ref2$match$params$re = _ref2$match$params.resource,
|
59
|
-
resourceId = _ref2$match$params$re === void 0 ? null : _ref2$match$params$re,
|
60
|
-
_ref2$match$params$id = _ref2$match$params.id,
|
61
|
-
itemId = _ref2$match$params$id === void 0 ? null : _ref2$match$params$id,
|
62
|
-
search = _ref2.location.search;
|
63
|
-
var query = queryString.parse(search);
|
64
|
-
var matchedResource = resource || resources.find(function (it) {
|
65
|
-
return resourceId !== null && it.id() === resourceId;
|
66
|
-
}) || null;
|
67
|
-
var PageComponent = ResourcePages[action];
|
68
|
-
return React.createElement(PageComponent, {
|
69
|
-
action: action,
|
70
|
-
query: query,
|
71
|
-
itemId: itemId,
|
72
|
-
resource: matchedResource,
|
73
|
-
getResourceActionUrl: function getResourceActionUrl() {
|
74
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
75
|
-
args[_key] = arguments[_key];
|
76
|
-
}
|
77
|
-
|
78
|
-
return _getResourceActionUrl.apply(void 0, [matchedResource].concat(args));
|
79
|
-
},
|
80
|
-
gotoResourceAction: function gotoResourceAction() {
|
81
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
82
|
-
args[_key2] = arguments[_key2];
|
83
|
-
}
|
84
|
-
|
85
|
-
return _gotoResourceAction.apply(void 0, [matchedResource].concat(args));
|
86
|
-
}
|
87
|
-
});
|
88
|
-
}
|
89
|
-
});
|
90
|
-
});
|
91
|
-
};
|
92
|
-
|
93
|
-
return React.createElement(Layout, null, React.createElement(Switch, null, user !== null ? React.createElement(Route, {
|
94
|
-
exact: true,
|
95
|
-
path: urlGenerator.route('account'),
|
96
|
-
render: function render() {
|
97
|
-
return React.createElement(Account, {
|
98
|
-
resource: definition.resource('users')
|
99
|
-
});
|
100
|
-
}
|
101
|
-
}) : React.createElement(Route, {
|
102
|
-
exact: true,
|
103
|
-
path: urlGenerator.route('account'),
|
104
|
-
render: function render() {
|
105
|
-
return React.createElement(Redirect, {
|
106
|
-
to: urlGenerator.route('home')
|
107
|
-
});
|
108
|
-
}
|
109
|
-
}), resources.filter(function (resource) {
|
110
|
-
return resource.hasRoutes();
|
111
|
-
}).reduce(function (routes, resource) {
|
112
|
-
return [].concat(_toConsumableArray(routes), _toConsumableArray(renderResourceRoutes(resource)));
|
113
|
-
}, []), renderResourceRoutes(), React.createElement(Route, {
|
114
|
-
exact: true,
|
115
|
-
path: urlGenerator.route('home'),
|
116
|
-
component: Home
|
117
|
-
})));
|
118
|
-
};
|
119
|
-
|
120
|
-
App.propTypes = propTypes;
|
121
|
-
App.defaultProps = defaultProps;
|
122
|
-
var WithStateContainer = connect(function (_ref3) {
|
123
|
-
var auth = _ref3.auth;
|
124
|
-
return {
|
125
|
-
user: auth.user || null
|
126
|
-
};
|
127
|
-
})(App);
|
128
|
-
var WithRouter = withRouter(WithStateContainer);
|
129
|
-
export default WithRouter;
|