diff --git a/.travis.yml b/.travis.yml index a40700d81..99a041228 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,21 +10,25 @@ notifications: rooms: - temainfo:QGzy1iQZdygEHxsEuylBqC1e#truly-ui - temainfo:QGzy1iQZdygEHxsEuylBqC1e#builds + - trulyui:76h7TWRl73PnVEjb7ab0F5S2#builds node_js: - '8' - '10' - - '11' + - "11.10.1" before_script: - npm prune - npm run lint - npm run test script: - npm run build:library + - npm run copy:assets + - npm run copy:marckdowns after_success: - - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then npm run copy:assets; fi - - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then npm run copy:marckdowns; fi + - if [[ "$TRAVIS_BRANCH" == "develop" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then npm run publish:dev; fi - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then npm run semantic-release; fi - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then npm run build:showcase; fi +before_deploy: + - if [[ "$TRAVIS_BRANCH" == "develop" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then cd dist; fi deploy: - provider: s3 local_dir: showcase @@ -34,6 +38,13 @@ deploy: bucket: "truly-ui.com" region: us-east-1 acl: public_read + - provider: npm + skip_cleanup: true + email: "truly@temainfo.com.br" + api_key: $NPM_TOKEN + tag: dev + on: + branch: develop branches: except: - /^v\d+\.\d+\.\d+$/ diff --git a/README.md b/README.md index 1bf78fee8..15aa45fa0 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,8 @@ - ✨ Learn about it on the [docs site](http://truly-ui.com/) - 🚀 See it in action on [Stackblitz](https://stackblitz.com/edit/truly-ui-simple) - 😎 Checkout the [sample application](integration) -- 📝 Learn about updates from the [changelog](CHANGELOG.md) +- 📖 Read the blog [posts](https://medium.com/truly-ui) +- 📝 Learn about updates from the [changelog](https://github.com/TemainfoSoftware/truly-ui/releases) - 💬 Get to know the latest news first through [slack](https://trulyui.slack.com) @@ -93,7 +94,7 @@ We assume that you have already installed the following packages at least and ar ``` "styles": [ - src/styles.css", + "src/styles.css", ... "node_modules/@angular/cdk/overlay-prebuilt.css", "node_modules/truly-ui/css/icons/dx-icons/css/icons.scss", diff --git a/package-lock.json b/package-lock.json index 2deccb760..1e8d7742a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -208,6 +208,12 @@ "uuid": "^3.1.0" } }, + "semver": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", + "dev": true + }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", @@ -237,6 +243,14 @@ "@angular-devkit/core": "7.0.6", "rxjs": "6.3.3", "semver": "5.5.1" + }, + "dependencies": { + "semver": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", + "dev": true + } } }, "@angular-devkit/build-optimizer": { @@ -446,6 +460,12 @@ "signal-exit": "^3.0.2" } }, + "semver": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", + "dev": true + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -685,7 +705,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, @@ -1051,6 +1071,14 @@ "rxjs": "6.3.3", "semver": "5.5.1", "semver-intersect": "1.4.0" + }, + "dependencies": { + "semver": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", + "dev": true + } } }, "@semantic-release/commit-analyzer": { @@ -1137,7 +1165,7 @@ }, "globby": { "version": "8.0.1", - "resolved": "http://registry.npmjs.org/globby/-/globby-8.0.1.tgz", + "resolved": "https://registry.npmjs.org/globby/-/globby-8.0.1.tgz", "integrity": "sha512-oMrYrJERnKBLXNLVTqhm3vPEdJ/b2ZE28xN4YARiix1NOIOBPEpOUnm844K1iu/BkphCaf2WNFwMszv8Soi1pw==", "dev": true, "requires": { @@ -1343,7 +1371,7 @@ }, "@types/q": { "version": "0.0.32", - "resolved": "http://registry.npmjs.org/@types/q/-/q-0.0.32.tgz", + "resolved": "https://registry.npmjs.org/@types/q/-/q-0.0.32.tgz", "integrity": "sha1-vShOV8hPEyXacCur/IKlMoGQwMU=", "dev": true }, @@ -1683,6 +1711,7 @@ "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, + "optional": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", @@ -1881,7 +1910,7 @@ }, "array-equal": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", "dev": true }, @@ -2072,7 +2101,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -2165,7 +2194,7 @@ }, "babel-plugin-istanbul": { "version": "4.1.6", - "resolved": "http://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz", "integrity": "sha512-PWP9FQ1AhZhS01T/4qLSKoHGY/xvkZdVBGlKM/HuxxS3+sC66HhTNR7+MpbO/so/cz/wY94MeSWJuP1hXIPfwQ==", "dev": true, "requires": { @@ -2183,7 +2212,7 @@ }, "babel-plugin-syntax-object-rest-spread": { "version": "6.13.0", - "resolved": "http://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", "dev": true }, @@ -2380,7 +2409,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true } @@ -2563,7 +2592,7 @@ }, "browserify-aes": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", "dev": true, "requires": { @@ -2608,7 +2637,7 @@ }, "browserify-rsa": { "version": "4.0.1", - "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", "dev": true, "requires": { @@ -2677,7 +2706,7 @@ }, "buffer": { "version": "4.9.1", - "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", "dev": true, "requires": { @@ -2752,7 +2781,7 @@ }, "cacache": { "version": "10.0.4", - "resolved": "http://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", "integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==", "dev": true, "requires": { @@ -2820,7 +2849,7 @@ }, "callsites": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", "dev": true }, @@ -2842,7 +2871,7 @@ }, "camelcase-keys": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", "dev": true, "requires": { @@ -3130,7 +3159,7 @@ "dependencies": { "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true } @@ -3522,7 +3551,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, @@ -3672,7 +3701,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, @@ -3848,7 +3877,7 @@ }, "create-hash": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", "dev": true, "requires": { @@ -3861,7 +3890,7 @@ }, "create-hmac": { "version": "1.1.7", - "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", "dev": true, "requires": { @@ -4245,7 +4274,7 @@ }, "diffie-hellman": { "version": "5.0.3", - "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "dev": true, "requires": { @@ -4553,7 +4582,7 @@ }, "es6-promisify": { "version": "5.0.0", - "resolved": "http://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", "dev": true, "requires": { @@ -4680,7 +4709,7 @@ }, "events": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/events/-/events-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", "dev": true }, @@ -5461,7 +5490,7 @@ }, "finalhandler": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", "dev": true, "requires": { @@ -5971,7 +6000,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -5989,11 +6019,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6006,15 +6038,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -6117,7 +6152,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -6127,6 +6163,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -6139,17 +6176,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -6166,6 +6206,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -6238,7 +6279,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -6248,6 +6290,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -6323,7 +6366,8 @@ }, "safe-buffer": { "version": "5.1.1", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -6353,6 +6397,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -6370,6 +6415,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -6408,11 +6454,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.0.2", - "bundled": true + "bundled": true, + "optional": true } } }, @@ -6473,7 +6521,7 @@ }, "get-stream": { "version": "3.0.0", - "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, @@ -6830,7 +6878,7 @@ }, "got": { "version": "6.7.1", - "resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", "dev": true, "requires": { @@ -7046,7 +7094,7 @@ }, "handle-thing": { "version": "1.2.5", - "resolved": "http://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz", "integrity": "sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ=", "dev": true }, @@ -7375,7 +7423,7 @@ }, "http-errors": { "version": "1.6.3", - "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "dev": true, "requires": { @@ -7425,7 +7473,7 @@ }, "http-proxy-middleware": { "version": "0.18.0", - "resolved": "http://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.18.0.tgz", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-0.18.0.tgz", "integrity": "sha512-Fs25KVMPAIIcgjMZkVHJoKg9VcXcC1C8yb9JUgeDvVXY0S/zgVIhMb+qVswDIgtJe2DfckMSY2d6TuTEutlk6Q==", "dev": true, "requires": { @@ -7892,7 +7940,7 @@ }, "is-builtin-module": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true, "requires": { @@ -8056,7 +8104,7 @@ }, "is-obj": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", "dev": true }, @@ -9022,7 +9070,7 @@ }, "jest-get-type": { "version": "22.4.3", - "resolved": "http://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", "dev": true }, @@ -9814,7 +9862,7 @@ }, "json5": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", "dev": true }, @@ -9860,13 +9908,13 @@ "dependencies": { "core-js": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/core-js/-/core-js-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.3.0.tgz", "integrity": "sha1-+rg/uwstjchfpjbEudNMdUIMbWU=", "dev": true }, "es6-promise": { "version": "3.0.2", - "resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz", "integrity": "sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y=", "dev": true }, @@ -9878,7 +9926,7 @@ }, "readable-stream": { "version": "2.0.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", "dev": true, "requires": { @@ -10088,7 +10136,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -10101,7 +10149,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -10364,7 +10412,8 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", - "dev": true + "dev": true, + "optional": true }, "loose-envify": { "version": "1.4.0", @@ -10572,7 +10621,7 @@ }, "media-typer": { "version": "0.3.0", - "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", "dev": true }, @@ -10599,7 +10648,7 @@ }, "meow": { "version": "3.7.0", - "resolved": "http://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", "dev": true, "requires": { @@ -10617,7 +10666,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true } @@ -11208,7 +11257,7 @@ "dependencies": { "semver": { "version": "5.3.0", - "resolved": "http://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", "dev": true } @@ -11475,7 +11524,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -14929,7 +14978,7 @@ }, "opn": { "version": "5.3.0", - "resolved": "http://registry.npmjs.org/opn/-/opn-5.3.0.tgz", + "resolved": "https://registry.npmjs.org/opn/-/opn-5.3.0.tgz", "integrity": "sha512-bYJHo/LOmoTd+pfiYhfZDnf9zekVJrY+cnS2a5F2x+w5ppvTqObojTP7WiFG+kVZs9Inw+qQ/lw7TroWwhdd2g==", "dev": true, "requires": { @@ -15028,7 +15077,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -15090,7 +15139,7 @@ }, "p-is-promise": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=", "dev": true }, @@ -15187,7 +15236,7 @@ }, "parse-asn1": { "version": "5.1.1", - "resolved": "http://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", "dev": true, "requires": { @@ -15839,7 +15888,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -15867,7 +15916,7 @@ }, "globby": { "version": "5.0.0", - "resolved": "http://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", "dev": true, "requires": { @@ -15881,13 +15930,13 @@ }, "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -16122,7 +16171,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true } @@ -16139,7 +16188,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -16169,7 +16218,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true } @@ -16586,13 +16635,13 @@ }, "regjsgen": { "version": "0.2.0", - "resolved": "http://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", "dev": true }, "regjsparser": { "version": "0.1.5", - "resolved": "http://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", "dev": true, "requires": { @@ -17062,7 +17111,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true } @@ -17132,7 +17181,7 @@ "dependencies": { "source-map": { "version": "0.4.4", - "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { @@ -17530,9 +17579,9 @@ } }, "semver": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", - "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", "dev": true }, "semver-diff": { @@ -17695,7 +17744,7 @@ }, "sha.js": { "version": "2.4.11", - "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", "dev": true, "requires": { @@ -18330,7 +18379,7 @@ }, "stream-browserify": { "version": "2.0.1", - "resolved": "http://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", "dev": true, "requires": { @@ -18390,7 +18439,7 @@ "dependencies": { "readable-stream": { "version": "2.3.6", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -18491,7 +18540,7 @@ }, "strip-eof": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, @@ -18562,7 +18611,7 @@ }, "source-map": { "version": "0.1.43", - "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", "dev": true, "requires": { @@ -18621,7 +18670,7 @@ }, "tar": { "version": "2.2.1", - "resolved": "http://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, "requires": { @@ -19185,7 +19234,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true } @@ -19204,7 +19253,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, @@ -19965,7 +20014,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true } @@ -20074,7 +20123,7 @@ }, "source-map": { "version": "0.4.4", - "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { @@ -20572,7 +20621,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -20638,7 +20687,7 @@ }, "xmlbuilder": { "version": "9.0.7", - "resolved": "http://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", "dev": true }, diff --git a/package.json b/package.json index 6af97f026..bfce156b6 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "ci": "npm run lint && npm run test && npm run build:library && npm run build:showcase && npm run copy:marckdowns && npm run copy:assets", "copy:assets": "node ./tools/scripts/copy-assets.js", "copy:marckdowns": "node ./tools/scripts/copy-marckdowns-assets.js", + "publish:dev": "node ./tools/scripts/publish-dev-builds.js", "semantic-release": "semantic-release" }, "private": false, @@ -103,6 +104,7 @@ "protractor": "~5.4.1", "rimraf": "^2.6.2", "semantic-release": "^15.12.1", + "semver": "^5.6.0", "ts-node": "^7.0.1", "tsickle": "^0.34.0", "tslib": "^1.9.3", diff --git a/projects/truly-ui/src/components/accordion/services/accordion.service.ts b/projects/truly-ui/src/components/accordion/services/accordion.service.ts index 9b66feb92..89c7df7c4 100644 --- a/projects/truly-ui/src/components/accordion/services/accordion.service.ts +++ b/projects/truly-ui/src/components/accordion/services/accordion.service.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/autocomplete/autocomplete-theme.scss b/projects/truly-ui/src/components/autocomplete/autocomplete-theme.scss index b9d1fdb27..59ecbfc18 100644 --- a/projects/truly-ui/src/components/autocomplete/autocomplete-theme.scss +++ b/projects/truly-ui/src/components/autocomplete/autocomplete-theme.scss @@ -17,6 +17,14 @@ box-shadow: inset 0px 5px 7px -5px rgba(0, 0, 0, 0.10); border: 1px solid map-deep-get($basic, "default", "border"); + &.disabled { + opacity: 0.35; + filter: Alpha(Opacity=70); + cursor: default !important; + background-color: map-deep-get($basic, "default", "background"); + color: map-deep-get($basic, "default", "foreground"); + } + &.withBorder { border: 1px solid map-deep-get($basic, "default", "border"); } @@ -47,14 +55,6 @@ border: 1px solid map-deep-get($warning, "default", "border"); } - &:disabled { - opacity: 0.35; - filter: Alpha(Opacity=70); - cursor: default !important; - background-color: map-deep-get($basic, "default", "background"); - color: map-deep-get($basic, "default", "foreground"); - } - &:read-only { background-color: map-deep-get($basic, "default", "background"); color: map-deep-get($basic, "default", "foreground"); diff --git a/projects/truly-ui/src/components/autocomplete/autocomplete.html b/projects/truly-ui/src/components/autocomplete/autocomplete.html index 34df66af4..0f2771d85 100644 --- a/projects/truly-ui/src/components/autocomplete/autocomplete.html +++ b/projects/truly-ui/src/components/autocomplete/autocomplete.html @@ -3,20 +3,29 @@
+
+ +
+
+ +
- - {{ item[ keyText ] }} + + {{ getItemText(item) }}
- + {{ messageLoading }} diff --git a/projects/truly-ui/src/components/autocomplete/autocomplete.scss b/projects/truly-ui/src/components/autocomplete/autocomplete.scss index f7aa095d1..33b8d357c 100644 --- a/projects/truly-ui/src/components/autocomplete/autocomplete.scss +++ b/projects/truly-ui/src/components/autocomplete/autocomplete.scss @@ -2,6 +2,27 @@ box-sizing: border-box; } +.ui-loading { + position: absolute; + width: 20px; + right: 5px; +} + +.ui-close { + position: absolute; + right: 5px; + height: 18px; + width: 18px; + display: flex; + align-items: center; + place-content: center; + font-size: 1.6em; + opacity: 0.3; + &:hover { + cursor: pointer; + } +} + .ui-autocomplete-box { display: table; width: 100%; @@ -18,6 +39,7 @@ scroll-snap-type: y mandatory; -ms-scroll-snap-type: mandatory; scroll-snap-stop: always; + overflow-x: hidden; width: 100%; outline: none; height: 200px; @@ -73,6 +95,8 @@ height: 30px; border-radius: 3px; position: relative; + display: flex; + align-items: center; .ui-clearbutton { right: 10px; position: absolute; @@ -94,7 +118,7 @@ outline: none; height: 100%; width: 100%; - padding-left: 10px; + padding-left: 6px; border-radius: 3px; background: transparent; } diff --git a/projects/truly-ui/src/components/autocomplete/autocomplete.ts b/projects/truly-ui/src/components/autocomplete/autocomplete.ts index 5b905e4e9..5bc874198 100644 --- a/projects/truly-ui/src/components/autocomplete/autocomplete.ts +++ b/projects/truly-ui/src/components/autocomplete/autocomplete.ts @@ -21,33 +21,36 @@ */ import { Component, Input, Optional, Inject, OnInit, OnChanges, ViewChildren, - EventEmitter, Output, ChangeDetectorRef, QueryList, AfterViewInit, ViewChild, ElementRef, + EventEmitter, Output, ChangeDetectorRef, QueryList, AfterViewInit, ViewChild, ElementRef, OnDestroy, } from '@angular/core'; -import {FormControl} from '@angular/forms'; - -import {MakeProvider} from '../core/base/value-accessor-provider'; -import {ElementBase} from '../input/core/element-base'; -import {NG_ASYNC_VALIDATORS, NG_VALIDATORS, NgModel} from '@angular/forms'; -import {ConnectedOverlayPositionChange} from '@angular/cdk/overlay'; -import {ActiveDescendantKeyManager} from '@angular/cdk/a11y'; -import {CdkVirtualScrollViewport} from '@angular/cdk/scrolling'; -import {I18nService} from '../i18n/i18n.service'; -import {AUTOCOMPLETE_CONFIG, AutoCompleteConfig} from './interfaces/autocomplete.config'; -import {DataSourceList} from '../core/classes/datasource-list'; -import {TlItemSelectedDirective} from '../core/directives/itemSelected/item-selected.directive'; -import {scrollIntoView} from '../core/helper/scrollIntoView'; -import {SelectedItemService} from './services/selected-item.service'; - -@Component({ +import { FormControl } from '@angular/forms'; + +import { MakeProvider } from '../core/base/value-accessor-provider'; +import { ElementBase } from '../input/core/element-base'; +import { NG_ASYNC_VALIDATORS, NG_VALIDATORS, NgModel } from '@angular/forms'; +import { ConnectedOverlayPositionChange } from '@angular/cdk/overlay'; +import { ActiveDescendantKeyManager } from '@angular/cdk/a11y'; +import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; +import { I18nService } from '../i18n/i18n.service'; +import { AUTOCOMPLETE_CONFIG, AutoCompleteConfig } from './interfaces/autocomplete.config'; +import { DataSourceList } from '../core/classes/datasource-list'; +import { TlItemSelectedDirective } from '../core/directives/itemSelected/item-selected.directive'; +import { scrollIntoView } from '../core/helper/scrollIntoView'; +import { SelectedItemService } from './services/selected-item.service'; +import { Subscription } from 'rxjs'; + +import * as objectPath from 'object-path'; + +@Component( { selector: 'tl-autocomplete', templateUrl: './autocomplete.html', - styleUrls: ['./autocomplete.scss'], - providers: [MakeProvider(TlAutoComplete), SelectedItemService], -}) -export class TlAutoComplete extends ElementBase implements OnInit, OnChanges, AfterViewInit { + styleUrls: [ './autocomplete.scss' ], + providers: [ MakeProvider( TlAutoComplete ), SelectedItemService ], +} ) +export class TlAutoComplete extends ElementBase implements OnInit, OnChanges, OnDestroy, AfterViewInit { - @Input('data') - set data(value) { + @Input( 'data' ) + set data( value ) { this._data = value; } @@ -71,6 +74,10 @@ export class TlAutoComplete extends ElementBase implements OnInit, OnCha @Input() openFocus = true; + @Input() loading = true; + + @Input() disabled: boolean = null; + @Input() color = 'basic'; @Input() labelPlacement: 'top' | 'left' = 'left'; @@ -91,17 +98,17 @@ export class TlAutoComplete extends ElementBase implements OnInit, OnCha @Output() lazyLoad: EventEmitter = new EventEmitter(); - @Output() select: EventEmitter = new EventEmitter(); + @Output() selectItem: EventEmitter = new EventEmitter(); @Output() filter: EventEmitter = new EventEmitter(); - @ViewChild(NgModel) model: NgModel; + @ViewChild( NgModel ) model: NgModel; - @ViewChild('input') input: ElementRef; + @ViewChild( 'input' ) input: ElementRef; - @ViewChild(CdkVirtualScrollViewport) cdkVirtualScroll: CdkVirtualScrollViewport; + @ViewChild( CdkVirtualScrollViewport ) cdkVirtualScroll: CdkVirtualScrollViewport; - @ViewChildren(TlItemSelectedDirective) listItems: QueryList; + @ViewChildren( TlItemSelectedDirective ) listItems: QueryList; public keyManager: ActiveDescendantKeyManager; @@ -111,11 +118,15 @@ export class TlAutoComplete extends ElementBase implements OnInit, OnCha public focused = false; + public closeHover = false; + + public selected; + public positionOverlay: 'top' | 'bottom' | 'center'; public nothingFound = false; - public searchControl = new FormControl(''); + public searchControl = new FormControl( '' ); public messageLoading = this.i18n.getLocale().AutoComplete.messageLoading; @@ -127,185 +138,226 @@ export class TlAutoComplete extends ElementBase implements OnInit, OnCha private lastItemScrolled = 0; + private subscription: Subscription = new Subscription(); + private _data = []; - constructor(@Optional() @Inject(NG_VALIDATORS) validators: Array, - @Optional() @Inject(AUTOCOMPLETE_CONFIG) autoCompleteConfig: AutoCompleteConfig, - @Optional() @Inject(NG_ASYNC_VALIDATORS) asyncValidators: Array, - private change: ChangeDetectorRef, private i18n: I18nService, private itemSelectedService: SelectedItemService) { - super(validators, asyncValidators); - this.setOptions(autoCompleteConfig); + constructor( @Optional() @Inject( NG_VALIDATORS ) validators: Array, + @Optional() @Inject( AUTOCOMPLETE_CONFIG ) autoCompleteConfig: AutoCompleteConfig, + @Optional() @Inject( NG_ASYNC_VALIDATORS ) asyncValidators: Array, + private change: ChangeDetectorRef, private i18n: I18nService, private itemSelectedService: SelectedItemService ) { + super( validators, asyncValidators ); + this.setOptions( autoCompleteConfig ); } ngOnInit() { } ngAfterViewInit() { - this.keyManager = new ActiveDescendantKeyManager(this.listItems); - this.handleModel(); + this.keyManager = new ActiveDescendantKeyManager( this.listItems ); + this.listenModelChanges(); + this.handleModelLazy(); this.validateKeyValue(); this.change.detectChanges(); } private validateKeyValue() { - if (!this.isModelModeString() && !this.keyValue && !this.identifier) { - throw Error('The AutoComplete should have an [identifier] key property, ' + - ' because the property [keyValue] is null and the list is working on [modelMode] \'object\''); + if ( !this.isModelModeString() && !this.keyValue && !this.identifier ) { + throw Error( 'The AutoComplete should have an [identifier] key property, ' + + ' because the property [keyValue] is null and the list is working on [modelMode] \'object\'' ); } } - private handleModel() { - this.model.valueChanges.subscribe(() => { - if (this.dataSource) { + private listenModelChanges() { + this.model.valueChanges.subscribe( () => { + if ( this.dataSource ) { this.handleModelLazy(); this.handleModelCached(); } - }); + } ); } private handleItemSelected() { - if (this.itemSelectedService.itemSelected) { - this.scrollToIndex().then(value => { - setTimeout(() => { - this.keyManager.setActiveItem(this.itemSelectedService.itemSelected.indexSelected); - }, 200); - }); + if ( this.itemSelectedService.itemSelected ) { + this.scrollToIndex().then( value => { + setTimeout( () => { + this.keyManager.setActiveItem( this.itemSelectedService.itemSelected.indexSelected ); + }, 200 ); + } ); } } private scrollToIndex() { - return new Promise((resolve, reject) => { - setTimeout(() => { - this.cdkVirtualScroll.scrollToIndex(this.lastItemScrolled); + return new Promise( ( resolve, reject ) => { + setTimeout( () => { + this.cdkVirtualScroll.scrollToIndex( this.lastItemScrolled ); this.change.markForCheck(); resolve(); - }, 200); - }); + }, 200 ); + } ); } - onScrollIndexChange($event) { - if ($event > 0) { + onScrollIndexChange( $event ) { + if ( $event > 0 ) { this.lastItemScrolled = $event; } } onInput() { + this.setIsOpen( true ); + this.setFiltering( true ); + } + + onHoverClose() { + this.closeHover = true; + } + + onLeaveClose() { + this.closeHover = false; + } + + onClickClose() { + this.value = ''; + this.setDescriptionValue( '' ); + this.searchControl.setValue( '' ); + this.closeHover = false; + this.selected = null; + this.setInputFocus(); this.setIsOpen(true); - this.setFiltering(true); + } + + private setInputFocus() { + this.input.nativeElement.focus(); } onBackdropClick() { - this.setIsOpen(false); - this.setFiltering(false); + this.setIsOpen( false ); + this.setFiltering( false ); } private handleModelLazy() { - if (this.model.value && this.lazyMode && !this.modelInitialized) { - if (!this.isModelModeString()) { - this.setDescriptionValue(this.model.value[this.keyText]); + if ( this.value && this.lazyMode && !this.modelInitialized ) { + if ( !this.isModelModeString() ) { + this.setDescriptionValue( objectPath.get( this.value, this.keyText ) ); } else { - console.warn('The item provided is was not found, emitting filter'); - this.filter.emit(this.getFilters(this.model.value)); + console.warn( 'The item provided is was not found, emitting filter' ); + this.filter.emit( this.getFilters( this.value ) ); } - this.handleKeyModelValue(this.model.value); + this.handleKeyModelValue( this.value ); } } - private setDescriptionValue(value: string) { + private setDescriptionValue( value: string ) { this.input.nativeElement.value = value; } private handleModelCached() { - this.dataSource.getCachedData().forEach((value) => { - if (this.model.value) { - if (String(this.getItemCompare(value)) === String(this.getCompareModel())) { - this.setDescriptionValue(value[this.keyText]); - this.handleKeyModelValue(value); + if ( this.dataSource && !this.lazyMode && this.dataSource.getCachedData() ) { + this.dataSource.getCachedData().forEach( ( value ) => { + if ( this.value ) { + if ( String( this.getItemCompare( value ) ) === String( this.getCompareModel() ) ) { + this.setDescriptionValue( objectPath.get( value, this.keyText ) ); + this.handleKeyModelValue( value ); + } } - } - }); + } ); + } } - private getItemCompare(value) { - if (!this.keyValue || this.isModelModeString()) { - return value[this.identifier]; + private getItemCompare( value ) { + if ( !this.keyValue || this.isModelModeString() ) { + return objectPath.get( value, this.identifier ); } - return value[this.keyValue]; + return objectPath.get( value, this.keyValue ); } - private handleKeyModelValue(value) { + private handleKeyModelValue( value ) { this.modelInitialized = true; - if (!this.isModelModeString() && this.keyValue) { - this.value = value[this.keyValue]; + this.selected = value; + if ( !this.isModelModeString() && this.keyValue ) { + this.value = objectPath.get( value, this.keyValue ); return; } - if (this.isModelModeString() && !this.keyValue) { - this.value = value[this.identifier]; + if ( this.isModelModeString() && !this.keyValue ) { + this.value = objectPath.get( value, this.identifier ); return; } - if (this.isModelModeString() && this.keyValue) { - this.value = value[this.keyValue]; + if ( this.isModelModeString() && this.keyValue ) { + this.value = objectPath.get( value, this.keyValue ); return; } this.value = value; } - private setOptions(options: AutoCompleteConfig) { - if (options) { + private setOptions( options: AutoCompleteConfig ) { + if ( options ) { const self = this; - Object.keys(options).forEach(function (key) { - self[key] = options[key]; - }); + Object.keys( options ).forEach( function ( key ) { + self[ key ] = options[ key ]; + } ); } } - private setSelected(item: TlItemSelectedDirective) { - this.keyManager.setActiveItem(item); - this.itemSelectedService.itemSelected = item; + private setSelected( itemDirective: TlItemSelectedDirective ) { + this.selected = itemDirective.itemSelected; + this.keyManager.setActiveItem( itemDirective ); + this.itemSelectedService.itemSelected = itemDirective; } - stopEvent($event) { + stopEvent( $event ) { $event.preventDefault(); $event.stopPropagation(); } - handleKeyArrowDown($event) { - if (this.isOpen) { - this.stopEvent($event); + handleKeyArrowDown( $event ) { + this.handleEventOpenList( $event ); + if ( !this.keyManager.activeItem ) { + this.keyManager.setFirstItemActive(); + return; } - this.keyManager.onKeydown($event); - scrollIntoView(this.keyManager.activeItem.element.nativeElement); + this.keyManager.onKeydown( $event ); + scrollIntoView( this.keyManager.activeItem.element.nativeElement ); + } + handleKeyArrowUp( $event ) { + this.handleEventOpenList( $event ); + if ( !this.keyManager.activeItem ) { + this.keyManager.setFirstItemActive(); + return; + } + this.keyManager.onKeydown( $event ); + scrollIntoView( this.keyManager.activeItem.element.nativeElement ); } - handleKeyArrowUp($event) { - if (this.isOpen) { - this.stopEvent($event); + handleEventOpenList( $event ) { + if ( this.isOpen ) { + this.stopEvent( $event ); } - this.keyManager.onKeydown($event); - scrollIntoView(this.keyManager.activeItem.element.nativeElement); } - handleKeyEscape($event) { + handleKeyEscape( $event ) { $event.stopPropagation(); - this.setIsOpen(false); + this.setIsOpen( false ); } - handleBlur() { - if (this.keyManager.activeItem && this.isOpen) { - this.setSelected( this.keyManager.activeItem); - this.setDescriptionValue(this.keyManager.activeItem.itemSelected[this.keyText]); - this.handleKeyModelValue(this.keyManager.activeItem.itemSelected); + handleKeyEnter() { + if ( this.keyManager.activeItem && this.isOpen ) { + if ( this.keyManager.activeItem.itemSelected ) { + this.selectItem.emit( this.keyManager.activeItem.itemSelected ); + this.setSelected( this.keyManager.activeItem ); + this.setDescriptionValue( objectPath.get( this.keyManager.activeItem.itemSelected, this.keyText ) ); + this.handleKeyModelValue( this.keyManager.activeItem.itemSelected ); + } } - this.setIsOpen(false); + this.setIsOpen( false ); } handleFocus() { this.focused = true; - if (this.openFocus && !this.keyManager.activeItem) { - this.setIsOpen(true); + if ( this.openFocus && !this.keyManager.activeItem && !this.isDisabled && !this.disabled ) { + this.setIsOpen( true ); } } @@ -314,119 +366,135 @@ export class TlAutoComplete extends ElementBase implements OnInit, OnCha } private getCompareModel() { - if (this.keyValue && !this.isModelModeString()) { - return this.model.value[this.keyValue]; + if ( this.keyValue && !this.isModelModeString() ) { + return objectPath.get( this.value, this.keyValue ); } - if (!this.isModelModeString() && !this.keyValue) { - return this.model.value[this.identifier]; + if ( !this.isModelModeString() && !this.keyValue ) { + return objectPath.get( this.value, this.identifier ); } - return this.model.value; + return this.value; } - selectItem(value: any, item: TlItemSelectedDirective) { - this.setDescriptionValue(value[this.keyText]); - this.handleKeyModelValue(value); + onSelectItem( value: any, item: TlItemSelectedDirective ) { + this.setDescriptionValue( objectPath.get( value, this.keyText ) ); + this.handleKeyModelValue( value ); this.input.nativeElement.focus(); - this.select.emit(value); - this.setIsOpen(false); - this.setSelected(item); + this.setIsOpen( false ); + this.setSelected( item ); this.change.detectChanges(); + this.selectItem.emit( value ); } - private setUpData(value?) { - if (!this.dataSource) { - this.dataSource = new DataSourceList({ + private setUpData( value? ) { + if ( !this.dataSource ) { + this.dataSource = new DataSourceList( { dataSource: value, pageSize: this.rowsPage, totalLength: this.totalLength, lazyMode: this.lazyMode - }); - this.dataSource.addPage(0); + } ); + this.listenLoadData(); + } + this.loading = false; + this.dataSource.setData( value ); + this.setNotFound( value.length === 0 ); + this.setFirstItemActive(); + } + + private setFirstItemActive() { + if ( this.keyManager ) { + setTimeout( () => { + this.keyManager.setFirstItemActive(); + }, 100 ); } - this.listenLoadData(); - this.setNotFound(false); - this.dataSource.setData(value); } private listenLoadData() { - if (!this.dataSource) { + if ( !this.dataSource ) { return; } - this.dataSource.loadMoreData.subscribe((data: any) => { - this.lazyLoad.emit({skip: data.skip, limit: data.limit, ...this.getFilters(this.searchControl.value)}); - }); + this.subscription.add( this.dataSource.loadMoreData.subscribe( ( data: any ) => { + this.lazyLoad.emit( { skip: data.skip, limit: data.limit, ...this.getFilters( this.searchControl.value ) } ); + } ) ); } - onPositionChange($event: ConnectedOverlayPositionChange) { + onPositionChange( $event: ConnectedOverlayPositionChange ) { this.positionOverlay = $event.connectionPair.originY; this.change.detectChanges(); } - private setIsOpen(value: boolean) { + private setIsOpen( value: boolean ) { this.isOpen = value; } + getItemText( item ) { + return objectPath.get( item, this.keyText ); + } + toggleIsOpen() { - this.isOpen = !this.isOpen; - this.input.nativeElement.focus(); - this.handleItemSelected(); + if ( !this.disabled && !this.isDisabled ) { + this.isOpen = !this.isOpen; + this.input.nativeElement.focus(); + this.handleItemSelected(); + } } - private getFilters(term: string) { + private getFilters( term: string ) { const fields = {}; - fields[this.searchBy] = {matchMode: 'contains', value: term}; - return {fields: fields, operator: 'or'}; + fields[ this.searchBy ] = { matchMode: 'contains', value: term }; + return { fields: fields, operator: 'or' }; } private setScrollVirtual() { - this.cdkVirtualScroll.elementRef.nativeElement.scrollTop = 0; + if ( this.cdkVirtualScroll ) { + this.cdkVirtualScroll.elementRef.nativeElement.scrollTop = 0; + } } - onFilter($event) { + onFilter( $event ) { this.setScrollVirtual(); - this.setFiltering(true); - if (this.lazyMode) { - this.filter.emit(this.getFilters($event)); + this.setFiltering( true ); + this.dataSource.resetPages(); + if ( this.lazyMode ) { + this.filter.emit( this.getFilters( $event ) ); return; } - if ($event) { - this.setUpData($event); - this.dataSource.dataStream.next($event); - setTimeout(() => { - this.setSelected(this.listItems.toArray()[0]); - }, 100); + if ( $event ) { + this.dataSource.setArray( $event ); + this.setUpData( $event ); + setTimeout( () => { + this.keyManager.setActiveItem( 0 ); + }, 100 ); return; } - this.dataSource.dataStream.next([]); - this.setNotFound(true); + this.dataSource.setData( [] ); + this.setNotFound( true ); + this.selected = null; } - private setFiltering(value: boolean) { + private setFiltering( value: boolean ) { this.filtering = value; } - private setNotFound(value: boolean) { + private setNotFound( value: boolean ) { this.nothingFound = value; } - ngOnChanges({data, totalLength}: any) { - if (data && !data['firstChange'] && this.lazyMode) { - this.setUpData(data['currentValue']); - this.dataSource.dataStream.next(data['currentValue']); - return; - } - if (data && data['currentValue']) { - this.setUpData(data['currentValue']); + ngOnChanges( { data, totalLength }: any ) { + if ( totalLength && !totalLength[ 'firstChange' ] ) { + this.dataSource.setArray( totalLength[ 'currentValue' ] ); } - if (totalLength && !totalLength['firstChange']) { - this.dataSource.setArray(totalLength['currentValue']); + if ( data && !data[ 'firstChange' ] && this.lazyMode ) { + this.setUpData( data[ 'currentValue' ] ); + return; } - if (this.filtering) { - this.setUpData(data['currentValue']); - this.dataSource.addPage(0); - this.dataSource.dataStream.next(data['currentValue']); - this.listenLoadData(); + if ( data && data[ 'currentValue' ] && !this.lazyMode ) { + this.setUpData( data[ 'currentValue' ] ); } } + ngOnDestroy() { + this.subscription.unsubscribe(); + } + } diff --git a/projects/truly-ui/src/components/autocomplete/index.ts b/projects/truly-ui/src/components/autocomplete/index.ts index a06dc0fcd..c0dde95a2 100644 --- a/projects/truly-ui/src/components/autocomplete/index.ts +++ b/projects/truly-ui/src/components/autocomplete/index.ts @@ -34,12 +34,14 @@ import { AUTOCOMPLETE_CONFIG, AutoCompleteConfig } from './interfaces/autocomple import { FilterContainerModule } from '../core/components/filter/filter-container.module'; import { ItemSelectedModule } from '../core/directives/itemSelected/item-selected.module'; import { A11yModule } from '@angular/cdk/a11y'; +import { LoaderModule } from '../loader/index'; @NgModule( { imports: [ CommonModule, OverlayModule, ScrollingModule, + LoaderModule, InputModule, FormsModule, BlockUIModule, diff --git a/projects/truly-ui/src/components/avatar/avatar.html b/projects/truly-ui/src/components/avatar/avatar.html index 85719baaf..8ab04825c 100644 --- a/projects/truly-ui/src/components/avatar/avatar.html +++ b/projects/truly-ui/src/components/avatar/avatar.html @@ -9,7 +9,8 @@
+ [style.width]="size" + [style.height]="!isPercentage() ? size : null">
+
{{ config.icon }} diff --git a/projects/truly-ui/src/components/blockui/blockui.scss b/projects/truly-ui/src/components/blockui/blockui.scss index e1757a28f..3114b7c65 100644 --- a/projects/truly-ui/src/components/blockui/blockui.scss +++ b/projects/truly-ui/src/components/blockui/blockui.scss @@ -2,10 +2,8 @@ position: absolute; width: 100%; height: 100%; - top: 0; - left: 0; background: rgba(245, 245, 245, 0.8); - z-index: 1000; + z-index: 1; } #blockui { diff --git a/projects/truly-ui/src/components/blockui/blockui.ts b/projects/truly-ui/src/components/blockui/blockui.ts index 22faf00da..ed03523f0 100644 --- a/projects/truly-ui/src/components/blockui/blockui.ts +++ b/projects/truly-ui/src/components/blockui/blockui.ts @@ -63,7 +63,14 @@ export class TlBlockUI implements OnChanges { this.overlayElement = this.overlayElementInstance.instance.element; } + private getPaddingElementRef() { + return window.getComputedStyle(this.elementRef.nativeElement).padding; + } + private setConfigToElement() { + this.blockuiConfig.width = this.elementRef.nativeElement.offsetWidth - 2 + 'px'; + this.blockuiConfig.height = this.elementRef.nativeElement.offsetHeight + 'px'; + this.blockuiConfig.padding = this.getPaddingElementRef(); this.overlayElementInstance.instance.config = this.blockuiConfig; } diff --git a/projects/truly-ui/src/components/calendar/calendar-theme.scss b/projects/truly-ui/src/components/calendar/calendar-theme.scss index f42e25eea..76d881112 100644 --- a/projects/truly-ui/src/components/calendar/calendar-theme.scss +++ b/projects/truly-ui/src/components/calendar/calendar-theme.scss @@ -25,6 +25,15 @@ } } + .ui-cell-status { + &.primary { + background: map-deep-get($primary, "default", "background"); + } + &.danger { + background: map-deep-get($danger, "default", "background"); + } + } + & .ui-table-calendar { & .ui-table-thead { & .ui-table-th { diff --git a/projects/truly-ui/src/components/calendar/calendar.scss b/projects/truly-ui/src/components/calendar/calendar.scss index 3bd392773..6387d11df 100644 --- a/projects/truly-ui/src/components/calendar/calendar.scss +++ b/projects/truly-ui/src/components/calendar/calendar.scss @@ -70,6 +70,7 @@ } & .ui-table-line .ui-table-cell { + position: relative; font-family: "Segoe UI", Lato, 'sans-serif', "Arial"; font-size: 0.9em; text-align: center; @@ -96,6 +97,35 @@ } } +.ui-status-wrapper { + width: 20px; + margin: 0 auto; + position: relative; +} + +.ui-cell-status { + width: 18px; + height: 4px; + margin: 0 auto; + border-radius: 2px; + position: absolute; + bottom: 3px; + z-index: 1; + transition: width 500ms ease-in-out; +} + +.ui-status-backdrop { + height: 4px; + margin: 0 auto; + border-radius: 2px; + position: absolute; + bottom: 3px; + background: #fff; + width: 100%; + z-index: 0; + border: 1px solid #ccc; +} + @keyframes creating { 0% {opacity:0; transform: scale(0);} 25% {opacity:0.25; transform: scale(0.25);} diff --git a/projects/truly-ui/src/components/calendar/calendar.ts b/projects/truly-ui/src/components/calendar/calendar.ts index 3c3cba82e..e3cf41cd8 100644 --- a/projects/truly-ui/src/components/calendar/calendar.ts +++ b/projects/truly-ui/src/components/calendar/calendar.ts @@ -34,6 +34,13 @@ import { NavigatorService } from '../navigator/services/navigator.service'; import { CalendarService } from './services/calendar.service'; import { I18nService } from '../i18n/i18n.service'; +export interface CalendarStatus { + id?: string; + date: Date; + current: number; + total: number; +} + @Component( { selector: 'tl-calendar', templateUrl: './calendar.html', @@ -46,13 +53,15 @@ export class TlCalendar extends ComponentDefaultBase implements AfterViewInit, O @Input() inputControlFocus; + @Input() status: Array; + @Input() date = new Date(); - @Input() year = this.date.getFullYear(); + @Input() year = this.date ? this.date.getFullYear() : new Date().getFullYear(); - @Input() month = this.date.getMonth(); + @Input() month = this.date ? this.date.getMonth() : new Date().getMonth(); - @Input() day = this.date.getDate(); + @Input() day = this.date ? this.date.getDate() : new Date().getDate(); @Input() typingDay = false; @@ -707,15 +716,21 @@ export class TlCalendar extends ComponentDefaultBase implements AfterViewInit, O } setDateChange() { + this.date = new Date(this.date); this.day = this.date.getDate(); this.month = this.date.getMonth(); this.year = this.date.getFullYear(); } ngOnChanges( changes: SimpleChanges ) { + if (changes.status) { + if (!changes.status.firstChange) { + this.calendarService.changeStatus(); + } + } if (changes.date) { + this.setDateChange(); if ( !changes.date.firstChange ) { - this.setDateChange(); this.setDateNavigator(); this.generateDays(); } diff --git a/projects/truly-ui/src/components/calendar/parts/calendar-days.ts b/projects/truly-ui/src/components/calendar/parts/calendar-days.ts index afb325e28..ccb6a8589 100644 --- a/projects/truly-ui/src/components/calendar/parts/calendar-days.ts +++ b/projects/truly-ui/src/components/calendar/parts/calendar-days.ts @@ -22,7 +22,7 @@ import { NavigatorService } from '../../navigator/services/navigator.service'; import { Component, ElementRef } from '@angular/core'; -import { TlCalendar } from '../calendar'; +import { CalendarStatus, TlCalendar } from '../calendar'; @Component( { selector: 'tl-calendar-days', @@ -37,9 +37,14 @@ export class TlCalendarDays { private dayOfMonth = []; - constructor() {} + private statusElements = []; - setCalendar(calendar) { + private status; + + constructor() { + } + + setCalendar( calendar ) { this.calendar = calendar; this.initializeTable(); } @@ -98,6 +103,17 @@ export class TlCalendarDays { } } + changeStatus() { + for (let day = 0; day < this.dayOfMonth.length; day++ ) { + const date = new Date( this.calendar.year, this.calendar.month, day + 1 ); + this.calendar.status.forEach( ( value, index ) => { + if ( value.date.getTime() === date.getTime() ) { + this.setStatus(value, this.statusElements[index].nativeElement); + } + }); + } + } + appendDays() { for ( let day = 0; day < this.dayOfMonth.length; day++ ) { if ( this.dayOfMonth[ day ].dayOfWeek === 0 ) { @@ -105,38 +121,72 @@ export class TlCalendarDays { this.calendar.renderer.addClass( this.week.nativeElement, 'ui-table-line' ); this.calendar.renderer.appendChild( this.calendar.tbody.nativeElement, this.week.nativeElement ); } + const td = new ElementRef( this.calendar.renderer.createElement( 'td' ) ); this.calendar.renderer.addClass( td.nativeElement, 'ui-table-cell' ); td.nativeElement.innerHTML = this.dayOfMonth[ day ].day; + if ( this.calendar.status ) { + + const date = new Date( this.calendar.year, this.calendar.month, day + 1 ); + this.calendar.status.forEach( ( value ) => { + if ( value.date.getTime() === date.getTime() ) { + + const statusWrapper = new ElementRef( this.calendar.renderer.createElement( 'div' ) ); + this.calendar.renderer.addClass( statusWrapper.nativeElement, 'ui-status-wrapper' ); + + this.status = new ElementRef( this.calendar.renderer.createElement( 'div' ) ); + this.calendar.renderer.addClass( this.status.nativeElement, 'ui-cell-status' ); + + this.calendar.renderer.setAttribute( this.status.nativeElement, 'day', day.toString()); + this.statusElements.push(this.status); + + const statusBackdrop = new ElementRef( this.calendar.renderer.createElement( 'div' ) ); + this.calendar.renderer.addClass( statusBackdrop.nativeElement, 'ui-status-backdrop' ); + + this.calendar.renderer.appendChild( statusWrapper.nativeElement, this.status.nativeElement ); + this.calendar.renderer.appendChild( statusWrapper.nativeElement, statusBackdrop.nativeElement ); + this.calendar.renderer.appendChild( td.nativeElement, statusWrapper.nativeElement ); + + this.setStatus( value ); + } + + } ); + } + this.markToday( this.dayOfMonth[ day ].day, td ); this.selectDay( this.dayOfMonth[ day ].day, td ); this.createClickListenerDay( td ); - this.calendar.renderer.appendChild( this.week.nativeElement, td.nativeElement ); } } - selectDay(day, cell) { - if (day === this.calendar.day) { - this.calendar.renderer.addClass(cell.nativeElement, 'selected'); + setStatus( item: CalendarStatus, element? ) { + const percent = (100 * item.current) / item.total; + this.calendar.renderer.setStyle( element ? element : this.status.nativeElement, 'width', percent + '%' ); + this.calendar.renderer.addClass( element ? element : this.status.nativeElement, percent === 100 ? 'danger' : 'primary' ); + } + + selectDay( day, cell ) { + if ( day === this.calendar.day ) { + this.calendar.renderer.addClass( cell.nativeElement, 'selected' ); this.calendar.selectedDay = cell.nativeElement; } } - markToday(day, cell) { + markToday( day, cell ) { if ( (day === new Date().getDate()) && (this.calendar.month === new Date().getMonth() ) && (this.calendar.year === new Date().getFullYear()) ) { - this.calendar.renderer.addClass(cell.nativeElement, 'today'); + this.calendar.renderer.addClass( cell.nativeElement, 'today' ); this.calendar.todayIndex = cell; } } - createClickListenerDay(cell) { - this.calendar.renderer.listen(cell.nativeElement, 'click', $event => { + createClickListenerDay( cell ) { + this.calendar.renderer.listen( cell.nativeElement, 'click', $event => { this.setSelectedDay( cell.nativeElement, $event, $event.target ); - }); + } ); } setSelectedDay( cell, $event, target? ) { diff --git a/projects/truly-ui/src/components/calendar/services/calendar.service.ts b/projects/truly-ui/src/components/calendar/services/calendar.service.ts index 1e3ee310d..afc35078c 100644 --- a/projects/truly-ui/src/components/calendar/services/calendar.service.ts +++ b/projects/truly-ui/src/components/calendar/services/calendar.service.ts @@ -80,6 +80,10 @@ export class CalendarService { this.relocateTable(); } + changeStatus() { + (this.component.instance).changeStatus(); + } + createTableDays() { this.handleComponentCreated(); const componentFactory = this.compiler.resolveComponentFactory( TlCalendarDays ); diff --git a/projects/truly-ui/src/components/card/card-theme.scss b/projects/truly-ui/src/components/card/card-theme.scss new file mode 100644 index 000000000..74071be33 --- /dev/null +++ b/projects/truly-ui/src/components/card/card-theme.scss @@ -0,0 +1,61 @@ +@import "../core/styles/theming/theming"; + +@mixin _tl-card-theme-schema( $theme, $action ) { + + $basic: map-deep-get($theme, 'basic'); + + /deep/ tl-card-header { + .ui-card-header { + background: #fff; + border-bottom: 1px solid map-deep-get($basic, "default", "border"); + } + } + + /deep/ tl-card-body { + .ui-card-body { + background: #fff; + border-bottom: 1px solid map-deep-get($basic, "default", "border"); + border-right: 1px solid map-deep-get($basic, "default", "border"); + border-left: 1px solid map-deep-get($basic, "default", "border"); + } + } + + /deep/ tl-card-footer { + .ui-card-footer { + background: map-deep-get($basic, "default", "background"); + border: 1px solid map-deep-get($basic, "default", "border"); + color: map-deep-get($basic, "default", "foreground"); + border-top: 0; + } + } + +} + +@mixin tl-card-theme( $theme ) { + + .ui-wrapper-card { + &.basic { + @include _tl-card-theme-schema($theme, 'basic') + } + + &.primary { + @include _tl-card-theme-schema($theme, 'primary') + } + + &.success { + @include _tl-card-theme-schema($theme, 'success') + } + + &.danger { + @include _tl-card-theme-schema($theme, 'danger') + } + + &.warning { + @include _tl-card-theme-schema($theme, 'warning') + } + + &.information { + @include _tl-card-theme-schema($theme, 'information') + } + } +} diff --git a/projects/truly-ui/src/components/card/card.html b/projects/truly-ui/src/components/card/card.html new file mode 100644 index 000000000..0b1693ff7 --- /dev/null +++ b/projects/truly-ui/src/components/card/card.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/projects/truly-ui/src/components/card/card.scss b/projects/truly-ui/src/components/card/card.scss new file mode 100644 index 000000000..b78ae27d2 --- /dev/null +++ b/projects/truly-ui/src/components/card/card.scss @@ -0,0 +1,27 @@ +.ui-wrapper-card { + background: #fff; + width: 100%; + display: flex; + align-items: center; + place-content: flex-start; + flex-flow: column; + border-radius: 5px; + transition: border-color, box-shadow 300ms linear; + box-sizing: border-box; + + &:hover { + border-color: rgba(0,0,0,.09); + box-shadow: 0 2px 8px rgba(0,0,0,.09); + } + + @keyframes infinitePulse { + 0% { + transform: scale(1, 1); + } + 100% { + transform: scale(1.2, 1.2); + opacity: 0.3; + } + } + +} diff --git a/projects/truly-ui/src/components/card/card.ts b/projects/truly-ui/src/components/card/card.ts new file mode 100644 index 000000000..699176ff4 --- /dev/null +++ b/projects/truly-ui/src/components/card/card.ts @@ -0,0 +1,38 @@ +/* + MIT License + + Copyright (c) 2018 Temainfo Software + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +import { Component, OnInit, Input } from '@angular/core'; + +@Component({ + selector: 'tl-card', + templateUrl: './card.html', + styleUrls: ['./card.scss'], +}) +export class TlCard implements OnInit { + + @Input() color = 'basic'; + + constructor() {} + + ngOnInit() {} + +} diff --git a/projects/truly-ui/src/components/card/index.ts b/projects/truly-ui/src/components/card/index.ts new file mode 100644 index 000000000..9791e98d9 --- /dev/null +++ b/projects/truly-ui/src/components/card/index.ts @@ -0,0 +1,30 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { TlCard } from './card'; +import { IconsModule } from '../icons/index'; +import { TlCardBody } from './parts/card-body/card-body'; +import { TlCardHeader } from './parts/card-header/card-header'; +import { TlCardFooter } from './parts/card-footer/card-footer'; + +@NgModule({ + imports: [ + CommonModule, + IconsModule, + FormsModule + ], + declarations: [ + TlCard, + TlCardBody, + TlCardFooter, + TlCardHeader + ], + exports: [ + TlCard, + TlCardHeader, + TlCardFooter, + TlCardBody + ] +}) +export class CardModule {} diff --git a/projects/truly-ui/src/components/card/parts/card-body/card-body.html b/projects/truly-ui/src/components/card/parts/card-body/card-body.html new file mode 100644 index 000000000..db90fee48 --- /dev/null +++ b/projects/truly-ui/src/components/card/parts/card-body/card-body.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/projects/truly-ui/src/components/card/parts/card-body/card-body.scss b/projects/truly-ui/src/components/card/parts/card-body/card-body.scss new file mode 100644 index 000000000..a472b156d --- /dev/null +++ b/projects/truly-ui/src/components/card/parts/card-body/card-body.scss @@ -0,0 +1,12 @@ +:host { + width: 100%; + position: relative; +} + +.ui-card-body { + width: 100%; + height: 100%; + padding: 10px; + box-sizing: border-box; +} + diff --git a/projects/truly-ui/src/components/card/parts/card-body/card-body.ts b/projects/truly-ui/src/components/card/parts/card-body/card-body.ts new file mode 100644 index 000000000..6b7e36b55 --- /dev/null +++ b/projects/truly-ui/src/components/card/parts/card-body/card-body.ts @@ -0,0 +1,35 @@ + + + /* + MIT License + + Copyright (c) 2019 Temainfo Sistemas + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ + import { Component } from '@angular/core'; + + @Component({ + selector: 'tl-card-body', + templateUrl: './card-body.html', + styleUrls: ['./card-body.scss'], + }) + export class TlCardBody { + + constructor() {} + + } diff --git a/projects/truly-ui/src/components/card/parts/card-footer/card-footer.html b/projects/truly-ui/src/components/card/parts/card-footer/card-footer.html new file mode 100644 index 000000000..bf2ad2b4c --- /dev/null +++ b/projects/truly-ui/src/components/card/parts/card-footer/card-footer.html @@ -0,0 +1,3 @@ + diff --git a/projects/truly-ui/src/components/card/parts/card-footer/card-footer.scss b/projects/truly-ui/src/components/card/parts/card-footer/card-footer.scss new file mode 100644 index 000000000..6488b7412 --- /dev/null +++ b/projects/truly-ui/src/components/card/parts/card-footer/card-footer.scss @@ -0,0 +1,15 @@ +:host { + width: 100%; + position: relative; +} + +.ui-card-footer { + width: 100%; + height: 50px; + font-size: 1.5em; + border-top: 0; + box-sizing: border-box; + tl-icon { + padding: 0 20px; + } +} diff --git a/projects/truly-ui/src/components/card/parts/card-footer/card-footer.ts b/projects/truly-ui/src/components/card/parts/card-footer/card-footer.ts new file mode 100644 index 000000000..25b26bc84 --- /dev/null +++ b/projects/truly-ui/src/components/card/parts/card-footer/card-footer.ts @@ -0,0 +1,35 @@ + + + /* + MIT License + + Copyright (c) 2019 Temainfo Sistemas + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ + import { Component } from '@angular/core'; + + @Component({ + selector: 'tl-card-footer', + templateUrl: './card-footer.html', + styleUrls: ['./card-footer.scss'], + }) + export class TlCardFooter { + + constructor() {} + + } diff --git a/projects/truly-ui/src/components/card/parts/card-header/card-header.html b/projects/truly-ui/src/components/card/parts/card-header/card-header.html new file mode 100644 index 000000000..674f84328 --- /dev/null +++ b/projects/truly-ui/src/components/card/parts/card-header/card-header.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/projects/truly-ui/src/components/card/parts/card-header/card-header.scss b/projects/truly-ui/src/components/card/parts/card-header/card-header.scss new file mode 100644 index 000000000..6e5222c03 --- /dev/null +++ b/projects/truly-ui/src/components/card/parts/card-header/card-header.scss @@ -0,0 +1,13 @@ +:host { + width: 100%; + position: relative; +} + +.ui-card-header { + width: 100%; + position: relative; + min-height: 100px; + overflow: hidden; + box-sizing: border-box; +} + diff --git a/projects/truly-ui/src/components/card/parts/card-header/card-header.ts b/projects/truly-ui/src/components/card/parts/card-header/card-header.ts new file mode 100644 index 000000000..677f4118b --- /dev/null +++ b/projects/truly-ui/src/components/card/parts/card-header/card-header.ts @@ -0,0 +1,35 @@ + + + /* + MIT License + + Copyright (c) 2019 Temainfo Sistemas + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ + import { Component } from '@angular/core'; + + @Component({ + selector: 'tl-card-header', + templateUrl: './card-header.html', + styleUrls: ['./card-header.scss'], + }) + export class TlCardHeader { + + constructor() {} + + } diff --git a/projects/truly-ui/src/components/clockpicker/services/clockpicker.service.ts b/projects/truly-ui/src/components/clockpicker/services/clockpicker.service.ts index 70e27f7e4..7c06965d0 100644 --- a/projects/truly-ui/src/components/clockpicker/services/clockpicker.service.ts +++ b/projects/truly-ui/src/components/clockpicker/services/clockpicker.service.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/core/classes/datasource-list.ts b/projects/truly-ui/src/components/core/classes/datasource-list.ts index 284a346e4..e9e6c4d54 100644 --- a/projects/truly-ui/src/components/core/classes/datasource-list.ts +++ b/projects/truly-ui/src/components/core/classes/datasource-list.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -76,6 +76,11 @@ export class DataSourceList extends DataSource { this.arrayTotal = Array.from( { length: length || this.totalLength } ); } + public resetPages() { + this.fetchedPages = new Set(); + this.fetchedPages.add(0); + } + private setProprieties(config) { Object.keys(config).forEach((value) => { this[value] = config[value]; @@ -89,8 +94,8 @@ export class DataSourceList extends DataSource { public setData(data: Array) { this.cachedData = data; this.arrayTotal.splice(this.currentPage * this.pageSize, this.pageSize, - ...data); - this.dataStream.next(this.arrayTotal); + ...data); + this.dataStream.next( this.arrayTotal ); } private getPageForIndex( index: number ): number { diff --git a/projects/truly-ui/src/components/core/components/filter/filter-container.ts b/projects/truly-ui/src/components/core/components/filter/filter-container.ts index a443eee6d..cbdb110ae 100644 --- a/projects/truly-ui/src/components/core/components/filter/filter-container.ts +++ b/projects/truly-ui/src/components/core/components/filter/filter-container.ts @@ -26,6 +26,8 @@ import { import { Subject } from 'rxjs'; import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; +import * as objectPath from 'object-path'; + @Component( { selector: 'tl-filter-container', template: ` @@ -80,7 +82,7 @@ export class TlFilterContainer implements AfterContentInit, OnDestroy { } const filtered = []; this.source.forEach( ( value ) => { - if ( String( value[ this.searchBy ].toLowerCase() ).indexOf( String( searchTerm.toLowerCase().trim() ) ) > -1 ) { + if ( String( objectPath.get( value, this.searchBy ).toLowerCase() ).indexOf( String( searchTerm.toLowerCase().trim() ) ) > -1 ) { filtered.push( value ); } } ); diff --git a/projects/truly-ui/src/components/core/directives/itemSelected/item-selected.directive.ts b/projects/truly-ui/src/components/core/directives/itemSelected/item-selected.directive.ts index 2d3577d63..db6646a55 100644 --- a/projects/truly-ui/src/components/core/directives/itemSelected/item-selected.directive.ts +++ b/projects/truly-ui/src/components/core/directives/itemSelected/item-selected.directive.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/core/directives/overlay-animation.ts b/projects/truly-ui/src/components/core/directives/overlay-animation.ts index 05fb47e2d..5353e9864 100644 --- a/projects/truly-ui/src/components/core/directives/overlay-animation.ts +++ b/projects/truly-ui/src/components/core/directives/overlay-animation.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/core/enums/actions-modal.ts b/projects/truly-ui/src/components/core/enums/actions-modal.ts index 33980a1eb..e226253ca 100644 --- a/projects/truly-ui/src/components/core/enums/actions-modal.ts +++ b/projects/truly-ui/src/components/core/enums/actions-modal.ts @@ -3,7 +3,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/core/helper/check-element-on-list.ts b/projects/truly-ui/src/components/core/helper/check-element-on-list.ts index 10a385cc8..259cfc0b9 100644 --- a/projects/truly-ui/src/components/core/helper/check-element-on-list.ts +++ b/projects/truly-ui/src/components/core/helper/check-element-on-list.ts @@ -3,7 +3,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/core/helper/elvis.ts b/projects/truly-ui/src/components/core/helper/elvis.ts new file mode 100644 index 000000000..9226edb61 --- /dev/null +++ b/projects/truly-ui/src/components/core/helper/elvis.ts @@ -0,0 +1,8 @@ +/** + * Undefined-safe function to access the property given by path parameter + * @param object The object to read from + * @param path The path to the property + */ +export function elvis(object: any, path: string): any | undefined { + return path ? path.split('.').reduce((value, key) => value && value[key], object) : object; +} diff --git a/projects/truly-ui/src/components/core/interfaces/datasource-list.interface.ts b/projects/truly-ui/src/components/core/interfaces/datasource-list.interface.ts index b0aeda60f..c13d62255 100644 --- a/projects/truly-ui/src/components/core/interfaces/datasource-list.interface.ts +++ b/projects/truly-ui/src/components/core/interfaces/datasource-list.interface.ts @@ -3,7 +3,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/core/services/menu.service.ts b/projects/truly-ui/src/components/core/services/menu.service.ts index e5e95d996..2fc98030c 100644 --- a/projects/truly-ui/src/components/core/services/menu.service.ts +++ b/projects/truly-ui/src/components/core/services/menu.service.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/core/styles/theming/_components.scss b/projects/truly-ui/src/components/core/styles/theming/_components.scss index fcf068171..60433219c 100644 --- a/projects/truly-ui/src/components/core/styles/theming/_components.scss +++ b/projects/truly-ui/src/components/core/styles/theming/_components.scss @@ -6,6 +6,7 @@ @import "../../../button/button-theme"; @import "../../../buttongroup/buttongroup-theme"; @import "../../../dropdownicon/dropdownicon-theme"; +@import "../../../card/card-theme"; @import "../../../calendar/calendar-theme"; @import "../../../chatlist/chatlist-theme"; @import "../../../checkbox/checkbox-theme"; @@ -61,6 +62,7 @@ @include tl-button-group-theme($theme); @include tl-button-theme($theme); @include tl-dropdown-icon-theme($theme); + @include tl-card-theme($theme); @include tl-calendar-theme($theme); @include tl-chatlist-theme($theme); @include tl-checkbox-theme($theme); diff --git a/projects/truly-ui/src/components/core/styles/theming/_main.scss b/projects/truly-ui/src/components/core/styles/theming/_main.scss index bfcc92ebb..36c5d862a 100644 --- a/projects/truly-ui/src/components/core/styles/theming/_main.scss +++ b/projects/truly-ui/src/components/core/styles/theming/_main.scss @@ -8,6 +8,7 @@ @include tl-badge-theme($theme); @include tl-button-theme($theme); @include tl-calendar-theme($theme); + @include tl-card-theme($theme); @include tl-colorpicker-theme($theme); @include tl-colorpicker-content-theme($theme); @include tl-colorpicker-input-theme($theme); diff --git a/projects/truly-ui/src/components/core/tokens/configuration.token.ts b/projects/truly-ui/src/components/core/tokens/configuration.token.ts index 8dedea0da..562610f9f 100644 --- a/projects/truly-ui/src/components/core/tokens/configuration.token.ts +++ b/projects/truly-ui/src/components/core/tokens/configuration.token.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/datepicker/datepicker.html b/projects/truly-ui/src/components/datepicker/datepicker.html index 7f851ac53..315bd12b0 100644 --- a/projects/truly-ui/src/components/datepicker/datepicker.html +++ b/projects/truly-ui/src/components/datepicker/datepicker.html @@ -9,6 +9,8 @@ (keypress)="handleDateChange()" (clear)="onClearInput($event)" [iconAfter]="iconAfter" + date + [formatDate]="formatDate" [textAlign]="textAlign" [labelPlacement]="labelPlacement" [readonly]="readonly ? true : null" diff --git a/projects/truly-ui/src/components/datepicker/datepicker.ts b/projects/truly-ui/src/components/datepicker/datepicker.ts index adf9fd31f..fb5cd33f5 100644 --- a/projects/truly-ui/src/components/datepicker/datepicker.ts +++ b/projects/truly-ui/src/components/datepicker/datepicker.ts @@ -53,6 +53,8 @@ export class TlDatePicker extends ElementBase implements OnInit, AfterVi @Input() labelPlacement = 'left'; + @Input() formatDate = 'dd.mm.yyyy'; + @Input() readonly = false; @Input() disabled = false; @@ -73,7 +75,7 @@ export class TlDatePicker extends ElementBase implements OnInit, AfterVi @ViewChild( TlCalendar ) calendar; - @ViewChild( TlInput ) tlinput; + @ViewChild( TlInput ) tlInput: TlInput; @ViewChild( 'calendarContent' ) calendarContent; @@ -85,8 +87,6 @@ export class TlDatePicker extends ElementBase implements OnInit, AfterVi public iconAfter = ''; - public formatDate = ''; - public trigger; public year = new Date().getFullYear(); @@ -103,6 +103,7 @@ export class TlDatePicker extends ElementBase implements OnInit, AfterVi ngOnInit() { this.handleDateChange(); + this.setDateMask(); if ( this.iconCalendar ) { this.iconAfter = 'ion-calendar'; } @@ -112,6 +113,17 @@ export class TlDatePicker extends ElementBase implements OnInit, AfterVi this.validateDateDirective(); } + setDateMask() { + this.tlInput.mask = this.getMask(); + } + + getMask() { + const format = this.formatDate.toLowerCase(); + const dd = format.replace('dd', '00'); + const mm = dd.replace('mm', '00'); + return mm.replace('yyyy', '0000'); + } + validateDateDirective() { let hasDate = false; for ( const item of this.datePicker.nativeElement.attributes ) { @@ -145,7 +157,6 @@ export class TlDatePicker extends ElementBase implements OnInit, AfterVi this.setValue( $event ); this.setDateValues($event); this.handleAutoClose(); - this.tlinput.input.nativeElement.focus(); } setDateValues($event) { diff --git a/projects/truly-ui/src/components/datepicker/index.ts b/projects/truly-ui/src/components/datepicker/index.ts index 31f2317fa..c5a94463b 100644 --- a/projects/truly-ui/src/components/datepicker/index.ts +++ b/projects/truly-ui/src/components/datepicker/index.ts @@ -31,6 +31,7 @@ import { InputModule } from '../input/index'; import { TlDatePickerContent } from './datepicker-content/datepicker-content'; import { OverlayModule } from '@angular/cdk/overlay'; import { PortalModule } from '@angular/cdk/portal'; +import { DateModule } from '../date/index'; @NgModule( { imports: [ @@ -40,6 +41,7 @@ import { PortalModule } from '@angular/cdk/portal'; FormsModule, OverlayModule, PortalModule, + DateModule, InputModule ], declarations: [ diff --git a/projects/truly-ui/src/components/dropdownlist/dropdownlist-theme.scss b/projects/truly-ui/src/components/dropdownlist/dropdownlist-theme.scss index 0661b9b92..0b102df2e 100644 --- a/projects/truly-ui/src/components/dropdownlist/dropdownlist-theme.scss +++ b/projects/truly-ui/src/components/dropdownlist/dropdownlist-theme.scss @@ -8,11 +8,11 @@ .ui-dropdown-box { - > .ui-dropdown-icon.ng-invalid { + .ui-dropdown-icon.ng-invalid { color: rgba(map-deep-get($danger, "default", "background"), 0.5) !important; } - > .ui-dropdown-wrapper { + .ui-dropdown { background: map-deep-get($basic, "default", "background"); border: 1px solid map-deep-get($basic, "default", "border"); diff --git a/projects/truly-ui/src/components/dropdownlist/dropdownlist.html b/projects/truly-ui/src/components/dropdownlist/dropdownlist.html index 0e99da6e4..549d00c46 100644 --- a/projects/truly-ui/src/components/dropdownlist/dropdownlist.html +++ b/projects/truly-ui/src/components/dropdownlist/dropdownlist.html @@ -1,26 +1,34 @@ -
- spinner +
+ +
+ +
+ + +
+ class="ui-dropdown">
arrow-down
+
tl-icon { - position: absolute; - right: 30px; - opacity: 0.3; - } - - > .ui-dropdown-wrapper { - border-radius:3px; - width: 100%; - color: #666; - padding-left: 5px; - cursor: pointer; - font-size: $default-fontSize; - font-family: $default-fontFamily; - font-weight: normal; - user-select: none; - -webkit-user-select: none; - } - > .ui-dropdown-icon { - position: absolute; - top: 0; - right: 10px; - text-align: center; - font-size: $default-fontSize; - font-family: $default-fontFamily; - font-weight: normal; - transition: transform linear 200ms; - pointer-events: none; - i { - padding: 0; + >.ui-dropdown-wrapper { + position: relative; + >.ui-dropdown { + border-radius: 3px; + width: 100%; + color: #666; + padding-left: 5px; + cursor: pointer; + font-size: $default-fontSize; + font-family: $default-fontFamily; + font-weight: normal; + user-select: none; + -webkit-user-select: none; + } + >.ui-dropdown-icon { + position: absolute; + top: 0; + width: 20px; + right: 10px; + text-align: center; + font-size: $default-fontSize; + font-family: $default-fontFamily; + font-weight: normal; + transition: transform linear 200ms; + pointer-events: none; + i { + padding: 0; + } } } - > .ui-hidden-input { + + >.ui-hidden-input { position: absolute; left: 0; opacity: 0; width: 0; bottom: 0; } + + .ui-loading-icon { + position: absolute; + width: 18px; + height: 18px; + z-index: 1; + margin: 0; + right: 35px; + } + + tl-icon { + position: absolute; + right: 5px; + opacity: 0.5; + } + } diff --git a/projects/truly-ui/src/components/dropdownlist/dropdownlist.ts b/projects/truly-ui/src/components/dropdownlist/dropdownlist.ts index 9a25a82a4..1c785e699 100644 --- a/projects/truly-ui/src/components/dropdownlist/dropdownlist.ts +++ b/projects/truly-ui/src/components/dropdownlist/dropdownlist.ts @@ -23,14 +23,16 @@ import { AfterViewInit, Component, Input, - OnInit, + Output, Inject, Optional, ContentChild, ViewChild, - ElementRef, OnChanges + ElementRef, OnChanges, EventEmitter } from '@angular/core'; +import * as objectPath from 'object-path'; + import { debounceTime } from 'rxjs/internal/operators'; import { MakeProvider } from '../core/base/value-accessor-provider'; import { Subject } from 'rxjs'; @@ -51,21 +53,19 @@ import { TlListItem } from '../overlaylist/list-item/list-item'; [ MakeProvider( TlDropDownList ) ] ] } ) -export class TlDropDownList extends ElementBase implements OnInit, OnChanges, AfterViewInit { +export class TlDropDownList extends ElementBase implements OnChanges, AfterViewInit { @Input( 'data' ) data: any[] = []; - @Input( 'keyText' ) keyText = 'keyText'; + @Input( 'keyText' ) keyText = null; @Input( 'icon' ) icon = null; @Input( 'label' ) label: string; - @Input( 'showOnlyIcon' ) showOnlyIcon = false; - @Input( 'debounceTime' ) debounceTime = 200; - @Input( 'disabled' ) disabled = true; + @Input( 'disabled' ) disabled = false; @Input( 'labelPlacement' ) labelPlacement = 'left'; @@ -79,11 +79,11 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha @Input( 'identifier' ) identifier = null; - @Input( 'preSelected' ) preSelected = ''; - @Input( 'defaultOption' ) defaultOption = false; - @Input( 'width' ) width = '120px'; + @Input( 'groupBy' ) groupBy = null; + + @Input( 'width' ) width = '100%'; @Input( 'placeholder' ) placeholder = 'Select Item'; @@ -91,7 +91,7 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha @Input( 'searchOnList' ) searchOnList = false; - @Input( 'placeholderIcon' ) placeholderIcon = 'ion-navicon-round'; + @Output( 'selectItem' ) selectItem: EventEmitter = new EventEmitter(); @ContentChild( NgModel ) model: NgModel; @@ -113,8 +113,6 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha public isLoading = true; - private subject = new Subject(); - constructor( @Optional() @Inject( DROPDOWN_CONFIG ) dropdownConfig: DropdownConfig, @Optional() @Inject( NG_VALIDATORS ) validators: Array, @Optional() @Inject( NG_ASYNC_VALIDATORS ) asyncValidators: Array ) { @@ -122,12 +120,6 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha this.setOptions( dropdownConfig ); } - ngOnInit() { - this.subject.pipe( debounceTime( this.debounceTime ) ).subscribe( searchTextValue => { - this.onSearch( searchTextValue ); - } ); - } - ngAfterViewInit() { this.listenModelChange(); } @@ -136,17 +128,24 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha const filter = []; this.datasource = this.data.slice(); this.datasource.filter( ( item ) => { - if ( (item[ this.keyText ].substr( 0, searchTextValue.length ).toLowerCase()) === (searchTextValue.toLowerCase()) ) { + if ( (this.getItemText( item ).substr( 0, searchTextValue.length ).toLowerCase()) === (searchTextValue.toLowerCase()) ) { filter.push( item ); } } ); this.datasource = filter; } + getItemText( item ) { + if ( this.typeOfData === 'simple' ) { + return item; + } + return objectPath.get( item, this.keyText ); + } + onKeyDown( $event ) { this.handleSelectInLetter( $event.key ); const keyEvent = { - [KeyEvent.SPACE]: () => this.handleKeySpace( $event ), + [KeyEvent.SPACE]: () => this.handleOpenList( $event ), [KeyEvent.ARROWDOWN]: () => this.stopEvent( $event ), [KeyEvent.ARROWUP]: () => this.stopEvent( $event ), }; @@ -162,7 +161,8 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha onSelectOption( $event: ListItemInterface ) { this.isOpen = false; this.optionSelected = $event; - this.selectedDescription = this.isSimpleData() ? $event.option.item : $event.option.item[ this.keyText ]; + this.selectedDescription = this.isSimpleData() ? $event.option.item : objectPath.get( $event.option.item, this.keyText ); + this.selectItem.emit( $event.option.item ); this.handleKeyModelValue( $event.option.item ); this.setInputFocus(); } @@ -178,10 +178,11 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha return this.modelMode === 'string'; } - private handleKeySpace( $event ) { + public handleOpenList( $event ) { this.stopEvent( $event ); - if ( !this.isOpen ) { + if ( !this.isOpen && !this.disabled && !this.isLoading ) { this.isOpen = true; + this.setUpComponent(); } } @@ -193,8 +194,9 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha private setUpComponent() { this.datasource = this.data; - this.disabled = false; - this.isLoading = false; + if ( this.data.length > 0 ) { + this.isLoading = false; + } } private validateData() { @@ -217,7 +219,7 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha } private listenModelChange() { - if (this.getModel()) { + if ( this.getModel() ) { this.getModel().valueChanges.subscribe( () => { this.getModelValue(); } ); @@ -231,11 +233,11 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha if ( !this.keyValue ) { return this.value = itemValue; } - return this.value = itemValue[ this.keyValue ]; + return this.value = objectPath.get( itemValue, this.keyValue ); } private getModelValue() { - if (!this.getModel()) { + if ( !this.getModel() ) { return; } this.datasource.forEach( ( value, index ) => { @@ -264,12 +266,12 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha return this.getModel().value; } if ( !this.keyValue ) { - return this.getModel().value[ this.identifier ]; + return objectPath.get( this.getModel().value, this.identifier ); } if ( this.isModelModeString() ) { return this.getModel().value; } - return this.getModel().value[ this.keyValue ]; + return objectPath.get( this.getModel().value, this.keyValue ); } private getCompare( value ) { @@ -277,16 +279,16 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha return value; } if ( !this.keyValue ) { - return value[ this.identifier ]; + return objectPath.get( value, this.identifier ); } - return value[ this.keyValue ]; + return objectPath.get( value, this.keyValue ); } private getDescription( value ) { if ( this.isSimpleData() ) { return value; } - return value[ this.keyText ]; + return objectPath.get( value, this.keyText ); } private handleSelectInLetter( keyInput: string ) { @@ -319,7 +321,7 @@ export class TlDropDownList extends ElementBase implements OnInit, OnCha } private getFirstLetterOfItem( item ): string { - return String( item[ this.keyText ] ).substring( 0, 1 ).toLowerCase(); + return String( objectPath.get( item, this.keyText ) ).substring( 0, 1 ).toLowerCase(); } ngOnChanges( changes ) { diff --git a/projects/truly-ui/src/components/dropdownlist/index.ts b/projects/truly-ui/src/components/dropdownlist/index.ts index 024b2496d..b78a49e05 100644 --- a/projects/truly-ui/src/components/dropdownlist/index.ts +++ b/projects/truly-ui/src/components/dropdownlist/index.ts @@ -10,6 +10,7 @@ import { OverlayListModule } from '../overlaylist/index'; import { InternalsModule } from '../internals/index'; import { IconsModule } from '../icons/index'; import { DROPDOWN_CONFIG, DropdownConfig } from './interfaces/dropdown.config'; +import { LoaderModule } from '../loader/index'; @NgModule( { imports: [ @@ -17,6 +18,7 @@ import { DROPDOWN_CONFIG, DropdownConfig } from './interfaces/dropdown.config'; InputModule, OverlayListModule, IconsModule, + LoaderModule, OverlayModule, A11yModule, InternalsModule, diff --git a/projects/truly-ui/src/components/dropdownlist/interfaces/list-item.ts b/projects/truly-ui/src/components/dropdownlist/interfaces/list-item.ts index 6fcfd68f7..a0a6971ec 100644 --- a/projects/truly-ui/src/components/dropdownlist/interfaces/list-item.ts +++ b/projects/truly-ui/src/components/dropdownlist/interfaces/list-item.ts @@ -3,7 +3,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/editor/editor.html b/projects/truly-ui/src/components/editor/editor.html index e7f3a2f47..ffa362707 100644 --- a/projects/truly-ui/src/components/editor/editor.html +++ b/projects/truly-ui/src/components/editor/editor.html @@ -1,7 +1,7 @@
    - - -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
  • +
diff --git a/projects/truly-ui/src/components/editor/interfaces/toolbar-config.ts b/projects/truly-ui/src/components/editor/interfaces/toolbar-config.ts index e8864bb27..8c8a413fa 100644 --- a/projects/truly-ui/src/components/editor/interfaces/toolbar-config.ts +++ b/projects/truly-ui/src/components/editor/interfaces/toolbar-config.ts @@ -3,7 +3,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/editor/model/toolbar-config.model.ts b/projects/truly-ui/src/components/editor/model/toolbar-config.model.ts index 672095cbd..791ec69bc 100644 --- a/projects/truly-ui/src/components/editor/model/toolbar-config.model.ts +++ b/projects/truly-ui/src/components/editor/model/toolbar-config.model.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/form/form-submit.directive.ts b/projects/truly-ui/src/components/form/form-submit.directive.ts index 83f20435b..c5b44c34e 100644 --- a/projects/truly-ui/src/components/form/form-submit.directive.ts +++ b/projects/truly-ui/src/components/form/form-submit.directive.ts @@ -3,7 +3,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/form/form.html b/projects/truly-ui/src/components/form/form.html index 7e46e1a27..a21b54f2e 100644 --- a/projects/truly-ui/src/components/form/form.html +++ b/projects/truly-ui/src/components/form/form.html @@ -1,4 +1,9 @@
+
+
+ +
+
diff --git a/projects/truly-ui/src/components/form/form.scss b/projects/truly-ui/src/components/form/form.scss index f822437ca..2ab93014c 100644 --- a/projects/truly-ui/src/components/form/form.scss +++ b/projects/truly-ui/src/components/form/form.scss @@ -1,7 +1,25 @@ +.formBox { + position: relative; +} + .formContent { position: relative; } +.loading { + z-index: 1; + width: 100%; + height: 100%; + position: absolute; + display: flex; + align-items: center; + place-content: center; + .loader { + width: 50px; + height: 50px; + } +} + .forFooter { position: absolute; right: 0; diff --git a/projects/truly-ui/src/components/form/index.ts b/projects/truly-ui/src/components/form/index.ts index 0f121d8a4..5b7f4ce65 100644 --- a/projects/truly-ui/src/components/form/index.ts +++ b/projects/truly-ui/src/components/form/index.ts @@ -33,10 +33,13 @@ import { DropDownListModule } from '../dropdownlist/index'; import { ButtonModule } from '../button/index'; import { ModalModule } from '../modal/index'; import { ShortcutModule } from '../shortcut/index'; +import { BlockUIModule } from '../blockui/index'; +import { LoaderModule } from '../loader/index'; @NgModule( { imports: [ CommonModule, + LoaderModule, ButtonModule, FormsModule, ReactiveFormsModule, diff --git a/projects/truly-ui/src/components/i18n/i18n.service.ts b/projects/truly-ui/src/components/i18n/i18n.service.ts index ffc35799a..6f72378dc 100644 --- a/projects/truly-ui/src/components/i18n/i18n.service.ts +++ b/projects/truly-ui/src/components/i18n/i18n.service.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/index.ts b/projects/truly-ui/src/components/i18n/index.ts index 4380bcda4..47fd15d08 100644 --- a/projects/truly-ui/src/components/i18n/index.ts +++ b/projects/truly-ui/src/components/i18n/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/autocomplete/en_US.ts b/projects/truly-ui/src/components/i18n/languages/autocomplete/en_US.ts index 9ae057fd6..3ee00053b 100644 --- a/projects/truly-ui/src/components/i18n/languages/autocomplete/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/autocomplete/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/autocomplete/index.ts b/projects/truly-ui/src/components/i18n/languages/autocomplete/index.ts index 13eccda24..7f2e3c672 100644 --- a/projects/truly-ui/src/components/i18n/languages/autocomplete/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/autocomplete/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/autocomplete/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/autocomplete/pt_BR.ts index 73be23332..9d1c015f3 100644 --- a/projects/truly-ui/src/components/i18n/languages/autocomplete/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/autocomplete/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/button/en_US.ts b/projects/truly-ui/src/components/i18n/languages/button/en_US.ts index 3e0a6feca..31c025e7e 100644 --- a/projects/truly-ui/src/components/i18n/languages/button/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/button/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/button/index.ts b/projects/truly-ui/src/components/i18n/languages/button/index.ts index 27cec7a54..660282278 100644 --- a/projects/truly-ui/src/components/i18n/languages/button/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/button/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/button/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/button/pt_BR.ts index 016bdc3ac..fecd55e49 100644 --- a/projects/truly-ui/src/components/i18n/languages/button/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/button/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/calendar/en_US.ts b/projects/truly-ui/src/components/i18n/languages/calendar/en_US.ts index 8d4765792..d4c67792c 100644 --- a/projects/truly-ui/src/components/i18n/languages/calendar/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/calendar/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/calendar/index.ts b/projects/truly-ui/src/components/i18n/languages/calendar/index.ts index e69e6e109..00a49216d 100644 --- a/projects/truly-ui/src/components/i18n/languages/calendar/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/calendar/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/calendar/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/calendar/pt_BR.ts index e11137638..5c59afc9e 100644 --- a/projects/truly-ui/src/components/i18n/languages/calendar/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/calendar/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/datatable/en_US.ts b/projects/truly-ui/src/components/i18n/languages/datatable/en_US.ts index 16082e0f3..128de0aac 100644 --- a/projects/truly-ui/src/components/i18n/languages/datatable/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/datatable/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/datatable/index.ts b/projects/truly-ui/src/components/i18n/languages/datatable/index.ts index 0455f3a45..a535557d3 100644 --- a/projects/truly-ui/src/components/i18n/languages/datatable/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/datatable/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/datatable/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/datatable/pt_BR.ts index 19f15646c..c4f066a72 100644 --- a/projects/truly-ui/src/components/i18n/languages/datatable/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/datatable/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/dialog/en_US.ts b/projects/truly-ui/src/components/i18n/languages/dialog/en_US.ts index e759c95ae..a2eb65c33 100644 --- a/projects/truly-ui/src/components/i18n/languages/dialog/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/dialog/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/dialog/index.ts b/projects/truly-ui/src/components/i18n/languages/dialog/index.ts index 1002f6960..331a87706 100644 --- a/projects/truly-ui/src/components/i18n/languages/dialog/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/dialog/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/dialog/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/dialog/pt_BR.ts index 05f86dd56..f84772dd9 100644 --- a/projects/truly-ui/src/components/i18n/languages/dialog/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/dialog/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/editor/en_US.ts b/projects/truly-ui/src/components/i18n/languages/editor/en_US.ts index 1bd519e60..af48be2b0 100644 --- a/projects/truly-ui/src/components/i18n/languages/editor/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/editor/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/editor/index.ts b/projects/truly-ui/src/components/i18n/languages/editor/index.ts index e6b061815..09151f255 100644 --- a/projects/truly-ui/src/components/i18n/languages/editor/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/editor/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/editor/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/editor/pt_BR.ts index 383a68915..011a09400 100644 --- a/projects/truly-ui/src/components/i18n/languages/editor/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/editor/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/en_US.ts b/projects/truly-ui/src/components/i18n/languages/en_US.ts index b3c14e57b..73a12d2d3 100644 --- a/projects/truly-ui/src/components/i18n/languages/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/form/en_US.ts b/projects/truly-ui/src/components/i18n/languages/form/en_US.ts index b0a0fc6a5..fdb7fabc6 100644 --- a/projects/truly-ui/src/components/i18n/languages/form/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/form/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/form/index.ts b/projects/truly-ui/src/components/i18n/languages/form/index.ts index 37454f8af..1f271c6f1 100644 --- a/projects/truly-ui/src/components/i18n/languages/form/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/form/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/form/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/form/pt_BR.ts index 21511a5b6..48df9ae46 100644 --- a/projects/truly-ui/src/components/i18n/languages/form/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/form/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/listbox/en_US.ts b/projects/truly-ui/src/components/i18n/languages/listbox/en_US.ts index 2ba2952e3..781c2e1fb 100644 --- a/projects/truly-ui/src/components/i18n/languages/listbox/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/listbox/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/listbox/index.ts b/projects/truly-ui/src/components/i18n/languages/listbox/index.ts index a92d9b49f..afe857a00 100644 --- a/projects/truly-ui/src/components/i18n/languages/listbox/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/listbox/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/listbox/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/listbox/pt_BR.ts index 597b66673..a442680df 100644 --- a/projects/truly-ui/src/components/i18n/languages/listbox/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/listbox/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/navigator/en_US.ts b/projects/truly-ui/src/components/i18n/languages/navigator/en_US.ts index b133e78e8..77482c703 100644 --- a/projects/truly-ui/src/components/i18n/languages/navigator/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/navigator/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/navigator/index.ts b/projects/truly-ui/src/components/i18n/languages/navigator/index.ts index 3f1a93c05..f53a51f10 100644 --- a/projects/truly-ui/src/components/i18n/languages/navigator/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/navigator/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/navigator/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/navigator/pt_BR.ts index a54d9ca72..3e3d1d0f9 100644 --- a/projects/truly-ui/src/components/i18n/languages/navigator/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/navigator/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/overlaylist/en_US.ts b/projects/truly-ui/src/components/i18n/languages/overlaylist/en_US.ts index 44f4f0c24..d06911ee5 100644 --- a/projects/truly-ui/src/components/i18n/languages/overlaylist/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/overlaylist/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/overlaylist/index.ts b/projects/truly-ui/src/components/i18n/languages/overlaylist/index.ts index 7cc650487..1edc71d01 100644 --- a/projects/truly-ui/src/components/i18n/languages/overlaylist/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/overlaylist/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/overlaylist/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/overlaylist/pt_BR.ts index 84abce0c6..c64ab4d1b 100644 --- a/projects/truly-ui/src/components/i18n/languages/overlaylist/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/overlaylist/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/permissions/en_US.ts b/projects/truly-ui/src/components/i18n/languages/permissions/en_US.ts index 3fe47c007..5ab2d20aa 100644 --- a/projects/truly-ui/src/components/i18n/languages/permissions/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/permissions/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/permissions/index.ts b/projects/truly-ui/src/components/i18n/languages/permissions/index.ts index bfa0aee9e..77b1395eb 100644 --- a/projects/truly-ui/src/components/i18n/languages/permissions/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/permissions/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/permissions/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/permissions/pt_BR.ts index 876620627..a03aa4235 100644 --- a/projects/truly-ui/src/components/i18n/languages/permissions/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/permissions/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/pt_BR.ts index c0be61b30..c9afd73ac 100644 --- a/projects/truly-ui/src/components/i18n/languages/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/timepicker/en_US.ts b/projects/truly-ui/src/components/i18n/languages/timepicker/en_US.ts index c1aa100c0..0cc8af968 100644 --- a/projects/truly-ui/src/components/i18n/languages/timepicker/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/timepicker/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/timepicker/index.ts b/projects/truly-ui/src/components/i18n/languages/timepicker/index.ts index fa46b1249..9f1a98d44 100644 --- a/projects/truly-ui/src/components/i18n/languages/timepicker/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/timepicker/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/timepicker/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/timepicker/pt_BR.ts index 84b714165..b63b38041 100644 --- a/projects/truly-ui/src/components/i18n/languages/timepicker/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/timepicker/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/validators/en_US.ts b/projects/truly-ui/src/components/i18n/languages/validators/en_US.ts index 01a5fb779..8a0753819 100644 --- a/projects/truly-ui/src/components/i18n/languages/validators/en_US.ts +++ b/projects/truly-ui/src/components/i18n/languages/validators/en_US.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/validators/index.ts b/projects/truly-ui/src/components/i18n/languages/validators/index.ts index 2b8d61a34..001d10f07 100644 --- a/projects/truly-ui/src/components/i18n/languages/validators/index.ts +++ b/projects/truly-ui/src/components/i18n/languages/validators/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/i18n/languages/validators/pt_BR.ts b/projects/truly-ui/src/components/i18n/languages/validators/pt_BR.ts index dfb74cd99..a134dc9f9 100644 --- a/projects/truly-ui/src/components/i18n/languages/validators/pt_BR.ts +++ b/projects/truly-ui/src/components/i18n/languages/validators/pt_BR.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/internals/components/label/label.scss b/projects/truly-ui/src/components/internals/components/label/label.scss index 8c8be7c94..501368491 100644 --- a/projects/truly-ui/src/components/internals/components/label/label.scss +++ b/projects/truly-ui/src/components/internals/components/label/label.scss @@ -7,6 +7,7 @@ $default-fontSize: 1em; text-align: left; padding: 0 0 5px 0; box-sizing: border-box; + line-height: 1px; } :host(.label-left) { diff --git a/projects/truly-ui/src/components/internals/index.ts b/projects/truly-ui/src/components/internals/index.ts index 92b297127..bbf19a76d 100644 --- a/projects/truly-ui/src/components/internals/index.ts +++ b/projects/truly-ui/src/components/internals/index.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/internals/pipes/leftpad.pipe.ts b/projects/truly-ui/src/components/internals/pipes/leftpad.pipe.ts index 51d9e061f..a0f3c800c 100644 --- a/projects/truly-ui/src/components/internals/pipes/leftpad.pipe.ts +++ b/projects/truly-ui/src/components/internals/pipes/leftpad.pipe.ts @@ -3,7 +3,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/listbox/classes/list-base.ts b/projects/truly-ui/src/components/listbox/classes/list-base.ts index f7403741c..becbeca62 100644 --- a/projects/truly-ui/src/components/listbox/classes/list-base.ts +++ b/projects/truly-ui/src/components/listbox/classes/list-base.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/listbox/components/listbox-template.ts b/projects/truly-ui/src/components/listbox/components/listbox-template.ts index 9e7189555..e057f820b 100644 --- a/projects/truly-ui/src/components/listbox/components/listbox-template.ts +++ b/projects/truly-ui/src/components/listbox/components/listbox-template.ts @@ -3,7 +3,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/listbox/listbox.html b/projects/truly-ui/src/components/listbox/listbox.html index aff68813b..7a0e79529 100644 --- a/projects/truly-ui/src/components/listbox/listbox.html +++ b/projects/truly-ui/src/components/listbox/listbox.html @@ -8,7 +8,7 @@ [source]="data" [searchBy]="searchBy" (filter)="onFilter($event)"> -
= new EventEmitter(); + @Output() selectItem: EventEmitter = new EventEmitter(); + @ViewChild(CdkVirtualScrollViewport) cdkVirtualScroll: CdkVirtualScrollViewport; @ViewChildren(TlItemSelectedDirective) listItems: QueryList; @@ -124,7 +126,8 @@ export class TlListBox extends ListBase implements AfterViewInit, OnDestroy, OnC this.subscription.add(this.renderer.listen(this.getElementTarget(), 'keydown', ($event) => { const event = { [KeyEvent.ARROWDOWN]: () => this.handleKeyArrowDown($event), - [KeyEvent.ARROWUP]: () => this.handleKeyArrowUp($event) + [KeyEvent.ARROWUP]: () => this.handleKeyArrowUp($event), + [KeyEvent.ENTER]: () => this.onKeyEnter() }; if (event[$event.keyCode]) { event[$event.keyCode](); @@ -147,11 +150,22 @@ export class TlListBox extends ListBase implements AfterViewInit, OnDestroy, OnC this.scrollTop = this.cdkVirtualScroll.elementRef.nativeElement.scrollTop; } + select(index: number) { + this.listKeyManager.setActiveItem( index ); + if (this.listKeyManager.activeItem) { + this.selectItem.emit((this.listKeyManager.activeItem as TlItemSelectedDirective).itemSelected); + } + } + setSelected(item: TlItemSelectedDirective) { this.listKeyManager.setActiveItem(item); this.setInputFocus(); } + onKeyEnter() { + this.selectItem.emit((this.listKeyManager.activeItem as TlItemSelectedDirective).itemSelected); + } + onClickItem(item: any) { this.clickItem.emit(item); } @@ -173,7 +187,7 @@ export class TlListBox extends ListBase implements AfterViewInit, OnDestroy, OnC } private setUpData(value?) { - if (value.length > 0) { + if ( value && value.length > 0) { this.dataSource = new DataSourceList({ dataSource: value || this.data, pageSize: this.rowsPage, @@ -186,6 +200,9 @@ export class TlListBox extends ListBase implements AfterViewInit, OnDestroy, OnC } else { this.loading = false; this.nothingFound = true; + if (this.dataSource) { + this.dataSource.dataStream.next([]); + } } } diff --git a/projects/truly-ui/src/components/loader/index.ts b/projects/truly-ui/src/components/loader/index.ts new file mode 100644 index 000000000..47e2925fc --- /dev/null +++ b/projects/truly-ui/src/components/loader/index.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { TlLoader } from './loader'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule + ], + declarations: [ + TlLoader + ], + exports: [ + TlLoader + ] +}) +export class LoaderModule {} diff --git a/projects/truly-ui/src/components/loader/loader.html b/projects/truly-ui/src/components/loader/loader.html new file mode 100644 index 000000000..3adf1875b --- /dev/null +++ b/projects/truly-ui/src/components/loader/loader.html @@ -0,0 +1,10 @@ + + + + diff --git a/projects/truly-ui/src/components/loader/loader.scss b/projects/truly-ui/src/components/loader/loader.scss new file mode 100644 index 000000000..20191799f --- /dev/null +++ b/projects/truly-ui/src/components/loader/loader.scss @@ -0,0 +1,33 @@ +.spinner { + z-index: 2; + min-width: 100%; + min-height: 100%; + animation: rotate 2s linear infinite; + + & .path { + stroke-linecap: round; + animation: dash 1.5s ease-in-out infinite; + } + +} + +@keyframes rotate { + 100% { + transform: rotate(360deg); + } +} + +@keyframes dash { + 0% { + stroke-dasharray: 1, 150; + stroke-dashoffset: 0; + } + 50% { + stroke-dasharray: 90, 150; + stroke-dashoffset: -35; + } + 100% { + stroke-dasharray: 90, 150; + stroke-dashoffset: -124; + } +} diff --git a/projects/truly-ui/src/components/loader/loader.ts b/projects/truly-ui/src/components/loader/loader.ts new file mode 100644 index 000000000..02b0c0292 --- /dev/null +++ b/projects/truly-ui/src/components/loader/loader.ts @@ -0,0 +1,40 @@ +/* + MIT License + + Copyright (c) 2018 Temainfo Software + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +import { Component, OnInit, Input } from '@angular/core'; + +@Component({ + selector: 'tl-loader', + templateUrl: './loader.html', + styleUrls: ['./loader.scss'], +}) +export class TlLoader implements OnInit { + + @Input() color = '#ccc'; + + @Input() strokeWidth = 5; + + constructor() {} + + ngOnInit() {} + +} diff --git a/projects/truly-ui/src/components/menu/menu-theme.scss b/projects/truly-ui/src/components/menu/menu-theme.scss index a985247ed..386287eda 100644 --- a/projects/truly-ui/src/components/menu/menu-theme.scss +++ b/projects/truly-ui/src/components/menu/menu-theme.scss @@ -35,6 +35,11 @@ } + &.router-active { + background: map-deep-get($basic, "hover", "background"); + border-right: 3px solid map-deep-get($primary, "default", "background"); + } + } .ui-submenu { diff --git a/projects/truly-ui/src/components/menu/menu.scss b/projects/truly-ui/src/components/menu/menu.scss index 0faa34a68..b6641d6c3 100644 --- a/projects/truly-ui/src/components/menu/menu.scss +++ b/projects/truly-ui/src/components/menu/menu.scss @@ -39,6 +39,7 @@ &:hover > ::ng-deep tl-simple-sub-menu { visibility: visible; } + } } diff --git a/projects/truly-ui/src/components/menu/menu.ts b/projects/truly-ui/src/components/menu/menu.ts index 5679e5f43..db301f586 100644 --- a/projects/truly-ui/src/components/menu/menu.ts +++ b/projects/truly-ui/src/components/menu/menu.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -21,7 +21,7 @@ */ import { Input, Component, OnDestroy, - Renderer2, ViewChild, ElementRef, OnChanges, SimpleChanges, AfterContentInit, ViewContainerRef, ChangeDetectorRef, + Renderer2, ViewChild, ElementRef, OnChanges, SimpleChanges, AfterContentInit, ViewContainerRef, } from '@angular/core'; import { Router } from '@angular/router'; import { SubMenuService } from './services/submenu.service'; @@ -167,6 +167,9 @@ export class TlMenu implements AfterContentInit, OnChanges, OnDestroy { createElementList( item ) { this.listElement = new ElementRef( this.renderer.createElement( 'li' ) ); this.renderer.addClass( this.listElement.nativeElement, 'ui-menulist-item' ); + if (this.isRouterActive(item)) { + this.renderer.addClass( this.listElement.nativeElement, 'router-active'); + } this.listenClickElementList( item ); this.setStyleListElement(); } @@ -177,6 +180,10 @@ export class TlMenu implements AfterContentInit, OnChanges, OnDestroy { } ); } + isRouterActive(item) { + return this.router.url === item[this.link]; + } + listenClickElementList( item ) { this.renderer.listen( this.listElement.nativeElement, 'click', ( MouseEvent ) => { if ( item[ this.link ] ) { diff --git a/projects/truly-ui/src/components/menu/parts/advanced/advanced-root-menu.ts b/projects/truly-ui/src/components/menu/parts/advanced/advanced-root-menu.ts index 9c559f4df..9695fe5a9 100644 --- a/projects/truly-ui/src/components/menu/parts/advanced/advanced-root-menu.ts +++ b/projects/truly-ui/src/components/menu/parts/advanced/advanced-root-menu.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/menu/parts/advanced/parts/advanced-sub-menu.ts b/projects/truly-ui/src/components/menu/parts/advanced/parts/advanced-sub-menu.ts index 32ebc3dc3..cf4f526bd 100644 --- a/projects/truly-ui/src/components/menu/parts/advanced/parts/advanced-sub-menu.ts +++ b/projects/truly-ui/src/components/menu/parts/advanced/parts/advanced-sub-menu.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/menu/parts/simple/simple-sub-menu-theme.scss b/projects/truly-ui/src/components/menu/parts/simple/simple-sub-menu-theme.scss index 4ef3d8251..41c1c6511 100644 --- a/projects/truly-ui/src/components/menu/parts/simple/simple-sub-menu-theme.scss +++ b/projects/truly-ui/src/components/menu/parts/simple/simple-sub-menu-theme.scss @@ -2,6 +2,7 @@ @mixin tl-simple-sub-menu-theme( $theme ) { $basic: map-deep-get($theme, 'basic'); + $primary: map-deep-get($theme, 'primary'); .ui-simple-list-item { background: map-deep-get($basic, "default", "background"); @@ -14,6 +15,11 @@ color: map-deep-get($basic, "default", "foreground"); } + &.router-active { + background: map-deep-get($basic, "hover", "background"); + border-right: 3px solid map-deep-get($primary, "default", "background"); + } + &:hover { background: map-deep-get($basic, "hover", "background"); color: map-deep-get($basic, "hover", "foreground"); diff --git a/projects/truly-ui/src/components/menu/parts/simple/simple-sub-menu.html b/projects/truly-ui/src/components/menu/parts/simple/simple-sub-menu.html index 5775ee5b2..896996757 100644 --- a/projects/truly-ui/src/components/menu/parts/simple/simple-sub-menu.html +++ b/projects/truly-ui/src/components/menu/parts/simple/simple-sub-menu.html @@ -3,6 +3,7 @@ [style.width]="width" [style.top]="'-' + itemHeight" #subMenuList>
  • ::ng-deep tl-simple-sub-menu { visibility: visible; } diff --git a/projects/truly-ui/src/components/menu/parts/simple/simple-sub-menu.ts b/projects/truly-ui/src/components/menu/parts/simple/simple-sub-menu.ts index da102728b..374206fa8 100644 --- a/projects/truly-ui/src/components/menu/parts/simple/simple-sub-menu.ts +++ b/projects/truly-ui/src/components/menu/parts/simple/simple-sub-menu.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -74,6 +74,10 @@ export class TlSimpleSubMenu implements OnChanges, OnDestroy { } } + isRouterActive(item) { + return this.router.url === item[this.link]; + } + alreadyTaken(element) { const anchor = this.anchorElements.filter((value) => { return value.rootElement === element; diff --git a/projects/truly-ui/src/components/menu/services/submenu.service.ts b/projects/truly-ui/src/components/menu/services/submenu.service.ts index 1ddffead1..084e7ee48 100644 --- a/projects/truly-ui/src/components/menu/services/submenu.service.ts +++ b/projects/truly-ui/src/components/menu/services/submenu.service.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/misc/fixed-position.directive.ts b/projects/truly-ui/src/components/misc/fixed-position.directive.ts index 82c07253c..fda169d46 100644 --- a/projects/truly-ui/src/components/misc/fixed-position.directive.ts +++ b/projects/truly-ui/src/components/misc/fixed-position.directive.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/misc/listoption.directive.ts b/projects/truly-ui/src/components/misc/listoption.directive.ts index 017b7de1d..b46c5fa83 100644 --- a/projects/truly-ui/src/components/misc/listoption.directive.ts +++ b/projects/truly-ui/src/components/misc/listoption.directive.ts @@ -3,7 +3,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/misc/relative-window-position.directive.ts b/projects/truly-ui/src/components/misc/relative-window-position.directive.ts index ece6d25c6..7ac11e4b5 100644 --- a/projects/truly-ui/src/components/misc/relative-window-position.directive.ts +++ b/projects/truly-ui/src/components/misc/relative-window-position.directive.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/misc/scroll-manager.directive.ts b/projects/truly-ui/src/components/misc/scroll-manager.directive.ts index e5c5a011b..8fea44227 100644 --- a/projects/truly-ui/src/components/misc/scroll-manager.directive.ts +++ b/projects/truly-ui/src/components/misc/scroll-manager.directive.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/modal/directives/modal-result.directive.ts b/projects/truly-ui/src/components/modal/directives/modal-result.directive.ts index 7d747be4c..8e7a4f86e 100644 --- a/projects/truly-ui/src/components/modal/directives/modal-result.directive.ts +++ b/projects/truly-ui/src/components/modal/directives/modal-result.directive.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/modal/interfaces/modal-instance.ts b/projects/truly-ui/src/components/modal/interfaces/modal-instance.ts index a17fcf44b..83c4ed870 100644 --- a/projects/truly-ui/src/components/modal/interfaces/modal-instance.ts +++ b/projects/truly-ui/src/components/modal/interfaces/modal-instance.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/modal/interfaces/modal-smart-form-config.ts b/projects/truly-ui/src/components/modal/interfaces/modal-smart-form-config.ts index cbc1494f6..077886b91 100644 --- a/projects/truly-ui/src/components/modal/interfaces/modal-smart-form-config.ts +++ b/projects/truly-ui/src/components/modal/interfaces/modal-smart-form-config.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/modal/services/sidebar.service.ts b/projects/truly-ui/src/components/modal/services/sidebar.service.ts index 8a4d08d20..041cc6cc1 100644 --- a/projects/truly-ui/src/components/modal/services/sidebar.service.ts +++ b/projects/truly-ui/src/components/modal/services/sidebar.service.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/multiselect/enums/error-messages.ts b/projects/truly-ui/src/components/multiselect/enums/error-messages.ts index 072d02bed..151b46387 100644 --- a/projects/truly-ui/src/components/multiselect/enums/error-messages.ts +++ b/projects/truly-ui/src/components/multiselect/enums/error-messages.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/multiselect/multiselect.ts b/projects/truly-ui/src/components/multiselect/multiselect.ts index d965312fc..a6a7a430c 100644 --- a/projects/truly-ui/src/components/multiselect/multiselect.ts +++ b/projects/truly-ui/src/components/multiselect/multiselect.ts @@ -26,11 +26,11 @@ import { OnInit, Output, ViewChild, - ContentChild, AfterViewInit, ChangeDetectorRef, + ContentChild, AfterViewInit, ChangeDetectorRef, OnDestroy, } from '@angular/core'; import { KeyEvent } from '../core/enums/key-events'; import { MakeProvider } from '../core/base/value-accessor-provider'; -import { FormControlName, NG_ASYNC_VALIDATORS, NG_VALIDATORS, NgModel } from '@angular/forms'; +import { FormControl, FormControlName, NG_ASYNC_VALIDATORS, NG_VALIDATORS, NgModel } from '@angular/forms'; import { ValueAccessorBase } from '../input/core/value-accessor'; import { OverlayAnimation } from '../core/directives/overlay-animation'; import { Subject, Subscription } from 'rxjs'; @@ -48,7 +48,7 @@ import { scrollIntoView } from '../core/helper/scrollIntoView'; [ MakeProvider( TlMultiSelect ) ] ] } ) -export class TlMultiSelect extends ValueAccessorBase implements OnInit, AfterViewInit { +export class TlMultiSelect extends ValueAccessorBase implements OnInit, AfterViewInit, OnDestroy { @Input() keyColor: string; @@ -134,6 +134,8 @@ export class TlMultiSelect extends ValueAccessorBase implements OnInit, Aft private subscription: Subscription = new Subscription(); + private control; + constructor( private change: ChangeDetectorRef ) { super(); } @@ -149,9 +151,17 @@ export class TlMultiSelect extends ValueAccessorBase implements OnInit, Aft ngAfterViewInit() { this.validateHasModel(); + this.setControl(); this.setRequired(); this.setDisabled(); this.handleValidator(); + this.listenControlChanges(); + } + + private listenControlChanges() { + this.subscription.add(this.control.valueChanges.subscribe(() => { + this.validateHasModel(); + })); } private setDisabled() { @@ -185,6 +195,10 @@ export class TlMultiSelect extends ValueAccessorBase implements OnInit, Aft } } + private setControl() { + this.control = this.model ? this.model : this.controlName; + } + private validateHasModel() { setTimeout( () => { if ( this.value ) { @@ -556,5 +570,9 @@ export class TlMultiSelect extends ValueAccessorBase implements OnInit, Aft return this.filteredItems.length === this.dataSource.length; } + ngOnDestroy() { + this.subscription.unsubscribe(); + } + } diff --git a/projects/truly-ui/src/components/overlaylist/list-item/list-item.html b/projects/truly-ui/src/components/overlaylist/list-item/list-item.html index ace49f544..7eac55c3f 100644 --- a/projects/truly-ui/src/components/overlaylist/list-item/list-item.html +++ b/projects/truly-ui/src/components/overlaylist/list-item/list-item.html @@ -2,9 +2,10 @@
    - +
  • diff --git a/projects/truly-ui/src/components/overlaylist/list-item/list-item.scss b/projects/truly-ui/src/components/overlaylist/list-item/list-item.scss index f01652cab..a4ed4ff7f 100644 --- a/projects/truly-ui/src/components/overlaylist/list-item/list-item.scss +++ b/projects/truly-ui/src/components/overlaylist/list-item/list-item.scss @@ -1,5 +1,8 @@ .ui-list-item { padding: 0 5px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; &:focus { outline: none; } diff --git a/projects/truly-ui/src/components/overlaylist/list-item/list-item.ts b/projects/truly-ui/src/components/overlaylist/list-item/list-item.ts index 0ac7df513..d91dabbbf 100644 --- a/projects/truly-ui/src/components/overlaylist/list-item/list-item.ts +++ b/projects/truly-ui/src/components/overlaylist/list-item/list-item.ts @@ -19,26 +19,29 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { Component, Input, ElementRef, ViewChild, Output, EventEmitter } from '@angular/core'; +import { Component, Input, ElementRef, ViewChild, TemplateRef } from '@angular/core'; import { Highlightable } from '@angular/cdk/a11y'; @Component( { selector: 'tl-list-item', templateUrl: './list-item.html', styleUrls: [ './list-item.scss' ], + exportAs: 'listItem' } ) export class TlListItem implements Highlightable { - constructor() {} - - public selected = false; - @Input() item; @Input() disabled = false; + @Input() grouped = true; + @Input() height = '30px'; + @Input() template: TemplateRef; + + public selected = false; + @ViewChild('listElement') element: ElementRef; setActiveStyles(): void { diff --git a/projects/truly-ui/src/components/overlaylist/overlay-list.html b/projects/truly-ui/src/components/overlaylist/overlay-list.html index 5a56ae847..a283608f6 100644 --- a/projects/truly-ui/src/components/overlaylist/overlay-list.html +++ b/projects/truly-ui/src/components/overlaylist/overlay-list.html @@ -4,34 +4,53 @@
    diff --git a/projects/truly-ui/src/components/overlaylist/overlay-list.scss b/projects/truly-ui/src/components/overlaylist/overlay-list.scss index f84d0d945..04784ffbc 100644 --- a/projects/truly-ui/src/components/overlaylist/overlay-list.scss +++ b/projects/truly-ui/src/components/overlaylist/overlay-list.scss @@ -106,6 +106,14 @@ $default-outline: none; } } +.group-list { + .group-description { + font-weight: 600; + color: #ababab; + padding: 0 5px; + } +} + .default-option { padding: 0 5px; > i { diff --git a/projects/truly-ui/src/components/overlaylist/overlay-list.ts b/projects/truly-ui/src/components/overlaylist/overlay-list.ts index d243a6e25..9af7f1fbd 100644 --- a/projects/truly-ui/src/components/overlaylist/overlay-list.ts +++ b/projects/truly-ui/src/components/overlaylist/overlay-list.ts @@ -21,24 +21,33 @@ */ import { Component, EventEmitter, OnInit, Output, Input, ViewChild, ElementRef, ViewChildren, QueryList, - AfterViewInit, SimpleChanges, OnChanges, Renderer2, + AfterViewInit, SimpleChanges, OnChanges, Renderer2, OnDestroy, } from '@angular/core'; import { ActiveDescendantKeyManager, FocusKeyManager } from '@angular/cdk/a11y'; -import { KeyEvent } from '../core/enums/key-events'; import { TlListItem } from './list-item/list-item'; import { TlInput } from '../input/input'; import { I18nService } from '../i18n/i18n.service'; import { ListItemInterface } from '../dropdownlist/interfaces/list-item'; import { scrollIntoView } from '../core/helper/scrollIntoView'; +import * as path from 'object-path'; +import { Subscription } from 'rxjs'; @Component( { selector: 'tl-overlay-list', templateUrl: './overlay-list.html', styleUrls: [ './overlay-list.scss' ], } ) -export class TlOverlayList implements OnInit, AfterViewInit, OnChanges { +export class TlOverlayList implements OnInit, AfterViewInit, OnChanges, OnDestroy { - @Input( 'datasource' ) datasource = []; + @Input( 'datasource' ) + set dataSource(data) { + this._datasource = data; + this.getFilteredData(); + } + + get dataSource() { + return this._datasource; + } @Input( 'searchOnList' ) searchOnList = false; @@ -52,7 +61,9 @@ export class TlOverlayList implements OnInit, AfterViewInit, OnChanges { @Input( 'keyText' ) keyText = 'text'; - @Input() keyIcon = 'icon'; + @Input( 'groupBy' ) groupBy = null; + + @Input( 'keyIcon' ) keyIcon = 'icon'; @Input( 'icon' ) icon = null; @@ -90,11 +101,24 @@ export class TlOverlayList implements OnInit, AfterViewInit, OnChanges { public notFound = false; + public groups = []; + + public unGrouped = []; + + public objectPath = path; + + private _datasource = []; + + private numberItems = 0; + + private subscription = new Subscription(); + get emptyList() { return this.i18n.getLocale().OverlayList.emptyList; } - constructor( private renderer: Renderer2, private i18n: I18nService ) {} + constructor( private renderer: Renderer2, + private i18n: I18nService ) {} ngOnInit() { } @@ -105,22 +129,69 @@ export class TlOverlayList implements OnInit, AfterViewInit, OnChanges { this.keyManager.withWrap(); this.handleActiveItem(); this.handleModelOption(); + this.getFilteredData(); + } + + getFilteredData() { + this.groups = []; + this.unGrouped = []; + if (!this.groupBy) { + this.unGrouped = this.dataSource; + return; + } + this.dataSource.forEach( ( value ) => { + if (!this.objectPath.get(value, this.groupBy)) { + this.unGrouped = this.getItemsGroup(this.objectPath.get(value, this.groupBy)); + return; + } + if ( !this.existGroup( this.objectPath.get(value, this.groupBy) ) ) { + this.groups.push( { + description: this.objectPath.get(value, this.groupBy), + items: this.getItemsGroup( this.objectPath.get(value, this.groupBy) ) + } ); + } + } ); + } + + existGroup( group ) { + for ( const item of this.groups ) { + if ( item.description === group ) { + return true; + } + } + return false; + } + + getItemsGroup( group ) { + const filter = this.dataSource.filter( ( item ) => this.objectPath.get(item, this.groupBy) === group); + this.numberItems += filter.length; + return filter; } handleCustomInputEvents() { if (this.customInput) { this.handleInputFocus(); - this.renderer.listen( this.customInput, 'keydown', ($event) => { - if (this.isKeyCodeEnter($event) && this.hasDataOnDataSource()) { + + this.subscription.add(this.renderer.listen( this.customInput, 'keydown.enter', () => { + if (this.hasDataOnDataSource()) { this.emitSelectOption(); } - this.handleKeyEvents($event); - }); + })); + + this.subscription.add(this.renderer.listen( this.customInput, 'keydown.arrowdown', () => { + this.keyManager.setNextItemActive(); + this.handleScrollIntoView(); + })); + + this.subscription.add(this.renderer.listen( this.customInput, 'keydown.arrowup', () => { + this.keyManager.setPreviousItemActive(); + this.handleScrollIntoView(); + })); } } handleInputFocus() { - if (this.searchOnList) { + if (this.searchOnList && !this.customFocus) { setTimeout(() => { this.tlInput.setFocus(); }, 1); @@ -128,11 +199,7 @@ export class TlOverlayList implements OnInit, AfterViewInit, OnChanges { } hasDataOnDataSource() { - return this.datasource.length > 0; - } - - isKeyCodeEnter($event) { - return $event.keyCode === KeyEvent.ENTER; + return this.dataSource.length > 0; } handleActiveItem() { @@ -153,18 +220,12 @@ export class TlOverlayList implements OnInit, AfterViewInit, OnChanges { setActiveItem(index: number) { this.removeSelectedAll(); this.keyManager.setActiveItem(index); - this.handleScrollIntoView(); } removeSelectedAll() { this.items.forEach((item) => item.selected = false); } - handleKeyEvents( $event: KeyboardEvent ) { - this.keyManager.onKeydown( $event ); - this.handleScrollIntoView(); - } - handleScrollIntoView() { if (this.keyManager.activeItem) { scrollIntoView(this.keyManager.activeItem.element.nativeElement); @@ -187,9 +248,9 @@ export class TlOverlayList implements OnInit, AfterViewInit, OnChanges { this.findByLetter.emit($event.key); } - handleClickOption( index: number, $event ) { + handleClickOption( $event, item: TlListItem ) { this.stopEvent($event); - this.keyManager.setActiveItem( index ); + this.keyManager.setActiveItem( item ); this.emitSelectOption(); } @@ -211,10 +272,11 @@ export class TlOverlayList implements OnInit, AfterViewInit, OnChanges { keydownSearch( $event ) { this.search.emit( $event.target.value ); + this.unGrouped = []; } setNotFound() { - this.notFound = this.datasource.length === 0; + this.notFound = this.dataSource.length === 0; } ngOnChanges(changes: SimpleChanges ) { @@ -227,5 +289,10 @@ export class TlOverlayList implements OnInit, AfterViewInit, OnChanges { this.handleModelOption(); } } + + ngOnDestroy() { + this.subscription.unsubscribe(); + } + } diff --git a/projects/truly-ui/src/components/panelgroup/panelgroup.ts b/projects/truly-ui/src/components/panelgroup/panelgroup.ts index 338ae714e..7db43dc08 100644 --- a/projects/truly-ui/src/components/panelgroup/panelgroup.ts +++ b/projects/truly-ui/src/components/panelgroup/panelgroup.ts @@ -41,7 +41,7 @@ export class TlPanelGroup implements AfterViewInit { @Input() customTemplate: TemplateRef; - @Input() fontSizeCaption = '1em'; + @Input() fontSizeCaption = '12px'; @Input() showButtonAction = false; diff --git a/projects/truly-ui/src/components/permissions/parts/directives/permission-group.directive.ts b/projects/truly-ui/src/components/permissions/parts/directives/permission-group.directive.ts index 750bfab30..dc846ce0d 100644 --- a/projects/truly-ui/src/components/permissions/parts/directives/permission-group.directive.ts +++ b/projects/truly-ui/src/components/permissions/parts/directives/permission-group.directive.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/permissions/parts/interfaces/permission-dataconfig.interface.ts b/projects/truly-ui/src/components/permissions/parts/interfaces/permission-dataconfig.interface.ts index 068fdf8ca..023096191 100644 --- a/projects/truly-ui/src/components/permissions/parts/interfaces/permission-dataconfig.interface.ts +++ b/projects/truly-ui/src/components/permissions/parts/interfaces/permission-dataconfig.interface.ts @@ -3,7 +3,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/permissions/parts/models/permission.model.ts b/projects/truly-ui/src/components/permissions/parts/models/permission.model.ts index fa0c8cba9..6d9f12482 100644 --- a/projects/truly-ui/src/components/permissions/parts/models/permission.model.ts +++ b/projects/truly-ui/src/components/permissions/parts/models/permission.model.ts @@ -3,7 +3,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/popupmenu/parts/popupmenu-item.ts b/projects/truly-ui/src/components/popupmenu/parts/popupmenu-item.ts index 7e25f059b..e1ac6a2ec 100644 --- a/projects/truly-ui/src/components/popupmenu/parts/popupmenu-item.ts +++ b/projects/truly-ui/src/components/popupmenu/parts/popupmenu-item.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/popupmenu/popupmenu.ts b/projects/truly-ui/src/components/popupmenu/popupmenu.ts index 69db1caa5..8b9c9131e 100644 --- a/projects/truly-ui/src/components/popupmenu/popupmenu.ts +++ b/projects/truly-ui/src/components/popupmenu/popupmenu.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/progressbar/progressbar.html b/projects/truly-ui/src/components/progressbar/progressbar.html index 646d0a968..26e50554e 100644 --- a/projects/truly-ui/src/components/progressbar/progressbar.html +++ b/projects/truly-ui/src/components/progressbar/progressbar.html @@ -1,5 +1,5 @@
    -
    +
    {{getProgressDescription()}} % ({{position}} {{unit}} / {{max}} {{unit}}) diff --git a/projects/truly-ui/src/components/progressbar/progressbar.scss b/projects/truly-ui/src/components/progressbar/progressbar.scss index 133e8f17f..db7ece58f 100644 --- a/projects/truly-ui/src/components/progressbar/progressbar.scss +++ b/projects/truly-ui/src/components/progressbar/progressbar.scss @@ -5,6 +5,10 @@ box-sizing: border-box; } +.border-rounded { + border-radius: 10px; +} + .ui-progressbar { width: 100%; } diff --git a/projects/truly-ui/src/components/progressbar/progressbar.ts b/projects/truly-ui/src/components/progressbar/progressbar.ts index 9c8458603..00c17f027 100644 --- a/projects/truly-ui/src/components/progressbar/progressbar.ts +++ b/projects/truly-ui/src/components/progressbar/progressbar.ts @@ -40,6 +40,8 @@ export class TlProgressBar implements OnInit, OnChanges { @Input() height = '15px'; + @Input() shape: 'default' | 'rounded' = 'rounded'; + @Input() progressInfo: 'none' | 'percentage' | 'detailed' = 'percentage'; @Input() mode: 'determinate' | 'indeterminate' = 'determinate'; diff --git a/projects/truly-ui/src/components/schedule/i18n/schedule-i18n.ts b/projects/truly-ui/src/components/schedule/i18n/schedule-i18n.ts new file mode 100644 index 000000000..4cc505037 --- /dev/null +++ b/projects/truly-ui/src/components/schedule/i18n/schedule-i18n.ts @@ -0,0 +1,37 @@ +/* + * + * MIT License + * + * Copyright (c) 2019 Temainfo Sistemas + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * / + */ +export const ScheduleI18n = { + views: { + day: 'Day', + week: 'Week', + month: 'Month', + workWeek: 'Work Week', + dayList: 'Day List', + weekList: 'Week List', + }, + buttons: { + addEvent: 'Add Event' + }, + scaleNotFound: 'Scale Not Exists' +}; diff --git a/projects/truly-ui/src/components/schedule/index.ts b/projects/truly-ui/src/components/schedule/index.ts index 2ff0670ed..f709cc582 100644 --- a/projects/truly-ui/src/components/schedule/index.ts +++ b/projects/truly-ui/src/components/schedule/index.ts @@ -14,6 +14,8 @@ import { BlockUIModule } from '../blockui/index'; import { ButtonModule } from '../button/index'; import { ButtonGroupModule } from '../buttongroup/index'; import { GenerateEventsService } from './services/generate-events.service'; +import { WorkScaleService } from './services/work-scale.service'; +import { EventService } from './services/event.service'; @NgModule({ @@ -36,7 +38,9 @@ import { GenerateEventsService } from './services/generate-events.service'; TlSchedule, ], providers: [ - GenerateEventsService + GenerateEventsService, + WorkScaleService, + EventService ] }) export class ScheduleModule {} diff --git a/projects/truly-ui/src/components/schedule/parts/heading/heading.component.html b/projects/truly-ui/src/components/schedule/parts/heading/heading.component.html index df909178c..0ed341d07 100644 --- a/projects/truly-ui/src/components/schedule/parts/heading/heading.component.html +++ b/projects/truly-ui/src/components/schedule/parts/heading/heading.component.html @@ -4,7 +4,7 @@ @@ -22,6 +22,6 @@
    - +
    diff --git a/projects/truly-ui/src/components/schedule/parts/heading/heading.component.ts b/projects/truly-ui/src/components/schedule/parts/heading/heading.component.ts index 788c206c2..deaf861f9 100644 --- a/projects/truly-ui/src/components/schedule/parts/heading/heading.component.ts +++ b/projects/truly-ui/src/components/schedule/parts/heading/heading.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { ViewType } from '../../types/view.type'; +import { ScheduleI18n } from '../../i18n/schedule-i18n'; @Component({ selector: 'tl-schedule-heading', @@ -14,6 +15,8 @@ export class HeadingComponent implements OnInit { @Input() currentDate = new Date(); + @Input() texts = ScheduleI18n; + @Output() changeView = new EventEmitter(); @Output() changeDate = new EventEmitter(); diff --git a/projects/truly-ui/src/components/schedule/schedule.html b/projects/truly-ui/src/components/schedule/schedule.html index c01338c71..07247fac8 100644 --- a/projects/truly-ui/src/components/schedule/schedule.html +++ b/projects/truly-ui/src/components/schedule/schedule.html @@ -3,6 +3,7 @@
    -
    +
    - + + + + + + + + + +
    diff --git a/projects/truly-ui/src/components/schedule/schedule.scss b/projects/truly-ui/src/components/schedule/schedule.scss index 53a0f8ea5..e7fa11d22 100644 --- a/projects/truly-ui/src/components/schedule/schedule.scss +++ b/projects/truly-ui/src/components/schedule/schedule.scss @@ -14,6 +14,7 @@ .ui-schedule-body { border: 1px solid #D6D6D6; box-sizing: content-box; - overflow-x: auto; + overflow-x: hidden; + overflow-y: visible; position: relative; } diff --git a/projects/truly-ui/src/components/schedule/schedule.ts b/projects/truly-ui/src/components/schedule/schedule.ts index 19a82082b..d19cea6fa 100644 --- a/projects/truly-ui/src/components/schedule/schedule.ts +++ b/projects/truly-ui/src/components/schedule/schedule.ts @@ -25,6 +25,11 @@ import { import { ScheduleDataSource } from './types/datasource.type'; import { StatusType } from './types/status.type'; import { ViewType } from './types/view.type'; +import { SlotSettingsType } from './types/slot-settings.type'; +import { WorkScaleType } from './types/work-scale.type'; +import { WorkScaleService } from './services/work-scale.service'; +import { EventService } from './services/event.service'; +import { ScheduleI18n } from './i18n/schedule-i18n'; @Component( { selector: 'tl-schedule', @@ -44,36 +49,21 @@ export class TlSchedule implements OnInit, OnChanges { @Input() height = '550px'; - @Input() duration = 30; + @Input() slotSettings: SlotSettingsType = new SlotSettingsType( 2, 43); - @Input() showNowIndicator = false; - - @Input() slatHightRows = 43; + @Input() workScale: WorkScaleType | WorkScaleType[] = new WorkScaleType( '08:00', '18:00', 30 ); - @Input() slatNumberRows = 2; + @Input() showNowIndicator = false; - @Input('events') set events( events: ScheduleDataSource[] ) { - this._events = [...events].sort(( a, b ) => a.date.start - b.date.start ); - this._events = JSON.parse( JSON.stringify(this._events) ); - } - get events () { - return this._events; - } + @Input() texts = ScheduleI18n; - @Input('startDayHour') set startDayHour( hours: string ) { - this._startDayHour = hours; - this.startDayMilliseconds = this.transformHourToMileseconds( hours ); - } - get startDayHour () { - return this._startDayHour; - } - - @Input('endDayHour') set setEndDayHour( hours: string ) { - this._endDayHour = hours; - this.endDayMilliseconds = this.transformHourToMileseconds( hours ); - } - get endDayHour () { - return this._endDayHour; + @Input('events') set events( events: ScheduleDataSource[]) { + if ( !events) { + this._events = []; + } else { + this._events = [...events].sort(( a, b ) => a.date.start - b.date.start ); + this._events = JSON.parse( JSON.stringify(this._events) ); + } } @Output() changeView = new EventEmitter(); @@ -92,43 +82,29 @@ export class TlSchedule implements OnInit, OnChanges { @Output() newEventClick = new EventEmitter(); - public startDayMilliseconds: number; - - public endDayMilliseconds: number; - public slatNumberRowsAsArray: Array; - public eventsOfDay: ScheduleDataSource[]; + public existsScale = false; private _events: ScheduleDataSource[]; - private _startDayHour: string; - - private _endDayHour: string; + get events(): ScheduleDataSource[] { + return this._events; + } - constructor( private changeDetection: ChangeDetectorRef ) {} + constructor( + public workScaleService: WorkScaleService, + private changeDetection: ChangeDetectorRef, + private eventService: EventService + ) {} ngOnInit() { this.convertSlarNumberToArray(); - this.getEventsOfDay(); this.changeDetection.detectChanges(); } ngOnChanges( changes: SimpleChanges ) { - - if ( changes['events'] !== undefined ) { - if ( !changes[ 'events' ].firstChange ) { - this.refreshStartAndEndDay(); - this.getEventsOfDay(); - } - } - - if ( changes['currentDate'] !== undefined ) { - if ( ! changes['currentDate'].firstChange) { - this.refreshStartAndEndDay(); - this.getEventsOfDay(); - } - } + this.existsScale = this.workScaleService.exitsWorkScale( this.workScale ); this.changeDetection.detectChanges(); } @@ -139,39 +115,14 @@ export class TlSchedule implements OnInit, OnChanges { onChangeDate($event) { this.currentDate = new Date( $event.year, $event.month, $event.day); - this.refreshStartAndEndDay(); - this.getEventsOfDay(); + this.workScaleService.currentDate = new Date( $event.year, $event.month, $event.day); + this.eventService.getEventsOfDay(); this.changeDate.emit( $event ); this.changeDetection.detectChanges(); } - private transformHourToMileseconds( fullHour: string ) { - const hourSplited = fullHour.split(':'); - - const hours = Number(hourSplited[0]); - const minutes = Number(hourSplited[1]); - const year = this.currentDate.getFullYear(); - const month = this.currentDate.getMonth(); - const date = this.currentDate.getDate(); - - return new Date(year, month, date, hours, minutes).getTime(); - } - - private refreshStartAndEndDay() { - this.endDayMilliseconds = this.transformHourToMileseconds( this.endDayHour ); - this.startDayMilliseconds = this.transformHourToMileseconds( this.startDayHour ); - } - - - private getEventsOfDay() { - if ( this.events === undefined ) { return []; } - this.eventsOfDay = this.events.filter( ( event ) => { - return ( event.date.start >= this.startDayMilliseconds ) && ( event.date.end <= this.endDayMilliseconds ); - }); - } - private convertSlarNumberToArray() { - this.slatNumberRowsAsArray = Array( this.slatNumberRows ); + this.slatNumberRowsAsArray = Array( this.slotSettings.slotCount ); this.changeDetection.detectChanges(); } } diff --git a/projects/truly-ui/src/components/schedule/services/event.service.ts b/projects/truly-ui/src/components/schedule/services/event.service.ts new file mode 100644 index 000000000..f77f65524 --- /dev/null +++ b/projects/truly-ui/src/components/schedule/services/event.service.ts @@ -0,0 +1,28 @@ +import { EventEmitter, Injectable } from '@angular/core'; +import { WorkScaleService } from './work-scale.service'; +import { ScheduleDataSource } from '../types/datasource.type'; + +@Injectable() +export class EventService { + + public eventsOfDay: ScheduleDataSource[]; + + public events: ScheduleDataSource[]; + + public updateEvents = new EventEmitter(); + + constructor( private workScaleService: WorkScaleService ) { } + + loadEvents( events: ScheduleDataSource[] ) { + this.events = events; + this.updateEvents.emit( this.events ); + } + + getEventsOfDay() { + // if ( this.events === undefined ) { return []; } + // this.eventsOfDay = this.events.filter( ( event ) => { + // return ( event.date.start >= this.workScaleService.startDayMilliseconds ) + // && ( event.date.end <= this.workScaleService.endDayMilliseconds ); + // }); + } +} diff --git a/projects/truly-ui/src/components/schedule/services/generate-events.service.ts b/projects/truly-ui/src/components/schedule/services/generate-events.service.ts index 1cf36b3f8..c7123b887 100644 --- a/projects/truly-ui/src/components/schedule/services/generate-events.service.ts +++ b/projects/truly-ui/src/components/schedule/services/generate-events.service.ts @@ -1,5 +1,9 @@ -import { Injectable } from '@angular/core'; +import { Injectable, QueryList } from '@angular/core'; import { Cluster, Graph, Node } from '../types/graph'; +import { elvis } from '../../core/helper/elvis'; +import { ScheduleDataSource } from '../types/datasource.type'; + +const WIDTH_SCROLL = 17; @Injectable() export class GenerateEventsService { @@ -12,24 +16,76 @@ export class GenerateEventsService { private originalEvents = []; - private startDayMilliseconds = 0; + private workScaleInMileseconds = []; - private endDayMilliseconds = 0; + private scheduleSlats: QueryList; constructor() {} - with( events ) { - this.originalEvents = JSON.parse( JSON.stringify(events) ); - this.events = events; - this.transformDateToPixel(); - return this.generateEvents(); + with( events: ScheduleDataSource[] ) { + if ( this.scheduleSlats ) { + if ( events.length > 0 && this.scheduleSlats.length > 0 ) { + this.originalEvents = JSON.parse( JSON.stringify( events ) ); + events = JSON.parse( JSON.stringify( events ) ); + + this.events = events; + this.transformDateToPixel(); + return this.generateEvents(); + } + } + + } + + initializeArray( workScaleInMileseconds, scheduleSlats: QueryList ) { + if ( scheduleSlats && scheduleSlats) { + if ( scheduleSlats.length > 0 && workScaleInMileseconds.length > 0 ) { + this.workScaleInMileseconds = workScaleInMileseconds; + this.scheduleSlats = scheduleSlats; + + this.heightSchedule = this.scheduleSlats.first.nativeElement.offsetHeight + this.scheduleSlats.last.nativeElement.offsetHeight; + this.widthSchedule = this.scheduleSlats.first.nativeElement.offsetWidth - WIDTH_SCROLL; + } + } + } + + private transformDateToPixel() { + for ( let i = 0; i <= this.events.length - 1; i++) { + this.events[i].date = Object.assign({}, { + start: Math.round(this.convertMillisecondsToPixel( this.events[i].date.start )), + end: Math.round(this.convertMillisecondsToPixel( this.events[i].date.end )) + }); + } } - initialize( startDayMilliseconds, endDayMilliseconds, heightSchedule, widthSchedule ) { - this.startDayMilliseconds = startDayMilliseconds; - this.endDayMilliseconds = endDayMilliseconds; - this.heightSchedule = heightSchedule; - this.widthSchedule = widthSchedule; + private convertMillisecondsToPixel(date = new Date().getTime()) { + let heightBody; + let startDayMilliseconds; + let endDayMilliseconds; + let converted; + let currentDate; + let position = -1; + let offsetHeight = 0; + + this.workScaleInMileseconds.forEach(( item, index, array) => { + if ( date > this.workScaleInMileseconds[index].start ) { + position++; + const slotObject = this.scheduleSlats.find( (slot, idx) => idx === ( index - 1)); + offsetHeight = offsetHeight + elvis(slotObject, 'nativeElement.offsetHeight') || 0; + } + }); + + if ( position < 0 && offsetHeight <= 0) { + return -1000; + } + + startDayMilliseconds = Math.floor(this.workScaleInMileseconds[position].start / 100000 ); + endDayMilliseconds = Math.floor(this.workScaleInMileseconds[position].end / 100000 ); + heightBody = this.scheduleSlats.find( (item, idx) => idx === position).nativeElement.offsetHeight; + date = Math.floor(date / 100000 ); + currentDate = date - startDayMilliseconds; + converted = ( heightBody * currentDate ) / ( endDayMilliseconds - startDayMilliseconds); + + return converted > heightBody ? -1000 : ( converted + offsetHeight ); } private generateEvents() { @@ -37,22 +93,24 @@ export class GenerateEventsService { const histogram = this.createHistogram(); const graph = this.createTheGraph( histogram ); this.setClusterWidth( graph ); - this.setNodesPosition(graph); + this.setNodesPosition( graph ); for ( const nodeId in graph.nodes ) { if ( graph.nodes.hasOwnProperty(nodeId) ) { - const node = graph.nodes[nodeId]; - const event = { - positions: { - id: node.id, - top: node.start, - left: node.position * node.cluster.width, - height: node.end + 1 - node.start, - width: node.cluster.width - }, - data: this.originalEvents.filter(( e ) => parseInt(e.value, 10) === node.id )[0] - }; - eventsWithPositioning.push(event); + if ( graph.nodes[nodeId].cluster ) { + const node = graph.nodes[nodeId]; + const event = { + positions: { + id: node.id, + top: node.start, + left: node.position * node.cluster.width, + height: node.end - node.start, + width: node.cluster.width + }, + data: this.originalEvents.filter(( e ) => e.value === node.id )[0] + }; + eventsWithPositioning.push(event); + } } } return eventsWithPositioning; @@ -69,10 +127,11 @@ export class GenerateEventsService { // setting which events occurs at each minute this.events.forEach( (event) => { for ( let i = event.date.start; i <= event.date.end - 1; i++ ) { - minutes[i].push(parseInt((event.value), 10)); + if ( minutes[i] ) { + minutes[i].push(event.value); + } } }); - return minutes; } @@ -82,7 +141,7 @@ export class GenerateEventsService { // creating the nodes this.events.forEach( (event) => { - const node = new Node(parseInt(event.value, 10), event.date.start, event.date.end - 1); + const node = new Node(event.value, event.date.start, event.date.end); nodeMap[node.id] = node; }); @@ -94,11 +153,14 @@ export class GenerateEventsService { minutes.forEach( (minute, index, arrayMinutes ) => { if (minute.length > 0) { - if ( ( minute[0] !== arrayMinutes[index - 1][0] ) && ( minute.length !== arrayMinutes[index - 1].length ) && cluster) { - graph.clusters.push(cluster); - cluster = null; + if ( arrayMinutes[index - 1] ) { + if ( ( minute[0] !== arrayMinutes[index - 1][0] ) && ( minute.length !== arrayMinutes[index - 1].length ) && cluster) { + graph.clusters.push(cluster); + cluster = null; + } } + cluster = cluster || new Cluster(); minute.forEach( ( eventId ) => { if (!cluster.nodes[eventId]) { @@ -136,7 +198,6 @@ export class GenerateEventsService { }); graph.nodes = nodeMap; - return graph; } @@ -182,21 +243,5 @@ export class GenerateEventsService { }); } - private transformDateToPixel() { - for ( let i = 0; i <= this.events.length - 1; i++) { - this.events[i].date = Object.assign({}, { - start: Math.round(this.convertMillisecondsToPixel( this.events[i].date.start )), - end: Math.round(this.convertMillisecondsToPixel( this.events[i].date.end )) - }); - } - } - - convertMillisecondsToPixel(date = new Date().getTime()) { - const heightBody = this.heightSchedule; - const currentDate = date - this.startDayMilliseconds; - const converted = ( heightBody * currentDate ) / ( this.endDayMilliseconds - this.startDayMilliseconds); - - return converted > heightBody ? -1000 : converted; - } } diff --git a/projects/truly-ui/src/components/schedule/services/work-scale.service.ts b/projects/truly-ui/src/components/schedule/services/work-scale.service.ts new file mode 100644 index 000000000..69caef854 --- /dev/null +++ b/projects/truly-ui/src/components/schedule/services/work-scale.service.ts @@ -0,0 +1,101 @@ +import { EventEmitter, Injectable } from '@angular/core'; +import { WorkScaleType } from '../types/work-scale.type'; + +@Injectable() +export class WorkScaleService { + + public workScale: WorkScaleType[]; + + public currentDate = new Date(); + + public timesCollection: Array>; + + public workScaleInMileseconds = []; + + public updateScale = new EventEmitter(); + + constructor( ) {} + + reload( workScale: WorkScaleType | WorkScaleType[] ) { + this.setWorkScale( workScale ); + this.createWorkScaleMileseconds(); + this.generateTimes(); + } + + exitsWorkScale ( workScale ) { + return workScale && ( + ( workScale as WorkScaleType ).hasOwnProperty('interval') || + ( workScale as Array ).length > 0 + ); + } + + private setWorkScale( workScale: WorkScaleType | WorkScaleType[] ) { + + if ( !this.exitsWorkScale( workScale ) ) { + return this.workScale = []; + } + + if ( ( workScale as WorkScaleType ).hasOwnProperty('interval') ) { + return this.workScale = new Array(1).fill( workScale as WorkScaleType); + } + + if ( ( workScale as Array ).length > 0 ) { + this.workScale = workScale as WorkScaleType[]; + } + + } + + private createWorkScaleMileseconds() { + + this.workScaleInMileseconds = []; + + if ( (this.workScale as Array).length > 0 ) { + (this.workScale as Array).forEach(( value: WorkScaleType, index, array) => { + if ( array.length > 0 ) { + this.workScaleInMileseconds.push({ + start: this.transformHourToMileseconds( value.start ), + end: this.transformHourToMileseconds( value.end ), + interval: value.interval + }); + } + }); + } + + } + + + private transformHourToMileseconds( fullHour: string ) { + const hourSplited = fullHour.split(':'); + + const hours = Number(hourSplited[0]); + const minutes = Number(hourSplited[1]); + const year = this.currentDate.getFullYear(); + const month = this.currentDate.getMonth(); + const date = this.currentDate.getDate(); + + return new Date(year, month, date, hours, minutes).getTime(); + } + + + private generateTimes() { + const MIN_TO_MILLESECOND = 60000; + this.timesCollection = new Array>( (this.workScaleInMileseconds as Array).length ).fill([]); + + if ( (this.workScaleInMileseconds as Array).length > 0 ) { + (this.workScaleInMileseconds as Array).forEach(( value , index, array) => { + let currentHour_ms = value.start; + let nextHourBreak_ms = value.start; + + while ( currentHour_ms < value.end ) { + if ( currentHour_ms === nextHourBreak_ms ) { + this.timesCollection[index] = [...this.timesCollection[index], new Date(nextHourBreak_ms) ] ; + nextHourBreak_ms = nextHourBreak_ms + (value.interval * MIN_TO_MILLESECOND); + } + currentHour_ms++; + } + }); + } + + this.updateScale.emit( this.timesCollection ); + } +} diff --git a/projects/truly-ui/src/components/schedule/types/block-dates.type.ts b/projects/truly-ui/src/components/schedule/types/block-dates.type.ts new file mode 100644 index 000000000..fa695ceaf --- /dev/null +++ b/projects/truly-ui/src/components/schedule/types/block-dates.type.ts @@ -0,0 +1,26 @@ +/* + MIT License + + Copyright (c) 2019 Temainfo Sistemas + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +export class BlockDatesType { + start: string; + end: string; +} diff --git a/projects/truly-ui/src/components/schedule/types/datasource.type.ts b/projects/truly-ui/src/components/schedule/types/datasource.type.ts index 407702ab4..9eb5dfd29 100644 --- a/projects/truly-ui/src/components/schedule/types/datasource.type.ts +++ b/projects/truly-ui/src/components/schedule/types/datasource.type.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/schedule/types/graph.ts b/projects/truly-ui/src/components/schedule/types/graph.ts index 5ade79e9f..058f545fb 100644 --- a/projects/truly-ui/src/components/schedule/types/graph.ts +++ b/projects/truly-ui/src/components/schedule/types/graph.ts @@ -10,7 +10,7 @@ export class Cluster { } export class Node { - id = 0; + id = ''; start = 0; end = 0; neighbours = {}; diff --git a/projects/truly-ui/src/components/schedule/types/slot-settings.type.ts b/projects/truly-ui/src/components/schedule/types/slot-settings.type.ts new file mode 100644 index 000000000..98bf04265 --- /dev/null +++ b/projects/truly-ui/src/components/schedule/types/slot-settings.type.ts @@ -0,0 +1,28 @@ +/* + MIT License + + Copyright (c) 2019 Temainfo Sistemas + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +export class SlotSettingsType { + constructor( + public slotCount: number, + public slotHight: number + ) {} +} diff --git a/projects/truly-ui/src/components/schedule/types/status.type.ts b/projects/truly-ui/src/components/schedule/types/status.type.ts index 9163b0c77..06ea1962d 100644 --- a/projects/truly-ui/src/components/schedule/types/status.type.ts +++ b/projects/truly-ui/src/components/schedule/types/status.type.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/schedule/types/view.type.ts b/projects/truly-ui/src/components/schedule/types/view.type.ts index 0247e44d3..ac4621b6d 100644 --- a/projects/truly-ui/src/components/schedule/types/view.type.ts +++ b/projects/truly-ui/src/components/schedule/types/view.type.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/schedule/types/work-scale.type.ts b/projects/truly-ui/src/components/schedule/types/work-scale.type.ts new file mode 100644 index 000000000..448f3ab0c --- /dev/null +++ b/projects/truly-ui/src/components/schedule/types/work-scale.type.ts @@ -0,0 +1,29 @@ +/* + MIT License + + Copyright (c) 2019 Temainfo Sistemas + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +export class WorkScaleType { + constructor( + public start: string, + public end: string, + public interval: number + ) {} +} diff --git a/projects/truly-ui/src/components/schedule/views/day-list/day-list.component.html b/projects/truly-ui/src/components/schedule/views/day-list/day-list.component.html index f0b3e20d9..c7a117f1f 100644 --- a/projects/truly-ui/src/components/schedule/views/day-list/day-list.component.html +++ b/projects/truly-ui/src/components/schedule/views/day-list/day-list.component.html @@ -1,13 +1,13 @@
    +
    -
    +
    {{time | date: 'HH'}}:{{time | date: 'mm'}}
    -
    -
    +
    + (dblclick)="rowDbClick( time, index, timesIndex )">
    @@ -26,29 +27,29 @@
    -
    {{event.data.title}}
    -
    {{event.data.detail}}
    +
    {{event?.data?.title}}
    +
    {{event?.data?.detail}}
    -
    {{event.data.date.start | date: 'HH:mm'}} - {{event.data.date.end | date: 'HH:mm'}}
    +
    {{event?.data?.date?.start | date: 'HH:mm'}} - {{event?.data?.date?.end | date: 'HH:mm'}}
    -
    -
    + + + +
    diff --git a/projects/truly-ui/src/components/schedule/views/day/view-day.component.scss b/projects/truly-ui/src/components/schedule/views/day/view-day.component.scss index abbac491c..c53a57f5b 100644 --- a/projects/truly-ui/src/components/schedule/views/day/view-day.component.scss +++ b/projects/truly-ui/src/components/schedule/views/day/view-day.component.scss @@ -22,6 +22,7 @@ & .ui-hour-detail{ font-weight: bold; font-size: 20px; + line-height: 1.5; } } @@ -93,7 +94,7 @@ border-right: 1px #D6D6D6 solid; border-bottom: 1px #D6D6D6 solid; user-select: none; - margin: 2px 2px 2px 0px; + //margin: 2px 2px 2px 0px; cursor: pointer; font-family: "Segoe UI", Lato, 'sans-serif', "Arial"; diff --git a/projects/truly-ui/src/components/schedule/views/day/view-day.component.ts b/projects/truly-ui/src/components/schedule/views/day/view-day.component.ts index ce81fd790..1d16c3454 100644 --- a/projects/truly-ui/src/components/schedule/views/day/view-day.component.ts +++ b/projects/truly-ui/src/components/schedule/views/day/view-day.component.ts @@ -1,39 +1,42 @@ import { Component, OnInit, OnChanges, AfterViewInit, ChangeDetectorRef, Input, ViewChild, ElementRef, SimpleChanges, - ChangeDetectionStrategy, Output, EventEmitter + ChangeDetectionStrategy, Output, EventEmitter, ViewChildren, QueryList, OnDestroy } from '@angular/core'; import { ScheduleDataSource } from '../../types/datasource.type'; import { GenerateEventsService } from '../../services/generate-events.service'; +import { SlotSettingsType } from '../../types/slot-settings.type'; +import { WorkScaleType } from '../../types/work-scale.type'; +import { EventService } from '../../services/event.service'; +import { WorkScaleService } from '../../services/work-scale.service'; +import { Subscription } from 'rxjs'; +import { ScheduleI18n } from '../../i18n/schedule-i18n'; @Component({ selector: 'tl-view-day', templateUrl: './view-day.component.html', styleUrls: ['./view-day.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class ViewDayComponent implements OnInit, AfterViewInit, OnChanges { + changeDetection: ChangeDetectionStrategy.OnPush, - @Input() duration = 30; +}) +export class ViewDayComponent implements OnInit, AfterViewInit, OnChanges, OnDestroy { @Input() currentDate = new Date(); - @Input() events: ScheduleDataSource[]; - @Input() statusConfig: {StatusType}; - @Input() startDayMilliseconds: number; - - @Input() endDayMilliseconds: number; - @Input() showNowIndicator = false; - @Input() slatHightRows = 43; + @Input() slotSettings: SlotSettingsType; - @Input() slatNumberRows = 2; + @Input() workScale: WorkScaleType | WorkScaleType[]; @Input() slatNumberRowsAsArray: Array; - @ViewChild('scheduleSlats') scheduleSlats: ElementRef; + @Input() texts = ScheduleI18n; + + @Input('events') events: ScheduleDataSource[]; + + @ViewChildren('scheduleSlats') scheduleSlats: QueryList; @Output() onRowDbClick = new EventEmitter(); @@ -47,84 +50,82 @@ export class ViewDayComponent implements OnInit, AfterViewInit, OnChanges { public nowIndicatorPositionTop: number; - public timesCollection: Array = []; + public timesCollection: Array>; public currentTime = new Date(); public eventsWithPositions = []; - constructor( private changeDetectionRef: ChangeDetectorRef, private generateEvents: GenerateEventsService ) { } + private subscriptions = new Subscription(); - ngOnInit() { - this.generateTimes(); - } + constructor( + private changeDetectionRef: ChangeDetectorRef, + private generateEvents: GenerateEventsService, + private eventService: EventService, + private workScaleService: WorkScaleService) { - ngAfterViewInit() { - this.generateEvents.initialize( - this.startDayMilliseconds, - this.endDayMilliseconds, - this.scheduleSlats.nativeElement.offsetHeight, - this.scheduleSlats.nativeElement.offsetWidth - ); - this.generateEventsPositions(); - this.inicializeNowIndicator(); - this.changeDetectionRef.detectChanges(); - } + this.subscriptions.add(this.workScaleService.updateScale.subscribe(( timesCollection) => { + this.timesCollection = timesCollection; + this.changeDetectionRef.detectChanges(); + })); - ngOnChanges( changes: SimpleChanges ) { - if ( changes['events'] !== undefined ) { - if ( !changes[ 'events' ].firstChange ) { - this.generateEvents.initialize( - this.startDayMilliseconds, - this.endDayMilliseconds, - this.scheduleSlats.nativeElement.offsetHeight, - this.scheduleSlats.nativeElement.offsetWidth - ); - this.generateEventsPositions(); - this.inicializeNowIndicator(); - this.changeDetectionRef.detectChanges(); - } - } - this.changeDetectionRef.detectChanges(); + this.subscriptions.add(this.eventService.updateEvents.subscribe(( event ) => { + this.generateEventsPositions( event ); + this.inicializeNowIndicator( ); + this.changeDetectionRef.detectChanges(); + })); } - rowDbClick( time, index) { - const minutesToStart = index > 0 ? ( this.duration / this.slatNumberRows ) * ( index ) : 0; - const minutesToEnd = ( this.duration / this.slatNumberRows ) * ( index + 1 ); + ngOnInit() {} - this.onRowDbClick.emit({ - start: new Date(time).setMinutes( minutesToStart ), - end: new Date(time).setMinutes( minutesToEnd ) - }); - } + ngAfterViewInit() {} - private generateTimes() { - const MIN_TO_MILLESECOND = 60000; + ngOnChanges( changes: SimpleChanges ) { - let currentHour_ms = this.startDayMilliseconds; - let nextHourBreak_ms = this.startDayMilliseconds; - this.timesCollection = []; + if ( changes['currentDate'] !== undefined ) { + this.workScaleService.currentDate = changes[ 'currentDate' ].currentValue; + this.eventService.getEventsOfDay(); + } - while ( currentHour_ms < this.endDayMilliseconds ) { - if ( currentHour_ms === nextHourBreak_ms ) { - this.timesCollection.push( new Date(nextHourBreak_ms) ); - nextHourBreak_ms = nextHourBreak_ms + (this.duration * MIN_TO_MILLESECOND); - } - currentHour_ms++; + if ( changes['workScale'] !== undefined ) { + this.workScaleService.reload( changes[ 'workScale' ].currentValue ); } + + + if ( changes['events'] !== undefined ) { + this.eventService.loadEvents( changes[ 'events' ].currentValue ); + this.eventService.getEventsOfDay(); + } + this.changeDetectionRef.detectChanges(); } + rowDbClick( time, index, periodIndex) { + const workScaleInterval = this.workScaleService.workScale[periodIndex].interval; + const minutesToStart = index > 0 ? ( workScaleInterval / this.slotSettings.slotCount ) * ( index ) : 0; + const minutesToEnd = ( workScaleInterval / this.slotSettings.slotCount ) * ( index + 1 ); + + this.onRowDbClick.emit({ + start: new Date(time).setMinutes( new Date(time).getMinutes( ) + minutesToStart ), + end: new Date(time).setMinutes( new Date(time).getMinutes( ) + minutesToEnd ), + }); + } + private inicializeNowIndicator() { - this.nowIndicatorPositionTop = this.showNowIndicator ? this.generateEvents.convertMillisecondsToPixel() : -1000; + // this.nowIndicatorPositionTop = this.showNowIndicator ? this.generateEvents.convertMillisecondsToPixel() : -1000; this.changeDetectionRef.detectChanges(); } - private generateEventsPositions() { - if ( this.events !== undefined && this.events.length > 0 ) { - this.eventsWithPositions = this.generateEvents.with( this.events ); + private generateEventsPositions( events ) { + if ( events !== undefined ) { + this.generateEvents.initializeArray( this.workScaleService.workScaleInMileseconds, this.scheduleSlats ); + this.eventsWithPositions = this.generateEvents.with( events ); } } + ngOnDestroy() { + this.subscriptions.unsubscribe(); + } + } diff --git a/projects/truly-ui/src/components/textarea/textarea.scss b/projects/truly-ui/src/components/textarea/textarea.scss index b8abe0645..68c75f03f 100644 --- a/projects/truly-ui/src/components/textarea/textarea.scss +++ b/projects/truly-ui/src/components/textarea/textarea.scss @@ -10,6 +10,7 @@ .tl-textarea { width: 100%; + height: 100%; position: relative; display: table; border-collapse: separate; diff --git a/projects/truly-ui/src/components/time-available-picker/time-available-picker-theme.scss b/projects/truly-ui/src/components/time-available-picker/time-available-picker-theme.scss index ac4895e2b..581e977ae 100644 --- a/projects/truly-ui/src/components/time-available-picker/time-available-picker-theme.scss +++ b/projects/truly-ui/src/components/time-available-picker/time-available-picker-theme.scss @@ -23,7 +23,7 @@ > .ui-time-content { > .ui-time-item { color: map-deep-get($theme, $action, "default", "foreground"); - span { + .ui-range-wrapper { &:hover { border: 1px solid map-deep-get($primary, "lighter", "background") !important; } diff --git a/projects/truly-ui/src/components/time-available-picker/time-available-picker.html b/projects/truly-ui/src/components/time-available-picker/time-available-picker.html index 89fa5ad66..3e0bcdb8e 100644 --- a/projects/truly-ui/src/components/time-available-picker/time-available-picker.html +++ b/projects/truly-ui/src/components/time-available-picker/time-available-picker.html @@ -1,26 +1,29 @@ -
    +
    {{ dateValue | date:'dd' }} {{ dateValue | date:'EEEE' }}
    - {{ selectedTime[0]?.date | date: 'HH:mm' }} - {{ selectedTime[1]?.date | date: 'HH:mm' }} - {{ selectedTime[0]?.date | date: 'HH:mm' }} + {{ selectedTime[0]?.range.start | date: 'HH:mm' }} - {{ selectedTime[1]?.range.end | date: 'HH:mm' }} + {{ selectedTime[0]?.range.start | date: 'HH:mm' }} - {{ selectedTime[0]?.range.end | date: 'HH:mm' }}
    sad Nothing Found !
    -
    +
    - - {{ item.date | date: 'HH:mm' }} - + {{ item.range.start | date: 'HH:mm' }} - + {{ item.range.end | date: 'HH:mm' }} +
    diff --git a/projects/truly-ui/src/components/time-available-picker/time-available-picker.scss b/projects/truly-ui/src/components/time-available-picker/time-available-picker.scss index 8f7424e25..8eef44f3c 100644 --- a/projects/truly-ui/src/components/time-available-picker/time-available-picker.scss +++ b/projects/truly-ui/src/components/time-available-picker/time-available-picker.scss @@ -6,10 +6,9 @@ user-select: none; display: flex; flex-direction: column; - width: 250px; + width: 300px; border-radius: 7px; - -webkit-animation: shadow-drop-bottom 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; - animation: shadow-drop-bottom 0.4s cubic-bezier(0.250, 0.460, 0.450, 0.940) both; + box-sizing: border-box; > .ui-time-header { height: 70px; width: 100%; @@ -34,7 +33,9 @@ } } > .ui-time-selected { - padding-right: 10px; + width: 170px; + display: flex; + place-content: space-around; span { font-size: 1.3em; padding: 5px 15px; @@ -45,16 +46,20 @@ > .ui-time-content { min-height: 180px; display: grid; - grid-template-columns: auto auto auto auto; - grid-template-rows: 50px 50px 50px 50px; + grid-template-rows: repeat(auto-fill, 50px); + grid-auto-flow: row; + grid-gap: 4px; + position: relative; + place-content: center; > .ui-time-item { display: flex; align-items: center; justify-content: center; font-size: 1em; - font-family: Lato; + font-family: "Segoe UI", Lato, 'sans-serif', "Arial"; height: 50px; - span { + .ui-range-wrapper { + display: flex; padding: 5px 10px; transition: background 150ms ease-in-out; border-radius: 3px; diff --git a/projects/truly-ui/src/components/time-available-picker/time-available-picker.ts b/projects/truly-ui/src/components/time-available-picker/time-available-picker.ts index 9e7b725e8..1a47b1576 100644 --- a/projects/truly-ui/src/components/time-available-picker/time-available-picker.ts +++ b/projects/truly-ui/src/components/time-available-picker/time-available-picker.ts @@ -25,10 +25,15 @@ import { } from '@angular/core'; export interface FilterTime { - date: Date; + range: DateRange; selected: boolean; } +export interface DateRange { + start: Date; + end: Date; +} + @Component( { selector: 'tl-time-available-picker', templateUrl: './time-available-picker.html', @@ -36,13 +41,15 @@ export interface FilterTime { } ) export class TlTimeAvailablePicker implements AfterViewInit, OnChanges { - @Input() availableTimes: Array = []; + @Input() availableTimes: Array = []; @Input() color = 'basic'; + @Input() width = 300; + @Input() dateValue: Date = new Date(); - @Input() value: Array = []; + @Input() value: Array = []; @Output() changeSelect: EventEmitter = new EventEmitter(); @@ -53,29 +60,32 @@ export class TlTimeAvailablePicker implements AfterViewInit, OnChanges { constructor( private change: ChangeDetectorRef ) {} ngAfterViewInit() { - this.setUpData(); this.handleValueChange(); } private setUpData() { this.availableTimes.forEach( ( value ) => { - this.filterTimes.push( { date: value, selected: false } ); + this.filterTimes.push( { range: value, selected: false } ); } ); } private handleValueChange() { if ( this.value.length > 0 ) { - this.value.forEach( ( date: Date ) => { - if (this.getDateOnFilter(date) >= 0) { - this.filterTimes[this.getDateOnFilter(date)].selected = true; + this.value.forEach( ( date: DateRange ) => { + const dateFilter = this.getDateOnFilter(date); + if ( dateFilter >= 0) { + this.filterTimes[dateFilter].selected = true; } } ); this.updateTime(); } } - private getDateOnFilter( date ) { - return this.filterTimes.findIndex( ( item: FilterTime ) => item.date.getTime() === date.getTime()); + private getDateOnFilter( date: DateRange ) { + return this.filterTimes.findIndex( ( item: FilterTime ) => + (item.range.start.getTime() === date.start.getTime()) && + (item.range.end.getTime() === date.end.getTime()) + ); } private getSelectedArray() { @@ -109,6 +119,7 @@ export class TlTimeAvailablePicker implements AfterViewInit, OnChanges { } time.selected = !time.selected; this.selectMany( time, readySelected, index ); + } private getFirstIndex( index ) { @@ -144,7 +155,7 @@ export class TlTimeAvailablePicker implements AfterViewInit, OnChanges { this.selectedTime[ 1 ] = allSelected[ allSelected.length - 1 ]; } } - this.changeSelect.emit( this.getSelectedArray().map((item) => item.date) ); + this.changeSelect.emit( this.getSelectedArray().map((item) => item.range) ); this.change.detectChanges(); } diff --git a/projects/truly-ui/src/components/timepicker/timepicker.html b/projects/truly-ui/src/components/timepicker/timepicker.html index f522e44cd..c954d32e5 100644 --- a/projects/truly-ui/src/components/timepicker/timepicker.html +++ b/projects/truly-ui/src/components/timepicker/timepicker.html @@ -2,6 +2,8 @@ -
    +
    {{ selectedTime }} {{ format === '12' ? timeZone : null }}
    -
    -
     
    -
     
    -
     
    +
    AM
    PM
    -
     
    -
     
    -
     
    @@ -101,7 +97,6 @@
    -
    diff --git a/projects/truly-ui/src/components/timepicker/timepicker.scss b/projects/truly-ui/src/components/timepicker/timepicker.scss index 3063b0a37..e51df313a 100644 --- a/projects/truly-ui/src/components/timepicker/timepicker.scss +++ b/projects/truly-ui/src/components/timepicker/timepicker.scss @@ -40,6 +40,7 @@ width: 220px; position: absolute; top: calc(50% - 5px); + z-index: 10; > .double-dot { position: absolute; line-height: 25px; @@ -63,11 +64,14 @@ } > .ui-ampm-content { width: 100%; - display: flex; - justify-content: center; transition: background 200ms linear; + position: relative; > .list { - line-height: 27px; + position: absolute; + overflow: hidden; + transition: top 150ms linear; + height: 60px; + top: calc(50% - 23px); } } diff --git a/projects/truly-ui/src/components/timepicker/timepicker.ts b/projects/truly-ui/src/components/timepicker/timepicker.ts index 1c329f6f4..6575b7cde 100644 --- a/projects/truly-ui/src/components/timepicker/timepicker.ts +++ b/projects/truly-ui/src/components/timepicker/timepicker.ts @@ -30,7 +30,6 @@ import { NG_ASYNC_VALIDATORS, NG_VALIDATORS, NG_VALUE_ACCESSOR, NgModel } from ' import { OverlayAnimation } from '../core/directives/overlay-animation'; import { Subscription } from 'rxjs'; import { I18nService } from '../i18n/i18n.service'; -import { CdkConnectedOverlay } from '@angular/cdk/overlay'; export interface IncrementalSteps { hour: number; @@ -93,8 +92,6 @@ export class TlTimepicker extends ElementBase implements OnInit, AfterCo @ViewChild( 'listAmPm' ) listAmPm: ElementRef; - @ViewChild( CdkConnectedOverlay ) cdkOverlay: CdkConnectedOverlay; - @Output() now: EventEmitter = new EventEmitter(); @Output() changeTime: EventEmitter = new EventEmitter(); @@ -143,7 +140,7 @@ export class TlTimepicker extends ElementBase implements OnInit, AfterCo constructor( @Optional() @Inject( NG_VALIDATORS ) validators: Array, @Optional() @Inject( NG_ASYNC_VALIDATORS ) asyncValidators: Array, - private renderer: Renderer2, private i18n: I18nService ) { + private i18n: I18nService ) { super( validators, asyncValidators ); } @@ -151,13 +148,11 @@ export class TlTimepicker extends ElementBase implements OnInit, AfterCo ngAfterContentInit() { this.handleCreateRing(); - this.listenContainer(); this.formatTime(); } ngAfterViewInit() { this.listenModelChange(); - this.handleOpen(); } handleCreateRing() { @@ -185,24 +180,8 @@ export class TlTimepicker extends ElementBase implements OnInit, AfterCo } } - handleOpen() { - !this.isOpen ? this.setPointerEvents('none') : this.setPointerEvents('auto'); - } - changeOpened() { this.isOpen = !this.isOpen; - this.handleOpen(); - } - - private setPointerEvents( value: string ) { - this.cdkOverlay.overlayRef.overlayElement.style.pointerEvents = value; - } - - private listenContainer() { - this.listeners.add( this.renderer.listen( document, 'click', () => { - this.isOpen = false; - this.handleOpen(); - } ) ); } private listenModelChange() { @@ -252,10 +231,6 @@ export class TlTimepicker extends ElementBase implements OnInit, AfterCo this.formatTime(); } - onScrollAmPm( $event ) { - $event.target.scrollTop >= (this.itemHeight / 2) ? this.timeZone = 'PM' : this.timeZone = 'AM'; - } - onClickCancel() { this.isOpen = false; this.cancel.emit( this.selectedTime ); @@ -274,11 +249,15 @@ export class TlTimepicker extends ElementBase implements OnInit, AfterCo const split = this.cleanValue( $event ).split( ':' ); if ( split[ 0 ].length >= 2 ) { this.hour = this.isFormat12() ? this.leftPad.transform( this.convertToAmPm( split[ 0 ] ), 2 ) : split[ 0 ]; - this.setScrollColumn( this.listHour.nativeElement, TIME.HOUR ); + if (this.listHour) { + this.setScrollColumn( this.listHour.nativeElement, TIME.HOUR ); + } } if ( split[ 1 ].length >= 2 ) { this.minute = split[ 1 ]; - this.setScrollColumn( this.listMinutes.nativeElement, TIME.MINUTE ); + if (this.listMinutes) { + this.setScrollColumn( this.listMinutes.nativeElement, TIME.MINUTE ); + } } } @@ -342,15 +321,11 @@ export class TlTimepicker extends ElementBase implements OnInit, AfterCo } setAm() { - if ( this.listAmPm ) { - this.listAmPm.nativeElement.scrollTop = 0; - } + this.timeZone = 'AM'; } setPm() { - if ( this.listAmPm ) { - this.listAmPm.nativeElement.scrollTop = this.itemHeight * 2; - } + this.timeZone = 'PM'; } private formatTime() { diff --git a/projects/truly-ui/src/components/toaster/parts/model/toaster.ts b/projects/truly-ui/src/components/toaster/parts/model/toaster.ts index 5b046b2c5..b351efe1c 100644 --- a/projects/truly-ui/src/components/toaster/parts/model/toaster.ts +++ b/projects/truly-ui/src/components/toaster/parts/model/toaster.ts @@ -3,7 +3,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/toaster/services/toaster.service.ts b/projects/truly-ui/src/components/toaster/services/toaster.service.ts index 769090600..7313beee9 100644 --- a/projects/truly-ui/src/components/toaster/services/toaster.service.ts +++ b/projects/truly-ui/src/components/toaster/services/toaster.service.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/toaster/toaster-config.ts b/projects/truly-ui/src/components/toaster/toaster-config.ts index fda66ff77..2c29f7e99 100644 --- a/projects/truly-ui/src/components/toaster/toaster-config.ts +++ b/projects/truly-ui/src/components/toaster/toaster-config.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/toaster/toaster-container.ts b/projects/truly-ui/src/components/toaster/toaster-container.ts index fbb65e2af..a3dc16a50 100644 --- a/projects/truly-ui/src/components/toaster/toaster-container.ts +++ b/projects/truly-ui/src/components/toaster/toaster-container.ts @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2017 Temainfo Sistemas + Copyright (c) 2019 Temainfo Sistemas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/projects/truly-ui/src/components/tooltip/directives/tooltip.directive.ts b/projects/truly-ui/src/components/tooltip/directives/tooltip.directive.ts index 2979ed791..a0a2e03d4 100644 --- a/projects/truly-ui/src/components/tooltip/directives/tooltip.directive.ts +++ b/projects/truly-ui/src/components/tooltip/directives/tooltip.directive.ts @@ -1,32 +1,19 @@ import { - ComponentFactoryResolver, Directive, HostListener, Input, OnDestroy, ViewContainerRef, Renderer2 + ComponentFactoryResolver, Directive, HostListener, Input, ViewContainerRef, Renderer2 } from '@angular/core'; import { TlToolTip } from '../tooltip'; import { TooltipOptions } from '../tooltipOptions'; +import { TlToolTipContainer } from '../parts/tooltip-container'; @Directive( { selector: '[tooltip]' } ) -export class TooltipDirective implements OnDestroy { +export class TooltipDirective { @Input() tooltip: TooltipOptions; - private listenerWheel; - - constructor( - private view: ViewContainerRef, - private compiler: ComponentFactoryResolver, - private renderer: Renderer2 - ) { - - if (!this.listenerWheel) { - this.listenerWheel = this.renderer.listen(this.view.element.nativeElement, 'mousewheel', (event) => { - this.hide(); - }); - } - - } + constructor( private view: ViewContainerRef, private compiler: ComponentFactoryResolver ) {} @HostListener( 'mouseenter' ) onMouseEnter() { @@ -38,21 +25,17 @@ export class TooltipDirective implements OnDestroy { this.hide(); } - show() { + private show() { if ( this.tooltip.text !== '' ) { - const componentFactory = this.compiler.resolveComponentFactory( TlToolTip ); + const componentFactory = this.compiler.resolveComponentFactory( TlToolTipContainer ); const componentRef = this.view.createComponent( componentFactory ); - (componentRef.instance).setOptions( this.tooltip ); - (componentRef.instance).setPosition( this.view.element ); + (componentRef.instance).setOptions( this.tooltip ); + (componentRef.instance).setElement( this.view.element ); } } - hide() { + private hide() { this.view.clear(); } - ngOnDestroy() { - this.listenerWheel(); - } - } diff --git a/projects/truly-ui/src/components/tooltip/index.ts b/projects/truly-ui/src/components/tooltip/index.ts index e2dba2235..49d955ee0 100644 --- a/projects/truly-ui/src/components/tooltip/index.ts +++ b/projects/truly-ui/src/components/tooltip/index.ts @@ -3,21 +3,26 @@ import { CommonModule } from '@angular/common'; import { TlToolTip } from './tooltip'; import { TooltipDirective } from './directives/tooltip.directive'; +import { OverlayModule } from '@angular/cdk/overlay'; +import { TlToolTipContainer } from './parts/tooltip-container'; @NgModule( { imports: [ CommonModule, + OverlayModule ], declarations: [ TlToolTip, + TlToolTipContainer, TooltipDirective ], exports: [ TlToolTip, + TlToolTipContainer, TooltipDirective ], entryComponents: [ - TlToolTip + TlToolTipContainer ] } ) export class TooltipModule { diff --git a/projects/truly-ui/src/components/tooltip/parts/tooltip-container.ts b/projects/truly-ui/src/components/tooltip/parts/tooltip-container.ts new file mode 100644 index 000000000..ec2d9d6ed --- /dev/null +++ b/projects/truly-ui/src/components/tooltip/parts/tooltip-container.ts @@ -0,0 +1,130 @@ +import { AfterContentInit, AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core'; +import { transition, trigger, style, animate } from '@angular/animations'; +import { CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay'; +import { TooltipOptions } from '../tooltipOptions'; +import { OverlayAnimation } from '../../core/directives/overlay-animation'; + +@Component( { + selector: 'tl-tooltip-container', + template: ` + + + + `, + animations: [OverlayAnimation], +} ) +export class TlToolTipContainer implements AfterContentInit { + + @ViewChild( 'tooltip' ) tooltip; + + @ViewChild( CdkConnectedOverlay ) connectedOverlay: CdkConnectedOverlay; + + public options: TooltipOptions; + + private element; + + setOptions( options: TooltipOptions ) { + this.options = options; + } + + setElement( element ) { + this.element = element; + } + + ngAfterContentInit() { + this.connectedOverlay.origin = new CdkOverlayOrigin( this.element ); + this.getPositionsByPlacement(); + } + + getPositionsByPlacement() { + const placements = { + 'left-top': () => this.setLeftTop(), + 'left-center' : () => this.setLeftCenter(), + 'left-bottom' : () => this.setLeftBottom(), + 'right-top': () => this.setRightTop(), + 'right-center': () => this.setRightCenter(), + 'right-bottom': () => this.setRightBottom(), + 'top-center': () => this.setTopCenter(), + 'bottom-center': () => this.setBottomCenter() + }; + if (placements[this.options.placement]) { + placements[this.options.placement](); + } + } + + setBottomCenter() { + this.connectedOverlay.positions = [ { + originX: 'center', + originY: 'bottom', + overlayX: 'center', + overlayY: 'top' + } ]; + } + + setTopCenter() { + this.connectedOverlay.positions = [ { + originX: 'center', + originY: 'top', + overlayX: 'center', + overlayY: 'bottom' + } ]; + } + + setRightCenter() { + this.connectedOverlay.positions = [ { + originX: 'end', + originY: 'center', + overlayX: 'start', + overlayY: 'center' + } ]; + } + + setRightTop() { + this.connectedOverlay.positions = [ { + originX: 'end', + originY: 'top', + overlayX: 'start', + overlayY: 'top' + } ]; + } + + setRightBottom() { + this.connectedOverlay.positions = [ { + originX: 'end', + originY: 'bottom', + overlayX: 'start', + overlayY: 'bottom' + } ]; + } + + setLeftBottom() { + this.connectedOverlay.positions = [ { + originX: 'start', + originY: 'bottom', + overlayX: 'end', + overlayY: 'bottom' + } ]; + } + + setLeftTop() { + this.connectedOverlay.positions = [ { + originX: 'start', + originY: 'top', + overlayX: 'end', + overlayY: 'top' + } ]; + } + + setLeftCenter() { + this.connectedOverlay.positions = [ { + originX: 'start', + originY: 'center', + overlayX: 'end', + overlayY: 'center' + } ]; + } + +} diff --git a/projects/truly-ui/src/components/tooltip/tooltip.html b/projects/truly-ui/src/components/tooltip/tooltip.html new file mode 100644 index 000000000..3c8bcb8bb --- /dev/null +++ b/projects/truly-ui/src/components/tooltip/tooltip.html @@ -0,0 +1,9 @@ +
    + {{ options?.text }} +
    +
    + diff --git a/projects/truly-ui/src/components/tooltip/tooltip.scss b/projects/truly-ui/src/components/tooltip/tooltip.scss index e263a0dba..4a9157ba9 100644 --- a/projects/truly-ui/src/components/tooltip/tooltip.scss +++ b/projects/truly-ui/src/components/tooltip/tooltip.scss @@ -1,64 +1,49 @@ -@mixin getMarginAndBorderLeftAndRight { - margin-top: -5px; - border-width: 5px; - border-style: solid; -} - -@mixin getMarginAndBorderTopAndBottom { - margin-left: -5px; - border-width: 5px; - border-style: solid; -} - -@mixin getPositionArrowRightLeft { - content: " "; - position: absolute; - top: 50%; - right: 100%; -} - .tooltip-text { - position: fixed; padding: 5px; color: #FFF; display: inline-block; - z-index: 10000; + z-index: 1; border-radius: 3px; - width: 120px; + width: 180px; height: initial; text-align: center; + margin: 5px; word-wrap: break-word; - background-color: #818383; - font-size: 12px !important; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important; + background-color: #242525; + font-size: 1em !important; + font-family: Lato, "Segoe UI", "Helvetica"; - > .-right { - @include getPositionArrowRightLeft; - @include getMarginAndBorderLeftAndRight; + .arrow { + position: absolute; + box-sizing: border-box; + height: 10px; + width: 10px; + border-style: solid; + border-color: #242525; + border-width: 0px 6px 6px 0px; } - > .-left { - content: " "; - position: absolute; - top: 50%; - left: 100%; - @include getMarginAndBorderLeftAndRight; + .left { + right: 0 !important; + transform: rotate(-45deg) !important; + top: calc(50% - 5px) !important; } - > .-top { - content: " "; - position: absolute; - top: 100%; - left: 50%; - @include getMarginAndBorderTopAndBottom; + .right { + transform: rotate(135deg); + top: calc(50% - 5px); + left: 0; } - > .-bottom { - content: " "; - position: absolute; - bottom: 100%; - left: 50%; - @include getMarginAndBorderTopAndBottom; + .bottom { + transform: rotate(-135deg); + top: 0; + left: calc(50% - 5px); + } + + .top { + transform: rotate(45deg); + left: calc(50% - 5px); } } diff --git a/projects/truly-ui/src/components/tooltip/tooltip.ts b/projects/truly-ui/src/components/tooltip/tooltip.ts index 566066479..89c4f80ad 100644 --- a/projects/truly-ui/src/components/tooltip/tooltip.ts +++ b/projects/truly-ui/src/components/tooltip/tooltip.ts @@ -1,197 +1,29 @@ -import { Component, ElementRef, ViewChild } from '@angular/core'; +import { AfterContentInit, Input, Component, ElementRef, ViewChild } from '@angular/core'; import { TooltipOptions } from './tooltipOptions'; -import { transition, trigger, style, animate } from '@angular/animations'; +import { OverlayAnimation } from '../core/directives/overlay-animation'; @Component( { - selector: 'tl-tooltip', - template: ` -
    {{text}} -
    -
    `, - styleUrls: [ './tooltip.scss' ], - animations: [ - trigger( - 'enterAnimation', [ - transition( ':enter', [ - style( { opacity: 0 } ), - animate( '200ms', style( { opacity: 1 } ) ) - ] ), - transition( ':leave', [ - style( { opacity: 1 } ), - animate( '200ms', style( { opacity: 0 } ) ) - ] ) - ] - ) - ], + selector: 'tl-tooltip', + templateUrl: './tooltip.html', + styleUrls: [ './tooltip.scss' ], + animations: [ OverlayAnimation ], } ) -export class TlToolTip implements TooltipOptions { +export class TlToolTip { - @ViewChild( 'tooltip' ) tooltip; + @Input() options: TooltipOptions; - public text: string; - - public color = '#000'; - - public placement = 'top'; - - public fontColor = '#FFF'; - - public width = ''; - - public show = true; - - private tooltipWidth = 0; - - private elementWidth = 0; - - private elementHeight = 0; - - private tooltipPadding = 10; - - private element; - - setOptions( options: TooltipOptions ) { - const self = this; - Object.keys( options ).forEach( function ( key ) { - self[ key ] = options[ key ]; - } ); - } - - setPlacementTop() { - const self = this; - this.getElementWidth(); - this.getElementHeight(); - setTimeout( function () { - self.getTopMeasureForTopTooltip(); - self.setAlignCenter(); - }, 0 ); - - } - - setPlacementLeft() { - const self = this; - setTimeout( function () { - self.getTopMeasureForLeftAndRight(); - self.setAlignLeft(); - }, 0 ); - } - - setPlacementRight() { - const self = this; - this.getElementWidth(); - setTimeout( function () { - self.getTopMeasureForLeftAndRight(); - self.setAlignRight(); - }, 0 ); + getClassByPlacement() { + if ( this.options.placement.includes( 'left' ) ) { + return 'left'; } - - setPlacementBottom() { - const self = this; - this.getElementWidth(); - this.getElementHeight(); - setTimeout( function () { - self.setTopMeasureForBottom(); - self.setAlignCenter(); - }, 0 ); - } - - getStyleTooltip() { - return { 'background-color': this.color, 'color': this.fontColor, 'width': this.width }; + if ( this.options.placement.includes( 'right' ) ) { + return 'right'; } - - getStyleTooltipArrow() { - switch ( this.placement ) { - case 'right': - return { - 'border-color': 'transparent ' + this.color + ' transparent transparent' - }; - case 'left': - return { - 'border-color': 'transparent transparent transparent' + this.color - }; - case 'top': - return { - 'border-color': this.color + ' transparent transparent transparent' - }; - case 'bottom': - return { - 'border-color': 'transparent transparent ' + this.color + ' transparent' - }; - } - } - - setPosition( element: ElementRef ) { - this.getElement( element ); - switch ( this.placement ) { - case 'top': - this.setPlacementTop(); - break; - case 'left': - this.setPlacementLeft(); - break; - case 'right': - this.setPlacementRight(); - break; - case 'bottom': - this.setPlacementBottom(); - break; - } + if ( this.options.placement.includes( 'top' ) ) { + return 'top'; } - - private getElement( element ) { - this.element = element; - } - - private existsMeasureOnNativeElement(): boolean { - return this.element.nativeElement.offsetWidth > 0 && this.element.nativeElement.offsetHeight > 0; - } - - private isLessOrEqualThanNormalWidth(): boolean { - return this.tooltip.nativeElement.offsetHeight <= 27; - } - - private getElementWidth() { - this.existsMeasureOnNativeElement() ? this.elementWidth = this.element.nativeElement.offsetWidth - : this.elementWidth = this.element.nativeElement.firstChild.clientWidth; - } - - private getTopMeasureForTopTooltip() { - this.tooltip.nativeElement.style.top = this.getElementTop() - - this.tooltip.nativeElement.offsetHeight - this.tooltipPadding + 'px'; - } - - private getTopMeasureForLeftAndRight() { - this.tooltip.nativeElement.style.top = - this.getElementTop() + (this.element.nativeElement.offsetHeight / 2) - - (this.tooltip.nativeElement.offsetHeight / 2) + 'px'; - } - - private getElementHeight() { - this.existsMeasureOnNativeElement() ? this.elementHeight = this.element.nativeElement.offsetHeight : - this.elementHeight = this.element.nativeElement.firstChild.clientHeight; - } - - private setTopMeasureForBottom() { - this.tooltip.nativeElement.style.top = - this.getElementTop() + this.elementHeight + this.tooltipPadding + 'px'; - } - - private setAlignCenter() { - this.tooltip.nativeElement.style.left = this.element.nativeElement.getBoundingClientRect().left + - (this.elementWidth / 2) - this.tooltip.nativeElement.offsetWidth / 2 + 'px'; - } - - private setAlignRight() { - this.tooltip.nativeElement.style.left = this.element.nativeElement.getBoundingClientRect().left + - this.elementWidth + this.tooltipPadding + 'px'; - } - - private setAlignLeft() { - this.tooltip.nativeElement.style.left = this.element.nativeElement.getBoundingClientRect().left - - this.tooltip.nativeElement.offsetWidth + 'px'; - } - - private getElementTop() { - return this.element.nativeElement.getBoundingClientRect().top; + if ( this.options.placement.includes( 'bottom' ) ) { + return 'bottom'; } + } } diff --git a/projects/truly-ui/src/components/tooltip/tooltipOptions.ts b/projects/truly-ui/src/components/tooltip/tooltipOptions.ts index 1c50b0fed..eacda5eb2 100644 --- a/projects/truly-ui/src/components/tooltip/tooltipOptions.ts +++ b/projects/truly-ui/src/components/tooltip/tooltipOptions.ts @@ -22,7 +22,7 @@ export interface TooltipOptions { text: string; color?: string; - placement?: string; + placement?: 'left-top' | 'left-center' | 'left-bottom' | 'right-top' | 'right-center' | 'right-bottom' | 'top-center' | 'bottom-center'; fontColor?: string; width?: string; } diff --git a/projects/truly-ui/src/public_api.ts b/projects/truly-ui/src/public_api.ts index 81e5ff99c..9be4a4651 100644 --- a/projects/truly-ui/src/public_api.ts +++ b/projects/truly-ui/src/public_api.ts @@ -1,4 +1,6 @@ // Modules +import { SlotSettingsType } from './components/schedule/types/slot-settings.type'; + export { AccordionModule } from './components/accordion/index'; export { AutoCompleteModule } from './components/autocomplete/index'; export { AvatarModule } from './components/avatar/index'; @@ -6,6 +8,7 @@ export { BadgeModule } from './components/badge/index'; export { ButtonModule } from './components/button/index'; export { ButtonGroupModule } from './components/buttongroup/index'; export { BlockUIModule } from './components/blockui/index'; +export { CardModule } from './components/card/index'; export { CheckBoxModule } from './components/checkbox/index'; export { ChatListModule } from './components/chatlist/index'; export { CalendarModule } from './components/calendar/index'; @@ -53,7 +56,6 @@ export { TooltipModule } from './components/tooltip/index'; export { ClockPickerModule } from './components/clockpicker/index'; export { ValidatorsModule } from './components/validators/index'; - // Dialog Interfaces export { InfoOptions } from './components/dialog/dialog-info/info-options'; export { ErrorOptions } from './components/dialog/dialog-error/error-options'; @@ -64,6 +66,7 @@ export { ConfirmationOptions } from './components/dialog/dialog-confirmation/con export { ModalOptions, Modal } from './components/modal/interfaces/modal-options'; export { ModalFormConfig } from './components/modal/interfaces/modal-smart-form-config'; export { ToasterConfig } from './components/toaster/toaster-config'; +export { CalendarStatus } from './components/calendar/calendar'; export { IncrementalSteps } from './components/timepicker/timepicker'; export { PermissionDataConfig } from './components/permissions/parts/interfaces/permission-dataconfig.interface'; @@ -82,6 +85,13 @@ export { ToasterService } from './components/toaster/services/toaster.service'; // Classes export { Permission } from './components/permissions/parts/models/permission.model'; +// Types +export { ScheduleDataSource } from './components/schedule/types/datasource.type'; +export { SlotSettingsType } from './components/schedule/types/slot-settings.type'; +export { StatusType } from './components/schedule/types/status.type'; +export { ViewType } from './components/schedule/types/view.type'; +export { WorkScaleType } from './components/schedule/types/work-scale.type'; + // Languages export { I18nService } from './components/i18n/i18n.service'; export { I18nInterface } from './components/i18n/i18n.interface'; diff --git a/src/app/app.component.html b/src/app/app.component.html index bf6e87745..f2ae18afa 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -439,6 +439,11 @@
    + +
    +
    With Status
    + +
    + +
    +
    diff --git a/src/app/components/calendar/calendardemo.component.ts b/src/app/components/calendar/calendardemo.component.ts index 38f8d3ac8..b6e5c2984 100644 --- a/src/app/components/calendar/calendardemo.component.ts +++ b/src/app/components/calendar/calendardemo.component.ts @@ -25,9 +25,9 @@ import * as json from './calendardemo-dataproperties.json'; import * as jsonEvts from './calendardemo.dataevents.json'; @Component( { - selector : 'app-calendar', - templateUrl : './calendardemo.component.html', - styleUrls : [ './calendardemo.component.scss' ] + selector: 'app-calendar', + templateUrl: './calendardemo.component.html', + styleUrls: [ './calendardemo.component.scss' ] } ) export class CalendarDemoComponent { @@ -35,13 +35,25 @@ export class CalendarDemoComponent { public dataEvents; + public month = new Date().getMonth(); + + public day = new Date().getDate(); + + public year = new Date().getFullYear(); + + public status = [ + { id: '1', date: new Date( this.year, this.month, this.day + 3 ), total: 50, current: 15 }, + { id: '2', date: new Date( this.year, this.month, this.day + 5 ), total: 50, current: 40 }, + { id: '3', date: new Date( this.year, this.month, this.day + 10 ), total: 50, current: 10 }, + ]; + constructor() { this.dataTableProperties = json.dataProperties; this.dataEvents = jsonEvts.dataEvents; } - onSelect($event) { - console.log($event); + onSelect( $event ) { + console.log( $event ); } } diff --git a/src/app/components/card/carddemo-dataproperties.json.ts b/src/app/components/card/carddemo-dataproperties.json.ts new file mode 100644 index 000000000..6ffc02ef3 --- /dev/null +++ b/src/app/components/card/carddemo-dataproperties.json.ts @@ -0,0 +1,30 @@ +/* + MIT License + + Copyright (c) 2018 Temainfo Software + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ +export const dataProperties = [ + { + name: 'text', + type: 'string', + default: 'null', + description: 'Displays a text.', + options: 'any text' + }, +]; diff --git a/src/app/components/card/carddemo-routing.module.ts b/src/app/components/card/carddemo-routing.module.ts new file mode 100644 index 000000000..0e4eba9bc --- /dev/null +++ b/src/app/components/card/carddemo-routing.module.ts @@ -0,0 +1,37 @@ +/* +MIT License + +Copyright (c) 2018 Temainfo Software + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +import { CardDemoComponent } from './carddemo.component'; + +@NgModule({ + imports: [ + RouterModule.forChild( [ + { path: '', component: CardDemoComponent } + ]) + ], + exports: [ + RouterModule + ] +}) +export class CardDemoRoutingModule {} diff --git a/src/app/components/card/carddemo.component.html b/src/app/components/card/carddemo.component.html new file mode 100644 index 000000000..5e4356790 --- /dev/null +++ b/src/app/components/card/carddemo.component.html @@ -0,0 +1,69 @@ +
    + + The Truly-UI Card are styles for actions in forms, dialogs, and more with support for multiple sizes, states + and many properties for customization + +
    +
    +
    + + +
    +
    Basic
    + + +
    + +
    +
    + William Aguera + Developer +
    +
    + heart +
    +
    +
    + +
    + RG + 12.575.659.12-2 +
    +
    + CPF + 078.880.369-70 +
    +
    + Data Nascimento + 22/05/1994 +
    +
    + Estado Civil + Solteiro +
    +
    + Genero + Masculino +
    +
    + + + +
    +
    +
    +
    +
    +
    + + + + + + + + + + +
    +
    diff --git a/src/app/components/card/carddemo.component.scss b/src/app/components/card/carddemo.component.scss new file mode 100644 index 000000000..2620f3c61 --- /dev/null +++ b/src/app/components/card/carddemo.component.scss @@ -0,0 +1,67 @@ +.header { + padding: 20px; + align-items: center; + place-content: flex-start; + display: flex; + background: #11998e; + background: -webkit-linear-gradient(to right, #11998e, #66cc99); + background: linear-gradient(to right, #11998e, #66cc99); +} + +.ui-icons { + position: absolute; + right: 20px; + top: 20px; + color: #609280; + font-size: 1.5em; +} +.ui-img-pulse { + position: absolute; + display: flex; + width: 80px; + height: 80px; + border-radius: 50%; + border: 7px solid #fff; + align-items: center; + place-content: center; + opacity: 0; + animation: infinitePulse 1s infinite; + animation-direction: alternate; +} +.ui-card-img { + width: 80px; + height: 80px; + border-radius: 50%; + border: 3px solid #ffffff59; +} +.ui-info { + display: flex; + flex-flow: column; + padding: 0 10px; + color: #fff; + span { + &:first-child { + font-weight: 600; + font-size: 18px; + } + } +} +.ui-info-item { + display: flex; + align-items: center; + place-content: space-between; + padding: 5px 0; + border-bottom: 1px dashed #6c9; + span { + &:first-child { + font-weight: 600; + color: #8c8989; + } + &:last-child { + font-size: 16px; + font-weight: 600; + color: #505050; + } + } +} + diff --git a/src/app/components/card/carddemo.component.ts b/src/app/components/card/carddemo.component.ts new file mode 100644 index 000000000..05e646b09 --- /dev/null +++ b/src/app/components/card/carddemo.component.ts @@ -0,0 +1,43 @@ +/* + MIT License + + Copyright (c) 2018 Temainfo Software + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ +import { Component } from '@angular/core'; + +import * as json from './carddemo-dataproperties.json'; +import * as jsonEvts from './carddemo.dataevents.json'; + +@Component( { +selector : 'app-card-demo', +templateUrl : './carddemo.component.html', +styleUrls : [ './carddemo.component.scss' ], +} ) +export class CardDemoComponent { + + public dataTableProperties; + + public dataEvents; + + constructor() { + this.dataTableProperties = json.dataProperties; + this.dataEvents = jsonEvts.dataEvents; + } +} + diff --git a/src/app/components/card/carddemo.dataevents.json.ts b/src/app/components/card/carddemo.dataevents.json.ts new file mode 100644 index 000000000..8b207f93c --- /dev/null +++ b/src/app/components/card/carddemo.dataevents.json.ts @@ -0,0 +1,33 @@ +/* + MIT License + + Copyright (c) 2018 Temainfo Software + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ +export const dataEvents = [ + { + name: 'selected', + parameters: [ + { + event: 'selected', + description: 'Action Selected' + } + ], + description: 'Callback to invoke when toogle event.', + }, +]; diff --git a/src/app/components/card/carddemo.module.ts b/src/app/components/card/carddemo.module.ts new file mode 100644 index 000000000..e7d14051c --- /dev/null +++ b/src/app/components/card/carddemo.module.ts @@ -0,0 +1,36 @@ +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { NgModule } from '@angular/core'; + +import { HighlightJsModule } from 'ngx-highlight-js'; + +import { CardDemoRoutingModule } from './carddemo-routing.module'; +import { CardDemoComponent } from './carddemo.component'; +import { CardModule } from '../../../../projects/truly-ui/src/components/card'; +import { ShowcaseCardModule } from '../../shared/components/showcase-card/showcase-card.module'; +import { ShowcaseTablePropertiesModule } from '../../shared/components/showcase-table-properties/showcase-table-properties.module'; +import { ShowcaseTableEventsModule } from '../../shared/components/showcase-table-events/showcase-table-events.module'; +import { ShowcaseHeaderModule } from '../../shared/components/showcase-header/showcase-header.module'; +import { IconsModule } from '../../../../projects/truly-ui/src/components/icons/index'; + +@NgModule({ + declarations: [ + CardDemoComponent + ], + imports: [ + CardDemoRoutingModule, + CardModule, + CommonModule, + IconsModule, + FormsModule, + HighlightJsModule, + ShowcaseCardModule, + ShowcaseTablePropertiesModule, + ShowcaseTableEventsModule, + ShowcaseHeaderModule + ], + exports: [ + CardDemoComponent + ] +}) +export class CardDemoModule {} diff --git a/src/app/components/datepicker/datepickerdemo-dataproperties.json.ts b/src/app/components/datepicker/datepickerdemo-dataproperties.json.ts index 308e44606..01430ccba 100644 --- a/src/app/components/datepicker/datepickerdemo-dataproperties.json.ts +++ b/src/app/components/datepicker/datepickerdemo-dataproperties.json.ts @@ -34,6 +34,13 @@ export const dataProperties = [ description: 'Create a label together with Input Element', options: 'any text' }, + { + name: 'formatDate', + type: 'string', + default: 'dd.mm.yyyy', + description: 'The format of date', + options: 'dd.mm.yyyy | mm.dd.yyyy | yyyy.mm.dd' + }, { name: 'labelSize', type: 'string', diff --git a/src/app/components/dropdownlist/dropdownlistdemo-dataevents.json.ts b/src/app/components/dropdownlist/dropdownlistdemo-dataevents.json.ts new file mode 100644 index 000000000..f68ef4d93 --- /dev/null +++ b/src/app/components/dropdownlist/dropdownlistdemo-dataevents.json.ts @@ -0,0 +1,6 @@ +export const dataProperties = [ + { + name: 'selectItem', + description: 'Dispatched when items is selected.', + }, +]; diff --git a/src/app/components/dropdownlist/dropdownlistdemo-dataproperties.json.ts b/src/app/components/dropdownlist/dropdownlistdemo-dataproperties.json.ts index 281a4e077..2fe186175 100644 --- a/src/app/components/dropdownlist/dropdownlistdemo-dataproperties.json.ts +++ b/src/app/components/dropdownlist/dropdownlistdemo-dataproperties.json.ts @@ -9,17 +9,40 @@ export const dataProperties = [ { name: 'keyText', type: 'string', - default: 'text', + default: 'null', description: 'Sets the data item field that represents the item text.', options: 'any text' }, + { + name: 'identifier', + type: 'string', + default: 'null', + description: 'String key used to compare values when model mode is string.', + options: 'any text' + }, + { + name: 'modelMode', + type: 'string', + default: 'object', + description: 'Operating mode of model values, some servers uses ID hash of value' + + ' fields and others the object itself. The model mode is used to compare value of models' + + ' with dropdown dataSource when angular is loading the form values.', + options: 'string | object' + }, { name: 'keyValue', type: 'string', - default: 'value', + default: 'null', description: 'Sets the data item field that represents the item value.', options: 'any text' }, + { + name: 'groupBy', + type: 'string', + default: 'null', + description: 'Key that would be used to group items', + options: 'any text' + }, { name: 'icon', type: 'string', @@ -44,7 +67,7 @@ export const dataProperties = [ { name: 'labelSize', type: 'string', - default: '100', + default: '100px', description: 'Sets the label width.', options: 'px | % | em' }, @@ -65,7 +88,7 @@ export const dataProperties = [ { name: 'width', type: 'string', - default: '87px', + default: '120px', description: 'Sets the width of Dropdown List.', options: 'px | % | em' }, @@ -76,10 +99,24 @@ export const dataProperties = [ description: 'Handle if will have input search or not', options: 'true | false' }, + { + name: 'defaultOption', + type: 'boolean', + default: 'false', + description: 'Handle if will have the null option', + options: 'true | false' + }, + { + name: 'debounceTime', + type: 'boolean', + default: '200', + description: 'Delay of time used on searching', + options: 'number' + }, { name: 'placeholder', type: 'string', - default: 'null', + default: 'Select item', description: 'Display a help text on dropdown list.', options: 'any text' }, diff --git a/src/app/components/dropdownlist/dropdownlistdemo.component.html b/src/app/components/dropdownlist/dropdownlistdemo.component.html index 191e6d9c6..96cec819e 100644 --- a/src/app/components/dropdownlist/dropdownlistdemo.component.html +++ b/src/app/components/dropdownlist/dropdownlistdemo.component.html @@ -87,7 +87,7 @@
    Placeholder
    Label
    Label
    -
    Height
    +
    Custom Height
    Height
    -
    Width + Filter
    +
    Custom Width + Filter
    @@ -170,9 +171,10 @@
    Required
    +
    +
    + +
    +
    GroupBy
    + + +
    + +
    +
    +
    Custom With Icon
    + + +
    +
    @@ -208,18 +251,14 @@
    Simple Data
    -

    Use DropdownList As Simple Array

    +
    Use DropdownList As Simple Array
    There's TWO ways to use DropdownList, the first one is using an Simple Array of Objects, passing only the data that you want to. For Example:

    -

    Use DropdownList As Complex Array

    +
    Use DropdownList As Complex Array
    The other one is a Complex Array of Objects where you must pass a pattern to the component.
    Note: The Keys inside those objects can be custom, referenced through the properties.
    Placement Bottom
    - +
    -
    Placement Right
    - +
    -
    Placement Left
    - +
    Custom Background Color
    - - +
    Custom Font Color
    - +
    diff --git a/src/app/getting-started/getting-started.component.html b/src/app/getting-started/getting-started.component.html index e0b147415..438a2edec 100644 --- a/src/app/getting-started/getting-started.component.html +++ b/src/app/getting-started/getting-started.component.html @@ -35,7 +35,7 @@

    Installation

    Inside the angular.json file add the following paths to the styles key