@operato/form 7.1.30 → 7.1.32

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +7 -7
  4. package/.editorconfig +0 -29
  5. package/.storybook/main.js +0 -3
  6. package/.storybook/preview.js +0 -52
  7. package/.storybook/server.mjs +0 -8
  8. package/demo/index.html +0 -110
  9. package/src/components/ox-custom-input.ts +0 -102
  10. package/src/components/ox-custom-select.ts +0 -91
  11. package/src/components/ox-file-uploader.ts +0 -164
  12. package/src/components/ox-form-master.ts +0 -246
  13. package/src/components/ox-form-paginator.ts +0 -60
  14. package/src/components/ox-search-form-paginator.ts +0 -46
  15. package/src/components/ox-search-form.ts +0 -467
  16. package/src/filters/filter-checkbox.ts +0 -34
  17. package/src/filters/filter-input-barcode.ts +0 -35
  18. package/src/filters/filter-input.ts +0 -30
  19. package/src/filters/filter-range-date.ts +0 -81
  20. package/src/filters/filter-range-number.ts +0 -64
  21. package/src/filters/filter-select.ts +0 -56
  22. package/src/filters/filter-styles.ts +0 -127
  23. package/src/filters/index.ts +0 -10
  24. package/src/filters/ox-filter-personalizer.ts +0 -188
  25. package/src/filters/ox-filters-form-base.ts +0 -437
  26. package/src/filters/registry.ts +0 -54
  27. package/src/index.ts +0 -4
  28. package/src/styles/index.ts +0 -3
  29. package/src/styles/multi-column-form-styles.ts +0 -192
  30. package/src/styles/search-form-styles.ts +0 -160
  31. package/src/styles/single-column-form-styles.ts +0 -114
  32. package/src/types.ts +0 -106
  33. package/stories/ox-filters-form-barcode.stories.ts +0 -140
  34. package/stories/ox-filters-form-base-bounded.stories.ts +0 -208
  35. package/stories/ox-filters-form-base-change-handler.stories.ts +0 -220
  36. package/stories/ox-filters-form-base-page-preference.stories.ts +0 -177
  37. package/stories/ox-filters-form-base.stories.ts +0 -179
  38. package/stories/ox-search-form-change-handler.stories.ts +0 -253
  39. package/stories/ox-search-form.stories.ts +0 -258
  40. package/tsconfig.json +0 -24
  41. package/web-dev-server.config.mjs +0 -27
  42. package/web-test-runner.config.mjs +0 -41
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/form",
3
3
  "description": "WebApplication form supporting components following open-wc recommendations",
4
4
  "author": "heartyoh",
5
- "version": "7.1.30",
5
+ "version": "7.1.32",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "exports": {
@@ -62,11 +62,11 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@material/web": "^2.0.0",
65
- "@operato/graphql": "^7.1.1",
66
- "@operato/input": "^7.1.30",
67
- "@operato/p13n": "^7.1.30",
68
- "@operato/time-calculator": "^7.1.1",
69
- "@operato/utils": "^7.1.1",
65
+ "@operato/graphql": "^7.1.32",
66
+ "@operato/input": "^7.1.32",
67
+ "@operato/p13n": "^7.1.32",
68
+ "@operato/time-calculator": "^7.1.32",
69
+ "@operato/utils": "^7.1.32",
70
70
  "lit": "^3.1.2"
71
71
  },
72
72
  "devDependencies": {
@@ -102,5 +102,5 @@
102
102
  "prettier --write"
103
103
  ]
104
104
  },
105
- "gitHead": "863eb4937334eb66a3cd0e5dbea5c77bc1afc472"
105
+ "gitHead": "c4f5ed0b63d49d02c5a155b592c0ecf681c92cf7"
106
106
  }
package/.editorconfig DELETED
@@ -1,29 +0,0 @@
1
- # EditorConfig helps developers define and maintain consistent
2
- # coding styles between different editors and IDEs
3
- # editorconfig.org
4
-
5
- root = true
6
-
7
-
8
- [*]
9
-
10
- # Change these settings to your own preference
11
- indent_style = space
12
- indent_size = 2
13
-
14
- # We recommend you to keep these unchanged
15
- end_of_line = lf
16
- charset = utf-8
17
- trim_trailing_whitespace = true
18
- insert_final_newline = true
19
-
20
- [*.md]
21
- trim_trailing_whitespace = false
22
-
23
- [*.json]
24
- indent_size = 2
25
-
26
- [*.{html,js,md}]
27
- block_comment_start = /**
28
- block_comment = *
29
- block_comment_end = */
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- stories: ['../dist/stories/**/*.stories.{js,md,mdx}'],
3
- };
@@ -1,52 +0,0 @@
1
- import { i18next } from '@operato/i18n'
2
-
3
- export const globalTypes = {
4
- locale: {
5
- name: 'Locale',
6
- description: 'Internationalization locale',
7
- toolbar: {
8
- icon: 'globe',
9
- items: [
10
- { value: 'en', right: '🇺🇸', title: 'English' },
11
- { value: 'ko', right: '🇰🇷', title: '한국어' },
12
- { value: 'zh', right: '🇨🇳', title: '中文' },
13
- { value: 'ja', right: '🇯🇵', title: '日本語' },
14
- { value: 'ms', right: '🇲🇾', title: 'Bahasa Melayu' }
15
- ],
16
- showName: true
17
- }
18
- },
19
- theme: {
20
- name: 'Theme',
21
- description: 'Global theme for components',
22
- toolbar: {
23
- icon: 'paintbrush',
24
- items: [
25
- { value: 'light', title: 'Light' },
26
- { value: 'dark', title: 'Dark' }
27
- ],
28
- showName: true
29
- }
30
- }
31
- }
32
-
33
- export const decorators = [
34
- (Story, context) => {
35
- const { locale, theme } = context.globals
36
-
37
- if (locale) {
38
- i18next.changeLanguage(locale)
39
- }
40
-
41
- // Set the theme class for the document
42
- if (theme === 'dark') {
43
- document.documentElement.classList.add('dark')
44
- document.documentElement.classList.remove('light')
45
- } else {
46
- document.documentElement.classList.add('light')
47
- document.documentElement.classList.remove('dark')
48
- }
49
-
50
- return Story()
51
- }
52
- ]
@@ -1,8 +0,0 @@
1
- import { storybookPlugin } from '@web/dev-server-storybook';
2
- import baseConfig from '../web-dev-server.config.mjs';
3
-
4
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
5
- ...baseConfig,
6
- open: '/',
7
- plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins],
8
- });
package/demo/index.html DELETED
@@ -1,110 +0,0 @@
1
- <!doctype html>
2
- <html lang="en-GB">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
6
-
7
- <style>
8
- body {
9
- background: #fafafa;
10
- --ox-checkbox-size: 12px;
11
- }
12
-
13
- #demo {
14
- position: relative;
15
- height: 300px;
16
- background-color: lightgray;
17
- vertical-align: middle;
18
- }
19
- </style>
20
- <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet" />
21
- <link
22
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
23
- rel="stylesheet"
24
- />
25
- <link
26
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
27
- rel="stylesheet"
28
- />
29
- <link
30
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
31
- rel="stylesheet"
32
- />
33
-
34
- <link href="/themes/app-theme.css" rel="stylesheet" />
35
- <link href="/themes/form-theme.css" rel="stylesheet" />
36
- </head>
37
- <body>
38
- <div id="demo"></div>
39
-
40
- <script type="module">
41
- import { html, render } from 'lit'
42
- import '@material/web/icon/icon.js'
43
- import '../dist/src/filters/ox-filters-form-base.js'
44
-
45
- const form = document.querySelector('#demo')
46
-
47
- const filters = [
48
- {
49
- name: 'test',
50
- type: 'string',
51
- label: 'name',
52
- operator: 'eq'
53
- },
54
- {
55
- name: 'active',
56
- type: 'boolean',
57
- label: 'active',
58
- operator: 'eq'
59
- },
60
- {
61
- name: 'sss',
62
- type: 'select',
63
- label: 'sss',
64
- operator: 'eq',
65
- options: () => {
66
- return [
67
- {
68
- display: '',
69
- value: ''
70
- },
71
- {
72
- display: 'ABC',
73
- value: 'ABC'
74
- },
75
- {
76
- display: 'DEF',
77
- value: 'DEF'
78
- }
79
- ]
80
- }
81
- },
82
- {
83
- name: 'range',
84
- type: 'number',
85
- label: 'range',
86
- operator: 'between'
87
- },
88
- {
89
- name: 'date-range',
90
- type: 'datetime',
91
- label: 'date',
92
- operator: 'between'
93
- }
94
- ]
95
-
96
- render(
97
- html`
98
- <ox-filters-form-base
99
- .filters=${filters}
100
- @filters-change=${e => {
101
- console.log('filters changed', e.detail)
102
- }}
103
- url-params-sensitive
104
- ></ox-filters-form-base>
105
- `,
106
- form
107
- )
108
- </script>
109
- </body>
110
- </html>
@@ -1,102 +0,0 @@
1
- import { LitElement, PropertyValues, css, html } from 'lit'
2
- import { customElement, property, query, state } from 'lit/decorators.js'
3
-
4
- @customElement('ox-custom-input')
5
- export class CustomInput extends LitElement {
6
- static styles = css`
7
- input {
8
- margin: auto 0;
9
- border: 1px solid var(--md-sys-color-outline);
10
- padding: 0 var(--spacing-small);
11
- min-width: var(--form-input-width, 300px);
12
- max-width: var(--form-input-width, 300px);
13
- height: var(--form-element-height-medium);
14
- outline: var(--form-input-outline, none);
15
- color: var(--form-input-background-color, var(--md-sys-color-on-surface-variant));
16
- background-color: var(--form-input-background-color, var(--md-sys-color-surface-variant));
17
- }
18
- `
19
-
20
- @property({ type: String }) name?: string
21
- @property({ type: String }) placeholder?: string
22
- @property({ type: String }) type?: string
23
- @property({ type: Object }) props: any
24
- @property({ type: Array }) attrs: any
25
- @property({ type: String }) valueField?: string
26
- @property({ type: Object }) value: any
27
- @property({ type: Boolean }) autofocus: boolean = false
28
-
29
- @query('input') input!: HTMLInputElement
30
-
31
- render() {
32
- return html`
33
- <input
34
- name=${this.name}
35
- placeholder=${this.placeholder}
36
- type=${this.type || 'text'}
37
- value=${this.value || ''}
38
- @input=${(e: InputEvent) => (this.value = (e.currentTarget as HTMLInputElement).value)}
39
- ?autofocus=${this.autofocus}
40
- />
41
- `
42
- }
43
-
44
- get checked() {
45
- return this.input.checked
46
- }
47
-
48
- set checked(checked) {
49
- this.input.checked = checked
50
- }
51
-
52
- firstUpdated() {
53
- this.dispatchEvent(new CustomEvent('load'))
54
- }
55
-
56
- updated(changes: PropertyValues<this>) {
57
- if (changes.has('props')) {
58
- if (this._isObject(this.props)) {
59
- for (let prop in this.props) {
60
- if (this.props[prop]) {
61
- this.input.setAttribute(prop, this.props[prop])
62
- this.setAttribute(prop, this.props[prop])
63
- }
64
- }
65
- }
66
- }
67
-
68
- if (changes.has('attrs')) {
69
- if (this.attrs && Array.isArray(this.attrs)) {
70
- this.attrs.forEach(attr => {
71
- this.input.setAttribute(attr, '')
72
- this.setAttribute(attr, '')
73
- })
74
- }
75
- }
76
-
77
- if (changes.has('value') && this._isObject(this.value)) {
78
- let value = this.value
79
- this.value = (this.valueField && value[this.valueField]) || value[Object.keys(value)[0]]
80
- }
81
- }
82
-
83
- _isObject(v: any) {
84
- return v instanceof Object && !Array.isArray(v)
85
- }
86
-
87
- focus() {
88
- this.input.focus()
89
- }
90
-
91
- select() {
92
- this.input.select()
93
- }
94
-
95
- blur() {
96
- this.input.blur()
97
- }
98
-
99
- checkValidity() {
100
- return this.input.checkValidity()
101
- }
102
- }
@@ -1,91 +0,0 @@
1
- import { LitElement, PropertyValues, css, html } from 'lit'
2
- import { customElement, property, query } from 'lit/decorators.js'
3
-
4
- @customElement('ox-custom-select')
5
- export class CustomSelect extends LitElement {
6
- static styles = css`
7
- select {
8
- margin: auto 0;
9
- border-style: var(--form-input-border-style, solid);
10
- border-width: var(--form-input-border-width, 1px);
11
- border-color: var(--form-input-border-color, #c4c5c6);
12
- padding: var(--form-input-padding, 5px);
13
- outline: var(--form-input-outline, none);
14
- color: var(--form-input-background-color, var(--md-sys-color-on-surface-variant));
15
- background-color: var(--form-input-background-color, var(--md-sys-color-surface-variant));
16
- min-width: calc(
17
- var(--form-input-width, 300px) + 2 * var(--form-input-padding, 5px) + 2 * var(--form-input-border-width, 1px)
18
- );
19
- max-width: calc(
20
- var(--form-input-width) + 2 * var(--form-input-padding, 5px) + 2 * var(--form-input-border-width, 1px)
21
- );
22
- -webkit-appearance: none;
23
- -webkit-border-radius: 0px;
24
- }
25
- `
26
-
27
- @property({ type: String }) name?: string
28
- @property({ type: Array }) options?: { name: string; value: any }[]
29
- @property({ type: Object }) props: any
30
- @property({ type: Array }) attrs: any
31
- @property({ type: String }) value: any
32
- @property({ type: Boolean }) autofocus: boolean = false
33
-
34
- @query('select') select!: HTMLInputElement
35
-
36
- render() {
37
- return html`
38
- <select
39
- name=${this.name}
40
- ?autofocus=${this.autofocus}
41
- @change=${(e: Event) => (this.value = (e.currentTarget as HTMLSelectElement).value)}
42
- >
43
- ${(this.options || []).map(
44
- option => html`
45
- <option value=${option.value} ?selected=${this.value === option.value}>${option.name}</option>
46
- `
47
- )}
48
- </select>
49
- `
50
- }
51
-
52
- firstUpdated() {
53
- this.dispatchEvent(new CustomEvent('load'))
54
- }
55
-
56
- updated(changes: PropertyValues<this>) {
57
- if (changes.has('props') && this._isObject(this.props)) {
58
- for (let prop in this.props) {
59
- if (this.props[prop]) {
60
- this.select.setAttribute(prop, this.props[prop])
61
- this.setAttribute(prop, this.props[prop])
62
- }
63
- }
64
- }
65
-
66
- if (changes.has('attrs')) {
67
- if (this.attrs && Array.isArray(this.attrs)) {
68
- this.attrs.forEach(attr => {
69
- this.select.setAttribute(attr, '')
70
- this.setAttribute(attr, '')
71
- })
72
- }
73
- }
74
- }
75
-
76
- _isObject(v: any) {
77
- return v instanceof Object && !Array.isArray(v)
78
- }
79
-
80
- focus() {
81
- this.select.focus()
82
- }
83
-
84
- blur() {
85
- this.select.blur()
86
- }
87
-
88
- checkValidity() {
89
- return this.select.checkValidity()
90
- }
91
- }
@@ -1,164 +0,0 @@
1
- import { LitElement, css, html } from 'lit'
2
- import { customElement, property, query } from 'lit/decorators.js'
3
-
4
- import { FileDropHelper } from '@operato/utils'
5
-
6
- @customElement('ox-file-uploader')
7
- export class FileUploader extends LitElement {
8
- static styles = [
9
- css`
10
- :host {
11
- display: flex;
12
- flex-direction: column;
13
- border-radius: var(--border-radius);
14
- text-align: center;
15
- padding-bottom: 5px !important;
16
- text-transform: capitalize;
17
-
18
- border: var(--file-uploader-border);
19
- background-color: var(--md-sys-color-background);
20
- font: var(--file-uploader-font) !important;
21
- color: var(--file-uploader-color);
22
- }
23
- :host > md-icon {
24
- color: var(--file-uploader-icon-color);
25
- }
26
-
27
- :host(.candrop) {
28
- background-color: var(--file-uploader-candrop-background-color);
29
- }
30
-
31
- #input-file {
32
- display: none;
33
- }
34
-
35
- label {
36
- position: relative;
37
- width: auto;
38
- border: none;
39
- text-transform: capitalize;
40
-
41
- padding: var(--file-uploader-label-padding);
42
- border-radius: var(--file-uploader-label-border-radius);
43
- background-color: var(--file-uploader-label-background-color);
44
- color: var(--file-uploader-label-color);
45
- font: var(--file-uploader-label-font) !important;
46
- }
47
-
48
- ul {
49
- max-width: 500px;
50
- list-style: none;
51
- padding: 0;
52
- }
53
- li {
54
- text-align: left;
55
-
56
- padding: var(--file-uploader-li-padding);
57
- border-bottom: var(--file-uploader-li-border-bottom);
58
- display: flex;
59
- align-items: center;
60
- }
61
- li md-icon {
62
- cursor: pointer;
63
- font: var(--file-uploader-li-icon-font);
64
- margin-left: auto;
65
- }
66
- li md-icon:hover,
67
- li md-icon:active {
68
- color: var(--file-uploader-li-icon-focus-color);
69
- }
70
- `
71
- ]
72
-
73
- @property({ type: Boolean }) multiple: boolean = false
74
- @property({ type: String }) accept: string = '*/*'
75
- @property({ type: String }) label?: string
76
-
77
- @property({ type: Array }) _files: File[] = []
78
-
79
- @query('#input-file') fileInput!: HTMLInputElement
80
-
81
- render() {
82
- return html`
83
- <md-icon>post_add</md-icon>
84
- <span>add file or drop files here!</span>
85
- <input
86
- id="input-file"
87
- type="file"
88
- accept=${this.accept}
89
- ?multiple=${this.multiple}
90
- hidden
91
- @change=${(e: Event) => {
92
- const fileInput = e.currentTarget as HTMLInputElement
93
- const files = fileInput.files as FileList
94
- //// Temporary Validation preventing file size more than 10mb to be uploaded
95
- for (let index = 0; index < files.length; index++) {
96
- if (files[index].size > 9999999) {
97
- document.dispatchEvent(
98
- new CustomEvent('notify', {
99
- detail: {
100
- type: 'error',
101
- message: 'File size must be less than 10 MB.'
102
- }
103
- })
104
- )
105
- throw new Error('File size must be less than 10 MB.')
106
- }
107
- }
108
-
109
- this._files = [...this._files, ...Array.from(files)]
110
-
111
- this.dispatchEvent(
112
- new CustomEvent('files-change', {
113
- bubbles: true,
114
- composed: true,
115
- detail: {
116
- files: files
117
- }
118
- })
119
- )
120
-
121
- fileInput.value = ''
122
- }}
123
- />
124
- <label for="input-file">${this.label || 'select file'}</label>
125
-
126
- ${this._files?.length
127
- ? html` <ul>
128
- ${this._files.map(
129
- file => html`
130
- <li>
131
- - ${file.name}
132
- <md-icon
133
- @click=${(e: Event) => {
134
- this._files.splice(this._files.indexOf(file), 1)
135
- this.requestUpdate()
136
- }}
137
- >delete_outline</md-icon
138
- >
139
- </li>
140
- `
141
- )}
142
- </ul>`
143
- : ''}
144
- `
145
- }
146
-
147
- firstUpdated() {
148
- FileDropHelper.set(this)
149
-
150
- this.addEventListener('file-drop', (e: Event) => {
151
- const de = e as any
152
- this._files = this.multiple ? de.detail : de.detail[0] ? [de.detail[0]] : []
153
- })
154
- }
155
-
156
- get files() {
157
- return this._files
158
- }
159
-
160
- reset() {
161
- this.fileInput.value = ''
162
- this._files = []
163
- }
164
- }